Selaa lähdekoodia

Finish Hotfix-zh-21

howie 3 vuotta sitten
vanhempi
commit
a246757887

+ 205 - 170
src/components/Common/image-upload.vue

@@ -1,223 +1,258 @@
 <template>
-	<div>
-		<el-upload
-			class="uploader"
-			:action="oss_url"
-			:data="dataObj"
-			:multiple="multiple"
-			name="file"
-			:accept="accept"
-			:show-file-list="false"
-			:on-success="uploadSuccess"
-			:before-upload="beforeUpload">
-		</el-upload>
-		<div class="images">
-			<div class="item" v-for="(item, index) in fileList" :key="index">
-				<div class="img" v-if="item.url" @mouseover="item.hover = true;" @mouseout="item.hover = false;">
-					<el-image ref="img" :src="imageURL + item.url" :preview-src-list="previewImages" v-if="checkFileType(item.url) == 'image'" style="width: 120px; height: 120px" fit="cover"></el-image>
-					<el-image ref="img" :src="imageURL + item.url" v-else style="width: 120px; height: 120px" fit="cover">
-						<div slot="error" class="image-slot">
-							<img class="file" src="@/assets/common/word.png" v-if="checkFileType(item.url) == 'word'">
-							<img class="file" src="@/assets/common/excel.png" v-if="checkFileType(item.url) == 'excel'">
-							<img class="file" src="@/assets/common/ppt.png" v-if="checkFileType(item.url) == 'ppt'">
-							<img class="file" src="@/assets/common/pdf.png" v-if="checkFileType(item.url) == 'pdf'">
-						</div>
-					</el-image>
-					<div class="mask" v-show="item.hover">
-						<i class="el-icon-zoom-in" @click="previewImage(item.url)" v-if="checkFileType(item.url) == 'image'"></i>
-						<i class="el-icon-upload2" @click="uploadImage(item.url)"></i>
-						<i class="el-icon-delete" @click="deleteImage(item.url)"></i>
-					</div>
-				</div>
-			</div>
-			<div class="add" @click="uploadImage()" v-if="multiple || (!multiple && fileList.length < 1)"><i class="el-icon-plus"></i></div>
-		</div>
-	</div>
+  <div>
+    <el-upload
+      class="uploader"
+      :action="oss_url"
+      :data="dataObj"
+      :multiple="multiple"
+      name="file"
+      :accept="accept"
+      :show-file-list="false"
+      :on-success="uploadSuccess"
+      :before-upload="beforeUpload"
+    />
+    <div class="images">
+      <div v-for="(item, index) in fileList" :key="index" class="item">
+        <div v-if="item.url" class="img" @mouseover="item.hover = true;" @mouseout="item.hover = false;">
+          <el-image v-if="checkFileType(item.url) == 'image'" ref="img" :src="imageURL + item.url" :preview-src-list="previewImages" style="width: 120px; height: 120px" fit="cover" />
+          <el-image v-else ref="img" :src="imageURL + item.url" style="width: 120px; height: 120px" fit="cover">
+            <div slot="error" class="image-slot">
+              <img v-if="checkFileType(item.url) == 'word'" class="file" src="@/assets/common/word.png">
+              <img v-if="checkFileType(item.url) == 'excel'" class="file" src="@/assets/common/excel.png">
+              <img v-if="checkFileType(item.url) == 'ppt'" class="file" src="@/assets/common/ppt.png">
+              <img v-if="checkFileType(item.url) == 'pdf'" class="file" src="@/assets/common/pdf.png">
+            </div>
+          </el-image>
+          <div v-show="item.hover" class="mask">
+            <i v-if="checkFileType(item.url) == 'image'" class="el-icon-zoom-in" @click="previewImage(item.url)" />
+            <i class="el-icon-upload2" @click="uploadImage(item.url)" />
+            <i class="el-icon-delete" @click="deleteImage(item.url)" />
+          </div>
+        </div>
+      </div>
+      <div v-if="multiple || (!multiple && fileList.length < 1)" class="add" @click="uploadImage()"><i class="el-icon-plus" /></div>
+    </div>
+  </div>
 </template>
 <script>
-import { getOssConfig } from '@/api/common';
+import { getOssConfig } from '@/api/common'
 import { findElem } from '@/utils/util'
 
 export default {
-	name: 'fileUpload',
-	props: {
-		// 接受上传的文件列表
-		fileList: Array,
+  name: 'FileUpload',
+  props: {
+    // 接受上传的文件列表
+    fileList: Array,
 
-		// 接受上传的文件类型
+    // 接受上传的文件类型
     fileType: {
       type: Array,
       default: () => ['image', 'word', 'excel', 'ppt', 'pdf']
     },
 
-		// 是否支持多选文件
-		multiple: {
-			type: Boolean,
-			default: false,
-		}
-	},
-	data() {
-		return {
+    // 是否支持多选文件
+    multiple: {
+      type: Boolean,
+      default: false
+    },
+    startRestricting: {
+      type: Boolean,
+      default: false
+    },
+    restrictFilename: {
+      type: Array,
+      default:()=>{
+        return  []
+      }
+    }
+
+  },
+  data() {
+    return {
       imageURL: this.$imageUrl,
-			oss_url: '',
-			dataObj: {},
-			uploadImageUrl: '',
-			waitUploadList: [],
-		};
-	},
-	created() {
-    getOssConfig().then(res => {
-      this.oss_url = res.data.host;
-    })
-	},
-	computed: {
-		isShowFileList: {
-			get: function() {
-				if (this.fileList.length > 0 && this.fileList[0].url) {
-					return true;
-				} else {
-					return false;
-				}
-			},
-			set: function(newValue) {}
-		},
-		accept() {
-			const imageList = ['.jpg', '.jpeg', '.png'];
-      const videoList = ['.mp4'];
-      const wordList = ['.doc', '.docx', '.dot', '.wps', '.wpt'];
-			const excelList = ['.xls', '.xlsx', '.xlt', '.et', '.ett'];
-			const pptList = ['.ppt', '.pptx', '.dps', '.dpt', '.pot', '.pps'];
-			const pdfList = ['.pdf'];
+      oss_url: '',
+      dataObj: {},
+      uploadImageUrl: '',
+      waitUploadList: []
+    }
+  },
+  computed: {
+    isShowFileList: {
+      get: function() {
+        if (this.fileList.length > 0 && this.fileList[0].url) {
+          return true
+        } else {
+          return false
+        }
+      },
+      set: function(newValue) {}
+    },
+    accept() {
+      const imageList = ['.jpg', '.jpeg', '.png']
+      const videoList = ['.mp4']
+      const wordList = ['.doc', '.docx', '.dot', '.wps', '.wpt']
+      const excelList = ['.xls', '.xlsx', '.xlt', '.et', '.ett']
+      const pptList = ['.ppt', '.pptx', '.dps', '.dpt', '.pot', '.pps']
+      const pdfList = ['.pdf']
 
-      let whiteList = [];
-      this.fileType.includes('image') && (whiteList = whiteList.concat(imageList));
-      this.fileType.includes('video') && (whiteList = whiteList.concat(videoList));
-      this.fileType.includes('word') && (whiteList = whiteList.concat(wordList));
-      this.fileType.includes('excel') && (whiteList = whiteList.concat(excelList));
-      this.fileType.includes('ppt') && (whiteList = whiteList.concat(pptList));
-      this.fileType.includes('pdf') && (whiteList = whiteList.concat(pdfList));
-			return whiteList.join(',');
-		},
-		previewImages() {
-      let fileList = [];
-      if(this.fileList && this.fileList.length > 0) {
+      let whiteList = []
+      this.fileType.includes('image') && (whiteList = whiteList.concat(imageList))
+      this.fileType.includes('video') && (whiteList = whiteList.concat(videoList))
+      this.fileType.includes('word') && (whiteList = whiteList.concat(wordList))
+      this.fileType.includes('excel') && (whiteList = whiteList.concat(excelList))
+      this.fileType.includes('ppt') && (whiteList = whiteList.concat(pptList))
+      this.fileType.includes('pdf') && (whiteList = whiteList.concat(pdfList))
+      return whiteList.join(',')
+    },
+    previewImages() {
+      const fileList = []
+      if (this.fileList && this.fileList.length > 0) {
         this.fileList.forEach(item => {
-          if(this.checkFileType(item.url) == 'image') {
-            fileList.push(this.imageURL + item.url);
+          if (this.checkFileType(item.url) == 'image') {
+            fileList.push(this.imageURL + item.url)
           }
         })
       }
-      return fileList;
+      return fileList
+    }
+  },
+  created() {
+    getOssConfig().then(res => {
+      this.oss_url = res.data.host
+    })
+  },
+  methods: {
+    getUUID() {
+      return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
+        return (c === 'x' ? (Math.random() * 16) | 0 : 'r&0x3' | '0x8').toString(16)
+      })
+    },
+    createName(name) {
+      const date = Date.now()
+      const uuid = this.getUUID()
+      const fileSuffix = name.substring(name.lastIndexOf('.') + 1)
+      return `${date}${uuid}.${fileSuffix}`
     },
-	},
-	methods: {
-		getUUID() {
-			return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
-				return (c === 'x' ? (Math.random() * 16) | 0 : 'r&0x3' | '0x8').toString(16);
-			});
-		},
-		createName(name) {
-			const date = Date.now();
-			const uuid = this.getUUID();
-			const fileSuffix = name.substring(name.lastIndexOf(".") + 1);
-			return `${date}${uuid}.${fileSuffix}`;
-		},
 
-		// 检查文件类型
+    // 检查文件类型
     checkFileType(url) {
-      if(!url) return '';
-			const fileSuffix = url.substring(url.lastIndexOf(".") + 1);
+      if (!url) return ''
+      const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
 
-			if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
-				return 'image';
-			}else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
-				return 'word';
-			}else if(['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
-				return 'excel';
-			}else if(['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
-				return 'ppt';
-			}else if(['pdf'].includes(fileSuffix)) {
-				return 'pdf';
-			}else {
-        return '';
+      if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
+        return 'image'
+      } else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
+        return 'word'
+      } else if (['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
+        return 'excel'
+      } else if (['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
+        return 'ppt'
+      } else if (['pdf'].includes(fileSuffix)) {
+        return 'pdf'
+      } else {
+        return ''
       }
-		},
+    },
 
-		// 获取oss配置
+    // 获取oss配置
     async getOssConfig(fileName) {
       const result = await new Promise((resolve, reject) => {
-				getOssConfig().then(res => {
-					const fileKey = this.createName(fileName);
-					res.data.name = fileName;
-					res.data.key = res.data.dir + fileKey;
-					resolve(res.data);
-				}).catch(res => {
-          resolve({});
+        getOssConfig().then(res => {
+          const fileKey = this.createName(fileName)
+          res.data.name = fileName
+          res.data.key = res.data.dir + fileKey
+          resolve(res.data)
+        }).catch(res => {
+          resolve({})
         })
       })
-      return result;
+      return result
     },
 
-		// 预览图片
+    // 预览图片
     previewImage(url) {
-      let index = findElem(this.fileList, 'url', url);
-      this.$refs.img[index].showViewer = true;
+      const index = findElem(this.fileList, 'url', url)
+      this.$refs.img[index].showViewer = true
     },
 
     // 删除图片
     deleteImage(url) {
-      let index = findElem(this.fileList, 'url', url);
-      this.fileList.splice(index, 1);
+      const index = findElem(this.fileList, 'url', url)
+      this.fileList.splice(index, 1)
     },
 
-		// 点击上传
-		uploadImage(url) {
-      this.uploadImageUrl = url;
-      document.querySelector('.uploader input').click();
+    // 点击上传
+    uploadImage(url) {
+      this.uploadImageUrl = url
+      document.querySelector('.uploader input').click()
     },
 
-		// 上传文件之前
-		async beforeUpload(file) {
-			const loading = this.$loading({
+    // 上传文件之前
+    async beforeUpload(file) {
+      const loading = this.$loading({
         lock: true,
         text: 'Loading',
         spinner: 'el-icon-loading',
         background: 'rgba(0, 0, 0, 0.7)'
-      });
-			this.dataObj = await this.getOssConfig(file.name);
-			this.waitUploadList.push(this.dataObj);
-		},
+      })
+      this.$emit('handleIsFileName', file.name)
+      this.dataObj = await this.getOssConfig(file.name)
+      this.waitUploadList.push(this.dataObj)
+      if (this.startRestricting) {
+        if (!this.restrictFilename.includes(file.name.split('.')[0])) {
+          this.$errorMsg('请根据固定文件名称上传:' + this.restrictFilename.join())
+          loading.close()
+          return Promise.reject()
+        }
+      }
+    },
 
-		// 文件上传成功
-		uploadSuccess(res, file) {
-			const loading = this.$loading({
+    // 文件上传成功
+    uploadSuccess(res, file) {
+      const loading = this.$loading({
         lock: true,
         text: 'Loading',
         spinner: 'el-icon-loading',
         background: 'rgba(0, 0, 0, 0.7)'
-      });
-			if(this.uploadImageUrl) {
-        let index = findElem(this.fileList, 'url', this.uploadImageUrl);
+      })
+      if (this.uploadImageUrl) {
+        const index = findElem(this.fileList, 'url', this.uploadImageUrl)
         this.$set(this.fileList, index, {
-					name: this.dataObj.name,
-					url: this.dataObj.key,
-					hover: false
-				});
-				this.waitUploadList = [];
-      }else {
-				let index = findElem(this.waitUploadList, 'name', file.name);
-				this.fileList.push({
-					name: this.waitUploadList[index].name,
-					url: this.waitUploadList[index].key,
-					hover: false
-				});
-        this.waitUploadList.splice(index, 1);
+          name: this.dataObj.name,
+          url: this.dataObj.key,
+          hover: false
+        })
+        this.waitUploadList = []
+      } else {
+        const index = findElem(this.waitUploadList, 'name', file.name)
+
+        if (this.startRestricting) {
+          if (this.fileList.length) {
+            this.fileList.forEach(k => {
+              if (k.name.split('.')[0] === file.name.split('.')[0]) {
+                k.name = this.waitUploadList[index].name
+                k.url = this.waitUploadList[index].key
+                k.hover = false
+                this.waitUploadList.splice(index, 1)
+                this.showFileList = true
+                loading.close()
+              }
+            })
+            return false
+          }
+        }
+        this.fileList.push({
+          name: this.waitUploadList[index].name,
+          url: this.waitUploadList[index].key,
+          hover: false
+        })
+        this.waitUploadList.splice(index, 1)
       }
-			this.showFileList = true;
-			loading.close();
-		},
-	}
-};
+      this.showFileList = true
+      loading.close()
+    }
+  }
+}
 </script>
 
 <style scoped lang="scss">

+ 7 - 3
src/views/engin_deposit/components/deposit-apply-surrender.vue

@@ -218,7 +218,7 @@
         <el-row :gutter="20">
           <el-col :xs="24" :sm="12" :lg="24">
             <el-form-item label="工程验收资料" prop="">
-              <imageUpload :fileList="fileList"  :multiple="true"/>
+              <imageUpload :fileList="fileList"  :multiple="true" :startRestricting="true" :restrictFilename="restrictFilename"/>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :lg="6">
@@ -272,9 +272,10 @@
 </template>
 
 <script>
-import { geDetail, applyDeposit } from "@/api/engin_deposit.js";
+import { applyDeposit, geDetail } from '@/api/engin_deposit.js'
+
+import imageUpload from '@/components/Common/image-upload.vue'
 
-import imageUpload from "@/components/Common/image-upload.vue";
 export default {
   components: {
     imageUpload,
@@ -285,6 +286,9 @@ export default {
       baseURL: process.env.VUE_APP_BASE_API,
       fileList: [],
       details: {},
+      restrictFilename: [
+        '安装结算单', '合同', '竣工明细表', '审核表', '收据', '相片'
+      ]
     };
   },
   created() {

+ 15 - 20
src/views/sales_policy/components/AddPolicy.vue

@@ -103,7 +103,7 @@
               </el-col>
               <el-col :xs="24" :ms="24" :lg="24">
                 <el-form-item label="政策封面图">
-                  <ImageUpload :fileList="fileList" :multiple="false" />
+                  <ImageUpload :fileList="fileList"  :multiple="false" />
                 </el-form-item>
               </el-col>
             </el-row>
@@ -426,27 +426,24 @@
 </template>
 
 <script>
-import { mapGetters, mapMutations } from "vuex";
-import Minxin from "@/mixin";
+import { mapGetters, mapMutations } from 'vuex'
+import Minxin from '@/mixin'
 import {
   addPoliy,
-  getK3List,
-  savePolicy,
-  getTypeList,
-  getWalletList,
-  updateCondition,
-  getMaterialList,
   deleteCondition,
-  getConditionList,
   deleteMaterialPolicy,
+  getConditionList,
+  getK3List,
+  getMaterialList,
   getNoRebateWalletList,
-} from "@/api/policy_list";
-import { getDictList } from "@/api/common";
-import { downloadFiles, handleImport } from "@/utils/util";
-import Transfer from "./Transfer";
-import AddCondition from "./AddCondition";
-import ImageUpload from "@/components/Common/image-upload.vue";
-import { type } from "os";
+  getTypeList,
+  savePolicy,
+  updateCondition
+} from '@/api/policy_list'
+import { downloadFiles, handleImport } from '@/utils/util'
+import Transfer from './Transfer'
+import AddCondition from './AddCondition'
+import ImageUpload from '@/components/Common/image-upload.vue'
 
 export default {
   mixins: [Minxin],
@@ -805,7 +802,7 @@ export default {
           this.$parent.getList();
           this.$parent.isShow = 1;
         });
-        return;
+
       } else {
         this.$errorMsg("选择经销商 ");
       }
@@ -846,8 +843,6 @@ export default {
       // this.dataList.push(this.addList[this.addList.length-1])
     },
     handleSave() {
-      console.log(this.dataList);
-      console.log(555);
       if (!this.dataList.length) {
           return
       }

+ 104 - 65
src/views/sales_policy/components/Transfer.vue

@@ -4,9 +4,21 @@
       <el-row class="radio">
         <el-radio-group v-model="region">
           <el-radio label="">全部经销商</el-radio>
-          <el-radio label="1">地区</el-radio>
-          <el-radio label="2">指定</el-radio>
+          <!--          <el-radio label="1">地区</el-radio>-->
+          <!--          <el-radio label="2">指定</el-radio>-->
         </el-radio-group>
+        <el-upload
+          class="import-btn"
+          :action="baseURL + 'student/import'"
+          :http-request="handleImport"
+          :file-list="importFileList"
+          :show-file-list="false"
+        >
+          <el-button
+            type="primary"  
+            size="small"
+          >导入经销商</el-button>
+        </el-upload>
       </el-row>
       <el-row type="flex">
         <el-col>
@@ -14,11 +26,9 @@
             v-model="keyword"
             placeholder="查找经销商"
             size="small"
-          ></el-input>
+          />
         </el-col>
-        <el-col
-          ><el-button size="small" @click="getcList">确定</el-button></el-col
-        >
+        <el-col style="margin-left: 10px"><el-button size="small" @click="getcList">确定</el-button></el-col>
       </el-row>
     </slot>
     <div>
@@ -37,22 +47,20 @@
                 :label="item.id"
                 :disabled="item.disabled"
               >
-                {{ item.name }}</el-checkbox
-              >
+                {{ item.name }}</el-checkbox>
             </el-checkbox-group>
           </div>
           <!-- 分页 -->
           <div>
             <el-pagination
-              @size-change="handleSizeChange"
-              @current-change="handleCurrentChange"
               :current-page="currentPage"
               :page-sizes="[10]"
               :page-size="10"
               layout="total, sizes, prev, pager, next, jumper"
               :total="listTotal"
-            >
-            </el-pagination>
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+            />
           </div>
         </el-col>
         <el-col class="middle_box" :span="6">
@@ -60,35 +68,27 @@
             <el-col>
               <el-button
                 size="small"
-                @click="handleAllAdd"
                 :disabled="type == 2 || !dataL.length"
-                >全部添加</el-button
-              ></el-col
-            >
+                @click="handleAllAdd"
+              >全部添加</el-button></el-col>
             <el-col>
               <el-button
                 size="small"
-                @click="handleAdd"
                 :disabled="type == 2 || !dataL.length"
-                >增加</el-button
-              ></el-col
-            >
+                @click="handleAdd"
+              >增加</el-button></el-col>
             <el-col>
               <el-button
                 size="small"
                 :disabled="type == 1 || !dataR.length"
                 @click="handleDelete"
-                >删除</el-button
-              ></el-col
-            >
+              >删除</el-button></el-col>
             <el-col>
               <el-button
                 size="small"
                 :disabled="type == 1 || !dataR.length"
                 @click="handleAllDelete"
-                >全部删除</el-button
-              ></el-col
-            >
+              >全部删除</el-button></el-col>
           </el-row>
         </el-col>
         <el-col
@@ -108,17 +108,18 @@
               :key="index"
               :label="item.id"
             >
-              {{ item.name }}</el-checkbox
-            >
+              {{ item.name }}</el-checkbox>
           </el-checkbox-group>
         </el-col>
       </el-row>
     </div>
     <slot name="footer">
       <el-row style="margin:50px  0 0 0;">
-        <el-button type="primary" size="small" @click="handleSubmit"
-          >提交审核</el-button
-        >
+        <el-button
+          type="primary"
+          size="small"
+          @click="handleSubmit"
+        >提交审核</el-button>
         <el-button type="primary" size="small" @click="">重置</el-button>
       </el-row>
     </slot>
@@ -126,60 +127,64 @@
 </template>
 
 <script>
-import Minxin from "@/mixin";
-import { getCrList } from "@/api/policy_list";
+import Minxin from '@/mixin'
+import { getCrList } from '@/api/policy_list'
+import { handleImport } from '@/utils/util'
+
 export default {
   mixins: [Minxin],
   data() {
     return {
-      type: "",
-      radio: "",
+      baseURL:'',
+      type: '',
+      radio: '',
       leftData: [],
       dataL: [],
       dataR: [],
       rightData: [],
       options: [],
-      value: "",
-      region: "",
-      keyword: "",
-    };
+      value: '',
+      region: '',
+      keyword: '',
+      importFileList: []
+    }
   },
   methods: {
     getList() {
-      this.getcList();
+      this.getcList()
     },
-    getcList() {
+    getcList: function() {
       const customerParams = {
         pageNum: this.currentPage,
         pageSize: this.pageSize,
-        keyword: this.region == 1 || this.region == "" ? "" : this.keyword,
-        region: this.region == 1 ? this.keyword : "",
-      };
+        keyword: this.keyword,
+        region: ''
+      }
       // 获取经销商列表
       getCrList(customerParams).then((res) => {
         for (let i = 0; i < res.data.records.length; i++) {
-          res.data.records[i].disabled = false;
+          res.data.records[i].disabled = false
         }
-        this.dataL = res.data.records;
-        console.log(res, "获取经销商列表");
-        this.listTotal = res.data.total;
-      });
+        this.dataL = res.data.records
+        console.log(res, '获取经销商列表')
+        this.listTotal = res.data.total
+      })
     },
     handleLeft(e) {
-      console.log(e);
-      this.type = 1;
+      console.log(e)
+      this.type = 1
     },
     handleRight(e) {
-      this.type = 2;
+      this.type = 2
     },
     handleAllAdd() {
-      this.dataR = this.dataL;
+      this.dataR = [...new Set([...this.dataR, ...this.dataL])]
     },
     handleAllDelete() {
       //  for (let j = 0; j < this.dataL.length; j++) {
       //         this.dataL[j].disabled = false
       //       }
-      this.dataR = [];
+      this.dataR = []
     },
     handleAdd() {
       if (this.type == 1) {
@@ -187,40 +192,73 @@ export default {
         for (let i = 0; i < this.dataL.length; i++) {
           for (let k = 0; k < this.leftData.length; k++) {
             if (this.dataL[i].id == this.leftData[k]) {
-              this.dataR = [...new Set([...this.dataR, this.dataL[i]])];
+              this.dataR = [...new Set([...this.dataR, this.dataL[i]])]
               // this.rightData =[...this.rightData,this.leftData[k]]
               // this.dataL[i].disabled = true
             }
           }
         }
-        this.leftData = [];
+        this.leftData = []
       }
     },
     handleDelete() {
       if (this.type == 2) {
-        const dataArr = JSON.parse(JSON.stringify(this.dataR));
+        const dataArr = JSON.parse(JSON.stringify(this.dataR))
 
-        for (let k = dataArr.length-1; k >=0; k--) {
+        for (let k = dataArr.length - 1; k >= 0; k--) {
           for (let i = 0; i < this.rightData.length; i++) {
             if (this.rightData[i] == this.dataR[k].id) {
-              dataArr.splice(k, 1);
-              continue;
+              dataArr.splice(k, 1)
             }
           }
         }
-        this.dataR = dataArr;
-        this.rightData = [];
+        this.dataR = dataArr
+        this.rightData = []
       }
     },
     handleSubmit() {
-      this.$emit("handleAddPolicy", this.dataR);
+      this.$emit('handleAddPolicy', this.dataR)
     },
-  },
-};
+    // 导入
+    async handleImport(param) {
+      return
+      this.importLoading = true
+      const file = param.file
+      console.log(file, 123)
+      const formData = new FormData()
+      formData.append('file', file)
+      formData.append('policyId', this.searchForm.code)
+      // formData.append("mainId", this.searchForm.mainId);
+      const result = await handleImport('/policy/material/import', formData)
+      this.importLoading = false
+      this.importFileList = []
+      if (result.code == 200) {
+        this.$alert(result.message, '导入成功', {
+          confirmButtonText: '确定'
+        })
+        this.dataList = []
+        this.listTotal = 0
+        this.sleectBox.currentPage = 1
+        this.handletwoList()
+      } else {
+        this.$alert(result.message, '导入失败', {
+          confirmButtonText: '确定'
+        })
+      }
+    }
+  }
+}
 </script>
 
 <style lang="scss" scoped>
 // 穿梭框
+.radio{
+  display: flex;
+  align-items: center;
+}
+.import-btn{
+  margin-left: 10px;
+}
 .transfer {
   margin: 20px 0;
   &_title {
@@ -246,6 +284,7 @@ export default {
     width: 440px;
     height: 450px;
     border: 1px solid #eee;
+    overflow-y: auto;
     &_flex {
       display: flex;
       flex-direction: column;

+ 8 - 11
src/views/supply/policy/components/retail_form.vue

@@ -142,7 +142,7 @@
           show-overflow-tooltip
         >
           <template slot-scope="scope">
-            {{scope.row.materialNumber?scope.row.materialNumber:scope.row.materialCode}}
+            {{ scope.row.materialNumber?scope.row.materialNumber:scope.row.materialCode }}
           </template>
         </el-table-column>
         <el-table-column
@@ -207,7 +207,7 @@
               placeholder="选择返利钱包"
               clearable
               size="small"
-              @change="changeWallet(scope.$index)"
+              @change="changeWallet($event,scope.row)"
             >
               <el-option
                 v-for="item in scope.row.rebateWallets"
@@ -1660,15 +1660,12 @@ export default {
       // this.popDataArr.splice(index,1)
     },
     // 修改返利钱包
-    changeWallet(index) {
-      if (this.goodsList[index].customerWalletId2) {
-        let obj = this.flWalletList.find(
-          (o) => o.customerWalletId == this.goodsList[index].customerWalletId2
-        );
-        this.goodsList[index].rebateRate = obj.rebateRate;
-      } else {
-        this.goodsList[index].rebateRate = "";
-      }
+    changeWallet(e,row) {
+       const obj =  row.rebateWallets.filter(k=>{
+          return e===k.customerWalletId
+        })[0]
+        this.$set(row,'rebateRate',(obj.rebateRate||0))
+
     },
 
     // 检查库存