Forráskód Böngészése

feat:更新代码

jinx 4 éve
szülő
commit
d58c00b2aa
2 módosított fájl, 156 hozzáadás és 145 törlés
  1. 155 144
      src/pages/equipment/index.vue
  2. 1 1
      src/pages/home/index.vue

+ 155 - 144
src/pages/equipment/index.vue

@@ -28,10 +28,7 @@
         <el-form-item label="物理地址" prop="address">
           <el-input v-model="ruleForm.address"></el-input>
         </el-form-item>
-        <el-form-item
-          v-if="ruleForm.cameraType != '' && ruleForm.cameraType != 6"
-          label="sn码" prop="snCode"
-        >
+        <el-form-item v-if="ruleForm.cameraType != '' && ruleForm.cameraType != 6" label="sn码" prop="snCode">
           <el-input v-model="ruleForm.snCode"></el-input>
         </el-form-item>
         <el-form-item label="初始点数" prop="balance">
@@ -42,13 +39,7 @@
         </el-form-item>
         <el-form-item label="客户名称" prop="compantId">
           <el-select v-model="ruleForm.companyId" placeholder="请选择">
-            <el-option
-              v-for="(item, i) in companyList"
-              :key="i"
-              :label="item.name"
-              :value="item.id"
-              >{{ item.name }}</el-option
-            >
+            <el-option v-for="(item, i) in companyList" :key="i" :label="item.name" :value="item.id">{{ item.name }}</el-option>
           </el-select>
         </el-form-item>
       </el-form>
@@ -68,12 +59,13 @@
         </el-form-item>
         <el-form-item label="充值类型">
           <el-select v-model="pointData.region" placeholder="请选择点数修改类型">
-            <el-option label="系统赠送" value=0></el-option>
-            <el-option label="退充值款" value=-2></el-option>
+            <el-option label="系统赠送" value='1'></el-option>
+            <el-option label="退充值款" value='2'></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="充值点数" width="100%">
-          <el-input @keyup.enter="_checkInput" maxlength="5" :suffix-icon="pointData.region==-2?'el-icon-minus':'el-icon-plus'" v-model.number="pointData.point"></el-input>
+          <!-- <el-input @keyup.enter="_checkInput" maxlength="5" :suffix-icon="pointData.region==-2?'el-icon-minus':'el-icon-plus'" v-model.number="pointData.point"></el-input> -->
+          <el-input @keyup.enter="_checkInput" maxlength="5" v-model.number="pointData.point"></el-input>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -91,9 +83,7 @@
           <el-button type="primary" @click="getData">搜索</el-button>
         </div>
         <div style="float: right; padding-right: 20px">
-          <el-button type="primary" @click="cameraVisible = true"
-            >添加相机</el-button
-          >
+          <el-button type="primary" @click="cameraVisible = true">添加相机</el-button>
         </div>
         <!-- <div style="float:right;padding-right:50px">
                   <el-button type="primary" @click="ShebeiVisible = true">添加设备</el-button>
@@ -102,17 +92,8 @@
     </div>
 
     <div class="h-body">
-      <el-table
-        height="520"
-        :data="tableData"
-        style="width: 100%; padding: 0 20px"
-      >
-        <el-table-column
-          v-for="(item, i) in tableHeader"
-          :key="i"
-          :prop="item.name"
-          :label="item.label"
-        >
+      <el-table height="520" :data="tableData" style="width: 100%; padding: 0 20px">
+        <el-table-column v-for="(item, i) in tableHeader" :key="i" :prop="item.name" :label="item.label">
         </el-table-column>
         <el-table-column label="操作">
           <template slot-scope="scope">
@@ -124,13 +105,7 @@
         </el-table-column>
       </el-table>
       <div class="p-con">
-        <el-pagination
-          @current-change="handleCurrentChange"
-          :current-page.sync="currentPage"
-          :page-size="size"
-          layout="total, prev, pager, next, jumper"
-          :total="total"
-        ></el-pagination>
+        <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="size" layout="total, prev, pager, next, jumper" :total="total"></el-pagination>
       </div>
     </div>
   </div>
@@ -157,7 +132,7 @@ export default {
         // { name: "goodsName", label: "设备类型" },
         { name: "cameraType", label: "设备类型" },
         { name: "snCode", label: "sn码" },
-        { name: "wifiName", label: "wifi"},
+        { name: "wifiName", label: "wifi" },
         { name: "activatedTime", label: "激活时间" },
         { name: "own", label: "出货类型" },
         { name: "companyName", label: "客户名称" },
@@ -169,38 +144,51 @@ export default {
         wifiName: "",
         address: "",
         // initPoint: "",
-        balance:"",
+        balance: "",
         cameraType: [],
         own: [],
         snCode: "",
         orderSn: "",
         companyId: "",
-        childName:""
+        childName: "",
       },
-      rules:{
-        snCode: [{ required:true ,message:'sn码不能为空'}],
-        own: [{required: true, message:'出库类型不能为空'}],
-        cameraType: [{required: true, message:'相机类型不能为空'}],
-        childName: [{required: true, message:'设备ID不能为空', trigger: 'blur'}],
-        wifiName: [{required: true, message:'wifi名称不能为空', trigger: 'blur'}],
-        address: [{required: true, message:'物理地址不能为空', trigger: 'blur'}],
-        balance: [{required: true, message:'初始点数不能为空', trigger: 'blur'}],
-        orderSn: [{required: true, message:'订单号不能为空', trigger: 'blur'}],
-        companyId: [{required: true, message:'客户名称不能为空', trigger: 'blur'}]
+      rules: {
+        snCode: [{ required: true, message: "sn码不能为空" }],
+        own: [{ required: true, message: "出库类型不能为空" }],
+        cameraType: [{ required: true, message: "相机类型不能为空" }],
+        childName: [
+          { required: true, message: "设备ID不能为空", trigger: "blur" },
+        ],
+        wifiName: [
+          { required: true, message: "wifi名称不能为空", trigger: "blur" },
+        ],
+        address: [
+          { required: true, message: "物理地址不能为空", trigger: "blur" },
+        ],
+        balance: [
+          { required: true, message: "初始点数不能为空", trigger: "blur" },
+        ],
+        orderSn: [
+          { required: true, message: "订单号不能为空", trigger: "blur" },
+        ],
+        companyId: [
+          { required: true, message: "客户名称不能为空", trigger: "blur" },
+        ],
       },
       pointVisible: false,
-      pointData:{
-        point: '',
-        region: '',
-        date1: '',
-        date2: '',
+      pointData: {
+        point: "",
+        region: "",
+        date1: "",
+        date2: "",
         delivery: false,
         type: [],
-        resource: '',
-        desc: ''
+        resource: "",
+        desc: "",
       },
-      currChildName:'',
-      currBalance:'',
+      currChildName: "",
+      currId: "",
+      currBalance: "",
       // addEq: {
       //   userName: "",
       //   companyId: "",
@@ -240,14 +228,19 @@ export default {
           pageSize: this.size,
         },
       }).then((res) => {
-        for(let i=0;i<res.message.list.length;i++){
-          res.message.list[i].activatedTime = this.$base.dateFormat('yyyy-MM-dd hh:mm',new Date(res.message.list[i].activatedTime))
-          res.message.list[i].own = this.ownToName(res.message.list[i].own)
-          res.message.list[i].cameraType = this.typeToName(res.message.list[i].cameraType)
+        for (let i = 0; i < res.message.list.length; i++) {
+          res.message.list[i].activatedTime = this.$base.dateFormat(
+            "yyyy-MM-dd hh:mm",
+            new Date(res.message.list[i].activatedTime)
+          );
+          res.message.list[i].own = this.ownToName(res.message.list[i].own);
+          res.message.list[i].cameraType = this.typeToName(
+            res.message.list[i].cameraType
+          );
         }
         this.tableData = res.message.list;
         this.total = res.message.total;
-        this.currentPage = res.message.pageNum
+        this.currentPage = res.message.pageNum;
       });
     },
     addCamera() {
@@ -267,7 +260,7 @@ export default {
         snCode: this.ruleForm.snCode,
         orderSn: this.ruleForm.orderSn,
         companyId: this.ruleForm.companyId,
-        childName: this.ruleForm.childName
+        childName: this.ruleForm.childName,
       };
       this.$http({
         method: "post",
@@ -288,16 +281,16 @@ export default {
                 wifiName: "",
                 address: "",
                 // initPoint: "",
-                balance:"",
+                balance: "",
                 cameraType: [],
                 own: [],
                 snCode: "",
                 orderSn: "",
                 companyId: "",
-                childName:""
-              }
+                childName: "",
+              };
               this.cameraVisible = false;
-              this.refresh()
+              this.refresh();
             },
           });
         } else {
@@ -308,116 +301,134 @@ export default {
         }
       });
     },
-    pointCharge(row){
-      this.pointVisible = true
-      this.pointData.region = ''
-      this.pointData.point = ''
-      this.currChildName = row.childName
-      this.currBalance = row.balance
+    pointCharge(row) {
+      this.pointVisible = true;
+      this.pointData.region = "";
+      this.pointData.point = "";
+      this.currChildName = row.childName;
+      this.currId = row.id;
+      this.currBalance = row.balance;
     },
     _checkInput: function (e) {
-      this.pointData.point += ''
-      this.pointData.point = this.form.point.replace(/[^\d]/g, '')
+      this.pointData.point += "";
+      this.pointData.point = this.form.point.replace(/[^\d]/g, "");
       if (Number(this.pointData.point) && this.pointData.point > 10000) {
-        this.pointData.point = 10000
+        this.pointData.point = 10000;
       }
     },
-    _modifyPoints(){
+    _modifyPoints() {
+      // let params = {
+      //   body: this.pointData.region,
+      //   points: this.pointData.point,
+      //   cameraId: this.pointData.childName
+      // }
       let params = {
-        body: this.pointData.region,
-        points: this.pointData.point,
-        cameraId: this.pointData.childName
+        id: this.currId,
+        type: this.pointData.region,
+        point: this.pointData.point,
+      };
+      if (this.pointData.region == "") {
+        this.$message({
+          message: "请选择充值类型",
+          type: "warning",
+        });
+        // this.$alert("请选择充值类型", "提示", {
+        //   confirmButtonText: "确定",
+        //   callback: (action) => {},
+        // });
+        return;
       }
-
-      if(!body){
-        this.$alert('请选择充值类型','提示',{
-          confirmButtonText: '确定',
-          callback: action => {
-
-          }
-        })
-      }else{
-        this.$http.post({
-          method: 'post',
-          url: '',
-          params: params,
-          headers: {
-            token: window.location.getItem('zfb_token')
-          }
-        }).then(res => {
-          if(res.code === 200){
-            this.$alert('充值成功!','提示',{
-              confirmButtonText: '确定'
-            })
-            this.pointVisible = false
-            this.refresh()
-          }else{
-            this.$alert(res.message,'提示',{
-              confirmButtonText: '确定'
-            })
-          }
-        })
+      if (this.pointData.point == "") {
+        this.$message({
+          message: "请输入点数",
+          type: "warning",
+        });
+        //   this.$alert("请输入点数", "提示", {
+        //     confirmButtonText: "确定",
+        //     callback: (action) => {},
+        //   });
+        //   return;
       }
+      this.$http({
+        method: "post",
+        url: "/company/addPoint",
+        data: params,
+        headers: {
+          token: localStorage.getItem("zfb_token"),
+        },
+      }).then((res) => {
+        if (res.code === 200) {
+          this.$alert("充值成功!", "提示", {
+            confirmButtonText: "确定",
+          });
+          this.pointVisible = false;
+          this.refresh();
+        } else {
+          this.$alert(res.message, "提示", {
+            confirmButtonText: "确定",
+          });
+        }
+      });
     },
-    clearData(){
-      this.cameraVisible = false
-      this.pointVisible = false
+    clearData() {
+      this.cameraVisible = false;
+      this.pointVisible = false;
       this.ruleForm = {
         wifiName: "",
         address: "",
         // initPoint: "",
-        balance:"",
+        balance: "",
         cameraType: [],
         own: [],
         snCode: "",
         orderSn: "",
         companyId: "",
-        childName:""
-      }
+        childName: "",
+      };
       this.pointData = {
-        point: '',
-        region: '',
-        date1: '',
-        date2: '',
+        point: "",
+        region: "",
+        date1: "",
+        date2: "",
         delivery: false,
         type: [],
-        resource: '',
-        desc: ''
-      }
+        resource: "",
+        desc: "",
+      };
     },
-    ownToName(own){
-      switch(own){
+    ownToName(own) {
+      switch (own) {
         case 0:
-          return "正常销售"
-          break
+          return "正常销售";
+          break;
         case 2:
-          return "礼品赠送"
-          break
+          return "礼品赠送";
+          break;
         case 1:
-          return "员工自用"
-          break
+          return "员工自用";
+          break;
         case 3:
-          return "其它"
-          break
+          return "其它";
+          break;
       }
     },
-    typeToName(cameraType){
-      switch(cameraType){
+    typeToName(cameraType) {
+      switch (cameraType) {
         case 4:
-          return "四维看看Pro八目相机"
-          break
+          return "四维看看Pro八目相机";
+          break;
         case 1:
-          return "四维看看Lite双目相机"
-          break
+          return "四维看看Lite双目相机";
+          break;
         case 9:
-          return "四维看看双目转台相机"
-          break
+          return "四维看看双目转台相机";
+          break;
         case 10:
-          return "四维看看激光相机"
-          break
+          return "四维看看激光相机";
+          break;
         case 6:
-          return "第三方相机"
-          break
+          return "第三方相机";
+          break;
       }
     },
     async getCompanyList() {

+ 1 - 1
src/pages/home/index.vue

@@ -1083,7 +1083,7 @@ export default {
           this.$http({
             method: 'post',
             data: params,
-            url: '/user/checkUserExists',
+            url: '/user/checkUserAddAble',
             headers: {
               token: window.localStorage.getItem('zfb_token')
             }