mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-23 05:40:20 +08:00
✨ Introducing new features. 标签的编辑和删除
This commit is contained in:
parent
392b44264b
commit
83730dec1c
@ -23,7 +23,7 @@
|
|||||||
// 定义子组件向父组件传值/事件
|
// 定义子组件向父组件传值/事件
|
||||||
const emit = defineEmits(['refresh']);
|
const emit = defineEmits(['refresh']);
|
||||||
import {useMessage} from "/@/hooks/message";
|
import {useMessage} from "/@/hooks/message";
|
||||||
import {addObj} from '/@/api/mp/wx-account-tag'
|
import {addObj,putObj} from '/@/api/mp/wx-account-tag'
|
||||||
import {useI18n} from "vue-i18n"
|
import {useI18n} from "vue-i18n"
|
||||||
|
|
||||||
const {t} = useI18n();
|
const {t} = useI18n();
|
||||||
@ -38,20 +38,25 @@ const loading = ref(false)
|
|||||||
const form = reactive({
|
const form = reactive({
|
||||||
wxAccountAppid: '',
|
wxAccountAppid: '',
|
||||||
tag: '',
|
tag: '',
|
||||||
|
id: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
// 定义校验规则
|
// 定义校验规则
|
||||||
const dataRules = ref({})
|
const dataRules = ref({})
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = (id: string) => {
|
const openDialog = (row: any,appid: string) => {
|
||||||
visible.value = true
|
visible.value = true
|
||||||
form.wxAccountAppid = id
|
|
||||||
|
|
||||||
// 重置表单数据
|
// 重置表单数据
|
||||||
if (dataFormRef.value) {
|
if (dataFormRef.value) {
|
||||||
dataFormRef.value.resetFields()
|
dataFormRef.value.resetFields()
|
||||||
}
|
}
|
||||||
|
if(row){
|
||||||
|
Object.assign(form,row)
|
||||||
|
}
|
||||||
|
form.wxAccountAppid = appid
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
@ -61,15 +66,27 @@ const onSubmit = () => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
loading.value = true
|
loading.value = true
|
||||||
addObj(form).then(() => {
|
if(form.id){
|
||||||
useMessage().success(t('common.addSuccessText'))
|
putObj(form).then(() => {
|
||||||
visible.value = false // 关闭弹窗
|
useMessage().success(t('common.editSuccessText'))
|
||||||
emit('refresh')
|
visible.value = false // 关闭弹窗
|
||||||
}).catch((err: any) => {
|
emit('refresh')
|
||||||
useMessage().error(err.msg)
|
}).catch((err: any) => {
|
||||||
}).finally(() => {
|
useMessage().error(err.msg)
|
||||||
loading.value = false
|
}).finally(() => {
|
||||||
})
|
loading.value = false
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
addObj(form).then(() => {
|
||||||
|
useMessage().success(t('common.addSuccessText'))
|
||||||
|
visible.value = false // 关闭弹窗
|
||||||
|
emit('refresh')
|
||||||
|
}).catch((err: any) => {
|
||||||
|
useMessage().error(err.msg)
|
||||||
|
}).finally(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<div class="mb8" style="width: 100%">
|
<div class="mb8" style="width: 100%">
|
||||||
<el-button v-auth="'mp_wx_account_tag_add'" class="ml10" formDialogRef icon="folder-add" type="primary"
|
<el-button v-auth="'mp_wx_account_tag_add'" class="ml10" formDialogRef icon="folder-add" type="primary"
|
||||||
@click="formDialogRef.openDialog(state.queryForm.wxAccountAppid)">
|
@click="formDialogRef.openDialog(null,state.queryForm.wxAccountAppid)">
|
||||||
{{ $t('common.addBtn') }}
|
{{ $t('common.addBtn') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-auth="'mp_wx_account_tag_export'" class="ml10" formDialogRef icon="Download" type="primary"
|
<el-button v-auth="'mp_wx_account_tag_export'" class="ml10" formDialogRef icon="Download" type="primary"
|
||||||
@ -49,8 +49,8 @@
|
|||||||
<el-table-column :label="t('wxAccountTag.tagId')" prop="tagId" show-overflow-tooltip/>
|
<el-table-column :label="t('wxAccountTag.tagId')" prop="tagId" show-overflow-tooltip/>
|
||||||
<el-table-column :label="$t('common.action')" width="150">
|
<el-table-column :label="$t('common.action')" width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button text type="primary" @click="formDialogRef.openDialog(scope.row.id)">{{ $t('common.editBtn') }}</el-button>
|
<el-button text type="primary" @click="formDialogRef.openDialog(scope.row,state.queryForm.wxAccountAppid)">{{ $t('common.editBtn') }}</el-button>
|
||||||
<el-button text type="primary" @click="handleDelete([scope.row.id])">{{$t('common.delBtn') }}</el-button>
|
<el-button text type="primary" @click="handleDelete(scope.row)">{{$t('common.delBtn') }}</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -141,10 +141,13 @@ const handleSelectionChange = (objs: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除操作
|
// 删除操作
|
||||||
const handleDelete = (ids: string[]) => {
|
const handleDelete = (row: any) => {
|
||||||
useMessageBox().confirm(t('common.delConfirmText'))
|
useMessageBox().confirm(t('common.delConfirmText'))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
delObjs(ids).then(() => {
|
delObjs({
|
||||||
|
id: row.id,
|
||||||
|
wxAccountAppid: row.wxAccountAppid
|
||||||
|
}).then(() => {
|
||||||
getDataList(false);
|
getDataList(false);
|
||||||
useMessage().success(t('common.delSuccessText'));
|
useMessage().success(t('common.delSuccessText'));
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user