Prechádzať zdrojové kódy

费控-订单费用表

cz 1 rok pred
rodič
commit
8261f47a25

+ 3 - 2
src/components/byForm/index.vue

@@ -50,8 +50,9 @@
               label: i.propsTreeLabel || 'label',
               children: i.propsTreeChildren || 'children',
               disabled:i.propsTreeDisabled || 'disabled'
-            }" value-key="id" :placeholder="i.placeholder || $t('common.pleaseSelect')" :disabled="i.disabled ? i.disabled : false" check-strictly
-                          :style="i.style?i.style:{width:'100%'}" default-expand-all @change="(e) => commonsEmit(e, i)" />
+            }" value-key="id" :filterable="i.filterable ? true : true" :placeholder="i.placeholder || $t('common.pleaseSelect')"
+                          :disabled="i.disabled ? i.disabled : false" check-strictly :style="i.style?i.style:{width:'100%'}" default-expand-all
+                          @change="(e) => commonsEmit(e, i)" />
           <el-date-picker v-model="formData[i.prop]" :readonly="i.readonly ? i.readonly : false" v-else-if="i.type == 'date'" :type="i.itemType"
                           :placeholder="i.placeholder || $t('common.pleaseSelectTime')" @change="(e) => commonsEmit(e, i)"
                           :disabled="i.disabled ? i.disabled : false" :format="i.format ? i.format : dateFormatInit(i.itemType)"

+ 1 - 0
src/components/process/SF/Contract.vue

@@ -2030,6 +2030,7 @@ const handleSubmit = async (isStag = false) => {
     //   const errorDiv = document.getElementsByClassName("is-error");
     //   errorDiv[0].scrollIntoView();
     // }, 0);
+    isShowOther.value = true;
   }
   return flag;
 };

+ 97 - 50
src/components/process/SF/CostControl.vue

@@ -5,21 +5,21 @@
       <template #order>
         <div style="width:100%;display:flex">
           <div style="width:calc(100% - 65px)">
-            <el-form-item label="销售订单" prop="contrctLabel" class="margin-b-0">
-              <el-input disabled v-model="formData.data.contrctLabel" placeholder="请选择"></el-input>
+            <el-form-item label="销售订单" prop="contractCode" class="margin-b-0">
+              <el-input disabled v-model="formData.data.contractCode" placeholder="请选择"></el-input>
             </el-form-item>
           </div>
-          <el-button type="primary" style="width:50px;margin-left:15px" @click="openSelectContrct = true" plain>选择</el-button>
+          <el-button type="primary" style="width:50px;margin-left:15px" @click="openSelectContrct = true" plain :disabled="isDisabled">选择</el-button>
         </div>
       </template>
 
       <template #shipment>
         <div style="width:100%;">
           <el-table :data="formData.data.contractOutboundInfoList" style="width: 100%;">
-            <el-table-column prop="processingMethod" label="订单归属" width="150"
-                             :formatter="(row)=>dictKeyValue(row.processingMethod,processingMethodData)" />
-            <el-table-column prop="taxTransportationWay" label="税运方式" width="150"
-                             :formatter="(row)=>dictKeyValue(row.taxTransportationWay,taxTransportationWay)" />
+            <el-table-column prop="contractBelongType" label="订单归属" width="150"
+                             :formatter="(row)=>dictKeyValue(row.contractBelongType,contractBelongTypeData)" />
+            <el-table-column prop="contractTaxTransportationWay" label="税运方式" width="150"
+                             :formatter="(row)=>dictKeyValue(row.contractTaxTransportationWay,contractTaxTransportationWay)" />
             <el-table-column prop="code" label="出货单号" width="150" />
             <el-table-column prop="sumQuantity" label="出货件数" width="150" />
             <el-table-column label="出货单图片">
@@ -401,7 +401,8 @@
                   <el-form-item :prop="'costControlDetailList.' + $index + '.accountSubjectsId'" :rules="rules.accountSubjectsId"
                                 :inline-message="true" class="margin-b-0">
                     <el-tree-select v-model="row.accountSubjectsId" :data="accountSubjectsData" check-strictly :render-after-expand="false"
-                                    node-key="id" :props="defaultProps" style="width:100%" :disabled="getAccountSubjectsId" />
+                                    node-key="id" :props="defaultProps" style="width:100%" :disabled="getAccountSubjectsId" filterable
+                                    @change="(val)=>changeAccountSubjectsId(val,$index)" />
                   </el-form-item>
                 </div>
               </template>
@@ -423,7 +424,7 @@
                                     :props="defaultPropsDept" :placeholder="'请选择'+key" style="width:100%" filterable
                                     v-if="['核算中心', '部门' ].includes(key)" :disabled="getAccountSubjectsId" />
                     <div v-else-if="['客户'].includes(key)">
-                      <el-button type="primary" @click="handleOpenSelectCustomer($index)" plain v-if="!judgeStatus()"
+                      <el-button type="primary" @click="handleOpenSelectCustomer($index)" plain v-if="getAccountSubjectsId"
                                  style="margin-bottom:10px">选择客户</el-button>
                       <el-input v-model="row.customerName" placeholder="请选择客户" disabled></el-input>
                     </div>
@@ -497,7 +498,7 @@ const expenseType = computed(
 const paymentMethod = computed(
   () => proxy.useUserStore().allDict["payment_method"]
 );
-const taxTransportationWay = computed(
+const contractTaxTransportationWay = computed(
   () => proxy.useUserStore().allDict["tax_transportation_way"]
 );
 const logisticsCompanyData = ref([]);
@@ -541,14 +542,14 @@ const isAfterSubmitOne = ref([
   },
 ]);
 
-const processingMethodData = ref([
+const contractBelongTypeData = ref([
   {
-    dictKey: 10,
-    dictValue: "业务自采",
+    dictKey: "1",
+    dictValue: "归属工厂",
   },
   {
-    dictKey: 20,
-    dictValue: "生产处理",
+    dictKey: "2",
+    dictValue: "归属业务",
   },
 ]);
 
@@ -611,7 +612,7 @@ const judgeStatus = () => {
 };
 const formOption = reactive({
   inline: true,
-  labelWidth: 110,
+  labelWidth: 120,
   itemWidth: 100,
   disabled: false,
 });
@@ -760,7 +761,7 @@ const formConfig = computed(() => {
       type: "slot",
       prop: "",
       slotName: "order",
-      itemWidth: 50,
+      itemWidth: 25,
       isShow: isShowAtt("contractId", "mainObj"),
     },
     {
@@ -931,7 +932,7 @@ const formConfig = computed(() => {
 });
 
 const rules = ref({
-  contrctLabel: [
+  contractCode: [
     { required: true, message: "请选择销售订单", trigger: "change" },
   ],
   costType: [
@@ -1206,9 +1207,9 @@ const getCorrespondSelectData = () => {
             selectDataMap.value[key] = proxy.handleTree(res.data, "deptId");
           });
       } else if (["股东", "职员"].includes(key)) {
-        let type = 1;
+        let identity = 10;
         if (key == "股东") {
-          type = 0;
+          identity = 20;
         }
         proxy
           .get(requestUrl[key], {
@@ -1216,7 +1217,7 @@ const getCorrespondSelectData = () => {
             pageSize: 10000,
             tenantId: proxy.useUserStore().user.tenantId,
             companyId: formData.data.companyId || "",
-            type,
+            identity,
           })
           .then((res) => {
             selectDataMap.value[key] = res.rows.map((x) => ({
@@ -1291,6 +1292,26 @@ const checkDisabled = () => {
     }
   }
 };
+
+const changeAccountSubjectsId = (val, index) => {
+  if (val) {
+    accountSubjectsId.value = val;
+    let currentAccountSubjects = accountSubjectsList.value.find(
+      (x) => x.id == accountSubjectsId.value
+    );
+    if (currentAccountSubjects) {
+      subjectsCalculateItemName.value =
+        currentAccountSubjects.calculateItemName;
+      subjectsCalculateItemNameList.value =
+        currentAccountSubjects.calculateItemName.split(",");
+      formData.data.costControlDetailList[index].subjectsCalculateItemName =
+        subjectsCalculateItemName.value;
+      formData.data.costControlDetailList[index].subjectsCalculateItemNameList =
+        subjectsCalculateItemNameList.value;
+      getCorrespondSelectData();
+    }
+  }
+};
 const changeCostType = (val) => {
   currentCostTypeData.value = paymentTypeData.value.find((x) => x.value == val);
   formData.data.tradeType = currentCostTypeData.value.tradeType;
@@ -1844,19 +1865,8 @@ const selectCustomer = (row) => {
   openSelectCustomer.value = false;
   proxy.msgTip("选择成功");
 };
-const openSelectContrct = ref(false);
-const handleSelectContrct = async (row) => {
-  formData.data.contractOutboundInfoList = row.contractOutboundInfoList.map(
-    (x) => ({
-      processingMethod: row.processingMethod || "",
-      taxTransportationWay: row.taxTransportationWay || "",
-      code: x.code,
-      sumQuantity: x.sumQuantity,
-      id: x.id,
-      fileList: [],
-      truckFileList: [],
-    })
-  );
+
+const getOutboundFile = async () => {
   let ids = formData.data.contractOutboundInfoList.map((x) => x.id);
   const allFile = await proxy.getFileData({
     businessIdList: ids,
@@ -1889,8 +1899,27 @@ const handleSelectContrct = async (row) => {
       }
     }
   }
-  formData.data.contrctId = row.id;
-  formData.data.contrctLabel = row.code;
+};
+const openSelectContrct = ref(false);
+const handleSelectContrct = async (row) => {
+  if (row.contractOutboundInfoList && row.contractOutboundInfoList.length) {
+    formData.data.contractOutboundInfoList = row.contractOutboundInfoList.map(
+      (x) => ({
+        contractBelongType: x.contractBelongType || "",
+        contractTaxTransportationWay: x.contractTaxTransportationWay || "",
+        code: x.code,
+        sumQuantity: x.sumQuantity,
+        id: x.id,
+        fileList: [],
+        truckFileList: [],
+      })
+    );
+    getOutboundFile();
+  } else {
+    return proxy.msgTip("该合同暂无出货数据", 2);
+  }
+  formData.data.contractId = row.id;
+  formData.data.contractCode = row.code;
   openSelectContrct.value = false;
   return proxy.msgTip("选择成功", 1);
 };
@@ -1963,15 +1992,21 @@ const handleSubmit = async (isStag = false) => {
       for (let i = 0; i < formData.data.costControlDetailList.length; i++) {
         const row = formData.data.costControlDetailList[i];
         let calculateItemList = [];
-        for (let j = 0; j < row.subjectsCalculateItemNameList.length; j++) {
-          const key = row.subjectsCalculateItemNameList[j];
-          if (row.submitMapData[key]) {
-            calculateItemList.push({
-              type: key,
-              businessId: row.submitMapData[key],
-            });
+        if (
+          row.subjectsCalculateItemNameList &&
+          row.subjectsCalculateItemNameList.length > 0
+        ) {
+          for (let j = 0; j < row.subjectsCalculateItemNameList.length; j++) {
+            const key = row.subjectsCalculateItemNameList[j];
+            if (row.submitMapData[key]) {
+              calculateItemList.push({
+                type: key,
+                businessId: row.submitMapData[key],
+              });
+            }
           }
         }
+
         row.calculateItemList = calculateItemList;
       }
       return true;
@@ -2024,8 +2059,11 @@ const getAllData = (businessId) => {
         row.fileList = [];
         row.invoiceFileList = [];
         // 名称列表
-        row.subjectsCalculateItemNameList =
-          row.subjectsCalculateItemName.split(",");
+        if (row.subjectsCalculateItemName) {
+          row.subjectsCalculateItemNameList =
+            row.subjectsCalculateItemName.split(",");
+        }
+
         // 第一条
         if (i == 0) {
           subjectsCalculateItemNameList.value =
@@ -2034,11 +2072,13 @@ const getAllData = (businessId) => {
         }
         //  数据处理并回显
         row.submitMapData = {};
-        for (let j = 0; j < row.calculateItemList.length; j++) {
-          const jele = row.calculateItemList[j];
-          row.submitMapData[jele.type] = jele.businessId;
-          if (jele.type == "客户") {
-            row.customerName = jele.customerName;
+        if (row.calculateItemList && row.calculateItemList.length > 0) {
+          for (let j = 0; j < row.calculateItemList.length; j++) {
+            const jele = row.calculateItemList[j];
+            row.submitMapData[jele.type] = jele.businessId;
+            if (jele.type == "客户") {
+              row.customerName = jele.customerName;
+            }
           }
         }
       }
@@ -2047,6 +2087,13 @@ const getAllData = (businessId) => {
       formData.data[key] = res[key];
     }
 
+    if (
+      formData.data.contractOutboundInfoList &&
+      formData.data.contractOutboundInfoList.length > 0
+    ) {
+      getOutboundFile();
+    }
+
     setTimeout(() => {
       if (paymentTypeData.value && paymentTypeData.value.length > 0) {
         currentCostTypeData.value = paymentTypeData.value.find(