马宇豪
2023-10-07 21e03c21386fb124774df48c8bb1fe3b185dbb48
src/views/coalMine/cViolationRegistration/index.vue
@@ -3,7 +3,7 @@
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="用户姓名" prop="userName">
        <el-input
          v-model="queryParams.userName"
          v-model="queryParams.name"
          placeholder="请输入用户姓名"
          clearable
          @keyup.enter.native="handleQuery"
@@ -17,19 +17,20 @@
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单位名称" prop="idCard">
      <el-form-item label="单位名称" prop="dept">
        <el-input
          v-model="queryParams.unit"
          v-model="queryParams.dept"
          placeholder="请输入单位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="作业类型">
      <el-form-item label="操作类型">
        <el-cascader
          v-model="classiFy"
          :options="expertTypes"
          :props="{ expandTrigger: 'hover', value: 'id',label: 'label'}"
          v-model="queryParams.operateTypeId"
          :options="typeList"
          :show-all-levels="false"
          :props="{ expandTrigger: 'hover', value: 'id',label: 'name',emitPath:false}"
          @change="handleChange"></el-cascader>
      </el-form-item>
      <el-form-item>
@@ -44,27 +45,35 @@
          type="primary"
          plain
          size="mini"
          @click="handleAdd"
          @click="openViolation({},'add')"
          v-hasPermi="['system:experts:add']"
        >新增填报</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="expertList">
      <el-table-column label="发生时间" align="center" prop="name" />
    <el-table v-loading="loading" :data="dataList">
      <el-table-column label="发生时间" align="center" prop="violationTime" />
      <el-table-column label="姓名" align="center" prop="name" />
      <el-table-column label="身份证号" align="center" prop="name" />
      <el-table-column label="IC/电子证编号" align="center" prop="phone"/>
      <el-table-column label="所属单位" align="center" prop="phone"/>
      <el-table-column label="作业种类" align="center" prop="phone"/>
      <el-table-column label="身份证号" align="center" prop="idCard" />
      <el-table-column label="IC卡编号" align="center" prop="icNum"/>
      <el-table-column label="电子证编号" align="center" prop="electNum"/>
      <el-table-column label="所属单位" align="center" prop="dept"/>
      <el-table-column label="作业种类" align="center" prop="jobCategory"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleView(scope.row)"
            @click="openViolation(scope.row,'view')"
          >查看违规详情</el-button>
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-edit"-->
<!--            @click="openViolation(scope.row,'edit')"-->
<!--            v-hasPermi="['system:experts:remove']"-->
<!--          >编辑</el-button>-->
          <el-button
            size="mini"
            type="text"
@@ -78,62 +87,122 @@
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageIndex"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <add-dialog ref="addDialogRef" @getList = "getList"></add-dialog>
    <violation-dialog ref="violationDialog" @getList="getList" :typeList="typeList"></violation-dialog>
  </div>
</template>
<script>
import addDialog from "@/views/notCoalMine/nViolationRegistration/components/addDialog.vue";
import violationDialog from "@/views/coalMine/cViolationRegistration/components/violationDialog.vue";
import {delViolation, getViolationPage} from "@/api/coalMine/violation";
import {getOperatePage} from "@/api/coalMine/operateType";
import {delPeople} from "@/api/coalMine/people";
export default {
  name: "nViolationRegistration",
  name: "cViolationRegistration",
  dicts: [],
  components: {
    addDialog
    violationDialog
  },
  data() {
    return {
      addDialogRef: '',
      violationDialog: '',
      loading: false,
      single: true,
      multiple: true,
      showSearch: true,
      addForm: false,
      dataList: [],
      total: 0,
      expertTypes: [],
      expertList: [],
      queryParams: {},
      classiFy: [],
      form: {},
      rules: {
        classifyName: [
          { required: true, message: "分类名称不能为空", trigger: "blur" }
        ]
      }
      typeList: [],
      queryParams: {
        name: '',
        idCard:'',
        dept: '',
        operateTypeId: null,
        isCm: 1,
        pageNum: 1,
        pageSize: 10
      },
    };
  },
  created() {
    this.getList()
    this.getTypeList()
  },
  methods: {
    getList(){
    async getList(){
      const t = this
      t.loading = true
      const res = await getViolationPage(t.queryParams)
      if(res.code == 200){
        t.dataList = res.rows
        t.total = res.total
      }else{
        t.$message({
          message: res.msg,
          type: 'warning'
        })
      }
      t.loading = false
    },
    async getTypeList() {
      this.loading = true;
      const res = await getOperatePage({name: ''})
      if(res.code == 200){
        this.typeList = this.handleTree(res.data, "id");
      }else{
        this.$message({
          type: 'warning',
          message: res.msg
        });
      }
      this.loading = false;
    },
    handleChange(){
    },
    handleQuery(){
    handleDelete(row){
      this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        const res = await delViolation(row.violationId)
        if(res.code == 200){
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
          await this.getList()
        }else{
          this.$message({
            type: 'warning',
            message: res.msg
          });
        }
      }).catch(() => {
      });
    },
    handleQuery(){
      this.queryParams.pageNum = 1
      this.getList()
    },
    resetQuery(){
      this.queryParams = {
        name: '',
        idCard:'',
        dept: '',
        operateTypeId: null,
        isCm: 1,
        pageNum: 1,
        pageSize: 10
      }
      this.getList()
    },
    handleAdd(){
      this.$refs.addDialogRef.openDialog();
    openViolation(data,type){
      this.$refs.violationDialog.openDialog(data,type);
    }
  }
};