From b2832a9c5d287b8a11c0e7ba312bfd45f195d8df Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 20 Dec 2022 17:29:18 +0800
Subject: [PATCH] 通行证、评价页面非管理员只能看见自己的数据
---
src/api/evaluation/evaluation.js | 12 +++
src/views/evaluation/evaluation.vue | 134 ++++++++++++++++++++++++++++++++-
src/const/pass/pass.js | 5 -
src/views/pass/pass.vue | 14 ++
src/api/pass/pass.js | 12 +++
src/const/evaluation/evaluation.js | 40 ++++++++-
6 files changed, 200 insertions(+), 17 deletions(-)
diff --git a/src/api/evaluation/evaluation.js b/src/api/evaluation/evaluation.js
index 5584ba8..da09780 100644
--- a/src/api/evaluation/evaluation.js
+++ b/src/api/evaluation/evaluation.js
@@ -12,6 +12,18 @@
})
}
+export const getPage = (current, size, params) => {
+ return request({
+ url: '/api/evaluation/evaluation/page',
+ method: 'get',
+ params: {
+ ...params,
+ current,
+ size,
+ }
+ })
+}
+
export const getDetail = (id) => {
return request({
url: '/api/evaluation/evaluation/detail',
diff --git a/src/api/pass/pass.js b/src/api/pass/pass.js
index 16c24d9..7baf8ae 100644
--- a/src/api/pass/pass.js
+++ b/src/api/pass/pass.js
@@ -12,6 +12,18 @@
})
}
+export const getPage = (current, size, params) => {
+ return request({
+ url: '/api/pass/pass/page',
+ method: 'get',
+ params: {
+ ...params,
+ current,
+ size,
+ }
+ })
+}
+
export const getDetail = (id) => {
return request({
url: '/api/pass/pass/detail',
diff --git a/src/const/evaluation/evaluation.js b/src/const/evaluation/evaluation.js
index 2fa867c..689111a 100644
--- a/src/const/evaluation/evaluation.js
+++ b/src/const/evaluation/evaluation.js
@@ -1,3 +1,5 @@
+import {mobileValidate} from "@/util/formValidator";
+
export default {
height:'auto',
calcHeight: 30,
@@ -6,7 +8,9 @@
searchMenuSpan: 6,
border: true,
index: true,
- viewBtn: true,
+ viewBtn: false,
+ editBtn:false,
+ delBtn:false,
selection: true,
dialogClickModal: false,
column: [
@@ -31,6 +35,7 @@
prop: "score",
type: "rate",
colors: ['#99A9BF', '#F7BA2A', '#FF9900'],
+ rules: [{required: true, trigger: ['blur','change'],message:"请评分"}]
},
{
label: "评价",
@@ -96,22 +101,47 @@
hide: true,
},
{
- label: "修改时间",
+ label: "评价时间",
prop: "updateTime",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
- hide: true,
+ },
+ {
+ label:"差评确认信息",
+ prop:"badCommentConfirm",
+ addDisplay: false,
+ editDisplay: false,
+ viewDisplay: false,
+ slot:true,
},
{
label: "状态",
prop: "status",
- type: "input",
+ type: "select",
+ search:true,
+ dicData:[
+ {
+ label: "所有",
+ value: "",
+ },
+ {
+ label:"待评价",
+ value:1
+ },
+ {
+ label:"好评",
+ value:2
+ },
+ {
+ label:"差评",
+ value:3
+ },
+ ],
addDisplay: false,
editDisplay: false,
viewDisplay: false,
- hide: true,
},
{
label: "是否已删除",
diff --git a/src/const/pass/pass.js b/src/const/pass/pass.js
index f976930..406ff65 100644
--- a/src/const/pass/pass.js
+++ b/src/const/pass/pass.js
@@ -22,11 +22,6 @@
hide: true,
},
{
- label: "名字",
- prop: "name",
- type: "input",
- },
- {
label: "编号",
prop: "no",
type: "input",
diff --git a/src/views/evaluation/evaluation.vue b/src/views/evaluation/evaluation.vue
index 1879619..e2c04b9 100644
--- a/src/views/evaluation/evaluation.vue
+++ b/src/views/evaluation/evaluation.vue
@@ -28,12 +28,22 @@
</el-button>
</template>
+ <template slot-scope="{row}" slot="badCommentConfirm">
+ <span v-if="row.status == 3 && !row.badCommentConfirm" style="color: red">差评类型未确认</span>
+ </template>
+
+
+
+ <template slot-scope="{type,size,row,index}" slot="menu">
+ <el-button v-if="row.status == 1" icon="el-icon-edit" :size="size" :type="type" @click="$refs.crud.rowEdit(row,index)">评 价</el-button>
+ <el-button v-if="row.status == 3 && !row.badCommentConfirm" icon="el-icon-warning-outline" :size="size" :type="type" @click="badCommentConfirm(row)">差评确认</el-button>
+ </template>
</avue-crud>
</basic-container>
</template>
<script>
- import {getList, getDetail, add, update, remove} from "@/api/evaluation/evaluation";
+ import {getPage, getDetail, add, update, remove} from "@/api/evaluation/evaluation";
import option from "@/const/evaluation/evaluation";
import {mapGetters} from "vuex";
@@ -50,11 +60,87 @@
},
selectionList: [],
option: option,
+ badConfirmOption:{
+ height:'auto',
+ calcHeight: 30,
+ tip: false,
+ border: true,
+ index: true,
+ dialogClickModal: false,
+ group:[
+ {
+ label: '评价信息',
+ collapse: true,
+ prop: 'info',
+ arrow:false,
+ column:[
+ {
+ label: "申请单号",
+ prop: "no",
+ type: "input",
+ readonly:true,
+ addDisplay: false,
+ editDisplay: false,
+ },
+ {
+ label: "评分",
+ prop: "score",
+ type: "rate",
+ disabled:true,
+ colors: ['#99A9BF', '#F7BA2A', '#FF9900'],
+ rules: [{required: true, trigger: ['blur','change'],message:"请评分"}]
+ },
+ {
+ label: "评价",
+ prop: "comment",
+ readonly:true,
+ disabled:true,
+ span:24,
+ type: "select",
+ multiple:true,
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=evaluation_comment",
+ props:{
+ label:"dictValue",
+ value:"dictKey"
+ },
+ },
+ {
+ label: "建议与反馈",
+ prop: "feedback",
+ readonly:true,
+ span:24,
+ type: "textarea",
+ }
+ ]
+ },
+ {
+ label: '确认评价内容',
+ collapse: true,
+ prop: 'confirm',
+ arrow:false,
+ column:[
+ {
+ label:'',
+ span:24,
+ gutter:18,
+ prop:'badCommentConfirm',
+ type:'radio',
+ props:{
+ label:"dictValue",
+ value:"dictKey"
+ },
+ dicUrl: '/api/blade-system/dict-biz/dictionary?code=evaluation_bad_comment_confirm',
+ rules: [{required: true, trigger: ['blur','change'],message:"请确认评价内容"}]
+ }
+ ]
+ }
+ ],
+ },
data: []
};
},
computed: {
- ...mapGetters(["permission"]),
+ ...mapGetters(["permission","userInfo"]),
permissionList() {
return {
addBtn: this.vaildData(this.permission.evaluation_add, true),
@@ -69,6 +155,9 @@
ids.push(ele.id);
});
return ids.join(",");
+ },
+ permit(){
+ return this.userInfo.role_name == 'admin' || this.userInfo.role_name == 'administrator' ? true:false
}
},
methods: {
@@ -86,6 +175,14 @@
});
},
rowUpdate(row, index, done, loading) {
+
+ if (row.score<3){
+ //评分小于3 差评
+ row.status = 3
+ }else {
+ row.status = 2
+ }
+
update(row).then(() => {
this.onLoad(this.page);
this.$message({
@@ -173,14 +270,43 @@
},
onLoad(page, params = {}) {
this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+
+ if (!this.permit){
+ params.userId = this.userInfo.user_id
+ }
+
+ getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
- }
+ },
+ //差评确认
+ badCommentConfirm(row){
+ this.$DialogForm.show({
+ title: '差评确认',
+ width: '70%',
+ data:row,
+ option: this.badConfirmOption,
+ callback:(res)=>{
+ update(res.data).then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ });
+ res.close()
+ })
+ this.option.group.forEach(group=>{
+ group.column.forEach(item=>{
+ item.disabled = false
+ })
+ })
+ }
+ })
+ },
}
};
</script>
diff --git a/src/views/pass/pass.vue b/src/views/pass/pass.vue
index 70e5526..0815941 100644
--- a/src/views/pass/pass.vue
+++ b/src/views/pass/pass.vue
@@ -52,7 +52,7 @@
</template>
<script>
- import {getList, getDetail, add, update, remove} from "@/api/pass/pass";
+ import {getPage, getDetail, add, update, remove} from "@/api/pass/pass";
import option from "@/const/pass/pass";
import {mapGetters} from "vuex";
import QRCode from 'qrcodejs2';
@@ -76,7 +76,7 @@
};
},
computed: {
- ...mapGetters(["permission"]),
+ ...mapGetters(["permission","userInfo"]),
permissionList() {
return {
addBtn: this.vaildData(this.permission.pass_add, true),
@@ -91,6 +91,9 @@
ids.push(ele.id);
});
return ids.join(",");
+ },
+ permit(){
+ return this.userInfo.role_name == 'admin' || this.userInfo.role_name == 'administrator' ? true:false
}
},
methods: {
@@ -195,7 +198,12 @@
},
onLoad(page, params = {}) {
this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+
+ if (!this.permit){
+ params.userId = this.userInfo.user_id
+ }
+
+ getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
--
Gitblit v1.9.3