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