案例管理
This commit is contained in:
		
							
								
								
									
										174
									
								
								stdiet-ui/src/components/Customer/SelectCustomer.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										174
									
								
								stdiet-ui/src/components/Customer/SelectCustomer.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,174 @@ | ||||
| <template> | ||||
|   <!-- 选择用户对话框 --> | ||||
|   <el-dialog :title="title" :visible.sync="open" @closed="cancel" width="480px" append-to-body> | ||||
|   <div class="app-container"> | ||||
|     <el-form | ||||
|       :model="queryParams" | ||||
|       ref="queryForm" | ||||
|       :inline="true" | ||||
|       v-show="showSearch" | ||||
|       label-width="60px" style="margin-top: -20px"> | ||||
|       <el-form-item label="名字" prop="name"> | ||||
|         <el-input | ||||
|           v-model.trim="queryParams.name" | ||||
|           placeholder="请输入名字" | ||||
|           clearable | ||||
|           size="small" | ||||
|         /> | ||||
|       </el-form-item> | ||||
|       <el-form-item> | ||||
|         <el-button | ||||
|           type="cyan" | ||||
|           icon="el-icon-search" | ||||
|           size="mini" | ||||
|           @click="handleQuery" | ||||
|           >搜索</el-button | ||||
|         > | ||||
|       </el-form-item> | ||||
|     </el-form> | ||||
|  | ||||
|     <el-row :gutter="10" class="mb8"> | ||||
|       <!--<el-col :span="1.5"> | ||||
|         <el-button | ||||
|           type="success" | ||||
|           size="mini" | ||||
|           :disabled="single" | ||||
|           @click="handleSelect" | ||||
|         >选择当前勾选用户</el-button> | ||||
|       </el-col>--> | ||||
|       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||||
|     </el-row> | ||||
|  | ||||
|     <el-table | ||||
|       v-loading="loading" | ||||
|       :data="customerCenterList" | ||||
|       @selection-change="handleSelectionChange" | ||||
|       ref="customerTable" | ||||
|     > | ||||
|      <!-- <el-table-column | ||||
|         label="创建时间" | ||||
|         align="center" | ||||
|         prop="createTime" | ||||
|         width="166" | ||||
|       />--> | ||||
|       <el-table-column type="selection" width="55" align="center" /> | ||||
|       <el-table-column label="客户姓名" align="center" prop="name" /> | ||||
|       <el-table-column label="手机号" align="center" prop="phone" /> | ||||
|     </el-table> | ||||
|  | ||||
|     <pagination | ||||
|       v-show="total > 0" | ||||
|       :total="total" | ||||
|       :page.sync="queryParams.pageNum" | ||||
|       :limit.sync="queryParams.pageSize" | ||||
|       :layout="'total, sizes, prev, next'" | ||||
|       :pageSizes="[5]" | ||||
|       @pagination="getList" | ||||
|     /> | ||||
|  | ||||
|   </div> | ||||
|     <div slot="footer" class="dialog-footer"> | ||||
|       <el-button | ||||
|         type="success" | ||||
|         :disabled="single" | ||||
|         @click="handleSelect" | ||||
|       >确定</el-button> | ||||
|       <el-button @click="cancel">取 消</el-button> | ||||
|     </div> | ||||
|   </el-dialog> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { | ||||
|   listCustomer, | ||||
| } from "@/api/custom/customer"; | ||||
|  | ||||
|  | ||||
| export default { | ||||
|   name: "selectCustomer", | ||||
|   components: { | ||||
|  | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       // 遮罩层 | ||||
|       loading: true, | ||||
|       // 选中数组 | ||||
|       ids: [], | ||||
|       // 选择名字数组 | ||||
|       names:[], | ||||
|       // 非单个禁用 | ||||
|       single: true, | ||||
|       // 非多个禁用 | ||||
|       multiple: true, | ||||
|       // 显示搜索条件 | ||||
|       showSearch: true, | ||||
|       // 总条数 | ||||
|       total: 0, | ||||
|       // 客户档案表格数据 | ||||
|       customerCenterList: [], | ||||
|       // 弹出层标题 | ||||
|       title: "", | ||||
|       // 是否显示弹出层 | ||||
|       open: false, | ||||
|       // 查询参数 | ||||
|       queryParams: { | ||||
|         pageNum: 1, | ||||
|         pageSize: 5, | ||||
|         name: null, | ||||
|         phone: null | ||||
|       } | ||||
|     }; | ||||
|   }, | ||||
|   created() { | ||||
|     this.getList(); | ||||
|   }, | ||||
|   computed: { | ||||
|   }, | ||||
|   methods: { | ||||
|     showDialog(title) { | ||||
|       this.title = title ? title : "选择客户"; | ||||
|       this.open = true; | ||||
|     }, | ||||
|     /** 查询客户档案列表 */ | ||||
|     getList() { | ||||
|       this.loading = true; | ||||
|       listCustomer(this.queryParams).then((response) => { | ||||
|         this.customerCenterList = response.rows; | ||||
|         this.total = response.total; | ||||
|         this.loading = false; | ||||
|       }); | ||||
|     }, | ||||
|     // 取消按钮 | ||||
|     cancel() { | ||||
|       this.open = false; | ||||
|       this.$refs.customerTable.clearSelection(); | ||||
|     }, | ||||
|     /** 搜索按钮操作 */ | ||||
|     handleQuery() { | ||||
|       this.queryParams.pageNum = 1; | ||||
|       this.getList(); | ||||
|     }, | ||||
|     /** 重置按钮操作 */ | ||||
|     resetQuery() { | ||||
|       this.resetForm("queryForm"); | ||||
|       this.handleQuery(); | ||||
|     }, | ||||
|     // 多选框选中数据 | ||||
|     handleSelectionChange(selection) { | ||||
|       this.ids = selection.map((item) => item.id); | ||||
|       this.names = selection.map((item) => item.name); | ||||
|       this.single = selection.length !== 1; | ||||
|       this.multiple = !selection.length; | ||||
|     }, | ||||
|     /** 选择用户操作 */ | ||||
|     handleSelect() { | ||||
|       const id = this.ids[0]; | ||||
|       const name = this.names[0]; | ||||
|       this.cancel(); | ||||
|       this.$emit('dealCustomerId', id, name); | ||||
|     }, | ||||
|  | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
							
								
								
									
										73
									
								
								stdiet-ui/src/components/FileDownload/MuchFileDown.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								stdiet-ui/src/components/FileDownload/MuchFileDown.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,73 @@ | ||||
| <template> | ||||
|   <!-- 多文件下载对话框 --> | ||||
|   <el-dialog :title="title" :visible.sync="open" @closed="cancel" width="600px" append-to-body> | ||||
|   <div class="app-container"> | ||||
|  | ||||
|     <el-table v-loading="loading" :data="fileList"> | ||||
|       <el-table-column label="文件名" align="center" prop="fileName" /> | ||||
|       <el-table-column label="上传时间" align="center" prop="createTime" /> | ||||
|       <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||
|         <template slot-scope="scope"> | ||||
|           <el-button | ||||
|             size="mini" | ||||
|             type="text" | ||||
|             icon="el-icon-download" | ||||
|             @click="" | ||||
|           >下载</el-button> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|     </el-table> | ||||
|  | ||||
|   </div> | ||||
|     <div slot="footer" class="dialog-footer"> | ||||
|       <el-button @click="cancel">取 消</el-button> | ||||
|     </div> | ||||
|   </el-dialog> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { downCaseFile } from "@/api/custom/customerCase"; | ||||
|  | ||||
| export default { | ||||
|   name: "MuchFileDown", | ||||
|   components: { | ||||
|  | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       // 遮罩层 | ||||
|       loading: true, | ||||
|       // 弹出层标题 | ||||
|       title: "", | ||||
|       // 是否显示弹出层 | ||||
|       open: false, | ||||
|       //案例id | ||||
|       caseId: null, | ||||
|       //文件列表 | ||||
|       fileList: [] | ||||
|     }; | ||||
|   }, | ||||
|   created() { | ||||
|  | ||||
|   }, | ||||
|   computed: { | ||||
|   }, | ||||
|   methods: { | ||||
|     showDialog(title, fileList) { | ||||
|       this.title = title ? title : "文件列表"; | ||||
|       this.fileList = fileList; | ||||
|       this.loading = false; | ||||
|       this.open = true; | ||||
|     }, | ||||
|     // 取消按钮 | ||||
|     cancel() { | ||||
|       this.open = false; | ||||
|       this.caseId = null; | ||||
|       this.fileList = []; | ||||
|     }, | ||||
|     downloadFile(file){ | ||||
|       downCaseFile(file); | ||||
|     } | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
							
								
								
									
										126
									
								
								stdiet-ui/src/components/FileUpload/DragUpload.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								stdiet-ui/src/components/FileUpload/DragUpload.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,126 @@ | ||||
| <template> | ||||
|   <el-upload class="upload-demo" | ||||
|              ref="upload" | ||||
|              drag | ||||
|              :headers="upload.headers" | ||||
|              :action="upload.url" | ||||
|              :limit="upload.limit" | ||||
|              :disabled="upload.isUploading" | ||||
|              :file-list="upload.fileList" | ||||
|              :multiple="upload.multiple" | ||||
|              :on-change="handleFileChange" | ||||
|              :on-exceed="handleFileexceed" | ||||
|              :on-progress="handleFileUploadProgress" | ||||
|              :on-success="handleFileSuccess" | ||||
|              :on-error="handleFileFail" | ||||
|              :data="upload.data" | ||||
|              :auto-upload="false"> | ||||
|     <i class="el-icon-upload"></i> | ||||
|     <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> | ||||
|     <div class="el-upload__tip" slot="tip">每个案例最多上传5个文件,且每个文件不超过50M</div> | ||||
|   </el-upload> | ||||
| </template> | ||||
| <script> | ||||
|   import { getToken } from '@/utils/auth' | ||||
| export default { | ||||
|   name: "DragUpload", | ||||
|   components: { | ||||
|  | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       upload: { | ||||
|         // 是否禁用上传 | ||||
|         isUploading: false, | ||||
|         // 上传的地址 | ||||
|         url: process.env.VUE_APP_BASE_API + "/custom/customerCase/uploadCaseFile", | ||||
|         // 设置上传的请求头部 | ||||
|         headers: {Authorization: 'Bearer ' + getToken()}, | ||||
|         // 其他需要携带的数据 | ||||
|         data:{}, | ||||
|         //文件列表 | ||||
|         fileList:[], | ||||
|         //同时上传文件上限 | ||||
|         limit: 5, | ||||
|         //每个文件大小 | ||||
|         fileSize: 1024 * 1024 * 50, | ||||
|         //是否支持同时选择多张 | ||||
|         multiple: true | ||||
|       }, | ||||
|       uploadResult:{ | ||||
|         fileUrl:[], | ||||
|         fileName:[] | ||||
|       } | ||||
|     }; | ||||
|   }, | ||||
|   methods: { | ||||
|     uploadFile(){ | ||||
|       if(this.upload.fileList.length > 0 && this.uploadResult.fileUrl.length != this.upload.fileList.length){ | ||||
|         this.$refs.upload.submit(); | ||||
|       }else{ | ||||
|         this.$emit('callbackMethod', this.uploadResult); | ||||
|       } | ||||
|     }, | ||||
|     uploadReset(){ | ||||
|       this.upload.fileList = []; | ||||
|       this.uploadResult["fileUrl"] = []; | ||||
|       this.uploadResult["fileName"] = []; | ||||
|     }, | ||||
|     //监控上传文件列表 | ||||
|     handleFileChange(file, fileList) { | ||||
|       let sizeFlag = file.size > this.upload.fileSize; | ||||
|       if (sizeFlag) { | ||||
|         this.$message({ | ||||
|           message: "当前文件过大", | ||||
|           type: "warning", | ||||
|         }); | ||||
|         fileList.pop(); | ||||
|       } | ||||
|       this.upload.fileList = fileList; | ||||
|     }, | ||||
|     // 文件数量超过限度 | ||||
|     handleFileexceed(file, fileList){ | ||||
|       this.$message({ | ||||
|         message: "最多可上传"+ this.upload.limit +"份文件", | ||||
|         type: "warning", | ||||
|       }); | ||||
|     }, | ||||
|     // 文件上传中处理 | ||||
|     handleFileUploadProgress(event, file, fileList) { | ||||
|       //this.upload.isUploading = true; | ||||
|     }, | ||||
|     // 文件上传成功处理 | ||||
|     handleFileSuccess(response, file, fileList) { | ||||
|       if(response != null && response.code === 200){ | ||||
|         this.uploadResult.fileUrl.push(response.fileUrl); | ||||
|         this.uploadResult.fileName.push(response.fileName); | ||||
|         if(this.uploadResult.fileUrl.length === this.upload.fileList.length){ | ||||
|           //文件全部上传成功,则调用回调方法 | ||||
|           this.$emit('callbackMethod', this.uploadResult); | ||||
|         } | ||||
|       }else{ | ||||
|         this.upload.fileList = fileList.pop(); | ||||
|         this.$message.error('文件上传失败,请检查文件格式'); | ||||
|       } | ||||
|     }, | ||||
|     // 文件上传失败处理 | ||||
|     handleFileFail(err, file, fileList){ | ||||
|       this.$message.error('文件上传失败,请检查文件格式'); | ||||
|       this.upload.fileList = fileList.pop(); | ||||
|     } | ||||
|   }, | ||||
|   props: { | ||||
|   }, | ||||
|   created() { | ||||
|  | ||||
|   }, | ||||
|  | ||||
| }; | ||||
| </script> | ||||
|  | ||||
| <style scoped> | ||||
|  | ||||
|  | ||||
|  | ||||
| </style> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user