评分管理-需求变更
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
VUE_APP_SCOPE=fengdu
|
VUE_APP_SCOPE=fengdu
|
||||||
#VUE_APP_API=https://web.fdfengshou.cn/
|
#VUE_APP_API=https://web.fdfengshou.cn/
|
||||||
#VUE_APP_API=http://192.168.1.87:9000/
|
VUE_APP_API=http://192.168.1.87:9000/
|
||||||
VUE_APP_API=http://test87web.cunwuyun.cn/
|
#VUE_APP_API=http://test87web.cunwuyun.cn/
|
||||||
|
|||||||
@@ -3,21 +3,21 @@
|
|||||||
<ai-list>
|
<ai-list>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="card_list">
|
<div class="card_list">
|
||||||
<div class="card" v-for="(item,index) in cardList" :key="index">
|
<div class="card" v-for="(label,key) in cardSta" :key="key">
|
||||||
<h2>{{ item.label }}</h2>
|
<h2>{{ label }}</h2>
|
||||||
<p class="color1">{{ item.value || 0 }}</p>
|
<p class="color1">{{ cardData[key] || 0 }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ai-title title="评分列表"></ai-title>
|
<ai-title title="评分列表"></ai-title>
|
||||||
<ai-search-bar>
|
<ai-search-bar>
|
||||||
<template #left>
|
<template #left>
|
||||||
<el-button type="primary" icon="iconfont iconAdd" @click="handleAdd">添加</el-button>
|
<el-button type="primary" icon="iconfont iconAdd" @click="handleAdd">添加</el-button>
|
||||||
<ai-select
|
<!-- <ai-select-->
|
||||||
v-model="search.type"
|
<!-- v-model="search.type"-->
|
||||||
@change="onChange"
|
<!-- @change="onChange"-->
|
||||||
placeholder="请选择事件类型"
|
<!-- placeholder="请选择事件类型"-->
|
||||||
:selectList="$dict.getDict('shopScoreType')">
|
<!-- :selectList="$dict.getDict('shopScoreType')">-->
|
||||||
</ai-select>
|
<!-- </ai-select>-->
|
||||||
<ai-select
|
<ai-select
|
||||||
v-model="search.listType"
|
v-model="search.listType"
|
||||||
@change="(search.current = 1), getList()"
|
@change="(search.current = 1), getList()"
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
label="分值"
|
label="分值"
|
||||||
slot="score">
|
slot="score">
|
||||||
<template v-slot="{ row }">
|
<template v-slot="{ row }">
|
||||||
<span>{{row.score === 0 ? 0 : row.score > 0 ? `+${row.score}` : row.score}}</span>
|
<span>{{ row.score === 0 ? 0 : row.score > 0 ? `+${row.score}` : row.score }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
<el-table-column slot="options" width="180px" fixed="right" label="操作" align="center">
|
<el-table-column slot="options" width="180px" fixed="right" label="操作" align="center">
|
||||||
<template slot-scope="{ row }">
|
<template slot-scope="{ row }">
|
||||||
<div class="table-options">
|
<div class="table-options">
|
||||||
<el-button type="text" @click="changeState(row)">{{row.status === '1' ? '停用' : '启用'}}</el-button>
|
<el-button type="text" @click="changeState(row)">{{ row.status === '1' ? '停用' : '启用' }}</el-button>
|
||||||
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
||||||
<el-button type="text" @click="handleDelete(row)">删除</el-button>
|
<el-button type="text" @click="handleDelete(row)">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -70,20 +70,19 @@
|
|||||||
</template>
|
</template>
|
||||||
</ai-list>
|
</ai-list>
|
||||||
<ai-dialog title="评分规则" :visible.sync="dialog" width="800px" @closed="onClosed" @onConfirm="onConfirm">
|
<ai-dialog title="评分规则" :visible.sync="dialog" width="800px" @closed="onClosed" @onConfirm="onConfirm">
|
||||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px" size="small">
|
||||||
<el-form-item label="事件类型:" prop="type">
|
<!-- <el-form-item label="事件类型:" prop="type">-->
|
||||||
<ai-select
|
<!-- <ai-select v-model="form.type" placeholder="请选择事件类型" dict="shopScoreType"/>-->
|
||||||
v-model="form.type"
|
<!-- </el-form-item>-->
|
||||||
placeholder="请选择事件类型"
|
<!-- <el-form-item label="自定义事件:" prop="listType">-->
|
||||||
:selectList="$dict.getDict('shopScoreType')">
|
<!-- <el-input v-model="form.listType" :disabled="form.type === '' || form.type === null || form.type === undefined" placeholder="请输入自定义事件" size="small"></el-input>-->
|
||||||
</ai-select>
|
<!-- </el-form-item>-->
|
||||||
</el-form-item>
|
<el-form-item label="事件名称:" prop="listType">
|
||||||
<el-form-item label="自定义事件:" prop="listType">
|
<el-input v-model="form.listType" placeholder="请输入事件名称" clearable/>
|
||||||
<el-input v-model="form.listType" :disabled="form.type === '' || form.type === null || form.type === undefined" placeholder="请输入自定义事件" size="small"></el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="规则:">常规</el-form-item>
|
<el-form-item label="规则:">常规</el-form-item>
|
||||||
<el-form-item label="分值:" prop="score">
|
<el-form-item label="分值:" prop="score">
|
||||||
<el-input-number v-model="form.score" :precision="2" size="small" placeholder="请输入分值"></el-input-number>
|
<el-input-number v-model="form.score" :precision="2" size="small" placeholder="请输入分值" :min="0"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</ai-dialog>
|
</ai-dialog>
|
||||||
@@ -101,196 +100,175 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
search:{
|
search: {
|
||||||
genre:'',
|
genre: '',
|
||||||
type:'',
|
type: '',
|
||||||
status:'',
|
status: '',
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
},
|
},
|
||||||
dictList:[],
|
dictList: [],
|
||||||
cardList: [
|
cardSta: {
|
||||||
{
|
rulesCount: "规则总数量",
|
||||||
label: '规则总数量',
|
positiveCount: "启动规则项",
|
||||||
value: 0
|
negativeCount: "停用规则项",
|
||||||
},
|
positiveScore: "规则总分数",
|
||||||
{
|
// negativeScore: "负向事件总分数",
|
||||||
label: '正向事件规则项',
|
},
|
||||||
value: 0
|
cardData: {},
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '正向事件总分数',
|
|
||||||
value: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '负向事件规则项',
|
|
||||||
value: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '负向事件总分数',
|
|
||||||
value: 0
|
|
||||||
},
|
|
||||||
],
|
|
||||||
total: 10,
|
total: 10,
|
||||||
colConfigs: [
|
colConfigs: [
|
||||||
{type: "selection"},
|
{type: "selection"},
|
||||||
{ prop: 'type', label: '类型', align: 'center' ,render:(h,{row})=>{
|
// { prop: 'type', label: '类型', align: 'center' ,render:(h,{row})=>{
|
||||||
return h('span',null,this.dict.getLabel('shopScoreType',row.type))
|
// return h('span',null,this.dict.getLabel('shopScoreType',row.type))
|
||||||
}},
|
// }},
|
||||||
{ prop: 'listType', label: '事件', align: 'center' },
|
{prop: 'listType', label: '事件', align: 'center'},
|
||||||
{ prop: 'rule', label: '规则', align: 'center' },
|
{prop: 'rule', label: '规则', align: 'center'},
|
||||||
{ slot: 'score' },
|
{slot: 'score'},
|
||||||
{ slot: 'status'},
|
{slot: 'status'},
|
||||||
],
|
],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
dialog:false,
|
dialog: false,
|
||||||
form:{
|
form: {
|
||||||
id:null,
|
id: null,
|
||||||
listType:'',
|
listType: '',
|
||||||
type:'',
|
type: '',
|
||||||
score:'',
|
score: '',
|
||||||
rule:'常规'
|
rule: '常规'
|
||||||
},
|
},
|
||||||
rules:{
|
rules: {
|
||||||
type:[{ required: true, message: '请选择事件类型', trigger: 'change' },],
|
type: [{required: true, message: '请选择事件类型', trigger: 'change'},],
|
||||||
listType:[{ required: true, message: '请输入自定义事件', trigger: 'blur' },],
|
listType: [{required: true, message: '请输入自定义事件', trigger: 'blur'},],
|
||||||
score:[{ required: true, message: '请输入分值', trigger: 'change' },],
|
score: [{required: true, message: '请输入分值', trigger: 'change'},],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
created(){
|
created() {
|
||||||
this.$dict.load('shopScoreType','shopScoreEvent').then(()=>{
|
this.queryListTypeByType()
|
||||||
|
this.$dict.load('shopScoreType', 'shopScoreEvent').then(() => {
|
||||||
this.getStatic()
|
this.getStatic()
|
||||||
this.getList()
|
this.getList()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onChange(e){
|
onChange(e) {
|
||||||
if(e){
|
if (e) {
|
||||||
this.queryListTypeByType(e)
|
this.queryListTypeByType(e)
|
||||||
}else {
|
} else {
|
||||||
this.search.listType = ''
|
this.search.listType = ''
|
||||||
this.dictList = []
|
this.dictList = []
|
||||||
this.search.current = 1
|
this.search.current = 1
|
||||||
this.getList()
|
this.getList()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async queryListTypeByType(type){
|
async queryListTypeByType(type) {
|
||||||
try {
|
try {
|
||||||
const {code,data} = await this.instance.post('/app/appscorerules/queryListTypeByType',null,{
|
const {code, data} = await this.instance.post('/app/appscorerules/queryListTypeByType', null, {
|
||||||
params:{
|
params: {type}
|
||||||
type
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
if(code===0){
|
if (code === 0) {
|
||||||
this.dictList = data?.map(item=>{
|
this.dictList = [...new Set(data?.map(e => e.listType) || [])].map(item => {
|
||||||
return {
|
return {dictName: item, dictValue: item}
|
||||||
dictName:item.listType,
|
|
||||||
dictValue:item.listType
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onConfirm(){
|
onConfirm() {
|
||||||
this.$refs['formRef'].validate(async valid=>{
|
this.$refs['formRef'].validate(async valid => {
|
||||||
if(valid){
|
if (valid) {
|
||||||
try {
|
try {
|
||||||
const {code} = await this.instance.post('/app/appscorerules/addOrUpdate',{...this.form})
|
const {code} = await this.instance.post('/app/appscorerules/addOrUpdate', {...this.form})
|
||||||
if(code===0){
|
if (code === 0) {
|
||||||
this.$message.success('保存成功')
|
this.$message.success('保存成功')
|
||||||
this.dialog = false
|
this.dialog = false
|
||||||
this.getList()
|
this.getList()
|
||||||
this.getStatic()
|
this.getStatic()
|
||||||
}
|
}
|
||||||
}catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onClosed(){
|
onClosed() {
|
||||||
this.form = {
|
this.form = {
|
||||||
type:'',
|
type: '',
|
||||||
score:''
|
score: ''
|
||||||
}
|
}
|
||||||
this.$refs['formRef'].resetFields()
|
this.$refs['formRef'].resetFields()
|
||||||
},
|
},
|
||||||
async changeState({id,status}){
|
async changeState({id, status}) {
|
||||||
try {
|
try {
|
||||||
const {code} = await this.instance.post('/app/appscorerules/isOrNotEnableById',null,{
|
const {code} = await this.instance.post('/app/appscorerules/isOrNotEnableById', null, {
|
||||||
params:{id}
|
params: {id}
|
||||||
})
|
})
|
||||||
if(code===0){
|
if (code === 0) {
|
||||||
this.$message.success(status === '1' ? '停用成功' :'启用成功')
|
this.$message.success(status === '1' ? '停用成功' : '启用成功')
|
||||||
this.getStatic()
|
this.getStatic()
|
||||||
this.getList()
|
this.getList()
|
||||||
}
|
}
|
||||||
}catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEdit(row){
|
handleEdit(row) {
|
||||||
this.form = {...row}
|
this.form = {...row}
|
||||||
this.dialog = true
|
this.dialog = true
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDelete({id}){
|
handleDelete({id}) {
|
||||||
this.$confirm("是否要删除此数据?").then(
|
this.$confirm("是否要删除此数据?").then(
|
||||||
async ()=>{
|
async () => {
|
||||||
try {
|
try {
|
||||||
const {code} = await this.instance.post('/app/appscorerules/delete',null,{
|
const {code} = await this.instance.post('/app/appscorerules/delete', null, {
|
||||||
params:{ids:id}
|
params: {ids: id}
|
||||||
})
|
})
|
||||||
if(code===0){
|
if (code === 0) {
|
||||||
this.$message.success('删除成功')
|
this.$message.success('删除成功')
|
||||||
this.getStatic()
|
this.getStatic()
|
||||||
this.getList()
|
this.getList()
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
}
|
}
|
||||||
}catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
handleAdd(){
|
handleAdd() {
|
||||||
this.dialog = true
|
this.dialog = true
|
||||||
},
|
},
|
||||||
|
|
||||||
async getStatic() {
|
async getStatic() {
|
||||||
try {
|
try {
|
||||||
const {code,data} = await this.instance.post('/app/appscorerules/queryAppScoreRulesCount')
|
const {code, data} = await this.instance.post('/app/appscorerules/queryAppScoreRulesCount')
|
||||||
if(code===0){
|
if (code === 0) {
|
||||||
const array = ['rulesCount','positiveCount','positiveScore','negativeCount','negativeScore']
|
this.cardData = data
|
||||||
array.forEach((item,index)=>{
|
|
||||||
this.cardList[index].value = data[item]
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async getList(){
|
async getList() {
|
||||||
try {
|
try {
|
||||||
const {code,data} = await this.instance.post('/app/appscorerules/list',null,{
|
const {code, data} = await this.instance.post('/app/appscorerules/list', null, {
|
||||||
params:{
|
params: {
|
||||||
...this.search
|
...this.search
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if(code===0){
|
if (code === 0) {
|
||||||
this.tableData = data.records
|
this.tableData = data.records
|
||||||
this.total = data.total
|
this.total = data.total
|
||||||
}
|
}
|
||||||
}catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,12 +319,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.start){
|
:deep(.start) {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #2EA222;
|
color: #2EA222;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.stop){
|
:deep(.stop) {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #FF4466;
|
color: #FF4466;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user