保安服务企业管理项目备份
guoshilong
2023-12-11 edc6f2fa032afad319a795bac741424b534de9fb
考试须知
2 files added
284 ■■■■■ changed files
src/api/exam/examinationNote.js 51 ●●●●● patch | view | raw | blame | history
src/views/exam/examinationNote.vue 233 ●●●●● patch | view | raw | blame | history
src/api/exam/examinationNote.js
New file
@@ -0,0 +1,51 @@
import request from '@/router/axios';
export const getPage = (current, size, params) => {
  return request({
    url: '/api/exam/examinationNote/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/exam/examinationNote/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}
export const save = (row) => {
  return request({
    url: '/api/exam/examinationNote/save',
    method: 'post',
    data: row
  })
}
export const update = (row) => {
  return request({
    url: '/api/exam/examinationNote/update',
    method: 'post',
    data: row
  })
}
export const getDetail = (params) => {
  return request({
    url: '/api/exam/examinationNote/detail',
    method: "get",
    params:{
      params
    }
  })
}
src/views/exam/examinationNote.vue
New file
@@ -0,0 +1,233 @@
<template>
  <basic-container
    :class="[
      'exam-card-body',
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page"
               :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave"
               @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
               @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
               @refresh-change="refreshChange" @on-load="onLoad">
<!--      <template slot="menuLeft">-->
<!--        <el-button-->
<!--          type="danger"-->
<!--          size="small"-->
<!--          icon="el-icon-delete"-->
<!--          plain-->
<!--          @click="handleDelete"-->
<!--        >删 除-->
<!--        </el-button>-->
<!--      </template>-->
    </avue-crud>
  </basic-container>
</template>
<script>
import {mapGetters} from "vuex";
import {getPage,save,update,remove,getDetail} from "@/api/exam/examinationNote";
export default {
  name: "examinationNote",
  data(){
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      editorOption:{
        propsHttp: {
          res: 'data',
          url: 'link'
        },
        action: "/api/blade-resource/oss/endpoint/put-file-attach"
      },
      option: {
        height: 'auto',
        calcHeight: 160,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true,
        index: true,
        indexLabel: '序号',
        searchBtnText: '查 询',
        emptyBtnText: '重 置',
        emptyBtnIcon: 'el-icon-refresh',
        viewBtn: false,
        selection: false,
        dialogClickModal: false,
        refreshBtn: false,
        columnBtn: false,
        searchShowBtn: false,
        column: [
          {
            label: "内容",
            prop: "content",
            component: "AvueUeditor",
            options: {
              action: "/api/blade-resource/oss/endpoint/put-file",
              props: {
                res: "data",
                url: "link"
              }
            },
            minRows: 4,
            span: 24,
            rules: [{
              required: true,
              message: "请输入内容",
              trigger: "blur"
            }],
          },
        ]
      },
      data: [],
    }
  },
  computed: {
    ...mapGetters(["permission","userInfo"]),
    permissionList () {
      return {
        addBtn: this.vaildData(this.permission.patrolRecord_add, false),
        viewBtn: this.vaildData(this.permission.patrolRecord_view, true),
        delBtn: this.vaildData(this.permission.patrolRecord_delete, false),
        editBtn: this.vaildData(this.permission.patrolRecord_edit, false)
      }
    },
    ids () {
      let ids = []
      this.selectionList.forEach(ele => {
        ids.push(ele.id)
      })
      return ids.join(",")
    }
  },
  methods: {
    rowSave (row, done, loading) {
      save(row).then(() => {
        this.onLoad(this.page)
        this.$message({
          type: "success",
          message: "操作成功!"
        })
        done()
      }, error => {
        loading()
      })
    },
    rowUpdate (row, index, done, loading) {
      update(row).then(() => {
        this.onLoad(this.page)
        this.$message({
          type: "success",
          message: "操作成功!"
        })
        done()
      }, error => {
        loading()
      })
    },
    rowDel (row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return remove(row.id)
        })
        .then(() => {
          this.onLoad(this.page)
          this.$message({
            type: "success",
            message: "操作成功!"
          })
        })
    },
    handleDelete () {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据")
        return
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids)
        })
        .then(() => {
          this.onLoad(this.page)
          this.$message({
            type: "success",
            message: "操作成功!"
          })
          this.$refs.crud.toggleSelection()
        })
    },
    beforeOpen (done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail({id:this.form.id}).then(res => {
          this.form = res.data.data
        })
      }
      done()
    },
    searchReset () {
      this.query = {}
      this.onLoad(this.page)
    },
    searchChange (params, done) {
      this.query = params
      this.page.currentPage = 1
      this.onLoad(this.page, params)
      done()
    },
    selectionChange (list) {
      this.selectionList = list
    },
    selectionClear () {
      this.selectionList = []
      this.$refs.crud.toggleSelection()
    },
    currentChange (currentPage) {
      this.page.currentPage = currentPage
    },
    sizeChange (pageSize) {
      this.page.pageSize = pageSize
    },
    refreshChange () {
      this.onLoad(this.page, this.query)
    },
    onLoad (page, params = {}) {
      this.loading = true
      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()
      })
    },
  }
}
</script>
<style scoped>
</style>