Przeglądaj źródła

fixed: 解决新增企业无法保存图片BUG

Vccc6 4 lat temu
rodzic
commit
eb862b03d5

+ 1 - 1
package.json

@@ -82,7 +82,7 @@
   ],
   "eslintConfig": {
     "rules": {
-      "eslint-disable-next-line":false
+      "eslint-disable-next-line": false
     }
   }
 }

+ 15 - 6
src/pages/authentication/index.vue

@@ -73,7 +73,7 @@
           <el-form-item label="*企业LOGO">
             <el-upload
               :headers="{token}"
-              :action="serverName+'/company/uploadLogo'"
+              :action="serverName+'/house/upload'"
               :show-file-list="true"
               :before-upload="beforeAvatarUpload"
               :on-change="handleChange"
@@ -105,12 +105,12 @@
           </el-form-item>
           <el-form-item label="*企业资质">
             <el-upload
-              :action="serverName+'/company/uploadLogo'"
+              :action="serverName+'/house/upload'"
               :show-file-list="true"
               :before-upload="beforeAvatarUpload"
               :on-change="handleChange"
               :file-list="fileList2"
-              :on-success="upload_success"
+              :on-success="upload_success2"
               :on-error="upload_fail">
               <div class="zfb-load">
                 <el-button style="float:left" size="small" type="primary">点击上传</el-button>
@@ -248,7 +248,11 @@ export default {
       loading: false,
       formLabelWidth: '100px',
       userName: '',
-      form: {},
+      form: {
+        ac_logo:'',
+        ac_zizhi:''
+      },
+      pagesize: 10,
       size: 10,
       total: 0,
       c_id: '',
@@ -483,8 +487,13 @@ export default {
     },
     upload_success (data) {
       console.log('上传成功')
-
-      this.homepic = data.message
+      console.log(data)
+      this.ac_logo = data.message
+    },
+    upload_success2 (data) {
+      console.log('上传成功')
+      console.log(data)
+      this.ac_zizhi = data.message
     },
     upload_fail (data) {
       this.$notify.error({

+ 10 - 5
src/pages/device/index.vue

@@ -46,7 +46,12 @@
             </el-table>
           </div>
           <div class="order-management-pagination">
-            <el-pagination  @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="pagesize" layout="total, prev, pager, next, jumper" :total="total">
+            <el-pagination  
+            @current-change="handleCurrentChange" 
+            :current-page.sync="currentPage" 
+            :page-size="pagesize" 
+            layout="total, prev, pager, next, jumper" 
+            :total="total">
             </el-pagination>
           </div>
         </div>
@@ -233,7 +238,7 @@ export default {
       }
       this.$http({
         method:'post',
-        url:'/company/selectCompanyDevice',
+        url:'/camera/pageList',
         data: params,
         headers:{
           token: window.localStorage.getItem('zfb_token')
@@ -279,8 +284,8 @@ export default {
       this.dialogFormVisible = true
     },
     async getCompanyList () {
-      let result = await this.$http.post('/manager/company/listAll')
-      this.companyList = result.data
+      let result = await this.$http.post('/company/listAll')
+      this.companyList = result.message.list
     },
     async _unbindDevice (row) {
       this.$confirm('确定把该设备从账号中解除绑定', '解绑设备', {
@@ -377,7 +382,7 @@ export default {
       }
 
       this.fullscreenLoading = true
-      let res = await this.$http.post('/manager/camera/add', {
+      let res = await this.$http.post('/camera/add', {
         childName,
         wifiName,
         orderSn,

+ 54 - 44
src/pages/equipment/index.vue

@@ -14,8 +14,9 @@
           <el-select v-model="ruleForm.type" placeholder="请选择相机类型">
             <el-option label="四维看看Pro八目相机" value="1"></el-option>
             <el-option label="四维看看Lite双目相机" value="0"></el-option>
-            <el-option label="四维看看双目转台相机" value="3"></el-option>
-            <el-option label="四维看看激光相机" value="4"></el-option>
+            <el-option label="四维看看双目转台相机" value="9"></el-option>
+            <el-option label="四维看看激光相机" value="10"></el-option>
+            <el-option label="第三方相机" value="6"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="wifi名称">
@@ -24,8 +25,8 @@
         <el-form-item label="物理地址">
           <el-input v-model="ruleForm.address"></el-input>
         </el-form-item>
-        <el-form-item label="sn码">
-          <el-input v-model="ruleForm.snCode"></el-input>
+        <el-form-item v-if="ruleForm.type != 6" label="*sn码">
+          <el-input v-model="ruleForm.snCode" required></el-input>
         </el-form-item>
         <el-form-item label="初始点数">
           <el-input v-model="ruleForm.initPoint"></el-input>
@@ -35,7 +36,7 @@
         </el-form-item>
         <el-form-item label="客户名称">
           <el-select v-model="ruleForm.companyId" placeholder="请选择">
-            <el-option></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>
@@ -51,7 +52,7 @@
           <el-input v-model="userName" placeholder="请输入用户名"></el-input>
         </div>
         <div>
-          <el-button type="primary" @click="search">搜索</el-button>
+          <el-button type="primary" @click="getData">搜索</el-button>
         </div>
         <div style="float: right; padding-right: 20px">
           <el-button type="primary" @click="cameraVisible = true"
@@ -77,20 +78,21 @@
           :label="item.label"
         >
         </el-table-column>
-        <el-table-column label="操作">
+        <!-- <el-table-column label="操作">
           <template slot-scope="scope">
-            <div>点数</div>
-            <div>解绑</div>
+            <div>
+              <span>点数</span>
+              <span>解绑</span>
+            </div>
           </template>
-        </el-table-column>
+        </el-table-column> -->
       </el-table>
       <div class="p-con">
         <el-pagination
-          @size-change="handleSizeChange"
           @current-change="handleCurrentChange"
           :current-page.sync="currentPage"
           :page-size="size"
-          layout="prev, pager, next, jumper"
+          layout="total, prev, pager, next, jumper"
           :total="total"
         ></el-pagination>
       </div>
@@ -153,50 +155,54 @@ export default {
     };
   },
   methods: {
-    handleSizeChange(val) {
-      console.log(`每页 ${val} 条`);
-    },
-    handleCurrentChange(val) {
-      console.log(`当前页: ${val}`);
-    },
+    // handleSizeChange(val) {
+    //   console.log(`每页 ${val} 条`);
+    // },
+    // handleCurrentChange(val) {
+    //   console.log(`当前页: ${val}`);
+    // },
     getData() {
-      let result;
+      if (!Number(this.currentPage)) this.currentPage = 1
       let params = {
         userName: this.userName || "",
-        // userName: this.userName || '',
-        // childName: this.childName || ''
       };
       this.$http({
         method: "post",
         data: params,
         url: "/camera/pageList",
-        header: {
+        headers: {
           token: window.localStorage.getItem("zfb_token"),
           pageNum: this.currentPage,
           pageSize: this.size,
         },
       }).then( res => {
-        this.tabelData = res.message;
-        // this.total = result.message.total
-        // this.currentPage = result.message.pageNum
+        this.tableData = res.message.list;
+        this.total = res.message.total
+        // this.currentPage = res.message.pageNum
       });
     },
     addCamera() {
+      if(this.ruleForm.type != 6 && this.ruleForm.snCode == ''){
+        this.$alert('sn码不能为空!','提示',{
+          confirmButtonText: '确定',
+        })
+        return
+      }
       let params = {
-        wifi: "",
-        address: "",
-        initPoint: "",
-        type: [],
-        own: [],
-        snCode: "",
-        orderNum: "",
-        companyId: "",
+        wifi: this.ruleForm.wifi,
+        address: this.ruleForm.address,
+        initPoint: this.ruleForm.initPoint,
+        type: this.ruleForm.type,
+        own: this.ruleForm.own,
+        snCode: this.ruleForm.snCode,
+        orderNum: this.ruleForm.orderNum,
+        companyId: this.ruleForm.companyId,
       };
       this.$http({
         method: "post",
         url: "/camera/add",
         data: params,
-        header: {
+        headers: {
           token: window.localStorage.getItem("zfb_token"),
           pageNum: this.currentPage,
           pageSize: this.size,
@@ -206,7 +212,8 @@ export default {
           this.$alert('相机添加成功','提示',{
             confirmButtonText: '确定',
             callback: action => {
-
+              this.getCompanyList()
+              this.cameraVisible = false
             }
           })
         }else{
@@ -221,17 +228,20 @@ export default {
     },
     async getCompanyList(){
       let result = await this.$http.post('/company/listAll')
-      this.companyList = result
+      this.companyList = result.message
+    },
+    handleCurrentChange (val) {
+      this.currentPage = val
     },
     refresh() {
       this.loading = true;
       this.getData();
       this.loading = false;
     },
-    search() {
-      this.currentPage === 1 ? this.refresh() : (this.currentPage = 1);
-      this.getData()
-    },
+    // search() {
+    //   this.currentPage === 1 ? this.refresh() : (this.currentPage = 1);
+    //   this.getData()
+    // },
     checkLegal(item) {
       if (item.value) {
         let params = {
@@ -267,11 +277,11 @@ export default {
   },
   watch: {
     currentPage() {
-      this.refresh();
-    },
-    size() {
-      this.refresh();
+      this.getData()
     },
+    // size() {
+    //   this.refresh();
+    // },
     num(newVal, oldVal) {
       if (newVal > oldVal) {
         this.addDevies.push({

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

@@ -46,7 +46,7 @@
                  @current-change="handleCurrentChange"
                  :current-page.sync="currentPage"
                  :page-size="size"
-                 layout="prev, pager, next, jumper"
+                 layout="total, prev, pager, next, jumper"
                  :total="total"
                 ></el-pagination>
             </div>

+ 1 - 1
src/utils/http.js

@@ -3,7 +3,7 @@ import Vue from 'vue'
 import router from '../router'
 
 var isProduction = process.env.NODE_ENV === 'production'
-const serverName = isProduction ? '' : '/api'
+const serverName = isProduction ? '/zfb' : '/api'
 
 //const serverName = isProduction ? '' : 'https://admin.zhifangbao.com/'