积分整合

This commit is contained in:
aixianling
2022-05-13 17:06:55 +08:00
parent 5d656a9e65
commit aef1ebc8c9
3 changed files with 138 additions and 221 deletions

View File

@@ -7,7 +7,7 @@
<template slot="tabs"> <template slot="tabs">
<el-tabs v-model="currIndex"> <el-tabs v-model="currIndex">
<el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label"> <el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
<component :is="tab.comp" v-if="currIndex === String(i)" :bizType="tab.bizType" :ref="tab.name" <component :is="tab.comp" v-if="currIndex === String(i)" :ref="tab.name"
:areaId="areaId" :instance="instance" :dict="dict" :permissions="permissions"/> :areaId="areaId" :instance="instance" :dict="dict" :permissions="permissions"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@@ -23,61 +23,53 @@ import {mapState} from 'vuex'
import scoreChange from "./scoreChange"; import scoreChange from "./scoreChange";
export default { export default {
name: 'AppScoreManage', name: 'AppScoreManage',
label: "积分维护", label: "积分维护",
components: {pointsDeclaration, pointsDetails, pointsAppeal, scoreChange}, components: {pointsDeclaration, pointsDetails, pointsAppeal, scoreChange},
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
permissions: Function permissions: Function
}, },
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
tabs() { tabs() {
return [ return [
// { {
// label: "积分申报", label: "积分明细",
// name: "pointsDeclaration", name: "pointsDetails",
// comp: pointsDeclaration, comp: pointsDetails,
// permission: "app_apppartyfee_record", permission: "app_apppartyfee_statistics",
// bizType: '0' },
// }, {
// { label: "积分申诉", name: "pointsAppeal", comp: pointsAppeal, permission: "app_apppartyfee_config", bizType: '1'}, label: "积分调整",
{ name: "scoreChange",
label: "积分明细", comp: scoreChange,
name: "pointsDetails", permission: "",
comp: pointsDetails, },
permission: "app_apppartyfee_statistics", ]
bizType: '2' }
}, },
{ created() {
label: "积分调整", this.areaId = this.user.info.areaId
name: "scoreChange", this.dict.load("integralCalcType")
comp: scoreChange, },
permission: "", methods: {
}, changeArea() {
] this.$nextTick(() => {
} this.$refs[this.tabs[Number(this.currIndex)].name][0].getList()
}, })
created() { }
this.areaId = this.user.info.areaId },
}, data() {
methods: { return {
changeArea() { activeName: "pointsDeclaration",
this.$nextTick(() => { currIndex: '0',
this.$refs[this.tabs[Number(this.currIndex)].name][0].getList() areaId: ''
})
}
},
data() {
return {
activeName: "pointsDeclaration",
currIndex: '0',
areaId: ''
}
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -4,46 +4,40 @@
<template slot="content"> <template slot="content">
<ai-search-bar bottomBorder> <ai-search-bar bottomBorder>
<template slot="left"> <template slot="left">
<el-date-picker size="small" v-model="searchDotime" type="daterange" range-separator="至" @change="timeChange" <el-date-picker size="small" v-model="searchDotime" type="daterange" range-separator="至" @change="timeChange"
start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker> start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</template> </template>
<template slot="right"> <template slot="right">
<el-input <el-input
v-model="search.familyName" v-model="search.familyName"
class="search-input" class="search-input"
size="small" size="small"
placeholder="对象、户主、事件类型" placeholder="对象、户主、事件类型"
clearable clearable
v-throttle="() => {search.current = 1, getList()}" v-throttle="() => {search.current = 1, getList()}"
@clear="search.current = 1, getList()" @clear="search.current = 1, getList()"
suffix-icon="iconfont iconSearch" /> suffix-icon="iconfont iconSearch"/>
</template> </template>
</ai-search-bar> </ai-search-bar>
<ai-table <ai-table
:tableData="tableData" :tableData="tableData"
:col-configs="colConfigs" :col-configs="colConfigs"
:total="total" :total="total" :dict="dict"
ref="aitableex" :current.sync="search.current"
:current.sync="search.current" :size.sync="search.size"
:size.sync="search.size" @getList="getList">
@getList="getList"> <el-table-column slot="changeIntegral" label="积分" align="center">
<el-table-column slot="changeIntegral" label="积分" align= "center">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<span>{{row.changeIntegral > 0 ? '+' : ''}}{{row.changeIntegral}}</span> <span>{{ row.changeIntegral > 0 ? '+' : '' }}{{ row.changeIntegral }}</span>
</template>
</el-table-column>
<el-table-column slot="doType" label="类型" align= "center">
<template slot-scope="{ row }">
<span>{{ dict.getLabel('integralDetailType', row.bizType) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column slot="options" label="操作" align="center" fixed="right" width="120"> <el-table-column slot="options" label="操作" align="center" fixed="right" width="120">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<el-button <el-button
type="text" type="text"
title="详情" title="详情"
:disabled="!$permissions('app_appvillagerintegraldetail_detail')" :disabled="!$permissions('app_appvillagerintegraldetail_detail')"
@click="viewItem(row)"> @click="viewItem(row)">
详情 详情
</el-button> </el-button>
</template> </template>
@@ -51,31 +45,20 @@
</ai-table> </ai-table>
</template> </template>
</ai-list> </ai-list>
<ai-dialog <ai-dialog title="详情" :visible.sync="dialog" :customFooter="true" :destroyOnClose="true" width="720px">
title="详情" <ai-wrapper>
:visible.sync="dialog.visible" <ai-info-item label="户主:" :value="dialogInfo.familyName"/>
:customFooter="true" <ai-info-item label="对象:" :value="dialogInfo.residentName"/>
:destroyOnClose="true" <ai-info-item label="事件:" :value="dialogInfo.eventDesc" isLine/>
width="720px" <ai-info-item label="时间:" :value="dialogInfo.doTime" isLine/>
> <ai-info-item label="积分:">
<div class="form_content"> {{ dialogInfo.changeIntegral >= 0 ? '增加' : '减少' }}
<div class="form_info"> <span style="color:#26f" v-text="Math.abs(dialogInfo.changeIntegral)"/>
<span class="form_label">户主</span> </ai-info-item>
<span class="form_value">{{dialogInfo.familyName}}</span> <ai-info-item label="积分余额:" :value="dialogInfo.nowIntegral"/>
</div> </ai-wrapper>
<div class="form_info">
<span class="form_label">事项</span>
<span class="form_value">{{dialogInfo.ruleName}}</span>
</div>
<div class="form_flex form_info">
<div>
<span class="form_label">积分</span>
<span class="form_value">{{dialogInfo.changeIntegral >= 0 ? '增加' : '减少'}}<span style="color:#2266FF">{{Math.abs(dialogInfo.changeIntegral)}}</span></span>
</div>
</div>
</div>
<div class="dialog-footer" slot="footer"> <div class="dialog-footer" slot="footer">
<el-button @click="dialog.visible=false" size="medium">关闭</el-button> <el-button @click="dialog=false">关闭</el-button>
</div> </div>
</ai-dialog> </ai-dialog>
</section> </section>
@@ -88,7 +71,7 @@ export default {
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
areaId:String areaId: String
}, },
data() { data() {
@@ -103,88 +86,53 @@ export default {
}, },
total: 10, total: 10,
colConfigs: [ colConfigs: [
{ prop: "residentName", label: "对象", width:160 }, {prop: "residentName", label: "对象", width: 160},
{ prop: "familyName", label: "户主", align: "center", width:160 }, {prop: "familyName", label: "户主", align: "center", width: 160},
{ {prop: "eventDesc", label: "事件", "show-overflow-tooltip": true, width: 420},
prop: "ruleName", {prop: "doTime", label: "时间", width: 200},
label: "事件类型", {prop: "type", label: "类型", width: 100, dict: "integralDetailType"},
"show-overflow-tooltip": true, {slot: "changeIntegral", label: "积分", width: 100},
width:420 {slot: "options", label: "操作", align: "center"},
},
{
prop: "doTime",
label: "时间",
width:200
},
// {
// prop: "doType",
// label: "类型",
// align: "center",
// width: 100,
// render: (h, params) => {
// return h(
// "span",
// {
// class: "status-" + params.row.doType,
// },
// this.$dict.getLabel("integralIntegralType", params.row.doType)
// );
// },
// },
{ slot: "doType", label: "类型", width: 100},
{ slot: "changeIntegral", label: "积分", width: 100},
// {
// prop: "bizType",
// label: "途径",
// align: "center",
// width: 100,
// formart: (bizType) =>
// this.$dict.getLabel("integralDetailBizType", bizType) || '-',
// },
{ slot: "options", label: "操作", align: "center" },
], ],
tableData: [], tableData: [],
dialog: { dialog: false,
visible: false,
},
dialogInfo: {}, dialogInfo: {},
}; };
}, },
mounted() { mounted() {
this.$dict this.$dict
.load([ .load([
"integralDeclareDoType", "integralDeclareDoType",
"integralDetailType", "integralDetailType",
]) ])
.then(() => { .then(() => {
this.getList(); this.getList();
}); });
}, },
methods: { methods: {
getList() { getList() {
this.instance this.instance.post(`/app/appvillagerintegraldetail/list`, null, {
.post(`/app/appvillagerintegraldetail/list`, null, { params: {
params: { ...this.search,
...this.search, areaId: this.areaId,
areaId: this.areaId, },
}, })
}) .then((res) => {
.then((res) => { if (res.code == 0) {
if (res.code == 0) { this.tableData = res.data.records;
this.tableData = res.data.records; this.total = res.data.total;
this.total = res.data.total; }
} });
});
}, },
timeChange() { timeChange() {
if(this.searchDotime) { if (this.searchDotime) {
this.search.doTimeStart = this.searchDotime[0] this.search.doTimeStart = this.searchDotime[0]
this.search.doTimeEnd = this.searchDotime[1] this.search.doTimeEnd = this.searchDotime[1]
}else { } else {
this.search.doTimeStart = null this.search.doTimeStart = null
this.search.doTimeEnd = null this.search.doTimeEnd = null
} }
this.search.current = 1 this.search.current = 1
@@ -192,18 +140,17 @@ export default {
}, },
viewItem(row) { viewItem(row) {
this.dialog.visible = true this.dialog = true
this.instance.post(`/app/appvillagerintegraldetail/queryDetailById?id=${row.id}`, null, {}).then((res) => { this.instance.post(`/app/appvillagerintegraldetail/queryDetailById?id=${row.id}`, null, {}).then((res) => {
if (res.code == 0) { if (res?.data) {
this.dialogInfo = res.data this.dialogInfo = res.data
console.log(this.dialogInfo) }
} });
});
}, },
onReset() { onReset() {
this.search.current = 1 this.search.current = 1
this.search.doTimeStart = null this.search.doTimeStart = null
this.search.doTimeEnd = null this.search.doTimeEnd = null
this.search.familyName = '' this.search.familyName = ''
this.searchDotime = [] this.searchDotime = []
@@ -218,16 +165,20 @@ export default {
height: 100%; height: 100%;
background: #f3f6f9; background: #f3f6f9;
overflow: auto; overflow: auto;
.form_content { .form_content {
.form_flex { .form_flex {
display: flex; display: flex;
div { div {
flex: 1; flex: 1;
} }
} }
.form_info { .form_info {
margin-bottom: 8px; margin-bottom: 8px;
} }
.form_label { .form_label {
display: inline-block; display: inline-block;
color: #999; color: #999;
@@ -235,6 +186,7 @@ export default {
width: 70px; width: 70px;
text-align: right; text-align: right;
} }
.form_value { .form_value {
display: inline-block; display: inline-block;
color: #333; color: #333;
@@ -246,10 +198,12 @@ export default {
// } // }
} }
} }
.form_div { .form_div {
padding-top: 24px; padding-top: 24px;
border-top: 1px solid #eee; border-top: 1px solid #eee;
} }
.status-0 { .status-0 {
color: #FF4466; color: #FF4466;
} }

View File

@@ -14,7 +14,7 @@
<ai-table <ai-table
:tableData="tableData" :tableData="tableData"
:col-configs="colConfigs" :col-configs="colConfigs"
:total="page.total" :total="page.total" :dict="dict"
:current.sync="page.current" :current.sync="page.current"
:size.sync="page.size" :size.sync="page.size"
@getList="getList"> @getList="getList">
@@ -40,14 +40,11 @@
</ai-person-select> </ai-person-select>
</el-form-item> </el-form-item>
<el-form-item label="调整说明" prop="description"> <el-form-item label="调整说明" prop="description">
<el-input v-model.trim="form.description" placeholder="请输入..." type="textarea" :rows="4" show-word-limit <el-input v-model.trim="form.eventDesc" placeholder="请输入..." type="textarea" :rows="4" show-word-limit
maxlength="100"></el-input> maxlength="100"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="类型" prop="doType"> <el-form-item label="类型" prop="integralCalcType">
<el-radio-group v-model="form.doType"> <ai-select v-model="form.integralCalcType" :selectList="dict.getDict('integralCalcType')"/>
<el-radio label="0">加分</el-radio>
<el-radio label="1">减分</el-radio>
</el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="积分" prop="changeIntegral"> <el-form-item label="积分" prop="changeIntegral">
<el-input v-model.trim.num="form.changeIntegral" placeholder="请输入正整数" size="small"></el-input> <el-input v-model.trim.num="form.changeIntegral" placeholder="请输入正整数" size="small"></el-input>
@@ -86,38 +83,19 @@ export default {
rules() { rules() {
return { return {
residentId: [{required: true, message: '请选择人员', trigger: 'blur'},], residentId: [{required: true, message: '请选择人员', trigger: 'blur'},],
description: [{required: true, message: '请输入调整说明', trigger: 'blur'},], eventDesc: [{required: true, message: '请输入调整说明', trigger: 'blur'},],
doType: [{required: true, message: '请输入调整说明', trigger: 'change'},], integralCalcType: [{required: true, message: '请输入调整说明', trigger: 'change'},],
changeIntegral: [ changeIntegral: [{required: true, validator: (r, v, cb) => v > 0 ? cb() : cb("请输入正数")}],
{
required: true, validator: (rule, value, callback) => {
if (!/^[1-9]\d*$/.test(value)) {
callback(new Error('请输入正整数'))
} else {
callback();
}
}, trigger: 'blur'
},],
} }
}, },
colConfigs() { colConfigs() {
return [ return [
{prop: "residentName", label: "姓名"}, {prop: "residentName", label: "姓名"},
{prop: "description", label: "调整说明"}, {prop: "eventDesc", label: "调整说明"},
{ {prop: "integralCalcType", label: "类型", dict: "integralCalcType", align: 'center'},
prop: "changeIntegral", label: "类型", align: "center", {prop: "changeIntegral", label: "积分", align: "center", render: (h, {row}) => h('p', `${row.integralCalcType > 0 ? '+' : '-'}${row.changeIntegral}`)},
render: (h, {row}) => [< span> {+row.changeIntegral > 0 ? "加分" : '减分'
} < /span>]
},
{
prop: "changeIntegral",
label: "积分",
align: "center",
render: (h, {row}) => [
<span>{row.changeIntegral > 0 ? `+${row.changeIntegral}` : `${row.changeIntegral}`}</span>]
},
{prop: "doTime", label: "操作时间"}, {prop: "doTime", label: "操作时间"},
{prop: "declareObjName", label: "操作人", align: "center"}, {prop: "createUserName", label: "操作人", align: "center"},
] ]
} }
}, },
@@ -134,10 +112,7 @@ export default {
onConfirm() { onConfirm() {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.instance.post(`/app/appvillagerintegraldetail/changeIntegral`, { this.instance.post(`/app/appvillagerintegraldetail/changeIntegral`, this.form).then(res => {
...this.form,
changeIntegral: this.form.doType == 0 ? `+${this.form.changeIntegral}` : `-${this.form.changeIntegral}`
}).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.$message.success("添加成功") this.$message.success("添加成功")
this.dialog = false this.dialog = false
@@ -149,11 +124,7 @@ export default {
}, },
getList() { getList() {
this.instance.post(`/app/appvillagerintegraldetail/list`, null, { this.instance.post(`/app/appvillagerintegraldetail/list`, null, {
params: { params: {...this.page, areaId: this.areaId, type: 0}
...this.page,
areaId: this.areaId,
doType: 2
}
}).then(res => { }).then(res => {
if (res?.data) { if (res?.data) {
this.tableData = res.data.records this.tableData = res.data.records