cz 1 gadu atpakaļ
vecāks
revīzija
0bd76b21c4

+ 79 - 1
src/components/process/SF/Purchase.vue

@@ -343,6 +343,7 @@ const copyType = ref(1);
 const copyContract = ref(false);
 const formData = reactive({
   data: {
+    purchaseProductList: [],
     remark: "",
   },
 });
@@ -432,6 +433,9 @@ const formConfig = computed(() => {
       border: true,
       data: deliveryType.value,
       itemWidth: 50,
+      fn: () => {
+        changeAddress();
+      },
     },
     {
       type: "input",
@@ -590,6 +594,74 @@ const getDict = () => {
       });
     });
 };
+
+const changeAddress = () => {
+  if (formData.data.deliveryType === "1") {
+    let buyCountryName = "";
+    if (formData.data.buyCountryName) {
+      buyCountryName = formData.data.buyCountryName;
+    }
+    let buyProvinceName = "";
+    if (formData.data.buyProvinceName) {
+      buyProvinceName = formData.data.buyProvinceName;
+    }
+    let buyCityName = "";
+    if (formData.data.buyCityName) {
+      buyCityName = formData.data.buyCityName;
+    }
+    let buyAddress = "";
+    if (formData.data.buyAddress) {
+      buyAddress = formData.data.buyAddress;
+    }
+    formData.data.address =
+      buyCountryName +
+      ", " +
+      buyProvinceName +
+      ", " +
+      buyCityName +
+      "," +
+      buyAddress;
+  } else if (formData.data.deliveryType === "2") {
+    let countryName = "";
+    if (formData.data.countryId) {
+      let data = countryData.value.filter(
+        (item) => item.id === formData.data.countryId
+      );
+      if (data && data.length > 0) countryName = data[0].chineseName;
+    }
+    let provinceName = "";
+    if (formData.data.provinceId) {
+      let data = provinceData.value.filter(
+        (item) => item.id === formData.data.provinceId
+      );
+      if (data && data.length > 0) provinceName = data[0].name;
+    } else {
+      if (formData.data.provinceName) {
+        provinceName = formData.data.provinceName;
+      }
+    }
+    let cityName = "";
+    if (formData.data.cityId) {
+      let data = cityData.value.filter(
+        (item) => item.id === formData.data.cityId
+      );
+      if (data && data.length > 0) cityName = data[0].name;
+    } else {
+      if (formData.data.cityName) {
+        cityName = formData.data.cityName;
+      }
+    }
+    let sellAddress = "";
+    if (formData.data.sellAddress) {
+      sellAddress = formData.data.sellAddress;
+    }
+    formData.data.address =
+      countryName + ", " + provinceName + ", " + cityName + "," + sellAddress;
+  } else if (formData.data.deliveryType === "3") {
+    formData.data.address = "";
+  }
+};
+
 const getCityData = (id, type, isChange) => {
   proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
     if (type === "20") {
@@ -621,6 +693,7 @@ const buyCorporationIdChange = (val) => {
       formData.data.buyProvinceName = res.provinceName;
       formData.data.buyCityName = res.cityName;
       formData.data.buyAddress = res.address;
+      changeAddress();
     });
   }
 };
@@ -648,6 +721,7 @@ const changeSupplier = (val) => {
       if (formData.data.provinceId) {
         getCityData(formData.data.provinceId, "30");
       }
+      setTimeout(() => changeAddress(), 1500);
     }
   }
 };
@@ -921,7 +995,11 @@ const getProductList = (ids) => {
         });
         formData.data.dataResource =
           formData.data.purchaseProductList[0].dataResource;
-        formData.data.dataResourceId = res[0].contractId;
+        if (formData.data.purchaseProductList[0].dataType == 0) {
+          formData.data.dataResourceId = res[0].subscribeId;
+        } else {
+          formData.data.dataResourceId = res[0].contractId;
+        }
         let productIdList = res.map((x) => x.productId);
         proxy
           .post("/fileInfo/getList", {

+ 233 - 0
src/components/process/SF/Subscribe.vue

@@ -0,0 +1,233 @@
+<template>
+  <div style="width: 100%; padding: 0px 15px">
+    <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom">
+
+      <template #commodity>
+        <div style="width: 100%">
+          <el-button type="primary" plain @click="openProduct = true" style="margin-bottom: 16px" v-if="!judgeStatus()">
+            选择物料
+          </el-button>
+          <el-table :data="formData.data.subscribeDetailList" style="width: 100%; ">
+            <el-table-column prop="productCode" label="物料编码" width="130" />
+            <el-table-column prop="productName" label="商品名称" min-width="130" />
+            <el-table-column label="尺寸 cm*cm*cm" width="180">
+              <template #default="{ row, $index }">
+                <div style="width: 100%">
+                  {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column prop="productUnit" label="单位" width="100" :formatter="(row) => dictKeyValue(row.productUnit, materialUnit)" />
+            <el-table-column label="申购数量" width="150">
+              <template #default="{ row, $index }">
+                <div style="width: 100%">
+                  <el-form-item :prop="'subscribeDetailList.' + $index + '.count'" :rules="rules.count" :inline-message="true"
+                                class="margin-b-0 wid100">
+                    <el-input-number onmousewheel="return false;" v-model="row.count" placeholder="请输入" style="width: 100%" :precision="0"
+                                     :controls="false" :min="0" />
+                  </el-form-item>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="备注">
+              <template #default="{ row, $index }">
+                <div style="width: 100%">
+                  <el-form-item :prop="'subscribeDetailList.' + $index + '.remark'" :rules="rules.remark" :inline-message="true"
+                                class="margin-b-0 wid100">
+                    <el-input onmousewheel="return false;" v-model="row.remark" placeholder="请输入" style="width: 100%" />
+                  </el-form-item>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" width="80" align="center" fixed="right" v-if="!judgeStatus()">
+              <template #default="{ $index }">
+                <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="90%" append-to-body>
+      <SelectMaterial @selectMaterial="selectMaterial"></SelectMaterial>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import byForm from "@/components/byForm/index";
+import SelectMaterial from "@/components/product/SelectMaterial.vue";
+import { useRoute } from "vue-router";
+const { proxy } = getCurrentInstance();
+const route = useRoute();
+// 接收父组件的传值
+const props = defineProps({
+  queryData: Object,
+});
+const openProduct = ref(false);
+const materialUnit = computed(
+  () => proxy.useUserStore().allDict["material_unit"]
+);
+const formData = reactive({
+  data: {
+    subscribeDetailList: [],
+  },
+});
+const formDom = ref(null);
+const judgeStatus = () => {
+  if (route.query.processType == 20 || route.query.processType == 10) {
+    return true;
+  }
+  if (props.queryData.recordList && props.queryData.recordList.length > 0) {
+    let data = props.queryData.recordList.filter(
+      (item) => item.status === 2 && item.nodeType !== 1
+    );
+    if (data && data.length > 0) {
+      return true;
+    }
+  }
+  return false;
+};
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  disabled: false,
+});
+const formConfig = computed(() => {
+  return [
+    {
+      type: "title",
+      title: "申购信息",
+      haveLine: false,
+    },
+    {
+      type: "input",
+      prop: "deptName",
+      label: "申购部门",
+      itemWidth: 33.33,
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "subcribeName",
+      label: "申购人",
+      itemWidth: 33.33,
+      disabled: true,
+    },
+    {
+      type: "date",
+      prop: "subcribeTime",
+      itemType: "date",
+      label: "申时间",
+      itemWidth: 33.33,
+      disabled: false,
+    },
+    {
+      type: "input",
+      prop: "subcribeContent",
+      itemType: "textarea",
+      label: "申购说明",
+      itemWidth: 100,
+      disabled: false,
+    },
+    {
+      type: "title",
+      title: "申购明细",
+      haveLine: true,
+    },
+    {
+      type: "slot",
+      slotName: "commodity",
+      label: "",
+    },
+  ];
+});
+
+const rules = ref({
+  deptName: [{ required: true, message: "请输入申购部门", trigger: "blur" }],
+  subcribeName: [
+    { required: true, message: "请输入申购人名称", trigger: "blur" },
+  ],
+  subcribeTime: [
+    { required: true, message: "请选择申购时间", trigger: "change" },
+  ],
+  count: [{ required: true, message: "请输入申购数量", trigger: "blur" }],
+});
+
+const selectMaterial = (row) => {
+  let flag = formData.data.subscribeDetailList.some(
+    (x) => x.productId == row.id
+  );
+  if (!flag) {
+    formData.data.subscribeDetailList.push({
+      productId: row.id,
+      productCode: row.customCode,
+      productName: row.name,
+      productUnit: row.unit,
+      productLength: row["length"],
+      productWidth: row.width,
+      productHeight: row.height,
+      count: null,
+      remark: "",
+    });
+    proxy.msgTip("选择成功");
+  } else {
+    proxy.msgTip("该物料已选择", 2);
+  }
+};
+
+const handleRemove = (index) => {
+  formData.data.subscribeDetailList.splice(index, 1);
+};
+
+const handleSubmit = async () => {
+  let flag = await formDom.value.handleSubmit(() => {});
+  if (flag) {
+    if (
+      formData.data.subscribeDetailList &&
+      formData.data.subscribeDetailList.length > 0
+    ) {
+      return true;
+    } else {
+      proxy.msgTip("请添加申购明细", 2);
+      return false;
+    }
+  } else {
+    setTimeout(() => {
+      const errorDiv = document.getElementsByClassName("is-error");
+      errorDiv[0].scrollIntoView();
+    }, 0);
+  }
+  return flag;
+};
+
+const getFormData = () => {
+  return proxy.deepClone(formData.data);
+};
+// 向父组件暴露
+defineExpose({
+  getFormData,
+  handleSubmit,
+});
+
+const getAllData = (businessId) => {
+  if (businessId) {
+    proxy.post("/subscribe/detail", { id: businessId }).then((res) => {
+      formData.data = res;
+    });
+  }
+};
+onMounted(() => {
+  formOption.disabled = judgeStatus();
+  formData.data.subcribeTime = proxy.parseTime(new Date());
+  formData.data.deptName = proxy.useUserStore().user.dept.deptName;
+  formData.data.subcribeName = proxy.useUserStore().user.nickName;
+  if (route.query.businessId && route.query.processType) {
+    getAllData(route.query.businessId);
+  }
+});
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 5 - 2
src/views/process/processApproval/index.vue

@@ -33,8 +33,9 @@
         </template>
 
         <!-- 申购 -->
-        <SendSubscribe ref="makeDom" @auxiliaryChange="(e) => getAuxiliaryData(e)" v-else-if="flowForm.flowKey == 'subscribe_flow'"
-                       :queryData="queryData.data"></SendSubscribe>
+        <!-- <SendSubscribe ref="makeDom" @auxiliaryChange="(e) => getAuxiliaryData(e)" v-else-if="flowForm.flowKey == 'subscribe_flow'"
+                       :queryData="queryData.data"></SendSubscribe> -->
+        <Subscribe ref="makeDom" :queryData="queryData.data" v-else-if="flowForm.flowKey == 'subscribe_flow'"></Subscribe>
 
         <!-- 样品单采购、交接单采购 -->
         <template v-else-if="flowForm.flowKey == 'ehsd_purchase_flow'">
@@ -220,6 +221,8 @@ import { useRouter, useRoute } from "vue-router";
 import Contract from "@/components/process/SF/Contract";
 import PriceSheet from "@/components/process/SF/PriceSheet";
 import Purchase from "@/components/process/SF/Purchase";
+import Subscribe from "@/components/process/SF/Subscribe";
+
 // 消息提示
 import { ElMessage, ElMessageBox } from "element-plus";
 //决策辅助

+ 33 - 33
src/views/purchaseManage/purchaseManage/purchase/index.vue

@@ -19,6 +19,14 @@
             {{ item.fileName }}
           </div>
         </template>
+        <template #size="{ item }">
+          <div v-if="item.productLength && item.productWidth && item.productHeight">
+            <span>{{ item.productLength }}cm</span>*
+            <span>{{ item.productWidth }}cm</span>*
+            <span>{{ item.productHeight }}cm</span>
+          </div>
+          <div v-else></div>
+        </template>
       </byTable>
     </div>
     <el-dialog :title="modalType == 'add' ? '添加供应商' : '编辑供应商'" v-model="dialogVisible" width="800" v-loading="loading">
@@ -97,9 +105,12 @@
 import { ElMessage, ElMessageBox } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
-import { computed, defineComponent, ref } from "vue";
-import { getToken } from "@/utils/auth";
 
+import { getToken } from "@/utils/auth";
+const { proxy } = getCurrentInstance();
+const materialUnit = computed(
+  () => proxy.useUserStore().allDict["material_unit"]
+);
 const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
 const headers = ref({ Authorization: "Bearer " + getToken() });
 const uploadData = ref({});
@@ -120,7 +131,6 @@ let fileList = ref([]);
 let rules = ref({
   name: [{ required: true, message: "请输入供应商名称", trigger: "blur" }],
 });
-const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
   {
     label: "状态",
@@ -143,73 +153,68 @@ const config = computed(() => {
       type: "selection",
       attrs: {
         checkAtt: "isCheck",
+        width: 60,
       },
     },
+
     {
       attrs: {
-        label: "归属公司",
-        prop: "corporationName",
-      },
-    },
-    {
-      attrs: {
-        label: "申购单号",
+        label: "单号",
         prop: "subscribeCode",
-      },
-    },
-    {
-      attrs: {
-        label: "物品类型",
-        prop: "productDefinition",
-      },
-      render(productDefinition) {
-        return productDefinition == 1 ? "产品" : "物料";
+        width: 150,
       },
     },
 
     {
       attrs: {
-        label: "物编码",
+        label: "物料编码",
         prop: "productCode",
+        width: 130,
       },
     },
     {
       attrs: {
-        label: "物名称",
+        label: "物名称",
         prop: "productName",
+        "min-width": 130,
       },
     },
     {
       attrs: {
-        label: "规格",
-        prop: "productSpec",
+        label: "尺寸",
+        slot: "size",
+        width: 180,
       },
     },
     {
       attrs: {
         label: "单位",
         prop: "productUnit",
+        width: 80,
       },
       render(unit) {
-        return proxy.dictKeyValue(unit, productUnit.value);
+        return proxy.dictKeyValue(unit, materialUnit.value);
       },
     },
     {
       attrs: {
-        label: "购数量",
+        label: "购数量",
         prop: "count",
+        width: 100,
       },
     },
     {
       attrs: {
         label: "已采购数量",
         prop: "purchaseCount",
+        width: 100,
       },
     },
     {
       attrs: {
         label: "采购状态",
         prop: "status",
+        width: 100,
       },
       render(status) {
         return status == 15 ? "待采购" : "部分采购";
@@ -219,18 +224,20 @@ const config = computed(() => {
       attrs: {
         label: "申购人",
         prop: "subcribeName",
+        width: 100,
       },
     },
     {
       attrs: {
         label: "申购时间",
         prop: "subcribeTime",
+        width: 160,
       },
     },
     {
       attrs: {
         label: "操作",
-        width: "100",
+        width: "80",
         align: "center",
       },
       // 渲染 el-button,一般用在最后一列。
@@ -420,14 +427,7 @@ const selectData = ref([]);
 const selectRow = (data) => {
   selectData.value = data;
 };
-const productUnit = ref([]);
 
-const getDict = () => {
-  proxy.getDictOne(["unit"]).then((res) => {
-    productUnit.value = res["unit"];
-  });
-};
-getDict();
 // 监听选中的值,并动态更新是否可选中
 watch(selectData, (newVal, oldVal) => {
   if (newVal.length == 0) {

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

@@ -16,6 +16,14 @@
             {{ item.fileName }}
           </div>
         </template>
+        <template #size="{ item }">
+          <div v-if="item.productLength && item.productWidth && item.productHeight">
+            <span>{{ item.productLength }}cm</span>*
+            <span>{{ item.productWidth }}cm</span>*
+            <span>{{ item.productHeight }}cm</span>
+          </div>
+          <div v-else></div>
+        </template>
       </byTable>
     </div>
     <el-dialog :title="modalType == 'add' ? '添加供应商' : '编辑供应商'" v-model="dialogVisible" width="800" v-loading="loading">
@@ -191,9 +199,16 @@ const config = computed(() => {
     },
     {
       attrs: {
+        label: "尺寸",
+        slot: "size",
+        width: 180,
+      },
+    },
+    {
+      attrs: {
         label: "单位",
         prop: "productUnit",
-        width: 60,
+        width: 80,
       },
       render(unit) {
         return proxy.dictKeyValue(unit, materialUnit.value);
@@ -210,6 +225,7 @@ const config = computed(() => {
       attrs: {
         label: "采购状态",
         prop: "status",
+        width: 100,
       },
       render(status) {
         return statusData.value.find((x) => x.value == status).label;
@@ -217,7 +233,7 @@ const config = computed(() => {
     },
     {
       attrs: {
-        label: "申购原因",
+        label: "申购说明",
         prop: "subscribeContent",
       },
     },