|
|
@ -44,7 +44,7 @@ |
|
|
|
</div> |
|
|
|
<div class="field-list"> |
|
|
|
<div v-for="(item, index) in selectStatus" :key="index" class="field-item"> |
|
|
|
<el-select :key="index" v-model="item.fiedType"> |
|
|
|
<el-select :key="index" v-model="item.fiedType" @change="selectChangeFiedType(index)"> |
|
|
|
<el-option |
|
|
|
v-for="v in fiedOption" |
|
|
|
:key="v.value" |
|
|
@ -60,7 +60,7 @@ |
|
|
|
<p>源分类(文件库-文件表)</p> |
|
|
|
<span>{{ form.documentName }}</span> |
|
|
|
</div> |
|
|
|
<div class="field-list"> |
|
|
|
<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-option value="">请选择</el-option> |
|
|
@ -82,18 +82,26 @@ |
|
|
|
<p>目标门类(整理库/管理库-文件表)</p> |
|
|
|
<span>{{ selectedCategoryName }}</span> |
|
|
|
</div> |
|
|
|
<div class="field-list"> |
|
|
|
<div v-loading="rightLoading" class="field-list"> |
|
|
|
<div v-if="isCorrField"> |
|
|
|
<div v-for="(item,index) in allFieldData" :key="index" class="field-item"> |
|
|
|
<p>{{ item.categoryFieldId.fieldCnName }}</p> |
|
|
|
<div class="field-state"><span :class=" item.categoryFieldId.isInput ? 'is-select' : 'is-hide'">{{ item.categoryFieldId.isInput ? '显示': '隐藏' }}</span></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-else> |
|
|
|
<div v-for="(item,index) in allCorrField" :key="index" class="field-item"> |
|
|
|
<p>{{ item.fieldCnName }}</p> |
|
|
|
<div class="field-state"><span :class=" item.isInput ? 'is-select' : 'is-hide'">{{ item.isInput ? '显示': '隐藏' }}</span></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-if="allFieldData.length === 0" class="empty-data" /> |
|
|
|
</div> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="text" @click="batchVisible = false">取消</el-button> |
|
|
|
<el-button type="primary" @click="batchVisible = false">确定</el-button> |
|
|
|
<el-button type="primary" @click="handleComfirmBatchToFile">确定</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
@ -103,11 +111,12 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { preLibraryCrud } from '../mixins/index' |
|
|
|
// FetchInitFieldMateList |
|
|
|
import { FetchInitFieldMate, FetchMateByDocumentId, FetchDetailsByDocumentIdAndCategoryId } from '@/api/system/fieldMate' |
|
|
|
import { FetchDocumentMenu } from '@/api/system/fileLibrary/fileLibrary' |
|
|
|
import { FetchCategoryMenu } from '@/api/system/category/category' |
|
|
|
import { FetchInitDocumentFieldByPid } from '@/api/system/fileLibrary/fileLibrary' |
|
|
|
import { FetchCategoryMenu, FetchInitCategoryFieldByPid } from '@/api/system/category/category' |
|
|
|
import { FetchArchivesScopeByCategoryId } from '@/api/system/archivesScope' |
|
|
|
import { FetchCheckRepeat } from '@/api/system/fieldMate' |
|
|
|
// import { FetchBatchToFile } from '@/api/prearchiveLibrary/prearchiveLibrary' |
|
|
|
import Treeselect from '@riophae/vue-treeselect' |
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
|
|
|
// import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect' |
|
|
@ -136,7 +145,7 @@ export default { |
|
|
|
documentName: '', |
|
|
|
categoryId: null |
|
|
|
}, |
|
|
|
selectedCategory: {}, |
|
|
|
batchCategory: {}, |
|
|
|
selectedCategoryName: null, |
|
|
|
scopeVisible: false, |
|
|
|
loadSource: [], |
|
|
@ -147,10 +156,10 @@ export default { |
|
|
|
}, |
|
|
|
fiedOption: [{ |
|
|
|
'label': '默认值', |
|
|
|
'value': 1 |
|
|
|
'value': 2 |
|
|
|
}, { |
|
|
|
'label': '字段值', |
|
|
|
'value': 2 |
|
|
|
'value': 1 |
|
|
|
}], |
|
|
|
fiedType: null, |
|
|
|
selectStatus: [], |
|
|
@ -160,7 +169,9 @@ export default { |
|
|
|
allFieldData: [], |
|
|
|
targetData: [], |
|
|
|
leftLoading: false, |
|
|
|
rightLoading: false |
|
|
|
rightLoading: false, |
|
|
|
isCorrField: true, |
|
|
|
allCorrField: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
@ -171,8 +182,6 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
// this.getInitFieldMateList() |
|
|
|
// this.getDocumentDataTree() |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
}, |
|
|
@ -194,7 +203,7 @@ export default { |
|
|
|
getInitDetail(id) { |
|
|
|
FetchInitFieldMate({ 'id': id }).then((res) => { |
|
|
|
this.selectedCategoryName = res.categoryName |
|
|
|
this.selectedCategory = res.fieldMateDetails[0].pid.categoryId |
|
|
|
this.batchCategory = res.fieldMateDetails[0].pid.categoryId |
|
|
|
this.form.categoryId = res.fieldMateDetails[0].pid.categoryId.pid |
|
|
|
this.getArchivesScopeByCategoryId() |
|
|
|
}).catch(err => { |
|
|
@ -204,10 +213,9 @@ export default { |
|
|
|
selectRules(val) { |
|
|
|
this.getInitDetail(val) |
|
|
|
this.selectStatus = [] |
|
|
|
// this.targetData = fieldData |
|
|
|
// this.targetData.forEach((item, index) => { |
|
|
|
// this.selectStatus.push({ mode: true, value: '' }) |
|
|
|
// }) |
|
|
|
this.allFieldData = [] |
|
|
|
this.allCorrField = [] |
|
|
|
this.isCorrField = true |
|
|
|
}, |
|
|
|
// 目标门类 |
|
|
|
getCategoryDataTree() { |
|
|
@ -215,9 +223,37 @@ export default { |
|
|
|
this.categoryTree = this.filterData(res) |
|
|
|
}) |
|
|
|
}, |
|
|
|
getDocumentDataTree() { |
|
|
|
FetchDocumentMenu().then(res => { |
|
|
|
this.documentTree = this.filterData(res) |
|
|
|
// 根据pid获取门类字段 |
|
|
|
initDocunmentFiledList(documentId) { |
|
|
|
// 文件库字段 |
|
|
|
this.leftLoading = true |
|
|
|
FetchInitDocumentFieldByPid({ documentId: documentId, isType: 2 }).then((res) => { |
|
|
|
this.options = res.sort((a, b) => { |
|
|
|
if (a.isInput !== b.isInput) { |
|
|
|
return a.isInput ? -1 : 1 |
|
|
|
} else { |
|
|
|
return a.isSequence - b.isSequence |
|
|
|
} |
|
|
|
}) |
|
|
|
this.leftLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 根据pid获取门类字段 |
|
|
|
initCategoryFiledList(categoryId) { |
|
|
|
// 门类字段 |
|
|
|
this.rightLoading = true |
|
|
|
FetchInitCategoryFieldByPid({ categoryId: categoryId, isType: 2 }).then((res) => { |
|
|
|
this.allCorrField = res.sort((a, b) => { |
|
|
|
if (a.isInput !== b.isInput) { |
|
|
|
return a.isInput ? -1 : 1 |
|
|
|
} else { |
|
|
|
return a.isSequence - b.isSequence |
|
|
|
} |
|
|
|
}) |
|
|
|
res.forEach((item, index) => { |
|
|
|
this.selectStatus.push({ mode: true, fiedType: 2, value: '', field: item, isInput: item.isInput }) |
|
|
|
}) |
|
|
|
this.rightLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 根据预归档库和门类获取详情 |
|
|
@ -227,10 +263,11 @@ export default { |
|
|
|
'categoryId': this.form.categoryId, |
|
|
|
'documentId': this.selectedDocument.id |
|
|
|
} |
|
|
|
this.initDocunmentFiledList(this.selectedDocument.id,) |
|
|
|
FetchDetailsByDocumentIdAndCategoryId(params).then(res => { |
|
|
|
this.allFieldData = res |
|
|
|
res.forEach((item, index) => { |
|
|
|
this.selectStatus.push({ mode: false, fiedType: item.categoryFieldId.isDefaultValue === '' ? 2 : 1, value: item.categoryFieldId.isDefaultValue === '' ? item.documentFieldId.fieldCnName : item.categoryFieldId.isDefaultValue, field: item.documentFieldId, isInput: item.documentFieldId.isInput }) |
|
|
|
this.selectStatus.push({ mode: false, fiedType: item.categoryFieldId.isDefaultValue === '' ? 1 : 2, value: item.categoryFieldId.isDefaultValue === '' ? item.documentFieldId.fieldCnName : item.categoryFieldId.isDefaultValue, field: item.documentFieldId, isInput: item.documentFieldId.isInput }) |
|
|
|
}) |
|
|
|
this.fieldLoading = false |
|
|
|
}) |
|
|
@ -245,9 +282,10 @@ export default { |
|
|
|
if (Array.isArray(res) && res.length === 1) { |
|
|
|
this.form.scope = res[0].scopeName |
|
|
|
} else { |
|
|
|
this.getDetailsByDocumentIdAndCategoryId() |
|
|
|
this.form.scope = null |
|
|
|
console.log('有多个“归档范围”') |
|
|
|
} |
|
|
|
this.getDetailsByDocumentIdAndCategoryId() |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleSelectCategory(val) { |
|
|
@ -259,32 +297,127 @@ export default { |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.form.categoryId) { |
|
|
|
this.$refs.scopeModule.$refs.tree2.setCurrentKey(this.form.categoryId) |
|
|
|
this.$refs.scopeModule.handleNodeClick2(this.selectedCategory) |
|
|
|
console.log(this.batchCategory) |
|
|
|
this.$refs.scopeModule.handleNodeClick2(this.batchCategory) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
hanleScopeSelect(val, category) { |
|
|
|
console.log('category', category) |
|
|
|
if (val.length !== 0) { |
|
|
|
this.form.scope = val[0].scopeName |
|
|
|
console.log('val', val) |
|
|
|
this.form.categoryId = category.id |
|
|
|
this.batchCategory = category |
|
|
|
this.selectedCategoryName = category.cnName |
|
|
|
this.$nextTick(() => { |
|
|
|
this.getCheckRepeat() |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
getCheckRepeat() { |
|
|
|
const params = { |
|
|
|
'categoryId': this.form.categoryId, |
|
|
|
'documentId': this.selectedDocument.id |
|
|
|
} |
|
|
|
this.fieldLoading = true |
|
|
|
FetchCheckRepeat(params).then((res) => { |
|
|
|
if (JSON.stringify(res) === JSON.stringify({})) { |
|
|
|
console.log('不存在对应关系') |
|
|
|
this.isCorrField = false |
|
|
|
this.$message({ |
|
|
|
message: '目标门类与当前源分类不存在对应关系', |
|
|
|
type: 'warning' |
|
|
|
}) |
|
|
|
this.form.ruleName = null |
|
|
|
this.selectStatus = [] |
|
|
|
this.initDocunmentFiledList(this.selectedDocument.id) |
|
|
|
this.initCategoryFiledList(this.form.categoryId) |
|
|
|
} else { |
|
|
|
console.log('存在对应关系') |
|
|
|
this.isCorrField = true |
|
|
|
this.selectStatus = [] |
|
|
|
this.allFieldData = [] |
|
|
|
this.form.ruleName = res.id |
|
|
|
this.getDetailsByDocumentIdAndCategoryId() |
|
|
|
} |
|
|
|
this.fieldLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 切换 "字段值" / "默认值" |
|
|
|
selectChangeFiedType(index) { |
|
|
|
this.options.forEach((item) => { |
|
|
|
if (this.selectStatus[index].fiedType === 1) { |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, fiedType: this.selectStatus[index].fiedType, value: this.allFieldData[index].categoryFieldId.isDefaultValue, field: item, isInput: item.isInput }) |
|
|
|
} else { |
|
|
|
this.selectStatus.splice(index, 1, { mode: true, fiedType: this.selectStatus[index].fiedType, value: '', field: item, isInput: item.isInput }) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
selectChange(index) { |
|
|
|
this.options.forEach((item) => { |
|
|
|
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 }) |
|
|
|
} else { |
|
|
|
if (item.fieldCnName === this.selectStatus[index].value) { |
|
|
|
this.selectStatus.splice(index, 1, { mode: false, value: this.selectStatus[index].value, field: item, isInput: item.isInput }) |
|
|
|
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 }) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
textMode(index) { |
|
|
|
this.selectStatus.splice(index, 1, { mode: true, value: this.selectStatus[index].value, field: null, isInput: this.selectStatus[index].isInput }) |
|
|
|
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 }) |
|
|
|
} |
|
|
|
}, |
|
|
|
handleClose(done) { |
|
|
|
this.batchVisible = false |
|
|
|
Object.assign(this.form, { |
|
|
|
ruleName: null, |
|
|
|
scope: null, |
|
|
|
documentId: null, |
|
|
|
categoryId: null |
|
|
|
}) |
|
|
|
this.selectedCategoryName = null |
|
|
|
this.allFieldData = [] |
|
|
|
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) |
|
|
|
console.log(this.selectStatus) |
|
|
|
const filteredDocumentList = this.selectStatus.map(item => { |
|
|
|
if (item.hasOwnProperty('field')) { |
|
|
|
const fieldValue = item['field'] // 获取指定字段的值 |
|
|
|
return { |
|
|
|
...fieldValue, // 提取整个field字段,并复制其内容 |
|
|
|
getType: item.fiedType // 在field字段中添加getType字段并赋值 |
|
|
|
} |
|
|
|
} else { |
|
|
|
return item |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log('filteredDocumentList', filteredDocumentList) |
|
|
|
console.log(this.allFieldData) |
|
|
|
const filteredCategoryList = this.allFieldData.map(item => { |
|
|
|
}) |
|
|
|
console.log(filteredCategoryList) |
|
|
|
|
|
|
|
const params = { |
|
|
|
'archivesIds': [], |
|
|
|
'categoryId': this.selectedDocument.id, |
|
|
|
'documentId': this.form.categoryId, |
|
|
|
'dtos': [] |
|
|
|
} |
|
|
|
console.log(params) |
|
|
|
// FetchBatchToFile().then((res) => { |
|
|
|
// }) |
|
|
|
}, |
|
|
|
normalizer(node) { |
|
|
|
if (node.children && !node.children.length) { |
|
|
|
delete node.children |
|
|
|