index.vue 13 KB

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