lxf 1 year ago
parent
commit
659369fbff

+ 1 - 1
src/assets/styles/index.scss

@@ -197,7 +197,7 @@ aside {
 .commons-title {
 .commons-title {
   font-size: 14px;
   font-size: 14px;
   font-weight: bold;
   font-weight: bold;
-  margin-bottom: 20px;
+  margin-bottom: 10px;
   padding-left: 20px;
   padding-left: 20px;
   position: relative;
   position: relative;
 }
 }

+ 127 - 0
src/components/process/subscribe.vue

@@ -0,0 +1,127 @@
+<template>
+  <div>
+    <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit"> </byForm>
+  </div>
+</template>
+
+<script setup>
+import byForm from "@/components/byForm/index";
+import { useRoute } from "vue-router";
+// import { ElMessage } from "element-plus";
+
+const route = useRoute();
+// 接收父组件的传值
+const props = defineProps({
+  queryData: Object,
+});
+const { proxy } = getCurrentInstance();
+const formData = reactive({
+  data: {},
+});
+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,
+  rules: [],
+  disabled: false,
+});
+const formConfig = computed(() => {
+  return [
+    {
+      type: "title",
+      title: "申购单",
+      label: "",
+    },
+    {
+      type: "title",
+      title: "申购清单",
+      label: "",
+    },
+  ];
+});
+const rules = ref({
+  countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
+  sellAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
+});
+const handleSubmit = async (flag) => {
+  if (flag) {
+    return true;
+  } else {
+    let status = await proxy.$refs.submit.handleSubmit(() => {});
+    if (status) {
+      // if (!(formData.data.contractProductList && formData.data.contractProductList.length > 0)) {
+      //   ElMessage("请添加至少一件商品");
+      //   return false;
+      // }
+      // if (formData.data.contractShipmentList && formData.data.contractShipmentList.length > 0) {
+      //   for (let i = 0; i < formData.data.contractProductList.length; i++) {
+      //     let data = formData.data.contractShipmentList.filter((item) => item.productId === formData.data.contractProductList[i].productId);
+      //     if (data && data.length > 0) {
+      //       let quantity = 0;
+      //       for (let j = 0; j < data.length; j++) {
+      //         quantity = parseFloat(Number(quantity) + Number(data[j].quantity));
+      //       }
+      //       if (quantity > formData.data.contractProductList[i].quantity) {
+      //         ElMessage("出货数量不能大于商品数量");
+      //         return false;
+      //       }
+      //     }
+      //   }
+      // }
+      return true;
+    } else {
+      setTimeout(() => {
+        const errorDiv = document.getElementsByClassName("is-error");
+        errorDiv[0].scrollIntoView();
+      }, 0);
+    }
+    return false;
+  }
+};
+const getFormData = () => {
+  return proxy.deepClone(formData.data);
+};
+watch(
+  () => props.queryData,
+  (newValue) => {
+    console.log(proxy.deepClone(newValue));
+    // formOption.disabled = judgeStatus();
+    // if (props.queryData && ["10", "20", "30"].includes(route.query.processType)) {
+    //   for (var text in props.queryData) {
+    //     formData.data[text] = props.queryData[text];
+    //   }
+    //   if (formData.data.countryId) {
+    //     getCityData(formData.data.countryId, "20");
+    //   }
+    //   if (formData.data.provinceId) {
+    //     getCityData(formData.data.provinceId, "30");
+    //   }
+    //   getDecisionAids();
+    // }
+  },
+  {
+    deep: true,
+  }
+);
+onMounted(() => {});
+// 向父组件暴露
+defineExpose({ getFormData, handleSubmit });
+</script>
+
+<style lang="scss" scoped>
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+</style>

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

@@ -6,7 +6,7 @@
           {{ route.query.flowName ? route.query.flowName : "流程标题(发起)" }}
           {{ route.query.flowName ? route.query.flowName : "流程标题(发起)" }}
         </div>
         </div>
         <div class="line"></div>
         <div class="line"></div>
-        
+        <Subscribe ref="makeDom"></Subscribe>
       </div>
       </div>
       <div class="bottom" v-if="route.query.processType != 20">
       <div class="bottom" v-if="route.query.processType != 20">
         <div class="commons-title title">处理意见</div>
         <div class="commons-title title">处理意见</div>
@@ -85,6 +85,8 @@
 import useTagsViewStore from "@/store/modules/tagsView.js";
 import useTagsViewStore from "@/store/modules/tagsView.js";
 import { useRouter, useRoute } from "vue-router";
 import { useRouter, useRoute } from "vue-router";
 import { ElMessage } from "element-plus";
 import { ElMessage } from "element-plus";
+// 申购单
+import Subscribe from "@/components/process/subscribe";
 
 
 const router = useRouter();
 const router = useRouter();
 const route = useRoute();
 const route = useRoute();
@@ -105,7 +107,6 @@ const flowRules = reactive({
 });
 });
 //组件实例
 //组件实例
 const { proxy } = getCurrentInstance();
 const { proxy } = getCurrentInstance();
-const makeDom = ref(null);
 const flowFormDom = ref(null);
 const flowFormDom = ref(null);
 let dialogVisible = ref(false);
 let dialogVisible = ref(false);
 const nextHandleUser = ref([]);
 const nextHandleUser = ref([]);
@@ -130,12 +131,12 @@ const handleResult = (res) => {
 const handleSubmit = async (_type) => {
 const handleSubmit = async (_type) => {
   try {
   try {
     // 调用发起组件的提交事件
     // 调用发起组件的提交事件
-    const flag = await makeDom.value.handleSubmit();
+    const flag = await proxy.$refs.makeDom.handleSubmit();
     if (flag) {
     if (flag) {
       flowFormDom.value.validate((valid) => {
       flowFormDom.value.validate((valid) => {
         btnLoading.value = true;
         btnLoading.value = true;
         if (valid) {
         if (valid) {
-          const data = { ...makeDom.value.getFormData() };
+          const data = { ...proxy.$refs.makeDom.getFormData() };
           // flowForm.fileList = flowForm.fileList.map((item) => {
           // flowForm.fileList = flowForm.fileList.map((item) => {
           //   return {
           //   return {
           //     ...item,
           //     ...item,
@@ -290,7 +291,7 @@ onMounted(async () => {
       padding: 20px;
       padding: 20px;
       .line {
       .line {
         border-bottom: 1px solid #ddd;
         border-bottom: 1px solid #ddd;
-        margin-bottom: 20px;
+        margin-bottom: 10px;
       }
       }
     }
     }
     .bottom {
     .bottom {