积分整合

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

View File

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

View File

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