refactor: 统一确认弹窗调用并优化开发代理配置
parent
59cc3bbd61
commit
e9cb162aea
|
|
@ -38,24 +38,21 @@ async function handleUpdatePublicStatusChange(
|
|||
row: AiImageApi.Image,
|
||||
): Promise<boolean | undefined> {
|
||||
const text = newStatus ? '公开' : '私有';
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要将该图片切换为【${text}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新图片状态
|
||||
await updateImage({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新图片状态
|
||||
await updateImage({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -76,24 +76,21 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: AiKnowledgeDocumentApi.KnowledgeDocument,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${row.name}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新文档状态
|
||||
await updateKnowledgeDocumentStatus({
|
||||
id: row.id,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新文档状态
|
||||
await updateKnowledgeDocumentStatus({
|
||||
id: row.id,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -64,21 +64,18 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: AiKnowledgeSegmentApi.KnowledgeSegment,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将片段 ${row.id} 的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新片段状态
|
||||
await updateKnowledgeSegmentStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新片段状态
|
||||
await updateKnowledgeSegmentStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -38,24 +38,21 @@ async function handleUpdatePublicStatusChange(
|
|||
row: AiMusicApi.Music,
|
||||
): Promise<boolean | undefined> {
|
||||
const text = newStatus ? '公开' : '私有';
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要将该音乐切换为【${text}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新音乐状态
|
||||
await updateMusic({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新音乐状态
|
||||
await updateMusic({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -74,28 +74,24 @@ async function handleDeleteContactBusinessList() {
|
|||
message.error('请先选择商机后操作!');
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteContactBusinessList({
|
||||
contactId: props.bizId,
|
||||
businessIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error($t('ui.actionMessage.operationFailed')));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const res = await deleteContactBusinessList({
|
||||
contactId: props.bizId,
|
||||
businessIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (!res) {
|
||||
throw new Error($t('ui.actionMessage.operationFailed'));
|
||||
}
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 查看商机详情 */
|
||||
|
|
|
|||
|
|
@ -83,21 +83,18 @@ function handleTransfer() {
|
|||
|
||||
/** 转化为客户 */
|
||||
async function handleTransform(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: '确定将该线索转化为客户吗?',
|
||||
})
|
||||
.then(async () => {
|
||||
// 转化为客户
|
||||
await transformClue(clueId.value);
|
||||
// 提示并返回成功
|
||||
message.success('转化客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 转化为客户
|
||||
await transformClue(clueId.value);
|
||||
// 提示并返回成功
|
||||
message.success('转化客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 加载数据 */
|
||||
|
|
|
|||
|
|
@ -71,28 +71,24 @@ async function handleDeleteContactBusinessList() {
|
|||
message.error('请先选择联系人后操作!');
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteBusinessContactList({
|
||||
businessId: props.bizId,
|
||||
contactIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error($t('ui.actionMessage.operationFailed')));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const res = await deleteBusinessContactList({
|
||||
businessId: props.bizId,
|
||||
contactIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (!res) {
|
||||
throw new Error($t('ui.actionMessage.operationFailed'));
|
||||
}
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 创建商机联系人关联 */
|
||||
|
|
|
|||
|
|
@ -100,41 +100,35 @@ function handleTransfer() {
|
|||
}
|
||||
|
||||
/** 锁定客户 */
|
||||
function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定锁定客户【${customer.value.name}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 锁定客户
|
||||
await lockCustomer(customerId.value, lockStatus);
|
||||
// 提示并返回成功
|
||||
message.success(lockStatus ? '锁定客户成功' : '解锁客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 锁定客户
|
||||
await lockCustomer(customerId.value, lockStatus);
|
||||
// 提示并返回成功
|
||||
message.success(lockStatus ? '锁定客户成功' : '解锁客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 领取客户 */
|
||||
function handleReceive(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handleReceive(): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定领取客户【${customer.value.name}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 领取客户
|
||||
await receiveCustomer([customerId.value]);
|
||||
// 提示并返回成功
|
||||
message.success('领取客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 领取客户
|
||||
await receiveCustomer([customerId.value]);
|
||||
// 提示并返回成功
|
||||
message.success('领取客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 分配客户 */
|
||||
|
|
@ -143,42 +137,36 @@ function handleDistributeForm() {
|
|||
}
|
||||
|
||||
/** 客户放入公海 */
|
||||
function handlePutPool(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handlePutPool(): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定将客户【${customer.value.name}】放入公海吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 放入公海
|
||||
await putCustomerPool(customerId.value);
|
||||
// 提示并返回成功
|
||||
message.success('放入公海成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 放入公海
|
||||
await putCustomerPool(customerId.value);
|
||||
// 提示并返回成功
|
||||
message.success('放入公海成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 更新成交状态操作 */
|
||||
async function handleUpdateDealStatus(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const dealStatus = !customer.value.dealStatus;
|
||||
confirm({
|
||||
const dealStatus = !customer.value.dealStatus;
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定更新成交状态为【${dealStatus ? '已成交' : '未成交'}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新成交状态
|
||||
await updateCustomerDealStatus(customerId.value, dealStatus);
|
||||
// 提示并返回成功
|
||||
message.success('更新成交状态成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新成交状态
|
||||
await updateCustomerDealStatus(customerId.value, dealStatus);
|
||||
// 提示并返回成功
|
||||
message.success('更新成交状态成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 加载数据 */
|
||||
|
|
|
|||
|
|
@ -94,32 +94,28 @@ function handleEdit() {
|
|||
}
|
||||
|
||||
/** 删除团队成员 */
|
||||
function handleDelete() {
|
||||
async function handleDelete() {
|
||||
if (checkedRows.value.length === 0) {
|
||||
message.error('请先选择团队成员后操作!');
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${checkedRows.value.map((item) => item.nickname).join(',')}移出团队吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deletePermissionBatch(
|
||||
checkedRows.value.map((item) => item.id!),
|
||||
);
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error('移出失败'));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const res = await deletePermissionBatch(
|
||||
checkedRows.value.map((item) => item.id!),
|
||||
);
|
||||
if (!res) {
|
||||
throw new Error('移出失败');
|
||||
}
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 退出团队 */
|
||||
|
|
|
|||
|
|
@ -65,23 +65,20 @@ async function handleDefaultStatusChange(
|
|||
newStatus: boolean,
|
||||
row: ErpAccountApi.Account,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
confirm({
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text}"${row.name}"默认吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新默认状态
|
||||
await updateAccountDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新默认状态
|
||||
await updateAccountDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -63,23 +63,20 @@ async function handleDefaultStatusChange(
|
|||
newStatus: boolean,
|
||||
row: ErpWarehouseApi.Warehouse,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
confirm({
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text}"${row.name}"默认吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新默认状态
|
||||
await updateWarehouseDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新默认状态
|
||||
await updateWarehouseDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
|
|
|
|||
|
|
@ -63,25 +63,22 @@ async function handleStatusChange(
|
|||
newStatus: boolean,
|
||||
row: MallCommentApi.Comment,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newStatus ? '展示' : '隐藏';
|
||||
confirm({
|
||||
const text = newStatus ? '展示' : '隐藏';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text}该评论吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateCommentVisible({
|
||||
id: row.id!,
|
||||
visible: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateCommentVisible({
|
||||
id: row.id!,
|
||||
visible: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -107,26 +107,23 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MallSpuApi.Spu,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 二次确认
|
||||
const text = newStatus ? '上架' : '下架';
|
||||
confirm({
|
||||
// 二次确认
|
||||
const text = newStatus ? '上架' : '下架';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text + row.name}吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 添加到仓库 / 回收站的状态 */
|
||||
|
|
|
|||
|
|
@ -60,21 +60,18 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MallCouponTemplateApi.CouponTemplate,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${row.name}的状态切换为【${newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用'}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新优惠券模板状态
|
||||
await updateCouponTemplateStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新优惠券模板状态
|
||||
await updateCouponTemplateStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -59,23 +59,20 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MallSeckillConfigApi.SeckillConfig,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 二次确认
|
||||
const text = row.status === 0 ? '启用' : '停用';
|
||||
confirm({
|
||||
// 二次确认
|
||||
const text = row.status === 0 ? '启用' : '停用';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text + row.name}吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateSeckillConfigStatus(row.id, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateSeckillConfigStatus(row.id, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -87,26 +87,23 @@ async function handleBrokerageEnabledChange(
|
|||
newEnabled: boolean,
|
||||
row: MallBrokerageUserApi.BrokerageUser,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newEnabled ? '开通' : '关闭';
|
||||
confirm({
|
||||
const text = newEnabled ? '开通' : '关闭';
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${row.nickname}的推广资格切换为【${text}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新推广资格
|
||||
await updateBrokerageEnabled({
|
||||
id: row.id!,
|
||||
enabled: newEnabled,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新推广资格
|
||||
await updateBrokerageEnabled({
|
||||
id: row.id!,
|
||||
enabled: newEnabled,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -113,13 +113,19 @@ function getTableActions(row: MesDvCheckPlanApi.CheckPlan): ActionItem[] {
|
|||
label: '启用',
|
||||
type: 'link',
|
||||
auth: ['mes:dv-check-plan:update'],
|
||||
onClick: handleEnable.bind(null, row),
|
||||
popConfirm: {
|
||||
title: `确认启用"${row.name}"点检保养方案?启用后将不可修改或删除。`,
|
||||
confirm: handleEnable.bind(null, row),
|
||||
},
|
||||
}
|
||||
: {
|
||||
label: '停用',
|
||||
type: 'link',
|
||||
auth: ['mes:dv-check-plan:update'],
|
||||
onClick: handleDisable.bind(null, row),
|
||||
popConfirm: {
|
||||
title: `确认停用"${row.name}"点检保养方案?`,
|
||||
confirm: handleDisable.bind(null, row),
|
||||
},
|
||||
},
|
||||
);
|
||||
return actions;
|
||||
|
|
|
|||
|
|
@ -96,19 +96,16 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MesMdItemApi.Item,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
Modal.confirm({
|
||||
content: `确认要将“${row.name}”物料切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
async onOk() {
|
||||
await updateItemStatus(row.id!, newStatus);
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
},
|
||||
onCancel() {
|
||||
reject(new Error('取消操作'));
|
||||
},
|
||||
});
|
||||
});
|
||||
try {
|
||||
await confirm(
|
||||
`确认要将"${row.name}"物料切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
await updateItemStatus(row.id!, newStatus);
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -55,9 +55,13 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MesProRouteApi.Route,
|
||||
): Promise<boolean | undefined> {
|
||||
await confirm(
|
||||
`确认要将"${row.name}"工艺路线切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
);
|
||||
try {
|
||||
await confirm(
|
||||
`确认要将"${row.name}"工艺路线切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
await updateRouteStatus(row.id!, newStatus);
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,11 @@ async function handleClockIn() {
|
|||
|
||||
/** 下工 */
|
||||
async function handleClockOut() {
|
||||
await confirm('确认下工当前工作站?');
|
||||
try {
|
||||
await confirm('确认下工当前工作站?');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
await clockOutWorkRecord();
|
||||
message.success('下工成功');
|
||||
await loadMyWorkstation();
|
||||
|
|
|
|||
|
|
@ -65,25 +65,22 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: PayAppApi.App,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用';
|
||||
confirm({
|
||||
const text = newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text + row.name}应用吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateAppStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateAppStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 生成渠道配置按钮 */
|
||||
|
|
|
|||
|
|
@ -138,21 +138,18 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: SystemUserApi.User,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${row.username}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新用户状态
|
||||
await updateUserStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新用户状态
|
||||
await updateUserStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -83,21 +83,18 @@ function handleTransfer() {
|
|||
|
||||
/** 转化为客户 */
|
||||
async function handleTransform(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: '确定将该线索转化为客户吗?',
|
||||
})
|
||||
.then(async () => {
|
||||
// 转化为客户
|
||||
await transformClue(clueId.value);
|
||||
// 提示并返回成功
|
||||
message.success('转化客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 转化为客户
|
||||
await transformClue(clueId.value);
|
||||
// 提示并返回成功
|
||||
message.success('转化客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 加载数据 */
|
||||
|
|
|
|||
|
|
@ -100,41 +100,35 @@ function handleTransfer() {
|
|||
}
|
||||
|
||||
/** 锁定客户 */
|
||||
function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定锁定客户【${customer.value.name}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 锁定客户
|
||||
await lockCustomer(customerId.value, lockStatus);
|
||||
// 提示并返回成功
|
||||
message.success(lockStatus ? '锁定客户成功' : '解锁客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 锁定客户
|
||||
await lockCustomer(customerId.value, lockStatus);
|
||||
// 提示并返回成功
|
||||
message.success(lockStatus ? '锁定客户成功' : '解锁客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 领取客户 */
|
||||
function handleReceive(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handleReceive(): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定领取客户【${customer.value.name}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 领取客户
|
||||
await receiveCustomer([customerId.value]);
|
||||
// 提示并返回成功
|
||||
message.success('领取客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 领取客户
|
||||
await receiveCustomer([customerId.value]);
|
||||
// 提示并返回成功
|
||||
message.success('领取客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 分配客户 */
|
||||
|
|
@ -143,42 +137,36 @@ function handleDistributeForm() {
|
|||
}
|
||||
|
||||
/** 客户放入公海 */
|
||||
function handlePutPool(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handlePutPool(): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定将客户【${customer.value.name}】放入公海吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 放入公海
|
||||
await putCustomerPool(customerId.value);
|
||||
// 提示并返回成功
|
||||
message.success('放入公海成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 放入公海
|
||||
await putCustomerPool(customerId.value);
|
||||
// 提示并返回成功
|
||||
message.success('放入公海成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 更新成交状态操作 */
|
||||
async function handleUpdateDealStatus(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const dealStatus = !customer.value.dealStatus;
|
||||
confirm({
|
||||
const dealStatus = !customer.value.dealStatus;
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定更新成交状态为【${dealStatus ? '已成交' : '未成交'}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新成交状态
|
||||
await updateCustomerDealStatus(customerId.value, dealStatus);
|
||||
// 提示并返回成功
|
||||
message.success('更新成交状态成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新成交状态
|
||||
await updateCustomerDealStatus(customerId.value, dealStatus);
|
||||
// 提示并返回成功
|
||||
message.success('更新成交状态成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 加载数据 */
|
||||
|
|
|
|||
|
|
@ -107,26 +107,23 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MallSpuApi.Spu,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 二次确认
|
||||
const text = newStatus ? '上架' : '下架';
|
||||
confirm({
|
||||
// 二次确认
|
||||
const text = newStatus ? '上架' : '下架';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text + row.name}吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 添加到仓库 / 回收站的状态 */
|
||||
|
|
|
|||
|
|
@ -37,24 +37,21 @@ async function handleUpdatePublicStatusChange(
|
|||
row: AiImageApi.Image,
|
||||
): Promise<boolean | undefined> {
|
||||
const text = newStatus ? '公开' : '私有';
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要将该图片切换为【${text}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新图片状态
|
||||
await updateImage({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新图片状态
|
||||
await updateImage({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -75,24 +75,21 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: AiKnowledgeDocumentApi.KnowledgeDocument,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${row.name}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新文档状态
|
||||
await updateKnowledgeDocumentStatus({
|
||||
id: row.id,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新文档状态
|
||||
await updateKnowledgeDocumentStatus({
|
||||
id: row.id,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -63,21 +63,18 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: AiKnowledgeSegmentApi.KnowledgeSegment,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将片段 ${row.id} 的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新片段状态
|
||||
await updateKnowledgeSegmentStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新片段状态
|
||||
await updateKnowledgeSegmentStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -37,24 +37,21 @@ async function handleUpdatePublicStatusChange(
|
|||
row: AiMusicApi.Music,
|
||||
): Promise<boolean | undefined> {
|
||||
const text = newStatus ? '公开' : '私有';
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要将该音乐切换为【${text}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新音乐状态
|
||||
await updateMusic({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新音乐状态
|
||||
await updateMusic({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -74,28 +74,24 @@ async function handleDeleteContactBusinessList() {
|
|||
ElMessage.error('请先选择商机后操作!');
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteContactBusinessList({
|
||||
contactId: props.bizId,
|
||||
businessIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error($t('ui.actionMessage.operationFailed')));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const res = await deleteContactBusinessList({
|
||||
contactId: props.bizId,
|
||||
businessIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (!res) {
|
||||
throw new Error($t('ui.actionMessage.operationFailed'));
|
||||
}
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 查看商机详情 */
|
||||
|
|
|
|||
|
|
@ -84,21 +84,18 @@ function handleTransfer() {
|
|||
|
||||
/** 转化为客户 */
|
||||
async function handleTransform(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: '确定将该线索转化为客户吗?',
|
||||
})
|
||||
.then(async () => {
|
||||
// 转化为客户
|
||||
await transformClue(clueId.value);
|
||||
// 提示并返回成功
|
||||
ElMessage.success('转化客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 转化为客户
|
||||
await transformClue(clueId.value);
|
||||
// 提示并返回成功
|
||||
ElMessage.success('转化客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 加载数据 */
|
||||
|
|
|
|||
|
|
@ -71,28 +71,24 @@ async function handleDeleteContactBusinessList() {
|
|||
ElMessage.error('请先选择联系人后操作!');
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteBusinessContactList({
|
||||
businessId: props.bizId,
|
||||
contactIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error($t('ui.actionMessage.operationFailed')));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const res = await deleteBusinessContactList({
|
||||
businessId: props.bizId,
|
||||
contactIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (!res) {
|
||||
throw new Error($t('ui.actionMessage.operationFailed'));
|
||||
}
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 创建商机联系人关联 */
|
||||
|
|
|
|||
|
|
@ -101,41 +101,35 @@ function handleTransfer() {
|
|||
}
|
||||
|
||||
/** 锁定客户 */
|
||||
function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定锁定客户【${customer.value.name}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 锁定客户
|
||||
await lockCustomer(customerId.value, lockStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success(lockStatus ? '锁定客户成功' : '解锁客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 锁定客户
|
||||
await lockCustomer(customerId.value, lockStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success(lockStatus ? '锁定客户成功' : '解锁客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 领取客户 */
|
||||
function handleReceive(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handleReceive(): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定领取客户【${customer.value.name}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 领取客户
|
||||
await receiveCustomer([customerId.value]);
|
||||
// 提示并返回成功
|
||||
ElMessage.success('领取客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 领取客户
|
||||
await receiveCustomer([customerId.value]);
|
||||
// 提示并返回成功
|
||||
ElMessage.success('领取客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 分配客户 */
|
||||
|
|
@ -144,42 +138,36 @@ function handleDistributeForm() {
|
|||
}
|
||||
|
||||
/** 客户放入公海 */
|
||||
function handlePutPool(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handlePutPool(): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定将客户【${customer.value.name}】放入公海吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 放入公海
|
||||
await putCustomerPool(customerId.value);
|
||||
// 提示并返回成功
|
||||
ElMessage.success('放入公海成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 放入公海
|
||||
await putCustomerPool(customerId.value);
|
||||
// 提示并返回成功
|
||||
ElMessage.success('放入公海成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 更新成交状态操作 */
|
||||
async function handleUpdateDealStatus(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const dealStatus = !customer.value.dealStatus;
|
||||
confirm({
|
||||
const dealStatus = !customer.value.dealStatus;
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定更新成交状态为【${dealStatus ? '已成交' : '未成交'}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新成交状态
|
||||
await updateCustomerDealStatus(customerId.value, dealStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success('更新成交状态成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新成交状态
|
||||
await updateCustomerDealStatus(customerId.value, dealStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success('更新成交状态成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 加载数据 */
|
||||
|
|
|
|||
|
|
@ -94,32 +94,28 @@ function handleEdit() {
|
|||
}
|
||||
|
||||
/** 删除团队成员 */
|
||||
function handleDelete() {
|
||||
async function handleDelete() {
|
||||
if (checkedRows.value.length === 0) {
|
||||
ElMessage.error('请先选择团队成员后操作!');
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${checkedRows.value.map((item) => item.nickname).join(',')}移出团队吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deletePermissionBatch(
|
||||
checkedRows.value.map((item) => item.id!),
|
||||
);
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error('移出失败'));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const res = await deletePermissionBatch(
|
||||
checkedRows.value.map((item) => item.id!),
|
||||
);
|
||||
if (!res) {
|
||||
throw new Error('移出失败');
|
||||
}
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 退出团队 */
|
||||
|
|
|
|||
|
|
@ -64,23 +64,20 @@ async function handleDefaultStatusChange(
|
|||
newStatus: boolean,
|
||||
row: ErpAccountApi.Account,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
confirm({
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text}"${row.name}"默认吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新默认状态
|
||||
await updateAccountDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新默认状态
|
||||
await updateAccountDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -62,23 +62,20 @@ async function handleDefaultStatusChange(
|
|||
newStatus: boolean,
|
||||
row: ErpWarehouseApi.Warehouse,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
confirm({
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text}"${row.name}"默认吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新默认状态
|
||||
await updateWarehouseDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新默认状态
|
||||
await updateWarehouseDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
|
|
|
|||
|
|
@ -62,25 +62,22 @@ async function handleStatusChange(
|
|||
newStatus: boolean,
|
||||
row: MallCommentApi.Comment,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newStatus ? '展示' : '隐藏';
|
||||
confirm({
|
||||
const text = newStatus ? '展示' : '隐藏';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text}该评论吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateCommentVisible({
|
||||
id: row.id!,
|
||||
visible: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateCommentVisible({
|
||||
id: row.id!,
|
||||
visible: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -106,26 +106,23 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MallSpuApi.Spu,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 二次确认
|
||||
const text = newStatus ? '上架' : '下架';
|
||||
confirm({
|
||||
// 二次确认
|
||||
const text = newStatus ? '上架' : '下架';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text + row.name}吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 添加到仓库 / 回收站的状态 */
|
||||
|
|
|
|||
|
|
@ -59,21 +59,18 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MallCouponTemplateApi.CouponTemplate,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${row.name}的状态切换为【${newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用'}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新优惠券模板状态
|
||||
await updateCouponTemplateStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新优惠券模板状态
|
||||
await updateCouponTemplateStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -56,23 +56,20 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MallSeckillConfigApi.SeckillConfig,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 二次确认
|
||||
const text = row.status === 0 ? '启用' : '停用';
|
||||
confirm({
|
||||
// 二次确认
|
||||
const text = row.status === 0 ? '启用' : '停用';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text + row.name}吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateSeckillConfigStatus(row.id, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateSeckillConfigStatus(row.id, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -86,26 +86,23 @@ async function handleBrokerageEnabledChange(
|
|||
newEnabled: boolean,
|
||||
row: MallBrokerageUserApi.BrokerageUser,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newEnabled ? '开通' : '关闭';
|
||||
confirm({
|
||||
const text = newEnabled ? '开通' : '关闭';
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${row.nickname}的推广资格切换为【${text}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新推广资格
|
||||
await updateBrokerageEnabled({
|
||||
id: row.id!,
|
||||
enabled: newEnabled,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新推广资格
|
||||
await updateBrokerageEnabled({
|
||||
id: row.id!,
|
||||
enabled: newEnabled,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -112,14 +112,20 @@ function getTableActions(row: MesDvCheckPlanApi.CheckPlan): ActionItem[] {
|
|||
type: 'warning',
|
||||
link: true,
|
||||
auth: ['mes:dv-check-plan:update'],
|
||||
onClick: handleEnable.bind(null, row),
|
||||
popConfirm: {
|
||||
title: `确认启用"${row.name}"点检保养方案?启用后将不可修改或删除。`,
|
||||
confirm: handleEnable.bind(null, row),
|
||||
},
|
||||
}
|
||||
: {
|
||||
label: '停用',
|
||||
type: 'warning',
|
||||
link: true,
|
||||
auth: ['mes:dv-check-plan:update'],
|
||||
onClick: handleDisable.bind(null, row),
|
||||
popConfirm: {
|
||||
title: `确认停用"${row.name}"点检保养方案?`,
|
||||
confirm: handleDisable.bind(null, row),
|
||||
},
|
||||
},
|
||||
);
|
||||
return actions;
|
||||
|
|
|
|||
|
|
@ -5,18 +5,12 @@ import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
|
|||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictLabel } from '@vben/hooks';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import {
|
||||
ElButton,
|
||||
ElCard,
|
||||
ElLoading,
|
||||
ElMessage,
|
||||
ElMessageBox,
|
||||
} from 'element-plus';
|
||||
import { ElButton, ElCard, ElLoading, ElMessage } from 'element-plus';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
|
|
@ -101,21 +95,16 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MesMdItemApi.Item,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
ElMessageBox.confirm(
|
||||
`确认要将“${row.name}”物料切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
'提示',
|
||||
{ type: 'warning' },
|
||||
)
|
||||
.then(async () => {
|
||||
await updateItemStatus(row.id!, newStatus);
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
try {
|
||||
await confirm(
|
||||
`确认要将"${row.name}"物料切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
await updateItemStatus(row.id!, newStatus);
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -3,18 +3,12 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
|||
import type { MesProRouteApi } from '#/api/mes/pro/route';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { CommonStatusEnum, DICT_TYPE } from '@vben/constants';
|
||||
import { getDictLabel } from '@vben/hooks';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import {
|
||||
ElButton,
|
||||
ElLoading,
|
||||
ElMessage,
|
||||
ElMessageBox,
|
||||
ElTooltip,
|
||||
} from 'element-plus';
|
||||
import { ElButton, ElLoading, ElMessage, ElTooltip } from 'element-plus';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
|
|
@ -62,17 +56,15 @@ async function handleStatusChange(
|
|||
row: MesProRouteApi.Route,
|
||||
): Promise<boolean | undefined> {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
await confirm(
|
||||
`确认要将"${row.name}"工艺路线切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
'提示',
|
||||
{ type: 'warning' },
|
||||
);
|
||||
await updateRouteStatus(row.id!, newStatus);
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
await updateRouteStatus(row.id!, newStatus);
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 删除(仅停用状态可删除) */
|
||||
|
|
|
|||
|
|
@ -55,7 +55,11 @@ async function handleClockIn() {
|
|||
|
||||
/** 下工 */
|
||||
async function handleClockOut() {
|
||||
await confirm('确认下工当前工作站?');
|
||||
try {
|
||||
await confirm('确认下工当前工作站?');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
await clockOutWorkRecord();
|
||||
ElMessage.success('下工成功');
|
||||
await loadMyWorkstation();
|
||||
|
|
|
|||
|
|
@ -64,25 +64,22 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: PayAppApi.App,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用';
|
||||
confirm({
|
||||
const text = newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text + row.name}应用吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateAppStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateAppStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
ElMessage.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 生成渠道配置按钮 */
|
||||
|
|
|
|||
|
|
@ -136,21 +136,18 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: SystemUserApi.User,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${row.username}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新用户状态
|
||||
await updateUserStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新用户状态
|
||||
await updateUserStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
Loading…
Reference in New Issue