大件运输联网系统前端代码
guoshilong
2022-12-20 b2832a9c5d287b8a11c0e7ba312bfd45f195d8df
通行证、评价页面非管理员只能看见自己的数据
6 files modified
217 ■■■■■ changed files
src/api/evaluation/evaluation.js 12 ●●●●● patch | view | raw | blame | history
src/api/pass/pass.js 12 ●●●●● patch | view | raw | blame | history
src/const/evaluation/evaluation.js 40 ●●●● patch | view | raw | blame | history
src/const/pass/pass.js 5 ●●●●● patch | view | raw | blame | history
src/views/evaluation/evaluation.vue 134 ●●●●● patch | view | raw | blame | history
src/views/pass/pass.vue 14 ●●●● patch | view | raw | blame | history
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',
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',
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: "是否已删除",
src/const/pass/pass.js
@@ -22,11 +22,6 @@
      hide: true,
    },
    {
      label: "名字",
      prop: "name",
      type: "input",
    },
    {
      label: "编号",
      prop: "no",
      type: "input",
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>
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;