index.vue 7.8 KB

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