index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <ele-modal
  3. title="首件两检报工"
  4. :visible.sync="dialogVisible"
  5. width="95%"
  6. :before-close="handleClose"
  7. append-to-body
  8. :maxable="true"
  9. :close-on-click-modal="false"
  10. :close-on-press-escape="false"
  11. >
  12. <div class="two-layout">
  13. <el-row :gutter="10" class="full-row">
  14. <el-col :span="12" class="full-col">
  15. <div class="pane">
  16. <div class="pane-title">首件两检</div>
  17. <div
  18. v-show="leftMode === 'list'"
  19. class="fill-box"
  20. v-loading="loading"
  21. >
  22. <ele-pro-table
  23. ref="table"
  24. row-key="id"
  25. :columns="columns"
  26. :datasource="list"
  27. cache-key="mes-ruleRecordsList-20260208-1"
  28. autoAmendPage
  29. :need-page="false"
  30. @refresh="getData"
  31. height="calc(80vh - 160px)"
  32. >
  33. <template v-slot:selfCheck="{ row }">
  34. <el-button
  35. type="primary"
  36. @click="selfRequest(row)"
  37. v-if="row.status == 0"
  38. >自检请托</el-button
  39. >
  40. <el-button
  41. type="primary"
  42. :disabled="row.status != 0"
  43. @click="reportClick(row, 1)"
  44. >{{ row.status == 0 ? '报工' : '已报工' }}</el-button
  45. >
  46. <el-button
  47. type="primary"
  48. v-if="row.status == 2 || row.status == 3"
  49. @click="reportClick(row, 1, 'detail')"
  50. >详情</el-button
  51. >
  52. </template>
  53. <template
  54. v-slot:specialInspection="{ row }"
  55. v-if="
  56. $hasPermission(
  57. 'mes:firstarticledualinspectionitem:specialreport'
  58. )
  59. "
  60. >
  61. <el-button
  62. type="primary"
  63. :disabled="row.status != 2"
  64. @click="reportClick(row, 2)"
  65. >{{ row.status == 3 ? '已报工' : '报工' }}</el-button
  66. >
  67. <el-button
  68. type="primary"
  69. v-if="row.status == 3"
  70. @click="reportClick(row, 2, 'detail')"
  71. >详情</el-button
  72. >
  73. </template>
  74. <template v-slot:status="{ row }">
  75. <el-tag v-if="row.status == 0">待自检</el-tag>
  76. <el-tag v-if="row.status == 2">待专检</el-tag>
  77. <el-tag v-if="row.status == 3">已完成</el-tag>
  78. </template>
  79. </ele-pro-table>
  80. </div>
  81. <self-inspection-reporting
  82. v-if="leftMode === 'report'"
  83. ref="selfReportingRef"
  84. @cancel="backToList"
  85. @success="reportSuccess"
  86. />
  87. <self-inspection-request
  88. v-if="leftMode === 'request'"
  89. ref="selfRequestRef"
  90. @cancel="backToList"
  91. @success="reportSuccess"
  92. />
  93. </div>
  94. </el-col>
  95. <el-col :span="12" class="full-col">
  96. <div class="pane">
  97. <div class="pane-title">工艺文件</div>
  98. <wokePopup ref="wokePopupRef"></wokePopup>
  99. </div>
  100. </el-col>
  101. </el-row>
  102. </div>
  103. <!-- <self-inspection-reporting
  104. ref="selfReportingRef"
  105. @refreshData="getData"
  106. ></self-inspection-reporting>
  107. <self-inspection-request
  108. ref="selfRequestRef"
  109. @refreshData="getData"
  110. ></self-inspection-request> -->
  111. </ele-modal>
  112. </template>
  113. <script>
  114. import { getQualityInspectionList } from '@/api/produce/qualityInspection.js';
  115. import dictMixins from '@/mixins/dictMixins';
  116. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  117. import selfInspectionReporting from './components/selfInspectionReporting.vue';
  118. import selfInspectionRequest from './components/selfInspectionRequest.vue';
  119. import wokePopup from '../picking/newWokePopup.vue';
  120. import { parameterGetByCode } from '@/api/system/dictionary-data';
  121. export default {
  122. mixins: [dictMixins, tableColumnsMixin],
  123. components: {
  124. selfInspectionReporting,
  125. selfInspectionRequest,
  126. wokePopup
  127. },
  128. data() {
  129. return {
  130. dialogVisible: false,
  131. loading: false,
  132. produceTaskInfo: null,
  133. workOrder: null,
  134. butLoad: false,
  135. list: [],
  136. type: '',
  137. leftMode: 'list',
  138. currentRow: null,
  139. reportType: null
  140. };
  141. },
  142. computed: {
  143. columns() {
  144. return [
  145. {
  146. width: 50,
  147. type: 'index',
  148. columnKey: 'index',
  149. label: '序号',
  150. align: 'center'
  151. },
  152. {
  153. prop: 'name',
  154. label: '名称',
  155. align: 'center',
  156. showOverflowTooltip: true,
  157. minWidth: 150
  158. },
  159. {
  160. prop: 'assignObjectName',
  161. label: '工位名称',
  162. align: 'center',
  163. showOverflowTooltip: true,
  164. minWidth: 150
  165. },
  166. {
  167. prop: 'deviceName',
  168. label: '设备名称',
  169. align: 'center',
  170. showOverflowTooltip: true,
  171. minWidth: 150
  172. },
  173. {
  174. prop: 'selfCheckUserName',
  175. label: '自检报工人',
  176. align: 'center',
  177. showOverflowTooltip: true,
  178. minWidth: 120
  179. },
  180. {
  181. prop: 'selfCheckTime',
  182. label: '自检时间',
  183. align: 'center',
  184. showOverflowTooltip: true,
  185. minWidth: 120
  186. },
  187. {
  188. prop: 'specialCheckUserName',
  189. label: '专检报工人',
  190. align: 'center',
  191. showOverflowTooltip: true,
  192. minWidth: 120
  193. },
  194. {
  195. prop: 'specialCheckTime',
  196. label: '专检时间',
  197. align: 'center',
  198. showOverflowTooltip: true,
  199. minWidth: 120
  200. },
  201. {
  202. prop: 'status',
  203. slot: 'status',
  204. label: '状态',
  205. align: 'center',
  206. showOverflowTooltip: true,
  207. minWidth: 100
  208. },
  209. {
  210. label: '自检报工',
  211. align: 'center',
  212. width: 150,
  213. fixed: 'right',
  214. slot: 'selfCheck'
  215. },
  216. {
  217. label: '专检报工',
  218. align: 'center',
  219. width: 150,
  220. fixed: 'right',
  221. slot: 'specialInspection'
  222. }
  223. ];
  224. }
  225. },
  226. methods: {
  227. async open(workOrder, produceTaskInfo, type, req) {
  228. // 每次打开重置子界面,避免仍停留在上一次的报工/请托或残留行数据
  229. this.leftMode = 'list';
  230. this.currentRow = null;
  231. this.reportType = null;
  232. this.workOrder = workOrder;
  233. this.produceTaskInfo = produceTaskInfo;
  234. this.type = type;
  235. this.dialogVisible = true;
  236. this.getData();
  237. const res = await parameterGetByCode({
  238. code: 'mes_craft_file_by_category_code'
  239. });
  240. const byCategory = res?.value === '1';
  241. if (byCategory) {
  242. this.$refs.wokePopupRef.openTwo(req);
  243. } else {
  244. this.$refs.wokePopupRef.open(req);
  245. }
  246. },
  247. // 获取数据
  248. async getData() {
  249. this.loading = true;
  250. try {
  251. const isSourceTask = this.type == 1;
  252. const params = {
  253. produceTaskId: isSourceTask
  254. ? this.produceTaskInfo?.sourceTaskId
  255. : this.produceTaskInfo?.id,
  256. produceTaskInstanceId: isSourceTask
  257. ? this.produceTaskInfo?.id
  258. : this.workOrder?.taskId,
  259. ...(isSourceTask
  260. ? { type: 2, assigneeId: this.workOrder?.id }
  261. : { workOrderId: this.workOrder?.id })
  262. };
  263. const { list = [] } = await getQualityInspectionList(params);
  264. this.list = list;
  265. } catch (error) {
  266. this.list = [];
  267. } finally {
  268. this.loading = false;
  269. }
  270. },
  271. handleClose() {
  272. this.dialogVisible = false;
  273. this.leftMode = 'list';
  274. this.currentRow = null;
  275. this.reportType = null;
  276. this.$emit('close');
  277. },
  278. async handleUpdate() {
  279. try {
  280. this.butLoad = true;
  281. await this.getData();
  282. this.$message.success('已更新');
  283. this.butLoad = false;
  284. } catch (error) {
  285. this.butLoad = false;
  286. }
  287. },
  288. // selfRequest(row) {
  289. // this.$refs.selfRequestRef.open(row, this.workOrder);
  290. // },
  291. selfRequest(row) {
  292. this.currentRow = row;
  293. this.leftMode = 'request';
  294. this.$nextTick(() => {
  295. this.$refs.selfRequestRef.open(row, this.workOrder);
  296. });
  297. },
  298. // reportClick(row, type, mode) {
  299. // this.$refs.selfReportingRef.open(row, type, mode);
  300. // }
  301. reportClick(row, type, mode) {
  302. this.currentRow = row;
  303. this.reportType = type;
  304. this.leftMode = 'report';
  305. this.$nextTick(() => {
  306. this.$refs.selfReportingRef.open(row, type, mode);
  307. });
  308. },
  309. async backToList() {
  310. this.leftMode = 'list';
  311. await this.getData();
  312. },
  313. async reportSuccess() {
  314. this.leftMode = 'list';
  315. await this.getData();
  316. }
  317. }
  318. };
  319. </script>
  320. <style lang="scss" scoped>
  321. .two-layout {
  322. height: 80vh;
  323. display: flex;
  324. flex-direction: column;
  325. }
  326. .full-row {
  327. flex: 1;
  328. height: 100%;
  329. }
  330. .full-col {
  331. height: 100%;
  332. }
  333. .pane {
  334. height: 100%;
  335. background: #fff;
  336. border-radius: 4px;
  337. padding: 10px;
  338. display: flex;
  339. flex-direction: column;
  340. min-height: 0;
  341. }
  342. // .step-list {
  343. // height: 60vh;
  344. // display: flex;
  345. // flex-direction: column;
  346. // }
  347. /* 表格父级 */
  348. .table-wrapper {
  349. flex: 1;
  350. min-height: 0;
  351. display: flex;
  352. }
  353. .pane-title {
  354. font-size: 16px;
  355. font-weight: 600;
  356. color: #03541c;
  357. padding-bottom: 10px;
  358. margin-bottom: 10px;
  359. border-bottom: 1px solid #ebeef5;
  360. flex-shrink: 0;
  361. }
  362. </style>