“zhuo”
2023-08-10 312b055ee75a14d90201e9de9024927de49d7d8b
src/views/CNAS/reviewAnnualPlan/index.vue
@@ -1,5 +1,278 @@
<template>
    <div>
        审核年度计划
  <div class="content-main">
    <div class="top-bar">
      <el-form ref="form" :inline="true">
        <el-form-item>
          <el-date-picker
            v-model="input"
            type="date"
            placeholder="请选择查询日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="getData()">查询</el-button>
          <el-button type="primary" plain @click="resetData()">重置</el-button>
        </el-form-item>
      </el-form>
      <el-form>
        <!-- 上传附件 -->
        <el-button
          class="rightBtn"
          type="primary"
          icon="el-icon-upload2"
          @click="dialogFormVisible1 = true"
          >上传附件</el-button
        >
        <el-dialog title="新增计划" :visible.sync="dialogFormVisible1">
          <el-form :model="uploadingForm">
            <el-form-item label="审核日期:" :label-width="formLabelWidth">
              <el-date-picker
                v-model="uploadingForm.auditTime"
                type="date"
                placeholder="请选择日期"
                autocomplete="off"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="录入人:" :label-width="formLabelWidth">
              <el-input
                v-model="uploadingForm.keyboarder"
                autocomplete="off"
                placeholder="请输入录入人"
              ></el-input>
            </el-form-item>
            <el-form-item label="上传附件:" :label-width="formLabelWidth">
              <el-input
                v-model="uploadingForm.attachment"
                autocomplete="off"
              ></el-input>
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button @click="dialogFormVisible1 = false">取 消</el-button>
            <el-button type="primary" @click="dialogFormVisible1 = false"
              >确 定</el-button
            >
          </div>
        </el-dialog>
        <!-- 上传计划 -->
        <el-button
          class="rightBtn"
          type="primary"
          icon="el-icon-document-add"
          @click="addPlan"
          >新增计划</el-button
        >
        <el-button
          class="rightBtn"
          type="primary"
          icon="el-icon-document-checked"
          >导出年度计划</el-button
        >
        <el-button
          class="rightBtn"
          type="primary"
          icon="el-icon-document-checked"
          >导出内部实施计划</el-button
        >
      </el-form>
    </div>
    <div class="library-table">
      <div class="table-box">
        <el-table
          ref="auditTable"
          border
          :max-height="800"
          :cell-style="{ textAlign: 'center' }"
          :header-cell-style="{
            border: '0px',
            background: '#f5f7fa',
            color: '#606266',
            boxShadow: 'inset 0 1px 0 #ebeef5',
            textAlign: 'center',
          }"
          :data="auditTable"
          style="width: 100%"
        >
          <el-table-column type="index" label="序号" min-width="30px">
            <template>
              <el-checkbox type="checkbox" />
            </template>
          </el-table-column>
          <el-table-column prop="year" label="年度" min-width="60px" />
          <el-table-column prop="month" label="月度" min-width="60px" />
          <el-table-column prop="planTime" label="计划时间" min-width="100px" />
          <el-table-column prop="auditType" label="性质" min-width="80px">
            <template slot-scope="scope">
              <span>
                {{ scope.row.auditType == 0 ? "内审" : "管理评审" }}
              </span>
            </template>
          </el-table-column>
          <el-table-column prop="department" label="部门" min-width="80px" />
          <el-table-column
            prop="auditLeader"
            label="审核组长"
            min-width="80px"
          />
          <el-table-column prop="auditEmp" label="组员" min-width="80px" />
          <el-table-column
            prop="auditPurpose"
            label="审核目的"
            min-width="100px"
          />
          <el-table-column
            prop="auditScope"
            label="审核范围"
            min-width="100px"
          />
          <el-table-column
            prop="auditPursuant"
            label="审核依据"
            min-width="100px"
          />
          <el-table-column prop="writeUser" label="编制人" min-width="80px" />
          <el-table-column prop="createTime" label="编制日期" min-width="100px">
          </el-table-column>
          <el-table-column prop="keyboarder" label="录入人" min-width="80px" />
          <el-table-column prop="checker" label="检验人" min-width="80px" />
          <el-table-column
            prop="auditTime"
            label="审核日期"
            min-width="100px"
          />
          <el-table-column prop="count" label="不符合项目数" min-width="60px" />
          <el-table-column prop="auditState" label="状态" min-width="100px">
            <template slot-scope="scope">
              <div v-if="scope.row.auditState === 0">
                <el-tag class="tag-item" type="warning">即将开始</el-tag>
              </div>
              <div v-else-if="scope.row.auditState === 1">
                <el-tag class="tag-item" type="success">完成</el-tag>
              </div>
              <div v-else>
                <el-tag class="tag-item" type="danger">逾期</el-tag>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="操作" min-width="100" fixed="right">
            <template slot-scope="scope">
              <el-button
                type="text"
                size="small"
                @click="handleClick(scope.row)"
                >查看</el-button
              >
              <el-button type="text" size="small">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页器 -->
        <div>
          <el-pagination
            :current-page="page"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { selectAllList, addCnasAnnualPlan } from "@/api/CNAS/reviewAnnualPlan";
export default {
  data() {
    return {
      input: [],
      auditTable: [],
      page: 1,
      total: 0,
      pageSize: 10,
      dialogFormVisible1: false,
      uploadingForm: {
        auditTime: "",
        keyboarder: "",
        keyboarder: "",
      },
      formLabelWidth: "80px",
    };
  },
  created() {
    this.getData();
  },
  methods: {
    // 每页条数改变时触发 选择一页显示多少行
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pageSize = val;
      this.getData();
    },
    // 当前页改变时触发 跳转其他页
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.page = val;
      this.getData();
    },
    // 重置按钮
    resetData() {
      this.input = undefined;
      this.page = 1;
      this.pageSize = 10;
      this.getData();
    },
    // 查询列表
    async getData() {
      const params = {
        page: this.page,
        pageSize: this.pageSize,
      };
      const { data } = await selectAllList(params);
      this.auditTable = data.row;
      this.total = data.total;
    },
  },
};
</script>
<style lang="scss" scoped>
.top-bar {
  margin: -25px -15px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  padding: 5px 24px 0px 24px;
}
.library-table {
  background-color: #fff;
  flex: 1;
  margin: 0px -15px;
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  .table-box {
    padding: 0px 20px;
    margin-top: 20px;
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    > div:nth-child(2) {
      display: flex;
      justify-content: end;
      margin: 10px 0;
    }
    .tag-item {
      width: 80px;
    }
  }
}
</style>