index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="10">
  4. <!-- <el-col :span="4" :xs="24">
  5. <org-tree
  6. v-model="queryParams.orgId"
  7. @defaultKey="getDefaultKey"
  8. @checkChange="checkChange"
  9. @click="clickTreeNode"
  10. ></org-tree>
  11. </el-col> -->
  12. <el-col :span="24" :xs="24">
  13. <!--用户数据-->
  14. <div class="main-right-box">
  15. <!-- 搜索条件 -->
  16. <div class="main-search-box">
  17. <!-- 搜索条件 -->
  18. <el-form
  19. :model="queryParams"
  20. ref="queryForm"
  21. size="small"
  22. :inline="true"
  23. v-show="showSearch"
  24. >
  25. <el-form-item label="创建机构">
  26. <org-tree
  27. v-model="queryParams.orgId"
  28. @defaultKey="getDefaultKey"
  29. @checkChange="checkChange"
  30. @click="clickTreeNode"
  31. ref="orgTree"
  32. ></org-tree>
  33. </el-form-item>
  34. <el-form-item label="外包评价名称" prop="evaluateName">
  35. <el-input
  36. :maxlength="20"
  37. v-model="queryParams.evaluateName"
  38. placeholder="请输入外包评价名称"
  39. clearable
  40. @keyup.enter.native="handleQuery"
  41. />
  42. </el-form-item>
  43. <el-form-item label="状态" prop="status">
  44. <el-select
  45. v-model="queryParams.status"
  46. placeholder="请选择状态"
  47. clearable
  48. >
  49. <el-option
  50. v-for="dict in dict.type.plan_status"
  51. :key="dict.value"
  52. :label="dict.label"
  53. :value="dict.value"
  54. />
  55. </el-select>
  56. </el-form-item>
  57. <el-form-item label="评价机构类型">
  58. <el-select
  59. @change="cleanExecOrgList"
  60. prop="orgType"
  61. label="评价机构类型"
  62. v-model="queryParams.orgType"
  63. placeholder="请选择评价机构类型"
  64. clearable
  65. >
  66. <el-option
  67. v-for="item in dict.type.sys_org_type"
  68. :key="item.value"
  69. :label="item.label"
  70. :value="item.value"
  71. >
  72. </el-option>
  73. </el-select>
  74. </el-form-item>
  75. <el-form-item label="评价角色" prop="roleId">
  76. <el-select
  77. @visible-change="getRolesByOrg"
  78. label="评价角色"
  79. v-model="queryParams.roleId"
  80. placeholder="请选择评价角色"
  81. filterable
  82. @change="handleRolesChange"
  83. >
  84. <el-option
  85. v-for="item in planRoles"
  86. :key="item.id"
  87. :label="item.name"
  88. :value="item.id"
  89. >
  90. </el-option>
  91. </el-select>
  92. </el-form-item>
  93. </el-form>
  94. <!-- 按纽 -->
  95. <el-row :gutter="10">
  96. <el-col :span="1.5">
  97. <el-button
  98. type="primary"
  99. icon="el-icon-search"
  100. size="mini"
  101. @click="handleQuery"
  102. >搜索</el-button
  103. >
  104. <el-button
  105. type="primary"
  106. icon="el-icon-refresh"
  107. size="mini"
  108. @click="resetQuery"
  109. >重置</el-button
  110. >
  111. <el-button
  112. type="primary"
  113. icon="el-icon-plus"
  114. size="mini"
  115. @click="handleAdd"
  116. v-hasPermi="['core:evaluatePlan:add']"
  117. >新增</el-button
  118. >
  119. </el-col>
  120. <right-toolbar
  121. :showSearch.sync="showSearch"
  122. @queryTable="getList"
  123. >
  124. </right-toolbar>
  125. </el-row>
  126. </div>
  127. <el-table
  128. border
  129. height="644"
  130. size="small"
  131. v-loading="loading"
  132. :data="dataList"
  133. align="center"
  134. fixed
  135. @selection-change="handleSelectionChange"
  136. >
  137. <el-table-column
  138. align="center"
  139. label="序号"
  140. type="index"
  141. width="100"
  142. ></el-table-column>
  143. <el-table-column align="center" label="创建机构" prop="orgName" />
  144. <el-table-column align="center"
  145. label="外包评价名称"
  146. prop="evaluateName"
  147. width="300"
  148. />
  149. <el-table-column align="center" label="评价机构类型" prop="orgType" />
  150. <el-table-column align="center" label="评价角色" prop="roleName" />
  151. <el-table-column align="center" label="评价周期" prop="evaluateCycle" />
  152. <el-table-column align="center" label="创建人" prop="createBy" width="180" />
  153. <el-table-column align="center" label="创建时间" prop="createTime" width="180" />
  154. <el-table-column align="center" label="状态" width="150">
  155. <template slot-scope="{ row }">
  156. <el-switch
  157. v-model="row.status"
  158. active-text="启用"
  159. active-value="0"
  160. inactive-text="停用"
  161. inactive-value="1"
  162. active-color="#3bbca9"
  163. inactive-color="#d7000f"
  164. @change="swtichChangeHandler(row)"
  165. >
  166. </el-switch>
  167. </template>
  168. </el-table-column>
  169. <el-table-column
  170. label="操作"
  171. width="260"
  172. align="center"
  173. class-name="small-padding fixed-width"
  174. >
  175. <template slot-scope="{ row }">
  176. <!-- publishEvaluate -->
  177. <el-button
  178. size="mini"
  179. @click="publishHandler(row)"
  180. v-hasPermi="['core:evaluatePlan:distribute']"
  181. type="text"
  182. v-if="row.orgId == isEdit && row.status == 0"
  183. :class="
  184. row.isDistribute == 0
  185. ? 'el-icon-arrow-down'
  186. : 'el-icon-top-left'
  187. "
  188. >{{ row.isDistribute == "0" ? "" : "取消" }}发布</el-button
  189. >
  190. <el-button
  191. size="mini"
  192. @click="editHandler(row)"
  193. type="text"
  194. v-if="row.orgId == isEdit"
  195. class="el-icon-edit-outline"
  196. >编辑</el-button
  197. ><el-button
  198. size="mini"
  199. @click="deleteHandler(row)"
  200. type="text"
  201. v-if="row.orgId == isEdit"
  202. class="el-icon-delete"
  203. >删除</el-button
  204. >
  205. </template>
  206. </el-table-column>
  207. </el-table>
  208. <pagination
  209. v-show="total > 0"
  210. :total="total"
  211. :page.sync="queryParams.pageNum"
  212. :limit.sync="queryParams.pageSize"
  213. @pagination="getList"
  214. />
  215. </div>
  216. </el-col>
  217. </el-row>
  218. <editEvaluate ref="Evaluate" @success="getList()"></editEvaluate>
  219. <DialogThreeState ref="DialogThreeState"> </DialogThreeState>
  220. </div>
  221. </template>
  222. <script>
  223. import { mapGetters } from "vuex";
  224. import { findAllRole } from "@/api/system/role";
  225. import {
  226. list,
  227. swtichHandler,
  228. delelteEvaluate,
  229. publishEvaluate,
  230. withdraw,
  231. } from "@/api/resumption/outsourcing.js";
  232. import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
  233. import editEvaluate from "./editDialog.vue";
  234. import DialogThreeState from "@/components/message/threeStateMessageBox.vue";
  235. import * as api from "@/api/resumption/outsourcing";
  236. export default {
  237. name: "SocWebIndex",
  238. dicts: ["sys_org_type", "plan_status"],
  239. components: {
  240. OrgTree,
  241. editEvaluate,
  242. DialogThreeState,
  243. },
  244. data() {
  245. const { params, query } = this.$route;
  246. return {
  247. loading: false,
  248. selectedValues: [],
  249. planRoles: [],
  250. queryParams: this.reset(),
  251. queryParams: {
  252. orgId: null,
  253. evaluateName: null,
  254. status: null,
  255. orgType: null,
  256. checkSub: true,
  257. roleId: "",
  258. pageNum: 1,
  259. pageSize: 10,
  260. ...query,
  261. },
  262. isEdit: null,
  263. // 显示搜索条件
  264. showSearch: true,
  265. total: 0,
  266. dataList: [],
  267. };
  268. },
  269. created() {
  270. },
  271. mounted() {},
  272. computed: {
  273. ...mapGetters(["orgId"]),
  274. },
  275. methods: {
  276. //开关启用停用
  277. swtichChangeHandler(row) {
  278. swtichHandler({
  279. id: row.id,
  280. status: row.status,
  281. }).then((res) => {
  282. let { code, msg } = res;
  283. if (code == 200) {
  284. this.$message.success(msg);
  285. this.getList();
  286. } else {
  287. this.$message.error(msg);
  288. }
  289. });
  290. },
  291. //获取列表
  292. getList() {
  293. this.loading = true;
  294. // this.queryParams.orgId=this.orgId
  295. list(this.queryParams).then((res) => {
  296. this.dataList = res?.data.rows || [];
  297. this.isEdit = res?.isEdit;
  298. this.total = res.data.total || [];
  299. this.loading = false;
  300. });
  301. },
  302. // 多选框选中数据
  303. handleSelectionChange(selection) {},
  304. /** 新增按钮操作 */
  305. handleAdd() {
  306. this.$refs.Evaluate.show();
  307. },
  308. editHandler(row) {
  309. this.$refs.Evaluate.show(row.id, row.isDistribute);
  310. },
  311. //发布
  312. publishHandler(row) {
  313. //0未 //1已
  314. if (row.isDistribute == "1") {
  315. this.$modal
  316. .confirm("是否取消发布?")
  317. .then(function () {})
  318. .then(() => {
  319. withdraw(row.id).then((res) => {
  320. let { code, msg } = res;
  321. if (code == 200) {
  322. this.getList();
  323. this.$modal.msgSuccess("取消发布成功");
  324. } else {
  325. this.$modal.msgSuccess(msg);
  326. }
  327. });
  328. });
  329. } else {
  330. // this.$modal
  331. // .confirm("是否确认发布?")
  332. // .then(function () {})
  333. // .then(() => {
  334. // publishEvaluate(row.id).then((res) => {
  335. // let { code, msg } = res;
  336. // if (code == 200) {
  337. // this.getList();
  338. // this.$modal.msgSuccess("发布成功");
  339. // } else {
  340. // this.$modal.msgSuccess(msg);
  341. // }
  342. // });
  343. // });
  344. let msg = "请选择下发后立即生成或下周期生成任务?";
  345. this.$refs["DialogThreeState"].show(
  346. msg,
  347. (state) => {
  348. if (state == 0 || state == 1) {
  349. this. distribute(row.id, state == 1);
  350. }
  351. },
  352. {
  353. yesText: "立即生成",
  354. noText: "下周期",
  355. cancelText: "取消",
  356. }
  357. );
  358. }
  359. },
  360. distribute(id, immediateEffect) {
  361. this.loading = true;
  362. api
  363. .publishEvaluate(id, immediateEffect)
  364. .then((response) => {
  365. if (response.data == 0) {
  366. this.loading = false;
  367. } else {
  368. this.getList();
  369. this.loading = false;
  370. }
  371. })
  372. .catch((response) => {
  373. this.getList();
  374. this.loading = false;
  375. });
  376. },
  377. deleteHandler(row) {
  378. this.$modal
  379. .confirm("是否确认删除?")
  380. .then(function () {})
  381. .then(() => {
  382. delelteEvaluate(row.id).then((res) => {
  383. let { code, msg } = res;
  384. if (code == 200) {
  385. this.getList();
  386. this.$modal.msgSuccess("删除成功");
  387. } else {
  388. this.$modal.msgSuccess(msg);
  389. }
  390. });
  391. });
  392. },
  393. //单选框状态改变
  394. checkChange(state) {
  395. this.queryParams.checkSub = state;
  396. this.getList();
  397. },
  398. // 节点单击事件
  399. clickTreeNode(data) {
  400. this.queryParams.orgId = data.id;
  401. this.getList();
  402. },
  403. getRolesByOrg() {
  404. let params = {
  405. orgType: this.queryParams.orgType || null,
  406. };
  407. findAllRole(params).then((res) => {
  408. this.planRoles = res.data;
  409. if (!this.queryParams.orgType) {
  410. this.planRoles = [];
  411. this.queryParams.roleId = [];
  412. }
  413. });
  414. },
  415. cleanExecOrgList() {
  416. this.execOrgIds = null;
  417. this.queryParams.roleId = [];
  418. this.queryParams.execOrgList = [];
  419. this.getRolesByOrg();
  420. },
  421. handleRolesChange(val) {
  422. this.selectedValues = val.toString().split(",");
  423. },
  424. getDefaultKey(key) {
  425. this.queryParams.orgId = key;
  426. this.getList();
  427. },
  428. /** 搜索按钮操作 */
  429. handleQuery() {
  430. this.queryParams.pageNum = 1;
  431. this.getList();
  432. },
  433. /** 重置按钮操作 */
  434. resetQuery() {
  435. this.resetForm("queryForm");
  436. this.queryParams.orgId = this.orgId;
  437. this.queryParams.checkSub = true;
  438. this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub)
  439. this.queryParams.onlyManager = false;
  440. this.queryParams.orgType = null;
  441. this.handleQuery();
  442. },
  443. reset() {
  444. return {
  445. planName: null,
  446. planType: null,
  447. planCycle: null,
  448. planStatus: null,
  449. orgType: null,
  450. roleNames: null,
  451. count: null,
  452. description: null,
  453. tableData: null,
  454. itemList: null,
  455. planExec: null,
  456. count: 0,
  457. note: null,
  458. planCreateOrgId: null,
  459. planCreateOrgName: null,
  460. roleList: null,
  461. roleId: null,
  462. execOrg: null,
  463. checkOrg: null,
  464. buildTaskNow: false,
  465. checkOrgList: [],
  466. execOrgList: [],
  467. rulePointList: null,
  468. checkOrgIds: null,
  469. execOrgIds: null,
  470. rulePointIds: null,
  471. checkOrgType: null,
  472. checkType: null,
  473. };
  474. },
  475. },
  476. };
  477. </script>
  478. <style lang="scss" scoped></style>