|
@ -79,6 +79,7 @@ import Treeselect from '@riophae/vue-treeselect' |
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
|
|
import { FetchFindAllSubsetById } from '@/api/archivesConfig/dictDetail' |
|
|
import { FetchFindAllSubsetById } from '@/api/archivesConfig/dictDetail' |
|
|
import { parseTime } from '@/utils/index.js' |
|
|
import { parseTime } from '@/utils/index.js' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: 'PreviewForm', |
|
|
name: 'PreviewForm', |
|
|
components: { draggable, Treeselect }, |
|
|
components: { draggable, Treeselect }, |
|
@ -129,8 +130,8 @@ export default { |
|
|
setParentsId: null, |
|
|
setParentsId: null, |
|
|
result: null, |
|
|
result: null, |
|
|
autoMatic: null, |
|
|
autoMatic: null, |
|
|
|
|
|
isType: 'category', |
|
|
autoEditString: [], |
|
|
autoEditString: [], |
|
|
isAutoLastString: null, |
|
|
|
|
|
normalizer(node) { |
|
|
normalizer(node) { |
|
|
if (node.childMenus == null || node.childMenus === 'null') { |
|
|
if (node.childMenus == null || node.childMenus === 'null') { |
|
|
delete node.childMenus |
|
|
delete node.childMenus |
|
@ -152,14 +153,18 @@ export default { |
|
|
}, |
|
|
}, |
|
|
formPreviewData: function() { |
|
|
formPreviewData: function() { |
|
|
this.editFormRow() |
|
|
this.editFormRow() |
|
|
this.FetchNoFormatField() |
|
|
|
|
|
|
|
|
if (this.isType !== 'arcives') { |
|
|
|
|
|
this.FetchNoFormatField(this.selectedCategory.id) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
created() { |
|
|
created() { |
|
|
this.editFormRow() |
|
|
this.editFormRow() |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
|
this.FetchNoFormatField() |
|
|
|
|
|
|
|
|
if (this.isType !== 'arcives') { |
|
|
|
|
|
this.FetchNoFormatField(this.selectedCategory.id) |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
// 递归查询字典名称对应的字典代码 |
|
|
// 递归查询字典名称对应的字典代码 |
|
@ -200,6 +205,7 @@ export default { |
|
|
// 自动生成 |
|
|
// 自动生成 |
|
|
handleAuto() { |
|
|
handleAuto() { |
|
|
let string = '' |
|
|
let string = '' |
|
|
|
|
|
const getAutoFiledVal = [] |
|
|
this.autoMatic.forEach(async val => { |
|
|
this.autoMatic.forEach(async val => { |
|
|
if (!this.addOrUpdateForm[val.fieldName]) { |
|
|
if (!this.addOrUpdateForm[val.fieldName]) { |
|
|
string += '' |
|
|
string += '' |
|
@ -209,36 +215,45 @@ export default { |
|
|
await FetchFindAllSubsetById({ id: fieldInfo.dictionaryConfigId.id }).then(res => { |
|
|
await FetchFindAllSubsetById({ id: fieldInfo.dictionaryConfigId.id }).then(res => { |
|
|
const option = this.getNode(res, this.addOrUpdateForm[val.fieldName]) |
|
|
const option = this.getNode(res, this.addOrUpdateForm[val.fieldName]) |
|
|
if (option) { |
|
|
if (option) { |
|
|
string += '' + option[0].dicCode + val.connector |
|
|
|
|
|
|
|
|
const obj = {} |
|
|
|
|
|
obj.name = val.fieldName |
|
|
|
|
|
obj.val = option[0].dicCode + val.connector |
|
|
|
|
|
obj.sequence = val.sequence |
|
|
|
|
|
// string += '' + option[0].dicCode + val.connector |
|
|
|
|
|
getAutoFiledVal.push(obj) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
string += '' + this.addOrUpdateForm[val.fieldName] + val.connector |
|
|
|
|
|
|
|
|
const obj = {} |
|
|
|
|
|
obj.name = val.fieldName |
|
|
|
|
|
obj.val = this.addOrUpdateForm[val.fieldName] + val.connector |
|
|
|
|
|
obj.sequence = val.sequence |
|
|
|
|
|
// string += '' + this.addOrUpdateForm[val.fieldName] + val.connector |
|
|
|
|
|
getAutoFiledVal.push(obj) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// 按照指定顺序排再拼接 |
|
|
|
|
|
getAutoFiledVal.sort(this.compare('sequence')) |
|
|
|
|
|
string = getAutoFiledVal.map((item) => item.val).join('') |
|
|
|
|
|
|
|
|
this.formPreviewData.map(item => { |
|
|
this.formPreviewData.map(item => { |
|
|
if (item.isAutomatic) { |
|
|
if (item.isAutomatic) { |
|
|
this.autoEditString = [] |
|
|
|
|
|
this.autoEditString.push(this.addOrUpdateForm[item.fieldName]) |
|
|
|
|
|
console.log('autoEditString', this.autoEditString) |
|
|
|
|
|
console.log(this.autoEditString[0].lastIndexOf('-')) |
|
|
|
|
|
this.isAutoLastString = this.autoEditString[0].substring(this.autoEditString[0].lastIndexOf('-') + 1) |
|
|
|
|
|
console.log('autoEditString', this.isAutoLastString) |
|
|
|
|
|
let lastString |
|
|
|
|
|
if (this.isAutoLastString) { |
|
|
|
|
|
lastString = string + this.isAutoLastString |
|
|
|
|
|
} else { |
|
|
|
|
|
lastString = string |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.$set(this.addOrUpdateForm, item.fieldName, lastString) |
|
|
|
|
|
|
|
|
this.$set(this.addOrUpdateForm, item.fieldName, string) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 排序 |
|
|
|
|
|
compare(property) { |
|
|
|
|
|
return function(a, b) { |
|
|
|
|
|
var value1 = a[property] |
|
|
|
|
|
var value2 = b[property] |
|
|
|
|
|
return value1 - value2 |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
// 获取档号组成项 |
|
|
// 获取档号组成项 |
|
|
FetchNoFormatField() { |
|
|
|
|
|
getNoFormatField({ categoryId: this.selectedCategory.id }).then(res => { |
|
|
|
|
|
|
|
|
FetchNoFormatField(categoryId) { |
|
|
|
|
|
getNoFormatField({ categoryId: categoryId }).then(res => { |
|
|
this.autoMatic = res |
|
|
this.autoMatic = res |
|
|
// this.handleAuto() |
|
|
// this.handleAuto() |
|
|
}) |
|
|
}) |
|
|