index.vue 10.0 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. cache-key="eceptionList"
  12. >
  13. <template v-slot:type="{ row }">
  14. <span> {{ getDictValue('异常类型', row.type + '') }}</span>
  15. </template>
  16. <template v-slot:approvalStatus="{ row }">
  17. <span
  18. v-if="row.exceptionClose == 2 || !row.exceptionClose"
  19. :style="{
  20. color:
  21. row.approvalStatus == 1
  22. ? '#409EFF'
  23. : row.approvalStatus == 2
  24. ? '#67C23A'
  25. : row.approvalStatus == 3
  26. ? '#F56C6C'
  27. : ''
  28. }"
  29. >
  30. {{
  31. row.approvalStatus == 1
  32. ? '审核中'
  33. : row.approvalStatus == 2
  34. ? '审核通过'
  35. : row.approvalStatus == 3
  36. ? '审核不通过'
  37. : row.approvalStatus == 4
  38. ? '已处置'
  39. : '草稿'
  40. }}
  41. </span>
  42. <span v-else>关闭</span>
  43. </template>
  44. <template v-slot:code="{ row }">
  45. <el-link
  46. type="primary"
  47. :underline="false"
  48. @click="open('detail', row)"
  49. >
  50. {{ row.code }}
  51. </el-link>
  52. </template>
  53. <!-- 操作列 -->
  54. <!-- 表头工具栏 -->
  55. <template v-slot:toolbar>
  56. <el-button
  57. size="small"
  58. type="primary"
  59. icon="el-icon-plus"
  60. class="ele-btn-icon"
  61. @click="open('add')"
  62. >
  63. 新建
  64. </el-button>
  65. <el-button
  66. size="small"
  67. type="danger"
  68. icon="el-icon-delete"
  69. class="ele-btn-icon"
  70. @click="remove()"
  71. plain
  72. :disabled="selection.length == 0"
  73. >
  74. 删除
  75. </el-button>
  76. <el-button
  77. size="small"
  78. type="primary"
  79. icon="el-icon-upload2"
  80. class="ele-btn-icon"
  81. plain
  82. >
  83. 导出
  84. </el-button>
  85. <el-button
  86. size="small"
  87. type="primary"
  88. icon="el-icon-download"
  89. class="ele-btn-icon"
  90. plain
  91. >
  92. 导入
  93. </el-button>
  94. <!-- <el-button
  95. size="small"
  96. type="primary"
  97. icon="el-icon-circle-plus-outline"
  98. class="ele-btn-icon"
  99. plain
  100. :disabled="selection.length == 0"
  101. >
  102. 处置
  103. </el-button> -->
  104. </template>
  105. <template v-slot:action="{ row }">
  106. <el-link
  107. type="primary"
  108. :underline="false"
  109. icon="el-icon-truck"
  110. v-if="row.approvalStatus == 0 || row.approvalStatus == 3"
  111. @click="open('edit', row)"
  112. >
  113. 编辑
  114. </el-link>
  115. <el-popconfirm
  116. class="ele-action"
  117. title="确定要删除吗?"
  118. v-if="row.approvalStatus == 0 || row.approvalStatus == 3"
  119. @confirm="remove([row.id])"
  120. >
  121. <template v-slot:reference>
  122. <el-link type="danger" :underline="false" icon="el-icon-delete">
  123. 删除
  124. </el-link>
  125. </template>
  126. </el-popconfirm>
  127. <el-link
  128. type="primary"
  129. :underline="false"
  130. icon="el-icon-circle-plus-outline"
  131. v-if="row.approvalStatus == 2 && row.exceptionClose == 2"
  132. @click="dispose(row)"
  133. >
  134. 处置
  135. </el-link>
  136. <el-link
  137. type="primary"
  138. :underline="false"
  139. icon="el-icon-circle-plus-outline"
  140. v-if="
  141. (row.approvalStatus == 0 || row.approvalStatus == 3) &&
  142. (!row.exceptionClose || row.exceptionClose == 2)
  143. "
  144. @click="submit(row.id)"
  145. >
  146. 提交
  147. </el-link>
  148. </template>
  149. </ele-pro-table>
  150. </el-card>
  151. <Create ref="create" @refresh="reload" />
  152. <dispose ref="dispose" @refresh="reload" />
  153. <ele-modal
  154. :visible.sync="visible"
  155. width="20vw"
  156. append-to-body
  157. :maxable="true"
  158. >
  159. <el-form ref="form" label-width="100px" class="create-form">
  160. <el-form-item
  161. label="审核人"
  162. prop="qualityInspector"
  163. style="margin-bottom: 20px"
  164. >
  165. <el-select
  166. v-model="qualityInspector"
  167. clearable
  168. style="width: 100%"
  169. :filterable="true"
  170. >
  171. <el-option
  172. v-for="item in userOptions"
  173. :key="item.id"
  174. :label="item.name"
  175. :value="item.id"
  176. />
  177. </el-select>
  178. </el-form-item>
  179. </el-form>
  180. <template v-slot:footer>
  181. <el-button @click="visible = false">取消</el-button>
  182. <el-button type="primary" @click="submit()"> 确定 </el-button>
  183. </template></ele-modal
  184. >
  185. </div>
  186. </template>
  187. <script>
  188. import OrderSearch from '../components/order-search.vue';
  189. import dictMixins from '@/mixins/dictMixins';
  190. import Create from '../components/create';
  191. import dispose from '../components/dispose';
  192. import { getList, remove, submit } from '@/api/exceptionManagement/index';
  193. import { listAllUserBind } from '@/api/bpm/index';
  194. import { btnList } from '../components/transition';
  195. export default {
  196. components: {
  197. OrderSearch,
  198. Create,
  199. dispose
  200. },
  201. mixins: [dictMixins],
  202. data() {
  203. return {
  204. visible: false,
  205. loading: false,
  206. releasParams: {
  207. teamId: '',
  208. id: ''
  209. },
  210. selection: [],
  211. userOptions: [],
  212. viewId: '',
  213. qualityInspector: ''
  214. };
  215. },
  216. computed: {
  217. // 表格列配置
  218. columns() {
  219. return [
  220. {
  221. columnKey: 'selection',
  222. type: 'selection',
  223. width: 45,
  224. align: 'center',
  225. fixed: 'left'
  226. },
  227. {
  228. columnKey: 'index',
  229. label: '序号',
  230. type: 'index',
  231. width: 55,
  232. align: 'center',
  233. showOverflowTooltip: true,
  234. fixed: 'left'
  235. },
  236. {
  237. prop: 'type',
  238. label: '类型',
  239. align: 'center',
  240. slot: 'type'
  241. },
  242. {
  243. prop: 'code',
  244. label: '编码',
  245. align: 'center',
  246. slot: 'code'
  247. },
  248. {
  249. prop: 'name',
  250. label: '名称',
  251. align: 'center'
  252. },
  253. {
  254. prop: 'describes',
  255. label: '异常描述',
  256. align: 'center'
  257. },
  258. {
  259. prop: 'disposalStatus',
  260. label: '处置类型',
  261. align: 'center',
  262. formatter: (row, column, cellValue) => {
  263. return btnList.find((item) => item.type == cellValue)?.name;
  264. }
  265. },
  266. {
  267. prop: 'relationType',
  268. label: '关联类型',
  269. align: 'center',
  270. formatter: (row, column, cellValue) => {
  271. return cellValue == 1
  272. ? '生产计划'
  273. : cellValue == 2
  274. ? '生产订单'
  275. : '生产工单';
  276. }
  277. },
  278. {
  279. prop: 'relationCode',
  280. label: '关联编码',
  281. align: 'center'
  282. },
  283. // {
  284. // prop: 'a',
  285. // label: '关联名称',
  286. // align: 'center'
  287. // },
  288. {
  289. prop: 'createUserName',
  290. label: '创建人',
  291. align: 'center'
  292. },
  293. {
  294. prop: 'createTime',
  295. label: '创建时间',
  296. align: 'center'
  297. },
  298. {
  299. prop: 'approvalStatus',
  300. label: '状态',
  301. align: 'center',
  302. slot: 'approvalStatus'
  303. },
  304. {
  305. columnKey: 'action',
  306. label: '操作',
  307. width: 240,
  308. align: 'center',
  309. resizable: false,
  310. fixed: 'right',
  311. slot: 'action',
  312. showOverflowTooltip: true
  313. }
  314. ];
  315. }
  316. },
  317. created() {
  318. this.requestDict('异常类型');
  319. this.userOptions = [];
  320. listAllUserBind().then((data) => {
  321. this.userOptions.push(...data);
  322. });
  323. },
  324. filters: {},
  325. methods: {
  326. //处置
  327. dispose(row) {
  328. this.$refs.dispose.open(row);
  329. },
  330. /* 表格数据源 */
  331. datasource({ page, limit, where }) {
  332. return getList({
  333. pageNum: page,
  334. size: limit,
  335. ...where
  336. });
  337. },
  338. open(type, row) {
  339. this.$refs.create.open(type, row);
  340. },
  341. remove(id) {
  342. let ids = id || this.selection.map((item) => item.id);
  343. remove(ids).then((res) => {
  344. this.$message.success('删除' + res);
  345. this.reload();
  346. });
  347. },
  348. submit(id) {
  349. if (id) {
  350. this.visible = true;
  351. this.viewId = id;
  352. return;
  353. }
  354. if (!this.qualityInspector) {
  355. this.$message.error('审核人不能为空');
  356. return;
  357. }
  358. submit({
  359. businessId: this.viewId,
  360. approvalUserId: this.qualityInspector
  361. }).then((res) => {
  362. this.$message.success('提交' + res.message);
  363. this.reload();
  364. this.visible = false;
  365. });
  366. },
  367. /* 刷新表格 */
  368. reload(where) {
  369. this.$nextTick(() => {
  370. this.$refs.table.reload({ page: 1, where });
  371. });
  372. }
  373. }
  374. };
  375. </script>
  376. <style lang="scss" scoped></style>