Skip to content

Commit f299f9e

Browse files
fit2cloudwxxfit2-zhao
authored andcommitted
fix: update opportunity status for select reason
1 parent 948582d commit f299f9e

3 files changed

Lines changed: 28 additions & 25 deletions

File tree

frontend/packages/mobile/src/components/business/crm-workflow-card/index.vue

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@
8181
8282
import CrmIcon from '@/components/pure/crm-icon-font/index.vue';
8383
84-
import { updateClueStatus, updateOptStage } from '@/api/modules';
84+
import { getReasonConfig, updateClueStatus, updateOptStage } from '@/api/modules';
8585
import { hasAllPermission, hasAnyPermission } from '@/utils/permission';
8686
8787
import { CommonRouteEnum } from '@/enums/routeEnum';
88+
import { ReasonTypeEnum } from '@lib/shared/enums/moduleEnum';
8889
8990
const { t } = useI18n();
9091
const router = useRouter();
@@ -128,7 +129,7 @@
128129
value: item.id,
129130
}));
130131
});
131-
132+
const enableReason = ref(false);
132133
const currentStageIndex = computed(() => workflowList.value.findIndex((e) => e.value === currentStage.value));
133134
const failureStage = computed(() => props.stageConfigList.find((e) => e.type === 'END' && e.rate === '0')?.id || '');
134135
const successStage = computed(
@@ -209,7 +210,11 @@
209210
async function handleUpdateStage(stage: string) {
210211
if (isDisabledStage(stage)) return;
211212
212-
if (props.showConfirmStatus && stage === workflowList.value[workflowList.value.length - 1].value) {
213+
if (
214+
props.showConfirmStatus &&
215+
stage === workflowList.value[workflowList.value.length - 1].value &&
216+
enableReason.value
217+
) {
213218
router.push({
214219
name: CommonRouteEnum.WORKFLOW_STAGE,
215220
query: {
@@ -223,6 +228,20 @@
223228
}
224229
await handleSave(stage);
225230
}
231+
232+
async function initReason() {
233+
try {
234+
const res = await getReasonConfig(ReasonTypeEnum.OPPORTUNITY_FAIL_RS);
235+
enableReason.value = res.enable;
236+
} catch (e) {
237+
// eslint-disable-next-line no-console
238+
console.log(e);
239+
}
240+
}
241+
242+
onBeforeMount(() => {
243+
initReason();
244+
});
226245
</script>
227246

228247
<style scoped lang="less">

frontend/packages/mobile/src/components/business/crm-workflow-card/workflowStage.vue

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,11 @@
101101
const form = ref<{
102102
stage: string;
103103
failureReason?: string;
104-
// expectedEndTime?: string;
105104
}>({
106105
stage: failureStage.value?.id || '',
107106
failureReason: '',
108-
// expectedEndTime: '',
109107
});
110108
111-
// const showEndTimePicker = ref(false);
112-
// const currentDate = ref<string[]>([]);
113-
// function selectExpectedEndTime() {
114-
// const date = dayjs();
115-
// currentDate.value = date.format('YYYY-MM-DD').split('-');
116-
// showEndTimePicker.value = true;
117-
// }
118-
119-
// const onSelectDateConfirm = ({ selectedValues }: { selectedValues: string[] }) => {
120-
// form.value.expectedEndTime = selectedValues.join('-');
121-
// showEndTimePicker.value = false;
122-
// };
123-
124109
const showReasonPicker = ref(false);
125110
const currentReason = ref<string[]>([]);
126111
function onSelectReasonConfirm({
@@ -147,10 +132,6 @@
147132
await updateStageApi[stageType]({
148133
id: route.query.id as string,
149134
stage: form.value.stage || failureStage.value?.id || '',
150-
// TODO 先不要了
151-
// expectedEndTime: form.value.expectedEndTime
152-
// ? (dayjs(form.value.expectedEndTime).valueOf() as number)
153-
// : undefined,
154135
failureReason: form.value.stage === failureStage.value?.id ? currentReason.value[0] : undefined,
155136
});
156137
showSuccessToast(t('common.operationSuccess'));

frontend/packages/web/src/components/business/crm-workflow-card/index.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,21 @@
148148
}
149149
}
150150
151+
const enableReason = ref(false);
151152
// 更新状态
152153
async function handleUpdateStatus(stage: string) {
153-
if (props.showConfirmStatus && stage === workflowList.value[workflowList.value.length - 1].value) {
154+
if (
155+
props.showConfirmStatus &&
156+
stage === workflowList.value[workflowList.value.length - 1].value &&
157+
enableReason.value
158+
) {
154159
updateStatusModal.value = true;
155160
form.value.stage = failureStage.value;
156161
return;
157162
}
158163
handleSave(stage);
159164
}
160-
161165
// 确认更新
162-
const enableReason = ref(false);
163166
async function handleConfirm() {
164167
if (enableReason.value) {
165168
formRef.value?.validate(async (errors) => {

0 commit comments

Comments
 (0)