mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2026-02-05 15:45:36 +00:00
优化
This commit is contained in:
parent
9919390e32
commit
e3cd18d991
@ -60,23 +60,25 @@ export default defineComponent({
|
|||||||
function onChange(val: boolean | string | number) {
|
function onChange(val: boolean | string | number) {
|
||||||
if (props.column && props.scope) {
|
if (props.column && props.scope) {
|
||||||
if (val !== undefined) {
|
if (val !== undefined) {
|
||||||
const params = {
|
if (val === activeValue.value || val === inactiveValue.value) {
|
||||||
id: props.scope.id,
|
const params = {
|
||||||
[props.column.property]: val
|
id: props.scope.id,
|
||||||
};
|
[props.column.property]: val
|
||||||
|
};
|
||||||
|
|
||||||
const req: Promise<any> = isFunction(props.api)
|
const req: Promise<any> = isFunction(props.api)
|
||||||
? props.api(params)
|
? props.api(params)
|
||||||
: Crud.value?.service.update(params);
|
: Crud.value?.service.update(params);
|
||||||
|
|
||||||
if (req) {
|
if (req) {
|
||||||
req.then(() => {
|
req.then(() => {
|
||||||
emit("update:modelValue", val);
|
emit("update:modelValue", val);
|
||||||
emit("change", val);
|
emit("change", val);
|
||||||
ElMessage.success("更新成功");
|
ElMessage.success("更新成功");
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
ElMessage.error(err.message);
|
ElMessage.error(err.message);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user