This commit is contained in:
yanran200730
2023-01-04 11:30:34 +08:00
4 changed files with 415 additions and 48 deletions

View File

@@ -4,7 +4,7 @@
<template slot="content">
<ai-search-bar>
<template #left>
<ai-select v-model="search.status" @change="(page.current = 1), getList()" placeholder="请选择事件" :selectList="$dict.getDict('srStatus')">
<ai-select v-model="search.category" @change="(page.current = 1), getList()" placeholder="请选择事件" :selectList="$dict.getDict('srCategory')">
</ai-select>
<ai-select v-model="search.type" @change="(page.current = 1), getList()" placeholder="请选择类型" :selectList="$dict.getDict('srType')">
</ai-select>
@@ -22,17 +22,43 @@
<span>{{ row.integral > 0 ? "+" : "" }}{{ row.integral }}</span>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" align="center" fixed="right" width="200">
<el-table-column slot="options" label="操作" align="center" fixed="right" width="160">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="changeStatus(row.id)" v-if="row.status == 1">停用</el-button>
<el-button type="text" @click="changeStatus(row.id)" v-else>启用</el-button>
<el-button type="text" @click="changeStatus(row.id, row.status)" v-if="row.status == 1">停用</el-button>
<el-button type="text" @click="changeStatus(row.id, row.status)" v-else>启用</el-button>
<el-button type="text" @click="set(row)" v-if="row.type == 11 || row.type == 12 || row.type == 13 ">配置</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
<ai-dialog title="配置成员" :visible.sync="dialog" :destroyOnClose="true" customFooter width="720px">
<ai-wrapper label-width="120px" v-if="!isSetEdit">
<ai-info-item label="成员" isLine>
<span v-for="(item, index) in chooseUserList" :key="index">
<span>{{item.name}}</span>
<span v-if="index < chooseUserList.length-1">,</span>
</span>
</ai-info-item>
</ai-wrapper>
<el-form ref="form" :model="form" :rules="rules" label-width="80px" v-else>
<el-form-item label="选择人员" prop="ids">
<ai-person-select :instance="instance" :customClicker="true" :chooseUserList="chooseUserList"
url="/app/wxcp/wxuser/list" headerTitle="人员列表"
:isMultiple="true" dialogTitle="选择" @selectPerson="selectPerson" class="aipersonselect">
<template name="option" v-slot:option="{ item }">
<span class="iconfont iconProlife">{{ item.name }}</span>
</template>
</ai-person-select>
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" @click="isSetEdit=true" v-if="!isSetEdit">编辑</el-button>
<el-button type="primary" @click="setConfirm" v-else>保存</el-button>
</template>
</ai-dialog>
<!-- <ai-empty v-else>暂无应用权限</ai-empty> -->
</section>
</template>
@@ -70,51 +96,34 @@ export default {
},
page: {current: 1, size: 10, total: 0},
colConfigs: [
{
prop: "type",
label: "类型",
dict: "srType",
},
{prop: "category", label: "事件", dict: "srcategory"},
{prop: "score", label: "规则"},
{
prop: "cycle",
label: "周期范围",
dict: "srCycle",
},
// {slot: "integral", label: "积分分值", align: "center"},
// {
// prop: "validRangeType",
// label: "有效范围",
// formart: (v) => (v == 0 ? "全局" : "指定网格"),
// },
{
prop: "status",
label: "状态",
align: "center",
width: 96,
dict: "srStatus",
},
{slot: "options", label: "操作", align: "center"},
{prop: "type", label: "类型", dict: "srType", width: 220},
{prop: "category", label: "事件", dict: "srCategory", align: "center", width: 200},
{prop: "remark", label: "规则"},
{prop: "cycle", label: "周期范围", dict: "srCycle", align: "center", width: 100},
{prop: "status", label: "状态", align: "center", width: 100, dict: "srStatus",},
{slot: "options", label: "操作", align: "center", width: 100},
],
tableData: [],
dialog: false,
setInfo: {},
isSetEdit: false,
chooseUserList: [],
personList: []
};
},
created() {
this.$dict.load('srStatus', 'srCategory', 'srType').then(() => {
this.$dict.load('srStatus', 'srCategory', 'srType', 'srCycle').then(() => {
this.getList();
});
},
methods: {
getList() {
this.instance
.post(`/app/appscorerule/list`, null, {
this.instance.post(`/app/appscorerule/list`, null, {
params: {
...this.search,
...this.page,
},
})
.then((res) => {
}).then((res) => {
if (res?.data) {
this.tableData = res.data.records;
this.page.total = res.data.total;
@@ -122,7 +131,7 @@ export default {
});
},
changeStatus(id, status) {
let text = status == 1 ? "用" : "用";
let text = status == 1 ? "用" : "用"
this.$confirm(`确定${text}该条规则?`).then(() => {
this.instance.post(`/app/appscorerule/enable?id=${id}`).then((res) => {
if (res.code == 0) {
@@ -132,6 +141,42 @@ export default {
});
});
},
set(row) {
this.chooseUserList = []
this.instance.post(`/app/appscorerule/queryDetailById?id=${row.id}`).then((res) => {
if (res?.data) {
if(res.data.massSendingConfigs && res.data.massSendingConfigs.length) {
this.chooseUserList = res.data.massSendingConfigs
}
}
});
this.dialog = true
this.setInfo = {...row}
},
selectPerson(val) {
console.log(val)
if (val) {
this.personList = val
} else {
this.personList = this.chooseUserList
}
},
setConfirm() {
if(!this.personList.length) {
return this.$message.error("请选择成员!")
}
var params = {
id: this.setInfo.id,
massSendingConfigs: this.personList,
}
this.instance.post(`/app/appscorerule/editMassSendingConfig`, params).then((res) => {
if (res.code == 0) {
this.dialog = false
this.$message.success(`配置成功!`);
this.getList();
}
});
}
},
};
</script>

View File

@@ -111,9 +111,9 @@ export default {
methods: {
// 详情
getDetail() {
this.instance.post(`/app/appscoredetail/queryDetailById`, null, {
this.instance.post(`/app/appscoredetail/userInfo`, null, {
params: {
id: this.params.id
sysUserId: this.params.id
}
}).then(res => {
if (res?.data) {
@@ -128,10 +128,9 @@ export default {
getEventSummary() {
this.instance.post(`/app/appscoredetail/detailTypeStatistics`, null, {
params: {
id: this.params.id,
startTime: this.startTime,
endTime: this.endTime,
sysUserId: this.data.sysUserId
sysUserId: this.data.id
}
}).then(res => {
if (res?.data) {
@@ -148,8 +147,7 @@ export default {
params: {
...this.search, //积分类型
total: this.total,
id: this.params.id,
sysUserId: this.data.sysUserId
sysUserId: this.data.id
}
}).then(res => {
if (res?.data) {

View File

@@ -58,7 +58,7 @@
<ai-uploader :instance="instance" fileType="file" v-model="form.enclosure" :limit="1"></ai-uploader>
</el-form-item>
<el-form-item label="类型" prop="scoreCalcType">
<ai-select v-model="form.scoreCalcType" :selectList="dict.getDict('integralCalcType')"/>
<ai-select v-model="form.scoreCalcType" :selectList="dict.getDict('srScoreCalcType')"/>
</el-form-item>
<el-form-item label="积分" prop="score">
<el-input v-model.trim="form.score" placeholder="请输入正数" size="small"></el-input>
@@ -115,7 +115,7 @@ export default {
}
},
created() {
this.$dict.load('integralCalcType')
this.$dict.load('srScoreCalcType')
this.getTableData()
this.getGridList()
},
@@ -125,9 +125,9 @@ export default {
return [
{ prop: "name", label: '姓名', align: "left"},
{ prop: "departName", label: '所属部门' },
{ prop: "nowScore", label: '积分余额', align: "center" },
{ prop: "score", label: '积分余额', align: "center" },
// { prop: "totalIntegral", label: '累计积分', align: "center", sortable: "custom" },
{ prop: "usedIntegral", label: '已用积分', align: "center" },
{ prop: "usedScore", label: '已用积分', align: "center" },
{ slot: "options" },
]
},
@@ -143,7 +143,7 @@ export default {
},
methods: {
getTableData() {
this.instance.post(`/app/appscoredetail/list`,null,{
this.instance.post(`/app/appscoredetail/userList`,null,{
params: {
...this.search,
current: this.current,
@@ -172,7 +172,7 @@ export default {
this.dialog = true
} else if(type ==1) {
this.chooseUserList = [{
sysUserId: row.sysUserId,
sysUserId: row.id,
name: row.name
}]
this.form.ids = this.chooseUserList.map(e => e.sysUserId)

View File

@@ -0,0 +1,324 @@
<template>
<section class="AppResidentsType">
<ai-list>
<template #content>
<ai-search-bar>
<template #left>
<ai-area-get
style="width: 180px;"
placeholder="请选择地区"
:instance="instance"
v-model="search.areaId"
@select="onAreaChange"/>
<el-cascader ref="cascader1" clearable v-model="departIdList" :options="girdOptions" placeholder="所属部门" size="small"
:props="defaultProps" :show-all-levels="false" @change="gridChange"></el-cascader>
</template>
<template #right>
<el-input size="small" placeholder="姓名" v-model="search.name" clearable
@clear="current = 1, search.name = '', getTableData()" suffix-icon="iconfont iconSearch"
v-throttle="() => {(current = 1), getTableData();}"/>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :total="total" :current.sync="current" :size.sync="size"
@getList="getTableData()" :col-configs="colConfigs" :dict="dict">
<el-table-column slot="options" label="操作" align="center">
<template slot-scope="{ row }">
<el-button type="text" @click="edit(row)">编辑</el-button>
<el-button type="text" @click="del(row.id)">删除</el-button>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
<ai-dialog
title="分类信息详情"
:visible.sync="dialog"
:destroyOnClose="true"
width="720px"
@onConfirm="onConfirm"
@closed="form={}">
<ai-wrapper>
<ai-info-item label="姓名" :value="form.name"></ai-info-item>
<ai-info-item label="部门" :value="form.departmentName"></ai-info-item>
<ai-info-item label="手机号" :value="form.phone"></ai-info-item>
<ai-info-item label="行政区划" :value="form.areaName"></ai-info-item>
</ai-wrapper>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="登记数" prop="registerCount">
<el-input v-model.trim="form.registerCount" placeholder="请输入正整数" size="small"></el-input>
</el-form-item>
<el-form-item label="朋友数" prop="friendCount">
<el-input v-model.trim="form.friendCount" placeholder="请输入正整数" size="small"></el-input>
</el-form-item>
<el-form-item label="知己数" prop="confidantCount">
<el-input v-model.trim="form.confidantCount" placeholder="请输入正整数" size="small"></el-input>
</el-form-item>
</el-form>
</ai-dialog>
</section>
</template>
<script>
import { mapState } from "vuex";
export default {
name: "AppResidentsType",
label: '居民分类信息(黔西南)',
props: {
instance: Function,
dict: Object,
permissions: Function,
menuName:String
},
data() {
return {
search: {
name: '',
departmentId: '',
current: 1,
size: 10,
areaId: '',
},
departIdList: [],
tableData: [],
size: 10,
total: 0,
current: 1,
girdList: [],
form: {
registerCount: 0,
friendCount: 0,
confidantCount: 0
},
personList: [],
dialog: false,
girdOptions: [],
defaultProps: {
label: 'name',
value: 'id',
checkStrictly: true,
},
chooseUserList: [],
flag: false,
}
},
created() {
this.$dict.load('integralCalcType')
this.getTableData()
this.getGridList()
},
computed: {
...mapState(['user']),
colConfigs() {
return [
{ prop: "name", label: '提交人', align: "left"},
{ prop: "departmentName", label: '部门'},
{ prop: "areaName", label: '行政区划'},
{ prop: "phone", label: '手机号'},
{ prop: "registerCount", label: '登记数'},
{ prop: "friendCount", label: '朋友数'},
{ prop: "confidantCount", label: '知己数'},
{ prop: "createTime", label: '创建时间', width:220},
{ slot: "options" },
]
},
rules() {
return {
registerCount: [{required: true, message: '请输入登记数', trigger: 'blur' },
{pattern: /^[0-9]+$/, message: '请输入正整数'}],
friendCount: [{required: true, message: '请输入朋友数', trigger: 'blur' },
{pattern: /^[0-9]+$/, message: '请输入正整数'}],
confidantCount: [{required: true, message: '请输入知己数', trigger: 'blur' },
{pattern: /^[0-9]+$/, message: '请输入正整数'}],
}
},
},
methods: {
getTableData() {
this.instance.post(`/app/appwxuserfamiliarityrate/list`,null,{
params: {
...this.search,
current: this.current,
size: this.size,
total: this.total
}
}).then(res => {
if(res?.data) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
onAreaChange () {
this.search.current = 1
this.$nextTick(() => {
this.getTableData()
})
},
del(row) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appwxuserfamiliarityrate/delete?id=${row.id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getTableData()
}
})
})
},
edit(row) {
this.dialog = true
this.form = {...row}
},
selectPerson(val) {
console.log(val)
if (val) {
this.personList = val
this.form.ids = [...this.personList.map(e => e.sysUserId)]
} else {
this.form.ids = this.chooseUserList.map(e => e.sysUserId)
}
},
getGridList() {
this.instance.post(`/app/wxcp/wxdepartment/listAll`).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.parentid];
if (parent) {
(parent.children || (parent.children = [])).push(item);
} else {
result.push(item);
}
});
return result;
},
gridChange(val) {
this.departIdList = val
this.search.departmentId = val?.[val.length - 1]
this.$refs.cascader1.dropDownVisible = false;
this.getTableData()
},
onConfirm() {
if(this.flag) return
this.$refs.form.validate((valid)=> {
if(valid) {
this.flag = true
this.instance.post(`/app/appwxuserfamiliarityrate/webUpdate`,{...this.form}).then(res => {
if(res?.code == 0) {
this.$message.success('分类信息修改成功')
setTimeout(() =>{
this.dialog = false
this.getTableData()
this.flag = false
}, 600)
} else {
this.flag = false
}
})
}
})
},
toDetail(id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id
}
})
}
},
}
</script>
<style lang="scss" scoped>
.AppResidentsType {
height: 100%;
:deep( .ai-dialog .ai-dialog__content ){
max-height: 600px!important;
}
.userlist {
display: inline-block;
}
.userlist, .user {
display: inline-block;
}
.user {
position: relative;
width: 70px;
text-align: center;
.remove-icon {
position: absolute;
right: 7px;
top: -4px;
line-height: 1;
padding: 6px 0;
font-size: 16px;
cursor: pointer;
&:hover {
color: crimson;
}
}
img, h2 {
display: block;
width: 40px;
height: 40px;
line-height: 40px;
text-align: center;
margin: 0 auto 4px;
font-size: 14px;
color: #fff;
border-radius: 50%;
}
h2 {
background-color: $primaryColor;
}
span {
color: #666;
font-size: 14px;
white-space: nowrap;
overflow: hidden;
word-break: break-all;
text-overflow: ellipsis;
}
}
:deep( .selectCont .pagination ){
width: 100%!important;
background: pink;
}
}
</style>