index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="10">
  4. <!--机构数据-->
  5. <!-- <el-col :span="4" :xs="24">
  6. <org-tree
  7. v-model="queryParams.orgId"
  8. @defaultOrg="getDefaultOrg"
  9. @checkChange="checkChange"
  10. @click="clickTreeNode"
  11. ></org-tree>
  12. </el-col> -->
  13. <el-col :span="24" :xs="24">
  14. <div class="main-right-box">
  15. <!-- 搜索条件 -->
  16. <div class="main-search-box">
  17. <el-form
  18. :model="queryParams"
  19. ref="search"
  20. size="small"
  21. :inline="true"
  22. v-show="showSearch"
  23. >
  24. <el-form-item label="所属机构">
  25. <org-tree
  26. v-model="queryParams.orgId"
  27. @defaultOrg="getDefaultOrg"
  28. @checkChange="checkChange"
  29. @click="clickTreeNode"
  30. ref="orgTree"
  31. ></org-tree>
  32. </el-form-item>
  33. <el-form-item prop="key" label="报警控制器名称">
  34. <el-input
  35. v-model="queryParams.key"
  36. :maxlength="50"
  37. placeholder="请输入报警控制器名称"
  38. clearable
  39. />
  40. </el-form-item>
  41. <el-form-item prop="status" label="报警控制器状态">
  42. <el-select
  43. label="报警控制器状态"
  44. v-model="queryParams.status"
  45. placeholder="请选择报警控制器状态"
  46. clearable
  47. >
  48. <el-option
  49. v-for="dict in dict.type.protection_status"
  50. :key="dict.value"
  51. :label="dict.label"
  52. :value="dict.value"
  53. />
  54. </el-select>
  55. </el-form-item>
  56. <el-form-item prop="dateRange" label="布撤防登记时间">
  57. <DataRangePicker
  58. v-model="queryParams.dateRange"
  59. key="daterange"
  60. type="daterange"
  61. range-separator="至"
  62. start-placeholder="开始日期"
  63. end-placeholder="结束日期"
  64. >
  65. </DataRangePicker>
  66. </el-form-item>
  67. </el-form>
  68. <!-- 按纽 -->
  69. <el-row :gutter="10">
  70. <el-col :span="1.5">
  71. <el-button
  72. type="primary"
  73. icon="el-icon-search"
  74. size="mini"
  75. @click="getList"
  76. v-hasPermi="['device:protection']"
  77. >搜索</el-button
  78. >
  79. <el-button
  80. type="primary"
  81. icon="el-icon-refresh"
  82. size="mini"
  83. @click="resetQuery"
  84. >重置</el-button
  85. >
  86. <!-- <el-button
  87. type="primary"
  88. icon="el-icon-plus"
  89. size="mini"
  90. @click="handleAdd()"
  91. v-hasPermi="['device:protection:add']"
  92. >新增</el-button
  93. > -->
  94. <el-button
  95. type="primary"
  96. icon="el-icon-download"
  97. size="mini"
  98. @click="handleExport()"
  99. v-hasPermi="['device:protection']"
  100. >导出数据</el-button
  101. >
  102. </el-col>
  103. <right-toolbar
  104. :showSearch.sync="showSearch"
  105. @queryTable="getList"
  106. ></right-toolbar>
  107. </el-row>
  108. </div>
  109. <el-table
  110. size="small"
  111. border
  112. v-loading="loading"
  113. :data="pageData"
  114. @selection-change="handleSelectionChange"
  115. height="594"
  116. >
  117. <el-table-column
  118. align="center"
  119. type="index"
  120. label="序号"
  121. width="60"
  122. v-if="columns[0].visible"
  123. >
  124. <template slot-scope="scope">
  125. {{
  126. (queryParams.pageNum - 1) * queryParams.pageSize +
  127. scope.$index +
  128. 1
  129. }}
  130. </template>
  131. </el-table-column>
  132. <el-table-column
  133. align="center"
  134. prop="affiliatedArea"
  135. label="地区"
  136. v-if="columns[6].visible"
  137. ></el-table-column>
  138. <el-table-column
  139. align="center"
  140. prop="affiliatedBank"
  141. label="行社名称"
  142. v-if="columns[7].visible"
  143. ></el-table-column>
  144. <el-table-column
  145. align="center"
  146. prop="orgName"
  147. label="所属机构"
  148. v-if="columns[1].visible"
  149. ></el-table-column>
  150. <el-table-column
  151. align="center"
  152. prop="name"
  153. label="报警控制器名称"
  154. show-overflow-tooltip
  155. v-if="columns[2].visible"
  156. >
  157. </el-table-column>
  158. <el-table-column
  159. align="center"
  160. prop="status"
  161. label="报警控制器状态"
  162. width="150"
  163. v-if="columns[3].visible"
  164. >
  165. <template slot-scope="r"
  166. >{{
  167. getLabel(dict.type.protection_status, r.row.status, "未知")
  168. }}
  169. </template>
  170. </el-table-column>
  171. <el-table-column
  172. align="center"
  173. prop="statusUpdatorName"
  174. label="登记人/数据来源"
  175. show-overflow-tooltip
  176. width="150"
  177. >
  178. <template slot-scope="{row}">
  179. <div>
  180. {{ row.statusUpdatorName||'自动获取' }}
  181. </div>
  182. </template>
  183. </el-table-column>
  184. <el-table-column
  185. align="center"
  186. prop="statusUpdateTime"
  187. label="最近登记时间"
  188. width="150"
  189. v-if="columns[5].visible"
  190. >
  191. </el-table-column>
  192. <el-table-column
  193. align="center"
  194. prop="statusUpdateTime"
  195. label="布撤防登记时间"
  196. width="150"
  197. v-if="columns[5].visible"
  198. >
  199. </el-table-column>
  200. <el-table-column align="center" label="操作">
  201. <template slot-scope="r">
  202. <!-- <el-button
  203. size="mini"
  204. type="text"
  205. icon="el-icon-edit-outline"
  206. @click="updateStatus(r.row.id, 1)"
  207. v-hasPermi="['device:protectionstatus:maintain']"
  208. >布防</el-button
  209. >
  210. <el-button
  211. size="mini"
  212. type="text"
  213. icon="el-icon-edit-outline"
  214. @click="updateStatus(r.row.id, 0)"
  215. v-hasPermi="['device:protectionstatus:maintain']"
  216. >撤防</el-button
  217. > -->
  218. <!-- <el-button
  219. size="mini"
  220. type="text"
  221. icon="el-icon-edit-outline"
  222. @click="onEdit(r.row.id)"
  223. v-hasPermi="['device:protection:edit']"
  224. >编辑</el-button
  225. > -->
  226. <el-button
  227. size="mini"
  228. type="text"
  229. icon="el-icon-document-copy"
  230. @click="onHistory(r.row)"
  231. v-hasPermi="['device:protection']"
  232. >布撤防历史</el-button
  233. >
  234. <!-- <el-popconfirm
  235. @confirm="onDel(r.row.id)"
  236. title="点击确定删除报警控制器"
  237. >
  238. <el-button
  239. size="mini"
  240. type="text"
  241. icon="el-icon-delete"
  242. v-hasPermi="['device:protection:remove']"
  243. slot="reference"
  244. >删除</el-button
  245. >
  246. </el-popconfirm> -->
  247. </template>
  248. </el-table-column>
  249. </el-table>
  250. <pagination
  251. v-show="total > 0"
  252. :total="total"
  253. :page.sync="queryParams.pageNum"
  254. :limit.sync="queryParams.pageSize"
  255. @pagination="getList"
  256. />
  257. </div>
  258. </el-col>
  259. </el-row>
  260. <dialog-edit
  261. ref="editDialog"
  262. @success="getList()"
  263. :orgTypeOptions="dict.type.sys_org_type"
  264. :ruleTypeOptions="dict.type.rule_type"
  265. ></dialog-edit>
  266. <dialog-history
  267. ref="historyDialog"
  268. :statusDict="dict.type.protection_status"
  269. ></dialog-history>
  270. </div>
  271. </template>
  272. <script>
  273. // import OrgTree from "@/components/orgTree";
  274. import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
  275. import DialogEdit from "./dialog.edit";
  276. import DialogHistory from "./dialog.history";
  277. import * as api from "@/api/resumption/protection";
  278. import { getLabel } from "@/views/commonOption.js";
  279. import { mapGetters } from "vuex";
  280. import dayjs from "dayjs";
  281. import DataRangePicker from "@/components/dateTime/daterange.picker.vue";
  282. export default {
  283. name: "protection",
  284. dicts: ["protection_status"],
  285. components: {
  286. DialogEdit,
  287. OrgTree,
  288. DialogHistory,
  289. DataRangePicker,
  290. },
  291. data() {
  292. const { params, query } = this.$route;
  293. return {
  294. isShow: false,
  295. loading: false,
  296. ids: [],
  297. // 非单个禁用
  298. single: true,
  299. // 非多个禁用
  300. multiple: true,
  301. // 显示搜索条件
  302. showSearch: true,
  303. total: 0,
  304. selectedOrgName: null,
  305. queryParams: {
  306. orgId: null,
  307. checkSub: true,
  308. key: null,
  309. status: null,
  310. dateRange: null,
  311. pageNum: 1,
  312. pageSize: 10,
  313. ...query,
  314. },
  315. pageData: [],
  316. // 列信息
  317. columns: [
  318. { key: 0, label: `序号`, visible: true },
  319. { key: 1, label: `所属机构`, visible: true },
  320. { key: 2, label: `报警控制器名称`, visible: true },
  321. { key: 3, label: `报警控制器状态`, visible: true },
  322. { key: 4, label: `登记人`, visible: true },
  323. { key: 5, label: `最近登记时间`, visible: true },
  324. { key: 6, label: `地区`, visible: true },
  325. { key: 7, label: `行社名称`, visible: true },
  326. ],
  327. };
  328. },
  329. props: {},
  330. watch: {},
  331. computed: {
  332. ...mapGetters(["orgId", "orgName"]),
  333. },
  334. methods: {
  335. getLabel,
  336. getList() {
  337. this.loading = true;
  338. this.pageData = [];
  339. api
  340. .list(this.queryParams)
  341. .then((response) => {
  342. this.pageData = response.rows;
  343. this.total = response.total;
  344. this.loading = false;
  345. })
  346. .catch(() => {
  347. this.loading = false;
  348. });
  349. },
  350. handleAdd(id, other = {}) {
  351. this.$refs.editDialog.show(id, other);
  352. },
  353. handleExport() {
  354. if (this.total == 0) {
  355. this.$message.error({
  356. message: `无可用数据导出!`,
  357. type: "error",
  358. duration: 2000,
  359. });
  360. return;
  361. }
  362. if (this.total>50000){
  363. this.$modal.alert("导出数据超过5万条,请缩小查询范围后重试");
  364. return;
  365. }
  366. this.download(
  367. "/core/resumption/protection/export",
  368. {
  369. ...this.queryParams,
  370. },
  371. `${this.selectedOrgName}-布撤防情况跟踪-${dayjs(new Date()).format(
  372. "YYYYMMDD"
  373. )}.xlsx`
  374. );
  375. },
  376. onEdit(id, other = {}) {
  377. this.$refs.editDialog.show(id, other);
  378. },
  379. onHistory(row) {
  380. this.$refs.historyDialog.show(row);
  381. },
  382. async onDel(id) {
  383. let b = (await api.del(id)).data;
  384. if (b) {
  385. this.$message.info("删除成功");
  386. }
  387. this.getList();
  388. },
  389. updateStatus(id, status) {
  390. api.updateStatus(id, status).then((r) => {
  391. this.$message.info("更新状态成功");
  392. this.getList();
  393. });
  394. },
  395. // 多选框选中数据
  396. handleSelectionChange(selection) {
  397. this.ids = selection.map((item) => item.userId);
  398. this.single = selection.length != 1;
  399. this.multiple = !selection.length;
  400. },
  401. /** 重置按钮操作 */
  402. resetQuery() {
  403. this.resetForm("search");
  404. this.queryParams.dateRange = null;
  405. this.queryParams.orgId = this.orgId;
  406. this.selectedOrgName = this.orgName;
  407. this.queryParams.checkSub = true;
  408. this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub);
  409. // this.queryParams.orgId = undefined;
  410. // this.$refs.tree.setCurrentKey(null);
  411. this.getList();
  412. },
  413. //单选框状态改变
  414. checkChange(state) {
  415. this.queryParams.checkSub = state;
  416. this.getList();
  417. },
  418. getDefaultOrg(node) {
  419. this.queryParams.orgId = node.id;
  420. this.selectedOrgName = node.shortName;
  421. this.getList();
  422. },
  423. // 节点单击事件
  424. clickTreeNode(data) {
  425. this.queryParams.orgId = data.id;
  426. this.selectedOrgName = data.shortName;
  427. this.getList();
  428. },
  429. },
  430. mounted() {},
  431. };
  432. </script>
  433. <style lang="scss" scoped>
  434. /* .search_key{
  435. ::v-deep .el-form-item__label{
  436. width:60px !important;
  437. }
  438. } */
  439. </style>