cz 1 jaar geleden
bovenliggende
commit
166e470af9
2 gewijzigde bestanden met toevoegingen van 321 en 43 verwijderingen
  1. 320 42
      src/components/process/SendPurchase.vue
  2. 1 1
      src/views/process/processApproval/index.vue

+ 320 - 42
src/components/process/SendPurchase.vue

@@ -1,65 +1,144 @@
 <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">
           <el-form-item label="采购部门" prop="deptName">
-            <el-input v-model="formData.data.deptName" placeholder="请输入"> </el-input>
+            <el-input v-model="formData.data.deptName" placeholder="请输入">
+            </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="采购人" prop="purchaseName">
-            <el-input v-model="formData.data.purchaseName" placeholder="请输入"> </el-input>
+            <el-input v-model="formData.data.purchaseName" placeholder="请输入">
+            </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="采购时间" prop="purchaseTime">
-            <el-date-picker v-model="formData.data.purchaseTime" type="datetime" placeholder="请选择" />
+            <el-date-picker
+              v-model="formData.data.purchaseTime"
+              type="datetime"
+              placeholder="请选择"
+            />
           </el-form-item>
         </el-col>
       </el-row>
       <el-row :gutter="10">
         <el-col :span="8">
           <el-form-item label="供应商" prop="supplyId">
-            <el-select v-model="formData.data.supplyId" placeholder="请选择" @change="handleChangeSupplier" filterable style="width: 100%">
-              <el-option v-for="item in supplierData" :label="item.name" :value="item.id"> </el-option>
+            <el-select
+              v-model="formData.data.supplyId"
+              placeholder="请选择"
+              @change="handleChangeSupplier"
+              filterable
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in supplierData"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
             </el-select>
           </el-form-item>
         </el-col>
       </el-row>
       <el-form-item label="采购说明" prop="purchaseContent">
-        <el-input v-model="formData.data.purchaseContent" placeholder="请输入" type="textarea"> </el-input>
+        <el-input
+          v-model="formData.data.purchaseContent"
+          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" v-if="ids.length == 0"> 添加货品 </el-button>
+        <el-button
+          type="primary"
+          @click="openProduct = true"
+          style="margin: 10px 0"
+          v-if="ids.length == 0"
+        >
+          添加货品
+        </el-button>
         <el-table :data="formData.data.purchaseDetailList">
-          <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="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="subscribeCount" label="申购数量" v-if="ids.length > 0" />
-          <el-table-column prop="purchaseCount" label="已采购数量" v-if="ids.length > 0" />
+          <el-table-column
+            prop="productUnit"
+            label="单位"
+            :formatter="(row) => dictValueLabel(row.productUnit, productUnit)"
+          />
+          <el-table-column
+            prop="subscribeCount"
+            label="申购数量"
+            v-if="ids.length > 0"
+          />
+          <el-table-column
+            prop="purchaseCount"
+            label="已采购数量"
+            v-if="ids.length > 0"
+          />
           <el-table-column prop="count" label="本次采购" min-width="150">
             <template #default="{ row, $index }">
-              <el-form-item :prop="'purchaseDetailList.' + $index + '.count'" :rules="rules.count" :inline-message="true">
-                <el-input-number onmousewheel="return false;" v-model="row.count" :precision="4" :controls="false" :min="0" @change="handleChangeAmount" />
+              <el-form-item
+                :prop="'purchaseDetailList.' + $index + '.count'"
+                :rules="rules.count"
+                :inline-message="true"
+              >
+                <el-input-number
+                  onmousewheel="return false;"
+                  v-model="row.count"
+                  :precision="4"
+                  :controls="false"
+                  :min="0"
+                  @change="handleChangeAmount"
+                />
               </el-form-item>
             </template>
           </el-table-column>
           <el-table-column prop="price" label="单价" min-width="150">
             <template #default="{ row, $index }">
-              <el-form-item :prop="'purchaseDetailList.' + $index + '.price'" :rules="rules.price" :inline-message="true">
-                <el-input-number onmousewheel="return false;" v-model="row.price" :precision="4" :controls="false" :min="0" @change="handleChangeAmount" />
+              <el-form-item
+                :prop="'purchaseDetailList.' + $index + '.price'"
+                :rules="rules.price"
+                :inline-message="true"
+              >
+                <el-input-number
+                  onmousewheel="return false;"
+                  v-model="row.price"
+                  :precision="4"
+                  :controls="false"
+                  :min="0"
+                  @change="handleChangeAmount"
+                />
               </el-form-item>
             </template>
           </el-table-column>
           <el-table-column prop="amount" label="金额" />
           <el-table-column prop="zip" label="操作" width="100">
             <template #default="{ $index }">
-              <el-button type="primary" link @click="handleRemove($index, 20)" :disabled="formData.data.purchaseDetailList.length === 1">删除</el-button>
+              <el-button
+                type="primary"
+                link
+                @click="handleRemove($index, 20)"
+                :disabled="formData.data.purchaseDetailList.length === 1"
+                >删除</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
@@ -67,46 +146,71 @@
       <el-row>
         <el-col :span="4">
           <el-form-item label="商品金额小计" prop="productAmount">
-            <el-input v-model="formData.data.productAmount" placeholder="请输入" disabled />
+            <el-input
+              v-model="formData.data.productAmount"
+              placeholder="请输入"
+              disabled
+            />
           </el-form-item>
         </el-col>
       </el-row>
       <div class="_t">其他收费项目</div>
       <el-form-item>
-        <el-button type="primary" style="margin: 10px 0" @click="handleAdd"> 添加 </el-button>
+        <el-button type="primary" style="margin: 10px 0" @click="handleAdd">
+          添加
+        </el-button>
         <el-table :data="formData.data.otherFeeList">
           <el-table-column prop="name" label="收费项目" min-width="150">
             <template #default="{ row, $index }">
-              <el-form-item :prop="'otherFeeList.' + $index + '.name'" :rules="rulesOne.name" :inline-message="true">
+              <el-form-item
+                :prop="'otherFeeList.' + $index + '.name'"
+                :rules="rulesOne.name"
+                :inline-message="true"
+              >
                 <el-autocomplete
                   v-model="row.name"
                   :fetch-suggestions="querySearchPerson"
                   clearable
                   class="inline-input w-50"
                   placeholder="请输入"
-                  @select="(val) => handlePerson(val, $index)">
+                  @select="(val) => handlePerson(val, $index)"
+                >
                 </el-autocomplete>
               </el-form-item>
             </template>
           </el-table-column>
           <el-table-column prop="price" label="金额" min-width="150">
             <template #default="{ row, $index }">
-              <el-form-item :prop="'otherFeeList.' + $index + '.price'" :rules="rulesOne.price" :inline-message="true">
-                <el-input-number v-model="row.price" :precision="4" :controls="false" @change="handleChangeAmount" />
+              <el-form-item
+                :prop="'otherFeeList.' + $index + '.price'"
+                :rules="rulesOne.price"
+                :inline-message="true"
+              >
+                <el-input-number
+                  v-model="row.price"
+                  :precision="4"
+                  :controls="false"
+                  @change="handleChangeAmount"
+                />
               </el-form-item>
             </template>
           </el-table-column>
 
           <el-table-column prop="remark" label="备注" min-width="150">
             <template #default="{ row, $index }">
-              <el-form-item :prop="'otherFeeList.' + $index + '.remark'" :inline-message="true">
+              <el-form-item
+                :prop="'otherFeeList.' + $index + '.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, 10)">删除</el-button>
+              <el-button type="primary" link @click="handleRemove($index, 10)"
+                >删除</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
@@ -114,7 +218,11 @@
       <el-row>
         <el-col :span="4">
           <el-form-item label="其他收费小计" prop="otherAmount">
-            <el-input v-model="formData.data.otherAmount" placeholder="请输入" disabled />
+            <el-input
+              v-model="formData.data.otherAmount"
+              placeholder="请输入"
+              disabled
+            />
           </el-form-item>
         </el-col>
       </el-row>
@@ -122,13 +230,27 @@
       <el-row>
         <el-col :span="4">
           <el-form-item label="采购总金额" prop="amount">
-            <el-input v-model="formData.data.amount" placeholder="请输入" disabled />
+            <el-input
+              v-model="formData.data.amount"
+              placeholder="请输入"
+              disabled
+            />
           </el-form-item>
         </el-col>
       </el-row>
     </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>
@@ -155,8 +277,12 @@ let formData = reactive({
 });
 let rules = ref({
   deptName: [{ required: true, message: "请输入采购部门", trigger: "blur" }],
-  purchaseName: [{ required: true, message: "请输入采购人名称", trigger: "blur" }],
-  purchaseTime: [{ required: true, message: "请选择采购时间", trigger: "change" }],
+  purchaseName: [
+    { required: true, message: "请输入采购人名称", trigger: "blur" },
+  ],
+  purchaseTime: [
+    { required: true, message: "请选择采购时间", trigger: "change" },
+  ],
   supplyId: [{ required: true, message: "请选择供应商", trigger: "change" }],
   count: [{ required: true, message: "请输入本次采购数量", trigger: "blur" }],
   price: [{ required: true, message: "请输入单价", trigger: "blur" }],
@@ -193,9 +319,14 @@ const handleAdd = () => {
 const pushGoods = (goods) => {
   if (goods && goods.length > 0) {
     let afterFiltering = [];
-    if (formData.data.purchaseDetailList && formData.data.purchaseDetailList.length > 0) {
+    if (
+      formData.data.purchaseDetailList &&
+      formData.data.purchaseDetailList.length > 0
+    ) {
       afterFiltering = goods.filter((item) => {
-        let data = formData.data.purchaseDetailList.filter((itemProduct) => itemProduct.bussinessId === item.id);
+        let data = formData.data.purchaseDetailList.filter(
+          (itemProduct) => itemProduct.bussinessId === item.id
+        );
         if (data && data.length > 0) {
           return false;
         }
@@ -215,7 +346,8 @@ const pushGoods = (goods) => {
       bussinessId: x.id,
       amount: 0,
     }));
-    formData.data.purchaseDetailList = formData.data.purchaseDetailList.concat(arr);
+    formData.data.purchaseDetailList =
+      formData.data.purchaseDetailList.concat(arr);
     openProduct.value = false;
     return ElMessage({
       message: "添加成功!",
@@ -347,13 +479,147 @@ const getDetails = () => {
 const supplierData = ref([]);
 const otherFeeListData = ref([]);
 const getSupplierList = async (req) => {
-  proxy.post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
-    supplierData.value = res.rows;
-  });
+  proxy
+    .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
+    .then((res) => {
+      supplierData.value = res.rows;
+    });
+};
+const emit = defineEmits(["auxiliaryChange"]);
+let auxiliaryData = ref([
+  {
+    label: "供应商最近采购",
+    data: [
+      [
+        {
+          label: "合同编号",
+          value: "12312312312456",
+          fn: () => {
+            console.log(formData.data);
+          },
+          style: {
+            color: "red",
+          },
+          num: 1,
+        },
+        {
+          label: "下单日期",
+          value: "123456",
+          fn: () => {
+            alert("点击事件");
+          },
+          num: 1,
+        },
+        {
+          label: "合同金额",
+          value: "123456",
+          fn: () => {
+            alert("点击事件");
+          },
+          num: 1,
+        },
+      ],
+      [
+        {
+          label: "合同编号",
+          value: "12312312312456",
+          fn: () => {
+            console.log(formData.data);
+          },
+          style: {
+            color: "red",
+          },
+          num: 1,
+        },
+        {
+          label: "下单日期",
+          value: "123456",
+          fn: () => {
+            alert("点击事件");
+          },
+          num: 1,
+        },
+        {
+          label: "合同金额",
+          value: "123456",
+          fn: () => {
+            alert("点击事件");
+          },
+          num: 1,
+        },
+      ],
+      [
+        {
+          label: "合同编号",
+          value: "12312312312456",
+          fn: () => {
+            console.log(formData.data);
+          },
+          style: {
+            color: "red",
+          },
+          num: 1,
+        },
+        {
+          label: "下单日期",
+          value: "123456",
+          fn: () => {
+            alert("点击事件");
+          },
+          num: 1,
+        },
+        {
+          label: "合同金额",
+          value: "123456",
+          fn: () => {
+            alert("点击事件");
+          },
+          num: 1,
+        },
+      ],
+    ],
+  },
+]);
+const auxiliaryChange = (data) => {
+  emit("auxiliaryChange", data);
+};
+
+const getAuxiliaryData = (supplyId, productIdList) => {
+  if (supplyId && productIdList) {
+    proxy
+      .post("/subscribe/decisionAid", {
+        supplyId: supplyId,
+        productIdList: productIdList,
+      })
+      .then((res) => {
+        auxiliaryData.value[0].data = auxiliaryData.value[0].data.map(
+          (x, index) => {
+            return x.map((y, sonIndex) => {
+              let obj = { ...y };
+              let value = "";
+              if (sonIndex === 0) {
+                value = res.purchaseList[index].code;
+              } else if (sonIndex === 1) {
+                value = res.purchaseList[index].createTime;
+              } else {
+                value =
+                  res.purchaseList[index].currency +
+                  proxy.moneyFormat(res.purchaseList[index].amount, 2);
+              }
+              obj.value = value;
+              return obj;
+            });
+          }
+        );
+        console.log(auxiliaryData.value, "aaa");
+        auxiliaryChange(auxiliaryData.value);
+      });
+  }
 };
 // 供应商改变逻辑
 const handleChangeSupplier = (val) => {
   const ids = formData.data.purchaseDetailList.map((x) => x.bussinessId);
+  getAuxiliaryData(val, ids);
   proxy
     .post("/supplierPrice/getSupplierPriceByProductIds", {
       supplierInfoId: val,
@@ -430,12 +696,16 @@ getDict();
 
 const createFilter = (queryString) => {
   return (restaurant) => {
-    return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0;
+    return (
+      restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+    );
   };
 };
 
 const querySearchPerson = (queryString, callback) => {
-  const results = queryString ? otherFeeListData.value.filter(createFilter(queryString)) : otherFeeListData.value;
+  const results = queryString
+    ? otherFeeListData.value.filter(createFilter(queryString))
+    : otherFeeListData.value;
   callback(results);
 };
 
@@ -448,7 +718,10 @@ const handlePerson = (item, index) => {
 watch(
   props.queryData,
   () => {
-    if (props.queryData && (route.query.processType == 10 || route.query.processType == 20)) {
+    if (
+      props.queryData &&
+      (route.query.processType == 10 || route.query.processType == 20)
+    ) {
       for (const key in props.queryData) {
         formData.data[key] = props.queryData[key];
       }
@@ -460,7 +733,9 @@ watch(
 );
 const judgeStatus = () => {
   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;
     }
@@ -478,7 +753,10 @@ defineExpose({
 });
 const acquireSelectList = () => {
   let data = [];
-  if (formData.data.purchaseDetailList && formData.data.purchaseDetailList.length > 0) {
+  if (
+    formData.data.purchaseDetailList &&
+    formData.data.purchaseDetailList.length > 0
+  ) {
     data = formData.data.purchaseDetailList.map((item) => {
       return {
         id: item.bussinessId,

+ 1 - 1
src/views/process/processApproval/index.vue

@@ -7,7 +7,7 @@
         </div>
         <div class="line"></div>
         <SendSubscribe ref="makeDom" @auxiliaryChange='(e) => auxiliaryData = e' v-if="flowForm.flowKey == 'subscribe_flow'" :queryData="queryData.data"></SendSubscribe>
-        <SendPurchase ref="makeDom" v-else-if="flowForm.flowKey == 'purchase_flow'" :queryData="queryData.data"></SendPurchase>
+        <SendPurchase ref="makeDom" @auxiliaryChange='(e) => auxiliaryData = e' v-else-if="flowForm.flowKey == 'purchase_flow'" :queryData="queryData.data"></SendPurchase>
         <SendFunds ref="makeDom" v-else-if="flowForm.flowKey == 'account_request_funds_flow'" :queryData="queryData.data"></SendFunds>
         <ReturnGood ref="makeDom" v-else-if="flowForm.flowKey == 'sales_return_flow'" :queryData="queryData.data"></ReturnGood>
         <PurchaseRefund ref="makeDom" v-else-if="flowForm.flowKey == 'refund_flow'" :queryData="queryData.data"></PurchaseRefund>