index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--机构数据-->
  5. <el-col :span="4" :xs="24">
  6. <org-tree
  7. v-model="queryParams.orgId"
  8. @defaultKey="getDefaultKey"
  9. @checkChange="checkChange"
  10. @click="clickTreeNode"
  11. hangsheTree
  12. :defaultCheckSub="false"
  13. ></org-tree>
  14. </el-col>
  15. <el-col :span="20" :xs="24">
  16. <!-- 搜索条件 -->
  17. <el-form
  18. :model="queryParams"
  19. ref="search"
  20. size="small"
  21. :inline="true"
  22. v-show="showSearch"
  23. label-width="100px"
  24. >
  25. <el-form-item prop="execOrgType" label="检查机构类型">
  26. <el-select
  27. prop="execOrgType"
  28. label="检查机构类型"
  29. v-model="queryParams.execOrgType"
  30. placeholder="请选择检查机构类型"
  31. clearable
  32. >
  33. <el-option
  34. v-for="dict in dict.type.sys_org_type"
  35. :key="dict.value"
  36. :label="dict.label"
  37. :value="dict.value"
  38. />
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item prop="checkOrgType" label="受检机构类型">
  42. <el-select
  43. prop="checkOrgType"
  44. label="受检机构类型"
  45. v-model="queryParams.checkOrgType"
  46. placeholder="请选择受检机构类型"
  47. clearable
  48. >
  49. <el-option
  50. v-for="dict in dict.type.sys_org_type"
  51. :key="dict.value"
  52. :label="dict.label"
  53. :value="dict.value"
  54. />
  55. </el-select>
  56. </el-form-item>
  57. <el-form-item prop="checkRole" label="检查角色">
  58. <el-select
  59. @visible-change="getRolesByOrg"
  60. prop="checkRole"
  61. label="检查角色"
  62. v-model="queryParams.checkRole"
  63. placeholder="请选择检查角色"
  64. clearable
  65. >
  66. <el-option
  67. v-for="dict in resumptionRoles"
  68. :key="dict.index"
  69. :label="dict.roleName"
  70. :value="dict.id"
  71. />
  72. </el-select>
  73. </el-form-item>
  74. <el-form-item prop="planCycle" label="检查周期">
  75. <el-select
  76. prop="planCycle"
  77. label="检查周期"
  78. v-model="queryParams.planCycle"
  79. placeholder="请选择检查周期"
  80. clearable
  81. >
  82. <el-option
  83. v-for="item in dict.type.check_cycle"
  84. :key="item.value"
  85. :label="item.label"
  86. :value="item.value"
  87. >
  88. </el-option>
  89. </el-select>
  90. </el-form-item>
  91. <el-form-item prop="planName" label="计划名称">
  92. <el-input
  93. v-model="queryParams.planName"
  94. :maxlength="50"
  95. name="planName"
  96. placeholder="请输入"
  97. clearable
  98. />
  99. </el-form-item>
  100. <el-form-item prop="planStatus" label="计划状态">
  101. <el-select
  102. prop="planStatus"
  103. label="计划状态"
  104. v-model="queryParams.planStatus"
  105. placeholder="请选择计划状态"
  106. clearable
  107. >
  108. <el-option
  109. v-for="item in dict.type.check_status"
  110. :key="item.value"
  111. :label="item.label"
  112. :value="item.value"
  113. >
  114. </el-option>
  115. </el-select>
  116. </el-form-item>
  117. <el-form-item>
  118. <el-button
  119. type="primary"
  120. icon="el-icon-search"
  121. size="mini"
  122. @click="getList"
  123. >搜索</el-button
  124. >
  125. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  126. >重置</el-button
  127. >
  128. </el-form-item>
  129. </el-form>
  130. <!-- 按纽 -->
  131. <el-row :gutter="10" class="mb8">
  132. <el-col :span="1.5">
  133. <el-button
  134. type="primary"
  135. icon="el-icon-plus"
  136. size="mini"
  137. @click="handleAdd()"
  138. v-hasPermi="['core:checkplan:add']"
  139. >新增计划</el-button
  140. >
  141. </el-col>
  142. <right-toolbar
  143. :showSearch.sync="showSearch"
  144. @queryTable="getList"
  145. :columns="columns"
  146. ></right-toolbar>
  147. </el-row>
  148. <el-table
  149. v-loading="loading"
  150. :data="pageData"
  151. @selection-change="handleSelectionChange"
  152. row-key="id"
  153. :tree-props="{ children: 'children' }"
  154. >
  155. <el-table-column
  156. type = 'index'
  157. label="序号"
  158. width="80px"
  159. v-if="columns[0].visible"
  160. ></el-table-column>
  161. <el-table-column
  162. prop="planName"
  163. label="计划名称"
  164. v-if="columns[1].visible"
  165. ></el-table-column>
  166. <el-table-column
  167. prop="planOfOrgName"
  168. label="计划所属机构"
  169. v-if="columns[4].visible"
  170. >
  171. </el-table-column>
  172. <el-table-column
  173. prop="planCreateOrgName"
  174. label="计划创建机构"
  175. v-if="columns[3].visible"
  176. >
  177. </el-table-column>
  178. <el-table-column
  179. prop="checkType"
  180. label="检查类型"
  181. v-if="columns[2].visible"
  182. >
  183. <template slot-scope="r"
  184. >{{
  185. getLabel(dict.type.check_type, `${r.row.checkType}`)
  186. }}
  187. </template>
  188. </el-table-column>
  189. <el-table-column
  190. prop="execOrgType"
  191. label="检查机构类型"
  192. v-if="columns[2].visible"
  193. >
  194. <template slot-scope="r"
  195. >{{
  196. getLabel(dict.type.sys_org_type, `${r.row.execOrgType}`)
  197. }}
  198. </template>
  199. </el-table-column>
  200. <el-table-column
  201. prop="checkOrgType"
  202. label="受检机构类型"
  203. width="120px"
  204. v-if="columns[6].visible"
  205. >
  206. <template slot-scope="r"
  207. >{{ getLabel(dict.type.sys_org_type, `${r.row.checkOrgType}`) }}
  208. </template>
  209. </el-table-column>
  210. <el-table-column
  211. prop="roleNames"
  212. label="检查角色"
  213. v-if="columns[6].visible"
  214. >
  215. <template slot-scope="scope">
  216. <template v-for="item in splitRoleNames(scope.row.roleNames)">
  217. {{ item }}
  218. <br />
  219. </template>
  220. </template></el-table-column>
  221. <el-table-column
  222. prop="planCycle"
  223. label="检查周期"
  224. width="80px"
  225. v-if="columns[6].visible"
  226. >
  227. <template slot-scope="r"
  228. >{{
  229. getLabel(dict.type.check_cycle, `${r.row.planCycle}`)
  230. }}
  231. </template>
  232. </el-table-column>
  233. <el-table-column
  234. prop="count"
  235. label="检查次数"
  236. v-if="columns[6].visible"
  237. ></el-table-column>
  238. <el-table-column
  239. prop="planStatus"
  240. label="状态"
  241. width="80px"
  242. v-if="columns[6].visible"
  243. >
  244. <template slot-scope="r"
  245. >{{
  246. getLabel(dict.type.check_status, `${r.row.planStatus}`)
  247. }}
  248. </template>
  249. </el-table-column>
  250. <el-table-column
  251. prop="modifiedName"
  252. label="修改人"
  253. v-if="columns[6].visible"
  254. ></el-table-column>
  255. <el-table-column
  256. prop="updateTime"
  257. label="修改时间"
  258. width="80px"
  259. v-if="columns[6].visible"
  260. >
  261. <template slot-scope="scope">
  262. <span>{{ formatTime(scope.row.updateTime,"YYYY-MM-DD") }}</span>
  263. </template>
  264. </el-table-column>
  265. <el-table-column label="操作">
  266. <template slot-scope="r">
  267. <el-button
  268. v-if="eqOrg(r.row)"
  269. size="mini"
  270. type="text"
  271. icon="el-icon-edit-outline"
  272. @click="onEdit(r.row.id)"
  273. v-hasPermi="['core:checkplan:edit']"
  274. >修改</el-button
  275. >
  276. <el-button
  277. v-if="eqOrg2(r.row)"
  278. size="mini"
  279. type="text"
  280. icon="el-icon-delete"
  281. @click="onDel(r.row.id, r.row.planName)"
  282. v-hasPermi="['core:checkplan:remove']"
  283. >删除</el-button
  284. >
  285. <el-button
  286. size="mini"
  287. type="text"
  288. icon="el-icon-arrow-down"
  289. v-if="checkCanPublish(r.row)"
  290. @click="showDialogDistribute(r.row)"
  291. v-hasPermi="['core:checkplan:distribute']"
  292. >下发</el-button>
  293. <el-button
  294. size="mini"
  295. type="text"
  296. icon="el-icon-arrow-down"
  297. v-if="newcheckCanPublish(r.row)"
  298. @click="newshowDialogDistribute(r.row)"
  299. v-hasPermi="['core:checkplan:distribute']"
  300. >下发</el-button>
  301. <el-button
  302. size="mini"
  303. type="text"
  304. icon="el-icon-arrow-down"
  305. v-if="chehui(r.row)"
  306. @click="chhuile(r.row)"
  307. v-hasPermi="['core:checkplan:distribute']"
  308. >撤回</el-button>
  309. </template>
  310. </el-table-column>
  311. </el-table>
  312. <pagination
  313. v-show="total > 0"
  314. :total="total"
  315. :page.sync="queryParams.pageNum"
  316. :limit.sync="queryParams.pageSize"
  317. @pagination="getList"
  318. />
  319. </el-col>
  320. </el-row>
  321. <dialog-edit
  322. ref="editDialog"
  323. @success="getList()"
  324. :orgTypeOptions="dict.type.sys_org_type"
  325. :ruleTypeOptions="dict.type.rule_type"
  326. ></dialog-edit>
  327. <DialogDistribute ref="dialogDistribute" @select="sel"></DialogDistribute>
  328. </div>
  329. </template>
  330. <script>
  331. import DialogDistribute from "./distribute.vue";
  332. import OrgTree from "@/components/orgTree";
  333. import { mapState, mapMutations,mapGetters } from "vuex";
  334. import DialogEdit from "./dialog.edit";
  335. import * as api from "@/api/safetycheck/plan";
  336. import { statusOptions, getLabel } from "@/views/commonOption";
  337. import { listRole } from "@/api/system/role";
  338. export default {
  339. name: "resumptionplan",
  340. dicts: [
  341. "sys_org_type",
  342. "rule_type",
  343. "check_cycle","check_status","check_type"
  344. ],
  345. components: {
  346. DialogEdit,
  347. OrgTree,
  348. DialogDistribute,
  349. },
  350. data() {
  351. const { params, query } = this.$route;
  352. return {
  353. isShow: false,
  354. loading: false,
  355. ids: [],
  356. // 非单个禁用
  357. single: true,
  358. // 非多个禁用
  359. multiple: true,
  360. // 显示搜索条件
  361. showSearch: true,
  362. resumptionRoles: [],
  363. total: 0,
  364. queryParams: {
  365. id: null,
  366. planName: null,
  367. checkRole: null,
  368. planCycle: null,
  369. planCreateOrgId: null,
  370. checkType: null,
  371. planOfOrgId: null,
  372. execOrgType: null,
  373. checkOrgType:null,
  374. planStatus:null,
  375. pageSize:10,
  376. pageNum:1,
  377. checkSub:false,
  378. orgId:null,
  379. ...query,
  380. },
  381. pageData: [],
  382. // 列信息
  383. columns: [
  384. { key: 0, label: `序号`, visible: true },
  385. { key: 1, label: `计划名称`, visible: true },
  386. { key: 2, label: `计划类型`, visible: true },
  387. { key: 3, label: `计划创建机构`, visible: true },
  388. { key: 4, label: `计划所属机构`, visible: true },
  389. { key: 5, label: `履职机构类型`, visible: true },
  390. { key: 6, label: `履职角色`, visible: true },
  391. { key: 7, label: `履职周期`, visible: true },
  392. { key: 8, label: `履职次数`, visible: true },
  393. { key: 9, label: `履职时间`, visible: true },
  394. { key: 10, label: `修改人`, visible: true },
  395. { key: 11, label: `计划状态`, visible: true },
  396. ],
  397. };
  398. },
  399. props: {},
  400. watch: {},
  401. computed: {
  402. ...mapState([]),
  403. ...mapGetters(["orgId", "orgName"]),
  404. },
  405. methods: {
  406. ...mapMutations([]),
  407. //判断是否跟当前用户同机构
  408. eqOrg(row) {
  409. // console.log(row.planCreateOrgId,"row.planCreateOrgId");
  410. // console.log(this.orgId,"this.orgId");
  411. if (row != null && row != undefined && row.planOfOrgId == this.orgId) {
  412. return true;
  413. }
  414. return true;
  415. },
  416. eqOrg2(row) {
  417. // console.log(row.planCreateOrgId,"row.planCreateOrgId");
  418. // console.log(this.orgId,"this.orgId");
  419. if (row != null && row != undefined && row.planCreateOrgId == this.orgId&& row.planOfOrgId == this.orgId) {
  420. return true;
  421. }
  422. return false;
  423. },
  424. newcheckCanPublish(row){
  425. if (row.planStatus==2&& row.parentId != -1&& row.planOfOrgType ==1) {
  426. return true;
  427. }
  428. return false;
  429. },
  430. newshowDialogDistribute(row){
  431. this.$modal
  432. .confirm("是否下发!", "提示")
  433. .then(() => {
  434. // 用户点击了确认按钮
  435. console.log("执行操作...");
  436. this.loading = true;
  437. api
  438. .distributeCheHui(row.id)
  439. .then((response) => {
  440. // console.log(response, "then");
  441. if (response.data == 0) {
  442. this.loading = false;
  443. } else {
  444. this.getList();
  445. this.loading = false;
  446. }
  447. })
  448. .catch((response) => {
  449. // console.log(response, "catch");
  450. this.getList();
  451. this.loading = false;
  452. });
  453. })
  454. .catch(() => {
  455. // 用户点击了取消按钮
  456. console.log("取消操作...");
  457. });
  458. },
  459. //已完成下发的计划不显示下发按钮
  460. checkCanPublish(row) {
  461. // console.log(row.planOfOrgType == "1","row.planOfOrgType")
  462. // console.log(row.planOfOrgType == "1"&& row.distribute==null,"row.distribute")
  463. //如果计划所属机构为省联社并且计划下发状态为0并且计划检查机构类型不为省联社和办事处(只有一个无法下发)
  464. if (row.planOfOrgType == "1"&& row.distribute==0&&row.execOrgType!="1"&&row.execOrgType!="2") {
  465. return true
  466. }
  467. return false;
  468. },
  469. splitRoleNames(val) {
  470. if(val!=null&&val!=undefined){
  471. return val.split(',');
  472. }else{
  473. return [];
  474. }
  475. // 使用逗号分割字符串,得到角色名称的数组
  476. },
  477. sel(selectList){
  478. this.loading = true;
  479. api.distribute(selectList).then((response) => {
  480. this.getList();
  481. this.loading = false;
  482. })
  483. },
  484. getRolesByOrg() {
  485. let params = {
  486. // orgId:this.queryParams.orgId
  487. };
  488. listRole(params).then((res) => {
  489. // console.info(res);
  490. this.resumptionRoles = res.rows;
  491. });
  492. },
  493. getList() {
  494. this.loading = true;
  495. console.info(this.dict.type);
  496. api
  497. .list(this.queryParams)
  498. .then((response) => {
  499. this.pageData = response.rows;
  500. this.total = response.total;
  501. this.loading = false;
  502. })
  503. .catch(() => {
  504. this.loading = false;
  505. });
  506. },
  507. getDefaultKey(key) {
  508. this.queryParams.orgId = key;
  509. this.getList();
  510. },
  511. handleAdd(id, other = {}) {
  512. id=null;
  513. this.$refs.editDialog.show(id, other);
  514. },
  515. onEdit(id, other = {}) {
  516. this.$refs.editDialog.show(id, other);
  517. },
  518. //开始撤回
  519. chhuile(row) {
  520. this.loading = true;
  521. api.cheHui(row.id).then((response) => {
  522. this.getList();
  523. this.loading = false;
  524. });
  525. },
  526. //已下发的显示撤回
  527. chehui(row) {
  528. if (row.distribute == 1) {
  529. return true;
  530. }
  531. return false;
  532. },
  533. showDialogDistribute(row){
  534. console.log(row,"qqq")
  535. this.$refs.dialogDistribute.show(row);
  536. },
  537. async onDel(id, name) {
  538. this.$modal
  539. .confirm('是否确认删除名称为"' + name + '"的数据项?')
  540. .then(() => {
  541. // 用户点击了确认按钮
  542. console.log("执行操作...");
  543. this.loading = true;
  544. api.delelte(id).then(() => {
  545. this.getList();
  546. this.loading = false;
  547. this.$modal.msgSuccess("删除成功");
  548. }).catch(()=>{
  549. this.loading = false;
  550. });
  551. })
  552. .catch(() => {
  553. // 用户点击了取消按钮
  554. console.log("取消操作...");
  555. });
  556. },
  557. // 多选框选中数据
  558. handleSelectionChange(selection) {
  559. this.ids = selection.map((item) => item.userId);
  560. this.single = selection.length != 1;
  561. this.multiple = !selection.length;
  562. },
  563. /** 重置按钮操作 */
  564. resetQuery() {
  565. this.resetForm("search");
  566. // this.queryParams.orgId = undefined;
  567. // this.$refs.tree.setCurrentKey(null);
  568. this.getList();
  569. },
  570. //单选框状态改变
  571. checkChange(state) {
  572. this.queryParams.checkSub = state;
  573. this.getList();
  574. },
  575. // 节点单击事件
  576. clickTreeNode(data) {
  577. this.queryParams.orgId = data.id;
  578. this.getList();
  579. },
  580. getStatusLabel(value) {
  581. return getLabel(statusOptions, value);
  582. },
  583. getLabel(options, value) {
  584. return getLabel(options, value);
  585. },
  586. //apimark//
  587. },
  588. mounted() {},
  589. };
  590. </script>
  591. <style lang="scss" scoped>
  592. .brand {
  593. }
  594. </style>