Browse Source

fix: 修改删除指令

pull/58/head
zhengkunwang223 2 years ago committed by zhengkunwang223
parent
commit
f3c23d8b06
  1. 2
      backend/i18n/lang/zh.yaml
  2. 29
      frontend/src/hooks/use-delete-data.ts
  3. 1
      frontend/src/views/app-store/installed/index.vue

2
backend/i18n/lang/zh.yaml

@ -18,6 +18,6 @@ ErrNotSupportType: "系统暂不支持当前类型: {{ .detail }}"
ErrNameIsExist: "名称已存在"
#app
ErrPortInUsed: "{{ .detail }} 已被占用!"
ErrPortInUsed: "{{ .detail }} 端口已被占用!"
ErrAppLimit: "应用超出安装数量限制"
ErrAppRequired: "请先安装 {{ .detail }} 应用"

29
frontend/src/hooks/use-delete-data.ts

@ -20,18 +20,29 @@ export const useDeleteData = <P = any, R = any>(
ElMessageBox.confirm(i18n.global.t(`${message}`) + '?', i18n.global.t('commons.msg.deleteTitle'), {
confirmButtonText: i18n.global.t('commons.button.confirm'),
cancelButtonText: i18n.global.t('commons.button.cancel'),
closeOnClickModal: false,
closeOnPressEscape: false,
showClose: false,
type: confirmType,
draggable: true,
beforeClose: async (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
instance.cancelButtonLoading = true;
const res = await api(params);
done();
if (!res) return reject(false);
resolve(true);
ElMessage({
type: 'success',
message: i18n.global.t('commons.msg.operationSuccess'),
});
} else {
done();
}
},
})
.then(async () => {
const res = await api(params);
if (!res) return reject(false);
ElMessage({
type: 'success',
message: i18n.global.t('commons.msg.operationSuccess'),
});
resolve(true);
})
.then(() => {})
.catch(() => {});
});
};

1
frontend/src/views/app-store/installed/index.vue

@ -195,6 +195,7 @@ const openOperate = (row: any, op: string) => {
checkRef.value.acceptParams({ items: items });
} else {
await useDeleteData(InstalledOp, operateReq, 'app.deleteWarn');
search();
}
});
} else {

Loading…
Cancel
Save