update 国内标准-编辑完善,AddForm组件完善
This commit is contained in:
@@ -251,7 +251,8 @@ export default {
|
||||
yesValue: YesOrNoEnum.YES.value,
|
||||
noValue: YesOrNoEnum.NO.value,
|
||||
nowShareInfo: {}, // 当前正在分享的数据
|
||||
selectedTreeKeys: [], // 选中的树节点
|
||||
selectedTreeKeys: [], // 选中的树节点key
|
||||
selectedTreeNodeCodes: [], // 选中树节点的code
|
||||
tableSlotField: ['standard_name', 'standard_number'], // 表格中需要插槽的字段
|
||||
treeLoading: false
|
||||
}
|
||||
@@ -273,6 +274,7 @@ export default {
|
||||
getDomesticStandardTree({ nodeName: this.treeInput }).then(res => {
|
||||
this.treeData = []
|
||||
this.selectedTreeKeys = []
|
||||
this.selectedTreeNodeCodes = []
|
||||
this.filters.nodeCode = null
|
||||
if (res.success) {
|
||||
const treeData = res.result || []
|
||||
@@ -440,6 +442,7 @@ export default {
|
||||
*/
|
||||
handleSelectTreeNode ({ dataRef }) {
|
||||
this.selectedTreeKeys = [dataRef.key]
|
||||
this.selectedTreeNodeCodes = [dataRef.nodeCode]
|
||||
this.filters.nodeCode = dataRef.nodeCode
|
||||
this.loadData(1)
|
||||
},
|
||||
@@ -448,7 +451,7 @@ export default {
|
||||
*/
|
||||
handleConfigStandard () {
|
||||
// 没选择左侧树节点,需要提示“请先选择二级及以下体系”
|
||||
if (!this.selectedTreeKeys || this.selectedTreeKeys.length === 0) {
|
||||
if (!this.selectedTreeNodeCodes || this.selectedTreeNodeCodes.length === 0) {
|
||||
this.$message.warn(this.$t('standardRegulationLibrary.configStandardNoTreeNode'))
|
||||
return
|
||||
}
|
||||
@@ -462,7 +465,7 @@ export default {
|
||||
continueConfigStandard (dbFieldName, standardIds) {
|
||||
this.loading = true
|
||||
const params = {
|
||||
nodeId: this.selectedTreeKeys[0],
|
||||
nodeCode: this.selectedTreeNodeCodes[0],
|
||||
standardIds
|
||||
}
|
||||
configDomesticStandard(params).then(res => {
|
||||
@@ -481,7 +484,7 @@ export default {
|
||||
*/
|
||||
handleRemoveStandard () {
|
||||
// 没选择左侧树节点,需要提示“请先选择二级及以下体系”
|
||||
if (!this.selectedTreeKeys || this.selectedTreeKeys.length === 0) {
|
||||
if (!this.selectedTreeNodeCodes || this.selectedTreeNodeCodes.length === 0) {
|
||||
this.$message.warn(this.$t('standardRegulationLibrary.configStandardNoTreeNode'))
|
||||
return
|
||||
}
|
||||
@@ -492,7 +495,7 @@ export default {
|
||||
}
|
||||
this.loading = true
|
||||
const params = {
|
||||
nodeId: this.selectedTreeKeys[0],
|
||||
nodeCode: this.selectedTreeNodeCodes[0],
|
||||
ids: this.selectedRowKeys.join(',')
|
||||
}
|
||||
removeDomesticStandard(params).then(res => {
|
||||
|
||||
+25
-4
@@ -14,9 +14,9 @@
|
||||
<add-form ref="addForm"
|
||||
:get-form-func="getFormFunc"
|
||||
:get-document-info-func="getDocumentInfoFunc"
|
||||
:special-placeholder="{
|
||||
standard_number: `${$t('standardRegulationLibrary.inputExample')}7258`
|
||||
}"
|
||||
:special-placeholder="specialPlaceholder"
|
||||
:default-value="defaultValue"
|
||||
:disabled-field-list="disabledField"
|
||||
@submitFormData="submitFormData" />
|
||||
</a-spin>
|
||||
</div>
|
||||
@@ -50,18 +50,39 @@ export default {
|
||||
form: {},
|
||||
confirmLoading: false,
|
||||
getFormFunc: getDomesticStandardFormModal,
|
||||
getDocumentInfoFunc: getDomesticStandardDocumentInfo
|
||||
getDocumentInfoFunc: getDomesticStandardDocumentInfo,
|
||||
// 特殊的placeholder
|
||||
specialPlaceholder: {
|
||||
standard_number: `${this.$t('standardRegulationLibrary.inputExample')}7258`
|
||||
},
|
||||
defaultValue: {
|
||||
year_number: new Date().getFullYear()
|
||||
},
|
||||
isEdit: null // 是否编辑
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 不可编辑的字段
|
||||
disabledField () {
|
||||
console.log(this.isEdit)
|
||||
if (this.isEdit) {
|
||||
// 标准编号,被代替标准号,被引用标准号
|
||||
return ['standard_number', 'replaced_by_standard_number', 'referenced_standard']
|
||||
}
|
||||
return ['replaced_by_standard_number', 'referenced_standard']
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible = true
|
||||
this.isEdit = false
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addForm.add()
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.visible = true
|
||||
this.isEdit = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addForm.edit(record)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user