Răsfoiți Sursa

修改初审提示

Alex 10 luni în urmă
părinte
comite
aa39730ff9
1 a modificat fișierele cu 78 adăugiri și 57 ștergeri
  1. 78 57
      src/views/recycleOrder/components/first-check-modal.vue

+ 78 - 57
src/views/recycleOrder/components/first-check-modal.vue

@@ -1,86 +1,107 @@
 <!-- 搜索表单 -->
 <template>
-    <simple-form-modal title="初审提示" :items="formItems" ref="editRef" :baseUrl="baseUrl" :formatData="formatData"
-        @success="(data) => emit('success', data)"></simple-form-modal>
+  <simple-form-modal
+    title="初审提示"
+    :items="formItems"
+    ref="editRef"
+    :baseUrl="baseUrl"
+    :formatData="formatData"
+    @success="(data) => emit('success', data)"
+  ></simple-form-modal>
 </template>
 
 <script setup>
-import { reactive, ref, defineEmits, getCurrentInstance } from 'vue';
-import SimpleFormModal from '@/components/CommonPage/SimpleFormModal.vue';
-const { proxy } = getCurrentInstance();
+  import { reactive, ref, defineEmits, getCurrentInstance } from 'vue';
+  import SimpleFormModal from '@/components/CommonPage/SimpleFormModal.vue';
+  const { proxy } = getCurrentInstance();
 
-const emit = defineEmits(['success']);
+  const emit = defineEmits(['success']);
 
-const formItems = computed(() => {
+  const formItems = computed(() => {
     return [
-        {
-            type: 'dictSelect',
-            label: '快递',
-            prop: 'finalExpress',
-            props: { code: 'final_express' },
-        },
-        {
-            type: 'select',
-            label: '收货仓库',
-            prop: 'godownId',
-            options: godownList.value
-                .filter((v) => v.useStatus == 1)
-                .map((d) => {
-                    return { label: d.godownName, value: d.id };
-                })
-        },
-        {
-            type: 'dictRadio',
-            label: '审核结果',
-            prop: 'auditStatus',
-            props: { code: 'recycle_audit_result' }
-        },
-        {
-            type: 'dictSelect',
-            label: '驳回原因',
-            prop: 'auditReason',
-            props: { code: 'audit_reject_reason', class: 'custom-select' },
-            vIf: (data) => data.auditStatus == 2
-        }
+      {
+        type: 'select',
+        label: '快递',
+        prop: 'finalExpress',
+        options: expressList.value.map((v) => {
+          return { label: v.dictLabel, value: v.dictValue };
+        })
+      },
+      {
+        type: 'select',
+        label: '收货仓库',
+        prop: 'godownId',
+        options: godownList.value.map((d) => {
+          return { label: d.godownName, value: d.id };
+        })
+      },
+      {
+        type: 'dictRadio',
+        label: '审核结果',
+        prop: 'auditStatus',
+        props: { code: 'recycle_audit_result' }
+      },
+      {
+        type: 'dictSelect',
+        label: '驳回原因',
+        prop: 'auditReason',
+        props: { code: 'audit_reject_reason', class: 'custom-select' },
+        vIf: (data) => data.auditStatus == 2
+      }
     ];
-});
+  });
 
-const godownList = ref([]);
-async function getGodownList() {
+  const godownList = ref([]);
+  async function getGodownList() {
     return proxy.$http.post('/baseinfo/godown/searchGodown?name=');
-}
+  }
 
-//默认值
-const baseUrl = reactive({
+  //获取快递列表
+  const expressList = ref([]);
+  async function getExpressList() {
+    return proxy.$http.get('/system/dict/data/type/final_express');
+  }
+
+  //默认值
+  const baseUrl = reactive({
     add: '/order/orderInfo/auditFirst',
     update: '/order/orderInfo/auditFirst'
-});
-const formData = ref({
+  });
+  const formData = ref({
     orderIds: '',
     godownId: 1,
     finalExpress: '3',
     auditStatus: '1'
-});
+  });
 
-const formatData = (data) => {
+  const formatData = (data) => {
     return {
-        ...data,
-        orderIds: formData.value.orderIds
-    }
-}
+      ...data,
+      orderIds: formData.value.orderIds
+    };
+  };
 
-const editRef = ref(null);
+  const editRef = ref(null);
 
-function handleOpen(orderIds) {
+  function handleOpen(orderIds) {
     formData.value.orderIds = orderIds;
     editRef.value?.handleOpen(formData.value);
 
     getGodownList().then((res) => {
-        if (res.data.code == 200) {
-            godownList.value = res.data.data;
-        }
+      if (res.data.code == 200) {
+        godownList.value = res.data.data.filter((v) => v.useStatus == 1);
+        formData.value.godownId =
+          godownList.value.length > 0 ? godownList.value[0].id : '';
+      }
+    });
+    getExpressList().then((res) => {
+      if (res.data.code == 200) {
+        expressList.value = res.data.data;
+        formData.value.finalExpress =
+          expressList.value.length > 0 ? expressList.value[0].dictValue : '';
+      }
     });
-}
+  }
 
-defineExpose({ handleOpen });
+  defineExpose({ handleOpen });
 </script>