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