index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <search ref="search" @search="search"></search>
  5. <ele-pro-table ref="table" :columns="columns" :datasource="datasource">
  6. <!-- 表头工具栏 -->
  7. <template v-slot:toolbar>
  8. <el-button
  9. size="small"
  10. type="primary"
  11. icon="el-icon-plus"
  12. class="ele-btn-icon"
  13. @click="openEdit('add')"
  14. >
  15. 添加
  16. </el-button>
  17. </template>
  18. <template v-slot:files="scope">
  19. <el-link
  20. v-for="link in scope.row.files"
  21. :key="link.id"
  22. type="primary"
  23. :underline="false"
  24. @click="downloadFile(link)"
  25. >
  26. {{ link.name }}
  27. </el-link>
  28. </template>
  29. <template v-slot:qualityType="{ row }">
  30. {{ getDictValue('质检计划类型', row.qualityType) }}
  31. </template>
  32. <template v-slot:qualityMode="{ row }">
  33. {{ getDictValue('质检方式', row.qualityMode) }}
  34. </template>
  35. <template v-slot:accessory="scope">
  36. <el-link
  37. v-for="link in scope.row.accessory"
  38. :key="link.id"
  39. type="primary"
  40. :underline="false"
  41. @click="downloadFile(link)"
  42. >
  43. {{ link.name }}
  44. </el-link>
  45. </template>
  46. <!-- 操作列 -->
  47. <template v-slot:action="{ row }">
  48. <el-link
  49. type="primary"
  50. :underline="false"
  51. @click="openEdit('detail', row)"
  52. >
  53. 详情
  54. </el-link>
  55. <el-link
  56. type="primary"
  57. :underline="false"
  58. v-if="row.status==0"
  59. @click="openEdit('edit', row)"
  60. >
  61. 报工
  62. </el-link>
  63. <el-popconfirm
  64. class="ele-action"
  65. title="确定要删除吗?"
  66. @confirm="remove(row)"
  67. v-if="row.status==0"
  68. >
  69. <template v-slot:reference>
  70. <el-link type="danger" :underline="false" icon="el-icon-delete">
  71. 删除
  72. </el-link>
  73. </template>
  74. </el-popconfirm>
  75. </template>
  76. </ele-pro-table>
  77. </el-card>
  78. <edit ref="edit" @done="done"></edit>
  79. </div>
  80. </template>
  81. <script>
  82. import search from './components/search.vue';
  83. import edit from './components/edit.vue';
  84. import { getList, removeItem } from '@/api/inspectionWork';
  85. import dictMixins from '@/mixins/dictMixins';
  86. import {getFile} from "@/api/system/file";
  87. export default {
  88. mixins: [dictMixins],
  89. components: {
  90. search,
  91. edit
  92. },
  93. data() {
  94. return {
  95. columns: [
  96. {
  97. width: 50,
  98. type: 'index',
  99. columnKey: 'index',
  100. align: 'center',
  101. label: '序号',
  102. },
  103. {
  104. prop: 'code',
  105. label: '编码',
  106. align: 'center',
  107. showOverflowTooltip: true,
  108. width: 180,
  109. },
  110. {
  111. label: '来源生产工单号',
  112. width: 180,
  113. showOverflowTooltip: true,
  114. prop: 'workOrderCode',
  115. align: 'center'
  116. },
  117. {
  118. prop: 'batchNo',
  119. label: '批次号',
  120. showOverflowTooltip: true,
  121. align: 'center'
  122. },
  123. {
  124. prop: 'productName',
  125. showOverflowTooltip: true,
  126. label: '产品名称',
  127. align: 'center'
  128. },
  129. {
  130. prop: 'productCode',
  131. showOverflowTooltip: true,
  132. label: '产品编码',
  133. align: 'center'
  134. },
  135. {
  136. prop: 'specification',
  137. showOverflowTooltip: true,
  138. label: '规格',
  139. align: 'center'
  140. },
  141. {
  142. prop: 'brandNo',
  143. label: '牌号',
  144. showOverflowTooltip: true,
  145. align: 'center'
  146. },
  147. {
  148. label: '类型',
  149. showOverflowTooltip: true,
  150. prop: 'qualityType',
  151. slot: 'qualityType',
  152. width: 120
  153. },
  154. {
  155. label: '质检方式',
  156. showOverflowTooltip: true,
  157. prop: 'qualityMode',
  158. slot: 'qualityMode',
  159. width: 120
  160. },
  161. {
  162. prop: 'produceTaskName',
  163. showOverflowTooltip: true,
  164. label: '工序',
  165. align: 'center'
  166. },
  167. {
  168. prop: 'total',
  169. showOverflowTooltip: true,
  170. label: '总数量',
  171. align: 'center',
  172. width:80
  173. },
  174. {
  175. prop: 'qualifiedNumber',
  176. label: '合格数',
  177. showOverflowTooltip: true,
  178. align: 'center',
  179. width:80
  180. },
  181. {
  182. showOverflowTooltip: true,
  183. prop: 'qualificationRate',
  184. label: '合格率',
  185. align: 'center',
  186. width:80
  187. },
  188. {
  189. prop: 'noQualifiedNumber',
  190. showOverflowTooltip: true,
  191. label: '不合格数',
  192. align: 'center',
  193. width:80
  194. },
  195. {
  196. prop: 'noQualificationRate',
  197. showOverflowTooltip: true,
  198. label: '不合格率',
  199. align: 'center',
  200. width:80
  201. },
  202. {
  203. showOverflowTooltip: true,
  204. prop: 'hours',
  205. label: '工时',
  206. align: 'center',
  207. width:60
  208. },
  209. {
  210. prop: 'qualityTime',
  211. showOverflowTooltip: true,
  212. label: '质检时间',
  213. align: 'center',
  214. width:120
  215. },
  216. {
  217. prop: 'qualityName',
  218. label: '质检人',
  219. showOverflowTooltip: true,
  220. align: 'center',
  221. width:80
  222. },
  223. {
  224. label: '附件',
  225. prop: 'accessory',
  226. showOverflowTooltip: true,
  227. slot: 'accessory'
  228. },
  229. {
  230. prop: 'status',
  231. label: '状态',
  232. align: 'center',
  233. width:80,
  234. formatter: (row, column, cellValue) => {
  235. return cellValue==0?'未报工':cellValue==1?'已报工':''
  236. }
  237. },
  238. {
  239. columnKey: 'action',
  240. label: '操作',
  241. width: 220,
  242. align: 'center',
  243. resizable: false,
  244. slot: 'action',
  245. fixed: 'right'
  246. }
  247. ]
  248. };
  249. },
  250. created() {
  251. this.requestDict('质检计划类型');
  252. this.requestDict('不良品处理类型');
  253. this.requestDict('质检方式');
  254. },
  255. methods: {
  256. datasource({ page, where, limit }) {
  257. return getList({
  258. ...where,
  259. pageNum: page,
  260. size: limit
  261. });
  262. },
  263. search(where) {
  264. this.$refs.table.reload({
  265. where: where,
  266. page: 1
  267. });
  268. },
  269. openEdit(type, row) {
  270. this.$refs.edit.open(type, row);
  271. },
  272. downloadFile(file) {
  273. getFile({objectName: file.storePath}, file.name);
  274. },
  275. remove(row) {
  276. removeItem([row.id])
  277. .then((message) => {
  278. this.$message.success(message);
  279. this.done();
  280. })
  281. .catch((e) => {});
  282. },
  283. done() {
  284. this.$refs.search.search();
  285. }
  286. }
  287. };
  288. </script>