|
|
|
@ -1,7 +1,8 @@ |
|
|
|
<script> |
|
|
|
import {searchCodeItemAllDefsSeq, searchCodeItemDefs, searchCodeItemDefsSeq} from "../../../api/code/codeItemDef"; |
|
|
|
import {searchCodeGenerationItemValueList} from "../../../api/code/codeItemValue"; |
|
|
|
import {codeNoGenerate, saveDrawing} from "../../../api/code/codeDrawing"; |
|
|
|
import {searchCodeItemAllDefsSeq} from "../../../api/code/codeItemDef"; |
|
|
|
import {searchCodeGenerationItemValueList, searchCodeItemValueListItem} from "../../../api/code/codeItemValue"; |
|
|
|
import {codeConditionDetailList} from "../../../api/code/codeConditionDetail"; |
|
|
|
import {codeNoGenerate, saveDrawing, searchDrawingDetailList, searchDrawingList} from "../../../api/code/codeDrawing"; |
|
|
|
import dayjs from "dayjs"; |
|
|
|
import {queryCodeErpPartNo, searchCodeParameterById} from "../../../api/code/codeParameterDef"; |
|
|
|
import itemValue from "./item/itemValue.vue"; |
|
|
|
@ -13,6 +14,14 @@ export default { |
|
|
|
type: Boolean, |
|
|
|
default: false |
|
|
|
}, |
|
|
|
dialogVisible: { |
|
|
|
type: Boolean, |
|
|
|
default: false |
|
|
|
}, |
|
|
|
initialDrawingNo: { |
|
|
|
type: String, |
|
|
|
default: '' |
|
|
|
}, |
|
|
|
initialErpPartNo: { |
|
|
|
type: String, |
|
|
|
default: '' |
|
|
|
@ -54,6 +63,8 @@ export default { |
|
|
|
checkCodeFlag:'N', |
|
|
|
getCodeNoLoading: false, |
|
|
|
saveCodeLoading: false, |
|
|
|
dialogInitToken: 0, |
|
|
|
dialogInitLoading: false, |
|
|
|
rules:{ |
|
|
|
drawingNo: [{ required: true, message: '“编码”不能为空,请先指定各个元素的值!', trigger: 'blur' }], |
|
|
|
erpPartNo: [{ required: true, message: '请输入IFS Part No', trigger: 'blur' }], |
|
|
|
@ -64,33 +75,366 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
if (!this.dialogMode) { |
|
|
|
this.searchCodeItemDefs(); |
|
|
|
} |
|
|
|
this.searchCodeParameterById(); |
|
|
|
}, |
|
|
|
beforeDestroy() { |
|
|
|
|
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
searchCodeItemDefs(){ |
|
|
|
getDefaultSearchModel(erpPartNo = '', erpPartDesc = '') { |
|
|
|
return { |
|
|
|
drawingNo: "", |
|
|
|
drawingNoNew: "", |
|
|
|
drawingDesc: "", |
|
|
|
erpPartNo: (erpPartNo || '').toUpperCase(), |
|
|
|
erpPartDesc: erpPartDesc || "", |
|
|
|
remark: "", |
|
|
|
seqFlag: "N", |
|
|
|
} |
|
|
|
}, |
|
|
|
resolveDefaultItemType(itemDef) { |
|
|
|
if (!itemDef || !itemDef.itemType) { |
|
|
|
return '' |
|
|
|
} |
|
|
|
return itemDef.itemType.includes('或') ? itemDef.itemType.split('或')[0] : itemDef.itemType |
|
|
|
}, |
|
|
|
resetGenerationState() { |
|
|
|
this.searchModel = this.getDefaultSearchModel(this.initialErpPartNo, this.initialErpPartDesc) |
|
|
|
this.codeItemTypes = this.codeItemDefs.map(item => this.resolveDefaultItemType(item)) |
|
|
|
this.codeItemValues = this.codeItemDefs.map(() => undefined) |
|
|
|
}, |
|
|
|
async initDialogData() { |
|
|
|
if (!this.dialogMode) { |
|
|
|
return |
|
|
|
} |
|
|
|
const token = ++this.dialogInitToken |
|
|
|
this.dialogInitLoading = true |
|
|
|
try { |
|
|
|
const loaded = await this.searchCodeItemDefs(true) |
|
|
|
if (!loaded || token !== this.dialogInitToken) { |
|
|
|
return |
|
|
|
} |
|
|
|
this.resetGenerationState() |
|
|
|
const drawingNo = (this.initialDrawingNo || '').trim() |
|
|
|
if (drawingNo && drawingNo !== 'NA') { |
|
|
|
await this.prefillDialogByDrawingNo(drawingNo, token) |
|
|
|
} |
|
|
|
} finally { |
|
|
|
if (token === this.dialogInitToken) { |
|
|
|
this.dialogInitLoading = false |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
async searchCodeItemDefs(silent = false){ |
|
|
|
let params = { |
|
|
|
site:'*', |
|
|
|
} |
|
|
|
this.codeItemTypes = []; |
|
|
|
this.codeItemValues = []; |
|
|
|
searchCodeItemAllDefsSeq(params).then(({data})=>{ |
|
|
|
try { |
|
|
|
const {data} = await searchCodeItemAllDefsSeq(params) |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.codeItemDefs = data.rows; |
|
|
|
this.codeItemDefs = data.rows || []; |
|
|
|
for (let i = 0; i < this.codeItemDefs.length; i++) { |
|
|
|
let arr = this.codeItemDefs[i].itemType.split('或'); |
|
|
|
this.codeItemTypes[i] = arr[0] |
|
|
|
this.codeItemTypes[i] = this.resolveDefaultItemType(this.codeItemDefs[i]) |
|
|
|
this.codeItemValues[i] = undefined |
|
|
|
} |
|
|
|
}else { |
|
|
|
return true |
|
|
|
} |
|
|
|
if (!silent) { |
|
|
|
this.$message.warning(data.msg); |
|
|
|
} |
|
|
|
}).catch((error) => { |
|
|
|
} catch (error) { |
|
|
|
if (!silent) { |
|
|
|
this.$message.error(error); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
}, |
|
|
|
async prefillDialogByDrawingNo(drawingNo, token) { |
|
|
|
try { |
|
|
|
const [listRes, detailStarRes] = await Promise.all([ |
|
|
|
searchDrawingList({ |
|
|
|
site: this.$store.state.user.site, |
|
|
|
drawingNo |
|
|
|
}), |
|
|
|
searchDrawingDetailList({ site: '*', drawingNo }) |
|
|
|
]) |
|
|
|
if (token !== this.dialogInitToken) { |
|
|
|
return |
|
|
|
} |
|
|
|
if (listRes.data && listRes.data.code === 0) { |
|
|
|
const drawingRows = listRes.data.rows || [] |
|
|
|
const drawingRow = drawingRows.find(item => item.drawingNo === drawingNo) || drawingRows[0] |
|
|
|
if (drawingRow) { |
|
|
|
this.searchModel = { |
|
|
|
...this.searchModel, |
|
|
|
drawingNo: drawingRow.drawingNo || drawingNo, |
|
|
|
drawingNoNew: drawingRow.drawingNoNew || '', |
|
|
|
drawingDesc: drawingRow.drawingDesc || '', |
|
|
|
remark: drawingRow.remark || '', |
|
|
|
seqFlag: drawingRow.seqFlag || 'N', |
|
|
|
erpPartNo: drawingRow.erpPartNo || this.searchModel.erpPartNo, |
|
|
|
erpPartDesc: drawingRow.erpPartDesc || this.searchModel.erpPartDesc |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
let detailRows = [] |
|
|
|
if (detailStarRes.data && detailStarRes.data.code === 0) { |
|
|
|
detailRows = detailStarRes.data.rows || [] |
|
|
|
} |
|
|
|
if (detailRows.length === 0) { |
|
|
|
const detailRes = await searchDrawingDetailList({ drawingNo }) |
|
|
|
if (detailRes.data && detailRes.data.code === 0) { |
|
|
|
detailRows = detailRes.data.rows || [] |
|
|
|
} |
|
|
|
} |
|
|
|
if (detailRows.length > 0) { |
|
|
|
await this.applyDrawingDetailToForm(detailRows, token) |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.$message.error(error) |
|
|
|
} |
|
|
|
}, |
|
|
|
normalizeMatchValue(value) { |
|
|
|
return String(value == null ? '' : value).trim() |
|
|
|
}, |
|
|
|
isSameMatchValue(left, right) { |
|
|
|
const l = this.normalizeMatchValue(left) |
|
|
|
const r = this.normalizeMatchValue(right) |
|
|
|
if (!l || !r) { |
|
|
|
return false |
|
|
|
} |
|
|
|
if (l === r) { |
|
|
|
return true |
|
|
|
} |
|
|
|
if (l.toUpperCase() === r.toUpperCase()) { |
|
|
|
return true |
|
|
|
} |
|
|
|
return false |
|
|
|
}, |
|
|
|
parseDrawingNoNewTokens(drawingNoNew) { |
|
|
|
const tokens = [] |
|
|
|
const source = String(drawingNoNew || '') |
|
|
|
if (!source) { |
|
|
|
return tokens |
|
|
|
} |
|
|
|
const regex = /\{([^}]*)\}|\|([^|]*)\|/g |
|
|
|
let match = regex.exec(source) |
|
|
|
while (match) { |
|
|
|
if (match[1] !== undefined) { |
|
|
|
tokens.push({type: 'brace', value: match[1]}) |
|
|
|
} else { |
|
|
|
tokens.push({type: 'pipe', value: match[2]}) |
|
|
|
} |
|
|
|
match = regex.exec(source) |
|
|
|
} |
|
|
|
return tokens |
|
|
|
}, |
|
|
|
parseDrawingDescMap(drawingDesc) { |
|
|
|
const result = new Map() |
|
|
|
const source = String(drawingDesc || '').trim() |
|
|
|
if (!source) { |
|
|
|
return result |
|
|
|
} |
|
|
|
const regex = /(\S+?):([^:]+?)(?=\s+\S+?:|$)/g |
|
|
|
let match = regex.exec(source) |
|
|
|
while (match) { |
|
|
|
const key = String(match[1] || '').trim() |
|
|
|
const value = String(match[2] || '').trim() |
|
|
|
if (key && value) { |
|
|
|
result.set(key, value) |
|
|
|
} |
|
|
|
match = regex.exec(source) |
|
|
|
} |
|
|
|
return result |
|
|
|
}, |
|
|
|
getDrawingDescValue(detail, itemDef, drawingDescMap) { |
|
|
|
if (!drawingDescMap || drawingDescMap.size === 0) { |
|
|
|
return '' |
|
|
|
} |
|
|
|
const candidates = [ |
|
|
|
detail ? detail.itemName : '', |
|
|
|
detail ? detail.itemDesc : '', |
|
|
|
itemDef ? itemDef.itemDesc : '', |
|
|
|
] |
|
|
|
for (let i = 0; i < candidates.length; i++) { |
|
|
|
const key = String(candidates[i] || '').trim() |
|
|
|
if (key && drawingDescMap.has(key)) { |
|
|
|
return drawingDescMap.get(key) |
|
|
|
} |
|
|
|
} |
|
|
|
return '' |
|
|
|
}, |
|
|
|
findMatchedSelectItem(itemValues, detailValue, tokenValue, descValue, detailLabel) { |
|
|
|
const list = itemValues || [] |
|
|
|
if (list.length === 0) { |
|
|
|
return null |
|
|
|
} |
|
|
|
const valueCandidates = [detailValue, tokenValue].filter(value => String(value || '').trim() !== '') |
|
|
|
for (let i = 0; i < valueCandidates.length; i++) { |
|
|
|
const matchedByValueNo = list.find(value => this.isSameMatchValue(value.valueNo, valueCandidates[i])) |
|
|
|
if (matchedByValueNo) { |
|
|
|
return matchedByValueNo |
|
|
|
} |
|
|
|
} |
|
|
|
const numericCandidates = valueCandidates |
|
|
|
.map(value => String(value || '').trim()) |
|
|
|
.filter(value => /^\d+$/.test(value)) |
|
|
|
for (let i = 0; i < numericCandidates.length; i++) { |
|
|
|
const normalized = String(parseInt(numericCandidates[i], 10)) |
|
|
|
const matchedByValueItemNo = list.find(value => |
|
|
|
String(value.valueItemNo) === numericCandidates[i] || |
|
|
|
String(value.valueItemNo) === normalized |
|
|
|
) |
|
|
|
if (matchedByValueItemNo) { |
|
|
|
return matchedByValueItemNo |
|
|
|
} |
|
|
|
} |
|
|
|
const labelCandidates = [detailLabel, descValue, detailValue].filter(value => String(value || '').trim() !== '') |
|
|
|
for (let i = 0; i < labelCandidates.length; i++) { |
|
|
|
const matchedByItemValue = list.find(value => this.isSameMatchValue(value.itemValue, labelCandidates[i])) |
|
|
|
if (matchedByItemValue) { |
|
|
|
return matchedByItemValue |
|
|
|
} |
|
|
|
} |
|
|
|
return null |
|
|
|
}, |
|
|
|
toInt(value) { |
|
|
|
const text = String(value == null ? '' : value).trim() |
|
|
|
if (!/^\d+$/.test(text)) { |
|
|
|
return null |
|
|
|
} |
|
|
|
return parseInt(text, 10) |
|
|
|
}, |
|
|
|
async backfillParentValuesByCondition(index, matchedItem, token) { |
|
|
|
if (!matchedItem || matchedItem.conditionId == null || token !== this.dialogInitToken) { |
|
|
|
return |
|
|
|
} |
|
|
|
try { |
|
|
|
const {data} = await codeConditionDetailList({ |
|
|
|
site: '*', |
|
|
|
itemNo: this.codeItemDefs[index].itemNo, |
|
|
|
conditionId: matchedItem.conditionId |
|
|
|
}) |
|
|
|
if (token !== this.dialogInitToken || !data || data.code !== 0) { |
|
|
|
return |
|
|
|
} |
|
|
|
const rows = data.rows || [] |
|
|
|
for (let i = 0; i < rows.length; i++) { |
|
|
|
const row = rows[i] |
|
|
|
const executeItemNo = this.toInt(row.SQLStatementExecuteItem || row.sqlstatementExecuteItem || row.sqlStatementExecuteItem) |
|
|
|
const executeValueItemNo = this.toInt(row.SQLStatementExecuteValueItemNo || row.sqlstatementExecuteValueItemNo || row.sqlStatementExecuteValueItemNo) |
|
|
|
if (!executeItemNo || !executeValueItemNo) { |
|
|
|
continue |
|
|
|
} |
|
|
|
const parentIndex = this.codeItemDefs.findIndex(item => Number(item.itemNo) === executeItemNo) |
|
|
|
if (parentIndex < 0) { |
|
|
|
continue |
|
|
|
} |
|
|
|
if (this.codeItemValues[parentIndex] != null && String(this.codeItemValues[parentIndex]).trim() !== '') { |
|
|
|
continue |
|
|
|
} |
|
|
|
if (this.codeItemTypes[parentIndex] !== '选择') { |
|
|
|
continue |
|
|
|
} |
|
|
|
const parentValues = await this.ensureSelectItemValuesForPrefill(parentIndex, token) |
|
|
|
if (token !== this.dialogInitToken || parentValues.length === 0) { |
|
|
|
continue |
|
|
|
} |
|
|
|
const parentMatched = parentValues.find(item => Number(item.valueItemNo) === executeValueItemNo) |
|
|
|
if (parentMatched) { |
|
|
|
this.$set(this.codeItemValues, parentIndex, parentMatched.valueItemNo) |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
} |
|
|
|
}, |
|
|
|
async ensureSelectItemValuesForPrefill(index, token) { |
|
|
|
if (token !== this.dialogInitToken) { |
|
|
|
return [] |
|
|
|
} |
|
|
|
const currentValues = this.codeItemDefs[index].itemValues || [] |
|
|
|
if (currentValues.length > 0) { |
|
|
|
return currentValues |
|
|
|
} |
|
|
|
try { |
|
|
|
const {data} = await searchCodeItemValueListItem({ |
|
|
|
site: '*', |
|
|
|
itemNo: this.codeItemDefs[index].itemNo |
|
|
|
}) |
|
|
|
if (token !== this.dialogInitToken) { |
|
|
|
return [] |
|
|
|
} |
|
|
|
if (data && data.code === 0) { |
|
|
|
const allValues = data.rows || [] |
|
|
|
this.$set(this.codeItemDefs, index, { |
|
|
|
...this.codeItemDefs[index], |
|
|
|
itemValues: allValues |
|
|
|
}) |
|
|
|
return allValues |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
} |
|
|
|
return [] |
|
|
|
}, |
|
|
|
async applyDrawingDetailToForm(detailRows, token) { |
|
|
|
const detailMap = new Map() |
|
|
|
detailRows.forEach(detail => { |
|
|
|
detailMap.set(String(detail.itemNo), detail) |
|
|
|
}) |
|
|
|
const seqTokens = this.parseDrawingNoNewTokens(this.searchModel.drawingNoNew) |
|
|
|
const drawingDescMap = this.parseDrawingDescMap(this.searchModel.drawingDesc) |
|
|
|
let seqTokenIndex = 0 |
|
|
|
for (let i = 0; i < this.codeItemDefs.length; i++) { |
|
|
|
if (token !== this.dialogInitToken) { |
|
|
|
return |
|
|
|
} |
|
|
|
const itemDef = this.codeItemDefs[i] |
|
|
|
const isVirtualItem = itemDef.virtualItem === 'Y' |
|
|
|
const seqToken = isVirtualItem ? null : (seqTokens[seqTokenIndex++] || null) |
|
|
|
const detail = detailMap.get(String(itemDef.itemNo)) |
|
|
|
if (!detail && !seqToken) { |
|
|
|
continue |
|
|
|
} |
|
|
|
const tokenType = seqToken && seqToken.type === 'pipe' ? '流水号' : null |
|
|
|
const detailType = (detail && detail.itemType) || tokenType || this.resolveDefaultItemType(itemDef) |
|
|
|
if (itemDef.itemType && itemDef.itemType.includes(detailType)) { |
|
|
|
this.$set(this.codeItemTypes, i, detailType) |
|
|
|
} else { |
|
|
|
this.$set(this.codeItemTypes, i, this.resolveDefaultItemType(itemDef)) |
|
|
|
} |
|
|
|
if (this.codeItemTypes[i] === '选择') { |
|
|
|
const loadedItemValues = await this.ensureSelectItemValuesForPrefill(i, token) |
|
|
|
if (token !== this.dialogInitToken) { |
|
|
|
return |
|
|
|
} |
|
|
|
const detailValue = detail ? detail.itemValue : '' |
|
|
|
const detailLabel = detail ? detail.itemLabel : '' |
|
|
|
const tokenValue = seqToken ? seqToken.value : '' |
|
|
|
const descValue = this.getDrawingDescValue(detail, itemDef, drawingDescMap) |
|
|
|
const matchedItem = this.findMatchedSelectItem(loadedItemValues, detailValue, tokenValue, descValue, detailLabel) |
|
|
|
if (matchedItem) { |
|
|
|
this.$set(this.codeItemValues, i, matchedItem.valueItemNo) |
|
|
|
await this.backfillParentValuesByCondition(i, matchedItem, token) |
|
|
|
if (token !== this.dialogInitToken) { |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
const detailValue = detail ? detail.itemValue : undefined |
|
|
|
const tokenValue = seqToken ? seqToken.value : undefined |
|
|
|
const descValue = this.getDrawingDescValue(detail, itemDef, drawingDescMap) |
|
|
|
const fillValue = (detailValue !== undefined && detailValue !== null && detailValue !== '') ? detailValue : |
|
|
|
(tokenValue !== undefined && tokenValue !== null && tokenValue !== '' ? tokenValue : descValue) |
|
|
|
if (fillValue !== undefined) { |
|
|
|
this.$set(this.codeItemValues, i, fillValue) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
changeCodeItemType(index){ |
|
|
|
this.$set(this.codeItemValues, index, undefined) |
|
|
|
@ -144,9 +488,15 @@ export default { |
|
|
|
paramsData.itemType = '手工' |
|
|
|
}else if (this.codeItemDefs[i].itemType.includes('选择') && this.codeItemTypes[i] === '选择'){ |
|
|
|
// 寻找 简码 |
|
|
|
paramsData.name = this.codeItemDefs[i].itemValues[0].conditionName |
|
|
|
paramsData.value = this.getValueNo(this.codeItemDefs[i].itemValues,this.codeItemValues[i]).valueNo |
|
|
|
paramsData.label = this.getValueNo(this.codeItemDefs[i].itemValues,this.codeItemValues[i]).itemValue |
|
|
|
const selectedValue = this.getValueNo(this.codeItemDefs[i].itemValues, this.codeItemValues[i]) |
|
|
|
if (!selectedValue) { |
|
|
|
this.showAlert(`元素${this.codeItemDefs[i].itemDesc}的值不存在,请重新选择`); |
|
|
|
this.getCodeNoLoading = false; |
|
|
|
return; |
|
|
|
} |
|
|
|
paramsData.name = (this.codeItemDefs[i].itemValues && this.codeItemDefs[i].itemValues[0]) ? this.codeItemDefs[i].itemValues[0].conditionName : '' |
|
|
|
paramsData.value = selectedValue.valueNo |
|
|
|
paramsData.label = selectedValue.itemValue |
|
|
|
paramsData.itemType = '选择' |
|
|
|
}else if (this.codeItemDefs[i].itemType.includes('流水号') && this.codeItemTypes[i] === '流水号'){ |
|
|
|
paramsData.itemType = '流水号' |
|
|
|
@ -175,7 +525,10 @@ export default { |
|
|
|
}, |
|
|
|
getValueNo(arr,valueItemNo){ |
|
|
|
// 寻找 简码 |
|
|
|
return arr.find(item=>item.valueItemNo === valueItemNo) |
|
|
|
if (!arr || arr.length === 0) { |
|
|
|
return null |
|
|
|
} |
|
|
|
return arr.find(item=>item.valueItemNo === valueItemNo) || null |
|
|
|
}, |
|
|
|
showAlert(msg){ |
|
|
|
this.$alert(msg, '提示', { |
|
|
|
@ -201,28 +554,36 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
searchCodeGenerationItemValueList(arr,index){ |
|
|
|
async searchCodeGenerationItemValueList(arr,index, silent = false){ |
|
|
|
if (arr.length === 0){ |
|
|
|
return; |
|
|
|
return false; |
|
|
|
} |
|
|
|
this.loadingIndex = index |
|
|
|
this.codeItemDefs[index].itemValues = [] |
|
|
|
this.$set(this.codeItemDefs, index, {...this.codeItemDefs[index]}) |
|
|
|
searchCodeGenerationItemValueList(arr).then(({data})=>{ |
|
|
|
try { |
|
|
|
const {data} = await searchCodeGenerationItemValueList(arr) |
|
|
|
if (data && data.code === 0){ |
|
|
|
let itemDefs = {...this.codeItemDefs[index], itemValues: data.rows} |
|
|
|
this.$set(this.codeItemDefs, index, itemDefs) |
|
|
|
}else { |
|
|
|
return true |
|
|
|
} |
|
|
|
if (!silent) { |
|
|
|
if (this.$refs[`codeItemValue${index}`] && this.$refs[`codeItemValue${index}`][0]) { |
|
|
|
this.$refs[`codeItemValue${index}`][0].blur(); |
|
|
|
} |
|
|
|
this.$alert(data.msg, '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
}); |
|
|
|
} |
|
|
|
this.loadingIndex = -1 |
|
|
|
}).catch((error)=>{ |
|
|
|
} catch (error) { |
|
|
|
if (!silent) { |
|
|
|
this.$message.error(error); |
|
|
|
} |
|
|
|
} finally { |
|
|
|
this.loadingIndex = -1 |
|
|
|
}) |
|
|
|
} |
|
|
|
return false |
|
|
|
}, |
|
|
|
changeRowCodeItemValue(index){ |
|
|
|
// 值发生变化清空后续所有参数 |
|
|
|
@ -230,6 +591,10 @@ export default { |
|
|
|
for (let i = index+1; i < this.codeItemDefs.length; i++) { |
|
|
|
if (this.codeItemDefs[i].itemByCondition === 'Y'){ |
|
|
|
this.$set(this.codeItemValues, i, undefined) |
|
|
|
this.$set(this.codeItemDefs, i, { |
|
|
|
...this.codeItemDefs[i], |
|
|
|
itemValues: [] |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -314,20 +679,34 @@ export default { |
|
|
|
}, |
|
|
|
watch:{ |
|
|
|
'searchModel.erpPartNo'(newVal,oldVal){ |
|
|
|
this.searchModel.erpPartNo = newVal.toUpperCase() |
|
|
|
this.searchModel.erpPartNo = (newVal || '').toUpperCase() |
|
|
|
}, |
|
|
|
dialogVisible: { |
|
|
|
immediate: true, |
|
|
|
handler(newVal) { |
|
|
|
if (!this.dialogMode) { |
|
|
|
return |
|
|
|
} |
|
|
|
if (newVal) { |
|
|
|
this.initDialogData() |
|
|
|
} else { |
|
|
|
this.dialogInitToken++ |
|
|
|
this.dialogInitLoading = false |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
initialErpPartNo: { |
|
|
|
immediate: true, |
|
|
|
handler(newVal) { |
|
|
|
if (this.dialogMode) { |
|
|
|
this.searchModel.erpPartNo = newVal || '' |
|
|
|
if (this.dialogMode && (!this.dialogVisible || !this.searchModel.drawingNo)) { |
|
|
|
this.searchModel.erpPartNo = (newVal || '').toUpperCase() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
initialErpPartDesc: { |
|
|
|
immediate: true, |
|
|
|
handler(newVal) { |
|
|
|
if (this.dialogMode) { |
|
|
|
if (this.dialogMode && (!this.dialogVisible || !this.searchModel.drawingNo)) { |
|
|
|
this.searchModel.erpPartDesc = newVal || '' |
|
|
|
} |
|
|
|
} |
|
|
|
@ -337,7 +716,7 @@ export default { |
|
|
|
</script> |
|
|
|
|
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div v-loading="dialogMode && dialogInitLoading" element-loading-text="回显加载中..."> |
|
|
|
<el-form :model="searchModel" ref="drawingForm" :rules="rules" label-position="top"> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="6"> |
|
|
|
|