index.vue 13 KB

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