index.vue 11 KB

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