浏览代码

修改bug

web100 2 年之前
父节点
当前提交
faa2ad2e49
共有 2 个文件被更改,包括 149 次插入49 次删除
  1. 148 49
      src/views/basicdata/dept/index.vue
  2. 1 0
      src/views/warehouseBusiness/warehouseCheck/index.vue

+ 148 - 49
src/views/basicdata/dept/index.vue

@@ -5,12 +5,33 @@
         <el-input v-model="queryParams.fName" placeholder="请输入仓库名称" clearable size="small"
           @keyup.enter.native="handleQuery" />
       </el-form-item>
-      <el-form-item label="状态" prop="status">
-        <el-select v-model="queryParams.status" placeholder="仓库状态" clearable size="small">
+      <el-form-item label="仓库属性" prop="fProperties">
+        <el-select v-model="queryParams.fProperties" placeholder="仓库属性" clearable size="small">
+          <el-option v-for="dict in fPropertiesOptions" :key="dict.dictValue" :label="dict.dictLabel"
+            :value="dict.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="仓库类型" prop="fType">
+        <el-select v-model="queryParams.fType" placeholder="仓库类型" clearable size="small">
+          <el-option v-for="dict in fTypeOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="货物类型" prop="fGoodsType">
+        <el-select v-model="queryParams.fGoodsType" placeholder="货物类型" clearable size="small">
+          <el-option v-for="dict in fGoodsTypeOptions" :key="dict.dictValue" :label="dict.dictLabel"
+            :value="dict.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="状态" prop="fStatus">
+        <el-select v-model="queryParams.fStatus" placeholder="仓库状态" clearable size="small">
           <el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel"
             :value="dict.dictValue" />
         </el-select>
       </el-form-item>
+      <el-form-item label="地址" prop="fAddr">
+        <el-input v-model="queryParams.fAddr" placeholder="请输入地址" clearable size="small"
+          @keyup.enter.native="handleQuery" />
+      </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -26,7 +47,7 @@
     </el-row>
 
     <el-table v-loading="loading" :data="deptList" row-key="fId" :default-expand-all="false" lazy
-      :tree-props="{children: 'children', hasChildren: 'hasChildren'}" :load="getTreeLoad" ref="table">
+      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" :load="getTreeLoad" ref="table">
       <el-table-column prop="fName" label="仓库名称" width="310"></el-table-column>
       <el-table-column prop="fProperties" label="仓库属性" width="100" :formatter="formatFProperties"></el-table-column>
       <el-table-column prop="fType" label="仓库类型" width="100" :formatter="formatfType"></el-table-column>
@@ -122,8 +143,7 @@
       <template slot="title">
         <div class="avue-crud__dialog__header">
           <span class="el-dialog__title">
-            <span
-              style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px"></span>
+            <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px"></span>
             添加仓库
           </span>
           <div class="avue-crud__dialog__menu enlarge" @click="full">
@@ -137,8 +157,7 @@
         <el-row>
           <el-col :span="8" v-if="form.parentId !== 0">
             <el-form-item label="上级仓库" prop="parentId">
-              <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer"
-                placeholder="选择上级仓库" />
+              <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级仓库" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -166,37 +185,25 @@
         <el-row>
           <el-col :span="8">
             <el-form-item label="仓库属性" prop="fProperties" label-width="82px">
-              <el-select v-model="form.fProperties" multiple collapse-tags style="width:100%" >
-                <el-option
-                v-for="(item, index) in fPropertiesOptions"
-                :key="index.dictValue"
-                :label="item.dictLabel"
-                :value="item.dictValue"
-              />
+              <el-select v-model="form.fProperties" multiple collapse-tags style="width:100%">
+                <el-option v-for="(item, index) in fPropertiesOptions" :key="index.dictValue" :label="item.dictLabel"
+                  :value="item.dictValue" />
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="仓库类型" prop="fType" label-width="82px">
               <el-select v-model="form.fType" multiple ollapse-tags style="width:100%">
-                <el-option
-                v-for="(item, index) in fTypeOptions"
-                :key="index.dictValue"
-                :label="item.dictLabel"
-                :value="item.dictValue"
-              />
+                <el-option v-for="(item, index) in fTypeOptions" :key="index.dictValue" :label="item.dictLabel"
+                  :value="item.dictValue" />
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="货物类型" prop="fGoodsType" label-width="82px">
               <el-select v-model="form.fGoodsType" multiple ollapse-tags style="width:100%">
-                <el-option
-                v-for="(item, index) in fGoodsTypeOptions"
-                :key="index.dictValue"
-                :label="item.dictLabel"
-                :value="item.dictValue"
-              />
+                <el-option v-for="(item, index) in fGoodsTypeOptions" :key="index.dictValue" :label="item.dictLabel"
+                  :value="item.dictValue" />
               </el-select>
             </el-form-item>
           </el-col>
@@ -222,8 +229,7 @@
           </el-col>
           <el-col :span="8">
             <el-form-item label="电话" prop="fTel">
-              <el-input v-model="form.fTel" placeholder="请输入电话"
-                oninput='this.value=this.value.replace(/[^\-?\d]/g,"")' />
+              <el-input v-model="form.fTel" placeholder="请输入电话" oninput='this.value=this.value.replace(/[^\-?\d]/g,"")' />
             </el-form-item>
           </el-col>
           <el-col :span="8">
@@ -242,7 +248,7 @@
           <el-col :span="8">
             <el-form-item label="状态">
               <el-radio-group v-model="form.fStatus">
-                <el-radio v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}
+                <el-radio v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictValue">{{ dict.dictLabel }}
                 </el-radio>
               </el-radio-group>
             </el-form-item>
@@ -271,13 +277,13 @@
             </el-form-item>
           </el-col>
         </el-row>
-      <el-row>
+        <el-row>
           <el-col :span="8">
             <el-form-item label="占地面积" prop="fCoverArea">
               <el-input v-model="form.fCoverArea" placeholder="请输入占地面积" @change="nameChange" />
             </el-form-item>
           </el-col>
-      </el-row>
+        </el-row>
         <!--<el-form-item label="状态,默认 T ,正常T 停用F 下拉选择">
           <el-radio-group v-model="form.fStatus">
             <el-radio label="1">请选择字典生成</el-radio>
@@ -290,7 +296,19 @@
           <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
         </el-form-item>
       </el-form>
-      <up-load :relevantAttachments="relevantAttachments" :createBy="username"></up-load>
+      <!-- <up-load :relevantAttachments="relevantAttachments" :createBy="username"></up-load> -->
+
+      <div style="margin-top: 20px;border: 1px solid #cccccc;padding: 5px;border-radius: 10px">
+        <el-upload :headers="headers" :action="uploadImgUrl" :on-success="onSuccess" list-type="picture-card"
+          :file-list="fileList" accept=".jpeg,.jpg,.png,.svg,.webp" :limit="100" :on-preview="handlePictureCardPreview"
+          :on-remove="handleRemove">
+          <i class="el-icon-plus"></i>
+        </el-upload>
+        <el-dialog :visible.sync="dVisible" append-to-body>
+          <img width="100%" :src="dialogImageUrl" alt="">
+        </el-dialog>
+      </div>
+
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
@@ -302,6 +320,7 @@
 <script>
 import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild, lazyListDept } from "@/api/basicdata/dept";
 import { list } from "@/api/monitor/monitorList";
+import { getToken } from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import Vue from 'vue'
@@ -370,15 +389,21 @@ export default {
   },
   data() {
     return {
+      headers: {
+        Authorization: "Bearer " + getToken(),
+      },
       total: 0,
+      dVisible: false,
       // 表格数据
       list: [],
+      dialogImageUrl: '',
+      uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
       //仓库属性
-      fPropertiesOptions:[],
+      fPropertiesOptions: [],
       //仓库类型
-      fTypeOptions:[],
+      fTypeOptions: [],
       //货物类型
-      fGoodsTypeOptions:[],
+      fGoodsTypeOptions: [],
       dialogVideoList: false,
       dialogVideo: false,
       //全屏放大
@@ -389,6 +414,7 @@ export default {
       showSearch: true,
       // 表格树数据
       deptList: [],
+      fileList: [],
       maps: [],
       // 仓库树选项
       deptOptions: [],
@@ -401,7 +427,11 @@ export default {
       // 查询参数
       queryParams: {
         fName: undefined,
-        status: undefined
+        fStatus: undefined,
+        fProperties: undefined,
+        fType: undefined,
+        fGoodsType: undefined,
+        fAddr: undefined
       },
       // 表单参数
       form: {
@@ -440,7 +470,7 @@ export default {
       },
       relevantAttachments: [],
       username: null,
-      projectIdOptions:[],
+      projectIdOptions: [],
     };
   },
   watch: {
@@ -500,15 +530,53 @@ export default {
       });
     },
     //仓库属性回显
-    formatFProperties(row,index){
+    formatFProperties(row, index) {
       // console.log(this.fPropertiesOptions[index]);
-      return this.selectDictLabel(this.fPropertiesOptions, row.fProperties);
+      let name = ""
+      if (row.fProperties != null && row.fProperties != "") {
+        let fPropertiesList = row.fProperties.split(",")
+        for (let i = 0; i < fPropertiesList.length; i++) {
+          name = name + this.selectDictLabel(this.fPropertiesOptions, fPropertiesList[i]) + ",";
+        }
+        name = name.substring(0, name.length - 1)
+
+      }
+      return name
+    },
+    formatfType(row) {
+      let name = ""
+      if (row.fType != null && row.fType != "") {
+        let fTypeList = row.fType.split(",")
+        for (let i = 0; i < fTypeList.length; i++) {
+          name = name + this.selectDictLabel(this.fTypeOptions, fTypeList[i]) + ",";
+        }
+        name = name.substring(0, name.length - 1)
+      }
+      return name
+    },
+    formatfGoodsType(row) {
+      let name = ""
+      if (row.fGoodsType != null && row.fGoodsType != "") {
+        let fGoodsTypeList = row.fGoodsType.split(",")
+        for (let i = 0; i < fGoodsTypeList.length; i++) {
+          name = name + this.selectDictLabel(this.fGoodsTypeOptions, fGoodsTypeList[i]) + ",";
+        }
+        name = name.substring(0, name.length - 1)
+
+      }
+      return name
     },
-    formatfType(row){
-      return this.selectDictLabel(this.fTypeOptions, row.fType);
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url;
+      this.dVisible = true;
     },
-    formatfGoodsType(row){
-      return this.selectDictLabel(this.fGoodsTypeOptions, row.fGoodsType);
+    //移除图片
+    handleRemove(file, fileList) {
+      console.log(fileList);
+      this.pictureEist = fileList
+    },
+    onSuccess(response, file, fileList) {
+      this.pictureEist = fileList
     },
     rowView(row) {
       Axios.post("/prod-api/api/LiveBroadcast/getAccessToken").then(res => {
@@ -633,11 +701,26 @@ export default {
       console.log('修改');
       this.reset();
       getDept(row.fId).then(response => {
-        console.log(response);
+        console.log(response.data);
         this.form = response.data;
         this.form.fLocation = this.form.fLocation + ''
         this.form.fCharg = this.form.fCharg + ''
-        this.relevantAttachments = this.form.annexList ? this.form.annexList : [];
+        // this.relevantAttachments = this.form.annexList ? this.form.annexList : [];
+        this.form.fProperties = this.form.fProperties.split(",")
+        this.form.fType = this.form.fType.split(",")
+        this.form.fGoodsType = this.form.fGoodsType.split(",")
+        this.form.fCoverArea = this.form.fCoverArea
+        this.fileList = []
+        for (let item in response.data.annexList) {
+
+          this.fileList.push(response.data.annexList[item].fUrl)
+        }
+        // 在每个元素前添加URL属性
+        this.fileList = this.fileList.map((file) => {
+          return { url: file };
+        });
+        this.pictureEist = this.fileList
+        console.log(this.fileList);
         this.open = true;
         this.title = "修改仓库";
       });
@@ -647,15 +730,27 @@ export default {
     },
     /** 提交按钮 */
     submitForm: function () {
-      this.form.fProperties = this.form.fProperties.join(',');
-      this.form.fType = this.form.fType.join(',');
-      this.form.fGoodsType = this.form.fGoodsType.join(',');
-      console.log(this.form.fProperties,this.form.fType,this.form.fGoodsType);
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.fId != undefined) {
             console.log(this.relevantAttachments)
             this.form.annexList = this.relevantAttachments
+            this.form.fProperties = this.form.fProperties.join(',');
+            this.form.fType = this.form.fType.join(',');
+            this.form.fGoodsType = this.form.fGoodsType.join(',');
+            this.form.annexList = []
+            for (let item in this.pictureEist) {
+              if (this.pictureEist[item].response) {
+                this.form.annexList.push({
+                  url: this.pictureEist[item].response.url
+                })
+              } else {
+                this.form.annexList.push({
+                  url: this.pictureEist[item].url
+                })
+              }
+            }
+            this.form.annexList = JSON.stringify(this.form.annexList)
             updateDept(this.form).then(response => {
               this.msgSuccess("修改成功");
               this.open = false;
@@ -663,6 +758,10 @@ export default {
             });
           } else {
             this.form.annexList = this.relevantAttachments
+            this.form.fProperties = this.form.fProperties.join(',');
+            this.form.fType = this.form.fType.join(',');
+            this.form.fGoodsType = this.form.fGoodsType.join(',');
+            console.log(this.form.fProperties, this.form.fType, this.form.fGoodsType);
             addDept(this.form).then(response => {
               this.msgSuccess("新增成功");
               this.open = false;

+ 1 - 0
src/views/warehouseBusiness/warehouseCheck/index.vue

@@ -850,6 +850,7 @@ export default {
             this.fileList.push(JSON.parse(res.rows[0].fPhotoUrl)[item])
           }
           this.pictureEist = this.fileList
+          console.log(this.pictureEist);
         }
       })
       this.opentwo = true