listCoomModal.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <ele-modal
  3. title="合格证列表"
  4. :visible.sync="visible"
  5. width="90%"
  6. append-to-body
  7. >
  8. <div class="ele-body">
  9. <el-card shadow="never">
  10. <!-- 搜索表单 -->
  11. <search @search="reload" />
  12. <!-- 数据表格 -->
  13. <ele-pro-table
  14. ref="table"
  15. :columns="columns"
  16. :datasource="datasource"
  17. row-key="code"
  18. :page-size="20"
  19. @columns-change="handleColumnChange"
  20. :cache-key="cacheKeyUrl"
  21. :selection.sync="selection"
  22. :needPage="false"
  23. height="500px"
  24. full-height="calc(100vh - 200px)"
  25. >
  26. <template v-slot:type="{ row }">{{
  27. getDictValue('质检计划类型', row.type)
  28. }}</template>
  29. </ele-pro-table>
  30. </el-card>
  31. </div>
  32. <div slot="footer">
  33. <el-button type="primary" @click="save()"> 确认 </el-button>
  34. <el-button @click="visible = false">关闭</el-button>
  35. </div>
  36. </ele-modal>
  37. </template>
  38. <script>
  39. import search from './search.vue';
  40. import tabMixins from '@/mixins/tableColumnsMixin';
  41. import { getList } from '@/api/certificateManagement';
  42. import dictMixins from '@/mixins/dictMixins';
  43. export default {
  44. components: {
  45. search
  46. },
  47. mixins: [dictMixins, tabMixins],
  48. data() {
  49. return {
  50. cacheKeyUrl: 'qsm-c2e9664a-certificateManagement',
  51. selection: [],
  52. orderTypeList: [
  53. {
  54. id: 0,
  55. label: '库存性订单'
  56. },
  57. {
  58. id: 1,
  59. label: '生产性订单'
  60. },
  61. {
  62. id: 2,
  63. label: '无客户生产性订单'
  64. },
  65. {
  66. id: 4,
  67. label: '不定向订单'
  68. }
  69. ],
  70. visible: false,
  71. // 表格列配置
  72. columns: []
  73. };
  74. },
  75. created() {
  76. this.requestDict('质检计划类型');
  77. this.requestDict('取样类型');
  78. },
  79. methods: {
  80. open() {
  81. this.visible = true;
  82. this.setColumns();
  83. },
  84. duplicateChecking() {
  85. let is = false;
  86. let key = ['type', 'batchNo', 'produceTaskName', 'orderNo'];
  87. key.forEach((_key) => {
  88. if (
  89. this.selection.some((item) => item[_key] != this.selection[0][_key])
  90. ) {
  91. is = true;
  92. }
  93. });
  94. // if(){
  95. // }
  96. return is;
  97. },
  98. save() {
  99. if (!this.selection.length) {
  100. this.$message.error('请选择合格证');
  101. return;
  102. }
  103. if (this.selection.length > 1 && this.duplicateChecking()) {
  104. this.$message.warning(
  105. '合格证类型、批次号、工序、订单号必须保持一致!'
  106. );
  107. return;
  108. }
  109. this.visible = false;
  110. let data = this.selection[0];
  111. this.$emit('success', {
  112. batchNo: data.batchNo,
  113. certificateId: this.selection.map((item) => item.id).toString(),
  114. contractor: data.contractor,
  115. generateType: 2,
  116. isMerged: 1,
  117. luxuryProductCode: data.luxuryProductCode,
  118. luxuryProductName: data.luxuryProductName,
  119. orderNo: data.orderNo,
  120. orderType: data.orderType,
  121. productCode: data.productCode,
  122. productName: data.productName,
  123. processingType: data.processingType,
  124. produceTaskCode: data.produceTaskCode,
  125. produceTaskId: data.produceTaskId,
  126. produceTaskName: data.produceTaskName,
  127. qualityWorkOrderId: data.qualityWorkOrderId,
  128. // reportTemplateId: data.reportTemplateId,
  129. // reportTemplateCode: data.reportTemplateCode,
  130. // reportTemplateName: data.reportTemplateName,
  131. type: data.type,
  132. workAme: data.workAme,
  133. qualifiedQuantity: this.selection.reduce(
  134. (total, item) => total + item.qualifiedQuantity,
  135. 0
  136. ),
  137. quantity: this.selection.reduce(
  138. (total, item) => total + item.quantity,
  139. 0
  140. )
  141. });
  142. },
  143. setColumns() {
  144. this.columns = [
  145. {
  146. columnKey: 'index',
  147. label: '序号',
  148. type: 'index',
  149. width: 55,
  150. align: 'center',
  151. showOverflowTooltip: true,
  152. fixed: 'left'
  153. },
  154. {
  155. width: 45,
  156. type: 'selection',
  157. columnKey: 'selection',
  158. align: 'center'
  159. },
  160. {
  161. prop: 'code',
  162. slot: 'code',
  163. label: '合格证号',
  164. showOverflowTooltip: true,
  165. align: 'center',
  166. minWidth: 130
  167. },
  168. {
  169. prop: 'quantity',
  170. label: '交验数量',
  171. showOverflowTooltip: true,
  172. align: 'center',
  173. minWidth: 100
  174. },
  175. {
  176. prop: 'qualifiedQuantity',
  177. label: '合格数量',
  178. showOverflowTooltip: true,
  179. align: 'center',
  180. minWidth: 110
  181. },
  182. {
  183. prop: 'type',
  184. label: '类型',
  185. slot: 'type',
  186. showOverflowTooltip: true,
  187. align: 'center',
  188. minWidth: 110
  189. },
  190. // {
  191. // prop: 'remark',
  192. // minWidth: 180,
  193. // label: '重要记事',
  194. // align: 'center',
  195. // showOverflowTooltip: true
  196. // },
  197. {
  198. prop: 'produceTaskName',
  199. minWidth: 110,
  200. label: '工序名称',
  201. align: 'center',
  202. showOverflowTooltip: true
  203. },
  204. {
  205. prop: 'produceTaskCode',
  206. minWidth: 110,
  207. label: '工序编号',
  208. align: 'center',
  209. showOverflowTooltip: true
  210. },
  211. {
  212. prop: 'batchNo',
  213. minWidth: 110,
  214. label: '批次号',
  215. align: 'center',
  216. showOverflowTooltip: true
  217. },
  218. {
  219. prop: 'orderNo',
  220. label: '订单号',
  221. showOverflowTooltip: true,
  222. align: 'center',
  223. minWidth: 140
  224. },
  225. {
  226. prop: 'luxuryProductCode',
  227. minWidth: 110,
  228. label: '顶级产品编码',
  229. align: 'center',
  230. showOverflowTooltip: true
  231. },
  232. {
  233. prop: 'luxuryProductName',
  234. minWidth: 110,
  235. label: '顶级产品名称',
  236. align: 'center',
  237. showOverflowTooltip: true
  238. },
  239. {
  240. prop: 'productCode',
  241. minWidth: 110,
  242. label: '编码',
  243. align: 'center',
  244. showOverflowTooltip: true
  245. },
  246. {
  247. prop: 'productName',
  248. minWidth: 110,
  249. label: '名称',
  250. align: 'center',
  251. showOverflowTooltip: true
  252. },
  253. // {
  254. // prop: 'executeDeptName',
  255. // label: '下发数量',
  256. // showOverflowTooltip: true,
  257. // align: 'center',
  258. // minWidth: 110
  259. // },
  260. {
  261. prop: 'measureUnit',
  262. minWidth: 110,
  263. label: '计量单位',
  264. align: 'center',
  265. showOverflowTooltip: true
  266. },
  267. {
  268. prop: 'processingType',
  269. minWidth: 110,
  270. label: '加工类型',
  271. align: 'center',
  272. formatter: (row) => {
  273. return row.processingType == 2
  274. ? '加工'
  275. : row.processingType == 3
  276. ? '装配'
  277. : '';
  278. },
  279. showOverflowTooltip: true
  280. },
  281. {
  282. prop: 'workAme',
  283. minWidth: 110,
  284. label: '作业名称',
  285. align: 'center',
  286. showOverflowTooltip: true
  287. },
  288. {
  289. prop: 'contractor',
  290. minWidth: 110,
  291. label: '承制单位',
  292. align: 'center',
  293. showOverflowTooltip: true
  294. },
  295. {
  296. prop: 'orderType',
  297. minWidth: 110,
  298. label: '订单类型',
  299. align: 'center',
  300. formatter: (_row, _column, cellValue) => {
  301. let obj = this.orderTypeList.find(
  302. (el) => el.id == _row.orderType
  303. );
  304. return obj ? obj.label : '';
  305. },
  306. showOverflowTooltip: true
  307. },
  308. {
  309. prop: 'createUserName',
  310. minWidth: 110,
  311. label: '创建人',
  312. align: 'center',
  313. showOverflowTooltip: true
  314. },
  315. {
  316. prop: 'createTime',
  317. minWidth: 110,
  318. label: '创建时间',
  319. align: 'center',
  320. showOverflowTooltip: true
  321. },
  322. {
  323. prop: 'approvalUserName',
  324. minWidth: 110,
  325. label: '审批人',
  326. align: 'center',
  327. showOverflowTooltip: true
  328. },
  329. {
  330. prop: 'approvalTime',
  331. minWidth: 110,
  332. label: '审批时间',
  333. align: 'center',
  334. showOverflowTooltip: true
  335. }
  336. ].filter((el) => !el.isNone);
  337. },
  338. /*回显类型 */
  339. /* 表格数据源 */
  340. datasource({ page, where, limit }) {
  341. return getList({
  342. ...where,
  343. generateType: 1,
  344. isMerged: 0,
  345. pageNum: 1,
  346. size: 999
  347. });
  348. },
  349. /* 刷新表格 */
  350. reload(where) {
  351. this.$refs.table.reload({ page: 1, where: where });
  352. }
  353. }
  354. };
  355. </script>