huk 3 gadi atpakaļ
vecāks
revīzija
95465ad20d

+ 2 - 6
build/utils.js

@@ -15,12 +15,8 @@ const devPathSrc = path.resolve(__dirname, '../../../src'); // node_modules应
 // ['index','appoint','configManager','homepage','inward','queue','RMS','sale','serviceManager','SporadicManage'
 //       统计报表       组织机构/系统管理 采购  仓储
 //  'statisticalReport','systemConfig','TMS','WMS','workFlow']
-// let devModules = ['all'];
-<<<<<<< HEAD
-let devModules = ['index','statisticalReport','appoint','RMS'];
-=======
-let devModules = ['index','queue','RMS'];
->>>>>>> dev
+let devModules = ['all'];
+// let devModules = ['index','statisticalReport','appoint','RMS'];
 if (pathSrc.indexOf('node_modules') > -1) {
     devModules = require('../../../cors.js').devModules;
 }

+ 2 - 2
config/index.js

@@ -56,9 +56,9 @@ let proxyTable = {
   },
   // 所有数据的请求域名地址
   "/api/v1": {
-    // target: "http://172.16.33.166:8080",
+    target: "http://172.16.33.166:8080",
     // target: "http://172.16.33.162:8019",
-    target: "http://192.168.1.102:8019",
+    // target: "http://192.168.1.102:8019",
     ws: true,
     pathRewrite: {
       "^/api/v1": "/api/v1"

+ 196 - 150
src/views/RMS/components/addCapacity.vue

@@ -2,35 +2,35 @@
   <!-- 添加运力信息 -->
   <div class="addCapacity">
     <PageTitle>返回</PageTitle>
-     <div class="form_box" style="margin-right: 10rem">
-        <dil-form :formId="309" v-model="form1" ref="from1"></dil-form>
-      </div>
-      <div class="elForm">
-             <el-form
-        :inline="true"
-        class="demo-form-inline"
-        label-width="80px"
-      >
+    <div class="form_box" style="margin-right: 10rem">
+      <dil-form :formId="309" v-model="form1" ref="from1"></dil-form>
+    </div>
+    <div class="elForm">
+      <el-form :inline="true" class="demo-form-inline" label-width="80px">
         <el-form-item label="选择承运商">
-         <el-autocomplete
-          class="inline-input"
-          v-model="state"
-          :fetch-suggestions="querySearch"
-          placeholder="请输入承运商名称"
-          :trigger-on-focus="false"
-          @select="handleSelect"
-        >
-        <template slot-scope="{ item }">
-          <div class="name">{{ item.carrierName }}</div>
-        </template>
-        </el-autocomplete>
+          <el-autocomplete
+            class="inline-input"
+            v-model="state"
+            :fetch-suggestions="querySearch"
+            placeholder="请输入承运商名称"
+            :trigger-on-focus="false"
+            @select="handleSelect"
+          >
+            <template slot-scope="{ item }">
+              <div class="name" v-if="item.carrierName">
+                {{ item.carrierName }}
+              </div>
+            </template>
+          </el-autocomplete>
         </el-form-item>
-    </el-form>
-      </div>
- 
+      </el-form>
+    </div>
+
     <div class="button_box">
       <el-button @click="cancel">取消</el-button>
-      <el-button type="primary" @click="makeSure">确定</el-button>
+      <el-button type="primary" @click="makeSure" :loading="addLoading"
+        >确定</el-button
+      >
     </div>
   </div>
 </template>
@@ -42,83 +42,95 @@ export default {
   components: { PageTitle },
   data() {
     return {
+      addLoading: false,
       form1: {},
-      form1Initialization : {
-        capacityTypeId : 1,
-        capacityNumber : '',
-        capacityCorlor : '黄',
-        capacityOwneris : '否',
-        capacityVip : '否',
-        capacityBlacklist : '否'
+      form1Initialization: {
+        capacityTypeId: 1,
+        capacityNumber: "",
+        capacityCorlor: "黄",
+        capacityOwneris: "否",
+        capacityVip: "否",
+        capacityBlacklist: "否",
       },
       value: undefined,
       carrierIds: null,
-      state:null,
-      userId:null,
+      state: null,
+      userId: null,
       restaurants: [],
-      accessToken:null,
-      userCode:null,
-      carrierUserId:null,
-      carrierId:null
+      accessToken: null,
+      userCode: null,
+      carrierUserId: null,
+      carrierId: null,
     };
   },
-  created(){
-      this.carrierUserId = getCookie("userId");
-      this.form1 = this.form1Initialization;
-      console.log(this.carrierUserId ,'carrierUserId')
-      
+  created() {
+    this.carrierUserId = getCookie("userId");
+    this.form1 = this.form1Initialization;
+    console.log(this.carrierUserId, "carrierUserId");
   },
   mounted() {
-   this.axios.post(
-       "/api/v1/rms/getCarrierNameBySSOId?carrierSSOId=" + this.carrierUserId
+    this.axios
+      .post(
+        "/api/v1/rms/getCarrierNameBySSOId?carrierSSOId=" + this.carrierUserId
       )
       .then((res) => {
-        if(res.data.code == "200"){
-        console.log(res.data.data)
-        this.state = res.data.data.carrierName
-        this.carrierIds = res.data.data.carrierId
-        }      
-  })},
+        if (res.data.code == "200") {
+          console.log(res.data.data);
+          if (res.data.data) {
+            this.state = res.data.data.carrierName;
+            this.carrierIds = res.data.data.carrierId;
+          }
+        }
+      });
+  },
   methods: {
     //承运商弹出层
-    handleSelect(item){    
-      this.carrierIds = item.carrierId
-      item.carrierName = this.state
+    handleSelect(item) {
+      this.carrierIds = item.carrierId;
+      item.carrierName = this.state;
     },
     //以下是承运商边输边查搜索
     querySearch(queryString, cb) {
-        this.axios.post('/api/v1/uc/getCarrierMesByLike?index='+queryString).then((res)=>{
-        if(res.data.code == "200"){
-          console.log(res.data.data)
-          var restaurants = res.data.data
-          console.log(restaurants,"restaurants");
-          var results = queryString ? restaurants.filter(this.createFilter(queryString)) :restaurants;
-           // 调用 callback 返回建议列表的数据
-          cb(results);
-        }
-        })     
-      },
+      this.axios
+        .post("/api/v1/uc/getCarrierMesByLike?index=" + queryString)
+        .then((res) => {
+          if (res.data.code == "200") {
+            console.log(res.data.data);
+            var restaurants = res.data.data;
+            console.log(restaurants, "restaurants");
+            var results = queryString
+              ? restaurants.filter(this.createFilter(queryString))
+              : restaurants;
+            // 调用 callback 返回建议列表的数据
+            cb(results);
+          }
+        });
+    },
     createFilter(queryString) {
-        return (restaurants)  =>  {
-          return (restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) > -1);
-        };
-      },
+      return (restaurants) => {
+        return (
+          restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
+          -1
+        );
+      };
+    },
     //以上是承运商边输边查搜索
-    deleteUser(userId){
-        this.axios.delete("pass/v1/sysusers/" + userId) .then((res) => {
-           this.$message.error("添加失败,车牌可能重复");
-           });
+    deleteUser(userId) {
+      this.axios.delete("pass/v1/sysusers/" + userId).then((res) => {
+        this.$message.error("添加失败,车牌可能重复");
+      });
     },
-    insertRole(userId,userCode){
-        this.axios
+    insertRole(userId, userCode) {
+      this.axios
         .post(
           "pass/v1/sysuserroles/addUserroles?userId=" +
             userId +
             "&userCode=" +
             userCode +
             "&roleId=" +
-            '923693668269953024'
-        ).then((res) => {
+            "923693668269953024"
+        )
+        .then((res) => {
           if (res.code === "0") {
             this.$message.success("操作成功");
             this.saveLoading = false;
@@ -126,37 +138,40 @@ export default {
           } else {
             this.$message.error(res.message);
           }
-        })
+        });
     },
     isVehicleNumber(vehicleNumber) {
-				  console.log(vehicleNumber)
-			      var result = false;
-			      if (vehicleNumber.length == 7){
-			        var express = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
-			        result = express.test(vehicleNumber);
-			      }
-			      return result;
-				  
-		},
+      console.log(vehicleNumber);
+      var result = false;
+      if (vehicleNumber.length == 7) {
+        var express =
+          /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
+        result = express.test(vehicleNumber);
+      }
+      return result;
+    },
     makeSure() {
-        if(!this.isVehicleNumber(this.form1.capacityNumber.toUpperCase())){
-            this.$message.error("车牌号格式不正确")
-            return
-        }
-        if(this.carrierIds == null){
-            this.$message.error("请选择承运商")
-            return
-        }
-        let RmsCapacity = {
+      this.addLoading = true;
+      if (!this.isVehicleNumber(this.form1.capacityNumber.toUpperCase())) {
+        this.$message.error("车牌号格式不正确");
+        this.addLoading = false;
+        return;
+      }
+      if (this.carrierIds == null) {
+        this.$message.error("请选择承运商");
+        this.addLoading = false;
+        return;
+      }
+      let RmsCapacity = {
         capacityTypeId: this.form1.capacityTypeId,
         capacityNumber: this.form1.capacityNumber.toUpperCase(),
         capacityCorlor: this.form1.capacityCorlor,
         capacityOwneris: this.form1.capacityOwneris,
         capacityVip: this.form1.capacityVip,
         capacityBlacklist: this.form1.capacityBlacklist,
-        remark:this.form1.remark,
-        carrierId:this.carrierIds,
-        state: this.state
+        remark: this.form1.remark,
+        carrierId: this.carrierIds,
+        state: this.state,
       };
       if (
         RmsCapacity.capacityNumber == null ||
@@ -164,46 +179,77 @@ export default {
         RmsCapacity.capacityOwneris == null ||
         RmsCapacity.capacityVip == null ||
         RmsCapacity.capacityBlacklist == null
-      )
+      ) {
         this.$message.error("存在空值!");
+        this.addLoading = false;
+      } else {
         var formData = new FormData();
-        formData.append("userName",this.form1.capacityNumber.toUpperCase())
-        console.log(formData.get("userName"))
-        console.log(formData.set("userName",this.form1.capacityNumber.toUpperCase()))
-        console.log(formData)
-        formData.append('userCode',this.form1.capacityNumber.toUpperCase())
-        formData.append('orgCode','yunli')
-        formData.append('orgName','运力')
-        formData.append('groupId','506514577756917769')
-        formData.append('companyId','713710108567277568')
-        formData.append('orgId','924126716337721344')
-        console.log(formData.get("userCode"))
-        console.log(typeof formData)
-        this.$store.dispatch("system/usersManage/addUser", formData).then((res) => {
-        console.log(res);
-        if (res.code === "0") {
-          console.log(res.data.userId)
-          this.userId = res.data.userId
-          this.userCode = res.data.userCode
-          RmsCapacity.ssoId = res.data.userId
-          console.log(RmsCapacity)
-          this.axios.post("/api/v1/rms/insertCapacity",RmsCapacity).then((res) => {
-              console.log(res)
-              if(res.data.code == '200'){
-                this.insertRole(this.userId,this.userCode)
-                this.$message.success("添加成功");
-                this.$router.push('capacity')
+        formData.append("userCode", this.form1.capacityNumber.toUpperCase());
+        formData.append("orgCode", "yunli");
+        formData.append("orgName", "运力");
+        formData.append("groupId", "506514577756917769");
+        formData.append("companyId", "713710108567277568");
+        formData.append("orgId", "924126716337721344");
+        console.log(formData.get("userCode"));
+        console.log(typeof formData);
+        this.$store
+          .dispatch("system/usersManage/addUser", formData)
+          .then((res) => {
+            console.log(res);
+            if (res.code === "0") {
+              console.log(res.data.userId);
+              this.userId = res.data.userId;
+              this.userCode = res.data.userCode;
+              RmsCapacity.ssoId = res.data.userId;
+              this.axios
+                .post("/api/v1/rms/insertCapacity", RmsCapacity)
+                .then((res) => {
+                  if (res.data.code == "200") {
+                    this.insertRole(this.userId, this.userCode);
+                    this.$message.success("添加成功");
+                    this.$router.push("capacity");
+                  } else if (res.data.code == "201") {
+                    this.deleteUser(this.userId);
+                  } else {
+                    this.deleteUser(this.userId);
+                  }
+                });
+            } else {
+              console.log(RmsCapacity, "RmsCapacity");
+              if (res.message == "账号已被注册") {
+                this.$confirm(
+                  "该账号已经绑定承运商, 是否确定进行更改?",
+                  "提示",
+                  {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning",
+                  }
+                )
+                  .then(() => {
+                    this.axios
+                      .post("/api/v1/rms/insertCapacity", RmsCapacity)
+                      .then((res) => {
+                        console.log(res, "res");
+                        if (res.data.code == "200") {
+                          this.$message.success("更改成功");
+                          this.$router.push("capacity");
+                        } else {
+                          this.$message.error("请联系管理人员");
+                        }
+                      });
+                  })
+                  .catch(() => {
+                    this.$message({
+                      type: "info",
+                      message: "已取消删除",
+                    });
+                  });
               }
-              else if(res.data.code == '201'){
-                this.deleteUser(this.userId)
-              }else{
-                this.deleteUser(this.userId)
-              }
-          })         
-        } else {
-          this.$message.error(res.message);
-        }
-      });
+            }
+          });
+        this.addLoading = false;
+      }
     },
     // 取消
     cancel() {
@@ -222,41 +268,41 @@ export default {
     margin-top: 30px;
     display: flex;
     justify-content: center;
-    .el-form-item{
+    .el-form-item {
       display: flex;
       justify-content: center;
-      .el-form-item__label{
+      .el-form-item__label {
         display: flex;
         align-items: center;
       }
-      .el-form-item__content{
-         .el-select{
-            width: 250px;
-          }
-          .el-input{
-            width: 250px;
-          }
+      .el-form-item__content {
+        .el-select {
+          width: 250px;
+        }
+        .el-input {
+          width: 250px;
+        }
       }
     }
   }
-  .inputBox{
+  .inputBox {
     display: flex;
     justify-content: center;
     margin-bottom: 30px;
-    .text{
+    .text {
       text-align: right;
       display: flex;
       align-items: center;
       margin-right: 5px;
     }
-    .input{
+    .input {
       width: 250px;
     }
   }
-  .button_box{
+  .button_box {
     display: flex;
     justify-content: center;
-    .el-button{
+    .el-button {
       width: 80px;
       margin-right: 10px;
     }

+ 62 - 30
src/views/RMS/components/capacity.vue

@@ -7,7 +7,7 @@
         v-model="textInput"
         clearable>
       </el-input>
-      <el-button type="primary" class="btn" @click="onclick">
+      <el-button type="primary" class="btn" @click="onclick" :loading="selectLoading">
         <i class="el-icon-search"></i>查询
       </el-button>
        <el-button type="primary" class="btn" @click="toInsert">
@@ -15,7 +15,12 @@
       </el-button>
     </div>
     <div class="table">
-      <dilTable v-bind.sync="options">
+      <dilTable 
+        v-bind.sync="options"
+        :loading="tableloading"
+        @func="func"
+        :isKuang="isKuang"
+      >
         <el-table-column fixed="right" label="操作" width="100">
           <template slot-scope="scope">
             <el-button
@@ -43,6 +48,9 @@ import { getCookie } from "@/utils/util.js";
 export default {
   data(){
     return{
+     selectLoading:false,
+     isKuang:false,
+     tableloading:false,
      show:false,
      name:"homeworkPath",
      textInput:"",
@@ -67,14 +75,38 @@ export default {
      } 
   },
   methods:{
+    func(res){
+      if(this.tableloading){
+        this.tableloading = false;
+      }
+      if(this.isKuang){
+        this.isKuang = false;
+      }
+      if(this.selectLoading){
+        this.selectLoading = false;
+      }
+    },
     onclick(){
-      if(getCookie("orgCode") == "chengyunshang"){
-      this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ getCookie("userId") +"&con=" +this.textInput + "&i=" + new Date();
-    }else if(getCookie("orgCode") == "baohua"){
-      this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId=" + getCookie("userId") + this.textInput + "&i=" + new Date();
-     }else{
-      this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ null +"&con=" +this.textInput + "&i=" + new Date();
-    }
+      this.isKuang = true;
+      this.tableloading = true;
+      this.selectLoading = true;
+      if(this.textInput){
+        if(getCookie("orgCode") == "chengyunshang"){
+          this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ getCookie("userId") +"&con=" +this.textInput + "&i=" + new Date();
+        }else if(getCookie("orgCode") == "baohua"){
+          this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId=" + getCookie("userId") + this.textInput + "&i=" + new Date();
+        }else{
+          this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ null +"&con=" +this.textInput + "&i=" + new Date();
+        }
+      }else{
+        if(getCookie("orgCode") == "chengyunshang"){
+          this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ getCookie("userId") + "&i=" + new Date();
+        }else if(getCookie("orgCode") == "baohua"){
+          this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId=" + getCookie("userId") + "&i=" + new Date();
+        }else{
+          this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ null + "&i=" + new Date();
+        }
+      }
     },
      toInsert() {
       this.$router.push("/addCapacity");
@@ -83,9 +115,8 @@ export default {
       this.$router.push("/editCapacity/" + capacityId)
     },
     deleteUser(userId){
-        this.axios.delete("pass/v1/sysusers/" + userId) .then((res) => {
-           this.$message.success("删除成功!");
-           });
+      this.axios.delete("pass/v1/sysusers/" + userId) .then((res) => {
+      });
     },
     deleteCapacity(capacityId) {
         if(getCookie("orgCode") == "wuliuchuyunzhongxin" || getCookie("orgCode") == "dagangadmin" || getCookie("orgCode") == "zidonghuabu"){
@@ -94,24 +125,25 @@ export default {
           cancelButtonText: '取消',
           type: 'warning',
         }).then(() => {
-            this.axios
-            .post("/api/v1/rms/deleteCapacity/" + capacityId)
-            .then((res) => {
-              if (res.data.code == 200) {
-                console.log(res.data.data)
-                this.deleteUser(res.data.data)
-                this.$message({
-                  type: "success",
-                  message: "删除成功!",
-                });     
-                this.$router.go(0);
-              } else {
-                this.$message({
-                  message: "删除失败",
-                  type: "warning",
-                });
-              }
-            });
+          this.axios
+          .post("/api/v1/rms/deleteCapacity/" + capacityId)
+          .then((res) => {
+            if (res.data.code == "200") {
+              console.log(res.data.data)
+              this.deleteUser(res.data.data)
+              this.$message({
+                type: "success",
+                message: "删除成功!",
+              });    
+              this.tableloading = true;
+              this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ null + "&i=" + new Date(); 
+            } else {
+              this.$message({
+                message: "删除失败",
+                type: "warning",
+              });
+            }
+          });
         }).catch(() => {
           this.$message({
             type: 'info',