File tree Expand file tree Collapse file tree
mobile/src/components/business/crm-workflow-card
web/src/components/business/crm-workflow-card Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 ();
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 (
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: {
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">
Original file line number Diff line number Diff line change 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({
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' ));
Original file line number Diff line number Diff line change 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 ) => {
You can’t perform that action at this time.
0 commit comments