index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <!-- 不良品列表 -->
  2. <template>
  3. <div class="ele-body">
  4. <el-card shadow="never" v-loading="loading">
  5. <order-search @search="reload" ref="searchRef"> </order-search>
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. :pageSize="20"
  11. :height="tableHeight"
  12. @fullscreen-change="fullscreenChange"
  13. >
  14. <!-- 操作列 -->
  15. <template v-slot:toolbar>
  16. <el-button type="primary" @click="open()">新建</el-button>
  17. </template>
  18. <template v-slot:unqualifiedProductsCode="{ row }">
  19. <el-link
  20. type="primary"
  21. :underline="false"
  22. @click="goDetail(row, 'detail')"
  23. >{{ row.unqualifiedProductsCode }}</el-link
  24. >
  25. </template>
  26. <template v-slot:qualityType="{ row }">
  27. {{ getQuality(row) }}
  28. </template>
  29. <template v-slot:quantity="{ row }">
  30. {{ row.quantity }}{{ row.measureUnit }}
  31. </template>
  32. <template v-slot:status="{ row }">
  33. {{ getDispose(row) }}
  34. </template>
  35. <template v-slot:action="{ row }">
  36. <el-link
  37. v-if="row.status == 0"
  38. type="primary"
  39. :underline="false"
  40. icon="el-icon-truck"
  41. @click="open(row)"
  42. >
  43. 编辑
  44. </el-link>
  45. <el-popconfirm
  46. class="ele-action"
  47. title="确定要删除吗?"
  48. v-if="row.status == 0"
  49. @confirm="remove(row)"
  50. >
  51. <template v-slot:reference>
  52. <el-link type="danger" :underline="false" icon="el-icon-delete">
  53. 删除
  54. </el-link>
  55. </template>
  56. </el-popconfirm>
  57. <el-link
  58. v-if="row.status == 0 || row.status == 1"
  59. type="primary"
  60. :underline="false"
  61. icon="el-icon-edit"
  62. @click="goDetail(row)"
  63. >
  64. 处置
  65. </el-link>
  66. </template>
  67. </ele-pro-table>
  68. </el-card>
  69. <Create ref="create" @refresh="reload" />
  70. </div>
  71. </template>
  72. <script>
  73. import OrderSearch from './components/order-search.vue';
  74. import dictMixins from '@/mixins/dictMixins';
  75. import { unacceptedProductStatus } from '@/utils/util';
  76. import Create from './components/create.vue';
  77. import { getByCode } from '@/api/system/dictionary-data';
  78. import { getList } from '@/api/unacceptedProduct/index';
  79. import { getQualityDetails } from '@/api/manufacture/spreadWorkOrder';
  80. export default {
  81. components: {
  82. OrderSearch,
  83. Create
  84. },
  85. mixins: [dictMixins],
  86. data() {
  87. return {
  88. visible: false,
  89. loading: false,
  90. releasParams: {
  91. teamId: '',
  92. id: ''
  93. },
  94. current: null,
  95. qualityList: [],
  96. disposeList: [],
  97. tableHeight: 'calc(100vh - 340px)'
  98. };
  99. },
  100. computed: {
  101. // 表格列配置
  102. columns() {
  103. return [
  104. {
  105. columnKey: 'index',
  106. label: '序号',
  107. type: 'index',
  108. width: 55,
  109. align: 'center',
  110. showOverflowTooltip: true,
  111. fixed: 'left'
  112. },
  113. {
  114. prop: 'unqualifiedProductsCode',
  115. label: '编码',
  116. slot: 'unqualifiedProductsCode',
  117. align: 'center',
  118. width: 150,
  119. showOverflowTooltip: true
  120. },
  121. {
  122. prop: 'sourceCode',
  123. label: '来源编码',
  124. align: 'center',
  125. width: 150,
  126. showOverflowTooltip: true
  127. },
  128. {
  129. prop: 'categoryCode',
  130. label: '物品编码',
  131. align: 'center',
  132. width: 160,
  133. showOverflowTooltip: true
  134. },
  135. {
  136. prop: 'categoryName',
  137. label: '物品名称',
  138. align: 'center',
  139. showOverflowTooltip: true
  140. },
  141. {
  142. prop: 'specification',
  143. label: '规格',
  144. align: 'center',
  145. width: 100,
  146. showOverflowTooltip: true
  147. },
  148. {
  149. prop: 'brandNum',
  150. label: '牌号',
  151. align: 'center',
  152. width: 100,
  153. showOverflowTooltip: true
  154. },
  155. {
  156. prop: 'modelType',
  157. label: '型号',
  158. align: 'center',
  159. width: 160,
  160. showOverflowTooltip: true
  161. },
  162. {
  163. prop: 'quantity',
  164. slot: 'quantity',
  165. label: '数量',
  166. align: 'center',
  167. width: 80,
  168. showOverflowTooltip: true
  169. },
  170. // {
  171. // prop: 'unit',
  172. // label: '计量单位',
  173. // align: 'center',
  174. // width: 100,
  175. // showOverflowTooltip: true
  176. // },
  177. {
  178. prop: 'batchNo',
  179. label: '批次号',
  180. align: 'center',
  181. width: 100,
  182. showOverflowTooltip: true
  183. },
  184. {
  185. prop: 'workOrderCode',
  186. label: '工单编号',
  187. align: 'center',
  188. width: 100,
  189. showOverflowTooltip: true
  190. },
  191. // {
  192. // prop: 'produceRoutingName',
  193. // label: '工艺路线',
  194. // align: 'center',
  195. // width: 120,
  196. // showOverflowTooltip: true
  197. // },
  198. // {
  199. // prop: 'taskName',
  200. // label: '工序',
  201. // align: 'center',
  202. // width: 120,
  203. // showOverflowTooltip: true
  204. // },
  205. {
  206. prop: 'disposeTime',
  207. label: '处置时间',
  208. align: 'center',
  209. width: 180,
  210. showOverflowTooltip: true
  211. },
  212. {
  213. prop: 'qualityType',
  214. slot: 'qualityType',
  215. label: '质检类型',
  216. align: 'center',
  217. width: 120,
  218. showOverflowTooltip: true
  219. },
  220. {
  221. prop: 'status',
  222. slot: 'status',
  223. label: '状态',
  224. align: 'center',
  225. width: 80
  226. // formatter: (row, column, cellValue) => {
  227. // console.log(this.getDictName('处置状态', cellValue));
  228. // return this.getDictName('处置状态', cellValue);
  229. // }
  230. },
  231. {
  232. columnKey: 'action',
  233. label: '操作',
  234. width: 200,
  235. align: 'center',
  236. resizable: false,
  237. fixed: 'right',
  238. slot: 'action'
  239. }
  240. ];
  241. }
  242. },
  243. created() {
  244. this.requestDict('质检计划类型');
  245. this.requestDict('处置状态');
  246. this.getDisposeList('dispose_status');
  247. this.getQualityList('inspection_plan_type');
  248. },
  249. filters: {},
  250. methods: {
  251. //处置
  252. goDetail(row, type) {
  253. this.$router.push({
  254. path: '/unacceptedProduct/detailList',
  255. query: {
  256. id: row.id,
  257. qualityType: row.qualityType,
  258. workOrderCode: row.workOrderCode,
  259. type
  260. }
  261. });
  262. },
  263. /* 表格数据源 */
  264. datasource({ page, limit, where }) {
  265. return getList({
  266. pageNum: page,
  267. size: limit,
  268. ...where
  269. });
  270. },
  271. open(row) {
  272. this.$refs.create.open(row ? JSON.parse(JSON.stringify(row)) : '');
  273. },
  274. remove(row) {
  275. deleteUnacceptedProduct(row.id).then((res) => {
  276. this.$message.success('删除' + res);
  277. this.reload();
  278. });
  279. },
  280. // // 下达
  281. // toRelease(row) {
  282. // this.current = row;
  283. // this.visible = true;
  284. // },
  285. // // 下达
  286. // confirm(row) {
  287. // this.$confirm('确认下发选中的任务吗?', '提示', {
  288. // confirmButtonText: '确定',
  289. // cancleButtonText: '取消',
  290. // type: 'warning'
  291. // })
  292. // .then(async () => {
  293. // const res = await issuedPutMeshWorkOrder({
  294. // id: [row.id],
  295. // status: 1
  296. // });
  297. // this.$message.success('任务下发成功!');
  298. // this.reload();
  299. // })
  300. // .catch(() => {});
  301. // },
  302. /* 刷新表格 */
  303. reload(where) {
  304. this.$nextTick(() => {
  305. this.$refs.table.reload({ page: 1, where });
  306. });
  307. },
  308. fullscreenChange(fullscreen) {
  309. if (fullscreen) {
  310. this.tableHeight = 'calc(100vh - 120px)';
  311. } else {
  312. this.tableHeight = 'calc(100vh - 340px)';
  313. }
  314. },
  315. getDispose(item) {
  316. const data = this.disposeList.find((it) => it.value == item.status);
  317. return data ? data.label : '';
  318. },
  319. getQuality(item) {
  320. for (let i = 0; i < this.qualityList.length; i++) {
  321. if (this.qualityList[i].value == item.qualityType) {
  322. return this.qualityList[i].label;
  323. }
  324. }
  325. },
  326. async getDisposeList(code) {
  327. let res = await getByCode(code);
  328. if (res?.code == 0) {
  329. let list = res.data.map((item) => {
  330. let key = Object.keys(item)[0];
  331. return { value: Number(key), label: item[key] };
  332. });
  333. this.disposeList = list;
  334. }
  335. },
  336. async getQualityList(code) {
  337. let res = await getByCode(code);
  338. if (res?.code == 0) {
  339. let list = res.data.map((item) => {
  340. let key = Object.keys(item)[0];
  341. return { value: Number(key), label: item[key] };
  342. });
  343. this.qualityList = list;
  344. }
  345. }
  346. }
  347. };
  348. </script>
  349. <style lang="scss" scoped></style>