布局项目库变更

This commit is contained in:
sunFlower
2022-10-17 14:51:17 +08:00
parent 2cbfb02ea6
commit e9554cfbe2
2 changed files with 27 additions and 15 deletions
@@ -70,13 +70,13 @@
trigger: 'blur'
}
],
projectVersion:[
projectVersion: [
{
required: true,
message: this.$t('projectVersion') + this.$t('cannotEmpty'),
trigger: 'blur'
}
],
]
},
disabled: false,
projectNameList: [],
@@ -98,7 +98,28 @@
},
editModel(value) {
this.visible = true
this.formInline = value
this.formInline.id = value.id
if (!value.children) {
this.formInline.projectVersion = '01'
} else if (value.children && value.children.length > 0) {
let projectVersion = value.children[value.children.length - 1].projectVersion
if (projectVersion.slice(0, 1) == '0') {
let num = projectVersion.slice(1, 2)
let numIndex = parseInt(num) + 1
if (numIndex.length == 1) {
this.formInline.projectVersion = '0' + numIndex
} else {
this.formInline.projectVersion = numIndex
}
} else {
let index = parseInt(projectVersion) + 1
if (index.length == 1) {
this.formInline.projectVersion = '0' + index
} else {
this.formInline.projectVersion = index
}
}
}
this.formInline = { ...this.formInline }
this.$nextTick(() => {
this.$refs.ruleForm.clearValidate()
@@ -110,15 +131,6 @@
handleSubmit() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
let url = ''
let Action
if (this.formInline.id) {
url = this.url.edit
Action = putAction
} else {
url = this.url.add
Action = postAction
}
let query = JSON.parse(JSON.stringify(this.formInline))
Object.keys(query).forEach(res => {
if (query[res] && query[res] instanceof Array) {
@@ -126,12 +138,12 @@
}
})
this.confirmLoading = true
Action(url, query).then((res) => {
postAction('/project/projectLibraryBase/addChild', query).then((res) => {
if (res.success) {
this.confirmLoading = false
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.$emit('addModelList')
this.$emit('changeExtensionForm')
} else {
this.$message.warning(res.message)
this.confirmLoading = false
@@ -272,7 +272,7 @@
this.toggleSearchStatus = !this.toggleSearchStatus
},
changeExtensionClick(val) {
this.$refs.changeExtensionModelRef.addModel(JSON.parse(JSON.stringify(val)))
this.$refs.changeExtensionModelRef.editModel(JSON.parse(JSON.stringify(val)))
},
changeExtensionForm() {