feat: 树状结构编辑-按钮添加loading
This commit is contained in:
@@ -58,10 +58,12 @@
|
|||||||
class="common-button-primary"
|
class="common-button-primary"
|
||||||
icon="el-icon-check"
|
icon="el-icon-check"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
:loading="btnLoading"
|
||||||
@click="handleSubmit">提交</el-button>
|
@click="handleSubmit">提交</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
class="common-button-default"
|
class="common-button-default"
|
||||||
icon="el-icon-close"
|
icon="el-icon-close"
|
||||||
|
:loading="btnLoading"
|
||||||
@click="handleClose">取消</el-button>
|
@click="handleClose">取消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
@@ -102,6 +104,7 @@ export default {
|
|||||||
drawerVisible: false,
|
drawerVisible: false,
|
||||||
addModel: {},
|
addModel: {},
|
||||||
loading: false,
|
loading: false,
|
||||||
|
btnLoading: false,
|
||||||
rules
|
rules
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -228,13 +231,17 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (!flag) return;
|
if (!flag) return;
|
||||||
|
const config = {
|
||||||
|
_this: this,
|
||||||
|
loading: 'loading'
|
||||||
|
}
|
||||||
let res = {}
|
let res = {}
|
||||||
switch (this.drawerTitle) {
|
switch (this.drawerTitle) {
|
||||||
case '新增体系':
|
case '新增体系':
|
||||||
res = await this.$http._postData(this.api.addMenuStandard,this.addModel)
|
res = await this.$http._postData(this.api.addMenuStandard,this.addModel, config)
|
||||||
break
|
break
|
||||||
case '编辑体系':
|
case '编辑体系':
|
||||||
res = await this.$http._putData(this.api.updateMenuStandard, this.addModel)
|
res = await this.$http._putData(this.api.updateMenuStandard, this.addModel, config)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if(res.ok){
|
if(res.ok){
|
||||||
|
|||||||
@@ -50,10 +50,12 @@
|
|||||||
class="common-button-primary"
|
class="common-button-primary"
|
||||||
icon="el-icon-check"
|
icon="el-icon-check"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
:loading="loading"
|
||||||
@click="saveProduct('productModelAdd')">提交</el-button>
|
@click="saveProduct('productModelAdd')">提交</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
class="common-button-default"
|
class="common-button-default"
|
||||||
icon="el-icon-close"
|
icon="el-icon-close"
|
||||||
|
:loading="loading"
|
||||||
@click="closeDrawer">取消</el-button>
|
@click="closeDrawer">取消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
@@ -93,6 +95,7 @@ export default {
|
|||||||
{type: 'string', max: 500, message: '最多输入500位', trigger: 'blur'}
|
{type: 'string', max: 500, message: '最多输入500位', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
loading: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -150,7 +153,8 @@ export default {
|
|||||||
this.productModelAdd.validFlag = '0'
|
this.productModelAdd.validFlag = '0'
|
||||||
if (this.modalType === 1) {
|
if (this.modalType === 1) {
|
||||||
this.$http.postData('sarResource/ts-resource/add', this.productModelAdd, {
|
this.$http.postData('sarResource/ts-resource/add', this.productModelAdd, {
|
||||||
_this: this
|
_this: this,
|
||||||
|
loading: 'loading'
|
||||||
}, res => {
|
}, res => {
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
this.$emit('selectMenuList')
|
this.$emit('selectMenuList')
|
||||||
@@ -161,7 +165,8 @@ export default {
|
|||||||
}, e => {})
|
}, e => {})
|
||||||
} else if (this.modalType === 2) {
|
} else if (this.modalType === 2) {
|
||||||
this.$http.putData('sarResource/ts-resource', this.productModelAdd, {
|
this.$http.putData('sarResource/ts-resource', this.productModelAdd, {
|
||||||
_this: this
|
_this: this,
|
||||||
|
loading: 'loading'
|
||||||
}, res => {
|
}, res => {
|
||||||
this.$emit('selectMenuList')
|
this.$emit('selectMenuList')
|
||||||
this.closeDrawer()
|
this.closeDrawer()
|
||||||
|
|||||||
+13
-4
@@ -89,11 +89,13 @@
|
|||||||
class="common-button-primary"
|
class="common-button-primary"
|
||||||
icon="el-icon-check"
|
icon="el-icon-check"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
:loading="loading"
|
||||||
@click="handleSubmit">提交
|
@click="handleSubmit">提交
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
class="common-button-default"
|
class="common-button-default"
|
||||||
icon="el-icon-close"
|
icon="el-icon-close"
|
||||||
|
:loading="loading"
|
||||||
@click="handleCancel">取消
|
@click="handleCancel">取消
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -123,10 +125,12 @@ export default {
|
|||||||
},
|
},
|
||||||
DrawerRules: {
|
DrawerRules: {
|
||||||
name: [
|
name: [
|
||||||
{required: true, message: '目录名称不能为空', trigger: 'change'}
|
{required: true, message: '目录名称不能为空', trigger: 'change'},
|
||||||
|
{type: 'string', max: 100, message: '最多输入100位'}
|
||||||
],
|
],
|
||||||
sort: [
|
sort: [
|
||||||
{required: true, message: '目录顺序不能为空', trigger: 'change'}
|
{required: true, message: '目录顺序不能为空且为正整数', trigger: 'change'},
|
||||||
|
{type: 'string', validator: this.verify.validStandNumInCompile2, trigger: 'blur'}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -135,7 +139,8 @@ export default {
|
|||||||
addTreeNode: 'lawss/sarLawsInformation/tree/addTreeNode',
|
addTreeNode: 'lawss/sarLawsInformation/tree/addTreeNode',
|
||||||
updateTreeNode: 'lawss/sarLawsInformation/tree/updateTreeNode',
|
updateTreeNode: 'lawss/sarLawsInformation/tree/updateTreeNode',
|
||||||
deleteTreeNode: 'lawss/sarLawsInformation/tree/deleteTreeNode',
|
deleteTreeNode: 'lawss/sarLawsInformation/tree/deleteTreeNode',
|
||||||
}
|
},
|
||||||
|
loading: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -219,7 +224,11 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
let method = this.DrawerTitle === '新增目录' ? '_postData' : '_putData'
|
let method = this.DrawerTitle === '新增目录' ? '_postData' : '_putData'
|
||||||
let url = this.DrawerTitle === '新增目录' ? this.url.addTreeNode : this.url.updateTreeNode
|
let url = this.DrawerTitle === '新增目录' ? this.url.addTreeNode : this.url.updateTreeNode
|
||||||
this.$http[method](url, this.DrawerModel).then(res => {
|
const config = {
|
||||||
|
_this: this,
|
||||||
|
loading: 'loading',
|
||||||
|
}
|
||||||
|
this.$http[method](url, this.DrawerModel, config).then(res => {
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
this.$message.success('操作成功')
|
this.$message.success('操作成功')
|
||||||
this.getMenuList()
|
this.getMenuList()
|
||||||
|
|||||||
Reference in New Issue
Block a user