index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <!-- 搜索表单 -->
  5. <search @search="reload" />
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. :selection.sync="selection"
  12. row-key="code"
  13. :page-size="20"
  14. @columns-change="handleColumnChange"
  15. :cache-key="cacheKeyUrl"
  16. >
  17. <!-- 表头工具栏 -->
  18. <template v-slot:qualityType="{ row }">
  19. {{ getDictValue('质检计划类型', row.qualityType) }}
  20. </template>
  21. <template v-slot:qualityMode="{ row }">
  22. {{ getDictValue('取样类型', row.qualityMode) }}
  23. </template>
  24. <!-- 操作列 -->
  25. <template v-slot:action="{ row }">
  26. <el-link
  27. type="primary"
  28. :underline="false"
  29. icon="el-icon-edit"
  30. @click="sampleCollection(row)"
  31. v-if="row.status == 0"
  32. >
  33. 收样
  34. </el-link>
  35. <el-link
  36. type="primary"
  37. :underline="false"
  38. icon="el-icon-edit"
  39. @click="openEdit(row)"
  40. v-if="row.status == 1"
  41. >
  42. 报工
  43. </el-link>
  44. </template>
  45. </ele-pro-table>
  46. </el-card>
  47. <!-- 编辑弹窗 -->
  48. <edit ref="edit" />
  49. </div>
  50. </template>
  51. <script>
  52. import search from './components/search.vue';
  53. // import edit from './components/inspectionProjectTaskSend.vue';
  54. import tabMixins from '@/mixins/tableColumnsMixin';
  55. import { getList, sampleCollection } from '@/api/inspectionProjectTask';
  56. import dictMixins from '@/mixins/dictMixins';
  57. export default {
  58. components: {
  59. search
  60. // edit
  61. },
  62. mixins: [dictMixins, tabMixins],
  63. data() {
  64. return {
  65. cacheKeyUrl: 'qsm-c2e9664a-inspectionProjectTask',
  66. // 表格列配置
  67. columns: [
  68. {
  69. columnKey: 'index',
  70. label: '序号',
  71. type: 'index',
  72. width: 55,
  73. align: 'center',
  74. showOverflowTooltip: true,
  75. fixed: 'left'
  76. },
  77. {
  78. prop: 'code',
  79. label: '请托单号',
  80. showOverflowTooltip: true,
  81. align: 'center',
  82. minWidth: 130
  83. },
  84. {
  85. prop: 'name',
  86. label: '任务名称',
  87. showOverflowTooltip: true,
  88. align: 'center',
  89. minWidth: 110
  90. },
  91. {
  92. prop: 'executeDeptName',
  93. label: '受托部门',
  94. showOverflowTooltip: true,
  95. align: 'center',
  96. minWidth: 110
  97. },
  98. {
  99. prop: 'executeUserName',
  100. minWidth: 110,
  101. label: '执行人员',
  102. align: 'center',
  103. showOverflowTooltip: true
  104. },
  105. {
  106. prop: 'requiredCompletionTime',
  107. minWidth: 110,
  108. label: '完成日期',
  109. align: 'center',
  110. showOverflowTooltip: true
  111. },
  112. {
  113. prop: 'urgent',
  114. minWidth: 110,
  115. label: '紧急程度',
  116. align: 'center',
  117. formatter: (row) => {
  118. return row.urgent == 1
  119. ? '普通'
  120. : row.urgent == 2
  121. ? '紧急'
  122. : '重要';
  123. },
  124. showOverflowTooltip: true
  125. },
  126. {
  127. prop: 'qualityWorkOrderCode',
  128. minWidth: 110,
  129. label: '质检工单编码',
  130. align: 'center',
  131. showOverflowTooltip: true
  132. },
  133. {
  134. prop: 'qualityWorkOrderName',
  135. minWidth: 110,
  136. label: '质检工单名称',
  137. align: 'center',
  138. showOverflowTooltip: true
  139. },
  140. {
  141. prop: 'sourceCode',
  142. minWidth: 110,
  143. label: '来源单号',
  144. align: 'center',
  145. showOverflowTooltip: true
  146. },
  147. {
  148. prop: 'qualityType',
  149. slot: 'qualityType',
  150. minWidth: 110,
  151. label: '类型',
  152. align: 'center',
  153. showOverflowTooltip: true
  154. },
  155. {
  156. slot: 'qualityMode',
  157. prop: 'qualityMode',
  158. minWidth: 110,
  159. label: '质检方式',
  160. align: 'center',
  161. showOverflowTooltip: true
  162. },
  163. {
  164. prop: 'productCode',
  165. minWidth: 110,
  166. label: '编码',
  167. align: 'center',
  168. showOverflowTooltip: true
  169. },
  170. {
  171. prop: 'productName',
  172. minWidth: 110,
  173. label: '名称',
  174. align: 'center',
  175. showOverflowTooltip: true
  176. },
  177. {
  178. prop: 'batchNo',
  179. minWidth: 110,
  180. label: '批次号',
  181. align: 'center',
  182. showOverflowTooltip: true
  183. },
  184. {
  185. prop: 'specification',
  186. minWidth: 110,
  187. label: '规格',
  188. align: 'center',
  189. showOverflowTooltip: true
  190. },
  191. {
  192. prop: 'brandNo',
  193. minWidth: 110,
  194. label: '牌号',
  195. align: 'center',
  196. showOverflowTooltip: true
  197. },
  198. {
  199. prop: 'produceTaskName',
  200. minWidth: 110,
  201. label: '工序名称',
  202. align: 'center',
  203. showOverflowTooltip: true
  204. },
  205. {
  206. prop: 'status',
  207. minWidth: 110,
  208. label: '状态',
  209. align: 'center',
  210. showOverflowTooltip: true
  211. },
  212. {
  213. prop: 'createUserName',
  214. minWidth: 110,
  215. label: '创建人',
  216. align: 'center',
  217. showOverflowTooltip: true
  218. },
  219. {
  220. prop: 'createTime',
  221. minWidth: 110,
  222. label: '创建时间',
  223. align: 'center',
  224. showOverflowTooltip: true
  225. },
  226. {
  227. prop: 'sampleReceiverName',
  228. minWidth: 110,
  229. label: '收样人',
  230. align: 'center',
  231. showOverflowTooltip: true
  232. },
  233. {
  234. prop: 'sampleReceiverTime',
  235. minWidth: 110,
  236. label: '收样时间',
  237. align: 'center',
  238. showOverflowTooltip: true
  239. },
  240. {
  241. columnKey: 'action',
  242. label: '操作',
  243. width: 220,
  244. align: 'center',
  245. resizable: false,
  246. slot: 'action',
  247. fixed: 'right',
  248. showOverflowTooltip: true
  249. }
  250. ]
  251. };
  252. },
  253. created() {
  254. this.requestDict('质检计划类型');
  255. this.requestDict('取样类型');
  256. },
  257. methods: {
  258. /*回显类型 */
  259. /* 表格数据源 */
  260. datasource({ page, where, limit }) {
  261. return getList({
  262. ...where,
  263. pageNum: page,
  264. size: limit
  265. });
  266. },
  267. /* 刷新表格 */
  268. reload(where) {
  269. this.$refs.table.reload({ page: 1, where: where });
  270. },
  271. uploadFile() {
  272. this.$refs.importDialogRef.open();
  273. },
  274. sampleCollection(row) {
  275. sampleCollection({ id: row.id }).then((res) => {
  276. this.$message.success('收样成功');
  277. this.reload();
  278. });
  279. },
  280. /* 打开编辑弹窗 */
  281. openEdit(row) {
  282. this.current = row;
  283. this.showEdit = true;
  284. this.$refs.userEdit.$refs.form &&
  285. this.$refs.userEdit.$refs.form.clearValidate();
  286. },
  287. /* 删除 */
  288. remove(row) {
  289. const loading = this.$loading({ lock: true });
  290. removeItem([row.id])
  291. .then((msg) => {
  292. loading.close();
  293. this.$message.success('删除' + msg);
  294. this.reload();
  295. })
  296. .catch((e) => {
  297. loading.close();
  298. });
  299. },
  300. /* 批量删除 */
  301. removeBatch() {
  302. if (!this.selection.length) {
  303. this.$message.error('请至少选择一条数据');
  304. return;
  305. }
  306. this.$confirm('确定要删除选中的质检吗?', '提示', {
  307. type: 'warning'
  308. })
  309. .then(() => {
  310. const loading = this.$loading({ lock: true });
  311. removeItem(this.selection.map((d) => d.id))
  312. .then((msg) => {
  313. loading.close();
  314. this.$message.success('删除' + msg);
  315. this.reload();
  316. })
  317. .catch((e) => {
  318. loading.close();
  319. });
  320. })
  321. .catch(() => {});
  322. }
  323. }
  324. };
  325. </script>