index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <seek-page :seekList="seekList" @search="search"></seek-page>
  5. <ele-pro-table
  6. ref="table"
  7. row-key="id"
  8. :columns="columns"
  9. :datasource="datasource"
  10. @columns-change="handleColumnChange"
  11. :cache-key="cacheKeyUrl"
  12. autoAmendPage
  13. >
  14. <template v-slot:toolbar>
  15. <el-button type="primary" size="mini" @click="addSampleOpen('add')"
  16. v-if="$hasPermission('qms:samplingrecord:save')"
  17. >新增</el-button
  18. >
  19. </template>
  20. <template v-slot:code="{ row }">
  21. <el-link
  22. type="primary"
  23. :underline="false"
  24. @click="addSampleOpen('view', row)"
  25. >
  26. {{ row.code }}
  27. </el-link>
  28. </template>
  29. <template v-slot:action="{ row }">
  30. <el-link
  31. type="primary"
  32. :underline="false"
  33. icon="el-icon-edit"
  34. @click="addSampleOpen('edit', row)"
  35. v-if="[0, 3].includes(row.approvalStatus)&&$hasPermission('qms:samplingrecord:update')"
  36. >
  37. 编辑
  38. </el-link>
  39. <el-link
  40. type="primary"
  41. :underline="false"
  42. v-if="[0, 3].includes(row.approvalStatus)&&$hasPermission('qms:samplingrecord:update')"
  43. @click="approvalSubmit(row)"
  44. >提交</el-link
  45. >
  46. <!-- <el-popconfirm
  47. class="ele-action"
  48. title="确定要删除此条数据吗?"
  49. @confirm="deleteRow(row)"
  50. v-if="[0, 3].includes(row.approvalStatus)&&$hasPermission('qms:samplingrecord:update')"
  51. >
  52. <template v-slot:reference>
  53. <el-link type="danger" :underline="false" icon="el-icon-delete">
  54. 删除
  55. </el-link>
  56. </template>
  57. </el-popconfirm> -->
  58. </template>
  59. </ele-pro-table>
  60. </el-card>
  61. <addSample ref="addSampleRef" @reload="search" :isSampleRecord="true"></addSample>
  62. <processSubmitDialog
  63. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  64. v-if="processSubmitDialogFlag"
  65. ref="processSubmitDialogRef"
  66. @reload="search"
  67. ></processSubmitDialog>
  68. </div>
  69. </template>
  70. <script>
  71. import dictMixins from '@/mixins/dictMixins';
  72. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  73. import addSample from './components/addSample.vue';
  74. import { samplingRecordsPage } from '@/api/samplingRecords';
  75. import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
  76. import { reviewStatus } from '@/enum/dict';
  77. export default {
  78. mixins: [dictMixins, tableColumnsMixin],
  79. components: {
  80. addSample,
  81. processSubmitDialog
  82. },
  83. data() {
  84. return {
  85. processSubmitDialogFlag: false,
  86. cacheKeyUrl: 'qms-2511141047-sampleRecord-table',
  87. columns: [
  88. {
  89. width: 50,
  90. type: 'index',
  91. columnKey: 'index',
  92. align: 'center',
  93. label: '序号'
  94. },
  95. {
  96. prop: 'code',
  97. label: '取样记录编码',
  98. slot: 'code',
  99. align: 'center',
  100. minWidth: 150,
  101. showOverflowTooltip: true
  102. },
  103. {
  104. prop: 'qualityWorkOrderCode',
  105. label: '质检工单编码',
  106. align: 'center',
  107. minWidth: 150,
  108. showOverflowTooltip: true
  109. },
  110. {
  111. prop: 'qualityWorkOrderName',
  112. label: '质检工单名称',
  113. align: 'center',
  114. minWidth: 120,
  115. showOverflowTooltip: true
  116. },
  117. {
  118. prop: 'sourceCode',
  119. label: '来源单号',
  120. align: 'center',
  121. minWidth: 150,
  122. showOverflowTooltip: true
  123. },
  124. {
  125. prop: 'qualityType',
  126. label: '类型',
  127. align: 'center',
  128. showOverflowTooltip: true,
  129. minWidth: 100,
  130. formatter: (row) => {}
  131. },
  132. {
  133. prop: 'qualityMode',
  134. label: '质检方式',
  135. align: 'center',
  136. minWidth: 100,
  137. formatter: (row) => {
  138. return row.qualityMode == 1 ? '全检' : '抽检';
  139. },
  140. showOverflowTooltip: true
  141. },
  142. {
  143. prop: 'productCode',
  144. label: '编码',
  145. align: 'center',
  146. minWidth: 110,
  147. showOverflowTooltip: true
  148. },
  149. {
  150. prop: 'productName',
  151. label: '名称',
  152. align: 'center',
  153. minWidth: 110,
  154. showOverflowTooltip: true
  155. },
  156. {
  157. prop: 'batchNo',
  158. label: '批次号',
  159. align: 'center',
  160. minWidth: 110,
  161. showOverflowTooltip: true
  162. },
  163. {
  164. prop: 'specification',
  165. label: '规格',
  166. align: 'center',
  167. minWidth: 110,
  168. showOverflowTooltip: true
  169. },
  170. {
  171. prop: 'modelType',
  172. label: '型号',
  173. align: 'center',
  174. minWidth: 110,
  175. showOverflowTooltip: true
  176. },
  177. {
  178. prop: 'brandNo',
  179. label: '牌号',
  180. align: 'center',
  181. minWidth: 110,
  182. showOverflowTooltip: true
  183. },
  184. {
  185. prop: 'produceTaskName',
  186. label: '工序名称',
  187. align: 'center',
  188. minWidth: 110,
  189. showOverflowTooltip: true
  190. },
  191. {
  192. prop: 'pleasePurpose',
  193. label: '请样目的',
  194. align: 'center',
  195. minWidth: 110,
  196. showOverflowTooltip: true
  197. },
  198. {
  199. prop: 'pleaseQuantity',
  200. label: '请样数量',
  201. align: 'center',
  202. minWidth: 110,
  203. showOverflowTooltip: true
  204. },
  205. {
  206. prop: 'pleaseUnit',
  207. label: '单位',
  208. align: 'center',
  209. minWidth: 110,
  210. showOverflowTooltip: true
  211. },
  212. {
  213. prop: 'conditionType',
  214. label: '取样',
  215. formatter: (row) => {
  216. return row.conditionType == 1 ? '整样' : '小样';
  217. },
  218. align: 'center',
  219. minWidth: 110,
  220. showOverflowTooltip: true
  221. },
  222. {
  223. prop: 'recordingMethod',
  224. label: '记录方法',
  225. align: 'center',
  226. formatter: (row) => {
  227. return row.recordingMethod == 1 ? '批样' : '单样全部';
  228. },
  229. minWidth: 110,
  230. showOverflowTooltip: true
  231. },
  232. {
  233. prop: 'quantity',
  234. label: '取样数量',
  235. align: 'center',
  236. minWidth: 110,
  237. showOverflowTooltip: true
  238. },
  239. {
  240. prop: 'unit',
  241. label: '单位',
  242. align: 'center',
  243. minWidth: 110,
  244. showOverflowTooltip: true
  245. },
  246. {
  247. prop: 'status',
  248. label: '状态',
  249. align: 'center',
  250. minWidth: 110,
  251. showOverflowTooltip: true,
  252. formatter: (_row, _column, cellValue) => {
  253. return _row.status == 1
  254. ? '审核中'
  255. : _row.status == 2
  256. ? '已取样'
  257. : '未提交';
  258. }
  259. },
  260. {
  261. prop: 'approvalStatus',
  262. label: '审核状态',
  263. align: 'center',
  264. minWidth: 110,
  265. showOverflowTooltip: true,
  266. formatter: (_row, _column, cellValue) => {
  267. return reviewStatus[_row.approvalStatus];
  268. }
  269. },
  270. {
  271. prop: 'createUserName',
  272. label: '创建人',
  273. align: 'center',
  274. minWidth: 110,
  275. showOverflowTooltip: true
  276. },
  277. {
  278. prop: 'createTime',
  279. label: '创建时间',
  280. align: 'center',
  281. minWidth: 110,
  282. showOverflowTooltip: true
  283. },
  284. {
  285. prop: 'approvalUserName',
  286. label: '审批人',
  287. align: 'center',
  288. minWidth: 110,
  289. showOverflowTooltip: true
  290. },
  291. {
  292. prop: 'approvalTime',
  293. label: '审批时间',
  294. align: 'center',
  295. minWidth: 110,
  296. showOverflowTooltip: true
  297. },
  298. {
  299. columnKey: 'action',
  300. label: '操作',
  301. width: 220,
  302. align: 'center',
  303. resizable: false,
  304. fixed: 'right',
  305. slot: 'action',
  306. showOverflowTooltip: true
  307. }
  308. ]
  309. };
  310. },
  311. computed: {
  312. seekList() {
  313. return [
  314. {
  315. label: '质检工单编码:',
  316. value: 'workOrderCode',
  317. type: 'input',
  318. placeholder: '请输入'
  319. },
  320. {
  321. label: '来源单号:',
  322. value: 'workOrderCode',
  323. type: 'input',
  324. placeholder: '请输入'
  325. },
  326. {
  327. label: '类型:',
  328. value: 'type',
  329. type: 'select',
  330. placeholder: '请输入',
  331. planList: [
  332. { label: '类型一', value: '1' },
  333. { label: '类型二', value: '2' }
  334. ]
  335. }
  336. ];
  337. }
  338. },
  339. methods: {
  340. // 刷新表格
  341. reload(where = {}) {
  342. this.$refs.table.reload({
  343. where
  344. });
  345. },
  346. addSampleOpen(type, row) {
  347. this.$refs.addSampleRef.open(type, row);
  348. },
  349. approvalSubmit(res) {
  350. this.processSubmitDialogFlag = true;
  351. this.$nextTick(() => {
  352. let params = {
  353. businessId: res.id,
  354. businessKey: 'sampling_approval_process',
  355. formCreateUserId: res.createUserId,
  356. variables: {
  357. businessCode: res.code,
  358. businessName: res.name,
  359. businessType: '取样'
  360. }
  361. };
  362. this.$refs.processSubmitDialogRef.init(params);
  363. });
  364. },
  365. /* 表格数据源 */
  366. datasource({ page, limit, where, order }) {
  367. // 参数
  368. const body = {
  369. ...where,
  370. ...order,
  371. pageNum: page,
  372. size: limit
  373. };
  374. return samplingRecordsPage(body);
  375. },
  376. search(where) {
  377. this.reload(where);
  378. }
  379. }
  380. };
  381. </script>
  382. <style></style>