积分规则
This commit is contained in:
		| @@ -5,7 +5,7 @@ | ||||
|       <template slot="content"> | ||||
|         <ai-search-bar> | ||||
|           <template #left> | ||||
|             <el-button type="primary" icon="iconfont iconAdd" @click="dialog = true"> 添加</el-button> | ||||
|             <el-button type="primary" icon="iconfont iconAdd" @click="add"> 添加</el-button> | ||||
|             <el-cascader size="small" v-model="systemRuleIdList" :options="rulesOps" placeholder="请选择事件/类型" clearable :props="rulesProps" | ||||
|                          @change="handleTypeSearch" ref="eventTypeSearch"/> | ||||
|             <ai-select v-model="search.status" @change="(page.current = 1), getList()" placeholder="请选择状态" :selectList="$dict.getDict('integralRuleStatus')"> | ||||
| @@ -47,7 +47,7 @@ | ||||
|           </el-form-item> | ||||
|  | ||||
|           <el-form-item label="规则"> | ||||
|             <div>常规</div> | ||||
|             <div>{{form.systemRuleId != '自定义' ? form.ruleType == 1 ? '阶梯' : '常规' : '常规'}}</div> | ||||
|           </el-form-item> | ||||
|  | ||||
|           <!-- <el-form-item label="规则" prop="ruleType" v-if="form.ruleType>-1" required> | ||||
| @@ -85,15 +85,42 @@ | ||||
|             <el-input type="number" placeholder="请输入,周期范围内,不填写表示不限制" v-model.number="form.numberLimit" clearable :disabled="isOneAndTen"/> | ||||
|           </el-form-item> | ||||
|  | ||||
|           <el-form-item label="工单处理要求时长" prop="workHoursLimit" v-if="isWorkOrder"> | ||||
|             <el-input-number v-model="form.workHoursLimit" :min="1" :max="100" label="工作日"></el-input-number> | ||||
|           </el-form-item> | ||||
|            | ||||
|  | ||||
|           <el-form-item label="积分分值" prop="integral"> | ||||
|           <el-form-item label="积分分值" prop="integral" v-if="!isWorkOrder"> | ||||
|             <el-input placeholder="请输入" v-model="form.integral" clearable/> | ||||
|           </el-form-item> | ||||
|  | ||||
|           <!-- 工单 --> | ||||
|           <el-form-item label="规则明细" prop="ladderRule" v-if="isWorkOrder"> | ||||
|             <el-row type="flex" justify="space-between"> | ||||
|               <div>从小到大顺序配置</div> | ||||
|               <el-button type="text" icon="iconfont iconAdd" @click="addIntegral">添加</el-button> | ||||
|             </el-row> | ||||
|             <el-table :data="form.ladderRuleList" size="mini" border stripe> | ||||
|               <el-table-column label="工作日区间" align="center" width="400"> | ||||
|                 <template slot-scope="{row}"> | ||||
|                   大于等于 | ||||
|                   <!-- <el-input-number class="tableInput" v-model="row.ge" :min="0" label="请输入" style="margin-right:8px;"></el-input-number> --> | ||||
|                   <el-input placeholder="请输入" v-model="row.ge" clearable  style="margin-right:8px;width:100px;" @keyup.native="row.ge=checkGe(row.ge)"/> | ||||
|                   小于 | ||||
|                   <el-input placeholder="请输入" v-model="row.lt" clearable @keyup.native="row.lt=checkGe(row.lt)" style="width:100px;"/> | ||||
|                   <!-- <el-input-number class="tableInput" v-model="row.lt" :min="0" label="请输入"></el-input-number> --> | ||||
|                 </template> | ||||
|               </el-table-column> | ||||
|               <el-table-column label="积分" align="center"> | ||||
|                 <template slot-scope="{row}"> | ||||
|                   <el-input class="tableInput" v-model="row.integral" clearable placeholder="请输入" type="number" | ||||
|                             @keyup.native="row.integral=checkIntegral(row.integral)"/> | ||||
|                 </template> | ||||
|               </el-table-column> | ||||
|               <el-table-column label="" align="center"> | ||||
|                 <template slot-scope="{ $index }"> | ||||
|                   <el-button type="text" @click="handleDeleteRule($index)">删除</el-button> | ||||
|                 </template> | ||||
|               </el-table-column> | ||||
|             </el-table> | ||||
|           </el-form-item> | ||||
|  | ||||
|           <el-form-item label="有效范围" prop="validRangeType" required> | ||||
|             <el-radio-group v-model="form.validRangeType"> | ||||
|               <el-radio label="0">全局</el-radio> | ||||
| @@ -150,7 +177,7 @@ export default { | ||||
|       } else { | ||||
|         callback(new Error('请输入积分分值')); | ||||
|       } | ||||
|     } | ||||
|     }; | ||||
|     return { | ||||
|       search: { | ||||
|         status: "", | ||||
| @@ -183,7 +210,6 @@ export default { | ||||
|             ); | ||||
|           }, | ||||
|         }, | ||||
|         {prop: "workHoursLimit", label: "工单处理要求时长", align: "center"}, | ||||
|         {slot: "integral", label: "积分分值", align: "center"}, | ||||
|         { | ||||
|           prop: "validRangeType", | ||||
| @@ -210,7 +236,7 @@ export default { | ||||
|         integral: "", | ||||
|         validRangeType: "0", | ||||
|         validRangeData: "", | ||||
|         workHoursLimit: 1 | ||||
|         ladderRuleList: [] | ||||
|       }, | ||||
|       formRules: { | ||||
|         systemRuleId: [ | ||||
| @@ -222,13 +248,13 @@ export default { | ||||
|         scoringCycle: [ | ||||
|           {required: true, message: "请选择周期范围", trigger: "change"}, | ||||
|         ], | ||||
|         workHoursLimit: [ | ||||
|           {required: true, message: "请输入工单处理要求时长", trigger: "change"}, | ||||
|         ], | ||||
|         integral: [{required: true, validator: validcode, trigger: "blur"},], | ||||
|         integral: [{required: true, validator: validcode, trigger: "blur"}], | ||||
|         validRangeType: [ | ||||
|           {required: true, message: "请选择有效范围", trigger: "change"}, | ||||
|         ], | ||||
|         ladderRuleList: [ | ||||
|           {required: true, message: "请输入积分值", trigger: "change"}, | ||||
|         ], | ||||
|       }, | ||||
|       rulesOps: [], | ||||
|       rulesProps: { | ||||
| @@ -252,12 +278,13 @@ export default { | ||||
|       girdNameList: [], | ||||
|       list: [], | ||||
|       isOneAndTen: false, | ||||
|       isWorkOrder: false | ||||
|       isWorkOrder: false, | ||||
|       typeList: [] | ||||
|     }; | ||||
|   }, | ||||
|   created() { | ||||
|     this.$dict.load("integralRuleStatus", "integralRuleRuleType", "integralRuleScoringCycle", | ||||
|         "integralRuleEvent", "integralRuleEventType").then(() => { | ||||
|         "integralRuleEvent", "integralRuleEventType", "qjEACondition").then(() => { | ||||
|       this.getList(); | ||||
|       this.getRulesList(); | ||||
|     }); | ||||
| @@ -304,6 +331,7 @@ export default { | ||||
|       this.isWorkOrder = false | ||||
|       if(row.parentRuleName == '工单处理') { | ||||
|         this.isWorkOrder = true | ||||
|         this.form.ladderRuleList = JSON.parse(this.form.ladderRule) | ||||
|       } | ||||
|     }, | ||||
|     remove(id) { | ||||
| @@ -334,10 +362,20 @@ export default { | ||||
|       }); | ||||
|     }, | ||||
|     onConfirm() { | ||||
|       var isWork = true | ||||
|       this.form.ladderRuleList.map((item) => { | ||||
|         if(!item.integral) { | ||||
|           isWork = false | ||||
|         } | ||||
|       }) | ||||
|       if(!isWork) { | ||||
|         return this.$message.error('请输入分值') | ||||
|       } | ||||
|       this.$refs.DialogForm.validate((valid) => { | ||||
|         if (valid) { | ||||
|           let formData = this.$copy(this.form); | ||||
|           // formData.ladderRule = JSON.stringify(formData.ladderRule) | ||||
|           formData.ladderRule = JSON.stringify(formData.ladderRuleList) | ||||
|           console.log(formData.ladderRule) | ||||
|           formData.integral = formData.integral || 0; | ||||
|           this.instance | ||||
|           .post(`/app/appintegralrule/addOrUpdate`, formData) | ||||
| @@ -347,10 +385,12 @@ export default { | ||||
|                   `${this.isEdit ? "编辑成功" : "添加成功"}` | ||||
|               ); | ||||
|               this.dialog = false; | ||||
|               this.isWorkOrder = false | ||||
|               this.getList(); | ||||
|               this.closed(); | ||||
|               this.girdInfoList = [] | ||||
|               this.girdNameList = [] | ||||
|                | ||||
|             } | ||||
|           }); | ||||
|         } else { | ||||
| @@ -358,6 +398,20 @@ export default { | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|     add() { | ||||
|       this.form = { | ||||
|         ruleType: "0", | ||||
|         systemRuleId: "", | ||||
|         ruleName: "", | ||||
|         scoringCycle: "", | ||||
|         numberLimit: "", | ||||
|         integral: "", | ||||
|         validRangeType: "0", | ||||
|         validRangeData: "", | ||||
|         ladderRuleList: [] | ||||
|       } | ||||
|       this.dialog = true | ||||
|     }, | ||||
|     handleTypeSearch(v) { | ||||
|       this.systemRuleIdList = v | ||||
|       this.search.systemRuleId = v?.[v.length - 1]; | ||||
| @@ -368,37 +422,52 @@ export default { | ||||
|     }, | ||||
|     handleTypeForm(v) { | ||||
|       console.log(v) | ||||
|       this.isWorkOrder = false | ||||
|       if (this.dialog) { | ||||
|         if(v[0] == '1' || v[0]== '10') { | ||||
|           this.form.scoringCycle = '0' | ||||
|           this.form.numberLimit = '1' | ||||
|           this.isOneAndTen = true | ||||
|           this.isWorkOrder = false | ||||
|           this.form.ladderRuleList = [] | ||||
|         } else if(v[0] == '20') { //工单处理 | ||||
|           this.isWorkOrder = true | ||||
|           this.form.ladderRuleList = [{ ge: null, lt: null, integral: null }] | ||||
|         } else { | ||||
|           this.form.scoringCycle = '' | ||||
|           this.form.numberLimit = '' | ||||
|           this.isOneAndTen = false | ||||
|           this.isWorkOrder = false | ||||
|           this.form.ladderRuleList = [] | ||||
|         } | ||||
|         this.form.systemRuleId = v?.[v.length - 1]; | ||||
|         if(v != '自定义') { | ||||
|           this.typeList.map((item) => { | ||||
|             if(item.id == v[1]) { | ||||
|               this.form.ruleType = item.ruleType | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     handleDelete(i) { | ||||
|       this.$confirm("是否要删除该规则?") | ||||
|       .then(() => { | ||||
|         this.form.ladderRule.splice(i, 1); | ||||
|         this.form.ladderRuleList.splice(i, 1); | ||||
|       }) | ||||
|       .catch(() => 0); | ||||
|     }, | ||||
|     checkIntegral(v) { | ||||
|       return /\.\d{2,}$/.test(v) ? Math.abs(v).toFixed(1) : Math.abs(v); | ||||
|       return /^\d+$/.test(v) ? Math.abs(v).toFixed(1) : Math.abs(v); | ||||
|     }, | ||||
|     checkGe(v) { | ||||
|       return /\.\d{2,}$/.test(v) ? v : Math.floor(v); | ||||
|     }, | ||||
|     getRulesList() { | ||||
|       this.instance | ||||
|       .post(`/app/appintegralsystemrule/list?current=1&size=3000`) | ||||
|       .then((res) => { | ||||
|         if (res?.data) { | ||||
|           this.typeList = res.data.records | ||||
|           this.rulesOps = this.toTree(res.data.records); | ||||
|           this.rulesOps.push({ | ||||
|             ruleName: "自定义", | ||||
| @@ -462,7 +531,15 @@ export default { | ||||
|       } else { | ||||
|         delete this.treeSelected[data.id] | ||||
|       } | ||||
|     } | ||||
|     }, | ||||
|     addIntegral() { | ||||
|       this.form.ladderRuleList?.push({ ge: null, lt: null, integral: null }) | ||||
|     }, | ||||
|     handleDeleteRule(i) { | ||||
|       this.$confirm("是否要删除该规则?").then(() => { | ||||
|         this.form.ladderRuleList.splice(i, 1) | ||||
|       }).catch(() => 0) | ||||
|     }, | ||||
|   }, | ||||
|   computed: { | ||||
|     isEdit() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user