|
@ -1,6 +1,6 @@ |
|
|
<template> |
|
|
<template> |
|
|
<!--批量修改--> |
|
|
<!--批量修改--> |
|
|
<el-dialog class="fileUpload-dialog" title="批量修改" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="bulkEditingVisible"> |
|
|
|
|
|
|
|
|
<el-dialog class="fileUpload-dialog" title="批量修改" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="bulkEditingVisible" :before-close="handleCloseDialog"> |
|
|
<div class="setting-dialog"> |
|
|
<div class="setting-dialog"> |
|
|
<div class="bulk-editing-container"> |
|
|
<div class="bulk-editing-container"> |
|
|
<el-form ref="editForm" :model="editForm" :rules="editRules" label-width="100px"> |
|
|
<el-form ref="editForm" :model="editForm" :rules="editRules" label-width="100px"> |
|
@ -28,35 +28,65 @@ |
|
|
<el-input v-model="editForm.oldContext" style="width: 360px;" /> |
|
|
<el-input v-model="editForm.oldContext" style="width: 360px;" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="更新内容" prop="updateContext"> |
|
|
<el-form-item label="更新内容" prop="updateContext"> |
|
|
<el-input v-if="editForm.updateField.mateData !== 3 && editForm.updateField.isInputClass !== 'date' && editForm.updateField.isInputClass !== 'number'" v-model="editForm.updateContext" style="width: 360px;" /> |
|
|
|
|
|
<el-select v-if="editForm.updateField.mateData === 3" v-model="editForm.updateContext" placeholder="请选择" style="width: 360px;"> |
|
|
|
|
|
|
|
|
<!-- <el-select v-if="editForm.updateField.mateData === 3" v-model="editForm.updateContext" placeholder="请选择" style="width: 360px;"> |
|
|
<el-option |
|
|
<el-option |
|
|
v-for="item in dictionaryOptions" |
|
|
v-for="item in dictionaryOptions" |
|
|
:key="item.dictionaryId" |
|
|
:key="item.dictionaryId" |
|
|
:label="item.dictionaryName" |
|
|
:label="item.dictionaryName" |
|
|
:value="item.dictionaryCode" |
|
|
|
|
|
|
|
|
:value="item.dictionaryName" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-select> --> |
|
|
|
|
|
|
|
|
|
|
|
<treeselect |
|
|
|
|
|
v-if="editForm.updateField.mateData === 3" |
|
|
|
|
|
v-model="editForm.updateContext" |
|
|
|
|
|
:options="dictionaryOptions" |
|
|
|
|
|
style="width: 360px;" |
|
|
|
|
|
flat |
|
|
|
|
|
:multiple="false" |
|
|
|
|
|
:normalizer="normalizerProject" |
|
|
|
|
|
placeholder="请选择" |
|
|
|
|
|
><div slot="value-label" slot-scope="{ node }">{{ getAutoNameUnknown(node.label) }}</div></treeselect> |
|
|
|
|
|
|
|
|
|
|
|
<el-select v-else-if="editForm.updateField.mateData === 1" v-model="editForm.updateContext" placeholder="请选择" style="width: 360px;"> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="item in fondsOptions" |
|
|
|
|
|
:key="item.fondsNo" |
|
|
|
|
|
:label="item.fondsName" |
|
|
|
|
|
:value="item.fondsNo" |
|
|
/> |
|
|
/> |
|
|
</el-select> |
|
|
</el-select> |
|
|
|
|
|
<treeselect |
|
|
|
|
|
v-else-if="editForm.updateField.mateData === 2" |
|
|
|
|
|
v-model="editForm.updateContext" |
|
|
|
|
|
:options="classifyOptions" |
|
|
|
|
|
style="width: 360px;" |
|
|
|
|
|
flat |
|
|
|
|
|
:multiple="false" |
|
|
|
|
|
:normalizer="normalizer" |
|
|
|
|
|
placeholder="请选择" |
|
|
|
|
|
><div slot="value-label" slot-scope="{ node }">{{ getAutoNameUnknown(node.label) }}</div></treeselect> |
|
|
<el-date-picker |
|
|
<el-date-picker |
|
|
v-if="editForm.updateField.isInputClass === 'date'" |
|
|
|
|
|
|
|
|
v-else-if="editForm.updateField.isInputClass === 'date'" |
|
|
v-model="editForm.updateContext" |
|
|
v-model="editForm.updateContext" |
|
|
type="date" |
|
|
type="date" |
|
|
placeholder="选择日期" |
|
|
placeholder="选择日期" |
|
|
style="width: 360px;" |
|
|
style="width: 360px;" |
|
|
/> |
|
|
/> |
|
|
<el-input-number |
|
|
<el-input-number |
|
|
v-if="editForm.updateField.isInputClass === 'number'" |
|
|
|
|
|
|
|
|
v-else-if="editForm.updateField.isInputClass === 'number'" |
|
|
v-model.number="editForm.initialValue" |
|
|
v-model.number="editForm.initialValue" |
|
|
:min="0" |
|
|
:min="0" |
|
|
:max="999" |
|
|
:max="999" |
|
|
controls-position="right" |
|
|
controls-position="right" |
|
|
style="width: 360px;" |
|
|
style="width: 360px;" |
|
|
/> |
|
|
/> |
|
|
|
|
|
<el-input v-else v-model="editForm.updateContext" style="width: 360px;" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
|
</div> |
|
|
</div> |
|
|
<div slot="footer" class="dialog-footer"> |
|
|
<div slot="footer" class="dialog-footer"> |
|
|
<el-button type="text" @click="bulkEditingVisible = false">取消</el-button> |
|
|
|
|
|
|
|
|
<el-button type="text" @click="handleCloseDialog">取消</el-button> |
|
|
<el-button type="primary" @click.native="onSubmitBlukEditing('editForm')">确定</el-button> |
|
|
<el-button type="primary" @click.native="onSubmitBlukEditing('editForm')">确定</el-button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -65,12 +95,15 @@ |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { FetchInitCategoryInputFieldByPid } from '@/api/system/category/category' |
|
|
import { FetchInitCategoryInputFieldByPid } from '@/api/system/category/category' |
|
|
import { FetchSonDictionaryList } from '@/api/system/dict' |
|
|
|
|
|
|
|
|
import { FetchSonDictionaryList, FetchDictionaryTree } from '@/api/system/dict' |
|
|
|
|
|
import { FetchFondsAll } from '@/api/system/fonds' |
|
|
|
|
|
import { FetchArchivesClassTree } from '@/api/system/archivesClass' |
|
|
import { FetchBatchUpdate } from '@/api/collect/collect' |
|
|
import { FetchBatchUpdate } from '@/api/collect/collect' |
|
|
|
|
|
|
|
|
|
|
|
import Treeselect from '@riophae/vue-treeselect' |
|
|
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
|
|
export default { |
|
|
export default { |
|
|
name: 'BlukEditing', |
|
|
name: 'BlukEditing', |
|
|
components: { }, |
|
|
|
|
|
|
|
|
components: { Treeselect }, |
|
|
mixins: [], |
|
|
mixins: [], |
|
|
props: { |
|
|
props: { |
|
|
selectedCategory: { |
|
|
selectedCategory: { |
|
@ -105,7 +138,9 @@ export default { |
|
|
value: 1, |
|
|
value: 1, |
|
|
label: '填充' |
|
|
label: '填充' |
|
|
}], |
|
|
}], |
|
|
dictionaryOptions: [] |
|
|
|
|
|
|
|
|
dictionaryOptions: [], |
|
|
|
|
|
fondsOptions: [], |
|
|
|
|
|
classifyOptions: [] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
@ -124,9 +159,9 @@ export default { |
|
|
{ required: true } |
|
|
{ required: true } |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
|
if (this.editForm.updateField.mateData === 3) { |
|
|
|
|
|
|
|
|
if (this.editForm.updateField.mateData !== null) { |
|
|
this.$set(validateRule, 'updateContext', [ |
|
|
this.$set(validateRule, 'updateContext', [ |
|
|
{ required: true, message: '请选择需更新内容得字典项', trigger: 'change' } |
|
|
|
|
|
|
|
|
{ required: true, message: '请选择更新内容', trigger: 'change' } |
|
|
]) |
|
|
]) |
|
|
} else if (this.editForm.updateField.isInputClass === 'date') { |
|
|
} else if (this.editForm.updateField.isInputClass === 'date') { |
|
|
this.$set(validateRule, 'updateContext', [ |
|
|
this.$set(validateRule, 'updateContext', [ |
|
@ -142,44 +177,43 @@ export default { |
|
|
}, |
|
|
}, |
|
|
watch: { |
|
|
watch: { |
|
|
'editForm.updateField'(newVal) { |
|
|
'editForm.updateField'(newVal) { |
|
|
console.log('item', newVal) |
|
|
|
|
|
console.log('mateData', newVal.mateData) |
|
|
|
|
|
console.log('isInputClass', newVal.isInputClass) |
|
|
|
|
|
this.$refs.editForm.clearValidate() |
|
|
|
|
|
this.editForm.updateContext = '' |
|
|
|
|
|
this.editForm.updateType = 1 |
|
|
|
|
|
if (newVal.mateData === 3 || newVal.isInputClass === 'date') { |
|
|
|
|
|
this.editTypeOptions = [{ |
|
|
|
|
|
value: 1, |
|
|
|
|
|
label: '填充' |
|
|
|
|
|
}] |
|
|
|
|
|
} else if (newVal.isInputClass === 'number') { |
|
|
|
|
|
this.editTypeOptions = [{ |
|
|
|
|
|
value: 1, |
|
|
|
|
|
label: '填充' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: 2, |
|
|
|
|
|
label: '替换' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: 3, |
|
|
|
|
|
label: '增加' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: 4, |
|
|
|
|
|
label: '减少' |
|
|
|
|
|
}] |
|
|
|
|
|
} else { |
|
|
|
|
|
this.editTypeOptions = [{ |
|
|
|
|
|
value: 1, |
|
|
|
|
|
label: '填充' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: 2, |
|
|
|
|
|
label: '替换' |
|
|
|
|
|
}] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
this.$refs.editForm.clearValidate() |
|
|
|
|
|
this.editForm.updateContext = '' |
|
|
|
|
|
this.editForm.updateType = 1 |
|
|
|
|
|
if (newVal.mateData !== null || newVal.isInputClass === 'date') { |
|
|
|
|
|
this.editTypeOptions = [{ |
|
|
|
|
|
value: 1, |
|
|
|
|
|
label: '填充' |
|
|
|
|
|
}] |
|
|
|
|
|
} else if (newVal.isInputClass === 'number') { |
|
|
|
|
|
this.editTypeOptions = [{ |
|
|
|
|
|
value: 1, |
|
|
|
|
|
label: '填充' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: 2, |
|
|
|
|
|
label: '替换' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: 3, |
|
|
|
|
|
label: '增加' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: 4, |
|
|
|
|
|
label: '减少' |
|
|
|
|
|
}] |
|
|
|
|
|
} else { |
|
|
|
|
|
this.editTypeOptions = [{ |
|
|
|
|
|
value: 1, |
|
|
|
|
|
label: '填充' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: 2, |
|
|
|
|
|
label: '替换' |
|
|
|
|
|
}] |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
@ -188,6 +222,15 @@ export default { |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
// 处理vue-treeSelect回显出现unknown问题 |
|
|
|
|
|
getAutoNameUnknown(name) { |
|
|
|
|
|
if (name.lastIndexOf('unknown') > -1) { |
|
|
|
|
|
// 当treeselect翻译不了值时,name中有id,截取id,去调接口或者字典查询出名字 |
|
|
|
|
|
return name.split('(')[0] |
|
|
|
|
|
} else { |
|
|
|
|
|
return name |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
getInitCategoryInputFieldByPid() { |
|
|
getInitCategoryInputFieldByPid() { |
|
|
const params = { |
|
|
const params = { |
|
|
'categoryId': this.selectedCategory.id, |
|
|
'categoryId': this.selectedCategory.id, |
|
@ -201,15 +244,96 @@ export default { |
|
|
selectField(val) { |
|
|
selectField(val) { |
|
|
console.log(val) |
|
|
console.log(val) |
|
|
if (val.mateData === 3) { |
|
|
if (val.mateData === 3) { |
|
|
this.getSonDictionaryList(val.dictionaryId.id) |
|
|
|
|
|
|
|
|
if (this.selectedCategory.arrangeType === 3 && val.fieldName === 'project_class') { |
|
|
|
|
|
this.getDictsList() |
|
|
|
|
|
} else { |
|
|
|
|
|
this.getSonDictionaryList(val.dictionaryId.id) |
|
|
|
|
|
} |
|
|
|
|
|
} else if (val.mateData === 1) { |
|
|
|
|
|
this.getFondsDatas() |
|
|
|
|
|
} else { |
|
|
|
|
|
this.getInitArchivesClass() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
getSonDictionaryList(dictionaryId) { |
|
|
getSonDictionaryList(dictionaryId) { |
|
|
FetchSonDictionaryList({ 'pid': dictionaryId }).then(res => { |
|
|
FetchSonDictionaryList({ 'pid': dictionaryId }).then(res => { |
|
|
console.log(res) |
|
|
|
|
|
this.dictionaryOptions = res |
|
|
this.dictionaryOptions = res |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 项目级别 - 阶段分类 |
|
|
|
|
|
getDictsList() { |
|
|
|
|
|
FetchDictionaryTree().then((res) => { |
|
|
|
|
|
const filterCodes = ['project_class'] |
|
|
|
|
|
let filteredItems = JSON.parse(JSON.stringify(res)).filter(item => filterCodes.includes(item.dictionaryCode)) |
|
|
|
|
|
filteredItems = this.addLevelToDictionaryList(filteredItems, 1) |
|
|
|
|
|
if (this.selectedCategory.arrangeType === 3 && this.collectLevel !== 1) { |
|
|
|
|
|
this.dictionaryOptions = filteredItems |
|
|
|
|
|
} else { |
|
|
|
|
|
this.dictionaryOptions = this.filterData(filteredItems, filteredItems[0].id) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 显示第一级和第二级 |
|
|
|
|
|
filterData(data, targetId) { |
|
|
|
|
|
return data.filter(item => { |
|
|
|
|
|
if (item.id === targetId || item.dictionaryParents === targetId) { |
|
|
|
|
|
if (item.childDictionarys && item.childDictionarys.length > 0) { |
|
|
|
|
|
item.childDictionarys = this.filterData(item.childDictionarys, targetId) |
|
|
|
|
|
} |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
return false |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 给筛选出来的数据加level 方便后面是否可点击 |
|
|
|
|
|
addLevelToDictionaryList(dictionaryList, level) { |
|
|
|
|
|
dictionaryList.forEach(dictionary => { |
|
|
|
|
|
dictionary.level = level |
|
|
|
|
|
if (dictionary.childDictionarys) { |
|
|
|
|
|
dictionary.childDictionarys = this.addLevelToDictionaryList(dictionary.childDictionarys, level + 1) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
return dictionaryList |
|
|
|
|
|
}, |
|
|
|
|
|
normalizerProject(node) { |
|
|
|
|
|
if ((node.childDictionarys && !node.childDictionarys.length) || node.childDictionarys === null) { |
|
|
|
|
|
delete node.childDictionarys |
|
|
|
|
|
} |
|
|
|
|
|
return { |
|
|
|
|
|
id: node.dictionaryName, |
|
|
|
|
|
label: node.dictionaryName, |
|
|
|
|
|
children: node.childDictionarys, |
|
|
|
|
|
isDisabled: (this.collectLevel !== 1 && node.level && node.level !== 3) || (this.collectLevel === 1 && node.level === 1) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
getFondsDatas() { |
|
|
|
|
|
FetchFondsAll().then(res => { |
|
|
|
|
|
this.fondsOptions = res |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
getInitArchivesClass() { |
|
|
|
|
|
this.classifyOptions = [] |
|
|
|
|
|
const params = { |
|
|
|
|
|
'categoryId': this.selectedCategory.id |
|
|
|
|
|
} |
|
|
|
|
|
FetchArchivesClassTree(params).then((res) => { |
|
|
|
|
|
this.classifyOptions = JSON.parse(JSON.stringify(res)) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
normalizer(node) { |
|
|
|
|
|
if (node.childArchivesClass === null) { |
|
|
|
|
|
delete node.childArchivesClass |
|
|
|
|
|
} |
|
|
|
|
|
return { |
|
|
|
|
|
id: node.code, |
|
|
|
|
|
label: node.name, |
|
|
|
|
|
children: node.childArchivesClass |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
onSubmitBlukEditing(formName) { |
|
|
onSubmitBlukEditing(formName) { |
|
|
this.$refs[formName].validate((valid) => { |
|
|
this.$refs[formName].validate((valid) => { |
|
|
if (valid) { |
|
|
if (valid) { |
|
@ -234,6 +358,13 @@ export default { |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
handleCloseDialog(done) { |
|
|
|
|
|
// 重置表单数据 |
|
|
|
|
|
this.$refs.editForm.resetFields() |
|
|
|
|
|
this.bulkEditingVisible = false |
|
|
|
|
|
// 关闭弹框 |
|
|
|
|
|
// done() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|