Browse Source

Merge branch 'stage' into dev0.3

cz 1 year ago
parent
commit
919c95ee96

+ 24 - 11
src/components/process/Contract.vue

@@ -14,12 +14,14 @@
                 <el-input v-model="formData.data.sellCountryName" placeholder="请输入国家" />
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="1"></el-col>
+            <el-col :span="7">
               <el-form-item label=" " prop="sellProvinceName">
                 <el-input v-model="formData.data.sellProvinceName" placeholder="请输入省/州" />
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="1"></el-col>
+            <el-col :span="7">
               <el-form-item label=" " prop="sellCityName">
                 <el-input v-model="formData.data.sellCityName" placeholder="请输入城市" />
               </el-form-item>
@@ -38,7 +40,8 @@
                 <el-input v-model="formData.data.sellContactName" placeholder="请输入联系人" />
               </el-form-item>
             </el-col>
-            <el-col :span="16">
+            <el-col :span="1"></el-col>
+            <el-col :span="15">
               <el-form-item label=" " prop="sellContactNumber">
                 <el-input v-model="formData.data.sellContactNumber" placeholder="请输入联系人电话" />
               </el-form-item>
@@ -63,7 +66,8 @@
                   </el-select>
                 </el-form-item>
               </el-col>
-              <el-col :span="6">
+              <el-col :span="1"></el-col>
+              <el-col :span="5">
                 <el-form-item label=" " prop="provinceName">
                   <selectCity
                     placeholder="省/洲"
@@ -75,12 +79,14 @@
                   </selectCity>
                 </el-form-item>
               </el-col>
-              <el-col :span="6">
+              <el-col :span="1"></el-col>
+              <el-col :span="5">
                 <el-form-item label=" " prop="cityName">
                   <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="formData.data" :data="cityData"> </selectCity>
                 </el-form-item>
               </el-col>
-              <el-col :span="6">
+              <el-col :span="1"></el-col>
+              <el-col :span="5">
                 <el-form-item label=" " prop="buyPostalCode">
                   <el-input v-model="formData.data.buyPostalCode" placeholder="请输入邮编" />
                 </el-form-item>
@@ -106,7 +112,8 @@
                   </el-autocomplete>
                 </el-form-item>
               </el-col>
-              <el-col :span="16">
+              <el-col :span="1"></el-col>
+              <el-col :span="15">
                 <el-form-item label=" " prop="buyContactNumber">
                   <el-input v-model="formData.data.buyContactNumber" placeholder="请输入联系人电话" />
                 </el-form-item>
@@ -258,6 +265,7 @@
                 </el-select>
               </el-form-item>
             </el-col>
+            <el-col :span="1"></el-col>
             <el-col :span="6">
               <el-form-item label="合同总金额" prop="amount">
                 <el-input v-model="formData.data.amount" placeholder="合同总金额" disabled />
@@ -265,14 +273,15 @@
             </el-col>
           </el-row>
           <el-row style="margin-top: 20px; width: 100%">
-            <el-col :span="7">
+            <el-col :span="6">
               <el-form-item label="付款方式" prop="paymentMethod">
                 <el-select v-model="formData.data.paymentMethod" placeholder="请选择付款方式" style="width: 100%">
                   <el-option v-for="item in fundsPaymentMethod" :key="item.value" :label="item.label" :value="item.value" />
                 </el-select>
               </el-form-item>
             </el-col>
-            <el-col :span="7">
+            <el-col :span="1"></el-col>
+            <el-col :span="6">
               <el-form-item label="预付比例 (%)" prop="advanceRatio">
                 <el-input-number
                   onmousewheel="return false;"
@@ -285,13 +294,15 @@
                   :max="100" />
               </el-form-item>
             </el-col>
-            <el-col :span="7">
+            <el-col :span="1"></el-col>
+            <el-col :span="6">
               <el-form-item label="收款账号" prop="shroffAccountId">
                 <el-select v-model="formData.data.shroffAccountId" placeholder="请选择收款账号" style="width: 100%" @change="changeShroffAccount">
                   <el-option v-for="item in accountList" :key="item.value" :label="item.label" :value="item.value" />
                 </el-select>
               </el-form-item>
             </el-col>
+            <el-col :span="1"></el-col>
             <el-col :span="3">
               <el-form-item label="  ">
                 <el-button type="primary" @click="changeActiveName" text>
@@ -356,6 +367,7 @@
                 </el-select>
               </el-form-item>
             </el-col>
+            <el-col :span="1"></el-col>
             <el-col :span="7">
               <el-form-item label="运输说明" prop="transportRemark">
                 <el-input v-model="formData.data.transportRemark" placeholder="请输入运输说明" />
@@ -363,7 +375,7 @@
             </el-col>
           </el-row>
           <el-row style="margin-top: 20px; width: 100%">
-            <el-col :span="14">
+            <el-col :span="15">
               <el-form-item label="付款条件" prop="remark">
                 <el-input v-model="formData.data.remark" :rows="2" type="textarea" placeholder="请输入付款条件" />
               </el-form-item>
@@ -382,6 +394,7 @@
                   :min="0" />
               </el-form-item>
             </el-col>
+            <el-col :span="1"></el-col>
             <el-col :span="7">
               <el-form-item label="质保期 (天)" prop="warranty">
                 <el-input-number

+ 93 - 18
src/components/process/ReturnGood.vue

@@ -1,39 +1,95 @@
 <template>
   <div style="width: 100%; padding: 0px 15px">
-    <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom">
+    <byForm
+      :formConfig="formConfig"
+      :formOption="formOption"
+      v-model="formData.data"
+      :rules="rules"
+      ref="formDom"
+    >
       <template #details>
         <div style="width: 100%">
-          <el-button type="primary" @click="openProduct = true" style="margin-bottom: 10px"> 添加物品 </el-button>
+          <el-button
+            type="primary"
+            @click="openProduct = true"
+            style="margin-bottom: 10px"
+          >
+            添加物品
+          </el-button>
           <el-table :data="formData.data.salesReturnDetailList">
+            <el-table-column
+              prop="goodType"
+              label="货品类型"
+              :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')"
+            />
             <el-table-column prop="productCode" label="货品编码" />
             <el-table-column prop="productName" label="货品名称" />
             <el-table-column prop="productSpec" label="规格型号" />
-            <el-table-column prop="productUnit" label="单位" :formatter="(row) => dictValueLabel(row.productUnit, productUnit)" />
+            <el-table-column
+              prop="productUnit"
+              label="单位"
+              :formatter="
+                (row) =>
+                  row.goodType == 1
+                    ? dictValueLabel(row.productUnit, productUnit)
+                    : dictValueLabel(row.productUnit, productUnitOne)
+              "
+            />
             <el-table-column prop="count" label="退货数量" min-width="150">
               <template #default="{ row, $index }">
-                <el-form-item :prop="'salesReturnDetailList.' + $index + '.count'" :rules="rules.count" :inline-message="true">
-                  <el-input-number onmousewheel="return false;" v-model="row.count" :precision="4" :controls="false" :min="0" />
+                <el-form-item
+                  :prop="'salesReturnDetailList.' + $index + '.count'"
+                  :rules="rules.count"
+                  :inline-message="true"
+                >
+                  <el-input-number
+                    onmousewheel="return false;"
+                    v-model="row.count"
+                    :precision="4"
+                    :controls="false"
+                    :min="0"
+                  />
                 </el-form-item>
               </template>
             </el-table-column>
             <el-table-column prop="remark" label="退货原因" min-width="150">
               <template #default="{ row, $index }">
-                <el-form-item :prop="'salesReturnDetailList.' + $index + '.remark'" :rules="rules.remark" :inline-message="true">
-                  <el-input v-model="row.remark" placeholder="请输入" type="textarea" />
+                <el-form-item
+                  :prop="'salesReturnDetailList.' + $index + '.remark'"
+                  :rules="rules.remark"
+                  :inline-message="true"
+                >
+                  <el-input
+                    v-model="row.remark"
+                    placeholder="请输入"
+                    type="textarea"
+                  />
                 </el-form-item>
               </template>
             </el-table-column>
             <el-table-column prop="zip" label="操作" width="100">
               <template #default="{ $index }">
-                <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
+                <el-button type="primary" link @click="handleRemove($index)"
+                  >删除</el-button
+                >
               </template>
             </el-table-column>
           </el-table>
         </div>
       </template>
     </byForm>
-    <el-dialog v-if="openProduct" v-model="openProduct" title="选择货品" width="70%" append-to-body>
-      <SelectGoods :selectList="acquireSelectList()" @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
+    <el-dialog
+      v-if="openProduct"
+      v-model="openProduct"
+      title="选择货品"
+      width="70%"
+      append-to-body
+    >
+      <SelectGoods
+        :selectList="acquireSelectList()"
+        @cancel="openProduct = false"
+        @pushGoods="pushGoods"
+      ></SelectGoods>
     </el-dialog>
   </div>
 </template>
@@ -155,9 +211,14 @@ const handleRemove = (index) => {
 const pushGoods = (goods) => {
   if (goods && goods.length > 0) {
     let afterFiltering = [];
-    if (formData.data.salesReturnDetailList && formData.data.salesReturnDetailList.length > 0) {
+    if (
+      formData.data.salesReturnDetailList &&
+      formData.data.salesReturnDetailList.length > 0
+    ) {
       afterFiltering = goods.filter((item) => {
-        let data = formData.data.salesReturnDetailList.filter((itemProduct) => itemProduct.bussinessId === item.id);
+        let data = formData.data.salesReturnDetailList.filter(
+          (itemProduct) => itemProduct.bussinessId === item.id
+        );
         if (data && data.length > 0) {
           return false;
         }
@@ -176,7 +237,8 @@ const pushGoods = (goods) => {
       bussinessId: x.id,
       remark: "",
     }));
-    formData.data.salesReturnDetailList = formData.data.salesReturnDetailList.concat(arr);
+    formData.data.salesReturnDetailList =
+      formData.data.salesReturnDetailList.concat(arr);
     openProduct.value = false;
     return ElMessage({
       message: "添加成功!",
@@ -207,19 +269,24 @@ const judgeStatus = () => {
     return true;
   }
   if (props.queryData.recordList && props.queryData.recordList.length > 0) {
-    let data = props.queryData.recordList.filter((item) => item.status === 2 && item.nodeType !== 1);
+    let data = props.queryData.recordList.filter(
+      (item) => item.status === 2 && item.nodeType !== 1
+    );
     if (data && data.length > 0) {
       return true;
     }
   }
   return false;
-};;
+};
 
 watch(
   props.queryData,
   () => {
     formOption.disabled = judgeStatus();
-    if (props.queryData && ["10", "20", "30"].includes(route.query.processType)) {
+    if (
+      props.queryData &&
+      ["10", "20", "30"].includes(route.query.processType)
+    ) {
       for (const key in props.queryData) {
         formData.data[key] = props.queryData[key];
       }
@@ -231,12 +298,17 @@ watch(
 );
 
 const productUnit = ref([]);
+const productUnitOne = ref([]);
 const getDict = () => {
-  proxy.getDictOne(["unit"]).then((res) => {
+  proxy.getDictOne(["unit", "material_unit"]).then((res) => {
     productUnit.value = res["unit"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
     }));
+    productUnitOne.value = res["material_unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
   });
 };
 getDict();
@@ -251,7 +323,10 @@ defineExpose({
 });
 const acquireSelectList = () => {
   let data = [];
-  if (formData.data.salesReturnDetailList && formData.data.salesReturnDetailList.length > 0) {
+  if (
+    formData.data.salesReturnDetailList &&
+    formData.data.salesReturnDetailList.length > 0
+  ) {
     data = formData.data.salesReturnDetailList.map((item) => {
       return {
         id: item.bussinessId,

+ 12 - 2
src/components/process/SendPurchase.vue

@@ -111,7 +111,12 @@
           <el-table-column
             prop="productUnit"
             label="单位"
-            :formatter="(row) => dictValueLabel(row.productUnit, productUnit)"
+            :formatter="
+              (row) =>
+                row.goodType == 1
+                  ? dictValueLabel(row.productUnit, productUnit)
+                  : dictValueLabel(row.productUnit, productUnitOne)
+            "
           />
           <el-table-column
             prop="subscribeCount"
@@ -734,12 +739,17 @@ const handleChangeOtherMoney = (val, index, key) => {
 };
 
 const productUnit = ref([]);
+const productUnitOne = ref([]);
 const getDict = () => {
-  proxy.getDictOne(["unit"]).then((res) => {
+  proxy.getDictOne(["unit", "material_unit"]).then((res) => {
     productUnit.value = res["unit"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
     }));
+    productUnitOne.value = res["material_unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
   });
   proxy.get("/purchaseOtherFee/listName").then((res) => {
     otherFeeListData.value = res.data.map((x) => ({ ...x, value: x.name }));

+ 136 - 42
src/components/process/SendSubscribe.vue

@@ -1,6 +1,12 @@
 <template>
   <div style="width: 100%; padding: 0px 15px">
-    <el-form :model="formData.data" :rules="rules" ref="formDom" label-position="top" :disabled="judgeStatus()">
+    <el-form
+      :model="formData.data"
+      :rules="rules"
+      ref="formDom"
+      label-position="top"
+      :disabled="judgeStatus()"
+    >
       <div class="_t">申购信息</div>
       <el-row :gutter="10">
         <el-col :span="6">
@@ -24,56 +30,121 @@
       <el-row :gutter="10">
         <el-col :span="6">
           <el-form-item label="申购部门" prop="deptName">
-            <el-input v-model="formData.data.deptName" placeholder="请输入" disabled> </el-input>
+            <el-input
+              v-model="formData.data.deptName"
+              placeholder="请输入"
+              disabled
+            >
+            </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="申购人" prop="subcribeName">
-            <el-input v-model="formData.data.subcribeName" placeholder="请输入" disabled> </el-input>
+            <el-input
+              v-model="formData.data.subcribeName"
+              placeholder="请输入"
+              disabled
+            >
+            </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="申购时间" prop="subcribeTime">
-            <el-date-picker v-model="formData.data.subcribeTime" type="datetime" placeholder="请选择" disabled />
+            <el-date-picker
+              v-model="formData.data.subcribeTime"
+              type="datetime"
+              placeholder="请选择"
+              disabled
+            />
           </el-form-item>
         </el-col>
       </el-row>
       <el-form-item label="申购说明" prop="subcribeContent">
-        <el-input v-model="formData.data.subcribeContent" placeholder="请输入" type="textarea"> </el-input>
+        <el-input
+          v-model="formData.data.subcribeContent"
+          placeholder="请输入"
+          type="textarea"
+        >
+        </el-input>
       </el-form-item>
       <div class="_t">申购明细</div>
       <el-form-item>
-        <el-button type="primary" @click="openProduct = true" style="margin: 10px 0"> 添加货品 </el-button>
+        <el-button
+          type="primary"
+          @click="openProduct = true"
+          style="margin: 10px 0"
+        >
+          添加货品
+        </el-button>
         <el-table :data="formData.data.subscribeDetailList">
-          <el-table-column prop="goodType" label="货品类型" :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')" />
+          <el-table-column
+            prop="goodType"
+            label="货品类型"
+            :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')"
+          />
           <el-table-column prop="code" label="货品编码" />
           <el-table-column prop="name" label="货品名称" min-width="150" />
           <el-table-column prop="spec" label="规格型号" />
-          <el-table-column prop="unit" label="单位" :formatter="(row) => dictValueLabel(row.unit, productUnit)" />
+          <el-table-column
+            prop="unit"
+            label="单位"
+            :formatter="
+              (row) =>
+                row.goodType == 1
+                  ? dictValueLabel(row.unit, productUnit)
+                  : dictValueLabel(row.unit, productUnitOne)
+            "
+          />
           <el-table-column prop="count" label="申购数量" min-width="150">
             <template #default="{ row, $index }">
-              <el-form-item :prop="'subscribeDetailList.' + $index + '.count'" :rules="rules.count" :inline-message="true">
-                <el-input-number onmousewheel="return false;" v-model="row.count" :precision="4" :controls="false" :min="1" />
+              <el-form-item
+                :prop="'subscribeDetailList.' + $index + '.count'"
+                :rules="rules.count"
+                :inline-message="true"
+              >
+                <el-input-number
+                  onmousewheel="return false;"
+                  v-model="row.count"
+                  :precision="4"
+                  :controls="false"
+                  :min="1"
+                />
               </el-form-item>
             </template>
           </el-table-column>
           <el-table-column prop="remark" label="备注" min-width="150">
             <template #default="{ row, $index }">
-              <el-form-item :prop="'subscribeDetailList.' + $index + '.remark'" :rules="rules.remark" :inline-message="true">
+              <el-form-item
+                :prop="'subscribeDetailList.' + $index + '.remark'"
+                :rules="rules.remark"
+                :inline-message="true"
+              >
                 <el-input v-model="row.remark" placeholder="请输入" />
               </el-form-item>
             </template>
           </el-table-column>
           <el-table-column prop="zip" label="操作" width="100">
             <template #default="{ $index }">
-              <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
+              <el-button type="primary" link @click="handleRemove($index)"
+                >删除</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
       </el-form-item>
     </el-form>
-    <el-dialog v-if="openProduct" v-model="openProduct" title="选择货品" width="70%" append-to-body>
-      <SelectGoods :selectList="acquireSelectList()" @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
+    <el-dialog
+      v-if="openProduct"
+      v-model="openProduct"
+      title="选择货品"
+      width="70%"
+      append-to-body
+    >
+      <SelectGoods
+        :selectList="acquireSelectList()"
+        @cancel="openProduct = false"
+        @pushGoods="pushGoods"
+      ></SelectGoods>
     </el-dialog>
   </div>
 </template>
@@ -96,10 +167,16 @@ let formData = reactive({
   },
 });
 let rules = ref({
-  corporationId: [{ required: true, message: "请选择归属公司", trigger: "change" }],
+  corporationId: [
+    { required: true, message: "请选择归属公司", trigger: "change" },
+  ],
   deptName: [{ required: true, message: "请输入申购部门", trigger: "blur" }],
-  subcribeName: [{ required: true, message: "请输入申购人名称", trigger: "blur" }],
-  subcribeTime: [{ required: true, message: "请选择申购时间", trigger: "change" }],
+  subcribeName: [
+    { required: true, message: "请输入申购人名称", trigger: "blur" },
+  ],
+  subcribeTime: [
+    { required: true, message: "请选择申购时间", trigger: "change" },
+  ],
   // subcribeContent: [
   //   { required: true, message: "请输入申购事由", trigger: "blur" },
   // ],
@@ -120,9 +197,14 @@ const handleRemove = (index) => {
 const pushGoods = (goods) => {
   if (goods && goods.length > 0) {
     let afterFiltering = [];
-    if (formData.data.subscribeDetailList && formData.data.subscribeDetailList.length > 0) {
+    if (
+      formData.data.subscribeDetailList &&
+      formData.data.subscribeDetailList.length > 0
+    ) {
       afterFiltering = goods.filter((item) => {
-        let data = formData.data.subscribeDetailList.filter((itemProduct) => itemProduct.bussinessId === item.id);
+        let data = formData.data.subscribeDetailList.filter(
+          (itemProduct) => itemProduct.bussinessId === item.id
+        );
         if (data && data.length > 0) {
           return false;
         }
@@ -141,7 +223,8 @@ const pushGoods = (goods) => {
       count: "",
       remark: "",
     }));
-    formData.data.subscribeDetailList = formData.data.subscribeDetailList.concat(arr);
+    formData.data.subscribeDetailList =
+      formData.data.subscribeDetailList.concat(arr);
     openProduct.value = false;
     return ElMessage({
       message: "添加成功!",
@@ -184,18 +267,23 @@ const judgeStatus = () => {
     return true;
   }
   if (props.queryData.recordList && props.queryData.recordList.length > 0) {
-    let data = props.queryData.recordList.filter((item) => item.status === 2 && item.nodeType !== 1);
+    let data = props.queryData.recordList.filter(
+      (item) => item.status === 2 && item.nodeType !== 1
+    );
     if (data && data.length > 0) {
       return true;
     }
   }
   return false;
-};;
+};
 
 watch(
   props.queryData,
   () => {
-    if (props.queryData && ["10", "20", "30"].includes(route.query.processType)) {
+    if (
+      props.queryData &&
+      ["10", "20", "30"].includes(route.query.processType)
+    ) {
       for (const key in props.queryData) {
         formData.data[key] = props.queryData[key];
       }
@@ -206,14 +294,18 @@ watch(
   }
 );
 const productUnit = ref([]);
+const productUnitOne = ref([]);
 const companyData = ref([]);
-
 const getDict = () => {
-  proxy.getDictOne(["unit"]).then((res) => {
+  proxy.getDictOne(["unit", "material_unit"]).then((res) => {
     productUnit.value = res["unit"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
     }));
+    productUnitOne.value = res["material_unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
   });
 
   proxy
@@ -232,7 +324,10 @@ defineExpose({
 });
 const acquireSelectList = () => {
   let data = [];
-  if (formData.data.subscribeDetailList && formData.data.subscribeDetailList.length > 0) {
+  if (
+    formData.data.subscribeDetailList &&
+    formData.data.subscribeDetailList.length > 0
+  ) {
     data = formData.data.subscribeDetailList.map((item) => {
       return {
         id: item.bussinessId,
@@ -246,35 +341,34 @@ const emit = defineEmits(["auxiliaryChange"]);
 let auxiliaryData = ref([
   {
     label: "最近合同",
-    data:[
+    data: [
       [
         {
-          label:"合同编号",
-          value:'12312312312456',
-          fn:()=>{
-            console.log(formData.data)
+          label: "合同编号",
+          value: "12312312312456",
+          fn: () => {
+            console.log(formData.data);
           },
-          style:{
-            color:'red'
+          style: {
+            color: "red",
           },
-          num:1,
+          num: 1,
         },
         {
-          label:"合同编号",
-          value:'123456',
-          fn:()=>{
-            alert('点击事件')
-          }
-        }
+          label: "合同编号",
+          value: "123456",
+          fn: () => {
+            alert("点击事件");
+          },
+        },
       ],
-
     ],
   },
 ]);
 const auxiliaryChange = (data) => {
   emit("auxiliaryChange", data);
 };
-auxiliaryChange(auxiliaryData)
+auxiliaryChange(auxiliaryData);
 </script>
 
 <style lang="scss" scoped>

+ 3 - 1
src/components/process/ServiceContract.vue

@@ -940,7 +940,9 @@ watch(
       if (formData.data.provinceId) {
         getCityData(formData.data.provinceId, "30");
       }
-      remarkEditor.value.changeHtml(formData.data.remark);
+      if( remarkEditor.value){
+          remarkEditor.value.changeHtml(formData.data.remark);
+      }
     }
   },
   {

+ 11 - 2
src/components/product/SelectGoods.vue

@@ -123,7 +123,11 @@ const config = computed(() => {
         prop: "unit",
       },
       render(unit) {
-        return proxy.dictValueLabel(unit, productUnit.value);
+        if (sourceList.value.pagination.definition == 1) {
+          return proxy.dictValueLabel(unit, productUnit.value);
+        } else {
+          return proxy.dictValueLabel(unit, productUnitOne.value);
+        }
       },
     },
     {
@@ -153,12 +157,17 @@ const config = computed(() => {
 });
 const table = ref(null);
 const productUnit = ref([]);
+const productUnitOne = ref([]);
 const getDict = () => {
-  proxy.getDictOne(["unit"]).then((res) => {
+  proxy.getDictOne(["unit", "material_unit"]).then((res) => {
     productUnit.value = res["unit"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
     }));
+    productUnitOne.value = res["material_unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
   });
 };
 getDict();

+ 17 - 4
src/views/purchaseManage/purchaseManage/alreadyPurchase/index.vue

@@ -88,9 +88,11 @@
         <el-form-item>
           <el-table :data="formData.data.arrivalDetailList">
             <el-table-column
-              prop="goodType"
+              prop="productDefinition"
               label="货品类型"
-              :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')"
+              :formatter="
+                (row) => (row.productDefinition == 1 ? '产品' : '物料')
+              "
             />
             <el-table-column prop="productCode" label="货品编码" />
             <el-table-column prop="productName" label="货品名称" />
@@ -98,7 +100,12 @@
             <el-table-column
               prop="productUnit"
               label="单位"
-              :formatter="(row) => dictValueLabel(row.productUnit, productUnit)"
+              :formatter="
+                (row) =>
+                  row.productDefinition == 1
+                    ? dictValueLabel(row.productUnit, productUnit)
+                    : dictValueLabel(row.productUnit, productUnitOne)
+              "
             />
             <el-table-column prop="purchaseCount" label="采购数量" />
             <el-table-column prop="sumArrivalCount" label="已到货" />
@@ -818,17 +825,23 @@ const handleEditOne = (row) => {
 
 const supplierData = ref([]);
 const productUnit = ref([]);
+const productUnitOne = ref([]);
+
 const getDict = async (req) => {
   proxy
     .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
     .then((res) => {
       supplierData.value = res.rows;
     });
-  proxy.getDictOne(["unit"]).then((res) => {
+  proxy.getDictOne(["unit", "material_unit"]).then((res) => {
     productUnit.value = res["unit"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
     }));
+    productUnitOne.value = res["material_unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
   });
 };
 const handleArrival = (row) => {

+ 24 - 10
src/views/purchaseManage/purchaseManage/arrival/index.vue

@@ -22,6 +22,11 @@
         ]"
         @get-list="getList"
       >
+        <template #productUnit="{ item }">
+          <div>
+            {{ getUnit(item) }}
+          </div>
+        </template>
         <template #fileSlot="{ item }">
           <div
             style="cursor: pointer; color: #409eff"
@@ -81,9 +86,11 @@
         <el-form-item>
           <el-table :data="formData.data.qualityDetailList">
             <el-table-column
-              prop="productType"
+              prop="productDefinition"
               label="货品类型"
-              :formatter="(row) => (row.productType == 1 ? '产品' : '物料')"
+              :formatter="
+                (row) => (row.productDefinition == 1 ? '产品' : '物料')
+              "
             />
             <el-table-column prop="productCode" label="货品编码" />
             <el-table-column prop="productName" label="货品名称" />
@@ -91,7 +98,12 @@
             <el-table-column
               prop="productUnit"
               label="单位"
-              :formatter="(row) => dictValueLabel(row.productUnit, productUnit)"
+              :formatter="
+                (row) =>
+                  row.productDefinition == 1
+                    ? dictValueLabel(row.productUnit, productUnit)
+                    : dictValueLabel(row.productUnit, productUnitOne)
+              "
             />
             <el-table-column prop="count" label="到货数量" />
             <el-table-column prop="sumQualityCount" label="已质检" />
@@ -189,7 +201,7 @@ let rules = ref({
 });
 const supplierData = ref([]);
 const productUnit = ref([]);
-const productType = ref([]);
+const productUnitOne = ref([]);
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
   {
@@ -263,9 +275,7 @@ const config = computed(() => {
       attrs: {
         label: "单位",
         prop: "productUnit",
-      },
-      render(unit) {
-        return proxy.dictValueLabel(unit, productUnit.value);
+        slot: "productUnit",
       },
     },
     {
@@ -425,12 +435,12 @@ const getDict = () => {
       supplierData.value = res.rows;
     });
 
-  proxy.getDictOne(["unit", "product_type"]).then((res) => {
+  proxy.getDictOne(["unit", "material_unit"]).then((res) => {
     productUnit.value = res["unit"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
     }));
-    productType.value = res["product_type"].map((x) => ({
+    productUnitOne.value = res["material_unit"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
     }));
@@ -492,7 +502,11 @@ watch(selectData, (newVal, oldVal) => {
   }
 });
 
-onMounted(() => {});
+const getUnit = (row) => {
+  return row.productDefinition == 1
+    ? proxy.dictValueLabel(row.productUnit, productUnit.value)
+    : proxy.dictValueLabel(row.productUnit, productUnitOne.value);
+};
 </script>
   
 <style lang="scss" scoped>

+ 22 - 6
src/views/purchaseManage/purchaseManage/purchase/index.vue

@@ -23,6 +23,11 @@
         ]"
         @get-list="getList"
       >
+        <template #productUnit="{ item }">
+          <div>
+            {{ getUnit(item) }}
+          </div>
+        </template>
         <template #fileSlot="{ item }">
           <div
             style="cursor: pointer; color: #409eff"
@@ -233,11 +238,9 @@ const config = computed(() => {
     {
       attrs: {
         label: "单位",
+        slot: "productUnit",
         prop: "productUnit",
       },
-      render(unit) {
-        return proxy.dictDataEcho(unit, productUnit.value);
-      },
     },
     {
       attrs: {
@@ -466,10 +469,17 @@ const selectRow = (data) => {
   selectData.value = data;
 };
 const productUnit = ref([]);
-
+const productUnitOne = ref([]);
 const getDict = () => {
-  proxy.getDictOne(["unit"]).then((res) => {
-    productUnit.value = res["unit"];
+  proxy.getDictOne(["unit", "material_unit"]).then((res) => {
+    productUnit.value = res["unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    productUnitOne.value = res["material_unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
   });
 };
 getDict();
@@ -507,6 +517,12 @@ const start = () => {
     });
   }
 };
+
+const getUnit = (row) => {
+  return row.productDefinition == 1
+    ? proxy.dictValueLabel(row.productUnit, productUnit.value)
+    : proxy.dictValueLabel(row.productUnit, productUnitOne.value);
+};
 </script>
   
 <style lang="scss" scoped>

+ 18 - 5
src/views/purchaseManage/purchaseManage/subscribe/index.vue

@@ -21,6 +21,11 @@
         ]"
         @get-list="getList"
       >
+        <template #productUnit="{ item }">
+          <div>
+            {{ getUnit(item) }}
+          </div>
+        </template>
         <template #fileSlot="{ item }">
           <div
             style="cursor: pointer; color: #409eff"
@@ -224,10 +229,8 @@ const config = computed(() => {
       attrs: {
         label: "单位",
         prop: "productUnit",
-        width: 60,
-      },
-      render(unit) {
-        return proxy.dictValueLabel(unit, productUnit.value);
+        slot: "productUnit",
+        width: 80,
       },
     },
     {
@@ -503,16 +506,26 @@ const statusData = ref([
 ]);
 selectConfig[1].data = statusData.value;
 const productUnit = ref([]);
+const productUnitOne = ref([]);
 const getDict = () => {
-  proxy.getDictOne(["unit"]).then((res) => {
+  proxy.getDictOne(["unit", "material_unit"]).then((res) => {
     productUnit.value = res["unit"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
     }));
+    productUnitOne.value = res["material_unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
   });
 };
 getDict();
 getList();
+const getUnit = (row) => {
+  return row.productDefinition == 1
+    ? proxy.dictValueLabel(row.productUnit, productUnit.value)
+    : proxy.dictValueLabel(row.productUnit, productUnitOne.value);
+};
 </script>
   
 <style lang="scss" scoped>

+ 6 - 1
src/views/purchaseSales/outAndInWarehouse/waitingForStorage/index.vue

@@ -48,6 +48,7 @@ const { proxy } = getCurrentInstance();
 const warehouseList = ref([]);
 const productType = ref([]);
 const productUnit = ref([]);
+const productUnitOne = ref([]);
 const status = ref([
   {
     label: "待入库",
@@ -223,7 +224,7 @@ const getDict = () => {
       });
     }
   });
-  proxy.getDictOne(["product_type", "unit"]).then((res) => {
+  proxy.getDictOne(["product_type", "unit", "material_unit"]).then((res) => {
     productType.value = res["product_type"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
@@ -232,6 +233,10 @@ const getDict = () => {
       label: x.dictValue,
       value: x.dictKey,
     }));
+    productUnitOne.value = res["material_unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
   });
 };
 const getList = async (req) => {

+ 136 - 101
src/views/salesMange/salesMange/afterSales/index.vue

@@ -266,6 +266,9 @@ const rules = ref({
   customerId: [
     { required: true, message: "请选择客户名称", trigger: "change" },
   ],
+  contractIds: [
+    { required: true, message: "请选择销售合同", trigger: "change" },
+  ],
   type: [{ required: true, message: "请选择售后类型", trigger: "change" }],
   remark: [{ required: true, message: "请输入售后说明", trigger: "blur" }],
   quantity: [{ required: true, message: "请输入售后数量", trigger: "blur" }],
@@ -389,108 +392,110 @@ const config = computed(() => {
       },
       renderHTML(row) {
         return [
-          {
-            attrs: {
-              label: "跟进",
-              type: "primary",
-              text: true,
-              disabled: false,
-            },
-            el: "button",
-            click() {
-              modalType.value = "add";
-              formData.followData = {
-                afterSalesDetailId: row.id,
-                fileList: [],
-              };
-              openFollow.value = true;
-            },
-          },
-          {
-            attrs: {
-              label: "关闭",
-              type: "primary",
-              text: true,
-              disabled: false,
-            },
-            el: "button",
-            click() {
-              ElMessageBox.confirm("您确定执行此操作吗?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-              }).then(() => {
-                proxy
-                  .post("/afterSalesDetail/edit", {
-                    id: row.id,
-                    status: 1,
-                  })
-                  .then(() => {
-                    ElMessage({
-                      message: "操作成功",
-                      type: "success",
-                    });
-                    getList();
-                  });
-              });
-            },
-          },
-          {
-            attrs: {
-              label: "退货",
-              type: "primary",
-              text: true,
-              disabled: false,
-            },
-            el: "button",
-            click() {
-              ElMessageBox.confirm("您确定执行退货操作吗?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-              }).then(() => {
-                proxy
-                  .post("/afterSalesDetail/salesReturn", {
-                    id: row.id,
-                  })
-                  .then(() => {
-                    ElMessage({
-                      message: "退货成功",
-                      type: "success",
-                    });
-                    getList();
+          row.status == 0
+            ? {
+                attrs: {
+                  label: "跟进",
+                  type: "primary",
+                  text: true,
+                  disabled: false,
+                },
+                el: "button",
+                click() {
+                  modalType.value = "add";
+                  formData.followData = {
+                    afterSalesDetailId: row.id,
+                    fileList: [],
+                  };
+                  openFollow.value = true;
+                },
+              }
+            : {},
+          row.status == 0
+            ? {
+                attrs: {
+                  label: "关闭",
+                  type: "primary",
+                  text: true,
+                  disabled: false,
+                },
+                el: "button",
+                click() {
+                  handleEdit(row, 1);
+                },
+              }
+            : {
+                attrs: {
+                  label: "重新打开",
+                  type: "primary",
+                  text: true,
+                  disabled: false,
+                },
+                el: "button",
+                click() {
+                  handleEdit(row, 0);
+                },
+              },
+          row.status == 0
+            ? {
+                attrs: {
+                  label: "退货",
+                  type: "primary",
+                  text: true,
+                  disabled: false,
+                },
+                el: "button",
+                click() {
+                  ElMessageBox.confirm("您确定执行退货操作吗?", "提示", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning",
+                  }).then(() => {
+                    proxy
+                      .post("/afterSalesDetail/salesReturn", {
+                        id: row.id,
+                      })
+                      .then(() => {
+                        ElMessage({
+                          message: "退货成功",
+                          type: "success",
+                        });
+                        getList();
+                      });
                   });
-              });
-            },
-          },
-          {
-            attrs: {
-              label: "换货",
-              type: "primary",
-              text: true,
-              disabled: false,
-            },
-            el: "button",
-            click() {
-              ElMessageBox.confirm("您确定执行换货操作吗?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-              }).then(() => {
-                proxy
-                  .post("/afterSalesDetail/salesReplace", {
-                    id: row.id,
-                  })
-                  .then(() => {
-                    ElMessage({
-                      message: "换货成功",
-                      type: "success",
-                    });
-                    getList();
+                },
+              }
+            : {},
+          row.status == 0
+            ? {
+                attrs: {
+                  label: "换货",
+                  type: "primary",
+                  text: true,
+                  disabled: false,
+                },
+                el: "button",
+                click() {
+                  ElMessageBox.confirm("您确定执行换货操作吗?", "提示", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning",
+                  }).then(() => {
+                    proxy
+                      .post("/afterSalesDetail/salesReplace", {
+                        id: row.id,
+                      })
+                      .then(() => {
+                        ElMessage({
+                          message: "换货成功",
+                          type: "success",
+                        });
+                        getList();
+                      });
                   });
-              });
-            },
-          },
+                },
+              }
+            : {},
           // {
           //   attrs: {
           //     label: "退款",
@@ -653,6 +658,15 @@ const getList = async (req) => {
 
 const submitForm = () => {
   formDom.value.handleSubmit(() => {
+    for (let i = 0; i < formData.data.afterSalesDetailList.length; i++) {
+      const e = formData.data.afterSalesDetailList[i];
+      if (!(e.quantity > 0)) {
+        return ElMessage({
+          message: "售后数量不能为0",
+          type: "info",
+        });
+      }
+    }
     submitLoading.value = true;
     formData.data.contractIds = formData.data.contractIds.join(",");
     proxy.post("/afterSales/" + modalType.value, formData.data).then(
@@ -741,7 +755,7 @@ const changeContract = (val) => {
           productSpec: x.productSpec,
           productUnit: x.productUnit,
           productId: x.productId,
-          quantity: null,
+          quantity: x.quantity,
           remark: "",
         }));
       });
@@ -907,6 +921,27 @@ const handleClickStatus = (row) => {
 const openFile = (path) => {
   window.open(path, "_blank");
 };
+
+const handleEdit = (row, status) => {
+  ElMessageBox.confirm("您确定执行此操作吗?", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  }).then(() => {
+    proxy
+      .post("/afterSalesDetail/edit", {
+        id: row.id,
+        status,
+      })
+      .then(() => {
+        ElMessage({
+          message: "操作成功",
+          type: "success",
+        });
+        getList();
+      });
+  });
+};
 </script>
   
 <style lang="scss" scoped>