CCL_QMS检验
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1317 lines
44 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
1 month ago
1 month ago
​
1 month ago
​
​
1 month ago
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
1 month ago
​
​
​
​
​
​
​
1 month ago
1 month ago
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
1 month ago
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
1 month ago
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
1 month ago
1 month ago
​
​
​
​
1 month ago
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
1 month ago
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <template>
  2. <el-dialog
  3. class="eds-batch-entry-dialog"
  4. :close-on-click-modal="false"
  5. :visible.sync="dialogVisible"
  6. :fullscreen="isFullscreen"
  7. append-to-body
  8. top="4vh"
  9. width="1380px"
  10. @opened="onOpened"
  11. @closed="onClosed">
  12. <div slot="title" class="eds-dialog-title">
  13. <span>{{ $t('qc.iqcPage.edsBatchEntryTitle') }}</span>
  14. <div class="eds-dialog-actions">
  15. <el-button size="mini" @click="isFullscreen = !isFullscreen">
  16. {{ $t(isFullscreen ? 'qc.iqcPage.edsExitFullscreen' : 'qc.iqcPage.edsFullscreen') }}
  17. </el-button>
  18. <el-button
  19. size="mini"
  20. type="warning"
  21. :loading="syncEdsLoading || saving"
  22. :disabled="readonly || loading || tagChecking"
  23. @click="handleSyncEds">
  24. {{ $t('qc.iqcPage.syncEds') }}
  25. </el-button>
  26. </div>
  27. </div>
  28. <div v-loading="loading" class="eds-batch-body">
  29. <!-- 实测值序号:扫入 / 移除标签号 -->
  30. <div class="tag-bind-section">
  31. <div class="section-title">
  32. <i class="el-icon-price-tag"></i>
  33. {{ $t('qc.iqcPage.edsMeasuredSeqArea') }}
  34. <span class="section-hint">{{ $t('qc.iqcPage.edsTagBindHint') }}</span>
  35. </div>
  36. <div v-if="!itemGroups.length" class="tag-empty">{{ $t('qc.iqcPage.edsNoInspectionItem') }}</div>
  37. <div v-else class="tag-input-grid">
  38. <div class="tag-input-item">
  39. <label>{{ $t('qc.iqcPage.edsTagScanIn') }}</label>
  40. <el-input
  41. ref="scanInInput"
  42. v-model="scanInRollNo"
  43. clearable
  44. :disabled="readonly"
  45. :readonly="tagChecking"
  46. :placeholder="$t('qc.iqcPage.edsTagScanInPlaceholder')"
  47. @keyup.enter.native="onScanInEnter" />
  48. </div>
  49. <div class="tag-input-item">
  50. <label>{{ $t('qc.iqcPage.edsTagRemove') }}</label>
  51. <el-input
  52. ref="removeInput"
  53. v-model="removeRollNo"
  54. clearable
  55. :disabled="readonly"
  56. :readonly="tagChecking"
  57. :placeholder="$t('qc.iqcPage.edsTagRemovePlaceholder')"
  58. @keyup.enter.native="onRemoveEnter" />
  59. </div>
  60. </div>
  61. </div>
  62. <div class="toolbar">
  63. <!--
  64. <el-button
  65. type="primary"
  66. size="mini"
  67. icon="el-icon-more"
  68. :disabled="readonly || !itemGroups.length"
  69. @click="openBatchAdd">
  70. {{ $t('qc.iqcPage.batchAdd') }}
  71. </el-button>
  72. -->
  73. <el-button
  74. v-if="!isAllExpanded"
  75. type="text"
  76. icon="el-icon-arrow-down"
  77. @click="expandAll">
  78. {{ $t('qc.iqcPage.batchExpand') }}
  79. </el-button>
  80. <el-button
  81. v-else
  82. type="text"
  83. icon="el-icon-arrow-up"
  84. @click="collapseAll">
  85. {{ $t('qc.iqcPage.batchCollapse') }}
  86. </el-button>
  87. </div>
  88. <el-collapse v-model="activeNames" class="item-collapse">
  89. <el-collapse-item
  90. v-for="group in itemGroups"
  91. :key="group.itemNo"
  92. :name="group.itemNo">
  93. <template slot="title">
  94. <div class="item-header">
  95. <span class="item-code">{{ group.itemNo }}</span>
  96. <span class="item-sep">·</span>
  97. <span class="item-name" :title="group.itemDesc || ''">{{ group.itemDesc || '-' }}</span>
  98. <span class="item-spec">
  99. <span class="spec-card">{{ $t('qc.table.standardValue') }}:{{ displayMetaValue(group, 'defaultValue') }}</span>
  100. <span class="spec-card">{{ $t('qc.table.upperValue') }}:{{ displayMetaValue(group, 'maxValue') }}</span>
  101. <span class="spec-card">{{ $t('qc.table.lowerValue') }}:{{ displayMetaValue(group, 'minValue') }}</span>
  102. </span>
  103. <span class="item-sep">·</span>
  104. <span
  105. class="spec-card item-progress"
  106. :class="enteredCount(group) >= group.rows.length && group.rows.length ? 'is-success' : 'is-warning'">
  107. {{ enteredCount(group) }}/{{ group.rows.length }}
  108. </span>
  109. <!--
  110. <el-button
  111. type="primary"
  112. size="mini"
  113. :disabled="readonly"
  114. @click.stop="addRowToGroup(group)">
  115. {{ $t('qc.common.add') }}
  116. </el-button>
  117. -->
  118. </div>
  119. </template>
  120. <el-table
  121. :data="group.rows"
  122. border
  123. class="eds-item-table"
  124. :header-cell-style="{ background: '#f5f7fa', color: '#606266', fontWeight: '500' }">
  125. <el-table-column prop="num" :label="$t('qc.iqcPage.serialNumber')" width="60" align="center" />
  126. <el-table-column prop="isQualified" :label="$t('qc.iqcPage.isQualified')" width="110" align="center">
  127. <template slot-scope="{ row }">
  128. <el-select
  129. v-model="row.isQualified"
  130. size="mini"
  131. clearable
  132. :disabled="readonly || isRowLocked(row)"
  133. @change="onQualifiedChange(row, $event)"
  134. :class="{
  135. greenElSelect: String(row.isQualified || '').toUpperCase() === 'Y',
  136. redElSelect: String(row.isQualified || '').toUpperCase() === 'N'
  137. }"
  138. :placeholder="$t('qc.iqcPage.isQualified')"
  139. style="width: 100%">
  140. <el-option :label="$t('qc.iqcPage.qualified')" value="Y" style="color: #67C23A" />
  141. <el-option :label="$t('qc.iqcPage.unqualified')" value="N" style="color: #F56C6C" />
  142. </el-select>
  143. </template>
  144. </el-table-column>
  145. <el-table-column prop="rollNo" :label="$t('qc.iqcPage.tagNo')" min-width="160" align="center">
  146. <template slot-scope="{ row }">
  147. <el-input
  148. :value="row.rollNo"
  149. readonly
  150. :disabled="readonly || isRowLocked(row) || tagChecking"
  151. :placeholder="$t('qc.iqcPage.edsTagPlaceholder')" />
  152. </template>
  153. </el-table-column>
  154. <el-table-column prop="productQuantity" :label="$t('qc.iqcPage.productQuantity')" min-width="100" align="center" />
  155. <el-table-column prop="defectQty" :label="$t('qc.iqcPage.edsDefectQty')" min-width="100" align="center">
  156. <template slot-scope="{ row }">
  157. <el-input-number
  158. v-model="row.defectQty"
  159. :min="0"
  160. :max="2147483647"
  161. :precision="0"
  162. :controls="false"
  163. :disabled="readonly || isRowLocked(row)"
  164. @change="(val, oldVal) => onDefectQtyChange(row, val, oldVal)"
  165. style="width: 100%" />
  166. </template>
  167. </el-table-column>
  168. <el-table-column prop="samplingLocation" :label="$t('qc.iqcPage.samplingPosA')" min-width="120" align="center">
  169. <template slot-scope="{ row }">
  170. <el-input
  171. v-model="row.samplingLocation"
  172. :disabled="readonly || isRowLocked(row)"
  173. :placeholder="$t('qc.iqcPage.enterSamplingPosA')" />
  174. </template>
  175. </el-table-column>
  176. <el-table-column prop="samplingLocationB" :label="$t('qc.iqcPage.samplingPosB')" min-width="120" align="center">
  177. <template slot-scope="{ row }">
  178. <el-input
  179. v-model="row.samplingLocationB"
  180. :disabled="readonly || isRowLocked(row)"
  181. :placeholder="$t('qc.iqcPage.enterSamplingPosB')" />
  182. </template>
  183. </el-table-column>
  184. <el-table-column prop="subDetailValue" :label="$t('qc.iqcPage.measuredA')" min-width="120" align="center">
  185. <template slot-scope="{ row }">
  186. <el-input
  187. v-model="row.subDetailValue"
  188. :disabled="readonly || isRowLocked(row)"
  189. :placeholder="$t('qc.iqcPage.enterMeasuredA')" />
  190. </template>
  191. </el-table-column>
  192. <el-table-column prop="subDetailValueB" :label="$t('qc.iqcPage.measuredB')" min-width="120" align="center">
  193. <template slot-scope="{ row }">
  194. <el-input
  195. v-model="row.subDetailValueB"
  196. :disabled="readonly || isRowLocked(row)"
  197. :placeholder="$t('qc.iqcPage.enterMeasuredB')" />
  198. </template>
  199. </el-table-column>
  200. <el-table-column prop="isTransfer" :label="$t('qc.iqcPage.isTransfer')" width="90" align="center">
  201. <template slot-scope="{ row }">
  202. <span>{{ formatQcYesNoFlag(displayTransferFlag(row)) }}</span>
  203. </template>
  204. </el-table-column>
  205. <el-table-column :label="$t('qc.common.operation')" width="70" align="center">
  206. <template slot-scope="{ row, $index }">
  207. <el-button
  208. v-if="!readonly && !isRowLocked(row) && !isRowTransferred(row)"
  209. type="text"
  210. size="mini"
  211. style="color:#F56C6C"
  212. @click="removeRow(group, $index)">
  213. {{ $t('qc.common.delete') }}
  214. </el-button>
  215. </template>
  216. </el-table-column>
  217. </el-table>
  218. </el-collapse-item>
  219. </el-collapse>
  220. </div>
  221. <div slot="footer" class="dialog-footer">
  222. <el-button
  223. type="primary"
  224. size="small"
  225. :loading="saving"
  226. :disabled="readonly || !itemGroups.length"
  227. icon="el-icon-check"
  228. @click="handleSave">
  229. {{ $t('qc.iqcPage.saveCurrentRoll') }}
  230. </el-button>
  231. <el-button size="small" @click="dialogVisible = false">{{ $t('qc.common.close') }}</el-button>
  232. </div>
  233. <sync-eds-dialog
  234. :visible.sync="syncEdsDialogVisible"
  235. :preview-list="syncEdsPreviewList"
  236. :loading="syncEdsLoading"
  237. @confirm="confirmSyncEds" />
  238. <!-- 批量新增行 -->
  239. <el-dialog
  240. :title="$t('qc.iqcPage.batchAdd')"
  241. :close-on-click-modal="false"
  242. :visible.sync="batchAddVisible"
  243. append-to-body
  244. width="510px">
  245. <el-form :inline="true" label-position="top">
  246. <el-form-item :label="$t('qc.iqcPage.defaultSamplingPosA')">
  247. <el-input v-model="batchAddData.samplingLocation" style="width: 150px" />
  248. </el-form-item>
  249. <el-form-item :label="$t('qc.iqcPage.defaultSamplingPosB')">
  250. <el-input v-model="batchAddData.samplingLocationB" style="width: 150px" />
  251. </el-form-item>
  252. <el-form-item :label="$t('qc.iqcPage.sampleQty')">
  253. <el-input v-model="batchAddData.samplingNumber" type="number" style="width: 150px" />
  254. </el-form-item>
  255. </el-form>
  256. <div slot="footer" class="dialog-footer">
  257. <el-button type="primary" size="small" @click="confirmBatchAdd">{{ $t('qc.common.save') }}</el-button>
  258. <el-button size="small" @click="batchAddVisible = false">{{ $t('qc.common.close') }}</el-button>
  259. </div>
  260. </el-dialog>
  261. </el-dialog>
  262. </template>
  263. <script>
  264. import {
  265. listSubDetailedRecordForEds,
  266. saveEdsBatchSubDetailed,
  267. checkEdsRollInspection,
  268. syncEdsInspectionResults
  269. } from '@/api/qc/qc'
  270. import { formatQcYesNoFlag, normalizeQcValueTypeDb } from '@/utils/qcValueTypeDisplay'
  271. import SyncEdsDialog from './SyncEdsDialog.vue'
  272. const TRACK_FIELDS = [
  273. 'rollNo',
  274. 'productQuantity',
  275. 'defectQty',
  276. 'samplingLocation',
  277. 'samplingLocationB',
  278. 'subDetailValue',
  279. 'subDetailValueB',
  280. 'subDetailValueC',
  281. 'subDetailValueD',
  282. 'subDetailValueE',
  283. 'isQualified'
  284. ]
  285. export default {
  286. name: 'EdsBatchEntryDialog',
  287. components: {
  288. SyncEdsDialog
  289. },
  290. props: {
  291. visible: {
  292. type: Boolean,
  293. default: false
  294. },
  295. detailData: {
  296. type: Object,
  297. default: () => ({})
  298. },
  299. detailList: {
  300. type: Array,
  301. default: () => []
  302. },
  303. inspectionType: {
  304. type: String,
  305. default: 'IQC'
  306. }
  307. },
  308. data () {
  309. return {
  310. isFullscreen: false,
  311. loading: false,
  312. saving: false,
  313. scanInRollNo: '',
  314. removeRollNo: '',
  315. itemGroups: [],
  316. activeNames: [],
  317. /** 打开时快照:key = itemNo__num,用于对比仅保存变更行 */
  318. originalRowMap: {},
  319. batchAddVisible: false,
  320. batchAddData: {
  321. samplingLocation: '',
  322. samplingLocationB: '',
  323. samplingNumber: ''
  324. },
  325. /** 扫描卷号校验中,防止重复提交 */
  326. tagChecking: false,
  327. syncEdsDialogVisible: false,
  328. syncEdsLoading: false,
  329. syncEdsPreviewList: [],
  330. syncEdsAllRows: [],
  331. /** 各卷最新 EDS 传输结论:rollNo -> PASS/FAIL */
  332. syncEdsLatestTransferMap: {}
  333. }
  334. },
  335. computed: {
  336. dialogVisible: {
  337. get () {
  338. return this.visible
  339. },
  340. set (val) {
  341. this.$emit('update:visible', val)
  342. }
  343. },
  344. readonly () {
  345. return this.detailData && this.detailData.submitFlag === 'Y'
  346. },
  347. isAllExpanded () {
  348. const total = (this.itemGroups || []).length
  349. return total > 0 && (this.activeNames || []).length >= total
  350. },
  351. itemMetaMap () {
  352. const map = {}
  353. ;(this.detailList || []).forEach((item) => {
  354. if (item && item.itemNo != null) {
  355. map[item.itemNo] = item
  356. }
  357. })
  358. return map
  359. }
  360. },
  361. watch: {
  362. visible (val) {
  363. if (val) {
  364. this.isFullscreen = false
  365. // 打开即清空上方扫入/移除输入,避免闪现上次内容
  366. this.scanInRollNo = ''
  367. this.removeRollNo = ''
  368. this.loadData()
  369. }
  370. }
  371. },
  372. methods: {
  373. formatQcYesNoFlag (value) {
  374. return formatQcYesNoFlag(value, this.$t.bind(this))
  375. },
  376. onOpened () {
  377. this.$nextTick(() => {
  378. this.focusScanInInput()
  379. })
  380. },
  381. onClosed () {
  382. this.scanInRollNo = ''
  383. this.removeRollNo = ''
  384. this.itemGroups = []
  385. this.activeNames = []
  386. this.originalRowMap = {}
  387. this.batchAddVisible = false
  388. this.tagChecking = false
  389. this.batchAddData = {
  390. samplingLocation: '',
  391. samplingLocationB: '',
  392. samplingNumber: ''
  393. }
  394. this.syncEdsDialogVisible = false
  395. this.syncEdsPreviewList = []
  396. this.syncEdsAllRows = []
  397. this.syncEdsLatestTransferMap = {}
  398. this.syncEdsLoading = false
  399. },
  400. fetchSubDetailRows () {
  401. const detail = this.detailData || {}
  402. const payload = {
  403. site: detail.site,
  404. buNo: detail.buNo,
  405. inspectionNo: detail.inspectionNo,
  406. inspectionType: String(this.inspectionType || 'IQC').toUpperCase()
  407. }
  408. return listSubDetailedRecordForEds(payload).then(({ data }) => {
  409. if (!(data && data.code === 0)) {
  410. return Promise.reject(new Error((data && (data.msg || data.message)) || this.$t('qc.iqcPage.edsLoadFail')))
  411. }
  412. this.syncEdsLatestTransferMap = data.latestTransferMap || {}
  413. return Array.isArray(data.rows) ? data.rows : []
  414. })
  415. },
  416. loadData () {
  417. const detail = this.detailData || {}
  418. if (!detail.site || !detail.buNo || !detail.inspectionNo) {
  419. this.$message.warning(this.$t('qc.iqcPage.edsNoSubDetail'))
  420. return
  421. }
  422. this.loading = true
  423. this.fetchSubDetailRows().then((rows) => {
  424. this.buildGroups(rows)
  425. this.$nextTick(() => this.focusScanInInput())
  426. }).catch((err) => {
  427. this.$message.error((err && err.message) || this.$t('qc.iqcPage.edsLoadFail'))
  428. }).finally(() => {
  429. this.loading = false
  430. })
  431. },
  432. buildGroups (rows) {
  433. const groupMap = {}
  434. // 先按 detailList 顺序建组,保证检验项全部展示
  435. ;(this.detailList || []).forEach((item) => {
  436. if (!item || item.itemNo == null) return
  437. groupMap[item.itemNo] = {
  438. itemNo: item.itemNo,
  439. itemDesc: item.itemDesc || item.itemName || '',
  440. meta: item,
  441. rows: []
  442. }
  443. })
  444. rows.forEach((row) => {
  445. if (!row) return
  446. const itemNo = row.itemNo
  447. if (itemNo == null) return
  448. if (!groupMap[itemNo]) {
  449. groupMap[itemNo] = {
  450. itemNo,
  451. itemDesc: (this.itemMetaMap[itemNo] && (this.itemMetaMap[itemNo].itemDesc || this.itemMetaMap[itemNo].itemName)) || '',
  452. meta: this.itemMetaMap[itemNo] || {},
  453. rows: []
  454. }
  455. }
  456. const cloned = { ...row }
  457. // 保证标签号字段可编辑,并补齐 itemNo 便于变更对比
  458. if (cloned.rollNo == null) cloned.rollNo = ''
  459. if (cloned.productQuantity == null) cloned.productQuantity = null
  460. if (cloned.defectQty == null) cloned.defectQty = 0
  461. if (cloned.itemNo == null) cloned.itemNo = itemNo
  462. groupMap[itemNo].rows.push(cloned)
  463. })
  464. Object.keys(groupMap).forEach((key) => {
  465. groupMap[key].rows.sort((a, b) => (Number(a.num) || 0) - (Number(b.num) || 0))
  466. })
  467. const orderKeys = (this.detailList || []).map((i) => i.itemNo).filter((k) => k != null && groupMap[k])
  468. Object.keys(groupMap).forEach((k) => {
  469. if (!orderKeys.includes(k)) orderKeys.push(k)
  470. })
  471. this.itemGroups = orderKeys.map((k) => groupMap[k])
  472. this.activeNames = this.itemGroups.slice(0, 3).map((g) => g.itemNo)
  473. this.captureOriginalSnapshot()
  474. },
  475. rowKey (itemNo, num) {
  476. return `${itemNo}__${num}`
  477. },
  478. normalizeField (val) {
  479. if (val == null) return ''
  480. return String(val).trim()
  481. },
  482. snapshotRow (row) {
  483. const snap = {}
  484. TRACK_FIELDS.forEach((f) => {
  485. snap[f] = this.normalizeField(row[f])
  486. })
  487. // 非变更比对字段:用于保存时拦截已传输行的删除
  488. snap.isTransfer = this.normalizeField(row.isTransfer)
  489. return snap
  490. },
  491. captureOriginalSnapshot () {
  492. const map = {}
  493. ;(this.itemGroups || []).forEach((group) => {
  494. ;(group.rows || []).forEach((row) => {
  495. if (!row || row.itemNo == null || row.num == null) return
  496. // 加载行可能未带 itemNo(来自子明细表查询已含),兜底用 group.itemNo
  497. const itemNo = row.itemNo != null ? row.itemNo : group.itemNo
  498. map[this.rowKey(itemNo, row.num)] = this.snapshotRow({ ...row, itemNo })
  499. })
  500. })
  501. this.originalRowMap = map
  502. },
  503. isRowChanged (row, itemNo) {
  504. const key = this.rowKey(itemNo, row.num)
  505. const original = this.originalRowMap[key]
  506. if (!original) return true
  507. return TRACK_FIELDS.some((f) => this.normalizeField(row[f]) !== original[f])
  508. },
  509. resetTransferOnEdit () {
  510. return ['IPQC', 'FQC', 'OQC'].includes(this.normalizeField(this.inspectionType).toUpperCase())
  511. },
  512. displayTransferFlag (row) {
  513. return this.resetTransferOnEdit() && this.isRowChanged(row, row.itemNo) ? 'N' : row.isTransfer
  514. },
  515. buildChangePayload () {
  516. const detail = this.detailData || {}
  517. const resetTransfer = this.resetTransferOnEdit()
  518. const updatedRows = []
  519. const insertedRows = []
  520. const deletedRows = []
  521. const currentKeys = new Set()
  522. const affectedItemNos = new Set()
  523. ;(this.itemGroups || []).forEach((group) => {
  524. const itemNo = group.itemNo
  525. ;(group.rows || []).forEach((row, idx) => {
  526. if (!row) return
  527. const num = row.num != null ? row.num : (idx + 1)
  528. const key = this.rowKey(itemNo, num)
  529. currentKeys.add(key)
  530. const payloadRow = {
  531. site: detail.site,
  532. buNo: detail.buNo,
  533. inspectionNo: detail.inspectionNo,
  534. itemNo,
  535. num,
  536. rollNo: row.rollNo != null ? String(row.rollNo).trim() : '',
  537. productQuantity: row.productQuantity,
  538. samplingLocation: row.samplingLocation,
  539. samplingLocationB: row.samplingLocationB,
  540. subDetailValue: row.subDetailValue,
  541. subDetailValueB: row.subDetailValueB,
  542. subDetailValueC: row.subDetailValueC,
  543. subDetailValueD: row.subDetailValueD,
  544. subDetailValueE: row.subDetailValueE,
  545. fileName: row.fileName,
  546. isTransfer: resetTransfer ? 'N' : row.isTransfer,
  547. isQualified: resetTransfer && Number(row.defectQty) > 0 ? 'N' : row.isQualified,
  548. defectQty: row.defectQty == null ? 0 : row.defectQty
  549. }
  550. if (!this.originalRowMap[key]) {
  551. insertedRows.push(payloadRow)
  552. affectedItemNos.add(itemNo)
  553. } else if (this.isRowChanged(row, itemNo)) {
  554. updatedRows.push(payloadRow)
  555. affectedItemNos.add(itemNo)
  556. }
  557. })
  558. })
  559. Object.keys(this.originalRowMap || {}).forEach((key) => {
  560. if (currentKeys.has(key)) return
  561. const original = this.originalRowMap[key] || {}
  562. // 已传输行不允许删除(前后端双重拦截)
  563. if (String(original.isTransfer || '').toUpperCase() === 'Y') {
  564. return
  565. }
  566. const parts = key.split('__')
  567. if (parts.length < 2) return
  568. const itemNo = parts[0]
  569. const num = Number(parts[1])
  570. deletedRows.push({ itemNo, num })
  571. affectedItemNos.add(itemNo)
  572. })
  573. const itemSpecs = []
  574. ;(this.itemGroups || []).forEach((group) => {
  575. if (!affectedItemNos.has(group.itemNo)) return
  576. const meta = group.meta || {}
  577. itemSpecs.push({
  578. itemNo: group.itemNo,
  579. // 归一化为 T/N,避免 valueTypeDb 为空或中文时后端按数字逻辑重算结论
  580. valueTypeDb: normalizeQcValueTypeDb(meta) || meta.valueTypeDb || '',
  581. minValue: meta.minValue,
  582. maxValue: meta.maxValue
  583. })
  584. })
  585. return {
  586. site: detail.site,
  587. buNo: detail.buNo,
  588. inspectionNo: detail.inspectionNo,
  589. inspectionType: String(this.inspectionType || 'IQC').toUpperCase(),
  590. updatedRows,
  591. insertedRows,
  592. deletedRows,
  593. itemSpecs
  594. }
  595. },
  596. /**
  597. * 调用 EDS/TT 校验卷号;success=true 才通过
  598. * @returns {Promise<Object|boolean>} 校验成功时返回扫描信息(含产品数)
  599. */
  600. validateEdsRollNo (serialNo) {
  601. const detail = this.detailData || {}
  602. const inspectionNo = detail.inspectionNo
  603. const sn = serialNo != null ? String(serialNo).trim() : ''
  604. if (!inspectionNo || !sn) {
  605. return Promise.resolve(false)
  606. }
  607. return checkEdsRollInspection({
  608. inspectionNo,
  609. serialNo: sn
  610. }).then(({ data }) => {
  611. // 后端 R.ok(map) 会把校验结果及 productQuantity 合并到顶层
  612. if (data && data.code === 0 && data.success === true) {
  613. return data
  614. }
  615. const tip = (data && (data.message || data.msg)) || this.$t('qc.iqcPage.edsRollCheckFail')
  616. this.$message.error(tip)
  617. return false
  618. }).catch((err) => {
  619. this.$message.error((err && err.message) || this.$t('qc.iqcPage.edsRollCheckFail'))
  620. return false
  621. })
  622. },
  623. hasRollNoInGroups (serialNo) {
  624. const sn = serialNo != null ? String(serialNo).trim() : ''
  625. if (!sn) return false
  626. return (this.itemGroups || []).some((group) =>
  627. (group.rows || []).some((row) => row && String(row.rollNo || '').trim() === sn)
  628. )
  629. },
  630. nextNumForGroup (group) {
  631. let groupMax = 0
  632. ;(group.rows || []).forEach((r) => {
  633. const num = Number(r.num)
  634. if (!Number.isNaN(num) && num > groupMax) groupMax = num
  635. })
  636. return groupMax + 1
  637. },
  638. /** 扫入:TT 校验通过后,每个检验项新增一行该卷号 */
  639. onScanInEnter () {
  640. if (this.readonly || this.tagChecking) return
  641. if (!this.itemGroups.length) {
  642. this.$message.warning(this.$t('qc.iqcPage.edsNoInspectionItem'))
  643. return
  644. }
  645. const serialNo = this.scanInRollNo != null ? String(this.scanInRollNo).trim() : ''
  646. if (!serialNo) return
  647. if (this.hasRollNoInGroups(serialNo)) {
  648. this.$message.warning(this.$t('qc.iqcPage.edsTagAlreadyExists', { rollNo: serialNo }))
  649. this.scanInRollNo = ''
  650. return
  651. }
  652. this.tagChecking = true
  653. this.validateEdsRollNo(serialNo).then((result) => {
  654. if (!result) return
  655. this.itemGroups.forEach((group) => {
  656. const row = this.createEmptyRow(this.nextNumForGroup(group))
  657. row.itemNo = group.itemNo
  658. row.rollNo = serialNo
  659. row.productQuantity = result.productQuantity == null || result.productQuantity === '' ? null : result.productQuantity
  660. row.isQualified = 'Y'
  661. group.rows.push(row)
  662. })
  663. this.$message.success(this.$t('qc.iqcPage.edsTagScanInSuccess', { rollNo: serialNo }))
  664. }).finally(() => {
  665. this.scanInRollNo = ''
  666. this.tagChecking = false
  667. })
  668. },
  669. /** 移除:删除每个检验项中对应卷号的行 */
  670. onRemoveEnter () {
  671. if (this.readonly || this.tagChecking) return
  672. if (!this.itemGroups.length) {
  673. this.$message.warning(this.$t('qc.iqcPage.edsNoInspectionItem'))
  674. return
  675. }
  676. const serialNo = this.removeRollNo != null ? String(this.removeRollNo).trim() : ''
  677. if (!serialNo) return
  678. let matched = 0
  679. let blocked = 0
  680. this.itemGroups.forEach((group) => {
  681. if (!group || !group.rows) return
  682. for (let i = group.rows.length - 1; i >= 0; i--) {
  683. const row = group.rows[i]
  684. if (!row || String(row.rollNo || '').trim() !== serialNo) continue
  685. matched += 1
  686. if (this.isRowTransferred(row) || this.isRowLocked(row)) {
  687. blocked += 1
  688. continue
  689. }
  690. group.rows.splice(i, 1)
  691. }
  692. })
  693. this.removeRollNo = ''
  694. if (!matched) {
  695. this.$message.warning(this.$t('qc.iqcPage.edsTagRemoveNotFound', { rollNo: serialNo }))
  696. } else if (blocked > 0) {
  697. this.$message.warning(this.$t('qc.iqcPage.edsTagRemoveBlocked', { rollNo: serialNo }))
  698. } else {
  699. this.$message.success(this.$t('qc.iqcPage.edsTagRemoveSuccess', { rollNo: serialNo }))
  700. }
  701. this.$nextTick(() => this.focusRemoveInput())
  702. },
  703. /** 行内标签号回车:校验通过才保留,失败则清空 */
  704. onRowRollNoEnter (row) {
  705. if (!row || this.readonly || this.isRowLocked(row) || this.isRowTransferred(row) || this.tagChecking) {
  706. return
  707. }
  708. const serialNo = row.rollNo != null ? String(row.rollNo).trim() : ''
  709. if (!serialNo) return
  710. this.tagChecking = true
  711. this.validateEdsRollNo(serialNo).then((result) => {
  712. if (!result) {
  713. row.rollNo = ''
  714. row.productQuantity = null
  715. } else {
  716. row.productQuantity = result.productQuantity == null || result.productQuantity === '' ? null : result.productQuantity
  717. if (!String(row.isQualified || '').trim()) {
  718. row.isQualified = Number(row.defectQty) > 0 ? 'N' : 'Y'
  719. }
  720. }
  721. }).finally(() => {
  722. this.tagChecking = false
  723. })
  724. },
  725. isRowTransferred (row) {
  726. return row && String(row.isTransfer || '').toUpperCase() === 'Y'
  727. },
  728. onQualifiedChange (row, value) {
  729. if (!this.resetTransferOnEdit()) return
  730. if (value === 'Y') {
  731. row.defectQty = 0
  732. } else if (Number(row.defectQty) > 0) {
  733. row.isQualified = 'N'
  734. }
  735. },
  736. onDefectQtyChange (row, newVal, oldVal) {
  737. if (!row) return
  738. if (row.defectQty == null) row.defectQty = 0
  739. if (this.readonly || this.isRowLocked(row)) return
  740. const next = Number(newVal != null ? newVal : row.defectQty)
  741. const prev = oldVal == null || oldVal === '' ? null : Number(oldVal)
  742. if (!(next > 0)) return
  743. if (!this.resetTransferOnEdit() && prev === next) return
  744. row.isQualified = 'N'
  745. },
  746. focusScanInInput () {
  747. const ref = this.$refs.scanInInput
  748. const el = Array.isArray(ref) ? ref[0] : ref
  749. if (el && el.focus) {
  750. el.focus()
  751. }
  752. },
  753. focusRemoveInput () {
  754. const ref = this.$refs.removeInput
  755. const el = Array.isArray(ref) ? ref[0] : ref
  756. if (el && el.focus) {
  757. el.focus()
  758. }
  759. },
  760. expandAll () {
  761. this.activeNames = this.itemGroups.map((g) => g.itemNo)
  762. },
  763. collapseAll () {
  764. this.activeNames = []
  765. },
  766. displayMetaValue (group, field) {
  767. const meta = (group && group.meta) || {}
  768. const val = meta[field]
  769. if (val == null || String(val).trim() === '') return '-'
  770. return val
  771. },
  772. enteredCount (group) {
  773. return (group.rows || []).filter((r) => r && r.subDetailValue != null && String(r.subDetailValue).trim() !== '').length
  774. },
  775. isRowLocked (row) {
  776. return row && String(row.isSubmit || '').toUpperCase() === 'Y'
  777. },
  778. createEmptyRow (num, defaults = {}) {
  779. return {
  780. num,
  781. rollNo: '',
  782. productQuantity: null,
  783. defectQty: 0,
  784. samplingLocation: defaults.samplingLocation || '',
  785. samplingLocationB: defaults.samplingLocationB || '',
  786. subDetailValue: '',
  787. subDetailValueB: '',
  788. subDetailValueC: '',
  789. subDetailValueD: '',
  790. subDetailValueE: '',
  791. isQualified: '',
  792. isTransfer: '',
  793. isSubmit: 'N'
  794. }
  795. },
  796. /** 单个检验项新增一行,便于手动维护标签号 */
  797. addRowToGroup (group) {
  798. if (this.readonly || !group) return
  799. const row = this.createEmptyRow(this.nextNumForGroup(group))
  800. row.itemNo = group.itemNo
  801. group.rows.push(row)
  802. if (this.activeNames.indexOf(group.itemNo) === -1) {
  803. this.activeNames = this.activeNames.concat([group.itemNo])
  804. }
  805. },
  806. openBatchAdd () {
  807. if (this.readonly || !this.itemGroups.length) return
  808. this.batchAddData = {
  809. samplingLocation: '',
  810. samplingLocationB: '',
  811. samplingNumber: ''
  812. }
  813. this.batchAddVisible = true
  814. },
  815. confirmBatchAdd () {
  816. const count = Number(this.batchAddData.samplingNumber)
  817. if (!count || count < 1 || !Number.isInteger(count)) {
  818. this.$message.warning(this.$t('qc.iqcPage.sampleQty'))
  819. return
  820. }
  821. this.itemGroups.forEach((group) => {
  822. let groupMax = this.nextNumForGroup(group) - 1
  823. for (let i = 0; i < count; i++) {
  824. const row = this.createEmptyRow(groupMax + i + 1, this.batchAddData)
  825. row.itemNo = group.itemNo
  826. group.rows.push(row)
  827. }
  828. })
  829. this.expandAll()
  830. this.batchAddVisible = false
  831. this.$nextTick(() => this.focusScanInInput())
  832. },
  833. removeRow (group, index) {
  834. if (!group || !group.rows) return
  835. const row = group.rows[index]
  836. if (this.isRowTransferred(row)) {
  837. this.$message.warning(this.$t('qc.iqcPage.edsTransferredNoDelete'))
  838. return
  839. }
  840. if (this.isRowLocked(row) || this.readonly) {
  841. return
  842. }
  843. group.rows.splice(index, 1)
  844. },
  845. /**
  846. * 保存当前变更。
  847. * @param {Object} options
  848. * @param {boolean} options.closeOnSuccess 成功后是否关闭弹框
  849. * @param {boolean} options.silentIfNoChange 无变更时是否静默跳过
  850. * @returns {Promise<{saved:boolean, skipped:boolean}>}
  851. */
  852. persistCurrentChanges (options = {}) {
  853. const closeOnSuccess = !!options.closeOnSuccess
  854. const silentIfNoChange = !!options.silentIfNoChange
  855. const detail = this.detailData || {}
  856. if (!detail.site || !detail.buNo || !detail.inspectionNo) {
  857. this.$message.warning(this.$t('qc.iqcPage.edsNoSubDetail'))
  858. return Promise.reject(new Error('missing detail'))
  859. }
  860. if (this.readonly) {
  861. return Promise.resolve({ saved: false, skipped: true })
  862. }
  863. const payload = this.buildChangePayload()
  864. const changeCount = (payload.updatedRows.length || 0)
  865. + (payload.insertedRows.length || 0)
  866. + (payload.deletedRows.length || 0)
  867. const refreshMasterQuantities = this.resetTransferOnEdit()
  868. if (!changeCount && !refreshMasterQuantities) {
  869. if (!silentIfNoChange) {
  870. this.$message.warning(this.$t('qc.iqcPage.edsNoChangeToSave'))
  871. }
  872. return Promise.resolve({ saved: false, skipped: true })
  873. }
  874. this.saving = true
  875. return saveEdsBatchSubDetailed(payload).then(({ data }) => {
  876. if (data && data.code === 0) {
  877. this.$message.success(this.$t('qc.iqcPage.edsSaveSuccess'))
  878. this.$emit('saved', data.quantitySummary)
  879. if (closeOnSuccess) {
  880. this.dialogVisible = false
  881. } else {
  882. if (refreshMasterQuantities) {
  883. const savedRows = new Map([...payload.updatedRows, ...payload.insertedRows]
  884. .map(row => [this.rowKey(row.itemNo, row.num), row]))
  885. this.itemGroups.forEach(group => {
  886. group.rows.forEach(row => {
  887. const saved = savedRows.get(this.rowKey(group.itemNo, row.num))
  888. if (saved) {
  889. row.isTransfer = saved.isTransfer
  890. row.isQualified = saved.isQualified
  891. }
  892. })
  893. })
  894. }
  895. this.captureOriginalSnapshot()
  896. }
  897. return { saved: true, skipped: false }
  898. }
  899. return Promise.reject(new Error((data && (data.msg || data.message)) || this.$t('qc.iqcPage.edsSaveFail')))
  900. }).catch((err) => {
  901. this.$message.error((err && err.message) || this.$t('qc.iqcPage.edsSaveFail'))
  902. return Promise.reject(err)
  903. }).finally(() => {
  904. this.saving = false
  905. })
  906. },
  907. handleSave () {
  908. if (this.readonly || this.saving || this.syncEdsLoading || this.tagChecking) return
  909. this.persistCurrentChanges({ closeOnSuccess: true, silentIfNoChange: false }).catch(() => {})
  910. },
  911. /** 同步 EDS:先保存当前数据,再打开与检验单一致的同步预览 */
  912. handleSyncEds () {
  913. if (this.readonly || this.saving || this.syncEdsLoading || this.loading || this.tagChecking) return
  914. this.persistCurrentChanges({ closeOnSuccess: false, silentIfNoChange: true }).then(() => {
  915. return this.openSyncEdsPreview()
  916. }).catch(() => {})
  917. },
  918. /**
  919. * 本次是否传输:无履历=首次传;结论不变=不传;最新 FAIL 且当前 PASS=重传
  920. */
  921. needEdsTransferThisTime (latestResult, currentIsFail) {
  922. const latest = latestResult != null ? String(latestResult).trim().toUpperCase() : ''
  923. const current = currentIsFail ? 'FAIL' : 'PASS'
  924. if (!latest) return true
  925. if (latest === current) return false
  926. return latest === 'FAIL' && current === 'PASS'
  927. },
  928. buildSyncEdsPreviewList (rows, latestTransferMap) {
  929. const source = Array.isArray(rows) ? rows : []
  930. const historyMap = latestTransferMap && typeof latestTransferMap === 'object'
  931. ? latestTransferMap
  932. : (this.syncEdsLatestTransferMap || {})
  933. // 检验单中的检验项目数量(各卷相同)
  934. const itemCount = Array.isArray(this.detailList) ? this.detailList.length : 0
  935. const isIpqcFqcOqc = ['IPQC', 'FQC', 'OQC'].includes(String(this.inspectionType || '').trim().toUpperCase())
  936. const groupMap = {}
  937. source.forEach((row) => {
  938. if (!row) return
  939. const rollNo = row.rollNo != null ? String(row.rollNo).trim() : ''
  940. const key = rollNo || '__EMPTY__'
  941. if (!groupMap[key]) {
  942. groupMap[key] = {
  943. rollNo,
  944. defectQty: 0,
  945. theoreticalCount: 0,
  946. enteredCount: 0,
  947. hasAbnormal: false
  948. }
  949. }
  950. const group = groupMap[key]
  951. const defectQty = Number(row.defectQty) || 0
  952. group.defectQty = isIpqcFqcOqc ? group.defectQty + defectQty : Math.max(group.defectQty, defectQty)
  953. group.theoreticalCount += 1
  954. if (String(row.isTransfer || '').trim().toUpperCase() === 'Y') {
  955. group.enteredCount += 1
  956. }
  957. if (String(row.isQualified || '').trim().toUpperCase() === 'N') {
  958. group.hasAbnormal = true
  959. }
  960. })
  961. return Object.keys(groupMap).map((key) => {
  962. const g = groupMap[key]
  963. const needTransfer = isIpqcFqcOqc
  964. ? g.enteredCount < g.theoreticalCount
  965. : this.needEdsTransferThisTime(historyMap[g.rollNo], g.hasAbnormal)
  966. return {
  967. rollNo: g.rollNo,
  968. defectQty: g.defectQty,
  969. itemCount,
  970. theoreticalCount: g.theoreticalCount,
  971. enteredCount: g.enteredCount,
  972. isAbnormal: g.hasAbnormal,
  973. isAbnormalText: g.hasAbnormal ? this.$t('qc.common.yes') : this.$t('qc.common.no'),
  974. conclusion: g.hasAbnormal
  975. ? this.$t('qc.iqcPage.unqualified')
  976. : this.$t('qc.iqcPage.qualified'),
  977. needTransfer,
  978. needTransferText: needTransfer ? this.$t('qc.common.yes') : this.$t('qc.common.no')
  979. }
  980. })
  981. },
  982. openSyncEdsPreview () {
  983. this.syncEdsLoading = true
  984. return this.fetchSubDetailRows().then((rows) => {
  985. this.syncEdsAllRows = rows
  986. const keepActive = (this.activeNames || []).slice()
  987. this.buildGroups(rows)
  988. this.activeNames = keepActive.filter((name) => this.itemGroups.some((g) => g.itemNo === name))
  989. const preview = this.buildSyncEdsPreviewList(rows, this.syncEdsLatestTransferMap)
  990. if (!preview.length) {
  991. this.$message.warning(this.$t('qc.iqcPage.syncEdsNoData'))
  992. return
  993. }
  994. this.syncEdsPreviewList = preview
  995. this.syncEdsDialogVisible = true
  996. }).catch(() => {
  997. this.$message.error(this.$t('qc.iqcPage.syncEdsFail'))
  998. }).finally(() => {
  999. this.syncEdsLoading = false
  1000. })
  1001. },
  1002. confirmSyncEds () {
  1003. if (this.syncEdsLoading) return
  1004. const preview = Array.isArray(this.syncEdsPreviewList) ? this.syncEdsPreviewList : []
  1005. const needTransferCount = preview.filter((row) => row && row.needTransfer).length
  1006. const missingRoll = preview.some((row) => {
  1007. if (!row || !row.needTransfer) return false
  1008. return !(row.rollNo != null && String(row.rollNo).trim())
  1009. })
  1010. if (missingRoll) {
  1011. this.$message.warning(this.$t('qc.iqcPage.syncEdsMissingRollNo'))
  1012. return
  1013. }
  1014. const detail = this.detailData || {}
  1015. this.syncEdsLoading = true
  1016. const payload = {
  1017. site: detail.site,
  1018. buNo: detail.buNo,
  1019. inspectionNo: detail.inspectionNo,
  1020. inspectionType: String(this.inspectionType || 'IQC').toUpperCase()
  1021. }
  1022. syncEdsInspectionResults(payload).then(({ data }) => {
  1023. if (data && data.code === 0 && data.success !== false) {
  1024. if (needTransferCount === 0) {
  1025. this.$message.warning(this.$t('qc.iqcPage.syncEdsNoPending'))
  1026. } else {
  1027. this.$message.success(this.$t('qc.iqcPage.syncEdsSuccess'))
  1028. }
  1029. this.syncEdsDialogVisible = false
  1030. this.$emit('saved')
  1031. this.loadData()
  1032. } else {
  1033. this.$message.error((data && (data.msg || data.message)) || this.$t('qc.iqcPage.syncEdsFail'))
  1034. }
  1035. }).catch(() => {
  1036. this.$message.error(this.$t('qc.iqcPage.syncEdsFail'))
  1037. }).finally(() => {
  1038. this.syncEdsLoading = false
  1039. })
  1040. }
  1041. }
  1042. }
  1043. </script>
  1044. <style scoped>
  1045. .eds-dialog-title {
  1046. display: flex;
  1047. align-items: center;
  1048. justify-content: space-between;
  1049. flex-wrap: wrap;
  1050. gap: 8px;
  1051. padding-right: 40px;
  1052. font-size: 16px;
  1053. font-weight: 600;
  1054. color: #303133;
  1055. }
  1056. .eds-dialog-actions {
  1057. margin-left: auto;
  1058. }
  1059. .eds-batch-body {
  1060. min-height: 420px;
  1061. }
  1062. .tag-bind-section {
  1063. border: 1px solid #e4e7ed;
  1064. border-radius: 4px;
  1065. background: #fafbfc;
  1066. padding: 10px 12px 12px;
  1067. margin-bottom: 8px;
  1068. }
  1069. .section-title {
  1070. font-size: 14px;
  1071. font-weight: 600;
  1072. color: #303133;
  1073. margin-bottom: 10px;
  1074. }
  1075. .section-title i {
  1076. margin-right: 4px;
  1077. color: #409eff;
  1078. }
  1079. .section-hint {
  1080. margin-left: 8px;
  1081. font-size: 12px;
  1082. font-weight: 400;
  1083. color: #909399;
  1084. }
  1085. .tag-empty {
  1086. color: #909399;
  1087. font-size: 13px;
  1088. padding: 8px 0;
  1089. }
  1090. .tag-input-grid {
  1091. display: flex;
  1092. flex-wrap: wrap;
  1093. gap: 10px 14px;
  1094. }
  1095. .tag-input-item {
  1096. width: 200px;
  1097. }
  1098. .tag-input-item label {
  1099. display: block;
  1100. font-size: 12px;
  1101. color: #606266;
  1102. margin-bottom: 4px;
  1103. line-height: 1.2;
  1104. }
  1105. .toolbar {
  1106. margin: 4px 0 8px;
  1107. }
  1108. .item-collapse {
  1109. border: none;
  1110. max-height: 480px;
  1111. overflow: auto;
  1112. }
  1113. .item-header {
  1114. display: flex;
  1115. align-items: center;
  1116. flex-wrap: wrap;
  1117. gap: 6px 8px;
  1118. width: 100%;
  1119. padding-right: 8px;
  1120. line-height: 1;
  1121. }
  1122. .item-code,
  1123. .item-name {
  1124. font-weight: 600;
  1125. color: #303133;
  1126. }
  1127. .item-name {
  1128. max-width: 220px;
  1129. overflow: hidden;
  1130. text-overflow: ellipsis;
  1131. white-space: nowrap;
  1132. }
  1133. .item-sep {
  1134. color: #909399;
  1135. }
  1136. .item-spec {
  1137. display: inline-flex;
  1138. align-items: center;
  1139. flex-wrap: wrap;
  1140. gap: 4px 6px;
  1141. }
  1142. .spec-card {
  1143. display: inline-flex;
  1144. align-items: center;
  1145. justify-content: center;
  1146. padding: 0 8px;
  1147. height: 22px;
  1148. line-height: 1;
  1149. text-align: center;
  1150. border: 1px solid #dcdfe6;
  1151. border-radius: 3px;
  1152. background: #f5f7fa;
  1153. color: #303133;
  1154. font-size: 12px;
  1155. font-weight: 400;
  1156. box-sizing: border-box;
  1157. }
  1158. .item-progress {
  1159. font-weight: 600;
  1160. font-variant-numeric: tabular-nums;
  1161. }
  1162. .item-progress.is-success {
  1163. color: #67c23a;
  1164. border-color: #c2e7b0;
  1165. background: #f0f9eb;
  1166. }
  1167. .item-progress.is-warning {
  1168. color: #e6a23c;
  1169. border-color: #f5dab1;
  1170. background: #fdf6ec;
  1171. }
  1172. .item-header .el-button--mini {
  1173. display: inline-flex;
  1174. align-items: center;
  1175. justify-content: center;
  1176. height: 22px;
  1177. padding: 0 8px;
  1178. margin-left: 0;
  1179. line-height: 1;
  1180. }
  1181. .dialog-footer {
  1182. text-align: center;
  1183. }
  1184. </style>
  1185. <style>
  1186. .eds-batch-entry-dialog > .el-dialog {
  1187. max-width: calc(100% - 24px);
  1188. }
  1189. .eds-batch-entry-dialog > .el-dialog.is-fullscreen {
  1190. display: flex;
  1191. flex-direction: column;
  1192. max-width: 100%;
  1193. overflow: hidden;
  1194. }
  1195. .eds-batch-entry-dialog > .is-fullscreen > .el-dialog__header,
  1196. .eds-batch-entry-dialog > .is-fullscreen > .el-dialog__footer {
  1197. flex-shrink: 0;
  1198. }
  1199. .eds-batch-entry-dialog > .is-fullscreen > .el-dialog__body,
  1200. .eds-batch-entry-dialog > .is-fullscreen .eds-batch-body {
  1201. display: flex;
  1202. flex: 1;
  1203. flex-direction: column;
  1204. min-height: 0;
  1205. }
  1206. .eds-batch-entry-dialog > .is-fullscreen .tag-bind-section,
  1207. .eds-batch-entry-dialog > .is-fullscreen .toolbar {
  1208. flex-shrink: 0;
  1209. }
  1210. .eds-batch-entry-dialog > .is-fullscreen .item-collapse {
  1211. min-height: 0;
  1212. max-height: none;
  1213. }
  1214. .eds-batch-entry-dialog .el-dialog__body {
  1215. padding: 12px 16px 8px;
  1216. }
  1217. /* 展开箭头放到项目名称前面 */
  1218. .eds-batch-entry-dialog .el-collapse-item__header {
  1219. height: auto;
  1220. min-height: 42px;
  1221. line-height: normal;
  1222. padding-top: 10px;
  1223. padding-bottom: 10px;
  1224. display: flex;
  1225. align-items: center;
  1226. flex-direction: row;
  1227. }
  1228. .eds-batch-entry-dialog .el-collapse-item__arrow {
  1229. order: -1;
  1230. margin: 0 8px 0 0 !important;
  1231. line-height: 1 !important;
  1232. height: auto !important;
  1233. display: inline-flex;
  1234. align-items: center;
  1235. }
  1236. .eds-batch-entry-dialog .el-collapse-item__header > *:not(.el-collapse-item__arrow) {
  1237. order: 1;
  1238. }
  1239. .eds-batch-entry-dialog .el-collapse-item__content {
  1240. padding-bottom: 10px;
  1241. }
  1242. /* 与「点击输入」弹框一致:沿用全局 input.el-input__inner 高度,不做额外覆盖 */
  1243. .eds-batch-entry-dialog .tag-input-item .el-input,
  1244. .eds-batch-entry-dialog .eds-item-table .el-input {
  1245. width: 100%;
  1246. }
  1247. .eds-batch-entry-dialog .tag-input-item .el-input__suffix {
  1248. display: flex;
  1249. align-items: center;
  1250. height: 100%;
  1251. right: 2px;
  1252. }
  1253. .eds-batch-entry-dialog .tag-input-item .el-input__icon {
  1254. line-height: 20px;
  1255. width: 18px;
  1256. }
  1257. .eds-batch-entry-dialog .eds-item-table .el-table__body td,
  1258. .eds-batch-entry-dialog .eds-item-table .el-table__header th {
  1259. padding: 2px 0;
  1260. }
  1261. /* Override the global 14px cell height so editable controls are not clipped. */
  1262. .eds-batch-entry-dialog .eds-item-table .el-table__body td .cell {
  1263. height: 24px;
  1264. line-height: 24px;
  1265. }
  1266. .eds-batch-entry-dialog .eds-item-table .el-input {
  1267. height: 20px;
  1268. line-height: 20px;
  1269. vertical-align: middle;
  1270. }
  1271. .eds-batch-entry-dialog .eds-item-table .el-select {
  1272. width: 100%;
  1273. vertical-align: middle;
  1274. }
  1275. .eds-batch-entry-dialog .eds-item-table .el-select .el-input__inner {
  1276. height: 20px;
  1277. line-height: 20px;
  1278. }
  1279. .eds-batch-entry-dialog .eds-item-table .el-select .el-input__icon {
  1280. line-height: 20px;
  1281. }
  1282. .eds-batch-entry-dialog .eds-item-table .greenElSelect .el-input__inner {
  1283. color: #67C23A;
  1284. }
  1285. .eds-batch-entry-dialog .eds-item-table .redElSelect .el-input__inner {
  1286. color: #F56C6C;
  1287. }
  1288. .eds-batch-entry-dialog .eds-item-table .el-button--text {
  1289. height: 20px;
  1290. padding: 0;
  1291. line-height: 20px;
  1292. vertical-align: baseline;
  1293. }
  1294. </style>