index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <!-- 动环设备管理 -->
  2. <template>
  3. <div class="app-container">
  4. <el-row :gutter="20">
  5. <el-col :span="4" :xs="24">
  6. <el-input placeholder="输入关键字进行过滤" v-model="filterText">
  7. </el-input>
  8. <el-tree
  9. class="filter-tree"
  10. :data="treedata"
  11. node-key="id"
  12. highlight-current
  13. :expand-on-click-node="true"
  14. :default-expanded-keys="topItemKeys"
  15. :filter-node-method="filterNode"
  16. accordion
  17. @node-click="clicktreenode"
  18. ref="tree"
  19. >
  20. <span class="custom-tree-node" slot-scope="{ node, data }">
  21. <span :title="data.label" class="show-ellipsis" v-if="data.isRule==0">{{
  22. data.label
  23. }}</span>
  24. <span v-else style="display: flex;">
  25. <i class="el-icon-s-management" style="color:#008CD6;padding-top:3px;"></i>
  26. <span :title="data.label" class="show-ellipsis" >{{
  27. data.label
  28. }}</span>
  29. </span>
  30. </span>
  31. </el-tree>
  32. </el-col>
  33. <el-col :span="20" :xs="24">
  34. <el-form
  35. :model="queryParams"
  36. ref="search"
  37. size="small"
  38. :inline="true"
  39. v-show="showSearch"
  40. label-width="100px"
  41. >
  42. <el-form-item prop="itemName" label="检查项">
  43. <el-input
  44. v-model="queryParams.itemName"
  45. placeholder="请输入内容"
  46. maxlength="50"
  47. clearable
  48. ></el-input>
  49. </el-form-item>
  50. <el-form-item prop="pointName" label="检查内容">
  51. <el-input
  52. v-model="queryParams.pointName"
  53. placeholder="请输入检查内容"
  54. maxlength="50"
  55. clearable
  56. ></el-input>
  57. </el-form-item>
  58. <el-form-item>
  59. <el-button
  60. type="primary"
  61. icon="el-icon-search"
  62. size="mini"
  63. @click="refresh"
  64. v-hasPermi="['resumption:ruleManager']"
  65. >搜索</el-button
  66. >
  67. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  68. >重置</el-button
  69. >
  70. </el-form-item>
  71. </el-form>
  72. <!-- 按纽 -->
  73. <el-row :gutter="10" class="mb8">
  74. <el-col :span="1.5">
  75. <el-button
  76. type="primary"
  77. @click="onAddItem()"
  78. :disabled="rule ? false : true"
  79. v-hasPermi="['resumption:ruleManager:add']"
  80. v-if="rule && rule.orgId == orgId"
  81. >新 增</el-button
  82. >
  83. <!-- <el-button
  84. type="primary"
  85. @click="onSelect()"
  86. >选择</el-button
  87. > -->
  88. <el-button
  89. type="warning"
  90. @click="dakai"
  91. :disabled="rule ? false : true"
  92. >{{ expandAll ? "收起所有行" : "展开所有行" }}</el-button
  93. >
  94. </el-col>
  95. <!-- <el-col :span="1.5">
  96. <el-button
  97. type="success"
  98. plain
  99. icon="el-icon-edit"
  100. size="mini"
  101. :disabled="single"
  102. @click="handleUpdate"
  103. v-hasPermi="['system:user:edit']"
  104. >修改</el-button
  105. >
  106. </el-col>
  107. <el-col :span="1.5">
  108. <el-button
  109. type="danger"
  110. plain
  111. icon="el-icon-delete"
  112. size="mini"
  113. :disabled="multiple"
  114. @click="handleDelete"
  115. v-hasPermi="['system:user:remove']"
  116. >删除</el-button
  117. >
  118. </el-col>-->
  119. <right-toolbar
  120. :showSearch.sync="showSearch"
  121. @queryTable="getList"
  122. :columns="columns"
  123. ></right-toolbar>
  124. </el-row>
  125. <el-table
  126. :data="tableData"
  127. border
  128. :default-expand-all="expandAll"
  129. v-if="fresh"
  130. style="width: 100%"
  131. >
  132. <el-table-column type="expand">
  133. <template slot-scope="props">
  134. <el-table
  135. :data="props.row.pointDtoList"
  136. border
  137. style="width: 100%"
  138. >
  139. <el-table-column
  140. prop="name"
  141. label="检查内容"
  142. v-if="columns[3].visible"
  143. >
  144. </el-table-column>
  145. <el-table-column
  146. prop="areaName"
  147. label="检查区域"
  148. v-if="columns[4].visible"
  149. >
  150. </el-table-column>
  151. <!-- <el-table-column prop="dataTypeName" label="数据类型">
  152. </el-table-column>
  153. <el-table-column prop="degreeRiskName" label="风险等级">
  154. </el-table-column> -->
  155. </el-table>
  156. </template>
  157. </el-table-column>
  158. <el-table-column
  159. type="index"
  160. label="序号"
  161. width="80"
  162. v-if="columns[0].visible"
  163. >
  164. </el-table-column>
  165. <el-table-column prop="name" label="检查项" v-if="columns[1].visible">
  166. </el-table-column>
  167. <!-- <el-table-column prop="itemDesc" label="标准及要求">
  168. </el-table-column> -->
  169. <el-table-column
  170. prop="pointNums"
  171. label="检查内容数量"
  172. v-if="columns[2].visible"
  173. >
  174. </el-table-column>
  175. <el-table-column label="操作" width="140">
  176. <template slot-scope="scope">
  177. <el-button
  178. type="text"
  179. size="small"
  180. icon="el-icon-edit"
  181. @click="onEditItem(scope.row.id)"
  182. v-hasPermi="['resumption:ruleManager:edit']"
  183. >编辑</el-button
  184. >
  185. <el-popconfirm
  186. title="将删除检查项及其下所有检查内容,确定删除?"
  187. @confirm="deldata(scope.row.id)"
  188. >
  189. <el-button type="text" size="small" slot="reference" icon="el-icon-delete" v-hasPermi="['resumption:ruleManager:remove']">删除</el-button>
  190. </el-popconfirm>
  191. </template>
  192. </el-table-column>
  193. </el-table>
  194. <pagination
  195. v-show="total > 0"
  196. :total="total"
  197. :page.sync="queryParams.pageNum"
  198. :limit.sync="queryParams.pageSize"
  199. @pagination="getList"
  200. />
  201. </el-col>
  202. </el-row>
  203. <dialog-edit
  204. ref="dialogEdit"
  205. :rule="rule"
  206. :pointDataSource="dict.type.point_data_source"
  207. @success="onSuccess"
  208. ></dialog-edit>
  209. </div>
  210. </template>
  211. <script>
  212. import { mapGetters, mapMutations } from "vuex";
  213. import { page, treeData, del } from "@/api/safetycheck/ruleManager.js";
  214. import DialogEdit from "./dialog.editItem.vue";
  215. export default {
  216. name: "safetycheckRuleManager",
  217. props: [],
  218. dicts: ["point_data_source"],
  219. data() {
  220. return {
  221. queryParams: {
  222. ruleId: null,
  223. itemName: null,
  224. pointName: null,
  225. pageNum: 1,
  226. pageSize: 10,
  227. },
  228. filterText: null,
  229. showSearch: true,
  230. rule: null, //选中的内容库
  231. // orgOfRule:null,//选中内容库
  232. expandAll: false,
  233. fresh: true,
  234. // checked: false,
  235. // item: {
  236. // label: "",
  237. // value: "",
  238. // },
  239. treedata: [],
  240. tableData: [],
  241. total: 0,
  242. topItemKeys: [],
  243. // defaultProps: {
  244. // children: "children",
  245. // label: "label",
  246. // },
  247. columns: [
  248. { key: 0, label: `序号`, visible: true },
  249. { key: 1, label: `检查项`, visible: true },
  250. { key: 2, label: `检查内容数量`, visible: true },
  251. { key: 3, label: `检查内容`, visible: true },
  252. { key: 4, label: `检查区域`, visible: true },
  253. ],
  254. currentOrgId:null,
  255. };
  256. },
  257. components: { DialogEdit },
  258. computed: {
  259. ...mapGetters(["orgId"])
  260. // ...mapState(["org", "loginUser"]),
  261. },
  262. watch: {
  263. filterText(val) {
  264. this.$refs.tree.filter(val);
  265. },
  266. },
  267. async created() {
  268. // this.OID = this.loginUser.org.id;
  269. await this.gettreelist();
  270. // await this.getList()
  271. // await this.getassetlist();
  272. },
  273. mounted() {
  274. },
  275. methods: {
  276. ...mapMutations([]),
  277. dakai() {
  278. this.expandAll = !this.expandAll;
  279. this.fresh = false;
  280. this.$nextTick(() => {
  281. this.fresh = true;
  282. });
  283. },
  284. filterNode(value, data) {
  285. if (!value) return true;
  286. return data.label.indexOf(value) !== -1;
  287. },
  288. async refresh() {
  289. this.currentPage = 1;
  290. this.getList();
  291. },
  292. async getList() {
  293. if (!this.rule) {
  294. this.$message.warning("请先选择一个检查内容库定义");
  295. return;
  296. }
  297. const data = await page(this.queryParams);
  298. this.tableData = data.rows;
  299. this.total =Number.parseInt(data.total);
  300. this.expandAll = false;
  301. },
  302. async gettreelist() {
  303. await treeData().then((v) => {
  304. this.treedata = v.data;
  305. this.topItemKeys = v.data.map((d) => d.id);
  306. });
  307. },
  308. handleSizeChange(val) {
  309. this.pagesize = val;
  310. this.getList();
  311. },
  312. handleCurrentChange(val) {
  313. this.currentPage = val;
  314. this.getList();
  315. },
  316. clicktreenode(data,node) {
  317. if (!data.isRule) {
  318. return;
  319. }
  320. this.expandAll = false;
  321. this.fresh = false;
  322. this.$nextTick(() => {
  323. this.fresh = true;
  324. });
  325. this.queryParams.ruleId = data.id;
  326. this.rule = data;
  327. this.rule.orgId=node.parent.data.id
  328. this.refresh();
  329. },
  330. async deldata(val) {
  331. await del(val);
  332. this.$message.info("删除成功");
  333. this.getList();
  334. },
  335. /** 重置按钮操作 */
  336. resetQuery() {
  337. this.resetForm("search");
  338. // this.queryParams.ruleId = undefined;
  339. // this.$refs.tree.setCurrentKey(null);
  340. this.getList();
  341. },
  342. onAddItem() {
  343. if (!this.rule) {
  344. this.$message.warning("请先选择检查内容库");
  345. return;
  346. }
  347. this.$refs.dialogEdit.show(null);
  348. },
  349. onEditItem(itemId) {
  350. this.$refs.dialogEdit.show(itemId);
  351. },
  352. onSelect(){
  353. this.$refs.DialogSelect.show();
  354. },
  355. onSuccess(){
  356. this.refresh();
  357. }
  358. },
  359. };
  360. </script>
  361. <style lang="scss" scoped>
  362. .show-ellipsis {
  363. display: block;
  364. width: 180px;
  365. overflow: hidden;
  366. white-space: nowrap;
  367. text-overflow: ellipsis;
  368. }
  369. .search {
  370. display: flex;
  371. flex-wrap: wrap;
  372. & > div {
  373. width: 25%;
  374. display: flex;
  375. align-items: center;
  376. margin-bottom: 12px;
  377. & > span:first-child {
  378. display: inline-block;
  379. min-width: 70px;
  380. font-size: 14px;
  381. color: #606266;
  382. }
  383. &:nth-child(2),
  384. &:nth-child(3) {
  385. margin-left: 15px;
  386. }
  387. &:nth-child(3) > span {
  388. display: inline-block;
  389. min-width: 100px;
  390. font-size: 14px;
  391. color: #606266;
  392. }
  393. &:nth-child(1) > span {
  394. display: inline-block;
  395. min-width: 100px;
  396. font-size: 14px;
  397. color: #606266;
  398. }
  399. &:nth-child(1) {
  400. }
  401. }
  402. }
  403. .box {
  404. border: 1px solid #eee;
  405. margin-bottom: 20px;
  406. border-radius: 5px;
  407. padding: 10px;
  408. min-height: 120px;
  409. & > p {
  410. font-size: 16px;
  411. font-weight: bold;
  412. margin-bottom: 15px;
  413. }
  414. }
  415. .item {
  416. margin-bottom: 14px;
  417. }
  418. ::v-deep .el-table__expanded-cell[class*="cell"] {
  419. padding: 0;
  420. padding-left: 47px;
  421. }
  422. ::v-deep .formbox {
  423. display: flex;
  424. flex-wrap: wrap;
  425. .el-form-item {
  426. width: 50%;
  427. }
  428. }
  429. </style>