Commit c8423c0f931937d389c3afe2a0d043c0b829932c

Authored by sanmu
1 parent 48302ce4

feat: 一期功能收尾

src/api/project/order.ts
... ... @@ -29,6 +29,7 @@ enum Api {
29 29 OPT_LOG = '/order/erp/opt/log/list_by_page', // 操作日志
30 30 AUDIT_LOG = '/order/erp/audit/log/list_by_page', //审批日志
31 31 ORDER_RATE_EXPORT = '/order/erp/report/export', // 所有设计师比重导出
  32 + ORDER_FIELD_CHECK = '/order/erp/order/check', // 校验内部编号是否重复
32 33 }
33 34  
34 35 export const formatSearchData = (params) => {
... ... @@ -83,6 +84,15 @@ export const getOrderOptLog = async (data: any) => {
83 84 export const getOrderAuditLog = async (data: any) => {
84 85 return defHttp.post<any>({ url: Api.AUDIT_LOG, data });
85 86 };
  87 +export const orderFieldCheck = async (data: any) => {
  88 + try {
  89 + await defHttp.post<any>({ url: Api.ORDER_FIELD_CHECK, data });
  90 + } catch (error) {
  91 + // 重复
  92 + return error.result === 1000;
  93 + }
  94 + return false;
  95 +};
86 96  
87 97 export const orderUpdate = async (data: any) => {
88 98 const res = await defHttp.post<any>({ url: Api.UPDATE, data }, { message: '操作成功' });
... ...
src/utils/http/axios/Axios.ts
... ... @@ -234,7 +234,7 @@ export class VAxios {
234 234 return router.push('/login');
235 235 }
236 236 if (res.data.result !== 0 && res.data.message) {
237   - createMessage.error(res.data.message);
  237 + if (res.data.message !== '款式重复,是否继续') createMessage.error(res.data.message);
238 238 return reject(res.data);
239 239 }
240 240  
... ...
src/utils/project.ts
... ... @@ -28,3 +28,30 @@ export const getBaseDisable = (field, code, id) =&gt; {
28 28 }
29 29 return false;
30 30 };
  31 +
  32 +// 质量检测的disable函数
  33 +// 中期验货:只要是PASS, PASS 2ND, PASS 3RD, FAIL-RELEASE,就锁定。
  34 +// 终期验货:只要是PASS, PASS 2ND, PASS 3RD, FAIL-RELEASE,就锁定。
  35 +export const getQualityDisable = (field, code, id, value, endValue) => {
  36 + // 确认自己是否是锁住的
  37 + // const isLock = getDisable(code, id, value);
  38 + const isLock = code === 'LOCKED' && !!id;
  39 + // 如果不是锁的,直接返回不锁
  40 + if (!isLock) return false;
  41 +
  42 + // 锁的话,需要在进行下面判断,确定要不要不锁
  43 + if (isLock) {
  44 + // 所有字段就锁定判断,终期验货结果,值是PASS, PASS 2ND, PASS 3RD, FAIL-RELEASE就锁定。
  45 + const isEndLock = ['PASS', 'PASS 2ND', 'PASS 3RD', 'FAIL RELEASE'].includes(endValue);
  46 + if (isEndLock) {
  47 + // return isEndLock && !!id && (value || value === 0);
  48 + return isEndLock;
  49 + } else {
  50 + // 中期验货结果,值是PASS, PASS 2ND, PASS 3RD, FAIL-RELEASE,就锁定。
  51 + if (field === 'midCheckResult') {
  52 + return ['PASS', 'PASS 2ND', 'PASS 3RD', 'FAIL RELEASE'].includes(value);
  53 + }
  54 + }
  55 + }
  56 + return false;
  57 +};
... ...
src/views/project/order/FormDetail/BaseFormPanel.vue
1 1 <template>
2   - <BasicForm @register="registerForm" />
  2 + <div className="pb-2">
  3 + <BasicForm @register="registerForm" />
  4 + </div>
  5 + <div
  6 + v-if="isInnerNoRepeat"
  7 + class="absolute bottom-0 left-0 bg-gray-200 px-2 py-1 w-full text-orange-500"
  8 + >{{ isInnerNoRepeat }}</div
  9 + >
3 10 </template>
4 11 <script lang="ts">
5   - import { computed, defineComponent, ref } from 'vue';
  12 + import { computed, defineComponent, onMounted, ref, watch } from 'vue';
6 13 import { BasicForm, useForm } from '/@/components/Form/index';
7 14 import { FIELDS_BASE_INFO } from '../tableData';
8 15 import { getBaseDisable } from '/@/utils/project';
... ... @@ -10,6 +17,7 @@
10 17  
11 18 import { useOrderInfo } from '/@/hooks/component/order';
12 19 import { get } from 'lodash-es';
  20 + import { orderFieldCheck } from '/@/api/project/order';
13 21  
14 22 export default defineComponent({
15 23 components: { BasicForm },
... ... @@ -24,12 +32,26 @@
24 32 id: {
25 33 type: String,
26 34 },
  35 + isCopy: {
  36 + type: Boolean,
  37 + },
27 38 businessUsers: {
28 39 type: Array,
29 40 },
30 41 },
31 42 emits: ['success'],
32 43 setup(props) {
  44 + // 子组建获取isCopy,并且自己维护isCopy的状态
  45 + let isCopy = ref(props.isCopy);
  46 + const isInnerNoRepeat = ref('');
  47 +
  48 + watch(
  49 + () => props.isCopy,
  50 + (value) => {
  51 + isCopy.value = value;
  52 + },
  53 + );
  54 +
33 55 let fields = ref({});
34 56 const picUrl = ref('');
35 57 const smallPicUrl = ref('');
... ... @@ -97,12 +119,25 @@
97 119 ...(item.component === 'Select' && { showSearch: true }),
98 120 ...(item.component === 'Select' && { options: options[item.field] }),
99 121 disabled: getBaseDisable(item.field, get(fields.value, `${item.field}`), props.id),
100   - onChange: (val) => {
101   - if (item.field === 'customerCode') {
  122 + onChange: async (val) => {
  123 + if (item.field === 'customerCode' && !isCopy.value) {
102 124 if (!props.id) {
103 125 setFieldsValue({ projectNo: val + '-', innerNo: val + '/' });
104 126 }
105 127 }
  128 + isCopy.value = false;
  129 +
  130 + if (item.field === 'innerNo') {
  131 + val = typeof val === 'string' ? val : val.target.value;
  132 + const res = await orderFieldCheck({
  133 + innerNo: [val],
  134 + });
  135 + if (res) {
  136 + isInnerNoRepeat.value = `内部编码 ${val} 已存在,保存前请确认是否需要修改`;
  137 + } else {
  138 + isInnerNoRepeat.value = '';
  139 + }
  140 + }
106 141 },
107 142 },
108 143 colProps: {
... ... @@ -133,6 +168,7 @@
133 168 validate,
134 169 picUrl,
135 170 smallPicUrl,
  171 + isInnerNoRepeat,
136 172 };
137 173 },
138 174 });
... ...
src/views/project/order/FormDetail/InspectionFormPanel.vue
... ... @@ -5,7 +5,7 @@
5 5 import { computed, defineComponent, ref } from 'vue';
6 6 import { BasicForm, useForm } from '/@/components/Form/index';
7 7 import { FIELDS_INSPECTION_INFO } from '../tableData';
8   - import { getDisable } from '/@/utils/project';
  8 + import { getDisable, getQualityDisable } from '/@/utils/project';
9 9 import { useOrderStoreWithOut } from '/@/store/modules/order';
10 10 import { get } from 'lodash-es';
11 11 import { useOrderInfo } from '/@/hooks/component/order';
... ... @@ -39,10 +39,12 @@
39 39 componentProps: {
40 40 ...(item.component === 'Select' && { showSearch: true }),
41 41 ...(item.component === 'Select' && { options: options[item.field] }),
42   - disabled: getDisable(
  42 + disabled: getQualityDisable(
  43 + item.field,
43 44 get(fields.value, item.field),
44 45 props.id,
45 46 get(props.inspectFormData, `${item.field}`),
  47 + get(props.inspectFormData, 'endCheckResult'),
46 48 ),
47 49 },
48 50 colProps: {
... ...
src/views/project/order/FormDetail/index.vue
... ... @@ -23,7 +23,12 @@
23 23 v-if="role === ROLE.ADMIN || role === ROLE.TRACKER"
24 24 >
25 25 <span className="text-red-600">{{ checkingMsg }}</span>
26   - <BaseFormPanel ref="baseFormPanelRef" :id="id" :businessUsers="businessUsers" />
  26 + <BaseFormPanel
  27 + ref="baseFormPanelRef"
  28 + :is-copy="isCopy"
  29 + :id="id"
  30 + :businessUsers="businessUsers"
  31 + />
27 32 </TabPanel>
28 33 <TabPanel
29 34 key="2"
... ... @@ -147,6 +152,7 @@
147 152  
148 153 const formRef = ref<FormActionType | null>(null);
149 154 const id = ref('');
  155 + const isCopy = ref(false);
150 156 const configList = ref([]);
151 157 const businessUsers = ref([]);
152 158 const checkingMsg = ref('');
... ... @@ -193,10 +199,13 @@
193 199 reportFormPanelRef?.value?.resetFields();
194 200 trackFormPanelRef?.value?.resetFields();
195 201 inspectionFormPanelRef?.value?.resetFields();
196   -
197   - return;
  202 + // id不存在,而且不是复制的,就是新建,不用走后面逻辑
  203 + if (!data?.isCopy) return;
198 204 }
  205 +
199 206 id.value = data.id;
  207 + isCopy.value = data?.isCopy;
  208 +
200 209 profitFormData.value =
201 210 data?.orderUpdateInfoVO?.profitAnalysisFields || data.profitAnalysisInfo;
202 211 inspectFormData.value = data.inspectionStageInfo;
... ... @@ -215,7 +224,7 @@
215 224 ...data.lockFields.baseFields,
216 225 };
217 226  
218   - if (id.value) {
  227 + if (id.value || data?.isCopy) {
219 228 orderCount.value = data.orderCount;
220 229  
221 230 setTimeout(() => {
... ... @@ -228,7 +237,8 @@
228 237 baseFormPanelRef.value.picUrl = data.picUrl;
229 238 baseFormPanelRef.value.smallPicUrl = data.smallPicUrl;
230 239 }
231   -
  240 + // 复制,只能更新基本信息
  241 + if (data.isCopy) return;
232 242 if (profitFormPanelRef.value) {
233 243 // 包装费用通过客户编码去查
234 244 const packetPrice = find(configList.value, (item) => {
... ... @@ -417,6 +427,7 @@
417 427 };
418 428 return {
419 429 id,
  430 + isCopy,
420 431 profitFormPanelRef,
421 432 reportFormPanelRef,
422 433 trackFormPanelRef,
... ...
src/views/project/order/index.vue
... ... @@ -41,17 +41,30 @@
41 41 }),
42 42 },
43 43 {
  44 + // 数据分析没有编辑权限
44 45 ...(role !== ROLE.DATA_REPORT_USER && {
45   - label: '申请权限',
  46 + label: '复制',
46 47 // icon: 'ic:outline-delete-outline',
47   - onClick: handleCheck.bind(null, record),
  48 + onClick: handleCopy.bind(null, record),
48 49 }),
49 50 },
  51 + // {
  52 + // ...(role !== ROLE.DATA_REPORT_USER && {
  53 + // label: '申请',
  54 + // // icon: 'ic:outline-delete-outline',
  55 + // onClick: handleCheck.bind(null, record),
  56 + // }),
  57 + // },
50 58 ]"
51 59 :dropDownActions="
52 60 role !== ROLE.DATA_REPORT_USER
53 61 ? [
54 62 {
  63 + label: '申请权限',
  64 + // icon: 'ic:outline-delete-outline',
  65 + onClick: handleCheck.bind(null, record),
  66 + },
  67 + {
55 68 label: '历史记录',
56 69 onClick: handleHistory.bind(null, record),
57 70 },
... ... @@ -247,6 +260,12 @@
247 260 return false;
248 261 }
249 262  
  263 + function handleCopy(record, e) {
  264 + openFormDetailDrawer(true, { ...toRaw(record), id: undefined, isCopy: true });
  265 + e?.stopPropagation();
  266 + return false;
  267 + }
  268 +
250 269 function handleAdd() {
251 270 openFormDetailDrawer(true, {});
252 271 }
... ... @@ -339,6 +358,7 @@
339 358 checkedKeys,
340 359 onSelect,
341 360 handleEdit,
  361 + handleCopy,
342 362 handleCheck,
343 363 onSelectAll,
344 364 tooltipVisible,
... ...
src/views/project/order/tableData.tsx
... ... @@ -707,7 +707,19 @@ export const FIELDS_BASE_INFO = [
707 707 component: 'Input',
708 708 labelWidth: 150,
709 709 label: '内部编号',
710   - rules: [{ required: true }],
  710 + rules: [
  711 + { required: true },
  712 + {
  713 + validator: async (rule, value) => {
  714 + if (value.includes(' ')) {
  715 + return Promise.reject();
  716 + }
  717 + return Promise.resolve();
  718 + },
  719 + message: '内容存在空格,请检查',
  720 + trigger: ['change', 'blur'],
  721 + },
  722 + ],
711 723 },
712 724 {
713 725 field: 'customerPo',
... ... @@ -721,7 +733,19 @@ export const FIELDS_BASE_INFO = [
721 733 component: 'Input',
722 734 labelWidth: 150,
723 735 label: '客户STYLE',
724   - rules: [{ required: true }],
  736 + rules: [
  737 + { required: true },
  738 + {
  739 + validator: async (rule, value) => {
  740 + if (value.includes(' ')) {
  741 + return Promise.reject();
  742 + }
  743 + return Promise.resolve();
  744 + },
  745 + message: '内容存在空格,请检查',
  746 + trigger: ['change', 'blur'],
  747 + },
  748 + ],
725 749 },
726 750 {
727 751 field: 'modeleLo',
... ... @@ -892,15 +916,15 @@ export const FIELDS_TRACK_STAGE_INFO = [
892 916 },
893 917 {
894 918 field: 'ppConfirmResult',
895   - component: 'Select',
896   - componentProps: {
897   - options: [
898   - {
899   - label: 'ok',
900   - value: 'ok',
901   - },
902   - ],
903   - },
  919 + component: 'Input',
  920 + // componentProps: {
  921 + // options: [
  922 + // {
  923 + // label: 'ok',
  924 + // value: 'ok',
  925 + // },
  926 + // ],
  927 + // },
904 928 label: 'pp样品确认意见 ',
905 929 },
906 930 {
... ... @@ -917,15 +941,15 @@ export const FIELDS_TRACK_STAGE_INFO = [
917 941 },
918 942 {
919 943 field: 'shippmentSampleConfirmResult',
920   - component: 'Select',
921   - componentProps: {
922   - options: [
923   - {
924   - label: 'ok',
925   - value: 'ok',
926   - },
927   - ],
928   - },
  944 + component: 'Input',
  945 + // componentProps: {
  946 + // options: [
  947 + // {
  948 + // label: 'ok',
  949 + // value: 'ok',
  950 + // },
  951 + // ],
  952 + // },
929 953 label: 'shipment sample确认意见',
930 954 labelWidth: 250,
931 955 },
... ... @@ -959,16 +983,16 @@ export const FIELDS_TRACK_STAGE_INFO = [
959 983 },
960 984 {
961 985 field: 'sgsTestFinishResult',
962   - component: 'Select',
  986 + component: 'Input',
963 987 label: 'SGS测试结果',
964   - componentProps: {
965   - options: [
966   - {
967   - label: 'ok',
968   - value: 'ok',
969   - },
970   - ],
971   - },
  988 + // componentProps: {
  989 + // options: [
  990 + // {
  991 + // label: 'ok',
  992 + // value: 'ok',
  993 + // },
  994 + // ],
  995 + // },
972 996 },
973 997 {
974 998 field: 'barcodeStickerArrivalTime',
... ...