Browse Source

新功能以及bug

cz 1 year ago
parent
commit
da1b50d13e

+ 24 - 17
src/components/byForm/index.vue

@@ -105,10 +105,12 @@
           <slot :name="i.slotName" v-else-if="i.type == 'slot'">
             {{ i.slotName }}插槽占位符
           </slot>
+
           <div class="upload" v-else-if="i.type == 'upload'">
             <el-upload :file-list="formData[i.prop]" action="https://winfaster.obs.cn-south-1.myhuaweicloud.com" :data="uploadData"
                        :list-type="i.listType ? i.listType : 'text'" :accept="i.accept?i.accept :''" :limit="i.limit?i.limit:3"
-                       :before-upload="(file)=>handleBeforeUpload(file,i.prop)" :on-success="handleSuccess" :on-preview="onPreviewFile">
+                       :before-upload="(file)=>handleBeforeUpload(file,i)" :on-success="()=>handleSuccess(i)" :on-exceed="()=>handleExceed(i)"
+                       :on-preview="onPreviewFile">
 
               <el-icon v-if="i.listType=='picture-card'">
                 <Plus />
@@ -116,6 +118,7 @@
               <el-button type="primary" plain v-else>点击上传</el-button>
             </el-upload>
           </div>
+
           <div class="upload" v-else-if="i.type == 'uploadImg'">
             <el-upload action="https://winfaster.obs.cn-south-1.myhuaweicloud.com" accept=".gif, .jpeg, .jpg, .png" :show-file-list="false"
                        :data="uploadData" :before-upload="(file)=>handleBeforeUploadOne(file,i.prop,i.imgProp)"
@@ -198,30 +201,34 @@ const formTableObj = {
 const fileList = ref([]);
 const fileListCopy = ref([]);
 const uploadData = ref({});
+const fileData = ref({});
+
 //文件上传相关方法
-const handleSuccess = (res, file, files) => {
-  emit("update:modelValue", formData.value);
+const handleSuccess = (item) => {
+  if (fileData.value && fileData.value.fileUrl) {
+    formData.value[item.prop].push({
+      id: fileData.value.id,
+      fileName: fileData.value.fileName,
+      name: fileData.value.fileName,
+      url: fileData.value.fileUrl,
+      fileUrl: fileData.value.fileUrl,
+    });
+    emit("update:modelValue", formData.value);
+  }
 };
-
-const handleBeforeUpload = async (file, prop) => {
+const handleBeforeUpload = async (file, item) => {
   const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
   uploadData.value = res.uploadBody;
-  // file.id = res.id;
-  // file.fileName = res.fileName;
-  // file.fileUrl = res.fileUrl;
-  formData.value[prop].push({
-    id: res.id,
-    fileName: res.fileName,
-    // path: res.fileUrl,
-    // url: res.fileUrl,
-    fileUrl: res.fileUrl,
-  });
-  return true;
+  fileData.value = res;
+};
+
+const handleExceed = (item) => {
+  let limit = item.limit || 3;
+  return proxy.msgTip(`上传文件数量不可大于${limit}`, 2);
 };
 const onPreviewFile = (file) => {
   if (file && file.fileUrl) window.open(file.fileUrl, "_blank");
 };
-const fileData = ref({});
 const imgLoading = ref(false);
 const handleBeforeUploadOne = async (file, prop, imgProp) => {
   imgLoading.value = true;

+ 80 - 11
src/components/process/SF/Contract.vue

@@ -149,7 +149,7 @@
                     </el-table-column>
                     <el-table-column prop="productCode" label="物料编码" width="190" />
                     <el-table-column prop="productName" label="物料名称" min-width="200" />
-                    <el-table-column label="尺寸 (cm)" width="150">
+                    <el-table-column label="尺寸 (cm)" width="130">
                       <template #default="{ row, $index }">
                         <div style="width: 100%">
                           {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
@@ -213,7 +213,7 @@
             </el-table-column>
             <el-table-column prop="productCnName" label="商品名称" min-width="130" />
             <el-table-column prop="productCode" label="商品编码" width="130" />
-            <el-table-column label="尺寸 cm*cm*cm" width="180">
+            <el-table-column label="尺寸 (cm)" width="130">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
@@ -235,14 +235,29 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column label="生产源文件" width="140">
+            <el-table-column label="生产源文件" width="210">
               <template #default="{ row, $index }">
-                <!-- <span class="el-click" v-if="!row.prodFilePath" @click="handleClickUpload('prodFilePath',false)">点击</span> -->
-                <span class="el-click" v-if="row.prodFilePath" @click="handleClickUpload('prodFilePath',false,$index)">点击上传 (查看)</span>
-                <el-button type="primary" link @click="handleClickUpload('prodFilePath',true,$index)" v-else>定制图稿</el-button>
+                <div style="width:100%">
+                  <div style="display:flex">
+                    <div class="el-click" style="writing-mode: vertical-rl" link @click="handleClickUploadOne($index)">
+                      {{row.isShowProductFile?'定制图稿':'取消定制'}}</div>
+                    <div>
+                      <div v-if="row.isShowProductFile &&row.fileListOne && row.fileListOne.length > 0">
+                        <span class="el-click" @click="onPicture(row.fileListOne[0].fileUrl)">{{row.fileListOne[0].fileName}}</span>
+                      </div>
+                      <div v-else>
+                        <el-upload action="https://winfaster.obs.cn-south-1.myhuaweicloud.com" :data="uploadData" :limit="1"
+                                   :before-upload="(file)=>handleBeforeUploadOne(file,$index)" :on-success="()=>handleSuccessOne($index)"
+                                   :on-exceed="()=>msgTip(`上传文件数量不可大于1`, 2)">
+                          <span class="el-click" style="line-height:1">点击上传</span>
+                        </el-upload>
+                      </div>
+                    </div>
+                  </div>
+                </div>
               </template>
             </el-table-column>
-            <el-table-column label="数量" width="150">
+            <el-table-column label="数量" width="110">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   <el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true"
@@ -254,7 +269,7 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column label="单价" width="180">
+            <el-table-column label="单价" width="160">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   <el-form-item :prop="'contractProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true"
@@ -421,6 +436,7 @@ import SelectContract from "@/components/contractCom/selectContract.vue";
 import SelectSample from "@/components/contractCom/selectSample.vue";
 import * as echarts from "echarts";
 import $bus from "@/bus/index.js";
+import { async } from "@antv/x6/lib/registry/marker/main";
 const route = useRoute();
 const { proxy } = getCurrentInstance();
 // 接收父组件的传值
@@ -456,7 +472,7 @@ const formData = reactive({
     contractType: "2",
     rate: 1,
     contractProductList: [],
-    companyId: companyId.value,
+    companyId: "",
     templateContent: "",
   },
 });
@@ -543,7 +559,7 @@ const formConfig = computed(() => {
       propsTreeLabel: "deptName",
       propsTreeValue: "deptId",
       itemWidth: 50,
-      disabled: companyId.value != "100" || !isEditList.value,
+      disabled: !isEditList.value,
       fn: () => {
         formData.data.contractProductList = [];
       },
@@ -1019,12 +1035,21 @@ const handleClickSelectMaterial = (index) => {
 };
 
 const contractProductBomList = ref([]);
-const selectProduct = (goods) => {
+const selectProduct = async (goods) => {
   if (goods && goods.id) {
+    let allFile = [];
     let fileUrl = "";
     if (goods.fileList && goods.fileList.length > 0) {
       fileUrl = goods.fileList[0].fileUrl;
     }
+    const fileData = await proxy.post("/fileInfo/getList", {
+      businessIdList: [goods.id],
+    });
+    if (fileData[goods.id] && fileData[goods.id].length > 0) {
+      allFile = fileData[goods.id];
+    } else {
+      allFile = [];
+    }
     proxy.post("/productBomInfo/detail", { id: goods.id }).then((res) => {
       if (res.productBomDetailList && res.productBomDetailList.length > 0) {
         contractProductBomList.value = res.productBomDetailList.map((x) => ({
@@ -1042,6 +1067,10 @@ const selectProduct = (goods) => {
           fileList: [],
           type: x.type,
         }));
+        let fileListOne = [];
+        if (allFile && allFile.length > 0) {
+          fileListOne = allFile.filter((x) => x.businessType == "2");
+        }
         formData.data.contractProductList.push({
           fileUrl: fileUrl,
           productId: goods.id,
@@ -1056,8 +1085,12 @@ const selectProduct = (goods) => {
           amount: "",
           remark: "",
           fileList: [],
+          isShowProductFile: true,
+          fileListOne: fileListOne,
+          prodFileList: [],
           contractProductBomList: contractProductBomList.value,
         });
+        fileData;
         proxy.msgTip("添加成功", 1);
         changeProductPrice();
         let ids = contractProductBomList.value.map((x) => x.materialId);
@@ -1273,6 +1306,13 @@ const handleBeforeUpload = async (file, index) => {
   return true;
 };
 
+const fileData = ref({});
+const handleBeforeUploadOne = async (file, index) => {
+  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
+  uploadData.value = res.uploadBody;
+  return true;
+};
+
 const handleSuccess = (index) => {
   if (
     formData.data.contractProductList[index].fileData &&
@@ -1287,6 +1327,18 @@ const handleSuccess = (index) => {
   }, 400);
 };
 
+const handleSuccessOne = (index) => {
+  if (fileData.value && fileData.value.fileUrl) {
+    formData.data.contractProductList[index].prodFileList.push({
+      id: fileData.value.id,
+      fileName: fileData.value.fileName,
+      name: fileData.value.fileName,
+      url: fileData.value.fileUrl,
+      fileUrl: fileData.value.fileUrl,
+    });
+  }
+};
+
 const loadingSearch = ref(false);
 const remoteMethod = (keyword) => {
   if (keyword && typeof keyword === "string") {
@@ -1385,6 +1437,14 @@ const handleClickUpload = async (att, flag, index) => {
   document.body.removeChild(a);
 };
 
+const handleClickUploadOne = (index) => {
+  formData.data.contractProductList[index].isShowProductFile =
+    !formData.data.contractProductList[index].isShowProductFile;
+  if (formData.data.contractProductList[index].isShowProductFile) {
+    formData.data.contractProductList[index].prodFileList = [];
+  }
+};
+
 const getAllData = (businessId) => {
   proxy.post("/contract/detail", { id: businessId }).then((res) => {
     res.countryId = res.buyCountryId;
@@ -1636,4 +1696,13 @@ const clickCopy = (type) => {
 .ql-editor {
   padding: 0px;
 }
+:deep(.el-upload-list) {
+  margin: 0px !important;
+  position: relative;
+  top: -8px;
+  left: -8px;
+}
+:deep(.el-upload-list--text .el-upload-list__item) {
+  min-width: 150px !important;
+}
 </style>

+ 49 - 4
src/views/EHSD/productLibrary/companyProduct/index.vue

@@ -468,11 +468,19 @@ const formConfig = computed(() => {
       itemWidth: 100,
     },
     {
-      type: "slot",
-      slotName: "productionFile",
+      type: "upload",
+      listType: "text",
+      accept: "",
+      limit: 1,
+      prop: "prodFileList",
       label: "生产文件",
-      itemWidth: 100,
     },
+    // {
+    //   type: "slot",
+    //   slotName: "productionFile",
+    //   label: "生产文件",
+    //   itemWidth: 100,
+    // },
     {
       type: "title1",
       title: "属性信息",
@@ -582,7 +590,25 @@ const getList = (req) => {
       let productIdList = res.rows.map((x) => x.id);
       // 请求文件数据并回显
       if (productIdList.length > 0) {
-        proxy.getFile(productIdList, sourceList.value.data, "id");
+        // proxy.getFile(productIdList, sourceList.value.data, "id");
+        proxy
+          .post("/fileInfo/getList", { businessIdList: productIdList })
+          .then((fileObj) => {
+            for (let i = 0; i < sourceList.value.data.length; i++) {
+              const ele = sourceList.value.data[i];
+              for (const key in fileObj) {
+                if (
+                  ele.id == key &&
+                  fileObj[ele.id] &&
+                  fileObj[ele.id].length > 0
+                ) {
+                  ele.fileList = fileObj[ele.id].filter(
+                    (x) => x.businessType == "0"
+                  );
+                }
+              }
+            }
+          });
       }
     },
     (err) => {
@@ -624,6 +650,7 @@ const openModal = () => {
     definition: "1",
     fileList: [],
     currency: "",
+    prodFileList: [],
   };
   if (currencyData.value && currencyData.value.length > 0) {
     formData.data.currency = currencyData.value[0].dictKey;
@@ -690,6 +717,24 @@ const getDtl = (row) => {
     if (formData.data.fileList.length > 0) {
       formData.data.imageUrl = formData.data.fileList[0].fileUrl;
     }
+    proxy
+      .post("/fileInfo/getList", { businessIdList: [row.id] })
+      .then((fileObj) => {
+        if (fileObj[row.id] && fileObj[row.id].length > 0) {
+          formData.data.prodFileList = fileObj[row.id]
+            .filter((x) => x.businessType == "2")
+            .map((item) => {
+              return {
+                ...item,
+                name: item.fileName,
+                url: item.fileUrl,
+              };
+            });
+        } else {
+          formData.data.prodFileList = [];
+        }
+      });
+
     dialogVisible.value = true;
   });
 };

+ 8 - 8
src/views/EHSD/saleContract/contractEHSD/index.vue

@@ -1250,14 +1250,14 @@ const moreSearchReset = () => {
 const productionFormDom = ref(null);
 const productionDialog = ref(false);
 const productionFormConfig = computed(() => [
-  {
-    type: "slot",
-    slotName: "companyName",
-    label: "报价子公司:",
-    prop: "companyName",
-    itemWidth: 100,
-    isShow: formData.data.companyName ? true : false,
-  },
+  // {
+  //   type: "slot",
+  //   slotName: "companyName",
+  //   label: "报价子公司:",
+  //   prop: "companyName",
+  //   itemWidth: 100,
+  //   isShow: formData.data.companyName ? true : false,
+  // },
   {
     type: "treeSelect",
     prop: "produceCompanyId",

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

@@ -479,23 +479,31 @@ const start = () => {
     });
   }
 };
+
 const startOne = () => {
   if (selectData.value.length > 0) {
     let rowId = selectData.value[0].subcribeId;
-    let ids = sourceList.value.data
-      .filter((x) => x.subcribeId == rowId)
-      .map((y) => y.id)
-      .join();
-    console.log(ids, "aaa");
-    proxy.$router.replace({
-      path: "/platform_manage/process/processApproval",
-      query: {
-        flowKey: "purchase_flow",
-        random: proxy.random(),
-        ids,
-        // submitType: "20",
-      },
-    });
+    proxy
+      .post("/subscribeDetail/page", {
+        pageNum: 1,
+        pageSize: 99999,
+        status: "15,30",
+      })
+      .then((res) => {
+        let data = res.rows;
+        let ids = data
+          .filter((x) => x.subcribeId == rowId)
+          .map((y) => y.id)
+          .join();
+        proxy.$router.replace({
+          path: "/platform_manage/process/processApproval",
+          query: {
+            flowKey: "purchase_flow",
+            random: proxy.random(),
+            ids,
+          },
+        });
+      });
   } else {
     return ElMessage({
       message: "请勾选数据!",

+ 13 - 14
src/views/purchaseManage/supplier/supplier/index.vue

@@ -106,6 +106,10 @@ import byForm from "@/components/byForm/index";
 import { computed, ref } from "vue";
 import selectCity from "@/components/selectCity/index.vue";
 
+const { proxy } = getCurrentInstance();
+const supplierType = computed(
+  () => proxy.useUserStore().allDict["supplier_type"]
+);
 const loading = ref(false);
 const submitLoading = ref(false);
 const sourceList = ref({
@@ -133,12 +137,11 @@ let rules = ref({
     { required: true, message: "请输入联系电话", trigger: "blur" },
   ],
 });
-const { proxy } = getCurrentInstance();
-const selectConfig = reactive([
+const selectConfig = computed(() => [
   {
     label: "供应商类型",
     prop: "type",
-    data: [],
+    data: supplierType.value,
   },
 ]);
 const config = computed(() => {
@@ -297,6 +300,12 @@ const formConfig = computed(() => {
       itemType: "text",
     },
     {
+      type: "input",
+      label: "邮编字段",
+      prop: "postalCode",
+      itemType: "text",
+    },
+    {
       type: "upload",
       listType: "text",
       accept: "",
@@ -438,17 +447,7 @@ const getCityData = (id, type, flag) => {
     }
   });
 };
-const supplierType = ref([]);
-const getDict = () => {
-  proxy.getDict(["supplier_type"]).then((res) => {
-    supplierType.value = res["supplier_type"];
-    selectConfig[0].data = supplierType.value.map((x) => ({
-      label: x.dictValue,
-      value: x.dictKey,
-    }));
-  });
-};
-getDict();
+
 getCityData("0");
 getList();
 </script>

+ 127 - 32
src/views/systemTenant/tenant/userTenant/index.vue

@@ -1,21 +1,41 @@
 <template>
-  <div class="pageIndexClass">
-    <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row :action-list="[
+  <div class="user">
+    <div class="tree">
+      <div class="treeList">
+        <div class="title commons-title">
+          组织架构
+        </div>
+        <div class="search">
+          <el-input v-model="search" placeholder="请输入搜索内容" clearable @clear="search = ''" @keyup.enter="searchChange"></el-input>
+        </div>
+        <div class="box">
+          <el-tree :data="treeData" ref="tree" node-key="deptId" @node-click="treeChange" default-expand-all :expand-on-click-node="false"
+                   :filter-node-method="filterNode">
+            <template #default="{ node, data }">
+              <div>{{data.deptName}}</div>
+            </template>
+          </el-tree>
+        </div>
+      </div>
+    </div>
+    <div class="content">
+      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row :action-list="[
         {
           text: '添加用户',
           action: () => openModal(),
         },
       ]" @get-list="getList">
-      <template #deptName="{ item }">
-        <div style="width: 100%">
-          <span v-for="(name,index) in item.deptNameList" :key="index">
-            {{name}}
-            <span v-if="index < item.deptNameList.length-1">=></span>
-          </span>
-        </div>
-      </template>
+        <template #deptName="{ item }">
+          <div style="width: 100%">
+            <span v-for="(name,index) in item.deptNameList" :key="index">
+              {{name}}
+              <span v-if="index < item.deptNameList.length-1">=></span>
+            </span>
+          </div>
+        </template>
 
-    </byTable>
+      </byTable>
+    </div>
 
     <el-dialog :title="modalType == 'add' ? '添加用户' : '编辑用户'" v-if="dialogVisible" v-model="dialogVisible" width="650" v-loading="loadingDialog">
       <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
@@ -71,7 +91,8 @@ const sourceList = ref({
     pageNum: 1,
     pageSize: 10,
     keyword: "",
-    tenantId: useUserStore().user.tenantId,
+    tenantId: proxy.useUserStore().user.tenantId,
+    deptId: "",
   },
 });
 const loading = ref(false);
@@ -211,20 +232,7 @@ const config = computed(() => {
     },
   ];
 });
-const getDict = () => {
-  proxy
-    .get("/tenantDept/list", {
-      pageNum: 1,
-      pageSize: 10000,
-      tenantId: useUserStore().user.tenantId,
-    })
-    .then((res) => {
-      deptList.value.data = proxy.handleTree(res.data, "deptId");
-      setTimeout(() => {
-        loading.value = false;
-      }, 200);
-    });
-};
+
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
@@ -239,7 +247,7 @@ const getList = async (req) => {
     }, 200);
   });
 };
-getDict();
+
 getList();
 const modalType = ref("add");
 const dialogVisible = ref(false);
@@ -348,7 +356,7 @@ const openModal = () => {
   modalType.value = "add";
   formData.data = {
     userType: 1,
-    tenantId: useUserStore().user.tenantId,
+    tenantId: proxy.useUserStore().user.tenantId,
   };
   loadingDialog.value = false;
   dialogVisible.value = true;
@@ -438,13 +446,100 @@ const changePassword = (val) => {
 const changePassword2 = (val) => {
   password.value = val.trim();
 };
+
+const treeData = ref([]);
+const search = ref("");
+const getTreeData = () => {
+  proxy
+    .get("/tenantDept/list", {
+      pageNum: 1,
+      pageSize: 9999,
+      keyword: "",
+      tenantId: proxy.useUserStore().user.tenantId,
+    })
+    .then((res) => {
+      // treeData.value = [
+      //   {
+      //     deptName: "全部",
+      //     deptId: "0",
+      //     children: proxy.handleTree(res.data, "deptId"),
+      //   },
+      // ];
+      treeData.value = proxy.handleTree(res.data, "deptId");
+      deptList.value.data = proxy.handleTree(res.data, "deptId");
+    });
+};
+getTreeData();
+
+const searchChange = () => {
+  proxy.$refs.tree.filter(search.value);
+};
+
+const getParents = (node, name, key) => {
+  if (node.parent && node.parent.data[key]) {
+    name += node.parent.data[key];
+    return getParents(node.parent, name, key);
+  }
+  return name;
+};
+// 以下可实现搜索显示子节点
+const filterNode = (value, data, node) => {
+  let names = getParents(node, node.data.deptName, "deptName");
+  let isName = names.indexOf(value) !== -1;
+  return !value || isName ? true : false;
+};
+
+const treeChange = (e, data) => {
+  sourceList.value.pagination.deptId = e.deptId;
+  getList();
+};
 </script>
 
 <style lang="scss" scoped>
-.tenant {
-  padding: 20px;
+.user {
+  padding: 10px;
+  display: flex;
+  justify-content: space-between;
+  .tree {
+    width: 300px;
+  }
+  .content {
+    width: calc(100% - 310px);
+  }
 }
-::v-deep(.el-input-number .el-input__inner) {
-  text-align: left;
+.treeList {
+  display: block;
+  height: 100%;
+  background: #fff;
+  padding: 10px 15px 15px;
+  height: calc(100vh - 122px);
+
+  .search {
+    display: flex;
+    margin-bottom: 20px;
+    .el-input {
+      // width: calc(100% - 70px);
+      margin-right: 10px;
+      text-align: center;
+    }
+  }
+  // .searh,.title,.box{
+  //   padding-left:20px ;
+  // }
+  .box {
+    padding-right: 0px;
+    height: calc(100vh - 245px);
+    overflow-y: auto;
+    overflow-x: auto;
+    .el-tree {
+      // .el-tree-node__content {
+      //   display: block;
+      // }
+
+      .el-tree-node > .el-tree-node__children {
+        overflow: visible;
+      }
+    }
+  }
 }
 </style>