案例管理优化
This commit is contained in:
		| @@ -57,6 +57,7 @@ public class SysCustomerCaseController extends BaseController | |||||||
|     public TableDataInfo list(SysCustomerCase sysCustomerCase) |     public TableDataInfo list(SysCustomerCase sysCustomerCase) | ||||||
|     { |     { | ||||||
|         startPage(); |         startPage(); | ||||||
|  |         sysCustomerCase.setKeywordArray(StringUtils.isNotEmpty(sysCustomerCase.getKeyword()) ? sysCustomerCase.getKeyword().split(",") : null); | ||||||
|         List<SysCustomerCase> list = sysCustomerCaseService.selectSysCustomerCaseList(sysCustomerCase); |         List<SysCustomerCase> list = sysCustomerCaseService.selectSysCustomerCaseList(sysCustomerCase); | ||||||
|         return getDataTable(list); |         return getDataTable(list); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -28,6 +28,8 @@ public class SysCustomerCase extends BaseEntity | |||||||
|     @Excel(name = "关键词") |     @Excel(name = "关键词") | ||||||
|     private String keyword; |     private String keyword; | ||||||
|  |  | ||||||
|  |     private String[] keywordArray; | ||||||
|  |  | ||||||
|     /** 案例所属客户ID */ |     /** 案例所属客户ID */ | ||||||
|     private Long customerId; |     private Long customerId; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -23,16 +23,30 @@ | |||||||
|         select id, name, keyword, remark, customer_id, create_time from sys_customer_case |         select id, name, keyword, remark, customer_id, create_time from sys_customer_case | ||||||
|     </sql> |     </sql> | ||||||
|  |  | ||||||
|  |     <sql id="searchKey"> | ||||||
|  |         <if test="keywordArray != null"> | ||||||
|  |             <trim prefix="AND (" suffix=")" suffixOverrides="or"> | ||||||
|  |                 <foreach collection="keywordArray"  separator="or" item="typeArray" index="i"> | ||||||
|  |                     ( scc.keyword like concat('%', #{typeArray}, '%') or scc.name like concat('%', #{typeArray}, '%') or scc.remark like concat('%', #{typeArray}, '%') ) | ||||||
|  |                 </foreach> | ||||||
|  |             </trim> | ||||||
|  |         </if> | ||||||
|  |     </sql> | ||||||
|  |  | ||||||
|     <select id="selectSysCustomerCaseList" parameterType="SysCustomerCase" resultMap="SysCustomerCaseResult"> |     <select id="selectSysCustomerCaseList" parameterType="SysCustomerCase" resultMap="SysCustomerCaseResult"> | ||||||
|         select scc.id, scc.name, scc.keyword, scc.remark, scc.customer_id, scc.create_time,sc.name as customer_name from sys_customer_case scc |         select scc.id, scc.name, scc.keyword, scc.remark, scc.customer_id, scc.create_time,sc.name as customer_name from sys_customer_case scc | ||||||
|         left join sys_customer sc on sc.id = scc.customer_id and sc.del_flag = 0 |         left join sys_customer sc on sc.id = scc.customer_id and sc.del_flag = 0 | ||||||
|         where scc.del_flag = 0 |         where scc.del_flag = 0 | ||||||
|         <if test="name != null  and name != ''"> |         <!--<if test="name != null  and name != ''"> | ||||||
|             and (scc.name like concat('%', #{name}, '%') OR scc.keyword like concat('%', #{name}, '%') OR scc.remark like concat('%', #{name}, '%')) |             and (scc.name like concat('%', #{name}, '%') OR scc.remark like concat('%', #{name}, '%')) | ||||||
|         </if> |         </if>--> | ||||||
|  |         <include refid="searchKey"> | ||||||
|  |             <property name="keywordArray" value="#{keywordArray}"/> | ||||||
|  |         </include> | ||||||
|         <if test="customerName != null and customerName != ''"> |         <if test="customerName != null and customerName != ''"> | ||||||
|             and sc.name like concat('%', #{customerName}, '%') |             and sc.name like concat('%', #{customerName}, '%') | ||||||
|         </if> |         </if> | ||||||
|  |         OR scc.keyword like concat('%', #{name}, '%') | ||||||
|         order by id desc |         order by id desc | ||||||
|     </select> |     </select> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -132,7 +132,7 @@ export default { | |||||||
|       downSigleFile(file.downUrl, file.fileName); |       downSigleFile(file.downUrl, file.fileName); | ||||||
|     }, |     }, | ||||||
|     isImage(name){ |     isImage(name){ | ||||||
|       var idx = name.indexOf('.'); |       var idx = name.lastIndexOf("."); | ||||||
|       if (idx === -1) { |       if (idx === -1) { | ||||||
|         return false; |         return false; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|   <div> |   <div> | ||||||
|     <div v-for="(item, index) in oldCaseFileList"> |     <div v-for="(item, index) in oldCaseFileList"> | ||||||
|       <span style="margin-right: 10px;"> |       <span style="margin-right: 10px;"> | ||||||
|         {{item.fileName ? (item.fileName.substring(0,15)+"..."): ""}} |         {{item.fileName.length > 15 ? (item.fileName.substring(0,15)+"...") : item.fileName}} | ||||||
|       </span> |       </span> | ||||||
|       <el-button style="margin-left: 10px;" type="danger" size="small" @click="removeOldFile(index)">移除该文件</el-button> |       <el-button style="margin-left: 10px;" type="danger" size="small" @click="removeOldFile(index)">移除该文件</el-button> | ||||||
|     </div> |     </div> | ||||||
|   | |||||||
| @@ -1,14 +1,32 @@ | |||||||
| <template> | <template> | ||||||
|   <div class="app-container"> |   <div class="app-container"> | ||||||
|     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> |     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> | ||||||
|       <el-form-item label="案例信息" prop="name"> |       <!--<el-form-item label="案例信息" prop="name"> | ||||||
|         <el-input |         <el-input | ||||||
|           v-model.trim="queryParams.name" |           v-model.trim="queryParams.name" | ||||||
|           placeholder="请输入案例名称或关键字" |           placeholder="请输入案例名称或备注" | ||||||
|           clearable |           clearable | ||||||
|           size="small" |           size="small" | ||||||
|         /> |         /> | ||||||
|  |       </el-form-item>--> | ||||||
|  |       <el-form-item label="案例信息" prop="name"> | ||||||
|  |         <el-select | ||||||
|  |           v-model="keywordArray" | ||||||
|  |           multiple | ||||||
|  |           filterable | ||||||
|  |           allow-create | ||||||
|  |           clearable | ||||||
|  |           default-first-option | ||||||
|  |           placeholder="关键词搜索" style="width: 100%;"> | ||||||
|  |           <el-option | ||||||
|  |             v-for="dict in caseKeyOptions" | ||||||
|  |             :key="dict.dictValue" | ||||||
|  |             :label="dict.dictLabel" | ||||||
|  |             :value="dict.dictValue"> | ||||||
|  |           </el-option> | ||||||
|  |         </el-select> | ||||||
|       </el-form-item> |       </el-form-item> | ||||||
|  |  | ||||||
|       <el-form-item label="客户姓名" prop="customerName"> |       <el-form-item label="客户姓名" prop="customerName"> | ||||||
|         <el-input |         <el-input | ||||||
|           v-model.trim="queryParams.customerName" |           v-model.trim="queryParams.customerName" | ||||||
| @@ -149,9 +167,16 @@ | |||||||
|             v-model="form.keywordArray" |             v-model="form.keywordArray" | ||||||
|             multiple |             multiple | ||||||
|             filterable |             filterable | ||||||
|  |             clearable | ||||||
|             allow-create |             allow-create | ||||||
|             default-first-option |             default-first-option | ||||||
|             placeholder="请创建案例关键词,按回车创建,最多20个" style="width: 100%;"> |             placeholder="请创建案例关键词,按回车创建,最多20个" style="width: 100%;"> | ||||||
|  |             <el-option | ||||||
|  |               v-for="dict in caseKeyOptions" | ||||||
|  |               :key="dict.dictValue" | ||||||
|  |               :label="dict.dictLabel" | ||||||
|  |               :value="dict.dictValue"> | ||||||
|  |             </el-option> | ||||||
|           </el-select> |           </el-select> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
|         <el-form-item label="案例备注" prop="remark"> |         <el-form-item label="案例备注" prop="remark"> | ||||||
| @@ -222,6 +247,7 @@ | |||||||
|           pageNum: 1, |           pageNum: 1, | ||||||
|           pageSize: 10, |           pageSize: 10, | ||||||
|           name: null, |           name: null, | ||||||
|  |           keyword: null, | ||||||
|           customerName: null |           customerName: null | ||||||
|         }, |         }, | ||||||
|         // 表单参数 |         // 表单参数 | ||||||
| @@ -237,7 +263,9 @@ | |||||||
|             { required: true, message: "案例关键词不能为空", trigger: "blur" }, |             { required: true, message: "案例关键词不能为空", trigger: "blur" }, | ||||||
|           ], |           ], | ||||||
|         }, |         }, | ||||||
|         submitFlag: false |         keywordArray:[], | ||||||
|  |         submitFlag: false, | ||||||
|  |         caseKeyOptions: [], | ||||||
|       }; |       }; | ||||||
|     }, |     }, | ||||||
|     components: { |     components: { | ||||||
| @@ -250,11 +278,15 @@ | |||||||
|     }, |     }, | ||||||
|     created() { |     created() { | ||||||
|       this.getList(); |       this.getList(); | ||||||
|  |       this.getDicts("case_key").then((response) => { | ||||||
|  |         this.caseKeyOptions = response.data; | ||||||
|  |       }); | ||||||
|     }, |     }, | ||||||
|     methods: { |     methods: { | ||||||
|       /** 查询客户案例管理列表 */ |       /** 查询客户案例管理列表 */ | ||||||
|       getList() { |       getList() { | ||||||
|         this.loading = true; |         this.loading = true; | ||||||
|  |         this.queryParams.keyword = this.keywordArray.join(","); | ||||||
|         listCustomerCase(this.queryParams).then(response => { |         listCustomerCase(this.queryParams).then(response => { | ||||||
|           this.customerCaseList = response.rows; |           this.customerCaseList = response.rows; | ||||||
|           this.total = response.total; |           this.total = response.total; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user