index.vue 13 KB

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