index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <order-search @search="reload" ref="searchRef"> </order-search>
  5. <ele-pro-table
  6. ref="table"
  7. :columns="columns"
  8. :datasource="datasource"
  9. :selection.sync="selection"
  10. row-key="id"
  11. :page-size="20"
  12. @columns-change="handleColumnChange"
  13. :cache-key="cacheKeyUrl"
  14. >
  15. <template v-slot:type="{ row }">
  16. <span> {{ getDictValue('异常类型', row.type + '') }}</span>
  17. </template>
  18. <template v-slot:code="{ row }">
  19. <el-link
  20. type="primary"
  21. :underline="false"
  22. @click="dispose('detail', row)"
  23. >
  24. {{ row.code }}
  25. </el-link>
  26. </template>
  27. <!-- 操作列 -->
  28. <!-- 表头工具栏 -->
  29. <template v-slot:toolbar>
  30. <el-button
  31. size="small"
  32. type="primary"
  33. icon="el-icon-plus"
  34. class="ele-btn-icon"
  35. @click="dispose('add')"
  36. >
  37. 新建
  38. </el-button>
  39. <!-- <el-button
  40. size="small"
  41. type="danger"
  42. icon="el-icon-delete"
  43. class="ele-btn-icon"
  44. @click="remove()"
  45. plain
  46. :disabled="selection.length == 0"
  47. >
  48. 删除
  49. </el-button>
  50. <el-button
  51. size="small"
  52. type="primary"
  53. icon="el-icon-upload2"
  54. class="ele-btn-icon"
  55. plain
  56. >
  57. 导出
  58. </el-button>
  59. <el-button
  60. size="small"
  61. type="primary"
  62. icon="el-icon-download"
  63. class="ele-btn-icon"
  64. plain
  65. >
  66. 导入
  67. </el-button> -->
  68. <!-- <el-button
  69. size="small"
  70. type="primary"
  71. icon="el-icon-circle-plus-outline"
  72. class="ele-btn-icon"
  73. plain
  74. :disabled="selection.length == 0"
  75. >
  76. 处置
  77. </el-button> -->
  78. </template>
  79. <!-- <template v-slot:action="{ row }">
  80. <el-link
  81. type="primary"
  82. :underline="false"
  83. icon="el-icon-circle-plus-outline"
  84. v-if="(row.approvalStatus == 0 || row.approvalStatus == 3)&&(!row.exceptionClose||row.exceptionClose==2)"
  85. @click="submit(row.id)"
  86. >
  87. 提交
  88. </el-link>
  89. </template> -->
  90. <template v-slot:action="{ row }">
  91. <el-link
  92. type="primary"
  93. :underline="false"
  94. icon="el-icon-truck"
  95. v-if="row.approvalStatus == 0 || row.approvalStatus == 3"
  96. @click="dispose('edit', row)"
  97. >
  98. 编辑
  99. </el-link>
  100. <el-link
  101. type="primary"
  102. :underline="false"
  103. v-if="row.approvalStatus == 0 || row.approvalStatus == 3"
  104. @click="submit(row)"
  105. >
  106. 提交
  107. </el-link>
  108. <el-popconfirm
  109. class="ele-action"
  110. title="确定要删除吗?"
  111. v-if="row.approvalStatus == 0 || row.approvalStatus == 3"
  112. @confirm="remove([row.id])"
  113. >
  114. <template v-slot:reference>
  115. <el-link type="danger" :underline="false" icon="el-icon-delete">
  116. 删除
  117. </el-link>
  118. </template>
  119. </el-popconfirm>
  120. </template>
  121. <dispose
  122. ref="disposeRef"
  123. @done="reload"
  124. :relationType="relationType == '1,3' ? 1 : relationType"
  125. ></dispose>
  126. </ele-pro-table>
  127. </el-card>
  128. <process-submit-dialog
  129. :isNotNeedProcess="false"
  130. :isCloseRefresh="false"
  131. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  132. v-if="processSubmitDialogFlag"
  133. ref="processSubmitDialogRef"
  134. @reload="reload"
  135. ></process-submit-dialog>
  136. </div>
  137. </template>
  138. <script>
  139. import OrderSearch from '../components/order-search.vue';
  140. import dictMixins from '@/mixins/dictMixins';
  141. // import Create from '../components/create';
  142. import dispose from '../components/addOrEditDialog';
  143. import { getList, remove, submit, getById } from '@/api/exceptionManagement/index';
  144. import { relationTypeOption } from '@/enum/dict.js';
  145. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  146. import tabMixins from '@/mixins/tableColumnsMixin';
  147. import { reviewStatus } from '@/enum/dict';
  148. export default {
  149. components: {
  150. OrderSearch,
  151. dispose,
  152. processSubmitDialog
  153. },
  154. mixins: [dictMixins, tabMixins],
  155. props: {
  156. relationType: {
  157. default: '1,3'
  158. }
  159. },
  160. data() {
  161. return {
  162. visible: false,
  163. loading: false,
  164. processSubmitDialogFlag: false,
  165. releasParams: {
  166. teamId: '',
  167. id: ''
  168. },
  169. selection: [],
  170. // userOptions: [],
  171. viewId: '',
  172. qualityInspector: '',
  173. cacheKeyUrl: 'eos-7a45afd7-saleManage-exceptionList',
  174. columnsVersion: 1
  175. };
  176. },
  177. computed: {
  178. // 表格列配置
  179. columns() {
  180. // 当columnsVersion变化时会重新计算,用作更新列配置
  181. const version = this.columnsVersion;
  182. return [
  183. {
  184. columnKey: 'selection',
  185. type: 'selection',
  186. width: 45,
  187. align: 'center',
  188. fixed: 'left'
  189. },
  190. {
  191. columnKey: 'index',
  192. label: '序号',
  193. type: 'index',
  194. width: 55,
  195. align: 'center',
  196. showOverflowTooltip: true,
  197. fixed: 'left'
  198. },
  199. {
  200. prop: 'code',
  201. label: '编码',
  202. align: 'center',
  203. slot: 'code'
  204. },
  205. {
  206. prop: 'name',
  207. label: '名称',
  208. align: 'center'
  209. },
  210. {
  211. prop: 'progress',
  212. label: '进度',
  213. align: 'center',
  214. formatter: (row, column, cellValue) => {
  215. return cellValue == 1
  216. ? '处置中'
  217. : cellValue == 2
  218. ? '处置完毕'
  219. : cellValue == 3
  220. ? '暂时搁置'
  221. : cellValue == 4
  222. ? '关闭'
  223. : '未开始';
  224. }
  225. },
  226. // {
  227. // prop: 'describes',
  228. // label: '异常描述',
  229. // align: 'center'
  230. // },
  231. // {
  232. // prop: 'disposalStatus',
  233. // label: '处置类型',
  234. // align: 'center',
  235. // },
  236. {
  237. prop: 'relationType',
  238. label: '来源单据类型',
  239. align: 'center',
  240. formatter: (row, column, cellValue) => {
  241. return relationTypeOption[cellValue] || '';
  242. }
  243. },
  244. {
  245. prop: 'relationCode',
  246. label: '来源单据编码',
  247. align: 'center'
  248. },
  249. {
  250. prop: 'relationName',
  251. label: '来源单据名称',
  252. align: 'center'
  253. },
  254. {
  255. prop: 'createUserName',
  256. label: '创建人',
  257. align: 'center'
  258. },
  259. {
  260. prop: 'createTime',
  261. label: '创建时间',
  262. align: 'center'
  263. },
  264. {
  265. prop: 'approvalStatus',
  266. label: '审批状态',
  267. align: 'center',
  268. formatter: (_row, _column, cellValue) => {
  269. return reviewStatus[_row.approvalStatus];
  270. }
  271. },
  272. {
  273. columnKey: 'action',
  274. label: '操作',
  275. width: 180,
  276. align: 'center',
  277. resizable: false,
  278. fixed: 'right',
  279. slot: 'action',
  280. showOverflowTooltip: true
  281. }
  282. ];
  283. }
  284. },
  285. created() {
  286. this.requestDict('异常类型');
  287. // this.userOptions = [];
  288. // listAllUserBind().then((data) => {
  289. // return;
  290. // this.userOptions.push(...data);
  291. // });
  292. },
  293. filters: {},
  294. activated() {
  295. // 由 keep-alive 切回时刷新列表,但保留搜索条件与当前页码
  296. if (this.$refs.table) {
  297. this.$refs.table.reload();
  298. }
  299. },
  300. methods: {
  301. //处置
  302. dispose(type, row) {
  303. this.$refs.disposeRef.open(type, row);
  304. },
  305. /* 表格数据源 */
  306. datasource({ page, limit, where }) {
  307. return getList({
  308. pageNum: page,
  309. size: limit,
  310. ...where,
  311. relationType: this.relationType
  312. });
  313. },
  314. open(type, row) {
  315. this.$refs.create.open(type, row);
  316. },
  317. remove(id) {
  318. remove(id).then((res) => {
  319. this.reload();
  320. });
  321. },
  322. async submit(res) {
  323. this.processSubmitDialogFlag = true;
  324. let data = await getById(res.id);
  325. console.log(data);
  326. let isExceptionDispose = false;
  327. let isExceptionDetermine = false;
  328. data.detailList.forEach((item) => {
  329. if (!item.exceptionDispose) {
  330. isExceptionDispose = true;
  331. }
  332. if (!item.exceptionDetermine) {
  333. isExceptionDetermine = true;
  334. }
  335. });
  336. if (isExceptionDispose) {
  337. this.$message.error('处置方式不能为空');
  338. // this.dispose('edit', res)
  339. return;
  340. }
  341. if (isExceptionDetermine) {
  342. this.$message.error('异常类型不能为空');
  343. // this.dispose('edit', res)
  344. return;
  345. }
  346. this.$nextTick(() => {
  347. let params = {
  348. businessId: res.id,
  349. businessKey: 'eom_exception_approve',
  350. formCreateUserId: res.createUserId,
  351. variables: {
  352. businessCode: res.code,
  353. businessName: res.name,
  354. businessType: res.relationName
  355. }
  356. };
  357. this.$refs.processSubmitDialogRef.init(params);
  358. });
  359. },
  360. /* 刷新表格 */
  361. reload(where) {
  362. this.$nextTick(() => {
  363. this.$refs.table.reload({ page: 1, where });
  364. this.$emit('getToDoReminder');
  365. });
  366. }
  367. }
  368. };
  369. </script>
  370. <style lang="scss" scoped></style>