index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  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. label="序号"
  139. type="index"
  140. width="60"
  141. ></el-table-column>
  142. <el-table-column label="创建机构" prop="orgName" />
  143. <el-table-column
  144. label="外包评价名称"
  145. prop="evaluateName"
  146. width="300"
  147. />
  148. <el-table-column label="评价机构类型" prop="orgType" />
  149. <el-table-column label="评价角色" prop="roleName" />
  150. <el-table-column label="评价周期" prop="evaluateCycle" />
  151. <el-table-column label="创建人" prop="createBy" />
  152. <el-table-column label="创建时间" prop="createTime" width="180" />
  153. <el-table-column label="状态" width="150">
  154. <template slot-scope="{ row }">
  155. <el-switch
  156. v-model="row.status"
  157. active-text="启用"
  158. active-value="0"
  159. inactive-text="停用"
  160. inactive-value="1"
  161. active-color="#3bbca9"
  162. inactive-color="#d7000f"
  163. @change="swtichChangeHandler(row)"
  164. >
  165. </el-switch>
  166. </template>
  167. </el-table-column>
  168. <el-table-column
  169. label="操作"
  170. width="260"
  171. class-name="small-padding fixed-width"
  172. >
  173. <template slot-scope="{ row }">
  174. <!-- publishEvaluate -->
  175. <el-button
  176. size="mini"
  177. @click="publishHandler(row)"
  178. v-hasPermi="['core:evaluatePlan:distribute']"
  179. type="text"
  180. v-if="row.orgId == isEdit && row.status == 0"
  181. :class="
  182. row.isDistribute == 0
  183. ? 'el-icon-arrow-down'
  184. : 'el-icon-top-left'
  185. "
  186. >{{ row.isDistribute == "0" ? "" : "取消" }}发布</el-button
  187. >
  188. <el-button
  189. size="mini"
  190. @click="editHandler(row)"
  191. type="text"
  192. v-if="row.orgId == isEdit"
  193. class="el-icon-edit-outline"
  194. >编辑</el-button
  195. ><el-button
  196. size="mini"
  197. @click="deleteHandler(row)"
  198. type="text"
  199. v-if="row.orgId == isEdit"
  200. class="el-icon-delete"
  201. >删除</el-button
  202. >
  203. </template>
  204. </el-table-column>
  205. </el-table>
  206. <pagination
  207. v-show="total > 0"
  208. :total="total"
  209. :page.sync="queryParams.pageNum"
  210. :limit.sync="queryParams.pageSize"
  211. @pagination="getList"
  212. />
  213. </div>
  214. </el-col>
  215. </el-row>
  216. <editEvaluate ref="Evaluate" @success="getList()"></editEvaluate>
  217. </div>
  218. </template>
  219. <script>
  220. import { mapGetters } from "vuex";
  221. import { findAllRole } from "@/api/system/role";
  222. import {
  223. list,
  224. swtichHandler,
  225. delelteEvaluate,
  226. publishEvaluate,
  227. withdraw,
  228. } from "@/api/resumption/outsourcing.js";
  229. import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
  230. import editEvaluate from "./editDialog.vue";
  231. export default {
  232. name: "SocWebIndex",
  233. dicts: ["sys_org_type", "plan_status"],
  234. components: {
  235. OrgTree,
  236. editEvaluate,
  237. },
  238. data() {
  239. const { params, query } = this.$route;
  240. return {
  241. loading: false,
  242. selectedValues: [],
  243. planRoles: [],
  244. queryParams: this.reset(),
  245. queryParams: {
  246. orgId: null,
  247. evaluateName: null,
  248. status: null,
  249. orgType: null,
  250. checkSub: true,
  251. roleId: "",
  252. pageNum: 1,
  253. pageSize: 10,
  254. ...query,
  255. },
  256. isEdit: null,
  257. // 显示搜索条件
  258. showSearch: true,
  259. total: 0,
  260. dataList: [],
  261. };
  262. },
  263. created() {
  264. },
  265. mounted() {},
  266. computed: {
  267. ...mapGetters(["orgId"]),
  268. },
  269. methods: {
  270. //开关启用停用
  271. swtichChangeHandler(row) {
  272. swtichHandler({
  273. id: row.id,
  274. status: row.status,
  275. }).then((res) => {
  276. let { code, msg } = res;
  277. if (code == 200) {
  278. this.$message.success(msg);
  279. this.getList();
  280. } else {
  281. this.$message.error(msg);
  282. }
  283. });
  284. },
  285. //获取列表
  286. getList() {
  287. this.loading = true;
  288. // this.queryParams.orgId=this.orgId
  289. list(this.queryParams).then((res) => {
  290. this.dataList = res?.data.rows || [];
  291. this.isEdit = res?.isEdit;
  292. this.total = res.data.total || [];
  293. this.loading = false;
  294. });
  295. },
  296. // 多选框选中数据
  297. handleSelectionChange(selection) {},
  298. /** 新增按钮操作 */
  299. handleAdd() {
  300. this.$refs.Evaluate.show();
  301. },
  302. editHandler(row) {
  303. this.$refs.Evaluate.show(row.id, row.isDistribute);
  304. },
  305. //发布
  306. publishHandler(row) {
  307. //0未 //1已
  308. if (row.isDistribute == "1") {
  309. this.$modal
  310. .confirm("是否取消发布?")
  311. .then(function () {})
  312. .then(() => {
  313. withdraw(row.id).then((res) => {
  314. let { code, msg } = res;
  315. if (code == 200) {
  316. this.getList();
  317. this.$modal.msgSuccess("取消发布成功");
  318. } else {
  319. this.$modal.msgSuccess(msg);
  320. }
  321. });
  322. });
  323. } else {
  324. this.$modal
  325. .confirm("是否确认发布?")
  326. .then(function () {})
  327. .then(() => {
  328. publishEvaluate(row.id).then((res) => {
  329. let { code, msg } = res;
  330. if (code == 200) {
  331. this.getList();
  332. this.$modal.msgSuccess("发布成功");
  333. } else {
  334. this.$modal.msgSuccess(msg);
  335. }
  336. });
  337. });
  338. }
  339. },
  340. deleteHandler(row) {
  341. this.$modal
  342. .confirm("是否确认删除?")
  343. .then(function () {})
  344. .then(() => {
  345. delelteEvaluate(row.id).then((res) => {
  346. let { code, msg } = res;
  347. if (code == 200) {
  348. this.getList();
  349. this.$modal.msgSuccess("删除成功");
  350. } else {
  351. this.$modal.msgSuccess(msg);
  352. }
  353. });
  354. });
  355. },
  356. //单选框状态改变
  357. checkChange(state) {
  358. this.queryParams.checkSub = state;
  359. this.getList();
  360. },
  361. // 节点单击事件
  362. clickTreeNode(data) {
  363. this.queryParams.orgId = data.id;
  364. this.getList();
  365. },
  366. getRolesByOrg() {
  367. let params = {
  368. orgType: this.queryParams.orgType || null,
  369. };
  370. findAllRole(params).then((res) => {
  371. this.planRoles = res.data;
  372. if (!this.queryParams.orgType) {
  373. this.planRoles = [];
  374. this.queryParams.roleId = [];
  375. }
  376. });
  377. },
  378. cleanExecOrgList() {
  379. this.execOrgIds = null;
  380. this.queryParams.roleId = [];
  381. this.queryParams.execOrgList = [];
  382. this.getRolesByOrg();
  383. },
  384. handleRolesChange(val) {
  385. this.selectedValues = val.toString().split(",");
  386. },
  387. getDefaultKey(key) {
  388. this.queryParams.orgId = key;
  389. this.getList();
  390. },
  391. /** 搜索按钮操作 */
  392. handleQuery() {
  393. this.queryParams.pageNum = 1;
  394. this.getList();
  395. },
  396. /** 重置按钮操作 */
  397. resetQuery() {
  398. this.resetForm("queryForm");
  399. this.queryParams.orgId = this.orgId;
  400. this.queryParams.checkSub = true;
  401. this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub)
  402. this.queryParams.onlyManager = false;
  403. this.queryParams.orgType = null;
  404. this.handleQuery();
  405. },
  406. reset() {
  407. return {
  408. planName: null,
  409. planType: null,
  410. planCycle: null,
  411. planStatus: null,
  412. orgType: null,
  413. roleNames: null,
  414. count: null,
  415. description: null,
  416. tableData: null,
  417. itemList: null,
  418. planExec: null,
  419. count: 0,
  420. note: null,
  421. planCreateOrgId: null,
  422. planCreateOrgName: null,
  423. roleList: null,
  424. roleId: null,
  425. execOrg: null,
  426. checkOrg: null,
  427. buildTaskNow: false,
  428. checkOrgList: [],
  429. execOrgList: [],
  430. rulePointList: null,
  431. checkOrgIds: null,
  432. execOrgIds: null,
  433. rulePointIds: null,
  434. checkOrgType: null,
  435. checkType: null,
  436. };
  437. },
  438. },
  439. };
  440. </script>
  441. <style lang="scss" scoped></style>