Prechádzať zdrojové kódy

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!67
黄梓星 2 rokov pred
rodič
commit
1d2a692879

+ 8 - 0
src/api/business/purchase/contract.js

@@ -24,6 +24,14 @@ export function EXPORT(data) {
   });
 }
 
+export function IMPORT(params) {
+  return request({
+    url: "/pu/contract/importData",
+    method: "GET",
+    params: params,
+  });
+}
+
 export function EDIT(data) {
   return request({
     url: "/pu/contract/edit",

+ 48 - 17
src/components/FileUpload/index.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="upload-file">
     <el-upload
+      drag
       multiple
       :action="uploadFileUrl"
       :before-upload="handleBeforeUpload"
@@ -15,7 +16,12 @@
       ref="fileUpload"
     >
       <!-- 上传按钮 -->
-      <el-button size="mini" type="primary">选取文件</el-button>
+      <!-- <el-button size="mini" type="primary">选取文件</el-button> -->
+      <i class="el-icon-upload"></i>
+      <div class="el-upload__text">
+        将文件拖到此处,或
+        <em>点击上传</em>
+      </div>
       <!-- 上传提示 -->
       <div class="el-upload__tip" slot="tip" v-if="showTip">
         请上传
@@ -41,11 +47,12 @@
         v-for="(file, index) in fileList"
       >
         <el-link
-          :href="`${baseUrl}${file.url}`"
+          :href="`${baseUrl}?id=${file.id}`"
           :underline="false"
           target="_blank"
         >
-          <span class="el-icon-document"> {{ getFileName(file.name) }} </span>
+          <!-- <span class="el-icon-document"> {{ getFileName(file.name) }} </span> -->
+          <span class="el-icon-document"> {{ file.name }} </span>
         </el-link>
         <div class="ele-upload-list__item-content-action">
           <el-link :underline="false" @click="handleDelete(index)" type="danger"
@@ -89,9 +96,10 @@ export default {
   data() {
     return {
       number: 0,
+      separator: ";",
       uploadList: [],
-      baseUrl: process.env.VUE_APP_BASE_API,
-      uploadFileUrl: process.env.VUE_APP_BASE_API + "/pu/contract/upload", // 上传文件服务器地址
+      baseUrl: "https://sy.derom.com/document-center/fastdfs/download",
+      uploadFileUrl: "/drp-file/document-center/fastdfs/upload",
       headers: {
         Authorization: "Bearer " + getToken(),
       },
@@ -104,15 +112,27 @@ export default {
         if (val) {
           let temp = 1;
           // 首先将值转为数组
-          const list = Array.isArray(val) ? val : this.value.split(",");
-          console.log("list", list);
+          const list = Array.isArray(val)
+            ? val
+            : this.value.split(this.separator);
           // 然后将数组转为对象数组
+          // this.fileList = list.map((item) => {
+          //   if (typeof item === "string") {
+          //     item = { name: item, url: item };
+          //   }
+          //   item.uid = item.uid || new Date().getTime() + temp++;
+          //   return item;
+          // });
           this.fileList = list.map((item) => {
-            if (typeof item === "string") {
-              item = { name: item, url: item };
-            }
-            item.uid = item.uid || new Date().getTime() + temp++;
-            return item;
+            item = JSON.parse(item);
+            console.log({
+              ...item,
+              uid: item.uid || new Date().getTime() + temp++,
+            });
+            return {
+              ...item,
+              uid: item.uid || new Date().getTime() + temp++,
+            };
           });
         } else {
           this.fileList = [];
@@ -167,8 +187,12 @@ export default {
     },
     // 上传成功回调
     handleUploadSuccess(res, file) {
-      if (res.code === 200) {
-        this.uploadList.push({ name: res.fileName, url: res.fileName });
+      if (res.code * 1 === 200) {
+        this.uploadList.push({
+          id: res.id,
+          url: res.filepath,
+          name: res.filename,
+        });
         this.uploadedSuccessfully();
       } else {
         this.number--;
@@ -181,7 +205,7 @@ export default {
     // 删除文件
     handleDelete(index) {
       this.fileList.splice(index, 1);
-      this.$emit("input", this.listToString(this.fileList));
+      this.$emit("input", this.listToString(this.fileList, this.separator));
     },
     // 上传结束处理
     uploadedSuccessfully() {
@@ -189,7 +213,7 @@ export default {
         this.fileList = this.fileList.concat(this.uploadList);
         this.uploadList = [];
         this.number = 0;
-        this.$emit("input", this.listToString(this.fileList));
+        this.$emit("input", this.listToString(this.fileList, this.separator));
         this.$modal.closeLoading();
       }
     },
@@ -203,10 +227,17 @@ export default {
     },
     // 对象转成指定字符串分隔
     listToString(list, separator) {
+      list = list.map((file) =>
+        JSON.stringify({
+          id: file.id,
+          url: file.url,
+          name: file.name,
+        })
+      );
       let strs = "";
       separator = separator || ",";
       for (let i in list) {
-        strs += list[i].url + separator;
+        strs += list[i] + separator;
       }
       return strs != "" ? strs.substr(0, strs.length - 1) : "";
     },

+ 16 - 9
src/components/Refers/refers.vue

@@ -18,14 +18,11 @@
           </el-header>
           <el-main>
             <el-table :data="dataList" v-loading="loading" size="small" border ref="contractTable"
-              @select="handleSelectionChange" @row-click="rowSelect" height="calc(100% - 40px)" style="width: 100%">
-              <el-table-column type="selection" header-align="center" align="center" width="50">
-              </el-table-column>
-              <el-table-column prop="id" header-align="center" align="center" sortable="custom" min-width="90" label="id">
-              </el-table-column>
-              <el-table-column prop="name" header-align="center" align="center" sortable="custom" min-width="90"
-                label="名称">
-              </el-table-column>
+              @select="handleSelectionChange" @row-click="rowSelect" height="calc(100% - 40px)">
+              <el-table-column type="selection" header-align="center" align="center" width="50"/>
+              <el-table-column prop="id" header-align="center" align="center" min-width="90" label="id"/>
+              <el-table-column prop="name" header-align="center" align="center" min-width="90" label="名称"/>
+              <el-table-column v-if="orgName" prop="orgName" header-align="center" align="center" min-width="90" label="所属组织"/>
             </el-table>
             <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
               :current-page="searchForm.pageNo" :page-sizes="[5, 10, 15, 20]" :page-size="searchForm.pageSize"
@@ -57,6 +54,7 @@ export default {
       idKey: "id", // 标识列表数据中每一行的唯一键的名称(需要按自己的数据改一下)
       dataList: [],
       total: 0,
+      orgName: false,
       orders: [],
       loading: false,
       visible: false,
@@ -94,6 +92,11 @@ export default {
         console.log('res', res)
         this.dataList = res.rows;
         this.total = res.total
+        if(res.rows[0].orgName) {
+          this.orgName = true
+        } else {
+          this.orgName = false
+        }
         this.loading = false;
         this.$nextTick(() => {
           this.setSelectRow();
@@ -151,7 +154,7 @@ export default {
   },
 };
 </script>
-<style lang="scss">
+<style lang="scss" scoped>
 .userDialog {
   .el-dialog__body {
     padding: 10px 0px 0px 10px;
@@ -168,4 +171,8 @@ export default {
     }
   }
 }
+::v-deep .el-table__header-wrapper .el-checkbox {
+  // display: none;//设置不成功,页面卡顿
+  visibility: hidden;
+}
 </style>

+ 1 - 4
src/components/popover-select/index.vue

@@ -137,10 +137,7 @@ export default {
         if (code === 200) {
           this.data = rows;
           this.page.total = total;
-          this.$notify.success({ title: msg });
-        } else {
-          this.$notify.warning({ title: msg });
-        }
+        } 
       } catch (err) {
         //
       } finally {

+ 40 - 0
src/utils/request.js

@@ -128,6 +128,7 @@ service.interceptors.response.use(
       // Message({ message: msg, type: "warning" });
       return Promise.reject("error");
     } else if (code !== 200) {
+      console.log("code", code);
       Notification.error({ title: msg });
       return Promise.reject("error");
     } else {
@@ -188,4 +189,43 @@ export function download(url, params, filename, config) {
     });
 }
 
+// // 通用上传方法
+// export function upload(url, params, filename, config) {
+//   downloadLoadingInstance = Loading.service({
+//     text: "正在上传数据,请稍候",
+//     spinner: "el-icon-loading",
+//     background: "rgba(255, 255, 255, 0.7)",
+//   });
+//   return service
+//     .post(url, params, {
+//       transformRequest: [
+//         (params) => {
+//           return tansParams(params);
+//         },
+//       ],
+//       headers: { "Content-Type": "application/x-www-form-urlencoded" },
+//       responseType: "blob",
+//       ...config,
+//     })
+//     .then(async (data) => {
+//       const isBlob = blobValidate(data);
+//       if (isBlob) {
+//         const blob = new Blob([data]);
+//         saveAs(blob, filename);
+//       } else {
+//         const resText = await data.text();
+//         const rspObj = JSON.parse(resText);
+//         const errMsg =
+//           errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
+//         Message.error(errMsg);
+//       }
+//       downloadLoadingInstance.close();
+//     })
+//     .catch((r) => {
+//       console.error(r);
+//       Message.error("下载文件出现错误,请联系管理员!");
+//       downloadLoadingInstance.close();
+//     });
+// }
+
 export default service;

+ 68 - 54
src/utils/ruoyi.js

@@ -1,5 +1,3 @@
-
-
 /**
  * 通用js方法封装处理
  * Copyright (c) 2019 ruoyi
@@ -8,22 +6,25 @@
 // 日期格式化
 export function parseTime(time, pattern) {
   if (arguments.length === 0 || !time) {
-    return null
+    return null;
   }
-  const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
-  let date
-  if (typeof time === 'object') {
-    date = time
+  const format = pattern || "{y}-{m}-{d} {h}:{i}:{s}";
+  let date;
+  if (typeof time === "object") {
+    date = time;
   } else {
-    if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
-      time = parseInt(time)
-    } else if (typeof time === 'string') {
-      time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '');
+    if (typeof time === "string" && /^[0-9]+$/.test(time)) {
+      time = parseInt(time);
+    } else if (typeof time === "string") {
+      time = time
+        .replace(new RegExp(/-/gm), "/")
+        .replace("T", " ")
+        .replace(new RegExp(/\.[\d]{3}/gm), "");
     }
-    if ((typeof time === 'number') && (time.toString().length === 10)) {
-      time = time * 1000
+    if (typeof time === "number" && time.toString().length === 10) {
+      time = time * 1000;
     }
-    date = new Date(time)
+    date = new Date(time);
   }
   const formatObj = {
     y: date.getFullYear(),
@@ -32,18 +33,20 @@ export function parseTime(time, pattern) {
     h: date.getHours(),
     i: date.getMinutes(),
     s: date.getSeconds(),
-    a: date.getDay()
-  }
+    a: date.getDay(),
+  };
   const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
-    let value = formatObj[key]
+    let value = formatObj[key];
     // Note: getDay() returns 0 on Sunday
-    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
+    if (key === "a") {
+      return ["日", "一", "二", "三", "四", "五", "六"][value];
+    }
     if (result.length > 0 && value < 10) {
-      value = '0' + value
+      value = "0" + value;
     }
-    return value || 0
-  })
-  return time_str
+    return value || 0;
+  });
+  return time_str;
 }
 
 // 表单重置
@@ -56,14 +59,19 @@ export function resetForm(refName) {
 // 添加日期范围
 export function addDateRange(params, dateRange, propName) {
   let search = params;
-  search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
+  search.params =
+    typeof search.params === "object" &&
+    search.params !== null &&
+    !Array.isArray(search.params)
+      ? search.params
+      : {};
   dateRange = Array.isArray(dateRange) ? dateRange : [];
-  if (typeof (propName) === 'undefined') {
-    search.params['beginTime'] = dateRange[0];
-    search.params['endTime'] = dateRange[1];
+  if (typeof propName === "undefined") {
+    search.params["beginTime"] = dateRange[0];
+    search.params["endTime"] = dateRange[1];
   } else {
-    search.params['begin' + propName] = dateRange[0];
-    search.params['end' + propName] = dateRange[1];
+    search.params["begin" + propName] = dateRange[0];
+    search.params["end" + propName] = dateRange[1];
   }
   return search;
 }
@@ -75,20 +83,20 @@ export function selectDictLabel(datas, value) {
   }
   var actions = [];
   Object.keys(datas).some((key) => {
-    if (datas[key].value == ('' + value)) {
+    if (datas[key].value == "" + value) {
       actions.push(datas[key].label);
       return true;
     }
-  })
+  });
   if (actions.length === 0) {
     actions.push(value);
   }
-  return actions.join('');
+  return actions.join("");
 }
 
 // 回显数据字典(字符串、数组)
 export function selectDictLabels(datas, value, separator) {
-  if (value === undefined || value.length ===0) {
+  if (value === undefined || value.length === 0) {
     return "";
   }
   if (Array.isArray(value)) {
@@ -100,30 +108,32 @@ export function selectDictLabels(datas, value, separator) {
   Object.keys(value.split(currentSeparator)).some((val) => {
     var match = false;
     Object.keys(datas).some((key) => {
-      if (datas[key].value == ('' + temp[val])) {
+      if (datas[key].value == "" + temp[val]) {
         actions.push(datas[key].label + currentSeparator);
         match = true;
       }
-    })
+    });
     if (!match) {
       actions.push(temp[val] + currentSeparator);
     }
-  })
-  return actions.join('').substring(0, actions.join('').length - 1);
+  });
+  return actions.join("").substring(0, actions.join("").length - 1);
 }
 
 // 字符串格式化(%s )
 export function sprintf(str) {
-  var args = arguments, flag = true, i = 1;
+  var args = arguments,
+    flag = true,
+    i = 1;
   str = str.replace(/%s/g, function () {
     var arg = args[i++];
-    if (typeof arg === 'undefined') {
+    if (typeof arg === "undefined") {
       flag = false;
-      return '';
+      return "";
     }
     return arg;
   });
-  return flag ? str : '';
+  return flag ? str : "";
 }
 
 // 转换字符串,undefined,null等转化为""
@@ -148,7 +158,7 @@ export function mergeRecursive(source, target) {
     }
   }
   return source;
-};
+}
 
 /**
  * 构造树型结构数据
@@ -159,9 +169,9 @@ export function mergeRecursive(source, target) {
  */
 export function handleTree(data, id, parentId, children) {
   let config = {
-    id: id || 'id',
-    parentId: parentId || 'parentId',
-    childrenList: children || 'children'
+    id: id || "id",
+    parentId: parentId || "parentId",
+    childrenList: children || "children",
   };
 
   var childrenListMap = {};
@@ -202,19 +212,23 @@ export function handleTree(data, id, parentId, children) {
 }
 
 /**
-* 参数处理
-* @param {*} params  参数
-*/
+ * 参数处理
+ * @param {*} params  参数
+ */
 export function tansParams(params) {
-  let result = ''
+  let result = "";
   for (const propName of Object.keys(params)) {
     const value = params[propName];
     var part = encodeURIComponent(propName) + "=";
-    if (value !== null && value !== "" && typeof (value) !== "undefined") {
-      if (typeof value === 'object') {
+    if (value !== null && value !== "" && typeof value !== "undefined") {
+      if (typeof value === "object") {
         for (const key of Object.keys(value)) {
-          if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') {
-            let params = propName + '[' + key + ']';
+          if (
+            value[key] !== null &&
+            value[key] !== "" &&
+            typeof value[key] !== "undefined"
+          ) {
+            let params = propName + "[" + key + "]";
             var subPart = encodeURIComponent(params) + "=";
             result += subPart + encodeURIComponent(value[key]) + "&";
           }
@@ -224,10 +238,10 @@ export function tansParams(params) {
       }
     }
   }
-  return result
+  return result;
 }
 
 // 验证是否为blob格式
 export function blobValidate(data) {
-  return data.type !== 'application/json'
+  return data.type !== "application/json";
 }

+ 8 - 8
src/views/purchase/PurchaseDemandList/add.vue

@@ -228,7 +228,7 @@
           <el-table-column label="物料编码" align="center" prop="materialCode" width="230px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable size="small" v-model="scope.row.materialCode" @focus="chooseMaterial(scope.$index)">
+                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.materialCode" @focus="chooseMaterial(scope.$index)">
                   <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMaterial(scope.$index)"></el-button>
                 </el-input>
               </el-form-item>
@@ -332,7 +332,7 @@
           <el-table-column label="收货仓库" align="center"  prop="deliveryWarehouseName" width="200px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable size="small" v-model="scope.row.deliveryWarehouseName" @focus="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')">
+                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.deliveryWarehouseName" @focus="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')">
                   <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')"></el-button>
                 </el-input>
               </el-form-item>
@@ -341,7 +341,7 @@
           <el-table-column label="收货货位" align="center"  prop="deliveryAllocationName" width="200px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable readonly size="small" v-model="scope.row.deliveryAllocationName">
+                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.deliveryAllocationName" @focus="choosehuoWei(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)">
                   <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="choosehuoWei(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)"></el-button>
                 </el-input>
               </el-form-item>
@@ -367,9 +367,9 @@
           <el-table-column label="默认采购组织" align="center"  prop="purOrgName" width="200px"/>
           <el-table-column label="默认采购组织编码" align="center"  prop="puOrg" width="200px"/>
           <!-- <el-table-column label="末级供应调拨待入量" align="center"  prop="lastStockQty" width="150px"/> -->
-          <el-table-column label="上级供应中心现存量" align="center"  prop="superiorCenterQty" width="200px"/>
+          <!-- <el-table-column label="上级供应中心现存量" align="center"  prop="superiorCenterQty" width="200px"/> -->
           <el-table-column label="上级库存被调拨占用量" align="center"  prop="superiorAllotQty" width="200px"/>
-          <el-table-column label="可用量" align="center"  prop="availableQty"/>
+          <!-- <el-table-column label="可用量" align="center"  prop="availableQty"/> -->
           <el-table-column label="调拨状态" align="center"  prop="statusAllot" width="100px">
             <template slot-scope="scope">
               <el-form-item class="hang">
@@ -387,7 +387,7 @@
           <el-table-column label="补单供应商编码" align="center"  prop="additionalSupplier" width="200px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable readonly size="small" v-model="scope.row.additionalSupplier">
+                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.additionalSupplier" @focus="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
                   <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
                 </el-input>
               </el-form-item>
@@ -396,7 +396,7 @@
           <el-table-column label="补单供应商名称" align="center"  prop="additionalSupplierName" width="200px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable readonly size="small" v-model="scope.row.additionalSupplierName"/>
+                <el-input readonly size="small" v-model="scope.row.additionalSupplierName"/>
               </el-form-item>
             </template>
           </el-table-column>
@@ -416,7 +416,7 @@
           <el-table-column label="收货地址" align="center"  prop="deliveryAddressName" width="200px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable size="small" v-model="scope.row.deliveryAddressName" @focus="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')">
+                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.deliveryAddressName" @focus="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')">
                   <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')"></el-button>
                 </el-input>
               </el-form-item>

+ 34 - 12
src/views/purchase/contract/import/index.vue

@@ -1,5 +1,6 @@
 <script>
-import { REMOVE } from "@/api/business/purchase/contract";
+import { getToken } from "@/utils/auth";
+import { IMPORTTEMPLATE } from "@/api/business/purchase/contract";
 export default {
   name: "ImportDialog",
   data() {
@@ -12,10 +13,10 @@ export default {
         updateSupport: 0,
         // 设置上传的请求头部
         headers: {
-          // Authorization: "Bearer " + getToken()
+          Authorization: "Bearer " + getToken(),
         },
         // 上传的地址
-        url: process.env.VUE_APP_BASE_API + "/system/user/importData",
+        url: "/drp-file/document-center/fastdfs/upload",
       },
     };
   },
@@ -30,22 +31,35 @@ export default {
     hide() {
       this.visible = false;
     },
-    /** 下载模板操作 */
-    importTemplate() {
-      importTemplate().then((response) => {
-        this.download(response.msg);
-      });
+    //
+    async importTemplate() {
+      try {
+        const { msg, code } = await IMPORTTEMPLATE();
+        if (code === 200) {
+          this.download(msg, {});
+        } else {
+          this.$notify.warning({ title: msg });
+        }
+      } catch (err) {
+        // catch
+      } finally {
+        // finally
+      }
     },
     // 文件上传中处理
     progress(event, file, fileList) {
+      console.log(event, file, fileList);
       this.upload.isUploading = true;
     },
     // 文件上传成功处理
     success(response, file, fileList) {
+      const { message: msg } = response;
       this.upload.open = false;
       this.upload.isUploading = false;
       this.$refs.upload.clearFiles();
-      this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
+      this.$alert(msg, "导入结果", {
+        dangerouslyUseHTMLString: true,
+      });
       this.getList();
     },
     //
@@ -77,11 +91,19 @@ export default {
         将文件拖到此处,或
         <em>点击上传</em>
       </div>
-      <div class="el-upload__tip" slot="tip">
+      <div
+        class="el-upload__tip"
+        slot="tip"
+        style="display: flex; align-items: center"
+      >
         <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
-        <el-link type="info" style="font-size: 12px" @click="importTemplate"
-          >下载模板</el-link
+        <el-link
+          type="info"
+          style="font-size: 12px; margin-left: 10px"
+          @click="importTemplate"
         >
+          下载模板
+        </el-link>
       </div>
       <div class="el-upload__tip" style="color: red" slot="tip">
         提示:仅允许导入“xls”或“xlsx”格式文件!

+ 78 - 37
src/views/purchase/purchase-order/add/column.js

@@ -11,21 +11,30 @@ export const Columns = [
     },
     queryParams: () => ({}),
     require: true,
+    isShow:true,
   },
   {
     key: "billType",
     title: "订单类型",
     inputType: "Select",
     referName: "sys_order_type", // 字典名
+    isShow:true,
+  },
+  { key: "oaDemandNo", title: "OA需求单号", inputType: "Input",  isShow:true,},
+  {
+    key: "code",
+    title: "订单编号",
+    inputType: "Input",
+    readonly: true,
+    disabled: true,
+    isShow:true,
   },
-  { key: "oaDemandNo", title: "OA需求单号", inputType: "Input", },
-  { key: "code", title: "订单编号", inputType: "Input", },
   {
     key: "billDate",
     title: "订单日期",
     inputType: "DatePicker",
     valueFormat: "yyyy-MM-dd",
-    width: 200,
+    width: 200, isShow:true,
   },
   {
     key: "supplierName",
@@ -39,6 +48,7 @@ export const Columns = [
     },
     queryParams: () => ({}),
     require: true,
+    isShow:true,
   },
   {
     key: "paymentAgreementName",
@@ -51,7 +61,7 @@ export const Columns = [
       paymentAgreementName: 'name'
     },
     queryParams: () => ({}),
-
+    isShow:true,
   },
   {
     key: "finalTypeName",
@@ -64,6 +74,7 @@ export const Columns = [
       finalTypeName: 'name'
     },
     queryParams: () => ({}),
+    isShow:true,
   },
   {
     key: "currencyName",
@@ -76,7 +87,7 @@ export const Columns = [
       currencyName: 'name'
     },
     queryParams: () => ({}),
-
+    isShow:true,
   },
   {
     key: "buyerName",
@@ -90,6 +101,7 @@ export const Columns = [
     },
     queryParams: () => ({}),
     require: true,
+    isShow:true,
   },
   {
     key: "puDeptName",
@@ -103,6 +115,7 @@ export const Columns = [
     },
     queryParams: () => ({}),
     require: true,
+    isShow:true,
   },
   {
     key: "customerName",
@@ -117,32 +130,37 @@ export const Columns = [
       customerName: 'name'
     },
     queryParams: () => ({}),
+    isShow:true,
   },
   {
     key: "qty",
     title: "总数量",
     inputType: "InputNumber",
     controlsPosition: "right",
+    isShow:true,
   },
   {
     key: "originalQty",
     title: "原始总数量",
     inputType: "InputNumber",
     controlsPosition: "right",
+    isShow:true,
   },
-  { key: "money", title: "价税合计", inputType: "Input", },
-  { key: "originalMoney", title: "原始总金额", inputType: "Input", },
-  { key: "notaxMoney", title: "无税金额", inputType: "Input", },
+  { key: "money", title: "价税合计", inputType: "Input", isShow:true, },
+  { key: "originalMoney", title: "原始总金额", inputType: "Input",  isShow:true,},
+  { key: "notaxMoney", title: "无税金额", inputType: "Input",  isShow:true,},
   {
     key: "status",
     title: "单据状态",
     inputType: "Select",
     referName: "sys_status", // 字典名
+    disabled: true,
+    isShow:true,
   },
-  { key: "freezeCause", title: "冻结原因", inputType: "Checkbox", },
-  { key: "isBack", title: "退货", inputType: "Input", inputType: "Checkbox", },
-  { key: "isMarketing", title: "已协同生成销售订单", inputType: "Checkbox", },
-  { key: "isMarketingSource", title: "由销售订单协同生成", inputType: "Checkbox", },
+  { key: "freezeCause", title: "冻结原因", inputType: "Checkbox", isShow:true, },
+  { key: "isBack", title: "退货", inputType: "Input", inputType: "Checkbox",  isShow:true,},
+  { key: "isMarketing", title: "已协同生成销售订单", inputType: "Checkbox",  isShow:true,},
+  { key: "isMarketingSource", title: "由销售订单协同生成", inputType: "Checkbox",  isShow:true,},
   {
     key: "warehouseName",
     title: "WMS入库仓库", // 收货仓库
@@ -154,7 +172,10 @@ export const Columns = [
       warehouse: 'id',
       warehouseName: 'name'
     },
-    queryParams: () => ({}),
+    queryParams: (params) => ({
+      pkOrg: params.puOrg,
+    }),
+    isShow:true,
   },
   {
     key: "goodsAllocationName",
@@ -167,18 +188,19 @@ export const Columns = [
       goodsAllocation: 'id',
       goodsAllocationName: 'name'
     },
+     isShow:true,
     queryParams: (params) => ({
-      pkOrg: params.puOrg,
+      stordocId: params.warehouse,
     }),
     width: 200,
   },
-  { key: "isSendSrm", title: "是否同步SRM", inputType: "Checkbox", },
-  { key: "isInvoice", title: "发票标识", inputType: "Checkbox", },
-  { key: "supplierOrderNo", title: "供应商订单号", inputType: "Input", },
-  { key: "rebateMoney", title: "订单使用返利金额", inputType: "Input", },
-  { key: "deductionMoney", title: "订单抵扣余款金额", inputType: "Input", },
-  { key: "address", title: "收货地址", inputType: "Input", },
-  { key: "contacts", title: "收货联系人", inputType: "Input", },
+  { key: "isSendSrm", title: "是否同步SRM", inputType: "Checkbox",isShow:true, },
+  { key: "isInvoice", title: "发票标识", inputType: "Checkbox", isShow:true,},
+  { key: "supplierOrderNo", title: "供应商订单号", inputType: "Input",isShow:true, },
+  { key: "rebateMoney", title: "订单使用返利金额", inputType: "Input",isShow:true, },
+  { key: "deductionMoney", title: "订单抵扣余款金额", inputType: "Input",isShow:true, },
+  { key: "address", title: "收货地址", inputType: "Input",isShow:true, },
+  { key: "contacts", title: "收货联系人", inputType: "Input",isShow:true, },
   {
     key: "customerDeptName",
     title: "客户部门",
@@ -190,6 +212,7 @@ export const Columns = [
       customerDept: 'id',
       customerDeptName: 'name'
     },
+     isShow:true,
     queryParams: () => ({}),
 
   },
@@ -204,11 +227,12 @@ export const Columns = [
       supplierContacts: 'id',
       supplierContactsName: 'name'
     },
+     isShow:true,
     queryParams: () => ({}),
     width: 200,
   },
-  { key: "isUrgency", title: "紧急程度", inputType: "Checkbox", },
-  { key: "isSendWms", title: "已同步WMS", inputType: "Checkbox", },
+  { key: "isUrgency", title: "紧急程度", inputType: "Checkbox",isShow:true, },
+  { key: "isSendWms", title: "已同步WMS", inputType: "Checkbox",isShow:true, },
   // { key: "agent", title: "代理人", inputType: "Input", }, // 建议删除
   {
     key: "agentName",
@@ -220,19 +244,21 @@ export const Columns = [
       agent: 'id',
       agentName: 'name'
     },
+     isShow:true,
     queryParams: () => ({}),
     width: 200,
   },
-  { key: "isClose", title: "最终关闭", inputType: "Checkbox", },
+  { key: "isClose", title: "最终关闭", inputType: "Checkbox", isShow:true, },
   {
     key: "closeTime",
     title: "最终关闭日期",
     inputType: "DatePicker",
     valueFormat: "yyyy-MM-dd",
+    isShow:true,
   },
-  { key: "applyPaymentMoney", title: "累计付款申请金额", inputType: "Input", },
-  { key: "paymentMoney", title: "累计付款金额", inputType: "Input", },
-  { key: "invoiceMoney", title: "发票金额", inputType: "Input", },
+  { key: "applyPaymentMoney", title: "累计付款申请金额", inputType: "Input", isShow:true,},
+  { key: "paymentMoney", title: "累计付款金额", inputType: "Input", isShow:true,},
+  { key: "invoiceMoney", title: "发票金额", inputType: "Input",isShow:true, },
   {
     key: "supplierPersonalName",
     title: "供应商业务员",
@@ -243,10 +269,11 @@ export const Columns = [
       supplierPersonal: 'id',
       supplierPersonalName: 'name'
     },
+     isShow:true,
     queryParams: () => ({}),
     require: true,
   },
-  { key: "isDeliver", title: "是否发货", inputType: "Checkbox", },
+  { key: "isDeliver", title: "是否发货", inputType: "Checkbox",  isShow:true,},
   {
     key: "retReasonName",
     title: "退换原因",
@@ -258,6 +285,7 @@ export const Columns = [
       retReason: 'id',
       retReasonName: 'name'
     },
+     isShow:true,
     queryParams: () => ({}),
   },
   {
@@ -271,9 +299,10 @@ export const Columns = [
       processType: 'id',
       processTypeName: 'name'
     },
+     isShow:true,
     queryParams: () => ({}),
   },
-  { key: "isEnd", title: "整单关闭标识", inputType: "Input", },
+  { key: "isEnd", title: "整单关闭标识", inputType: "Input", isShow:true, },
   {
     key: "projectNowName",
     title: "在建工程项目",
@@ -285,6 +314,7 @@ export const Columns = [
       projectNow: 'id',
       projectNowName: 'name'
     },
+     isShow:true,
     queryParams: () => ({}),
   },
   {
@@ -298,28 +328,39 @@ export const Columns = [
       operatingItems: 'id',
       operatingItemsName: 'name'
     },
+     isShow:true,
     queryParams: () => ({}),
 
   },
-  { key: "isArrivalReson", title: "到货超期原因", inputType: "Input", },
-  { key: "midOrderNo", title: "中台采购订单号", inputType: "Input", },
-  { key: "marketingCode", title: "销售订单号", inputType: "Input", },
-  { key: "isArrival", title: "到货超期", inputType: "Checkbox", },
-  { key: "createByName", title: "创建人名称", inputType: "Input", },
-  { key: "updateByName", title: "更新人名称", inputType: "Input", },
-  { key: "flowId", title: "OA流程ID", inputType: "Input", },
-  { key: "approver", title: "审批人", inputType: "Input", },
+  { key: "isArrivalReson", title: "到货超期原因", inputType: "Input", isShow:true, },
+  { key: "midOrderNo", title: "中台采购订单号", inputType: "Input", isShow:true, },
+  { key: "marketingCode", title: "销售订单号", inputType: "Input", isShow:true, },
+  { key: "isArrival", title: "到货超期", inputType: "Checkbox",  isShow:true,},
+  { key: "createByName", title: "创建人名称", inputType: "Input", isShow:false, },
+  { key: "updateByName", title: "更新人名称", inputType: "Input", isShow:false, },
+  { key: "flowId", title: "OA流程ID", inputType: "Input", isShow:false, },
+  { key: "approver", title: "审批人", inputType: "Input", isShow:false, },
   {
     key: "approverFinishTime",
     title: "审批时间",
     inputType: "DatePicker",
     valueFormat: "yyyy-MM-dd",
+    isShow:false,
   },
   {
     key: "approveTime",
     title: "提交时间",
     inputType: "DatePicker",
     valueFormat: "yyyy-MM-dd",
+    isShow:false,
+  },
+  {
+    key: "sysFileRecordList",
+    title: "附件",
+    inputType: "Upload",
+    // fileType: ["pdf",""],
+    span: 24,
+    isShow:true,
   },
 
 ];

+ 21 - 29
src/views/purchase/purchase-order/add/index.vue

@@ -15,12 +15,14 @@ NewTabColumns.forEach((column) => {
     ...column.tableColumns.filter((cColumn) => cColumn.inputType === "Select")
   );
 });
-console.log(SelectColumns, 'SelectColumns');
 
 export default {
   name: "AddPurchaseOrderDrawer",
   dicts: initDicts(SelectColumns),
-  components: {},
+  components: {
+    FileUploadCenter: () => import('../components/FileUploadCenter/index.vue'),
+    popDialog: () => import('@/components/PopDialog/index.vue'),
+  },
 
   data() {
     return {
@@ -43,22 +45,20 @@ export default {
   watch: {
     "params.puOrderItemList": {
       handler(nVal, oVal) {
-        console.log(nVal, 'nVal', oVal, 'oVal');
-        this.handleSynchronousMaterial("puOrderItemList", "puOrderExecuteList");
+        this.visible && this.handleSynchronousMaterial("puOrderItemList", "puOrderExecuteList");
       },
       deep: true,
     },
     "params.puOrderExecuteList": {
       handler(nVal, oVal) {
-        this.handleSynchronousMaterial("puOrderExecuteList", "puOrderItemList");
+        this.visible && this.handleSynchronousMaterial("puOrderExecuteList", "puOrderItemList");
       },
       deep: true,
     },
     "params": {
       handler(nVal, oVal) {
-
         // 组织变化
-        if (nVal.puOrg != oVal.puOrg) {
+        if (this.visible && (nVal.puOrg != oVal.puOrg)) {
           console.log(nVal.puOrg, 'nVal.puOrg', oVal.puOrg, 'oVal.puOrg');
           for (const key in this.params) {
             if (Array.isArray(this.params[key])) {
@@ -87,8 +87,7 @@ export default {
       this.params.buyerName = nickName;
       this.params.puDept = deptId;
       this.params.puDeptName = deptName;
-      this.params.status = '0';
-
+      // this.params.status = '0';
     },
     setVisible(prop) {
       this.visible = prop;
@@ -190,21 +189,24 @@ export default {
     // 取消
     handleCancel() {
       this.setVisible(false);
-      this.params = initParams(this.columns, "key", "value");
+      this.params = {
+        ...initParams(this.columns),
+        puOrderItemList: [],
+        puOrderExecuteList: [],
+      }
+
     },
     // 保存
     async handleSava() {
       // orderAddForm
-      console.log(this.params, "params");
+      console.log(this.params.sysFileRecordList, "params");
+
       // this.$refs['orderAddForm'].validate(async (valid) => {
       //   if (valid) {
       try {
         const { code, msg } = await orderApi.create(this.params);
         if (code === 200) {
-          this.$notify.success({ title: msg });
-          this.setVisible(false);
-        } else {
-          this.$notify.warning({ title: msg });
+          this.handleCancel();
         }
       } catch (err) {
         //
@@ -234,10 +236,7 @@ export default {
               ...this.params,
             });
             if (code === 200) {
-              this.$notify.success({ title: msg });
               this.setVisible(false);
-            } else {
-              this.$notify.warning({ title: msg });
             }
           } catch (err) {
             this.$notify.error({ title: "error", message: err });
@@ -319,7 +318,7 @@ export default {
         </div>
         <el-row style="display:flex; flex-wrap: wrap;">
           <el-col v-for="(column, index) in columns" :key="index" :span="column.span || 6">
-            <el-form-item :prop="column.key" :label="column.title">
+            <el-form-item :prop="column.key" :label="column.title" v-if="column.isShow">
 
               <el-input v-if="column.inputType === 'Input'" v-model="params[column.key]" :placeholder="column.placeholder"
                 :clearable="column.clearable" :disabled="column.disabled" style="width: 100%">
@@ -361,16 +360,9 @@ export default {
               <el-checkbox v-if="column.inputType === 'Checkbox'" v-model="params[column.key]" true-label="Y"
                 false-label="N">
               </el-checkbox>
-              <el-upload v-if="column.inputType === 'Upload'" :file-list="params[column.key]" :disabled="column.disabled"
-                drag action="https://jsonplaceholder.typicode.com/posts/" multiple>
-                <i class="el-icon-upload"></i>
-                <div class="el-upload__text">
-                  将文件拖到此处,或<em>点击上传</em>
-                </div>
-                <div class="el-upload__tip" slot="tip">
-                  只能上传jpg/png文件,且不超过500kb
-                </div>
-              </el-upload>
+              <file-upload-center v-if="column.inputType === 'Upload'" v-model="params[column.key]"
+                :file-type="column.fileType">
+              </file-upload-center>
             </el-form-item>
           </el-col>
         </el-row>

+ 232 - 0
src/views/purchase/purchase-order/components/FileUploadCenter/index.vue

@@ -0,0 +1,232 @@
+<template>
+  <div class="upload-file">
+    <el-upload multiple :action="uploadFileUrl" :disabled="disabled" :before-upload="handleBeforeUpload"
+      :file-list="fileList" :limit="limit" :on-error="handleUploadError" :on-exceed="handleExceed"
+      :on-success="handleUploadSuccess" :show-file-list="false" class="upload-file-uploader" ref="fileUpload">
+      <!-- 上传按钮 -->
+      <el-button size="mini" type="primary" :disabled="disabled">选取文件</el-button>
+      <!-- 上传提示 -->
+      <div class="el-upload__tip" slot="tip" v-if="showTip">
+        请上传
+        <template v-if="fileSize">
+          大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
+        </template>
+        <template v-if="fileType">
+          格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b>
+        </template>
+        的文件
+      </div>
+    </el-upload>
+
+    <!-- 文件列表 -->
+    <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
+
+      <li :key="file.fileUrl" class="el-upload-list__item ele-upload-list__item-content"
+        v-for="(file, index) in fileList">
+        <!-- <el-link :href="`${baseUrl}${file.fileUrl}`" :underline="false" target="_blank"> -->
+        <el-link :href="`${baseUrl}${file.fileUrl}`" :underline="false" target="_blank">
+          <!-- <span class="el-icon-document"> {{ getFileName(file.name) }} </span> -->
+          <span class="el-icon-document"> {{ file.fileName }} </span>
+        </el-link>
+        <div class="ele-upload-list__item-content-action">
+          <el-link :underline="false" @click="handleDelete(index)" :disabled="disabled" type="danger">删除</el-link>
+        </div>
+      </li>
+    </transition-group>
+  </div>
+</template>
+
+<script>
+import { getToken } from "@/utils/auth";
+
+export default {
+  name: "FileUploadCenter",
+  props: {
+    // 值
+    value: [String, Object, Array],
+    // 数量限制
+    limit: {
+      type: Number,
+      default: 5,
+    },
+    // 大小限制(MB)
+    fileSize: {
+      type: Number,
+      default: 5,
+    },
+    // 文件类型, 例如['png', 'jpg', 'jpeg']
+    fileType: {
+      type: Array,
+      default: () => ["doc", "xls", "ppt", "txt", "pdf", "jpg"],
+    },
+    // 是否显示提示
+    isShowTip: {
+      type: Boolean,
+      default: true,
+    },
+    // 是否禁用
+    disabled: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  data() {
+    console.log(process.env, 'process.env');
+    return {
+      number: 0,
+      uploadList: [],
+      baseUrl: '/file',
+      uploadFileUrl: '/file' + "/document-center/fastdfs/upload", // 上传文件服务器地址
+      fileList: [],
+    };
+  },
+  watch: {
+    value: {
+      handler(val) {
+        this.fileList = val ? val : [];
+
+        return this.fileList;
+        // if (val) {
+        //   let temp = 1;
+        //   // 首先将值转为数组
+        //   const list = Array.isArray(val) ? val : this.value.split(",");
+        //   console.log("list", list);
+        //   // 然后将数组转为对象数组
+        //   this.fileList = list.map((item) => {
+        //     if (typeof item === "string") {
+        //       item = { name: item, url: item };
+        //     }
+        //     item.uid = item.uid || new Date().getTime() + temp++;
+        //     return item;
+        //   });
+        // } else {
+        //   this.fileList = [];
+        //   return [];
+        // }
+      },
+      deep: true,
+      immediate: true,
+    },
+  },
+  computed: {
+    // 是否显示提示
+    showTip() {
+      return this.isShowTip && (this.fileType || this.fileSize);
+    },
+  },
+  methods: {
+    // 上传前校检格式和大小
+    handleBeforeUpload(file) {
+      // 校检文件类型
+      if (this.fileType) {
+        const fileName = file.name.split(".");
+        const fileExt = fileName[fileName.length - 1];
+        const isTypeOk = this.fileType.indexOf(fileExt) >= 0;
+        if (!isTypeOk) {
+          this.$modal.msgError(
+            `文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`
+          );
+          return false;
+        }
+      }
+      // 校检文件大小
+      if (this.fileSize) {
+        const isLt = file.size / 1024 / 1024 < this.fileSize;
+        if (!isLt) {
+          this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`);
+          return false;
+        }
+      }
+      this.$modal.loading("正在上传文件,请稍候...");
+      this.number++;
+      return true;
+    },
+    // 文件个数超出
+    handleExceed() {
+      this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
+    },
+    // 上传失败
+    handleUploadError(err) {
+      this.$modal.msgError("上传文件失败,请重试");
+      this.$modal.closeLoading();
+    },
+    // 上传成功回调
+    handleUploadSuccess(res, file) {
+      if (res.code == 200) {
+        console.log(res, 'res--------------');
+        this.uploadList.push({
+          fileName: res.filename,
+          fileUrl: `/${res.group}/${res.filepath}`,
+          fileFastId: res.id,
+        });
+        this.uploadedSuccessfully();
+      } else {
+        this.number--;
+        this.$modal.closeLoading();
+        this.$modal.msgError(res.msg);
+        this.$refs.fileUpload.handleRemove(file);
+        this.uploadedSuccessfully();
+      }
+    },
+    // 删除文件
+    handleDelete(index) {
+      this.fileList.splice(index, 1);
+      // this.$emit("input", this.listToString(this.fileList));
+      this.$emit("input", this.fileList);
+    },
+    // 上传结束处理
+    uploadedSuccessfully() {
+      if (this.number > 0 && this.uploadList.length === this.number) {
+        this.fileList = this.fileList.concat(this.uploadList);
+        console.log(this.fileList, 'this.fileList***************');
+        this.uploadList = [];
+        this.number = 0;
+        // this.$emit("input", this.listToString(this.fileList));
+        this.$emit("input", this.fileList);
+        this.$modal.closeLoading();
+      }
+    },
+    // 获取文件名称
+    // getFileName(name) {
+    //   if (name.lastIndexOf("/") > -1) {
+    //     return name.slice(name.lastIndexOf("/") + 1);
+    //   } else {
+    //     return "";
+    //   }
+    // },
+    // 对象转成指定字符串分隔
+    // listToString(list, separator) {
+    //   let strs = "";
+    //   separator = separator || ",";
+    //   for (let i in list) {
+    //     strs += list[i].url + separator;
+    //   }
+    //   return strs != "" ? strs.substr(0, strs.length - 1) : "";
+    // },
+  },
+};
+</script>
+
+<style scoped lang="scss">
+.upload-file-uploader {
+  margin-bottom: 5px;
+}
+
+.upload-file-list .el-upload-list__item {
+  border: 1px solid #e4e7ed;
+  line-height: 2;
+  margin-bottom: 10px;
+  position: relative;
+}
+
+.upload-file-list .ele-upload-list__item-content {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  color: inherit;
+}
+
+.ele-upload-list__item-content-action .el-link {
+  margin-right: 10px;
+}
+</style>

+ 29 - 30
src/views/purchase/purchase-order/edit/index.vue

@@ -19,7 +19,7 @@ export default {
   name: "EditPurchaseOrderDrawer",
   dicts: initDicts(SelectColumns),
   components: {
-
+    FileUploadCenter: () => import('../components/FileUploadCenter/index.vue'),
   },
   data() {
     return {
@@ -82,9 +82,9 @@ export default {
     // 判断属性是否禁用
     handleIsForbidden(status) {
       console.log(status);
-      let { editColumns, editTabColumns } = forbidden(status != '2');
-      this.columns = editColumns;
-      this.tabColumns = editTabColumns;
+      let { editColumns: updateColumns, editTabColumns: updateTabColumns } = forbidden(status != '2');
+      this.columns = updateColumns;
+      this.tabColumns = updateTabColumns;
     },
     // 查询详细
     async fetchItem(prop) {
@@ -93,11 +93,7 @@ export default {
         const { code, msg, data } = await orderApi.details(prop);
         if (code === 200) {
           this.params = { ...this.params, ...data };
-          console.log(this.params, 'this.params----------123');
           this.handleIsForbidden(this.params.status);
-          this.$notify.success({ title: msg });
-        } else {
-          this.$notify.warning({ title: msg });
         }
       } catch (err) {
         //
@@ -113,13 +109,21 @@ export default {
         if (Array.isArray(this.params[key])) {
 
           const arr = this.tabColumns.find(
+
             (element) => element.key === key
+
           ).tableColumns;
 
+
           let rowData = initParams(arr, "key", "value");
 
-          'rowno' in rowData && (rowData['rowno'] = this.params[key].length + 1);
-          'rowNo' in rowData && (rowData['rowNo'] = this.params[key].length + 1);
+          "rowno" in rowData &&
+            (rowData["rowno"] = this.params[key].length + 1);
+          "rowNo" in rowData &&
+            (rowData["rowNo"] = this.params[key].length + 1);
+
+          // 是否完成询价,新增明细行需默认明细为false
+          rowData['whetherCompleteInquiry'] = false;
 
           this.params[key].push(rowData);
         }
@@ -143,7 +147,11 @@ export default {
     // 取消
     handleCancel() {
       this.setVisible(false);
-      this.params = initParams(this.columns, "key", "value");
+      this.params = {
+        ...initParams(this.columns),
+        puOrderItemList: [],
+        puOrderExecuteList: [],
+      }
     },
     // 保存
     async handleSava() {
@@ -156,10 +164,7 @@ export default {
           : orderApi.edit(this.params)
         )
         if (code === 200) {
-          this.setVisible(false);
-          this.$notify.success({ title: msg });
-        } else {
-          this.$notify.warning({ title: msg });
+          this.handleCancel();
         }
       } catch (err) {
         //
@@ -247,7 +252,7 @@ export default {
         </div>
         <el-row style="display:flex; flex-wrap: wrap;">
           <el-col v-for="(column, index) in columns" :key="index" :span="column.span || 6">
-            <el-form-item :prop="column.key" :label="column.title">
+            <el-form-item :prop="column.key" :label="column.title" v-if="column.isShow">
               <el-input v-if="column.inputType === 'Input'" v-model="params[column.key]" :placeholder="column.placeholder"
                 :clearable="column.clearable" :disabled="column.disabled" style="width: 100%">
               </el-input>
@@ -261,7 +266,7 @@ export default {
                 style="width: 100%">
               </el-input>
               <el-input-number v-if="column.inputType === 'InputNumber'" v-model="params[column.key]"
-                :max="handleIsRevise(params.status) ? params[column.key] : 'Infinity'"
+                :max="handleIsRevise(params.status) ? params[column.key] : Infinity"
                 :controls-position="column.controlsPosition" :placeholder="column.placeholder"
                 :clearable="column.clearable" :disabled="column.disabled" style="width: 100%">
               </el-input-number>
@@ -287,16 +292,9 @@ export default {
               <el-checkbox v-if="column.inputType === 'Checkbox'" v-model="params[column.key]" :disabled="column.disabled"
                 true-label="Y" false-label="N">
               </el-checkbox>
-              <el-upload v-if="column.inputType === 'Upload'" :file-list="params[column.key]" :disabled="column.disabled"
-                drag action="https://sy.derom.com/document-center/fastdfs/upload" multiple>
-                <i class="el-icon-upload"></i>
-                <div class="el-upload__text">
-                  将文件拖到此处,或<em>点击上传</em>
-                </div>
-                <!-- <div class="el-upload__tip" slot="tip">
-                  只能上传jpg/png文件,且不超过500kb
-                </div> -->
-              </el-upload>
+              <file-upload-center v-if="column.inputType === 'Upload'" v-model="params[column.key]"
+                :file-type="column.fileType" :disabled="handleIsRevise(params.status)">
+              </file-upload-center>
             </el-form-item>
           </el-col>
         </el-row>
@@ -348,7 +346,7 @@ export default {
                   </el-checkbox>
                   <el-input-number v-if="cColumn.inputType === 'InputNumber'" v-model="scope.row[cColumn.key]"
                     :controls-position="cColumn.controlsPosition"
-                    :max="handleIsRevise(params.status) ? scope.row[cColumn.key] : 'Infinity'"
+                    :max="handleIsRevise(params.status) ? scope.row[cColumn.key] : Infinity"
                     @change="handleInputChange(scope.row, cColumn.key)" :placeholder="cColumn.placeholder"
                     :clearable="cColumn.clearable" :disabled="cColumn.disabled" :size="size" style="width: 100%">
                   </el-input-number>
@@ -360,7 +358,7 @@ export default {
               编辑:自制:可删可增 -->
               <el-table-column fixed="right" label="操作" width="120">
                 <template slot-scope="scope">
-                  <el-button  v-if="params.source == '3'&& !handleIsRevise(params.status)" @click.native.prevent="
+                  <el-button v-if="params.source == '3' && !handleIsRevise(params.status)" @click.native.prevent="
                     delTableRow(params[tabName], scope.$index)
                     " type="text" size="small">
                     删行
@@ -371,7 +369,8 @@ export default {
           </el-tab-pane>
         </el-tabs>
         <el-row style="position: absolute; top: 20px; right: 20px">
-          <el-button v-if="params.source == '3'&& !handleIsRevise(params.status)" :size="size" @click="addTableRow(params[tabName])">增行</el-button>
+          <el-button v-if="params.source == '3' && !handleIsRevise(params.status)" :size="size"
+            @click="addTableRow(params[tabName])">增行</el-button>
         </el-row>
       </el-card>
     </el-form>

+ 17 - 4
src/views/purchase/purchase-order/edit/initColumn.js

@@ -27,15 +27,28 @@ export const forbidden = (isEdit) => {
     console.log('编辑');
     // 编辑
     editColumns.forEach(item => {
-      item.disabled = false;
-      item.readonly = false;
+
+      if(item.key == 'code' || item.key == 'status'){
+
+        item.disabled = true;
+        item.readonly = true;
+      }else{
+        item.disabled = false;
+        item.readonly = false;
+      }
     })
 
     editTabColumns.forEach(item => {
 
       item.tableColumns.forEach(t => {
-        t.disabled = false;
-        t.readonly = false;
+
+        if(t.key == 'rowno' ||t.key == 'rowNo'){
+          t.disabled = true;
+          t.readonly = true;
+        }else{
+          t.disabled = false;
+          t.readonly = false;
+        }
       })
     })
   } else {

+ 18 - 24
src/views/purchase/purchase-order/index.vue

@@ -40,7 +40,6 @@ export default {
         puOrderExecuteList: [],
       },
       checkedList: [],
-      checkedTabList: [],
     };
   },
   computed: {
@@ -63,7 +62,6 @@ export default {
         if (code === 200) {
           this.page.total = total;
           this.tableData = rows;
-          this.$notify.success({ title: msg });
         }
       } catch (err) {
         //
@@ -73,9 +71,9 @@ export default {
     },
     handleSearchChange() {
       this.isSimpleSearch = !this.isSimpleSearch;
-      this.$notify.info({
-        title: this.isSimpleSearch ? "Simple Search" : "All Search",
-      });
+      // this.$notify.info({
+      //   title: this.isSimpleSearch ? "Simple Search" : "All Search",
+      // });
     },
     // 页大小变
     handleSizeChange(prop) {
@@ -146,7 +144,6 @@ export default {
           for (const key in this.tabTableDatas) {
             this.tabTableDatas[key] = data[key];
           }
-          this.$notify.success({ title: msg });
         }
       } catch (err) {
         //
@@ -190,18 +187,17 @@ export default {
     },
     // 判断“退回”按钮
     judgeIsAllSendBack() {
-
       if (this.checkedList.length == 1) {
 
         // 非手工、状态非审批通过  
-        if (this.checkedList[0].source != 3 && this.checkedList[0].status != 2) {
+        if (this.checkedList[0].source != 3 && (this.checkedList[0].status == 0 || this.checkedList[0].status == 3)) {
 
           return false
         }
       }
       return true;
     },
-    //  退回
+    //  整单退回
     handleAllSendBack() {
       let data = {
         id: this.checkedList[0].id,
@@ -211,7 +207,7 @@ export default {
       console.log(data);
       try {
         this.loading = true;
-        // let { code, msg } = orderApi.documentsReturn(data);
+        let { code, msg } = orderApi.documentsReturn(data);
 
       } catch (error) {
 
@@ -268,9 +264,6 @@ export default {
 
     },
 
-    handleTabSelect(selection, row) {
-      this.checkedTabList = selection; 
-    },
 
 
   },
@@ -311,22 +304,24 @@ export default {
     <el-row :gutter="24" style="padding: 0 20px">
       <!-- <el-col :span="6">123</el-col> -->
       <el-col :span="24" style="text-align: right;margin: 0 10px 0 0">
+
+        <!-- <el-button-group style="margin-left: 10px"> -->
+        <el-button size="mini" type="primary" plain @click="handleOpenAddDrawer"
+          v-hasPermi="['material:order:add']">新增</el-button>
+        <!-- </el-button-group> -->
+
         <el-button-group style="margin-left: 10px">
-          <el-button size="mini" type="danger" @click="handleOpenAddDrawer"
-            v-hasPermi="['material:order:add']">新增</el-button>
           <el-button size="mini" :disabled="checkedList.length != 1" @click="handleCopy">复制</el-button>
-
         </el-button-group>
 
-        <!-- <el-button-group style="margin-left: 10px">
-          <el-button size="mini" @click="handleAllSendBack" :key="checkedList.length"
-            :disabled="judgeIsAllSendBack()">整单退回</el-button>
-        </el-button-group> -->
+        <el-button-group style="margin-left: 10px" :key="checkedList.length + 1">
+          <el-button size="mini" @click="handleAllSendBack" :disabled="judgeIsAllSendBack()">整单退回</el-button>
+          <el-button size="mini" @click="handleAllClose" :disabled="judgeIsAllClose()">整单关闭</el-button>
+        </el-button-group>
 
         <el-button-group style="margin-left: 10px">
           <!-- <el-button size="mini">采购退货</el-button> -->
-          <el-button size="mini" @click="handleAllClose" :key="checkedList.length"
-            :disabled="judgeIsAllClose()">整单关闭</el-button>
+
           <!-- <el-button size="mini">附件管理</el-button>
           <el-button size="mini">单据追溯</el-button> -->
         </el-button-group>
@@ -373,9 +368,8 @@ export default {
     <el-tabs v-model="tabName" @tab-click="handleTabClick" style="width: 100%;padding: 20px 10px">
       <el-tab-pane v-for="(column, index) in tabColumns" :key="index" :label="column.title" :name="column.key">
 
-        <el-table :data="tabTableDatas[column.key]" style="width: 100%" highlight-current-row @select="handleTabSelect"
+        <el-table :data="tabTableDatas[column.key]" style="width: 100%" highlight-current-row
           :height="tabTableDatas[column.key].length ? 300 : 100">
-          <el-table-column type="selection" width="45"></el-table-column>
           <el-table-column type="index" width="50" label="序号"></el-table-column>
           <el-table-column v-for="(cColumn, cIndex)  in column.tableColumns" :key="cIndex" :prop="cColumn.key"
             :label="cColumn.title" :width="cColumn.width || 180"

+ 6 - 13
src/views/purchase/purchase-order/see/index.vue

@@ -24,6 +24,9 @@ NewTabColumns.forEach(column => {
 export default {
   name: "SeePurchaseOrderDrawer",
   dicts: initDicts(SelectColumns),
+  components: {
+    FileUploadCenter: () => import('../components/FileUploadCenter/index.vue'),
+  },
   data() {
     return {
       visible: false,
@@ -53,9 +56,6 @@ export default {
         const { code, msg, data } = await orderApi.details(prop);
         if (code === 200) {
           this.params = data;
-          this.$notify.success({ title: msg });
-        } else {
-          this.$notify.warning({ title: msg });
         }
       } catch (err) {
         //
@@ -137,16 +137,9 @@ export default {
               <el-checkbox v-if="column.inputType === 'Checkbox'" v-model="params[column.key]" disabled true-label="Y"
                 false-label="N">
               </el-checkbox>
-              <el-upload v-if="column.inputType === 'Upload'" :file-list="params[column.key]" disabled drag
-                action="https://jsonplaceholder.typicode.com/posts/" multiple>
-                <i class="el-icon-upload"></i>
-                <div class="el-upload__text">
-                  将文件拖到此处,或<em>点击上传</em>
-                </div>
-                <div class="el-upload__tip" slot="tip">
-                  只能上传jpg/png文件,且不超过500kb
-                </div>
-              </el-upload>
+              <file-upload-center v-if="column.inputType === 'Upload'" v-model="params[column.key]"
+                :file-type="column.fileType" :disabled="true">
+              </file-upload-center>
             </el-form-item>
           </el-col>
         </el-row>

+ 43 - 3
src/views/purchase/transferOrder/add.vue

@@ -235,7 +235,7 @@
           <el-table-column label="物料编码" align="center" prop="material" width="230px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input readonly size="small" v-model="scope.row.material">
+                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.material" @focus="chooseMaterial(scope.$index)">
                   <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMaterial(scope.$index)"></el-button>
                 </el-input>
               </el-form-item>
@@ -267,7 +267,24 @@
             </template>
           </el-table-column>
           <el-table-column label="税率" align="center" prop="rate"/>
-          <!-- <el-table-column label="调入仓库" align="center" prop="storageWarehouseName"/> -->
+          <el-table-column label="调出货位" align="center" prop="deliveryAllocationName" width="230px">
+            <template slot-scope="scope">
+              <el-form-item class="hang">
+                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.deliveryAllocationName" @focus="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调出货位', basicForm.deliveryWarehouse)">
+                  <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调出货位', basicForm.deliveryWarehouse)"></el-button>
+                </el-input>
+              </el-form-item>
+            </template>
+          </el-table-column>
+          <el-table-column label="调入货位" align="center" prop="storageAllocationName" width="230px">
+            <template slot-scope="scope">
+              <el-form-item class="hang">
+                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.storageAllocationName" @focus="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调入货位', basicForm.storageWarehouse)">
+                  <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调入货位', basicForm.storageWarehouse)"></el-button>
+                </el-input>
+              </el-form-item>
+            </template>
+          </el-table-column>
           <el-table-column label="批次号" align="center" prop="patchNo" width="150px"/>
           <el-table-column label="产品批号" align="center" prop="producBatch" width="230px">
             <template slot-scope="scope">
@@ -622,6 +639,8 @@ export default {
         type: '',
         isPage: true,
         title: '',
+        // 仓库编码
+        stordocId: ''
       },
       referConditionMx: {
         orgCode: '',
@@ -703,7 +722,7 @@ export default {
       this.$emit('jugislist', true)
       let queryParams = {
         pageNum: 1,
-        pageSize: 10
+        pageSize: 5
       }
       this.$emit('refresh', queryParams)
     },
@@ -778,6 +797,10 @@ export default {
         mainQty: null,
         rate: '0.00',
         storageWarehouseName: null,
+        deliveryAllocationName: null,
+        deliveryAllocation: null,
+        storageAllocationName: null,
+        storageAllocation: null,
         patchNo: null,
         producBatch: null,
         manufactureDate: null,
@@ -853,6 +876,14 @@ export default {
         this.basicForm.deliveryWarehouse = selection[0].id
         this.basicForm.deliveryWarehouseName = selection[0].name
       }
+      if (this.referCondition.title == '调出货位') {
+        this.materialInfo[this.tableIndex].deliveryAllocationName = selection[0].name
+        this.materialInfo[this.tableIndex].deliveryAllocation = selection[0].id
+      }
+      if (this.referCondition.title == '调入货位') {
+        this.materialInfo[this.tableIndex].storageAllocationName = selection[0].name
+        this.materialInfo[this.tableIndex].storageAllocation = selection[0].id
+      }
     },
     chooseTreeRefer(type, isPage, title) {
       this.referCondition.type = type
@@ -899,6 +930,15 @@ export default {
     selectBatch(selection) {
       console.log('选中的批次号', selection)
     },
+    // 明细行选择货位
+    chooseMxHW(index, type, isPage, title, stordocId) {
+      this.tableIndex = index
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
+      this.referCondition.stordocId = stordocId
+      this.$refs.refer.init(this.referCondition)
+    },
   }
 }
 </script>

+ 5 - 1
src/views/purchase/transferOrder/index.vue

@@ -94,7 +94,11 @@
           <el-table-column label="订单类型" align="center" prop="billType" width="150px"/>
           <el-table-column label="单据号" align="center" prop="code" width="150px"/>
           <el-table-column label="单据日期" align="center" prop="billDate" width="150px"/>
-          <el-table-column label="调拨方式" align="center" prop="allotType" width="150px"/>
+          <el-table-column label="调拨方式" align="center" prop="allotType" width="150px">
+            <template slot-scope="scope">
+              <span>{{ scope.row.allotType == '2' ? '财务组织间调拨' : '财务组织内库存组织内调拨' }}</span>
+            </template>
+          </el-table-column>
           <el-table-column label="调拨出库单号" align="center" prop="deliveryCode" width="150px"/>
           <el-table-column label="调拨入库单号" align="center" prop="storageCode" width="150px"/>
           <el-table-column label="调拨入库组织" align="center" prop="storageInventoryOrgName" width="150px"/>

+ 13 - 7
vue.config.js

@@ -51,10 +51,16 @@ module.exports = {
           ["^" + process.env.VUE_APP_BASE_API]: "",
         },
       },
-      "/drp-admin/mock34": {
-        target: `http://172.16.100.123:3030/mock/34`,
+      "/drp-file": {
+        target: `https://sy.derom.com`,
         changeOrigin: true,
-        pathRewrite: { [`^/drp-admin/mock34`]: "" },
+        pathRewrite: { [`^/drp-file`]: "" },
+      },
+      "/file": {
+        // target: process.env.NODE_ENV == "development" ? `https://test-sy.derom.com` : `https://sy.derom.com`,
+        target: `https://sy.derom.com`,
+        changeOrigin: true,
+        pathRewrite: { [`^/file`]: "" },
       },
     },
     disableHostCheck: true,
@@ -137,10 +143,10 @@ module.exports = {
         },
       });
       config.optimization.runtimeChunk("single"),
-      {
-        from: path.resolve(__dirname, "./public/robots.txt"), //防爬虫文件
-        to: "./", //到根目录下
-      };
+        {
+          from: path.resolve(__dirname, "./public/robots.txt"), //防爬虫文件
+          to: "./", //到根目录下
+        };
     });
   },
 };