|
|
@ -62,13 +62,13 @@ |
|
|
|
</div> |
|
|
|
<div v-loading="leftLoading" class="field-list"> |
|
|
|
<div v-for="(item, index) in selectStatus" :key="index" class="field-item"> |
|
|
|
<el-select v-if="item.mode" :key="index" v-model="item.value" @change="selectChange(index)"> |
|
|
|
<el-select v-if="item.mode" :key="index" v-model="item.value" @change="selectChange($event,index)"> |
|
|
|
<el-option value="">请选择</el-option> |
|
|
|
<el-option |
|
|
|
v-for="v in options" |
|
|
|
:key="v.id" |
|
|
|
:label="v.fieldCnName" |
|
|
|
:value="v.fieldCnName" |
|
|
|
:value="v" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<p v-if="!item.mode" @click="textMode(index)"> |
|
|
@ -149,6 +149,7 @@ export default { |
|
|
|
batchCategory: {}, |
|
|
|
selectedCategoryName: null, |
|
|
|
scopeVisible: false, |
|
|
|
scopeSelection: null, |
|
|
|
loadSource: [], |
|
|
|
rules: { |
|
|
|
categoryId: [ |
|
|
@ -164,11 +165,9 @@ export default { |
|
|
|
}], |
|
|
|
fiedType: null, |
|
|
|
selectStatus: [], |
|
|
|
selectOptions: [], |
|
|
|
options: [], |
|
|
|
fieldLoading: false, |
|
|
|
allFieldData: [], |
|
|
|
targetData: [], |
|
|
|
leftLoading: false, |
|
|
|
rightLoading: false, |
|
|
|
isCorrField: true, |
|
|
@ -256,6 +255,17 @@ export default { |
|
|
|
res.forEach((item, index) => { |
|
|
|
this.selectStatus.push({ mode: true, fiedType: 1, value: '', field: item, isInput: item.isInput }) |
|
|
|
}) |
|
|
|
if (this.form.scope) { |
|
|
|
const indexClass = res.findIndex(item => item.fieldName === 'archive_ctg_no') |
|
|
|
const indexRetention = res.findIndex(item => item.fieldName === 'retention') |
|
|
|
if (indexClass !== -1 && this.scopeSelection[0].archivesClass !== null) { |
|
|
|
this.selectStatus.splice(indexClass, 1, { mode: false, fiedType: 2, value: this.scopeSelection[0].archivesClass.name, field: this.allCorrField[indexClass], isInput: this.allCorrField[indexClass].isInput }) |
|
|
|
} |
|
|
|
if (indexRetention !== -1 && this.scopeSelection[0].retention !== '') { |
|
|
|
this.selectStatus.splice(indexRetention, 1, { mode: false, fiedType: 2, value: this.scopeSelection[0].retention, field: this.allCorrField[indexRetention], isInput: this.allCorrField[indexRetention].isInput }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.rightLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
@ -284,9 +294,10 @@ export default { |
|
|
|
console.log(res) |
|
|
|
if (Array.isArray(res) && res.length === 1) { |
|
|
|
this.form.scope = res[0].scopeName |
|
|
|
this.scopeSelection = res |
|
|
|
} else { |
|
|
|
this.form.scope = null |
|
|
|
console.log('有多个“归档范围”') |
|
|
|
console.log('有多个“归档范围”或者无归档范围') |
|
|
|
} |
|
|
|
this.getDetailsByDocumentIdAndCategoryId() |
|
|
|
}) |
|
|
@ -301,11 +312,13 @@ export default { |
|
|
|
'categoryId': this.form.categoryId |
|
|
|
} |
|
|
|
FetchArchivesScopeByCategoryId(params).then(res => { |
|
|
|
console.log('resddddd', res) |
|
|
|
if (Array.isArray(res) && res.length === 1) { |
|
|
|
this.form.scope = res[0].scopeName |
|
|
|
this.scopeSelection = res |
|
|
|
} else { |
|
|
|
this.form.scope = null |
|
|
|
console.log('有多个“归档范围”') |
|
|
|
console.log('有多个“归档范围”或者无归档范围') |
|
|
|
} |
|
|
|
this.getCheckRepeat() |
|
|
|
}) |
|
|
@ -321,8 +334,10 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
hanleScopeSelect(val, category) { |
|
|
|
console.log('Scopeval', val) |
|
|
|
if (val.length !== 0) { |
|
|
|
this.form.scope = val[0].scopeName |
|
|
|
this.scopeSelection = val |
|
|
|
this.form.scope = '【' + val[0].scopeCode + '】' + val[0].scopeName |
|
|
|
this.form.categoryId = category.id |
|
|
|
this.batchCategory = category |
|
|
|
this.selectedCategoryName = category.cnName |
|
|
@ -347,6 +362,7 @@ export default { |
|
|
|
}) |
|
|
|
this.form.ruleName = null |
|
|
|
this.selectStatus = [] |
|
|
|
this.allCorrField = [] |
|
|
|
this.initDocunmentFiledList(this.selectedDocument.id) |
|
|
|
this.initCategoryFiledList(this.form.categoryId) |
|
|
|
} else { |
|
|
@ -355,7 +371,6 @@ export default { |
|
|
|
this.selectStatus = [] |
|
|
|
this.allFieldData = [] |
|
|
|
this.form.ruleName = res.id |
|
|
|
|
|
|
|
this.getDetailsByDocumentIdAndCategoryId() |
|
|
|
} |
|
|
|
this.fieldLoading = false |
|
|
@ -366,9 +381,19 @@ export default { |
|
|
|
this.options.forEach((item) => { |
|
|
|
if (this.selectStatus[index].fiedType === 2) { |
|
|
|
if (!this.isCorrField) { |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: this.selectStatus[index].fiedType, value: this.selectStatus[index].fiedType === 1 ? this.selectStatus[index].value : this.allCorrField[index].isDefaultValue, field: item, isInput: item.isInput }) |
|
|
|
console.log('1111') |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: this.selectStatus[index].fiedType, value: this.selectStatus[index].fiedType === 1 ? this.selectStatus[index].value : this.allCorrField[index].isDefaultValue, field: this.selectStatus[index].field, isInput: this.selectStatus[index].field.isInput }) |
|
|
|
if (this.form.scope) { |
|
|
|
if (this.allCorrField[index].fieldName === 'archive_ctg_no' && this.scopeSelection[0].archivesClass !== null) { |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: 2, value: this.scopeSelection[0].archivesClass.name, field: this.allCorrField[index], isInput: this.allCorrField[index].isInput }) |
|
|
|
} |
|
|
|
if (this.allCorrField[index].fieldName === 'retention' && this.scopeSelection[0].retention !== null) { |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: 2, value: this.scopeSelection[0].retention, field: this.allCorrField[index], isInput: this.allCorrField[index].isInput }) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: this.selectStatus[index].fiedType, value: this.allFieldData[index].categoryFieldId.isDefaultValue, field: item, isInput: item.isInput }) |
|
|
|
console.log('2222') |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: this.selectStatus[index].fiedType, value: this.allFieldData[index].categoryFieldId.isDefaultValue, field: this.selectStatus[index].field, isInput: this.selectStatus[index].field.isInput }) |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (!this.isCorrField) { |
|
|
@ -376,24 +401,25 @@ export default { |
|
|
|
} else { |
|
|
|
this.isTest = false |
|
|
|
} |
|
|
|
this.selectStatus.splice(index, 1, { mode: true, fiedType: this.selectStatus[index].fiedType, value: '', field: item, isInput: item.isInput }) |
|
|
|
this.selectStatus.splice(index, 1, { mode: true, fiedType: this.selectStatus[index].fiedType, value: '', field: this.selectStatus[index].field, isInput: this.selectStatus[index].field.isInput }) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
selectChange(index) { |
|
|
|
selectChange(val, index) { |
|
|
|
this.options.forEach((item) => { |
|
|
|
if (!this.isCorrField && this.allCorrField[index].isDefaultValue !== '') { |
|
|
|
if (this.isTest) { |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: 1, value: this.selectStatus[index].value, field: item, isInput: item.isInput }) |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: 1, value: val.fieldCnName, field: val, isInput: val.isInput }) |
|
|
|
} else { |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: 2, value: this.allCorrField[index].isDefaultValue === '' ? this.selectStatus[index].value : this.allCorrField[index].isDefaultValue, field: item, isInput: item.isInput }) |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: 2, value: this.allCorrField[index].isDefaultValue === '' ? this.selectStatus[index].value : this.allCorrField[index].isDefaultValue, field: val, isInput: val.isInput }) |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (this.selectStatus[index].fiedType === 1) { |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: 1, value: this.selectStatus[index].value, field: item, isInput: item.isInput }) |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: 1, value: val.fieldCnName, field: val, isInput: val.isInput }) |
|
|
|
} else { |
|
|
|
if (item.fieldCnName === this.selectStatus[index].value) { |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: this.allFieldData[index].categoryFieldId.isDefaultValue === '' ? 1 : 2, value: this.allFieldData[index].categoryFieldId.isDefaultValue === '' ? this.selectStatus[index].value : this.allFieldData[index].categoryFieldId.isDefaultValue, field: item, isInput: item.isInput }) |
|
|
|
console.log('item444', item) |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: this.allFieldData[index].categoryFieldId.isDefaultValue === '' ? 1 : 2, value: this.allFieldData[index].categoryFieldId.isDefaultValue === '' ? val.fieldCnName : this.allFieldData[index].categoryFieldId.isDefaultValue, field: val, isInput: val.isInput }) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -401,7 +427,7 @@ export default { |
|
|
|
}, |
|
|
|
textMode(index) { |
|
|
|
if (this.selectStatus[index].fiedType === 1) { |
|
|
|
this.selectStatus.splice(index, 1, { mode: true, fiedType: 1, value: this.selectStatus[index].value, field: null, isInput: this.selectStatus[index].isInput }) |
|
|
|
this.selectStatus.splice(index, 1, { mode: true, fiedType: 1, value: '', field: null, isInput: this.selectStatus[index].isInput }) |
|
|
|
} |
|
|
|
}, |
|
|
|
handleClose(done) { |
|
|
@ -420,34 +446,59 @@ export default { |
|
|
|
// done() |
|
|
|
}, |
|
|
|
handleComfirmBatchToFile() { |
|
|
|
// const getIndicesByMode = (modeValue) => { |
|
|
|
// return this.selectStatus.reduce((indices, item, index) => { |
|
|
|
// if (item.mode === modeValue) { |
|
|
|
// indices.push(index) |
|
|
|
// } |
|
|
|
// return indices |
|
|
|
// }, []) |
|
|
|
// } |
|
|
|
// const indices = getIndicesByMode(false) |
|
|
|
// const arrAL = this.selectStatus.map(item => { |
|
|
|
// if (item.hasOwnProperty('field')) { |
|
|
|
// return { |
|
|
|
// documentValue: item['field'].fieldName, |
|
|
|
// getType: item.fiedType // 在field字段中添加getType字段并赋值 |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// return item |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// console.log(arrAL) |
|
|
|
const dtos = this.allFieldData.map((item, index) => { |
|
|
|
return { |
|
|
|
'categoryValue': item.categoryFieldId.fieldName, |
|
|
|
'documentValue': this.selectStatus[index].fiedType === 2 ? item.categoryFieldId.isDefaultValue : this.selectStatus[index].field.fieldName, |
|
|
|
'getType': this.selectStatus[index].fiedType, |
|
|
|
'isRequired': item.categoryFieldId.isRequired |
|
|
|
} |
|
|
|
}) |
|
|
|
const getIndicesByMode = (modeValue) => { |
|
|
|
return this.selectStatus.reduce((indices, item, index) => { |
|
|
|
if (item.mode === modeValue) { |
|
|
|
indices.push(index) |
|
|
|
} |
|
|
|
return indices |
|
|
|
}, []) |
|
|
|
} |
|
|
|
const indices = getIndicesByMode(false) |
|
|
|
console.log(indices) |
|
|
|
const filteredFields = indices.map(index => this.selectStatus[index]) |
|
|
|
const categoryCorrField = indices.map(index => this.allCorrField[index]) |
|
|
|
console.log('filteredFields', filteredFields) |
|
|
|
console.log('categoryCorrField', categoryCorrField) |
|
|
|
|
|
|
|
let dtos |
|
|
|
if (!this.isCorrField) { |
|
|
|
dtos = categoryCorrField.map((item, index) => { |
|
|
|
let documentValue |
|
|
|
console.log(this.scopeSelection) |
|
|
|
console.log(filteredFields[index]) |
|
|
|
if (filteredFields[index].fiedType === 2) { |
|
|
|
if (item.fieldName === 'archive_ctg_no' && this.scopeSelection[0].archivesClass !== null) { |
|
|
|
console.log('111') |
|
|
|
documentValue = this.scopeSelection[0].archivesClass.name |
|
|
|
} else if (item.fieldName === 'retention' && this.scopeSelection[0].retention !== null) { |
|
|
|
console.log('222') |
|
|
|
documentValue = this.scopeSelection[0].retention |
|
|
|
} else { |
|
|
|
console.log('333') |
|
|
|
documentValue = item.isDefaultValue |
|
|
|
} |
|
|
|
} else { |
|
|
|
console.log('444') |
|
|
|
documentValue = filteredFields[index].field.fieldName |
|
|
|
} |
|
|
|
return { |
|
|
|
'categoryValue': item.fieldName, |
|
|
|
'documentValue': documentValue, |
|
|
|
'getType': filteredFields[index].fiedType, |
|
|
|
'isRequired': item.isRequired |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
dtos = this.allFieldData.map((item, index) => { |
|
|
|
return { |
|
|
|
'categoryValue': item.categoryFieldId.fieldName, |
|
|
|
'documentValue': this.selectStatus[index].fiedType === 2 ? item.categoryFieldId.isDefaultValue : this.selectStatus[index].field.fieldName, |
|
|
|
'getType': this.selectStatus[index].fiedType, |
|
|
|
'isRequired': item.categoryFieldId.isRequired |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const archivesIds = this.selectionsArc.map(item => { |
|
|
|
return item.id |
|
|
|
}) |
|
|
@ -471,6 +522,9 @@ export default { |
|
|
|
}) |
|
|
|
this.selectedCategoryName = null |
|
|
|
this.allFieldData = [] |
|
|
|
this.allCorrField = [] |
|
|
|
this.isTest = false |
|
|
|
this.batchCategory = {} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|