index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <div class="done pagePadding">
  3. <ex-table
  4. v-loading="false"
  5. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  6. :table="table"
  7. :data="tableData"
  8. :columns="columns"
  9. :page="pageInfo"
  10. :size="size"
  11. @page-curr-change="handlePageChange"
  12. @page-size-change="handleSizeChange"
  13. @screen-reset="
  14. pageInfo.curr = 1;
  15. searchList();
  16. "
  17. @screen-submit="
  18. pageInfo.curr = 1;
  19. searchList();
  20. "
  21. >
  22. <template #table-header="{}">
  23. <div style="width: 100%">
  24. <el-row>
  25. <el-col :span="24">
  26. <el-col
  27. :span="3"
  28. style="width: 66px; float: right"
  29. v-if="powers.some((item) => item == '002')"
  30. >
  31. <el-button
  32. type="primary"
  33. :size="searchSize"
  34. style="float: right"
  35. @click="searchList"
  36. >
  37. 刷新
  38. </el-button>
  39. </el-col>
  40. <el-col
  41. :span="3"
  42. style="width: 66px; float: right"
  43. v-if="powers.some((item) => item == '003')"
  44. >
  45. <el-button
  46. :size="searchSize"
  47. type="success"
  48. style="float: right"
  49. @click="openModal('add', false)"
  50. >
  51. 添加
  52. </el-button>
  53. </el-col>
  54. </el-col>
  55. </el-row>
  56. </div>
  57. </template>
  58. <template #status="{ scope }">
  59. <el-tag
  60. :size="tablebtnSize"
  61. :type="scope.row.status == '0' ? 'warning' : ''"
  62. v-text="
  63. (statusOptions.find((item) => item.id == scope.row.status) || {})
  64. .label || '--'
  65. "
  66. ></el-tag>
  67. </template>
  68. <template #operation="{ scope }">
  69. <el-tooltip
  70. v-if="powers.some((item) => item == '007')"
  71. effect="dark"
  72. content="详情"
  73. placement="top"
  74. >
  75. <i
  76. class="el-icon-view tb-icon"
  77. @click="openModal(scope.row.id, true)"
  78. ></i>
  79. </el-tooltip>
  80. <el-tooltip
  81. v-if="powers.some((item) => item == '005')"
  82. effect="dark"
  83. content="修改"
  84. placement="top"
  85. >
  86. <i
  87. class="el-icon-edit tb-icon"
  88. @click="openModal(scope.row.id, false)"
  89. ></i>
  90. </el-tooltip>
  91. <el-tooltip
  92. v-if="
  93. powers.some((item) => item == '004') && scope.row.status === '1'
  94. "
  95. effect="dark"
  96. content="禁用"
  97. placement="top"
  98. >
  99. <i
  100. class="el-icon-video-pause tb-icon"
  101. @click="changeStatus(scope.row.id, scope.row.status)"
  102. ></i>
  103. </el-tooltip>
  104. <el-tooltip
  105. v-if="
  106. powers.some((item) => item == '004') && scope.row.status === '0'
  107. "
  108. effect="dark"
  109. content="启用"
  110. placement="top"
  111. >
  112. <i
  113. class="el-icon-video-play tb-icon"
  114. @click="changeStatus(scope.row.id, scope.row.status)"
  115. ></i>
  116. </el-tooltip>
  117. </template>
  118. </ex-table>
  119. <no-auth v-else></no-auth>
  120. <!-- 弹窗 新增/修改 -->
  121. <add-edit
  122. :id="modelId"
  123. :show-model="showModel"
  124. :is-detail="isDetail"
  125. @refresh="searchList"
  126. @cancel="showModel = false"
  127. />
  128. </div>
  129. </template>
  130. <script>
  131. import ExTable from "@/components/ExTableNew.vue";
  132. import addEdit from "./addEdit";
  133. import asyncRequest from "@/apis/service/process/done";
  134. import mixinPage from "@/mixins/elPaginationHandle";
  135. import { mapGetters } from "vuex";
  136. import resToken from "@/mixins/resToken";
  137. export default {
  138. name: "done",
  139. mixins: [mixinPage, resToken],
  140. components: {
  141. ExTable,
  142. addEdit,
  143. },
  144. computed: {
  145. //组件SIZE设置
  146. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  147. powers() {
  148. let tran =
  149. this.$store.getters.btnList.find((item) => item.menu_route == "done") ||
  150. {};
  151. if (tran && tran.action && tran.action.length > 0) {
  152. return tran.action;
  153. } else {
  154. return [];
  155. }
  156. },
  157. },
  158. data() {
  159. return {
  160. loading: true,
  161. showModel: false,
  162. isDetail: false,
  163. modelId: 0,
  164. parmValue: {
  165. loginName: "", // 账户
  166. fullName: "", // 姓名
  167. type: 2, // 用户类型(1运营人员 2物业人员)
  168. page: 1, // 页码
  169. size: 15, // 每页显示条数
  170. },
  171. // 状态
  172. statusOptions: [
  173. { id: 0, label: "禁用" },
  174. { id: 1, label: "启用" },
  175. ],
  176. // 表格 - 数据
  177. tableData: [],
  178. // 表格 - 参数
  179. table: {
  180. stripe: true,
  181. border: true,
  182. _defaultHeader_: ["setcol"],
  183. },
  184. // 表格 - 分页
  185. pageInfo: {
  186. size: 15,
  187. curr: 1,
  188. total: 0,
  189. },
  190. // 表格 - 列参数
  191. columns: [
  192. {
  193. prop: "oing_sn",
  194. label: "待办编号",
  195. },
  196. {
  197. prop: "operation",
  198. label: "流程名称",
  199. },
  200. {
  201. prop: "bills",
  202. label: "单据号",
  203. },
  204. {
  205. prop: "current_node",
  206. label: "当前节点",
  207. },
  208. {
  209. prop: "stay_time",
  210. label: "停留时间",
  211. // sortable: true,
  212. // _slot_: "status",
  213. },
  214. {
  215. prop: "launcher",
  216. label: "发起人",
  217. // sortable: true,
  218. },
  219. {
  220. prop: "launcher_part",
  221. label: "发起人部门",
  222. // fixed: "right",
  223. // _noset_: true,
  224. // _slot_: "operation",
  225. },
  226. {
  227. prop: "aply_time",
  228. label: "申请时间",
  229. },
  230. ],
  231. };
  232. },
  233. mounted() {
  234. this.searchList();
  235. },
  236. methods: {
  237. restSearch() {
  238. // 表格 - 分页
  239. this.pageInfo = {
  240. size: 10,
  241. curr: 1,
  242. total: 0,
  243. };
  244. this.parmValue = {
  245. status: "", // 账户
  246. level: "", // 姓名
  247. role_name: "",
  248. page: 1, // 页码
  249. size: 10, // 每页显示条数
  250. };
  251. this.searchList();
  252. },
  253. // 新建/编辑/详情
  254. openModal(id, isDetail) {
  255. this.showModel = true;
  256. this.modelId = id;
  257. this.isDetail = isDetail;
  258. },
  259. /**
  260. * 启用/禁用
  261. * @param {String} id id
  262. * @param {String} status 0-禁用 1-启用
  263. */
  264. async changeStatus(id, status) {
  265. await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
  266. confirmButtonText: "确定",
  267. cancelButtonText: "取消",
  268. type: "warning",
  269. })
  270. .then(async () => {
  271. const model = {
  272. roleid: id,
  273. status: status === "1" ? "0" : "1",
  274. };
  275. const res = await asyncRequest.status(model);
  276. if (res && res.code === 0) {
  277. this.$notify.success({
  278. title: "状态修改成功",
  279. message: "",
  280. });
  281. this.searchList();
  282. } else if (res && res.code >= 100 && res.code <= 104) {
  283. await this.logout();
  284. } else {
  285. this.$message.warning(res.message);
  286. }
  287. })
  288. .catch(() => {
  289. console.log("取消");
  290. });
  291. },
  292. // 刷新表格
  293. async searchList() {
  294. this.loading = true;
  295. const res = await asyncRequest.list(this.parmValue);
  296. if (res && res.code === 0 && res.data) {
  297. this.tableData = res.data.list;
  298. this.tableData.map((e) => {
  299. e.userdoneList = e.userlist.join(",");
  300. return e;
  301. });
  302. this.pageInfo.total = Number(res.data.count);
  303. } else if (res && res.code >= 100 && res.code <= 104) {
  304. await this.logout();
  305. } else {
  306. this.tableData = [];
  307. this.pageInfo.total = 0;
  308. }
  309. this.loading = false;
  310. },
  311. },
  312. };
  313. </script>
  314. <style lang="scss" scoped>
  315. </style>