积分管理
This commit is contained in:
		| @@ -34,7 +34,7 @@ | |||||||
|       <template #content> |       <template #content> | ||||||
|         <ai-search-bar> |         <ai-search-bar> | ||||||
|           <template #left> |           <template #left> | ||||||
|             <el-select size="small" style="width: 200px;margin-left: 16px;" v-model="search.girdId" placeholder="类型" clearable |             <el-select size="small" style="width: 200px;" v-model="search.girdId" placeholder="类型" clearable | ||||||
|                       @change="getListInit()"> |                       @change="getListInit()"> | ||||||
|               <el-option |               <el-option | ||||||
|                   v-for="(item,i) in girdList" |                   v-for="(item,i) in girdList" | ||||||
|   | |||||||
| @@ -5,21 +5,12 @@ | |||||||
|         <ai-search-bar> |         <ai-search-bar> | ||||||
|           <template #left> |           <template #left> | ||||||
|             <el-button type="primary" size="small" icon="iconfont iconAdd" @click="dialog = true">批量调整积分</el-button> |             <el-button type="primary" size="small" icon="iconfont iconAdd" @click="dialog = true">批量调整积分</el-button> | ||||||
|             <el-button type="primary" size="small" icon="iconfont iconAdd" @click="toDetail('')">跳转详情</el-button> |             <el-cascader ref="cascader1" clearable v-model="search.girdId" :options="girdOptions" placeholder="所属网格" size="small"  | ||||||
|             <el-select size="small" style="width: 200px;" v-model="search.girdId" placeholder="所属网格" clearable |               :props="defaultProps" :show-all-levels="false" @change="gridChange"></el-cascader> | ||||||
|                       @change="getListInit()"> |  | ||||||
|               <el-option |  | ||||||
|                   v-for="(item,i) in girdList" |  | ||||||
|                   :key="i" |  | ||||||
|                   :label="item.girdName" |  | ||||||
|                   :value="item.id" |  | ||||||
|               > |  | ||||||
|               </el-option> |  | ||||||
|             </el-select> |  | ||||||
|           </template> |           </template> | ||||||
|           <template #right> |           <template #right> | ||||||
|             <el-input size="small" placeholder="请输入居民名称或真实姓名" v-model="search.name" clearable |             <el-input size="small" placeholder="请输入居民名称或真实姓名" v-model="search.userName" clearable | ||||||
|               @clear="page.current = 1, search.name = '', getTableData()" suffix-icon="iconfont iconSearch" |               @clear="page.current = 1, search.userName = '', getTableData()" suffix-icon="iconfont iconSearch" | ||||||
|               v-throttle="() => {(page.current = 1), getTableData();}"/> |               v-throttle="() => {(page.current = 1), getTableData();}"/> | ||||||
|             <ai-download :instance="instance" url="" :params="search" fileName="网格员积分" |             <ai-download :instance="instance" url="" :params="search" fileName="网格员积分" | ||||||
|                          :disabled="tableData.length == 0"> |                          :disabled="tableData.length == 0"> | ||||||
| @@ -32,7 +23,7 @@ | |||||||
|           <el-table-column slot="options" label="操作"  align="center"> |           <el-table-column slot="options" label="操作"  align="center"> | ||||||
|             <template slot-scope="{ row }"> |             <template slot-scope="{ row }"> | ||||||
|               <el-button type="text" @click="dialog = true">调整积分</el-button> |               <el-button type="text" @click="dialog = true">调整积分</el-button> | ||||||
|               <el-button type="text" @click="toAdd(row.id)">详情</el-button> |               <el-button type="text" @click="toDetail(row.id)">详情</el-button> | ||||||
|             </template> |             </template> | ||||||
|           </el-table-column> |           </el-table-column> | ||||||
|         </ai-table> |         </ai-table> | ||||||
| @@ -48,8 +39,8 @@ | |||||||
|       <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |       <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||||||
|         <el-form-item label="选择人员" prop="residentId"> |         <el-form-item label="选择人员" prop="residentId"> | ||||||
|           <ai-person-select :instance="instance" :customClicker="true" |           <ai-person-select :instance="instance" :customClicker="true" | ||||||
|                             :url="'/app/appresident/list?areaId=' + user.info.areaId" |                             :url="'/app/appgirdmemberinfo/list?size=10'" | ||||||
|                             :isMultiple="false" dialogTitle="选择" @selectPerson="selectPerson"> |                             :isMultiple="true" dialogTitle="选择" @selectPerson="selectPerson"> | ||||||
|             <template name="option" v-slot:option="{ item }"> |             <template name="option" v-slot:option="{ item }"> | ||||||
|               <span class="iconfont iconProlife">{{ item.name }}</span> |               <span class="iconfont iconProlife">{{ item.name }}</span> | ||||||
|               <ai-id mode="show" :show-eyes="false" :value="item.idNumber"/> |               <ai-id mode="show" :show-eyes="false" :value="item.idNumber"/> | ||||||
| @@ -61,17 +52,13 @@ | |||||||
|                     maxlength="100"></el-input> |                     maxlength="100"></el-input> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
|         <el-form-item label="上传凭证"> |         <el-form-item label="上传凭证"> | ||||||
|           <el-row> |           <ai-uploader :instance="instance" fileType="file" v-model="form.enclosure" :limit="1"></ai-uploader> | ||||||
|             <el-radio v-model="radio" label="1">图片</el-radio> |  | ||||||
|             <el-radio v-model="radio" label="2">附件</el-radio> |  | ||||||
|           </el-row> |  | ||||||
|           <ai-uploader :instance="instance" isWechat v-model="form.files" :limit="1" url="/app/wxcp/upload/uploadFile?type=image"></ai-uploader> |  | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
|         <el-form-item label="类型" prop="integralCalcType"> |         <el-form-item label="类型" prop="integralCalcType"> | ||||||
|           <!-- <ai-select v-model="form.integralCalcType" :selectList="dict.getDict('integralCalcType')"/> --> |           <ai-select v-model="form.integralCalcType" :selectList="dict.getDict('integralCalcType')"/> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
|         <el-form-item label="积分" prop="changeIntegral"> |         <el-form-item label="积分" prop="integral"> | ||||||
|           <el-input v-model.trim="form.changeIntegral" placeholder="请输入正数" size="small"></el-input> |           <el-input v-model.trim="form.integral" placeholder="请输入正数" size="small"></el-input> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
|       </el-form> |       </el-form> | ||||||
|     </ai-dialog> |     </ai-dialog> | ||||||
| @@ -92,8 +79,7 @@ export default { | |||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|       search: { |       search: { | ||||||
|         current: 1, |         userName: '', | ||||||
|         name: '', |  | ||||||
|         girdId: '', |         girdId: '', | ||||||
|       }, |       }, | ||||||
|       tableData: [], |       tableData: [], | ||||||
| @@ -101,24 +87,40 @@ export default { | |||||||
|       girdList: [], |       girdList: [], | ||||||
|        |        | ||||||
|       form: { |       form: { | ||||||
|  |         ids: [], | ||||||
|  |         eventDesc: "",   | ||||||
|  |         enclosure: [],   // 附件 | ||||||
|  |         integralCalcType: "", | ||||||
|  |         integral: 0, | ||||||
|       }, |       }, | ||||||
|       personList: [], |       personList: [], | ||||||
|       dialog: false, |       dialog: false, | ||||||
|       radio: '' |       girdOptions: [], | ||||||
|  |       defaultProps: { | ||||||
|  |         label: 'girdName', | ||||||
|  |         value: 'id', | ||||||
|  |         checkStrictly: true, | ||||||
|  |         expandTrigger: 'hover', | ||||||
|  |       }, | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   created() { |   created() { | ||||||
|     // this.$dict.load('integralCalcType') |     this.$dict.load('integralCalcType') | ||||||
|  |     this.getTableData() | ||||||
|  |     this.getGridList() | ||||||
|  |   }, | ||||||
|  |   watch: { | ||||||
|  |     gridChange() {} | ||||||
|   }, |   }, | ||||||
|   computed: { |   computed: { | ||||||
|     ...mapState(['user']), |     ...mapState(['user']), | ||||||
|     colConfigs() { |     colConfigs() { | ||||||
|       return [ |       return [ | ||||||
|         { prop: "", label: '姓名', align: "left",  }, |         { prop: "userName", label: '姓名', align: "left",  }, | ||||||
|         { prop: "", label: '所属网格', align: "center",  }, |         { prop: "girdName", label: '所属网格', align: "center",  }, | ||||||
|         { prop: "", label: '积分余额', align: "center", }, |         { prop: "integral", label: '积分余额', align: "center", }, | ||||||
|         { prop: "", label: '累计积分', align: "center", }, |         { prop: "totalIntegral", label: '累计积分', align: "center", }, | ||||||
|  |         { prop: "usedIntegral", label: '已用积分', align: "center", }, | ||||||
|         { slot: "options" }, |         { slot: "options" }, | ||||||
|       ] |       ] | ||||||
|     }, |     }, | ||||||
| @@ -127,26 +129,87 @@ export default { | |||||||
|         residentId: [{required: true, message: '请选择人员', trigger: 'blur'},], |         residentId: [{required: true, message: '请选择人员', trigger: 'blur'},], | ||||||
|         eventDesc: [{required: true, message: '请输入调整说明', trigger: 'blur'},], |         eventDesc: [{required: true, message: '请输入调整说明', trigger: 'blur'},], | ||||||
|         integralCalcType: [{required: true, message: '请选择类型', trigger: 'change'},], |         integralCalcType: [{required: true, message: '请选择类型', trigger: 'change'},], | ||||||
|         changeIntegral: [{required: true, validator: (r, v, cb) => v > 0 ? cb() : cb("请输入正数")}], |         integral: [{required: true, validator: (r, v, cb) => v > 0 ? cb() : cb("请输入正数")}], | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|     getTableData() {}, |     getTableData() { | ||||||
|     getListInit() { |       this.instance.post(`/app/appintegraluser/integralManager`,null,{ | ||||||
|       this.search.current = 1 |         params: { | ||||||
|       this.getList() |           ...this.page, | ||||||
|  |           ...this.search, | ||||||
|  |         } | ||||||
|  |       }).then(res => { | ||||||
|  |         if(res?.data) { | ||||||
|  |           this.tableData = res.data.records | ||||||
|  |           this.page.total = res.data.total | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     selectPerson(val) { |     selectPerson(val) { | ||||||
|       if (val) { |       this.personList = val | ||||||
|         this.form.residentId = val.id |       this.form.ids = this.personList.map(e => e.id) | ||||||
|         this.personList = [{...val}] |       // if (val) { | ||||||
|       } else { |       //   this.form.residentId = val.id | ||||||
|         this.form.residentId = "" |       //   this.personList = [{...val}] | ||||||
|         this.personList = [] |       // } else { | ||||||
|       } |       //   this.form.residentId = "" | ||||||
|  |       //   this.personList = [] | ||||||
|  |       // } | ||||||
|     }, |     }, | ||||||
|     onConfirm() {}, |     getGridList() { | ||||||
|  |       this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => { | ||||||
|  |         if (res.code == 0) { | ||||||
|  |           this.girdOptions = this.toTree(res.data) | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     // 转树形结构 | ||||||
|  |     toTree(data) { | ||||||
|  |       let result = []; | ||||||
|  |       if (!Array.isArray(data)) { | ||||||
|  |         return result | ||||||
|  |       } | ||||||
|  |       let map = {}; | ||||||
|  |       data.forEach(item => { | ||||||
|  |         map[item.id] = item; | ||||||
|  |       }); | ||||||
|  |       data.forEach(item => { | ||||||
|  |         let parent = map[item.parentGirdId]; | ||||||
|  |         if (parent) { | ||||||
|  |           (parent.children || (parent.children = [])).push(item); | ||||||
|  |         } else { | ||||||
|  |           result.push(item); | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |       return result; | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     gridChange(val) { | ||||||
|  |       this.search.girdId = val?.[val.length - 1] | ||||||
|  |       this.$refs.cascader1.dropDownVisible = false; | ||||||
|  |       this.getTableData() | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     onConfirm() { | ||||||
|  |       this.instance.post(`/app/appintegraluser/changeIntegral`,{ | ||||||
|  |         ids: this.form.ids, | ||||||
|  |         eventDesc: this.form.eventDesc,   | ||||||
|  |         enclosure: this.form.enclosure?.[0].url,   // 附件 | ||||||
|  |         integralCalcType: this.form.integralCalcType, | ||||||
|  |         integral: this.form.integral, | ||||||
|  |       }).then(res => { | ||||||
|  |         if(res.code == 0) { | ||||||
|  |           this.$message.success('调整积分成功') | ||||||
|  |           this.getTableData() | ||||||
|  |           this.dialog = false | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |  | ||||||
|     toDetail(id) { |     toDetail(id) { | ||||||
|       this.$emit('change', { |       this.$emit('change', { | ||||||
|         type: 'gridScoreDetail', |         type: 'gridScoreDetail', | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user