cz 1 rok pred
rodič
commit
a71ef534c4

+ 1 - 3
src/components/WDLY/process/SendPurchaseWDLY.vue

@@ -610,9 +610,7 @@ const handleChangeAmount = () => {
 };
 
 const handleChangeMoney = (val, index, key) => {
-  if (val) {
-    formData.data.purchaseDetailList[index][key] = val;
-  }
+  formData.data.purchaseDetailList[index][key] = val;
   for (let i = 0; i < formData.data.purchaseDetailList.length; i++) {
     formData.data.purchaseDetailList[i].amount = parseFloat(
       formData.data.purchaseDetailList[i].count *

+ 4 - 4
src/components/byForm/index.vue

@@ -117,6 +117,7 @@
           :disabled="i.disabled ? i.disabled : false"
           :format="i.format ? i.format : dateFormatInit(i.itemType)"
           :value-format="i.format ? i.format : dateFormatInit(i.itemType)"
+          :style="i.style"
         />
         <el-switch
           :disabled="i.disabled ? i.disabled : false"
@@ -308,7 +309,6 @@ const handleSuccess = (res, file, files) => {
   emit("update:modelValue", formData.value);
 };
 
-
 const handleRemove = (file) => {
   const index = fileListCopy.value.findIndex(
     (x) => x.uid === file.uid || x.id === file.id
@@ -336,10 +336,10 @@ const formData = computed(() => {
 });
 const formDataReset = ref({ ...proxy.modelValue });
 const commonsEmit = (prop, item) => {
-  if(item.type == 'input' && item.itemType == 'number'){
-    console.log(formData.value)
+  if (item.type == "input" && item.itemType == "number") {
+    console.log(formData.value);
   }
-    
+
   if (item.fn) {
     item.fn(prop);
   }

+ 409 - 2
src/views/WDLY/purchaseManage/alreadyPurchase/index.vue

@@ -36,6 +36,9 @@
 
         <template #btn="{ item }">
           <div>
+            <el-button type="primary" link @click="handleUpdateData(item)"
+              >修改</el-button
+            >
             <el-button
               type="primary"
               v-if="item.purchaseStatus == 30"
@@ -763,6 +766,153 @@
         </div>
       </template>
     </el-drawer> -->
+    <el-dialog
+      :title="'修改合同'"
+      v-model="purchaseDialog"
+      width="1200"
+      destroy-on-close
+    >
+      <byForm
+        :formConfig="purchaseFormConfig"
+        :formOption="formOption"
+        v-model="formData.purchaseData"
+        :rules="purchaseFormRules"
+        ref="purchaseDom"
+      >
+        <template #details>
+          <div style="width: 100%">
+            <el-table :data="formData.purchaseData.purchaseDetailList">
+              <el-table-column
+                prop="productDefinition"
+                label="物品类型"
+                :formatter="
+                  (row) =>
+                    row.productDefinition == 1
+                      ? '产品'
+                      : row.productDefinition == 2
+                      ? '物料'
+                      : ''
+                "
+                width="100"
+              />
+              <el-table-column
+                prop="productCustomCode"
+                label="物品编码"
+                min-width="150"
+              />
+              <el-table-column
+                prop="productName"
+                label="物品名称"
+                min-width="160"
+              />
+              <el-table-column
+                prop="productUnit"
+                label="单位"
+                :formatter="
+                  (row) => dictValueLabel(row.productUnit, productUnit)
+                "
+                width="80"
+              />
+              <el-table-column prop="count" label="采购数量" width="100" />
+              <el-table-column prop="price" label="单价" min-width="150">
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="'purchaseDetailList.' + $index + '.price'"
+                    :rules="purchaseFormRules.price"
+                    :inline-message="true"
+                  >
+                    <el-input-number
+                      :model-value="
+                        formData.purchaseData.purchaseDetailList[$index].price
+                      "
+                      :precision="4"
+                      :controls="false"
+                      :min="0"
+                      onmousewheel="return false;"
+                      @change="(val) => handleChangeMoney(val, $index, 'price')"
+                    />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column prop="amount" label="金额" width="120" />
+            </el-table>
+          </div>
+        </template>
+        <template #otherDetails>
+          <div style="width: 100%">
+            <el-table :data="formData.purchaseData.otherFeeList">
+              <el-table-column prop="name" label="费用名称" min-width="150">
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="'otherFeeList.' + $index + '.name'"
+                    :rules="purchaseFormRules.name"
+                    :inline-message="true"
+                  >
+                    <el-input v-model="row.name" placeholder="请输入" />
+                  </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="purchaseFormRules.price"
+                    :inline-message="true"
+                  >
+                    <el-input-number
+                      v-model="row.price"
+                      :precision="4"
+                      :controls="false"
+                      onmousewheel="return 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-input v-model="row.remark" placeholder="请输入" />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </template>
+        <template #fileSlot>
+          <div style="width: 100%">
+            <el-upload
+              v-model:fileList="fileList"
+              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
+              :data="uploadData"
+              multiple
+              :before-upload="handleBeforeUpload"
+              :on-success="handleSuccess"
+              :on-preview="onPreviewFile"
+            >
+              <el-button disabled>选择</el-button>
+            </el-upload>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="purchaseDialog = false" size="large"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          @click="submitUpdate()"
+          size="large"
+          :loading="loadingTwo"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
   
@@ -1005,6 +1155,7 @@ let formData = reactive({
   data: {},
   dataOne: {},
   dataTwo: {},
+  purchaseData: {},
 });
 const formOption = reactive({
   inline: true,
@@ -1442,13 +1593,14 @@ watch(
 );
 
 const handleClickContractCode = (row) => {
-  proxy.$router.push({
+  proxy.$router.replace({
     path: "/platform_manage/process/processApproval",
     query: {
       flowKey: row.processInstanceId,
       id: row.flowId,
       businessId: row.id,
       processType: 20,
+      random: proxy.random(),
     },
   });
 };
@@ -1509,15 +1661,20 @@ const getCityData = (id, type, flag) => {
   });
 };
 const productUnit = ref([]);
+const fundsPaymentMethod = ref([]);
 const supplierData = ref([]);
 const warehouseList = ref([]);
 const userList = ref([]);
 const getDict = () => {
-  proxy.getDictOne(["unit"]).then((res) => {
+  proxy.getDictOne(["unit", "funds_payment_method"]).then((res) => {
     productUnit.value = res["unit"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
     }));
+    fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
   });
   proxy
     .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
@@ -1678,6 +1835,256 @@ const pushKdRoute = (row) => {
     },
   });
 };
+
+const purchaseDialog = ref(false);
+const fileList = ref([]);
+const purchaseDom = ref(null);
+const purchaseFormConfig = computed(() => [
+  {
+    type: "title",
+    title: "基础信息",
+  },
+  {
+    type: "input",
+    prop: "deptName",
+    label: "采购部门",
+    disabled: true,
+    itemWidth: 25,
+  },
+  {
+    type: "input",
+    prop: "purchaseName",
+    label: "采购人",
+    disabled: true,
+    itemWidth: 25,
+  },
+  {
+    type: "date",
+    itemType: "datetime",
+    prop: "purchaseName",
+    label: "采购时间",
+    disabled: true,
+    itemWidth: 25.01,
+    style: {
+      width: "100%",
+    },
+  },
+  {
+    type: "select",
+    label: "供应商",
+    prop: "supplyId",
+    filterable: true,
+    data: supplierData.value,
+    disabled: true,
+    itemWidth: 25,
+    style: {
+      width: "100%",
+    },
+  },
+  {
+    type: "select",
+    label: "是否合同",
+    prop: "isAgreement",
+    data: [
+      {
+        label: "是",
+        value: "1",
+      },
+      {
+        label: "否",
+        value: "0",
+      },
+    ],
+    disabled: true,
+    itemWidth: 25,
+    style: {
+      width: "100%",
+    },
+  },
+  {
+    type: "select",
+    label: "付款方式",
+    prop: "paymentMethod",
+    data: fundsPaymentMethod.value,
+    itemWidth: 25,
+    disabled: true,
+    style: {
+      width: "100%",
+    },
+  },
+  {
+    type: "input",
+    label: "采购单号",
+    prop: "contractCode",
+    disabled: true,
+    itemWidth: 25,
+  },
+
+  {
+    type: "input",
+    itemType: "textarea",
+    label: "采购说明",
+    prop: "purchaseContent",
+    disabled: true,
+    itemWidth: 50,
+  },
+  {
+    type: "title",
+    title: "采购明细",
+  },
+  {
+    type: "slot",
+    slotName: "details",
+    label: "",
+  },
+  {
+    type: "title",
+    title: "其他费用",
+  },
+  {
+    type: "slot",
+    slotName: "otherDetails",
+    label: "",
+  },
+  {
+    type: "number",
+    prop: "freight",
+    label: "运费",
+    itemWidth: 25,
+    precision: 2,
+    min: -9999999,
+    controls: false,
+    fn: () => handleChangeAmount(),
+    style: {
+      width: "100%",
+    },
+  },
+  {
+    type: "number",
+    prop: "preferential",
+    label: "优惠",
+    itemWidth: 25,
+    precision: 2,
+    min: -9999999,
+    controls: false,
+    fn: () => handleChangeAmount(),
+    style: {
+      width: "100%",
+    },
+  },
+  {
+    type: "input",
+    prop: "amount",
+    label: "采购总金额",
+    disabled: true,
+    itemWidth: 100,
+    style: {
+      width: "25%",
+    },
+  },
+  {
+    type: "slot",
+    slotName: "fileSlot",
+    label: "附件",
+  },
+]);
+const purchaseFormRules = ref({
+  name: [{ required: true, message: "请输入费用名称", trigger: "blur" }],
+  price: [{ required: true, message: "请输入单价/金额", trigger: "blur" }],
+  freight: [{ required: true, message: "请输入运费", trigger: "blur" }],
+  preferential: [{ required: true, message: "请输入优惠", trigger: "blur" }],
+});
+const handleUpdateData = (row) => {
+  let val = row.id;
+  purchaseDialog.value = true;
+  proxy
+    .post("/purchase/detail", {
+      id: val,
+    })
+    .then((res) => {
+      let jsonData = {};
+      if (res.victoriatouristJson) {
+        jsonData = JSON.parse(res.victoriatouristJson);
+      }
+      formData.purchaseData = { ...res, ...jsonData };
+      formData.purchaseData.purchaseDetailList =
+        formData.purchaseData.purchaseDetailList.map((x) => ({
+          ...x,
+          subscribeCount: x.subscribeQuantity,
+          purchaseCount: x.purchaseQuantity,
+        }));
+    });
+  proxy.post("/fileInfo/getList", { businessIdList: [val] }).then((fileObj) => {
+    formData.purchaseData.fileList = fileObj[val] || [];
+    if (
+      formData.purchaseData.fileList &&
+      formData.purchaseData.fileList.length > 0
+    ) {
+      fileList.value = formData.purchaseData.fileList.map((item) => {
+        return {
+          raw: item,
+          name: item.fileName,
+          url: item.fileUrl,
+        };
+      });
+    }
+  });
+};
+
+// 计算采购总金额
+const handleChangeAmount = () => {
+  let sum = 0;
+  for (let i = 0; i < formData.purchaseData.purchaseDetailList.length; i++) {
+    const e = formData.purchaseData.purchaseDetailList[i];
+    // e.amount = parseFloat(e.count * e.price).toFixed(4);
+    sum += Number(e.amount);
+  }
+  for (let i = 0; i < formData.purchaseData.otherFeeList.length; i++) {
+    const e = formData.purchaseData.otherFeeList[i];
+    sum += Number(e.price);
+  }
+  sum += formData.purchaseData.freight;
+  sum += formData.purchaseData.preferential;
+  formData.purchaseData.amount = parseFloat(sum).toFixed(4);
+};
+
+const handleChangeMoney = (val, index, key) => {
+  formData.purchaseData.purchaseDetailList[index][key] = val;
+  for (let i = 0; i < formData.purchaseData.purchaseDetailList.length; i++) {
+    formData.purchaseData.purchaseDetailList[i].amount = parseFloat(
+      formData.purchaseData.purchaseDetailList[i].count *
+        formData.purchaseData.purchaseDetailList[i].price
+    ).toFixed(4);
+  }
+  handleChangeAmount();
+};
+
+const onPreviewFile = (file) => {
+  window.open(file.raw.fileUrl, "_blank");
+};
+const submitUpdate = () => {
+  purchaseDom.value.handleSubmit(() => {
+    loadingTwo.value = true;
+    const data = proxy.deepClone(formData.purchaseData);
+    const jsonData = JSON.parse(data.victoriatouristJson);
+    const victoriatouristJson = {
+      ...jsonData,
+      otherFeeList: data.otherFeeList,
+      freight: data.freight,
+      preferential: data.preferential,
+    };
+    data.victoriatouristJson = JSON.stringify(victoriatouristJson);
+    proxy.post("/purchase/edit", data).then((res) => {
+      ElMessage({
+        message: `操作成功`,
+        type: "success",
+      });
+      purchaseDialog.value = false;
+      loadingTwo.value = false;
+      getList();
+    });
+  });
+};
 </script>
   
 <style lang="scss" scoped>

+ 2 - 0
src/views/WDLY/purchaseManage/purchase/index.vue

@@ -365,6 +365,7 @@ const start = (type) => {
           flowKey: "wdly_purchase",
           ids,
           flowName: "采购申请",
+          random: proxy.random(),
         },
       });
     } else {
@@ -389,6 +390,7 @@ const start = (type) => {
         flowKey: "wdly_purchase",
         ids,
         flowName: "采购申请",
+        random: proxy.random(),
       },
     });
   }

+ 2 - 1
src/views/WDLY/purchaseManage/subscribe/index.vue

@@ -287,7 +287,8 @@ const openModal = () => {
     path: "/platform_manage/process/processApproval",
     query: {
       flowKey: "wdly_apply_purchase",
-      time: Date.now(),
+      flowName: "申购发起",
+      random: proxy.random(),
     },
   });
 };