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.

106 lines
3.3 KiB

3 months ago
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
​
​
3 months ago
​
​
3 months ago
​
​
3 months ago
3 months ago
3 months ago
​
​
​
​
​
3 months ago
​
3 months ago
​
​
3 months ago
2 months ago
3 months ago
2 months ago
​
​
3 months ago
​
​
​
3 months ago
3 months ago
2 months ago
​
​
​
3 months ago
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
​
​
​
  1. import { queryEquipmentFolderLocationList } from '@/api/qc/qc.js'
  2. export default {
  3. data () {
  4. return {
  5. batchDeviceDialogVisible: false,
  6. batchClassificationList: [],
  7. batchEquipmentFolderList: [],
  8. itemObjectEquipmentList: []
  9. }
  10. },
  11. watch: {
  12. ItemObjectModelFlag (val) {
  13. if (val) {
  14. this.loadItemObjectEquipmentList()
  15. }
  16. }
  17. },
  18. methods: {
  19. loadItemObjectEquipmentList () {
  20. if (!this.actionData || !this.actionData.site) {
  21. return Promise.resolve()
  22. }
  23. return queryEquipmentFolderLocationList({
  24. site: this.actionData.site,
  25. buNo: this.actionData.buNo,
  26. page: 1,
  27. pageCount: -1
  28. }).then(({ data }) => {
  29. if (data && data.code === 0) {
  30. this.itemObjectEquipmentList = data.rows || []
  31. this.batchEquipmentFolderList = this.itemObjectEquipmentList
  32. }
  33. })
  34. },
  35. getRowDeviceOptions (row) {
  36. const options = [...(row.objectList || [])]
  37. if (row.equipmentNo && !options.some(opt => opt.objectID === row.equipmentNo)) {
  38. const selected = (this.itemObjectEquipmentList || []).find(
  39. item => item.equipmentNo === row.equipmentNo
  40. )
  41. if (selected) {
  42. options.unshift({
  43. objectID: selected.equipmentNo,
  44. objectDesc: selected.equipmentDesc || selected.equipmentNo
  45. })
  46. } else {
  47. options.unshift({
  48. objectID: row.equipmentNo,
  49. objectDesc: row.equipmentNo
  50. })
  51. }
  52. }
  53. return options
  54. },
  55. openBatchDeviceDialog () {
  56. const list = this.itemObjectList || []
  57. this.batchClassificationList = [...new Set(
  58. list.map(item => (item.equipmentClassification || '').trim()).filter(Boolean)
  59. )]
  60. if (!this.batchClassificationList.length) {
  61. this.$message.warning(this.$t('qc.iqcPage.batchDeviceNoClassification'))
  62. return
  63. }
  64. const openDialog = () => {
  65. this.batchEquipmentFolderList = this.itemObjectEquipmentList || []
  66. this.batchDeviceDialogVisible = true
  67. }
  68. if (this.itemObjectEquipmentList.length) {
  69. openDialog()
  70. } else {
  71. this.loadItemObjectEquipmentList().then(() => openDialog())
  72. }
  73. },
  74. applyBatchDevice (payload) {
  75. const selections = payload && payload.selections
  76. ? payload.selections
  77. : (payload && payload.classification ? [payload] : [])
  78. let applied = 0
  79. selections.forEach(({ classification, equipmentNo, equipmentDesc }) => {
  80. this.itemObjectList.forEach(item => {
  81. if ((item.equipmentClassification || '').trim() !== classification) {
  82. return
  83. }
  84. if (!item.objectList) {
  85. this.$set(item, 'objectList', [])
  86. }
  87. if (!item.objectList.some(opt => opt.objectID === equipmentNo)) {
  88. item.objectList.push({
  89. objectID: equipmentNo,
  90. objectDesc: equipmentDesc
  91. })
  92. }
  93. item.equipmentNo = equipmentNo
  94. applied++
  95. })
  96. })
  97. this.batchDeviceDialogVisible = false
  98. if (applied > 0) {
  99. this.$message.success(this.$t('qc.iqcPage.batchDeviceApplySuccess', { count: applied }))
  100. } else {
  101. this.$message.warning(this.$t('qc.iqcPage.batchDeviceApplyEmpty'))
  102. }
  103. }
  104. }
  105. }