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