simple vor 5 Jahren
Ursprung
Commit
0a2e69de5d

+ 1 - 1
build/webpack.prod.conf.js

@@ -32,7 +32,7 @@ const webpackConfig = merge(baseWebpackConfig(baseOption), {
     new webpack.DefinePlugin({
     	'process.env': env,
     	'host.PROJECT':JSON.stringify(baseOption.project),
-    	'host.LOGINPATH': JSON.stringify('/crm_yun') //统一登录路径
+    	'host.LOGINPATH': JSON.stringify('') //统一登录路径
     }),
     // UglifyJs do not support ES6+, you can also use babel-minify for better treeshaking: https://github.com/babel/minify
 //  new webpack.optimize.UglifyJsPlugin({

+ 94 - 90
config/download.js

@@ -1,19 +1,15 @@
 let project = host.PROJECT;
 const prodServer = require('./prod/' + project + '.js'); //服务信息
 
-export default (url = '', baseUrl='', data = {},dataType = 'JSON', type = 'GET', requestType='FORMDATA') => {
+export default (url = '', baseUrl = '', data = {}, dataType = 'JSON', type = 'GET', requestType = 'FORMDATA') => {
   var html = '<div class="ivu-spin-fullscreen ivu-spin-fullscreen-wrapper"><div class="ivu-spin ivu-spin-fix ivu-spin-show-text ivu-spin-fullscreen"><div class="ivu-spin-main"><span class="ivu-spin-dot"></span> <div class="ivu-spin-text"><div><i class="ivu-icon ivu-icon-load-c demo-spin-icon-load" style="font-size: 18px;"></i><div>Loading</div></div></div></div></div></div>'
-	$('#app').append(html);
-	type = type.toUpperCase();
-	if(process.env.NODE_ENV === 'development'){
+  $('#app').append(html);
+  type = type.toUpperCase();
+  if (process.env.NODE_ENV === 'development') {
     baseUrl = baseUrl;
-  }
-  else if(process.env.NODE_ENV === 'production')
-  {
-    if(baseUrl)
-    {
-      switch (baseUrl)
-      {
+  } else if (process.env.NODE_ENV === 'production') {
+    if (baseUrl) {
+      switch (baseUrl) {
         case '/landcrm':
           baseUrl = prodServer("landcrm");
           break;
@@ -30,33 +26,42 @@ export default (url = '', baseUrl='', data = {},dataType = 'JSON', type = 'GET',
           baseUrl = prodServer("manage");
           break;
         case '/community': //会员认证    community: 正式,   communityDev: 测试,qpi:幸福基业
-        	baseUrl = prodServer("community");
+          baseUrl = prodServer("community");
           break;
-        case '/points'://积分
+        case '/points': //积分
           baseUrl = prodServer("points");
-        	break;
-        case '/question'://调查问卷
+          break;
+        case '/question': //调查问卷
           baseUrl = prodServer("question");
           break;
 
-        case '/activiti':// 订餐 会议室预订
+        case '/activiti': // 订餐 会议室预订
           baseUrl = prodServer("activiti");
           break;
-        case '/member'://会员管理
+        case '/member': //会员管理
           baseUrl = prodServer("member");
           break;
-        case '/voucher'://
+        case '/voucher': //
           baseUrl = prodServer("voucher");
           break;
-        case '/bus'://楼巴管理
+        case '/bus': //楼巴管理
           baseUrl = prodServer("bus");
           break;
-        case '/guesthouse'://招待管理
+        case '/guesthouse': //招待管理
           baseUrl = prodServer("guesthouse");
           break;
-        case '/apartment'://公寓管理
+        case '/apartment': //公寓管理
           baseUrl = prodServer("apartment");
           break;
+        case '/purchase': //
+          baseUrl = "https://test.hajwy.com/purchase";
+          break;
+        case '/hajwy': //
+          baseUrl = "https://test.hajwy.com/qpi/rest";
+          break;
+        case '/mkf': //
+          baseUrl = "https://pms.hajwy.com/landcrm";
+          break;
         default:
           baseUrl = "";
           break;
@@ -65,95 +70,94 @@ export default (url = '', baseUrl='', data = {},dataType = 'JSON', type = 'GET',
   }
   url = baseUrl + url;
 
-	let dataStr = ''; //数据拼接字符串
-	if (type == 'GET') {
-		if(typeof(data)=="object"){
-			Object.keys(data).forEach(key => {
-				dataStr += key + '=' + data[key] + '&';
-			})
-		}
-		if (dataStr !== '') {
+  let dataStr = ''; //数据拼接字符串
+  if (type == 'GET') {
+    if (typeof (data) == "object") {
+      Object.keys(data).forEach(key => {
+        dataStr += key + '=' + data[key] + '&';
+      })
+    }
+    if (dataStr !== '') {
       dataStr = dataStr.substr(0, dataStr.lastIndexOf('&'));
       url = url + '?' + dataStr;
-		}
-		// url = url + '?' + dataStr;
-	}
-	else{
-		if(requestType === "FORMDATA")
-    {
-      Object.keys(data).forEach(key => {
-				dataStr += key + '=' + data[key] + '&';
-			})
-			dataStr = dataStr.substr(0, dataStr.lastIndexOf('&'));
     }
-    else if(requestType === "JSON")
-    {
+    // url = url + '?' + dataStr;
+  } else {
+    if (requestType === "FORMDATA") {
+      Object.keys(data).forEach(key => {
+        dataStr += key + '=' + data[key] + '&';
+      })
+      dataStr = dataStr.substr(0, dataStr.lastIndexOf('&'));
+    } else if (requestType === "JSON") {
       dataStr = JSON.stringify(data)
     }
-	}
+  }
 
   var xhr = new XMLHttpRequest();
 
   xhr.open(type, url, true);
   xhr.responseType = 'arraybuffer';
   xhr.onload = function () {
-      if (this.status === 200) {
-          //提取文件名
-          var filename = "";
-          var disposition = xhr.getResponseHeader('Content-disposition');
-          if (disposition && disposition.indexOf('attachment') !== -1) {
-              var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
-              var matches = filenameRegex.exec(disposition);
-              if (matches != null && matches[1]) filename = decodeURI(matches[1].replace(/['"]/g, ''));
-          }
-          var type2 = xhr.getResponseHeader('Content-Type');
+    if (this.status === 200) {
+      //提取文件名
+      var filename = "";
+      var disposition = xhr.getResponseHeader('Content-disposition');
+      if (disposition && disposition.indexOf('attachment') !== -1) {
+        var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+        var matches = filenameRegex.exec(disposition);
+        if (matches != null && matches[1]) filename = decodeURI(matches[1].replace(/['"]/g, ''));
+      }
+      var type2 = xhr.getResponseHeader('Content-Type');
 
-          if(typeof File === 'undefined' && typeof Blob === 'undefined')
-          {
-            alert("当前浏览器不支持下载,请使用最新浏览器重试");
-            return;
-          }
+      if (typeof File === 'undefined' && typeof Blob === 'undefined') {
+        alert("当前浏览器不支持下载,请使用最新浏览器重试");
+        return;
+      }
 
-          var blob = typeof File === 'function'
-              ? new File([this.response], filename, { type: type2 })
-              : new Blob([this.response], { type: type2 });
-          if (typeof window.navigator.msSaveBlob !== 'undefined') {
-              window.navigator.msSaveBlob(blob, filename);
-          } else {
-              var URL = window.URL || window.webkitURL;
-              var downloadUrl = URL.createObjectURL(blob);
+      var blob = typeof File === 'function' ?
+        new File([this.response], filename, {
+          type: type2
+        }) :
+        new Blob([this.response], {
+          type: type2
+        });
+      if (typeof window.navigator.msSaveBlob !== 'undefined') {
+        window.navigator.msSaveBlob(blob, filename);
+      } else {
+        var URL = window.URL || window.webkitURL;
+        var downloadUrl = URL.createObjectURL(blob);
 
-              if (filename) {
-                  var a = document.createElement("a");
-                  if (typeof a.download === 'undefined') {
-                      window.location = downloadUrl;
-                  } else {
-                      a.href = downloadUrl;
-                      a.download = filename;
-                      document.body.appendChild(a);
-                      a.click();
-                  }
-              } else {
-                  window.location = downloadUrl;
-              }
-              setTimeout(function () { URL.revokeObjectURL(downloadUrl); }, 100);
+        if (filename) {
+          var a = document.createElement("a");
+          if (typeof a.download === 'undefined') {
+            window.location = downloadUrl;
+          } else {
+            a.href = downloadUrl;
+            a.download = filename;
+            document.body.appendChild(a);
+            a.click();
           }
+        } else {
+          window.location = downloadUrl;
+        }
+        setTimeout(function () {
+          URL.revokeObjectURL(downloadUrl);
+        }, 100);
       }
-       $('.ivu-spin-fullscreen-wrapper').remove();
+    }
+    $('.ivu-spin-fullscreen-wrapper').remove();
   };
-  if(requestType && requestType === "JSON") {
-  	xhr.setRequestHeader('Content-type', 'application/json');
-  }
-  else {
-  	xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+  if (requestType && requestType === "JSON") {
+    xhr.setRequestHeader('Content-type', 'application/json');
+  } else {
+    xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
   }
 
   xhr.setRequestHeader('token', localStorage.token || "");
 
-  if(type == 'POST') {
-  	xhr.send(dataStr);
-  }
-  else {
-  	xhr.send();
+  if (type == 'POST') {
+    xhr.send(dataStr);
+  } else {
+    xhr.send();
   }
 }

+ 84 - 157
config/fetch.js

@@ -1,22 +1,19 @@
 import '../static/encry.min.js' //接口加密工具
 import Vue from 'vue'
-function initData(params)
-{
+
+function initData(params) {
   var URLSearchParams = require('url-search-params');
   //360浏览器不支持URLSearchParams
-  if(typeof URLSearchParams==="function")
-  {
+  if (typeof URLSearchParams === "function") {
     var formMap = new URLSearchParams();
-    for(var key in params){
-      if(typeof(params[key]) == "undefined") {
+    for (var key in params) {
+      if (typeof (params[key]) == "undefined") {
         params[key] = '';
       }
       formMap.append(key, params[key]);
     }
     return formMap;
-  }
-  else
-  {
+  } else {
     return params;
   }
 
@@ -25,76 +22,24 @@ function initData(params)
 let project = host.PROJECT;
 const prodServer = require('./prod/' + project + '.js'); //服务信息
 
-export default async(url = '',baseUrl='',data = {},dataType = 'JSON', type = 'GET',pathArr=[], method = 'fetch') => {
+export default async (url = '', baseUrl = '', data = {}, dataType = 'JSON', type = 'GET', pathArr = [], method = 'fetch') => {
   type = type.toUpperCase();
-  if(process.env.NODE_ENV === 'development'){
-    baseUrl=baseUrl;
-  }
-  else if(process.env.NODE_ENV === 'production')
-  {
-    if(baseUrl)
-    {
-      switch (baseUrl)
-      {
+  if (process.env.NODE_ENV === 'development') {
+    baseUrl = baseUrl;
+  } else if (process.env.NODE_ENV === 'production') {
+    if (baseUrl) {
+      switch (baseUrl) {
         case '/landcrm':
-          baseUrl = prodServer("landcrm");
-          break;
-        case '/activity': //微信运营-活动
-          baseUrl = prodServer("activity");
-          break;
-        case '/steward': //微信运营-管家
-          baseUrl = prodServer("steward");
-          break;
-        case '/knowledge': //微信运营-文章
-          baseUrl = prodServer("knowledge");
-          break;
-        case '/manage': //微信运营-会员
-          baseUrl = prodServer("manage");
-          break;
-        case '/community': //会员认证    community: 正式,   communityDev: 测试,qpi:幸福基业
-        	baseUrl = prodServer("community");
-          break;
-        case '/points'://积分
-          baseUrl = prodServer("points");
-        	break;
-        case '/question'://调查问卷
-          baseUrl = prodServer("question");
-          break;
-        case '/sterilization'://消杀计划
-          baseUrl = prodServer("sterilization");
-          break;
-        case '/propaganda'://故事
-          baseUrl = prodServer("propaganda");
-          break;
-        case '/activiti':// 订餐 会议室预订
-          baseUrl = prodServer("activiti");
-          break;
-        case '/bus':// 楼巴管理
-          baseUrl = prodServer("bus");
-          break;
-        case '/statistic':// 统计管理
-          baseUrl = prodServer("statistic");
-          break;
-        case '/member'://
-          baseUrl = prodServer("member");
-          break;
-        case '/itemBorrow'://
-          baseUrl = prodServer("itemBorrow");
+          baseUrl = 'https://test.hajwy.com/landcrm';
           break;
-        case '/borrowRecord'://
-          baseUrl = prodServer("borrowRecord");
+        case '/purchase': //
+          baseUrl = "https://test.hajwy.com/purchase";
           break;
-        case '/voucher'://
-          baseUrl = prodServer("voucher");
+        case '/hajwy': //
+          baseUrl = "https://test.hajwy.com/qpi/rest";
           break;
-        case '/guesthouse'://
-          baseUrl = prodServer("guesthouse");
-          break;
-        case '/apartment'://
-          baseUrl = prodServer("apartment");
-          break;
-          case '/car'://
-          baseUrl = prodServer("car");
+        case '/mkf': //
+          baseUrl = "https://pms.hajwy.com/landcrm";
           break;
         default:
           baseUrl = "";
@@ -105,25 +50,23 @@ export default async(url = '',baseUrl='',data = {},dataType = 'JSON', type = 'GE
   }
 
   url = baseUrl + url;
-  if(pathArr && pathArr.length>0)
-  {
-    url+="/"+pathArr.join("/");
+  if (pathArr && pathArr.length > 0) {
+    url += "/" + pathArr.join("/");
   }
   if (type == 'GET' || type == 'DELETE') {
     let dataStr = ''; //数据拼接字符串
     Object.keys(data).forEach(key => {
-      if(typeof(data[key]) == "undefined") {
+      if (typeof (data[key]) == "undefined") {
         data[key] = "";
       }
       dataStr += key + '=' + encodeURIComponent(data[key]) + '&';
     })
     if (dataStr !== '') {
       dataStr = dataStr.substr(0, dataStr.lastIndexOf('&'));
-      url = url + '?' + dataStr+'&_t=' + new Date().getTime();
+      url = url + '?' + dataStr + '&_t=' + new Date().getTime();
+    } else {
+      url = url + '?_t=' + new Date().getTime();
     }
-		else{
-			url = url + '?_t=' + new Date().getTime();
-		}
   }
   if (window.fetch && method == 'fetch') {
     var header_content = {
@@ -133,39 +76,34 @@ export default async(url = '',baseUrl='',data = {},dataType = 'JSON', type = 'GE
       'token': ''
     };
 
-    if(dataType && dataType==="XML")
-    {
+    if (dataType && dataType === "XML") {
       header_content = {
         'Accept': 'application/xml',
         'Content-Type': 'application/x-www-form-urlencoded'
       };
-    }
-    else if(dataType && dataType==="JSON2")
-    {
+    } else if (dataType && dataType === "JSON2") {
       header_content = {
         'Accept': 'application/json',
         'Content-Type': 'application/json'
       };
-    }
-    else if(dataType && dataType === "FORMDATA")
-    {
+    } else if (dataType && dataType === "FORMDATA") {
       header_content = {
         dataType: "json",
-        cache: false,//上传文件无需缓存
-	      processData: false,//用于对data参数进行序列化处理 这里必须false
+        cache: false, //上传文件无需缓存
+        processData: false, //用于对data参数进行序列化处理 这里必须false
         // contentType: "application/x-www-form-urlencoded", //必须
         ContentType: "application/x-www-form-urlencoded"
       };
     }
 
 
-    if(localStorage.token != "" && typeof(localStorage.token) !== "undefined") {
+    if (localStorage.token != "" && typeof (localStorage.token) !== "undefined") {
       header_content.client_token = localStorage.token;
       header_content.token = localStorage.token;
     }
-    header_content.sign = key_gen.encode(key_gen.handlerData(type == 'GET'?url.substring(url.indexOf("?")+1):data));
+    header_content.sign = key_gen.encode(key_gen.handlerData(type == 'GET' ? url.substring(url.indexOf("?") + 1) : data));
 
-    if(localStorage.user_id){
+    if (localStorage.user_id) {
       header_content["userId"] = localStorage.user_id;
     }
 
@@ -177,23 +115,23 @@ export default async(url = '',baseUrl='',data = {},dataType = 'JSON', type = 'GE
       cache: "force-cache"
     }
 
-     if ((type == 'POST' || type == 'PUT' || type == 'DELETE') && dataType!="JSON2"&& dataType!="FORMDATA") {
+    if ((type == 'POST' || type == 'PUT' || type == 'DELETE') && dataType != "JSON2" && dataType != "FORMDATA") {
       Object.defineProperty(requestConfig, 'body', {
         value: initData(data)
       })
-    }else if((type == 'POST' || type == 'PUT' || type == 'DELETE') && dataType=="JSON2"){
+    } else if ((type == 'POST' || type == 'PUT' || type == 'DELETE') && dataType == "JSON2") {
       Object.defineProperty(requestConfig, 'body', {
-          value: JSON.stringify(data)
-        })
-    }else if((type == 'POST') && dataType=="FORMDATA"){
+        value: JSON.stringify(data)
+      })
+    } else if ((type == 'POST') && dataType == "FORMDATA") {
       Object.defineProperty(requestConfig, 'body', {
-          value: data
-        })
+        value: data
+      })
     }
 
     try {
       const response = await fetch(url, requestConfig);
-      if(response.headers.get("token_code") == -2 || response.headers.get("token_code") == -1){
+      if (response.headers.get("token_code") == -2 || response.headers.get("token_code") == -1) {
         Vue.prototype.$Message.config({
           top: 80,
           duration: 3
@@ -203,37 +141,32 @@ export default async(url = '',baseUrl='',data = {},dataType = 'JSON', type = 'GE
         console.log(requestConfig);
         console.log("------end-------");
         Vue.prototype.$Message.info("当前账号已过期,请重新登录!");
-        Vue.prototype.$Message=function(str){return;}
-        setTimeout(function(){
+        Vue.prototype.$Message = function (str) {
+          return;
+        }
+        setTimeout(function () {
           localStorage.clear();
-          if(host.PROJECT && host.PROJECT=="xingfujiye")
-          {
-            window.location.href = "http://csms.cfldcn.com:5902/qpi/logoutFilter?returnUrl="+Util.filterUrl(window.location.href);
-          }
-          else
-          {
+          if (host.PROJECT && host.PROJECT == "xingfujiye") {
+            window.location.href = "http://csms.cfldcn.com:5902/qpi/logoutFilter?returnUrl=" + Util.filterUrl(window.location.href);
+          } else {
             location.reload();
           }
           return;
         }, 3000);
-      }
-      else {
-        if(dataType && dataType==="XML")
-        {
+      } else {
+        if (dataType && dataType === "XML") {
           const responseJson = await response.text();
           return responseJson
-        }
-        else
-        {
+        } else {
           const responseJson = await response.json();
           return responseJson
         }
       }
     } catch (error) {
       Vue.prototype.$Spin.hide();
-      const responseJson={
-        errCode:500,
-        msg:"系统异常"
+      const responseJson = {
+        errCode: 500,
+        msg: "系统异常"
       };
       return responseJson;
     }
@@ -247,49 +180,43 @@ export default async(url = '',baseUrl='',data = {},dataType = 'JSON', type = 'GE
       }
 
       let sendData = '';
-      if ((type == 'POST' || type == 'PUT' || type == 'DELETE') && dataType!="JSON2"&& dataType!="FORMDATA") {
-	      sendData = initData(data);
-	    }else if((type == 'POST' || type == 'PUT' || type == 'DELETE') && dataType=="JSON2"){
-	      sendData = JSON.stringify(data);
-	    }else if((type == 'POST') && dataType=="FORMDATA"){
-	      sendData = data;
-	    }
+      if ((type == 'POST' || type == 'PUT' || type == 'DELETE') && dataType != "JSON2" && dataType != "FORMDATA") {
+        sendData = initData(data);
+      } else if ((type == 'POST' || type == 'PUT' || type == 'DELETE') && dataType == "JSON2") {
+        sendData = JSON.stringify(data);
+      } else if ((type == 'POST') && dataType == "FORMDATA") {
+        sendData = data;
+      }
 
       requestObj.open(type, url, true);
-      requestObj.setRequestHeader("Accept","application/json");
+      requestObj.setRequestHeader("Accept", "application/json");
 
-	    if(dataType && dataType==="XML")
-	    {
-	    	requestObj.setRequestHeader("Accept","application/xml");
-	    	requestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
-	    }
-	    else if(dataType && dataType==="JSON2")
-	    {
-	    	requestObj.setRequestHeader("Accept","application/json");
-	    	requestObj.setRequestHeader("Content-type", "application/json");
-	    }
-	    else if(dataType && dataType === "FORMDATA")
-	    {
-	    	requestObj.setRequestHeader("Accept","application/json");
-	    	requestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
-	    	requestObj.setRequestHeader("dataType", "json");
-	    	requestObj.setRequestHeader("cache", false); //上传文件无需缓存
-	    	requestObj.setRequestHeader("processData", false); //用于对data参数进行序列化处理 这里必须false
-	    	requestObj.setRequestHeader("contentType", false); //必须
-	    }
-	    else {
-	    	requestObj.setRequestHeader("Accept","application/json");
-	    	requestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
-	    }
+      if (dataType && dataType === "XML") {
+        requestObj.setRequestHeader("Accept", "application/xml");
+        requestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+      } else if (dataType && dataType === "JSON2") {
+        requestObj.setRequestHeader("Accept", "application/json");
+        requestObj.setRequestHeader("Content-type", "application/json");
+      } else if (dataType && dataType === "FORMDATA") {
+        requestObj.setRequestHeader("Accept", "application/json");
+        requestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+        requestObj.setRequestHeader("dataType", "json");
+        requestObj.setRequestHeader("cache", false); //上传文件无需缓存
+        requestObj.setRequestHeader("processData", false); //用于对data参数进行序列化处理 这里必须false
+        requestObj.setRequestHeader("contentType", false); //必须
+      } else {
+        requestObj.setRequestHeader("Accept", "application/json");
+        requestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+      }
       requestObj.setRequestHeader("client_token", localStorage.token || "");
       requestObj.setRequestHeader("token", localStorage.token || "");
-    	requestObj.setRequestHeader("sign", key_gen.encode(key_gen.handlerData(type == 'GET'?url.substring(url.indexOf("?")+1):data)));
-      if(localStorage.user_id){
-      	requestObj.setRequestHeader("x-user-id-header", localStorage.user_id);
-	    }
+      requestObj.setRequestHeader("sign", key_gen.encode(key_gen.handlerData(type == 'GET' ? url.substring(url.indexOf("?") + 1) : data)));
+      if (localStorage.user_id) {
+        requestObj.setRequestHeader("x-user-id-header", localStorage.user_id);
+      }
       requestObj.send(sendData);
 
-			requestObj.onreadystatechange = () => {
+      requestObj.onreadystatechange = () => {
         if (requestObj.readyState == 4) {
           if (requestObj.status == 200) {
             let obj = requestObj.response || requestObj.responseT

+ 7 - 6
config/index.js

@@ -60,7 +60,7 @@ module.exports = {
         }
       },
       "/landcrm": { //基础服务
-        target: devServer("landcrm"),
+        target: "https://test.hajwy.com/landcrm",
         secure: false,
         changeOrigin: true,
         pathRewrite: {
@@ -155,8 +155,8 @@ module.exports = {
           '^/file': '/'
         }
       },
-      "/mkf": { //采购结算明细对接
-        target: 'https://pms.hajwy.com/landcrm',
+      "/mkf": { //地区、项目获取
+        target: 'https://test.hajwy.com/landcrm',
         secure: false,
         changeOrigin: true,
         pathRewrite: {
@@ -171,9 +171,10 @@ module.exports = {
           '^/hajwy': '/'
         }
       },
-      "/purchase": { //采购供应商管理测试
-        //target: "http://www.jihengcc.cn:17080/purchase", //采购供应商管理测试
-        target: "http://172.18.1.40:8080/purchase", //采购供应商管理测试
+      "/purchase": { //采采购管理整体测试
+        // target: "http://www.jihengcc.cn:17080/purchase", //采购供应商管理测试
+        // target: "https://test.hajwy.com/purchase", //采购供应商管理测试
+        target: "http://172.18.1.79:8989/purchase",
         // target: "http://172.18.1.253:8080/purchase",
         secure: false,
         changeOrigin: true,

+ 4 - 4
src/assets/js/menu/slideMenuItems.js

@@ -41,10 +41,10 @@ module.exports = [
     type: 'tree',
     name: '报表中心',
     items: [{
-      type: 'item',
-      name: '申购计划报表',
-      router: '/index/reportPurchasePlan'
-    },{
+    //   type: 'item',
+    //   name: '申购计划报表',
+    //   router: '/index/reportPurchasePlan'
+    // },{
       type: 'item',
       name: '物料历史价格报表',
       router: '/index/reportHistoryCost'

+ 12 - 13
src/page/baseInfo/components/supply/supplyAdd.vue

@@ -49,7 +49,7 @@
           </Col>
           <Col span="4" class-name="tables">所属区域</Col>
           <Col span="4" class-name="tables">
-            <Select multiple v-model="form.ssqy" placeholder="所属区域" style="width: 95%">
+            <Select v-model="form.ssqy" placeholder="所属区域" style="width: 95%">
               <Option
                 v-for="item in ssqyList"
                 :value="item.areaId"
@@ -211,7 +211,7 @@ export default {
         gyslxdh: "", //供应商联系电话
         gysfl: "", //供应商分类
         gyspj: "", //供应商评级
-        ssqy: [], //所属区域
+        ssqy: "", //所属区域
         fgcgy: "", //分管采购员
         qyzt: "1", //启用状态
         clsj: "", //成立时间
@@ -262,9 +262,8 @@ export default {
     uploadFilesSuccess(response, file, fileList) {
       this.uploading = false;
       this.form.filesList.push({
-        fileName: response.fileInfo.fName,
-        fileSize: "",
-        filePath: response.fileInfo.resPath
+        fileName: response.data.fileName,
+        filePath: response.data.filePath
         // fileDetailType: ""
       });
     },
@@ -298,12 +297,12 @@ export default {
     },
     // 新增供应商
     addGys() {
-      let arr = [];
-      for (let i = 0; i < this.form.ssqy.length; i++) {
-        arr.push(
-          this.ssqyList.filter(a => a.areaId == this.form.ssqy[i])[0].areaName
-        );
-      }
+      // let arr = [];
+      // for (let i = 0; i < this.form.ssqy.length; i++) {
+      //   arr.push(
+      //     this.ssqyList.filter(a => a.areaId == this.form.ssqy[i])[0].areaName
+      //   );
+      // }
       let data = {
         gpName: this.form.gysmc,
         gpAbbreviation: this.form.gysjc,
@@ -317,8 +316,8 @@ export default {
         gpGradeName: this.gyspjList.filter(
           a => a.detailId == this.form.gyspj
         )[0].detailName,
-        gpRegionId: this.form.ssqy.join(","),
-        gpRegionName: arr.join(","),
+        gpRegionId: this.form.ssqy,
+        gpRegionName: this.ssqyList.filter(a => a.areaId == this.form.ssqy)[0].areaName,
         gpBuyerId: this.form.fgcgy,
         gpBuyerName: this.fgcgyList.filter(a => a.userId == this.form.fgcgy)[0]
           .userName,

+ 87 - 42
src/page/baseInfo/components/supply/supplyEdit.vue

@@ -56,25 +56,14 @@
           </Col>
           <Col span="4" class-name="tables">所属区域</Col>
           <Col span="4" class-name="tables">
-            <Select
-              v-if="editing"
-              multiple
-              v-model="form.ssqy"
-              placeholder="所属区域"
-              style="width: 95%"
-            >
+            <Select v-if="editing" v-model="form.ssqy" placeholder="所属区域" style="width: 95%">
               <Option
                 v-for="item in ssqyList"
                 :value="item.areaId"
                 :key="item.areaId"
               >{{ item.areaName }}</Option>
             </Select>
-            <div v-else>
-              <span v-for="(item, index) in form.ssqy" :key="index">
-                {{
-                ssqyList.filter(a => a.areaId = item)[0].areaName }}
-              </span>
-            </div>
+            <div v-else>{{ssqyList.filter(a => a.areaId = form.ssqy)[0].areaName }}</div>
           </Col>
           <Col span="4" class-name="tables">分管采购员</Col>
           <Col span="4" class-name="tables">
@@ -128,7 +117,7 @@
                 <span>否</span>
               </Radio>
             </RadioGroup>
-            <span v-else>{{ form.qyzt == '1' ? '是' : '否' }}</span>
+            <span v-else>{{ form.ybnsr == '1' ? '是' : '否' }}</span>
           </Col>
           <Col span="4" class-name="tables">税务登记号</Col>
           <Col span="4" class-name="tables">
@@ -315,30 +304,39 @@
         <Row class="mainCont">
           <Col span="6" class-name="tables">物品分类</Col>
           <Col span="6" class-name="tables">
-            <Select v-model="xzbjForm.wpfl" style="width: 95%" :transfer="true">
-              <Option
-                v-for="item in wpflList"
-                :value="item.value"
-                :key="item.value"
-              >{{ item.label }}</Option>
-            </Select>
+            <Cascader
+              :data="wpflList"
+              v-model="xzbjForm.wpfl"
+              @on-change="wpflChange"
+              style="line-height:inherit"
+            ></Cascader>
           </Col>
           <Col span="6" class-name="tables">报价物品</Col>
           <Col span="6" class-name="tables">
-            <Select v-model="xzbjForm.bjwp" style="width: 95%" :transfer="true">
-              <Option
-                v-for="item in bjwpList"
-                :value="item.value"
-                :key="item.value"
-              >{{ item.label }}</Option>
+            <Select
+              v-model="xzbjForm.bjwp"
+              @on-change="bjwpChange"
+              style="width: 95%"
+              :transfer="true"
+            >
+              <Option v-for="item in bjwpList" :value="item.sgId" :key="item.sgId">{{ item.gcName }}</Option>
             </Select>
           </Col>
           <Col span="6" class-name="tables">物品编码</Col>
-          <Col span="6" class-name="tables">自动带出</Col>
+          <Col
+            span="6"
+            class-name="tables"
+          >{{ this.xzbjForm.wpbm == "" ? "-" : this.xzbjForm.wpbm }}</Col>
           <Col span="6" class-name="tables">规格型号</Col>
-          <Col span="6" class-name="tables">自动带出</Col>
+          <Col
+            span="6"
+            class-name="tables"
+          >{{ this.xzbjForm.ggxh == "" ? "-" : this.xzbjForm.ggxh }}</Col>
           <Col span="6" class-name="tables">计量单位</Col>
-          <Col span="6" class-name="tables">自动带出</Col>
+          <Col
+            span="6"
+            class-name="tables"
+          >{{ this.xzbjForm.jldw == "" ? "-" : this.xzbjForm.jldw }}</Col>
           <Col span="6" class-name="tables">含税单价(元)</Col>
           <Col span="6" class-name="tables">
             <Input v-model="xzbjForm.hsdj" placeholder="请输入" style="width: 95%" />
@@ -498,7 +496,9 @@ import {
   addGoodProviderBankCard, //新增银行账号
   deleteGoodProviderBankCard, //删除银行账号
   updateGoodProviderBankCard, //编辑银行账号
-  stockGoodsByGpID //供货商详情查询
+  stockGoodsByGpID, //供货商详情查询
+  tbiGoodsCategoryList, //获取物品分类
+  tbiStockGoods //获取物料列表
 } from "@/service/getData";
 export default {
   props: ["gpId", "gysflList", "gyspjList", "ssqyList", "fgcgyList"],
@@ -548,7 +548,7 @@ export default {
       xzbjTitle: "新增报价",
       xzbjEditId: "",
       xzbjForm: {
-        wpfl: "", //物品分类
+        wpfl: [], //物品分类
         bjwp: "", //报价物品
         wpbm: "", //物品编码
         ggxh: "", //规格型号
@@ -835,6 +835,31 @@ export default {
   },
   created() {
     this.getData();
+    tbiGoodsCategoryList().then(res => {
+      // this.allFlList = res.data.data;
+      let arr = [];
+      for (let index in res.data.data) {
+        if (res.data.data[index].parentId == null) {
+          this.wpflList.push({
+            label: res.data.data[index].gcName,
+            value: res.data.data[index].gcId,
+            children: []
+          });
+        }
+      }
+      for (let index in this.wpflList) {
+        let arr = res.data.data.filter(
+          a => a.parentId == this.wpflList[index].value
+        );
+        console.log(this.wpflList[index].value, arr);
+        for (let i in arr) {
+          this.wpflList[index].children.push({
+            label: arr[i].gcName,
+            value: arr[i].gcId
+          });
+        }
+      }
+    });
   },
   methods: {
     //新增报价
@@ -908,6 +933,25 @@ export default {
       this.xzbjTitle = "新增报价";
       this.xzbjShow = true;
     },
+    //报价 -- 物品分类切换
+    wpflChange(val) {
+      let postData = {
+        gcParentid: val[0],
+        gcId: val[1]
+      };
+      tbiStockGoods(postData).then(res => {
+        if (res.status == 200) {
+          this.bjwpList = res.data;
+        }
+      });
+    },
+    //报价 --  报价物品切换
+    bjwpChange(val) {
+      let arr = this.bjwpList.filter(a => a.sgId == val);
+      this.xzbjForm.wpbm = arr[0].sgNo;
+      this.xzbjForm.ggxh = arr[0].standardModel;
+      this.xzbjForm.jldw = arr[0].measureUnit;
+    },
     //引入人员
     yrryOk() {},
     yrryCancel() {
@@ -1109,10 +1153,10 @@ export default {
     uploadFilesSuccess(response, file, fileList) {
       this.uploading = false;
       this.form.filesList.push({
-        fileName: response.fileInfo.fileName,
-        fullName: response.fileInfo.fName,
-        resPath: response.fileInfo.resPath,
-        fileDetailType: ""
+        fileName: response.data.fileName,
+        // fullName: response.data.fName,
+        filePath: response.data.filePath
+        // fileDetailType: ""
       });
     },
     //列表方法 1-供货详情 2-报价记录 3-联系人 4-银行账号
@@ -1281,7 +1325,7 @@ export default {
           this.ssqyList.filter(a => a.areaId == this.form.ssqy[i])[0].areaName
         );
       }
-      let data = {
+      let postData = {
         gpId: this.gpId,
         gpName: this.form.gysmc,
         gpAbbreviation: this.form.gysjc,
@@ -1295,8 +1339,9 @@ export default {
         gpGradeName: this.gyspjList.filter(
           a => a.detailId == this.form.gyspj
         )[0].detailName,
-        gpRegionId: this.form.ssqy.join(","),
-        gpRegionName: arr.join(","),
+        gpRegionId: this.form.ssqy,
+        gpRegionName: this.ssqyList.filter(a => a.areaId == this.form.ssqy)[0]
+          .areaName,
         gpBuyerId: this.form.fgcgy,
         gpBuyerName: this.fgcgyList.filter(a => a.userId == this.form.fgcgy)[0]
           .userName,
@@ -1307,8 +1352,8 @@ export default {
         gpTaxRegistrationNo: this.form.swdjh,
         gpBusinessLicense: this.form.yyzz,
         gpUnitProperty: this.form.dwxz,
-        gpRegisteredCapital: this.form.zczb,
-        gpAssets: this.form.zcgm,
+        gpRegisteredCapital: Number(this.form.zczb),
+        gpAssets: Number(this.form.zcgm),
         gpAccountPeriod: this.form.zqts,
         mainBusiness: this.form.zyyw,
         gpAddress: this.form.gysdz,
@@ -1316,7 +1361,7 @@ export default {
         attachments: this.form.filesList
       };
       this.spinShow = true;
-      updateGoodProvider(data).then(res => {
+      updateGoodProvider(postData).then(res => {
         this.spinShow = false;
         if (res.status == 200) {
           this.editing = false;

+ 2 - 3
src/page/baseInfo/supply.vue

@@ -9,9 +9,8 @@
       </div>
       <Row :gutter="10" style="margin-bottom: 10px">
         <Col span="6">
-          <Select multiple v-model="searchForm.ssqy" placeholder="所属区域" @on-change="ssqyChange">
+          <Select v-model="searchForm.ssqy" placeholder="所属区域" @on-change="ssqyChange">
             <Option
-              :disabled="searchForm.ssqy.indexOf('all') != -1"
               v-for="item in ssqyList"
               :value="item.areaId"
               :key="item.areaId"
@@ -136,7 +135,7 @@ export default {
       handleWidth: 100,
       //   查询参数
       searchForm: {
-        ssqy: [], //所属区域
+        ssqy: "", //所属区域
         gysfl: "", //供应商分类
         gyspj: "", //供应商评级
         gysbh: "", //供应商编号

+ 38 - 6
src/page/purchase/components/balance/balanceAdd.vue

@@ -6,7 +6,7 @@
         <p slot="title">采购结算详情</p>
         <div slot="extra">
           <Button @click="addJs">保存</Button>
-          <Button>提交</Button>
+          <Button v-if="balanceType == 'edit' && (form.spzt == '1' || form.spzt == '4')">提交</Button>
           <Button @click="cancel">取消</Button>
         </div>
         <Row class="mainCont">
@@ -52,7 +52,7 @@
             <span class="mustSpan">*</span>
           </Col>
           <Col span="4" class-name="tables">
-            <Select v-model="form.gys" style="width: 95%" @on-change="gysChange">
+            <Select v-model="form.gys" filterable style="width: 95%" @on-change="gysChange">
               <Option v-for="item in gysList" :value="item.gpId" :key="item.gpId">{{ item.gpName }}</Option>
             </Select>
           </Col>
@@ -194,7 +194,8 @@ import {
   queryPurchaseSettlementInfo,
   editPurchaseSettlement,
   selectGoodProviderSelectionList,
-  getProjectList
+  getProjectList,
+  submitPurchaseSettlement
 } from "@/service/getData";
 import balanceMxAdd from "./balanceMxAdd";
 export default {
@@ -353,7 +354,7 @@ export default {
           let data = res.data;
           this.form.glqy = Number(data.areaId);
           this.form.glxm = Number(data.projectId);
-          this.form.gys = Number(data.supplierId);
+          this.form.gys = data.supplierId;
           this.form.gffzr = data.supplierPrincipal;
           this.form.gyslxdh = Number(data.supplierTel);
           this.form.khh = data.depositBank;
@@ -390,7 +391,8 @@ export default {
       let postData = {
         settlementId: this.settlementId,
         areaId: this.form.glqy,
-        areaName: this.glqyList.filter(a => a.areaId == this.form.glqy)[0].areaName,
+        areaName: this.glqyList.filter(a => a.areaId == this.form.glqy)[0]
+          .areaName,
         supplierId: this.form.gys,
         supplierPrincipal: this.form.gffzr,
         supplierTel: this.form.gyslxdh,
@@ -415,6 +417,35 @@ export default {
         }
       });
     },
+    submitJs() {
+      let postData = {
+        settlementId: this.settlementId,
+        areaId: this.form.glqy,
+        areaName: this.glqyList.filter(a => a.areaId == this.form.glqy)[0]
+          .areaName,
+        supplierId: this.form.gys,
+        supplierPrincipal: this.form.gffzr,
+        supplierTel: this.form.gyslxdh,
+        depositBank: this.form.khh,
+        accountNumber: this.form.zh,
+        type: this.form.djlx,
+        receivedName: this.form.shr,
+        adjustmentPrice: this.form.tzje,
+        instruction: this.form.sm,
+        attachmentList: this.form.filesList,
+        applicantId: localStorage.user_id,
+        applicantName: localStorage.user_name,
+        attachmentList: this.form.filesList,
+        detailList: this.tableData
+      };
+      submitPurchaseSettlement(postData).then(res => {
+        if (res.status == 200) {
+          this.$Message.success("提交结算详情成功!");
+        } else {
+          this.$Message.error(res.message);
+        }
+      });
+    },
     //新增结算
     addJs() {
       if (this.balanceType == "edit") {
@@ -432,7 +463,8 @@ export default {
       let postData = {
         areaId: this.form.glqy,
         projectId: this.form.glxm,
-        areaName: this.glqyList.filter(a => a.areaId == this.form.glqy)[0].areaName,
+        areaName: this.glqyList.filter(a => a.areaId == this.form.glqy)[0]
+          .areaName,
         projectName: this.glxmList.filter(a => a.projectId == this.form.glxm)[0]
           .projectName,
         supplierId: this.form.gys,

+ 2 - 1
src/page/purchase/components/balance/balanceMxAdd.vue

@@ -167,7 +167,8 @@ export default {
         storehouseTimeStart: this.addForm.rksj[0],
         storehouseTimeEnd: this.addForm.rksj[1],
         warehouseEntry: this.addForm.rkd,
-        supplierId: this.gysId
+        // supplierId: this.gysId
+        supplierId: 1000595
       };
       let postStr = "";
       for (let item in postData) {

+ 31 - 13
src/page/purchase/components/order/orderAdd.vue

@@ -5,18 +5,19 @@
       <Card style="width:100%" :bordered="false" :dis-hover="true">
         <p slot="title">采购订单详情</p>
         <div slot="extra">
-          <Button @click="addCgdd" v-if="orderType == 'add'">提交</Button>
           <Button
-            @click="editCgdd"
-            v-if="form.spzt == '1' || form.spzt == '' || form.spzt == '4'"
-          >保存</Button>
+            @click="submitCgdd"
+            v-if="(orderType == 'edit') && (form.spzt == '1' || form.spzt == '4')"
+          >提交</Button>
+          <Button @click="addCgdd" v-if="form.spzt == '1' || form.spzt == '' || form.spzt == '4'">保存</Button>
           <Button @click="cancel">取消</Button>
         </div>
         <Row class="mainCont">
           <Col span="4" class-name="tables">订购编号</Col>
           <Col span="4" class-name="tables">
-            <span v-if="orderType == 'add'">保存成功后生成</span>
-            <span v-else>{{ form.dgbh }}</span>
+            <!-- <span v-if="orderType == 'add'">保存成功后生成</span>
+            <span v-else>{{ form.dgbh }}</span>-->
+            {{ orderType == 'add' ? '保存成功后生成' : form.dgbh }}
           </Col>
           <Col span="4" class-name="tables">标题</Col>
           <Col span="4" class-name="tables">
@@ -52,7 +53,7 @@
                 :disabled="form.spzt == '2' || form.spzt == '3'"
               >{{ item.projectName }}</Option>
             </Select>
-            <span v-else>{{ form.glxm.split(',')[1] }}</span>
+            <span v-else>s{{ form.glxm.split(',')[1] }}</span>
           </Col>
           <Col span="4" class-name="tables">单据类型</Col>
           <Col span="4" class-name="tables">
@@ -103,7 +104,7 @@
             ></DatePicker>
           </Col>
           <Col span="4" class-name="tables">交货地点</Col>
-          <Col span="4" class-name="tables">计算属性</Col>
+          <Col span="4" class-name="tables">{{ form.jhdd }}</Col>
           <Col span="4" class-name="tables">收货人</Col>
           <Col span="4" class-name="tables">
             <Input
@@ -316,7 +317,8 @@ import {
   findPurchaseOrder,
   editPurchaseOrder,
   getLabelByCode,
-  getProjectList
+  getProjectList,
+  submitPurchaseOrder
 } from "@/service/getData";
 import orderMxAdd from "./orderMxAdd";
 export default {
@@ -523,9 +525,8 @@ export default {
     uploadFilesSuccess(response, file, fileList) {
       this.uploading = false;
       this.form.filesList.push({
-        fileName: response.fileInfo.fileName,
-        fullName: response.fileInfo.fName,
-        resPath: response.fileInfo.resPath,
+        fileName: response.data.fileName,
+        resPath: response.data.filePath,
         fileDetailType: ""
       });
     },
@@ -573,8 +574,10 @@ export default {
           this.form.gffzr = data.gpcName;
           this.form.gyslxdh = data.gpcPhone;
           this.form.spzt = data.approvalState;
+          this.form.sm = data.instruction;
           this.form.ddzt = data.orderState;
           this.form.gysmc = data.gpName;
+          this.form.jhdd = data.deliveryPlace;
           this.orderType = "edit";
           for (let item in data.detailList) {
             tableArr.push({
@@ -658,6 +661,19 @@ export default {
         }
       });
     },
+    submitCgdd() {
+      let gpName = this.gysList.filter(a => a.gpId == this.form.gys);
+      let postData = {
+        orderId: this.orderId
+      };
+      submitPurchaseOrder(postData).then(res => {
+        if (res.status == 200) {
+          this.$Message.success("提交采购订单成功!");
+        } else {
+          this.$Message.error(res.message);
+        }
+      });
+    },
     //新增采购订单
     addCgdd() {
       if (this.orderType == "edit") {
@@ -693,6 +709,7 @@ export default {
           this.orderId = res.data.orderId;
           this.form.dgbh = res.data.orderCode;
           this.form.bt = res.data.title;
+          this.form.jhdd = res.data.deliveryPlace;
           this.orderType = "edit";
         } else {
           this.$Message.error(res.message);
@@ -810,12 +827,13 @@ button {
   }
 }
 .mainCont .tables {
-  height: 50px;
+  min-height: 50px;
   border-right: 1px solid #e4e4e4;
   border-bottom: 1px solid #e4e4e4;
   display: flex;
   align-items: center;
   justify-content: center;
+  word-break: break-all;
   &:nth-child(2n + 1) {
     background: #f8f9fb;
   }

+ 2 - 1
src/page/purchase/components/order/orderMxAdd.vue

@@ -190,7 +190,8 @@ export default {
         areaIds: this.areaId.split(',')[0],
         queryText1: this.searchForm.wlmc,
         queryText2: "",
-        projectIds: this.projectId.split(',')[0],
+        // projectIds: this.projectId.split(',')[0],
+        projectIds: 10,
         storehouseId: this.searchForm.ck
       };
       queryPurchasePoolList(postData).then(res => {

+ 4 - 3
src/page/purchase/components/order/orderPrint.vue

@@ -19,7 +19,7 @@
         <div class="line"></div>
         <div class="line"></div>
         <Row>
-          <Col :span="12" class="infor">供应商:{{ printData.gpName ? "" : printData.gpName }}</Col>
+          <Col :span="12" class="infor">供应商:{{ printData.gpName }}</Col>
           <Col :span="6" class="infor">订购单号:{{ printData.orderCode }}</Col>
           <Col
             :span="6"
@@ -29,7 +29,7 @@
           <Col :span="7" class="infor">FAX:{{ printData.gpcFax }}</Col>
           <Col :span="10" class="infor">TEL:{{ printData.gpcPhone }}</Col>
           <Col :span="7" class="infor">申购部门:{{ printData.archName }}</Col>
-          <Col :span="7" class="infor">申购人:{{ printData.applicantName }}</Col>
+          <Col :span="7" class="infor">申购人:{{ printData.purchaserName }}</Col>
           <Col :span="10" class="infor">TEL:{{ printData.purchaserTel}}</Col>
           <Col
             :span="7"
@@ -105,7 +105,7 @@
                 </p>
                 <p>5、供方如向我司相关人员行贿或所供产品出现规格、数量与送货单不符、以假充真等情形的,我司有权按该产品金额“以一罚十”标准要求乙方承担违约责任;如发现有假发票,我司将有权不给予付款并追究其相关法律责任。</p>
                 <p>6、以上价格已含增值税专用发票3%,发票抬头:东莞市光大物业管理有限公司。</p>
-                <p>7、备注:订单日期2019-8-14</p>
+                <p>7、备注:订单日期{{ printData.orderTime.split(' ')[0] }}</p>
               </td>
             </tr>
           </tbody>
@@ -190,6 +190,7 @@ ivu-card-head-inner,
   }
   .infor {
     line-height: 30px;
+    word-break: break-all;
   }
   .foot {
     line-height: 40px;

+ 47 - 2
src/page/purchase/components/plan/planAdd.vue

@@ -6,7 +6,7 @@
         <p slot="title">申购计划详情</p>
         <div slot="extra">
           <Button @click="addSgjh">保存</Button>
-          <Button>提交</Button>
+          <Button @click="submitSgjh" v-if="planType == 'edit' && (form.spzt == '0' || form.spzt == '4')">提交</Button>
           <Button @click="cancel">取消</Button>
         </div>
         <Row class="mainCont">
@@ -217,7 +217,8 @@ import {
   addPurchaseApply,
   queryPurchaseApplyInfo,
   editPurchaseApply,
-  warehouseList
+  warehouseList,
+  submitPurchaseApply
 } from "@/service/getData";
 import planMxAdd from "./planMxAdd";
 export default {
@@ -523,6 +524,50 @@ export default {
       };
       this.spinShow = true;
       editPurchaseApply(postData).then(res => {
+        this.spinShow = false;
+        if (res.status == 200) {
+          this.$Message.success("提交申购计划成功!");
+          this.cancel();
+        } else {
+          this.$Message.error(res.message);
+        }
+      });
+    },
+    submitSgjh() {
+      let cango = true;
+      for (let i in this.tableData) {
+        if (this.tableData[i].storehouseId == "") {
+          cango = false;
+          this.$Message.error("请选择计划明细仓库!");
+          return false;
+        }
+        this.tableData[i].referenceTotalPrice =
+          this.tableData[i].amount * this.tableData[i].referencePrice;
+        this.tableData[i].storehouseName = this.ckList.filter(
+          a => a.twId == this.tableData[i].storehouseId
+        )[0].twName;
+      }
+      if (!cango) {
+        return false;
+      }
+      let postData = {
+        areaId: this.form.ssqy.split(",")[0],
+        areaName: this.form.ssqy.split(",")[1],
+        projectId: this.form.ssxm.split(",")[0],
+        projectName: this.form.ssxm.split(",")[1],
+        type: this.form.jhlx,
+        applyMonth: this.form.date,
+        purchaserId: this.form.fgcgy.split(",")[0],
+        purchaserName: this.form.fgcgy.split(",")[1],
+        applicantId: localStorage.user_id,
+        applicantName: localStorage.user_name,
+        attachmentList: this.form.filesList,
+        remark: this.form.sm,
+        id: this.id,
+        detailList: this.tableData
+      };
+      this.spinShow = true;
+      submitPurchaseApply(postData).then(res => {
         this.spinShow = false;
         if (res.status == 200) {
           this.$Message.success("编辑申购计划成功!");

+ 3 - 3
src/page/purchase/components/plan/planMxAdd.vue

@@ -44,7 +44,7 @@
           </div>
         </template>
       </Table>
-      <Page align="right" :total="pageTotal" @on-change="pageChange" show-total />
+      <!-- <Page align="right" :total="pageTotal" @on-change="pageChange" show-total /> -->
     </Card>
     <Modal v-model="addShow" width="700" title="新增物料申请" @on-ok="addOk">
       <Row class="mainCont">
@@ -250,7 +250,7 @@ export default {
       };
       uploadStockGoods(postData).then(res => {
         if (res.status == 200) {
-          this.$Messgae.success("新增物料成功!");
+          this.$Message.success("新增物料成功!");
           this.addCancel();
         } else {
           this.$Message.error(res.message);
@@ -270,7 +270,7 @@ export default {
     //列表方法
     getTableData() {
       let postData = {
-        gcParentid: this.searchForm.yjfl,
+        gcParentId: this.searchForm.yjfl,
         gcId: this.searchForm.ejfl,
         sgNo: "",
         sgName: "",

+ 778 - 0
src/page/purchase/components/pool/poolAdd.vue

@@ -0,0 +1,778 @@
+<template>
+  <div>
+    <!-- 页面主体内容 -->
+    <div class="planAddContent" v-show="contentShow">
+      <Card style="width:100%" :bordered="false" :dis-hover="true">
+        <p slot="title">采购订单详情</p>
+        <div slot="extra">
+          <Button
+            @click="submitCgdd"
+            v-if="(orderType == 'edit') && (form.spzt == '1' || form.spzt == '4')"
+          >提交</Button>
+          <Button @click="addCgdd" v-if="form.spzt == '1' || form.spzt == '' || form.spzt == '4'">保存</Button>
+          <Button @click="cancel">取消</Button>
+        </div>
+        <Row class="mainCont">
+          <Col span="4" class-name="tables">订购编号</Col>
+          <Col span="4" class-name="tables">
+            <!-- <span v-if="orderType == 'add'">保存成功后生成</span>
+            <span v-else>{{ form.dgbh }}</span>-->
+            {{ orderType == 'add' ? '保存成功后生成' : form.dgbh }}
+          </Col>
+          <Col span="4" class-name="tables">标题</Col>
+          <Col span="4" class-name="tables">
+            <span v-if="orderType == 'add'">保存成功后生成</span>
+            <span v-else>{{ form.bt }}</span>
+          </Col>
+          <Col span="4" class-name="tables">总价(元)</Col>
+          <Col span="4" class-name="tables">{{ form.totalPrice }}</Col>
+          <Col span="4" class-name="tables">关联区域</Col>
+          <Col span="4" class-name="tables">
+            <Select
+              v-model="form.glqy"
+              style="width: 95%"
+              v-if="orderType == 'add'"
+              @on-change="ssqyChange"
+              disabled
+            >
+              <Option
+                v-for="item in glqyList"
+                :value="item.areaId + ',' + item.areaName"
+                :key="item.areaId"
+              >{{ item.areaName }}</Option>
+            </Select>
+            <span v-else>{{ form.glqy.split(',')[1] }}</span>
+          </Col>
+          <Col span="4" class-name="tables">关联项目</Col>
+          <Col span="4" class-name="tables">
+            <Select
+              v-model="form.glxm"
+              style="width: 95%"
+              v-if="orderType == 'add'"
+              disabled
+            >
+              <Option
+                v-for="item in glxmList"
+                :value="item.projectId + ',' + item.projectName"
+                :key="item.projectId"
+              >{{ item.projectName }}</Option>
+            </Select>
+            <span v-else>s{{ form.glxm.split(',')[1] }}</span>
+          </Col>
+          <Col span="4" class-name="tables">单据类型</Col>
+          <Col span="4" class-name="tables">
+            <Select v-model="form.djlx" style="width: 95%">
+              <Option
+                v-for="item in djlxList"
+                :value="item.value"
+                :key="item.value"
+                :disabled="form.spzt == '2' || form.spzt == '3'"
+              >{{ item.label }}</Option>
+            </Select>
+          </Col>
+
+          <Col span="4" class-name="tables">采购人</Col>
+          <Col span="4" class-name="tables">{{ form.cgr }}</Col>
+          <Col span="4" class-name="tables">采购人联系方式</Col>
+          <Col span="4" class-name="tables">
+            <Input
+              v-model="form.cgrlxfs"
+              :disabled="form.spzt == '2' || form.spzt == '3'"
+              placeholder="请输入"
+              style="width: 95%"
+            />
+          </Col>
+          <Col span="4" class-name="tables">下单日期</Col>
+          <Col span="4" class-name="tables">
+            <DatePicker
+              style="width: 95%"
+              format="yyyy-MM-dd HH:mm:ss"
+              :value="form.xdrq"
+              @on-change="form.xdrq=$event"
+              type="datetime"
+              placeholder="请选择"
+              :disabled="form.spzt == '2' || form.spzt == '3'"
+            ></DatePicker>
+          </Col>
+          <Col span="4" class-name="tables">交货时间</Col>
+          <Col span="4" class-name="tables">
+            <DatePicker
+              :disabled="form.xdrq == '' || form.spzt != '1'"
+              style="width: 95%"
+              format="yyyy-MM-dd HH:mm:ss"
+              :value="form.jhsj"
+              :options="jhsjOptions"
+              @on-change="form.jhsj=$event"
+              type="datetimerange"
+              placeholder="请选择"
+            ></DatePicker>
+          </Col>
+          <Col span="4" class-name="tables">交货地点</Col>
+          <Col span="4" class-name="tables">{{ form.jhdd }}</Col>
+          <Col span="4" class-name="tables">收货人</Col>
+          <Col span="4" class-name="tables">
+            <Input
+              v-model="form.shr"
+              :disabled="form.spzt == '2' || form.spzt == '3'"
+              placeholder="请输入"
+              style="width: 95%"
+            />
+          </Col>
+          <Col span="4" class-name="tables">收货人联系方式</Col>
+          <Col span="4" class-name="tables">
+            <Input
+              v-model="form.shrlxfs"
+              :disabled="form.spzt == '2' || form.spzt == '3'"
+              placeholder="请输入"
+              style="width: 95%"
+            />
+          </Col>
+          <Col span="4" class-name="tables">供应商</Col>
+          <Col span="12" class-name="tables">
+            <Select
+              v-model="form.gys"
+              @on-change="gysChange"
+              filterable
+              style="width: 95%"
+              v-if="orderType == 'add'"
+            >
+              <Option
+                v-for="item in gysList"
+                :disabled="form.spzt == '2' || form.spzt == '3'"
+                :value="item.gpId"
+                :key="item.gpId"
+              >{{ item.gpName }}</Option>
+            </Select>
+            <span v-else>{{ form.gysmc }}</span>
+          </Col>
+          <Col span="4" class-name="tables">供方负责人</Col>
+          <Col span="4" class-name="tables">{{ form.gffzr }}</Col>
+          <Col span="4" class-name="tables">供应商联系电话</Col>
+          <Col span="4" class-name="tables">{{ form.gyslxdh }}</Col>
+          <Col span="4" class-name="tables">关联申购计划</Col>
+          <Col span="4" class-name="tables">{{ form.glsgjh }}</Col>
+          <!-- <Col span="4" class-name="tables"></Col>
+          <Col span="4" class-name="tables"></Col>-->
+          <Col span="4" class-name="tables">审批状态</Col>
+          <Col span="4" class-name="tables">
+            <span v-if="form.spzt == ''">-</span>
+            <span v-if="form.spzt == '1'">未提交</span>
+            <span v-if="form.spzt == '2'">审核中</span>
+            <span v-if="form.spzt == '3'">审核通过</span>
+            <span v-if="form.spzt == '4'">审核拒绝</span>
+          </Col>
+          <Col span="4" class-name="tables">审批通过时间</Col>
+          <Col span="4" class-name="tables">-</Col>
+          <Col span="4" class-name="tables">订单状态</Col>
+          <Col span="4" class-name="tables">
+            <span v-if="form.ddzt == ''">-</span>
+            <span v-if="form.ddzt == '1'">未下单</span>
+            <span v-if="form.ddzt == '2'">待下单</span>
+            <span v-if="form.ddzt == '3'">已下单</span>
+            <span v-if="form.ddzt == '4'">入库中</span>
+            <span v-if="form.ddzt == '5'">已入库</span>
+            <span v-if="form.ddzt == '6'">已取消</span>
+          </Col>
+        </Row>
+        <Row class="uplCont" type="flex" justify="center" style="align-items: stretch">
+          <Col span="4" class-name="upl">附件</Col>
+          <Col span="10" class-name="uplf">
+            <Upload
+              :headers="uploadHeaders"
+              style="width: 80%"
+              multiple
+              type="drag"
+              :disabled="form.spzt == '2' || form.spzt == '3'"
+              action="/purchase/common/uploadFile"
+              :before-upload="beforeUpload"
+              :on-success="uploadFilesSuccess"
+              :show-upload-list="false"
+              :on-progress="upFilesLoading"
+            >
+              <!-- :default-file-list="xzwgForm.filesList" -->
+              <div style="padding: 5px 0">
+                <Icon type="md-cloud-upload" size="36" style="color: #3399ff"></Icon>
+                <span>点击或将文件拖拽到这里上传</span>
+              </div>
+            </Upload>
+          </Col>
+          <Col span="10" class="upl" style="padding: 5px">
+            <div v-for="(item, index) in form.filesList" :key="index">
+              <a href="javascript:;">{{ item.fullName }}</a>
+              <span style="float: right; cursor:pointer" @click="form.filesList.splice(index, 1)">x</span>
+            </div>
+            <p v-if="uploading" style="text-align: center">上传中...</p>
+          </Col>
+        </Row>
+        <Row class="mainCont">
+          <Col span="4" class-name="tables">说明</Col>
+          <Col span="20" class-name="tables">
+            <Input
+              v-model="form.sm"
+              :disabled="form.spzt == '2' || form.spzt == '3'"
+              placeholder="请输入"
+              style="width: 99%"
+            />
+          </Col>
+        </Row>
+        <Spin size="large" fix v-if="spinShow"></Spin>
+      </Card>
+      <Card style="width:100%" :bordered="false" :dis-hover="true">
+        <p slot="title">采购明细</p>
+        <div slot="extra">
+          <Button type="primary" @click="mxAddShow" :disabled="orderType == 'add'">新增明细</Button>
+        </div>
+        <Table
+          :columns="tableColumn"
+          style="width: 100%"
+          :data="tableData"
+          :loading="tableLoading"
+          @on-select="tableOnSelect"
+        >
+          <template slot-scope="{ row, index }" slot="purchaseNum">
+            <Input
+              :disabled="form.spzt == '2'"
+              v-model="tableData[index].purchaseNum"
+              placeholder="请输入"
+              style="width: 95%"
+            />
+          </template>
+          <template slot-scope="{ row, index }" slot="price">
+            <Input
+              :disabled="form.spzt == '2' || form.spzt == '3'"
+              v-model="tableData[index].price"
+              placeholder="请输入"
+              style="width: 95%"
+            />
+          </template>
+          <template slot-scope="{ row, index }" slot="totalPrice">
+            <div>{{ tableData[index].price * tableData[index].purchaseNum }}</div>
+          </template>
+          <template slot-scope="{ row, index }" slot="plannedArrivalTime">
+            <DatePicker
+              :disabled="form.spzt == '2' || form.spzt == '3'"
+              :transfer="true"
+              format="yyyy-MM-dd HH:mm:ss"
+              type="datetime"
+              :value="tableData[index].plannedArrivalTime"
+              @on-change="tableData[index].plannedArrivalTime=$event"
+              placeholder="请选择"
+              style="width: 95%"
+            ></DatePicker>
+          </template>
+          <template slot-scope="{ row, index }" slot="isNumControl">
+            <RadioGroup v-model="tableData[index].isNumControl">
+              <Radio :label="1" :disabled="form.spzt == '2' || form.spzt == '3'">
+                <span>是</span>
+              </Radio>
+              <Radio :label="2" :disabled="form.spzt == '2' || form.spzt == '3'">
+                <span>否</span>
+              </Radio>
+            </RadioGroup>
+          </template>
+          <template slot-scope="{ row, index }" slot="isTimeControl">
+            <RadioGroup v-model="tableData[index].isTimeControl">
+              <Radio :label="1" :disabled="form.spzt == '2' || form.spzt == '3'">
+                <span>是</span>
+              </Radio>
+              <Radio :label="2" :disabled="form.spzt == '2' || form.spzt == '3'">
+                <span>否</span>
+              </Radio>
+            </RadioGroup>
+          </template>
+          <template slot-scope="{ row, index }" slot="cz">
+            <div>
+              <a href="javascript:;" v-if="form.spzt != '2'" @click="deleteRow(index)">删除</a>
+            </div>
+          </template>
+        </Table>
+      </Card>
+      <!-- <Modal v-model="plszShow" title="批量设置" @on-ok="plszOk" @on-cancel="plszCancel">
+        <Row class="mainCont">
+          <Col span="12" class-name="tables">入库仓库</Col>
+          <Col span="12" class-name="tables">
+            <Select v-model="plrkck" style="width: 95%" :transfer="true">
+              <Option v-for="item in ckList" :value="item.value" :key="item.value">{{ item.label }}</Option>
+            </Select>
+          </Col>
+          <Col span="12" class-name="tables">计划到货时间</Col>
+          <Col span="12" class-name="tables">
+            <DatePicker
+              :transfer="true"
+              format="yyyy-MM-dd"
+              type="date"
+              :value="pldhsj"
+              @on-change="pldhsj=$event"
+              placeholder="请选择"
+              style="width: 95%"
+            ></DatePicker>
+          </Col>
+        </Row>
+      </Modal>-->
+    </div>
+    <!-- 计划明细新增 -->
+    <poolMxAdd ref="mxAdd" @plAdd="plAdd" @return="contentShow = true" v-show="!contentShow" />
+  </div>
+</template>
+
+<script>
+import {
+  addPurchaseOrder,
+  findPurchaseOrder,
+  editPurchaseOrder,
+  getLabelByCode,
+  getProjectList,
+  submitPurchaseOrder
+} from "@/service/getData";
+import poolMxAdd from "./poolMxAdd";
+export default {
+  props: ["gysList", "glqyList"],
+  components: {
+    poolMxAdd
+  },
+  data() {
+    return {
+      orderType: "add",
+      orderId: "",
+      lazyTableData: [],
+      uploadHeaders: {
+        token: localStorage.token,
+        userId: localStorage.user_id
+      },
+      spinShow: false,
+      contentShow: true,
+      form: {
+        dgbh: "", //订购编号
+        bt: "", //标题
+        glqy: "", //关联区域
+        glxm: "", //关联项目
+        cgr: localStorage.user_name, //采购人
+        cgrlxfs: "", //采购人联系方式
+        xdrq: "", //下单日期
+        jhsj: [], //交货时间
+        jhdd: "", //交货地点
+        shr: "", //收货人
+        shrlxfs: "", //收货人联系方式
+        djlx: "", //单据类型
+        gys: "", //供应商
+        gysmc: "", //供应商名称
+        gffzr: "", //供方负责人
+        gyslxdh: "", //供应商联系电话
+        totalPrice: 0, //总价
+        sm: "", //说明
+        spzt: 1, //审批状态
+        sptgsj: "", //审批通过时间
+        ddzt: "", //订单状态
+        glsgjh: "", //关联申购计划
+        filesList: []
+      },
+      jhsjOptions: {
+        disabledDate: date => {
+          return date && date.valueOf() < new Date(this.form.xdrq);
+        }
+      },
+      // glqyList: [{ label: "test", value: 1 }],
+      glxmList: [],
+      cgrList: [{ label: "test", value: 1 }],
+      djlxList: [],
+      // gysList: [{ label: "test", value: 1 }],
+      gffzrList: [{ label: "test", value: 1 }],
+      uploading: false,
+      // 批量设置
+      plszShow: false,
+      plrkck: "",
+      pldhsj: "",
+      // table
+      tableColumn: [
+        {
+          title: "申购计划",
+          key: "applyRuleCode",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "物料编码",
+          key: "code",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "物料分类",
+          key: "firstClassName",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "物料名称",
+          key: "materialName",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "品牌",
+          key: "brandName",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "规格型号",
+          key: "specs",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "单位",
+          key: "unit",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "计划数量",
+          key: "amount",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "已下订数量",
+          key: "billedAmount",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "累计入库数量",
+          key: "warehousedNum",
+          tooltip: "true",
+          width: 120
+        },
+        {
+          title: "待采购数量",
+          key: "applySurplusNum",
+          tooltip: "true",
+          width: 120
+        },
+        {
+          title: "采购数量",
+          slot: "purchaseNum",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "单价(元)",
+          slot: "price",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "总价(元)",
+          slot: "totalPrice",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "入库仓库",
+          key: "storehouseName",
+          tooltip: "true",
+          width: 130
+        },
+        {
+          title: "计划到货时间",
+          slot: "plannedArrivalTime",
+          tooltip: "true",
+          width: 150
+        },
+        {
+          title: "数量管控",
+          slot: "isNumControl",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "时间管控",
+          slot: "isTimeControl",
+          tooltip: "true",
+          width: 100
+        },
+        {
+          title: "操作",
+          slot: "cz",
+          tooltip: "true",
+          fixed: "right",
+          width: 60
+        }
+      ],
+      tableData: [],
+      tableSelect: [],
+      deleteIds: [],
+      tableLoading: false
+    };
+  },
+  created() {
+    getLabelByCode({ dictCode: "billType" }).then(res => {
+      if (res.status == 200) {
+        this.djlxList = res.data;
+      } else {
+        this.$Message.error(res.message);
+      }
+    });
+  },
+  methods: {
+    //批量设置弹窗
+    plszOpen() {
+      this.plszShow = true;
+    },
+    plszOk() {},
+    plszCancel() {},
+    //表单上传
+    beforeUpload() {},
+    upFilesLoading() {
+      this.uploading = true;
+    },
+    uploadFilesSuccess(response, file, fileList) {
+      this.uploading = false;
+      this.form.filesList.push({
+        fileName: response.data.fileName,
+        resPath: response.data.filePath,
+        fileDetailType: ""
+      });
+    },
+    getData(areaId, projectId, lazyTableData) {},
+    //供应商切换
+    gysChange(val) {
+      let gys = this.gysList.filter(a => a.gpId == val)[0];
+      this.form.gffzr = gys.gpcName;
+      this.form.gyslxdh = gys.gpcPhone;
+    },
+    //所属区域切换
+    ssqyChange() {
+      let postData = {
+        areaId: this.form.glqy.split(",")[0],
+        userId: localStorage.user_id
+      };
+      getProjectList(postData).then(res => {
+        this.form.glxm = "";
+        this.glxmList = res.items;
+      });
+    },
+    //编辑采购订单
+    editCgdd() {
+      let gpName = this.gysList.filter(a => a.gpId == this.form.gys);
+      let postData = {
+        areaId: this.form.glqy.split(",")[0],
+        areaName: this.form.glqy.split(",")[1],
+        projectId: this.form.glxm.split(",")[0],
+        projectName: this.form.glxm.split(",")[1],
+        purchaserId: localStorage.user_id,
+        purchaserName: localStorage.user_name,
+        purchaserTel: this.form.cgrlxfs,
+        receivedName: this.form.shr,
+        receivedTel: this.form.shrlxfs,
+        orderTime: this.form.xdrq,
+        deliveryStartTime: this.form.jhsj[0],
+        deliveryEndTime: this.form.jhsj[1],
+        deliveryPlace: this.form.jhdd,
+        type: this.form.djlx,
+        instruction: this.form.sm,
+        attachmentList: this.form.filesList,
+        gpId: this.form.gys, //供应商ID
+        gpNmae: gpName.length ? gpName[0].gpName : "", //供应商Name
+        orderId: this.orderId,
+        deleteId: this.deleteIds.join(","),
+        attachmentList: this.form.filesList,
+        detailList: this.tableData
+      };
+      this.spinShow = true;
+      this.tableLoading = true;
+      editPurchaseOrder(postData).then(res => {
+        this.spinShow = false;
+        this.tableLoading = false;
+        if (res.status == 200) {
+          this.$Message.success("编辑采购订单成功!");
+          this.getCgddXq(this.orderId);
+        } else {
+          this.$Message.error(res.message);
+        }
+      });
+    },
+    //新增采购订单
+    addCgdd() {
+      if (this.orderType == "edit") {
+        this.editCgdd();
+        return false;
+      }
+      let gpName = this.gysList.filter(a => a.gpId == this.form.gys);
+      let postData = {
+        areaId: this.form.glqy.split(",")[0],
+        areaName: this.form.glqy.split(",")[1],
+        projectId: this.form.glxm.split(",")[0],
+        projectName: this.form.glxm.split(",")[1],
+        purchaserId: localStorage.user_id,
+        purchaserName: localStorage.user_name,
+        purchaserTel: this.form.cgrlxfs,
+        receivedName: this.form.shr,
+        receivedTel: this.form.shrlxfs,
+        orderTime: this.form.xdrq,
+        deliveryStartTime: this.form.jhsj[0],
+        deliveryEndTime: this.form.jhsj[1],
+        deliveryPlace: this.form.jhdd,
+        type: this.form.djlx,
+        instruction: this.form.sm,
+        attachmentList: this.form.filesList,
+        gpId: this.form.gys, //供应商ID
+        gpNmae: gpName.length ? gpName[0].gpName : "" //供应商Name
+      };
+      this.spinShow = true;
+      addPurchaseOrder(postData).then(res => {
+        this.spinShow = false;
+        if (res.status == 200) {
+          this.$Message.success("新增采购订单成功!");
+          this.orderId = res.data.orderId;
+          this.form.dgbh = res.data.orderCode;
+          this.form.bt = res.data.title;
+          this.form.jhdd = res.data.deliveryPlace;
+          this.orderType = "edit";
+        } else {
+          this.$Message.error(res.message);
+        }
+      });
+    },
+    //新增明细
+    mxAddShow() {
+      this.contentShow = false;
+      this.$refs.mxAdd.orderId = this.orderId;
+      this.$refs.mxAdd.approvalState = this.form.spzt;
+      this.$refs.mxAdd.orderState = this.form.ddzt;
+      this.$refs.mxAdd.areaId = this.form.glqy;
+      this.$refs.mxAdd.projectId = this.form.glxm;
+      this.$refs.mxAdd.getTableData();
+      this.$refs.mxAdd.getCk();
+    },
+    //列表方法
+    getTableData() {
+      this.spinShow = false;
+    },
+    //删除采购明细
+    deleteRow(index) {
+      if (this.deleteIds.indexOf(this.tableData[index].applyDetailId) == -1) {
+        this.deleteIds.push(this.tableData[index].applyDetailId);
+      }
+      this.tableData.splice(index, 1);
+    },
+    //批量添加
+    plAdd(list) {
+      console.log(list);
+      for (let item in list) {
+        if (this.deleteIds.indexOf(list[item].applyDetailId) != -1) {
+          this.deleteIds.splice(
+            this.deleteIds.indexOf(list[item].applyDetailId),
+            1
+          );
+        }
+        if (
+          this.tableData.filter(
+            a => a.applyDetailId == list[item].applyDetailId
+          ).length > 0
+        ) {
+        } else {
+          this.tableData.push(list[item]);
+        }
+      }
+    },
+    tableOnSelect(selection, row) {},
+    //取消、返回
+    cancel() {
+      this.form.dgbh = "";
+      this.form.bt = "";
+      this.form.glqy = "";
+      this.form.glxm = "";
+      this.form.djlx = "";
+      this.form.cgr = "";
+      this.form.cgrlxfs = "";
+      this.form.xdrq = "";
+      this.form.jhsj = [];
+      this.form.shr = "";
+      this.form.shrlxfs = "";
+      this.form.gys = "";
+      this.form.gffzr = "";
+      this.form.gyslxdh = "";
+      this.form.sm = "";
+      this.form.filesList = [];
+      this.form.spzt = 1;
+      this.tableData = [];
+      this.deleteIds = [];
+      this.orderType = "add";
+      this.spinShow = false;
+      this.$emit("return");
+    }
+  },
+  watch: {
+    tableData: {
+      handler(val, name) {
+        let total = 0;
+        let str = "";
+        for (let item in val) {
+          total += val[item].price * val[item].purchaseNum;
+          str += val[item].applyRuleCode + ",";
+        }
+        this.form.totalPrice = total;
+        this.form.glsgjh = str.replace(/\,$/, "");
+      },
+      deep: true
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+button {
+  min-width: 80px;
+}
+.uplCont {
+  border-left: 1px solid #e4e4e4;
+  .upl {
+    flex: auto;
+    border-right: 1px solid #e4e4e4;
+    &:nth-child(1) {
+      background: #f8f9fb;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+    }
+  }
+  .uplf {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    min-height: 80px;
+  }
+}
+.mainCont .tables {
+  min-height: 50px;
+  border-right: 1px solid #e4e4e4;
+  border-bottom: 1px solid #e4e4e4;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  word-break: break-all;
+  &:nth-child(2n + 1) {
+    background: #f8f9fb;
+  }
+}
+.mainCont {
+  border-left: 1px solid #e4e4e4;
+  border-top: 1px solid #e4e4e4;
+}
+ivu-card-head-inner,
+.ivu-card-head p {
+  display: inline-block;
+  width: 100%;
+  height: 20px;
+  line-height: 20px;
+  font-size: 14px;
+  color: #17233d;
+  font-weight: 700;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  font-weight: normal;
+}
+</style>

+ 299 - 0
src/page/purchase/components/pool/poolMxAdd.vue

@@ -0,0 +1,299 @@
+<template>
+  <div>
+    <Card style="width:100%" :bordered="false" :dis-hover="true">
+      <p slot="title">添加采购订单物料</p>
+      <div slot="extra">
+        <Button @click="$emit('return')">返回</Button>
+      </div>
+      <Row :gutter="10" style="margin-bottom: 10px">
+        <Col span="4">
+          <Select v-model="searchForm.ck" placeholder="仓库名">
+            <Option v-for="item in ckList" :value="item.twId" :key="item.twId">{{ item.twName }}</Option>
+          </Select>
+        </Col>
+        <Col span="4">
+          <Select v-model="searchForm.yjfl" placeholder="一级分类" @on-change="yjflChange">
+            <Option v-for="item in yjflList" :value="item.gcId" :key="item.gcId">{{ item.gcName }}</Option>
+          </Select>
+        </Col>
+        <Col span="4">
+          <Select v-model="searchForm.ejfl" placeholder="二级分类">
+            <Option v-for="item in ejflList" :value="item.gcId" :key="item.gcId">{{ item.gcName }}</Option>
+          </Select>
+        </Col>
+        <Col span="4">
+          <Input v-model="searchForm.wlmc" placeholder="物料编码或名称" />
+        </Col>
+        <Col span="8">
+          <Button type="primary" style="width: 80px" @click="getTableData">查询</Button>
+          <Button type="primary" @click="plAdd">批量添加</Button>
+        </Col>
+      </Row>
+      <Table
+        :columns="tableColumn"
+        style="width: 100%"
+        :data="tableData"
+        :loading="tableLoading"
+        @on-select="tableOnSelect"
+        @on-select-cancel="tableOnCancel"
+        @on-select-all="tableOnSelect"
+        @on-select-all-cancel="tableOnCancel"
+      >
+        <template slot-scope="{ row, index }" slot="action">
+          <div>
+            <a href="javascript:;">编辑</a>
+            <a href="javascript:;">复制</a>
+            <a href="javascript:;">删除</a>
+            <a href="javascript:;">打印</a>
+          </div>
+        </template>
+      </Table>
+      <Page align="right" :total="pageTotal" @on-change="pageChange" show-total />
+    </Card>
+  </div>
+</template>
+
+<script>
+import {
+  queryPurchasePoolList,
+  tbiGoodsCategoryList,
+  warehouseList
+} from "@/service/getData";
+export default {
+  data() {
+    return {
+      orderId: "",
+      approvalState: "",
+      orderState: "",
+      areaId: "",
+      projectId: "",
+      type: "",
+      //新增物料申请表单
+      addForm: {
+        ck: "", //仓库名
+        wlmc: "", //物料名称
+        yjfl: "", //物料一级分类
+        ejfl: "", //物料二级分类
+        jldw: "", //计量单位
+        ggxh: "", //规格型号
+        wllx: "", //物料类型
+        scjg: "", //市场价格
+        sqsm: "" //申请说明
+      },
+      //表格查询内容
+      searchForm: {
+        yjfl: "", //一级分类
+        ejfl: "", // 二级分类
+        wlmc: "" //物料编码或名称
+      },
+      ckList: [],
+      allFlList: [],
+      yjflList: [],
+      ejflList: [],
+      jldwList: [],
+      wllxList: [],
+      //   表格参数
+      tableLoading: false,
+      pageTotal: 0,
+      pageNum: 1,
+      tableColumn: [
+        {
+          type: "selection",
+          width: 60,
+          align: "center"
+        },
+        {
+          title: "申购计划",
+          key: "code",
+          tooltip: "true"
+        },
+        {
+          title: "物料编码",
+          key: "materialCode",
+          tooltip: "true"
+        },
+        {
+          title: "物料分类",
+          key: "firstClassName",
+          tooltip: "true"
+        },
+        {
+          title: "物料名称",
+          key: "materialName",
+          tooltip: "true"
+        },
+        {
+          title: "品牌",
+          key: "brandName",
+          tooltip: "true"
+        },
+        {
+          title: "型号规格",
+          key: "specs",
+          tooltip: "true"
+        },
+        {
+          title: "单位",
+          key: "unit",
+          tooltip: "true"
+        },
+        {
+          title: "库存量",
+          key: "inventory",
+          tooltip: "true"
+        },
+        {
+          title: "参考单价(元)",
+          key: "referencePrice",
+          tooltip: "true",
+          width: 120
+        },
+        {
+          title: "计划数量",
+          key: "amount",
+          tooltip: "true"
+        },
+        {
+          title: "已下订数量",
+          key: "billedAmount",
+          tooltip: "true"
+        },
+        {
+          title: "可下订数量",
+          key: "noBilledAmout",
+          tooltip: "true"
+        }
+      ],
+      tableData: [],
+      tableSelect: []
+    };
+  },
+  created() {
+    tbiGoodsCategoryList().then(res => {
+      this.allFlList = res.data.data;
+      let arr = [];
+      for (let index in res.data.data) {
+        if (res.data.data[index].parentId == null) {
+          this.yjflList.push(res.data.data[index]);
+        }
+      }
+    });
+  },
+  methods: {
+    //列表方法
+    getTableData() {
+      let postData = {
+        page: this.pageNum,
+        pageSize: 10,
+        firstClassId: this.searchForm.yjfl,
+        secondClassId: this.searchForm.ejfl,
+        areaIds: this.areaId.split(',')[0],
+        queryText1: this.searchForm.wlmc,
+        queryText2: "",
+        // projectIds: this.projectId.split(',')[0],
+        projectIds: 10,
+        storehouseId: this.searchForm.ck
+      };
+      queryPurchasePoolList(postData).then(res => {
+        if (res.status == 200) {
+          this.tableData = res.data.records;
+          this.pageTotal = res.data.total;
+        }
+      });
+    },
+    pageChange(val) {
+      this.pageNum = val;
+      this.getTableData();
+    },
+    tableOnSelect(selection, row) {
+      this.tableSelect = selection;
+    },
+    tableOnCancel(selection, row) {
+      this.tableSelect = selection;
+    },
+    //获取仓库
+    getCk() {
+      let postData = {
+        areaId: this.areaId.split(',')[0],
+        projectId: this.projectId.split(',')[0]
+      };
+      warehouseList(postData).then(res => {
+        if (res.status == 200) {
+          this.ckList = res.data;
+        }
+      });
+    },
+    //一级分类切换
+    yjflChange(val) {
+      let arr = this.allFlList.filter(a => a.parentId == val);
+      this.searchForm.ejfl = "";
+      this.ejflList = arr;
+    },
+    //批量添加物料
+    plAdd() {
+      let arr = [];
+      for (let item in this.tableSelect) {
+        let date = new Date();
+        let dateArr = `${date.getFullYear()}-${date.getMonth() +
+          1}-${date.getDate()} 00:00:00`;
+        arr.push({
+          applyDetailId: this.tableSelect[item].id,
+          applyRuleId: this.tableSelect[item].purchaseApplyId,
+          applyRuleCode: this.tableSelect[item].code,
+          code: this.tableSelect[item].materialCode,
+          firstClassName: this.tableSelect[item].firstClassName,
+          materialName: this.tableSelect[item].materialName,
+          brandName: this.tableSelect[item].brandName,
+          specs: this.tableSelect[item].specs,
+          unit: this.tableSelect[item].unit,
+          amount: this.tableSelect[item].amount,
+          billedAmount: this.tableSelect[item].billedAmount,
+          inventory: this.tableSelect[item].inventory,
+          storehouseName: this.tableSelect[item].storehouseName,
+          price: this.tableSelect[item].referencePrice,
+          purchaseNum: 0,
+          plannedArrivalTime: dateArr,
+          isNumControl: 1,
+          isTimeControl: 1,
+          applySurplusNum: this.tableSelect[item].amount,
+          warehousedNum: 0,
+          remark: ""
+        });
+      }
+      this.$emit("plAdd", arr);
+      this.$emit("return");
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+ivu-card-head-inner,
+.ivu-card-head p {
+  display: inline-block;
+  width: 100%;
+  height: 20px;
+  line-height: 20px;
+  font-size: 14px;
+  color: #17233d;
+  font-weight: 700;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  font-weight: normal;
+}
+.mainCont .tables {
+  height: 50px;
+  border-right: 1px solid #e4e4e4;
+  border-bottom: 1px solid #e4e4e4;
+  line-height: 50px;
+  text-align: center;
+  &:nth-child(2n + 1) {
+    background: #f8f9fb;
+  }
+}
+.mainCont {
+  border-left: 1px solid #e4e4e4;
+  border-top: 1px solid #e4e4e4;
+}
+</style>

+ 38 - 3
src/page/purchase/purchaseOrder.vue

@@ -103,13 +103,15 @@
         <template slot-scope="{ row, index }" slot="action">
           <div>
             <a href="javascript:;" @click="editRow(row)">编辑</a>
-            <a href="javascript:;">复制</a>
+            <!-- <a href="javascript:;">复制</a> -->
             <a href="javascript:;" v-if="row.orderState == '1'" @click="deleteRow(row)">删除</a>
             <a
               href="javascript:;"
               v-if="row.orderState != '6' || row.approvalState != '4'"
               @click="printRow(row)"
             >打印</a>
+            <a href="javascript:;" @click="cgddxd(row.orderId)" v-if="row.orderState == '2'">下单</a>
+            <a href="javascript:;" @click="cgddqx(row.orderId)" v-if="row.orderState == '2'">取消订单</a>
           </div>
         </template>
       </Table>
@@ -134,7 +136,8 @@ import {
   selectGoodProviderSelectionList,
   exportPurchaseOrder,
   getAreaList,
-  getProjectList
+  getProjectList,
+  editPurchaseOrderState
 } from "@/service/getData";
 import orderAdd from "./components/order/orderAdd";
 import orderPrint from "./components/order/orderPrint";
@@ -298,7 +301,7 @@ export default {
         orderState: this.searchForm.ddzt,
         queryText: this.searchForm.title
       };
-      exportPurchaseOrder(postData).then(res => {});
+      exportPurchaseOrder(postData);
     },
     //列表方法
     getTableData() {
@@ -331,6 +334,38 @@ export default {
       this.addShow = true;
       this.$refs.add.getCgddXq(row.orderId);
     },
+    cgddxd(id) {
+      this.$Modal.confirm({
+        title: "下单",
+        content: "是否确定下单?",
+        okText: "确定",
+        onOk: () => {
+          let str = `?orderId=${id}&state=3`;
+          editPurchaseOrderState(str).then(res => {
+            if ((res.status = 200)) {
+              this.$Message.success("下单成功!");
+              this.getTableData();
+            }
+          });
+        }
+      });
+    },
+    cgddqx(id) {
+      this.$Modal.confirm({
+        title: "取消订单",
+        content: "是否确定取消该订单?",
+        okText: "确定",
+        onOk: () => {
+          let str = `?orderId=${id}&state=6`;
+          editPurchaseOrderState(str).then(res => {
+            if ((res.status = 200)) {
+              this.$Message.success("取消订单成功!");
+              this.getTableData();
+            }
+          });
+        }
+      });
+    },
     deleteRow(row) {
       this.$Modal.confirm({
         title: "删除",

+ 96 - 7
src/page/purchase/purchasePool.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <Card style="width:100%" :bordered="false" :dis-hover="true">
+    <Card style="width:100%" :bordered="false" :dis-hover="true" v-show="contentShow">
       <p slot="title">待采购池</p>
       <Row :gutter="10" style="margin-bottom: 10px">
         <Col span="6">
@@ -41,7 +41,7 @@
         </Col>
         <Col span="12" style="text-align: right">
           <Button type="primary" style="width: 80px" @click="getTableData">查询</Button>
-          <Button type="primary" style="width: 100px">批量采购</Button>
+          <Button type="primary" style="width: 100px" @click="plcg">批量采购</Button>
         </Col>
       </Row>
       <Table
@@ -51,22 +51,36 @@
         :height="resizeHeight - 30"
         :loading="tableLoading"
         @on-select="tableOnSelect"
+        @on-select-cancel="tableOnCancel"
+        @on-select-all="tableOnSelect"
+        @on-select-all-cancel="tableOnCancel"
       ></Table>
       <Page align="right" :total="pageTotal" @on-change="pageChange" show-total />
     </Card>
+    <poolAdd
+      ref="add"
+      @return="addReturn"
+      :glqyList="ssqyList"
+      :gysList="gysList"
+      v-show="!contentShow"
+    />
   </div>
 </template>
 
 <script>
+import poolAdd from "./components/pool/poolAdd";
 import {
   queryPurchasePoolList,
   getAreaList,
   getProjectList,
-  tbiGoodsCategoryList
+  tbiGoodsCategoryList,
+  selectGoodProviderSelectionList
 } from "@/service/getData";
 export default {
+  components: { poolAdd },
   data() {
     return {
+      contentShow: true,
       //  自适应尺寸↓
       resizeHeight: 100,
       resizeWidth: 100,
@@ -82,6 +96,7 @@ export default {
       },
       ssqyList: [],
       ssxmList: [],
+      gysList: [],
       allFlList: [],
       yjflList: [],
       ejflList: [],
@@ -111,13 +126,13 @@ export default {
         },
         {
           title: "区域",
-          key: "qy",
+          key: "areaName",
           tooltip: "true",
           width: 100
         },
         {
           title: "项目",
-          key: "xm",
+          key: "projectName",
           tooltip: "true",
           width: 100
         },
@@ -183,7 +198,7 @@ export default {
         },
         {
           title: "可下订数量",
-          key: "noBilledAmout",
+          key: "noBilledAmount",
           tooltip: "true",
           width: 100
         }
@@ -197,6 +212,9 @@ export default {
     getAreaList(localStorage.user_id).then(res => {
       this.ssqyList = res.items;
     });
+    selectGoodProviderSelectionList().then(res => {
+      this.gysList = res.data;
+    });
     tbiGoodsCategoryList().then(res => {
       this.allFlList = res.data.data;
       let arr = [];
@@ -230,6 +248,57 @@ export default {
       this.searchForm.ejfl = "";
       this.ejflList = arr;
     },
+    addReturn() {
+      this.$router.push("/purchaseOrder");
+    },
+    //批量采购
+    plcg() {
+      let project = "";
+      let area = "";
+      let toAddArr = [];
+      if (this.tableSelect.length == 0) {
+        this.$Message.error("请至少选择一条采购物料信息!");
+        return false;
+      } else {
+        area = this.tableSelect[0].area;
+        project = this.tableSelect[0].projectId;
+      }
+      for (let i in this.tableSelect) {
+        if (this.tableSelect[i].projectId != project) {
+          this.$Message.error("请选择同一项目下的物料信息!");
+          return false;
+        } else {
+          let date = new Date();
+          let dateArr = `${date.getFullYear()}-${date.getMonth() +
+            1}-${date.getDate()} 00:00:00`;
+          arr.push({
+            applyDetailId: this.tableSelect[i].id,
+            applyRuleId: this.tableSelect[i].purchaseApplyId,
+            applyRuleCode: this.tableSelect[i].code,
+            code: this.tableSelect[i].materialCode,
+            firstClassName: this.tableSelect[i].firstClassName,
+            materialName: this.tableSelect[i].materialName,
+            brandName: this.tableSelect[i].brandName,
+            specs: this.tableSelect[i].specs,
+            unit: this.tableSelect[i].unit,
+            amount: this.tableSelect[i].amount,
+            billedAmount: this.tableSelect[i].billedAmount,
+            inventory: this.tableSelect[i].inventory,
+            storehouseName: this.tableSelect[i].storehouseName,
+            price: this.tableSelect[i].referencePrice,
+            purchaseNum: 0,
+            plannedArrivalTime: dateArr,
+            isNumControl: 1,
+            isTimeControl: 1,
+            applySurplusNum: this.tableSelect[i].amount,
+            warehousedNum: 0,
+            remark: ""
+          });
+        }
+      }
+      this.contentShow = false;
+      this.$refs.add.getData(area, project, toAddArr);
+    },
     //列表方法
     getTableData() {
       let postData = {
@@ -254,7 +323,12 @@ export default {
       this.pageNum = val;
       this.getTableData();
     },
-    tableOnSelect(selection, row) {}
+    tableOnSelect(selection, row) {
+      this.tableSelect = selection;
+    },
+    tableOnCancel(selection, row) {
+      this.tableSelect = selection;
+    }
   },
   mounted: function() {
     //  监听浏览器页面尺寸
@@ -265,6 +339,21 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+.mainCont .tables {
+  height: 50px;
+  border-right: 1px solid #e4e4e4;
+  border-bottom: 1px solid #e4e4e4;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  &:nth-child(2n + 1) {
+    background: #f8f9fb;
+  }
+}
+.mainCont {
+  border-left: 1px solid #e4e4e4;
+  border-top: 1px solid #e4e4e4;
+}
 ivu-card-head-inner,
 .ivu-card-head p {
   display: inline-block;

+ 1 - 1
src/page/report/historyCost.vue

@@ -185,7 +185,7 @@ export default {
         endTime: this.searchForm.time[1],
         ...this.searchForm
       };
-      exportMaterialHistoricalPrice(postData).then();
+      exportMaterialHistoricalPrice(postData);
     },
     //列表页方法
     getTableData() {

+ 14 - 3
src/service/getData.js

@@ -106,6 +106,9 @@ export const deleteGoodProviderBankCard = (data) => fetch(`
 //供应商管理 ---  编辑供应商 ---  编辑银行账号
 export const updateGoodProviderBankCard = (data) => fetch(`
 /goodProvider/updateGoodProviderBankCard`, '/purchase', data, 'JSON2', 'POST');
+//申购计划 ---  查询物料信息列表
+export const tbiStockGoods = (data) => fetch(`
+/common/tbiStockGoods`, '/purchase', data, 'JSON2', 'GET');
 /*
  *采购管理
  *申购计划模块接口
@@ -119,9 +122,12 @@ export const deletePurchaseApply = (data) => fetch(`
 //申购计划 ---  新增申购计划
 export const addPurchaseApply = (data) => fetch(`
 /purchaseApply/addPurchaseApply`, '/purchase', data, 'JSON2', 'POST');
-//申购计划 ---  新增申购计划
+//申购计划 ---  编辑申购计划
 export const editPurchaseApply = (data) => fetch(`
 /purchaseApply/editPurchaseApply`, '/purchase', data, 'JSON2', 'POST');
+//申购计划 ---  提交申购计划
+export const submitPurchaseApply = (data) => fetch(`
+/purchaseApply/submitPurchaseApply`, '/purchase', data, 'JSON2', 'POST');
 //申购计划 ---  查询申购计划详情
 export const queryPurchaseApplyInfo = (data) => fetch(`
 /purchaseApply/queryPurchaseApplyInfo`, '/purchase', data, 'JSON', 'POST');
@@ -167,8 +173,10 @@ export const addPurchaseOrder = (data) => fetch(`
 export const findPurchaseOrder = (data) => fetch(`
 /purchaseOrder/findPurchaseOrderById`, '/purchase', data, 'JSON2', 'GET');
 //采购订单 ---  编辑采购订单详情
-export const editPurchaseOrder = (data) => fetch(`
-purchaseOrder/editPurchaseOrder`, '/purchase', data, 'JSON2', 'POST');
+export const editPurchaseOrder = (data) => fetch(`/purchaseOrder/editPurchaseOrder`, '/purchase', data, 'JSON2', 'POST');
+//采购订单 ---  编辑订单状态
+export const editPurchaseOrderState = (data) => fetch(`/purchaseOrder/editPurchaseOrderState${data}`, '/purchase', data, 'JSON2', 'POST');
+
 /*
  *采购管理
  *采购结算模块接口
@@ -194,6 +202,9 @@ export const queryPurchaseSettlementInfo = (data) => fetch(`
 //采购结算 ---  编辑采购结算详情
 export const editPurchaseSettlement = (data) => fetch(`
 /purchaseSettlement/editPurchaseSettlement`, '/purchase', data, 'JSON2', 'POST');
+//采购结算 ---  提交采购结算
+export const submitPurchaseSettlement = (data) => fetch(`
+/purchaseSettlement/submitPurchaseSettlement`, '/purchase', data, 'JSON2', 'POST');
 //采购结算 ---  获取结算明细列表
 export const hajwySettlementList = (data) => fetch(`/inventoryInfo/settlementList`, '/hajwy', data, 'FORMDATA', 'POST')
 /*