fuliqi
2024-04-30 c46e3ad03a8c5fb27b0361d219babca0e537ad77
src/views/system/result/detail/index1.vue
@@ -50,17 +50,22 @@
        <el-table-column label="分数" prop="score" align="center">
        </el-table-column>
        <el-table-column label="状态" prop="publish" align="center">
        </el-table-column>
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button size="small" type="text"  v-show="scope.row.publish != 1">确认发布</el-button>
            <el-button size="small" type="text"  v-show="scope.row.publish == 1">取消发布</el-button>
            <dict-tag :options="dict.type.platform_is_publish" :value="scope.row.publish" />
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="scope">
            <div style="display: flex;justify-content: center;">
            <el-button size="small" type="text" @click="handlePublish(scope.row)" v-if="scope.row.publish === 'UNPUBLISHED'" >确认发布</el-button>
            <el-button size="small" type="text" @click="handlePublish(scope.row)" v-if="scope.row.publish === 'PUBLISHED'">取消发布</el-button>
            <el-button
              size="mini"
              type="text"
              icon="el-icon-view"
              @click="handleDetail(scope.row.id)"
            >详细</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
@@ -68,8 +73,8 @@
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      :page.sync="queryParamsList.pageNum"
      :limit.sync="queryParamsList.pageSize"
      @pagination="getList"
    />
@@ -86,11 +91,15 @@
let observer = null;
export default {
  name: 'index',
  dicts: ['platform_examine_use', 'platform_examine_category'],
  dicts: ['platform_examine_category','platform_is_publish'],
  data() {
    return {
      activeIndex: '0',
      areaList: [],
      province: {
        id: [],
        publish: null,
      },
      date: '',
      dateRange: '',
      // 总条数
@@ -101,7 +110,14 @@
        deptId: null,
        examineTag:0
      },
      queryParamsList: {
        pageNum: 1,
        pageSize: 10,
        deptId: null,
        examineTag:0
      },
      tableData: [],
      tableLoading: false,
      loading: false,
      searchForm: {
        time: null,
@@ -113,20 +129,54 @@
    console.log(this.$route.query.index)
    if (this.$route.query.index) {
      this.queryParams.deptId = this.$route.query.index
      this.queryParamsList.deptId = this.$route.query.index
    }
    const date = new Date();
    const year = date.getFullYear();
    const month = (date.getMonth() + 1) >= 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1);
    this.date = year + '-' + month;
    this.queryParams.date = this.date;
    this.queryParams.examineTag =this.$route.query.examineTag;
    this.queryParamsList.examineTag =this.$route.query.examineTag;
    this.activeIndex = this.$route.query.examineTag;
    this.areaSelect();
    this.getChart(this.$route.query.index)
    this.getList(this.$route.query.index);
  },
  computed: {
  },
  methods: {
    //发布
    handlePublish(row) {
      const getExamineCategoryText = category => {
        switch (category) {
          case 1: return '视频考核';
          case 2: return '车辆考核';
          case 3: return '人脸考核';
          default: return '未知';
        }
      };
      const year = row.createTime.substr(0, 4);
      const month = (parseInt(row.createTime.substr(5, 2), 10)).toString();
      const day = (parseInt(row.createTime.substr(8, 2), 10)).toString();
      const formattedCreateTime = year + '年' + month + '月' + day + '日';
      let text = row.publish === 'UNPUBLISHED' ? '发布' : '取消发布';
      this.province.id = [row.id]
      this.province.publish = text === "发布" ? "PUBLISHED" : "UNPUBLISHED";
      this.$modal.confirm('确认要' + text + "" + getExamineCategoryText(row.examineCategory) + "" + formattedCreateTime + '的考核成绩吗?')
        .then(() => {
          return publishScore(this.province);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess(text + "成功");
        })
        .catch(() => {
          // 错误处理逻辑
        });
    },
    // 区域下拉数据
    areaSelect() {
      areaSelect().then(res => {
@@ -141,8 +191,9 @@
    handleSelect(key) {
      this.activeIndex = key;
      this.queryParams.examineTag = key;
      this.queryParamsList.examineTag = key;
      this.getChart(this.queryParams.deptId);
      this.getList(this.queryParams.deptId);
      this.getList(this.queryParamsList.deptId);
    },
    /** 查询考核模板列表 */
    getChart(deptId) {
@@ -156,7 +207,7 @@
    /** 查询考核模板列表 */
    getList() {
      this.tableLoading = true;
      detailScore(this.queryParams).then(response => {
      detailScore(this.queryParamsList).then(response => {
        this.tableData = response.rows;
        this.total = response.total;
        this.tableLoading = false;
@@ -173,6 +224,8 @@
        path: '/examine/detail/detail',
        query: {
          id: id,
          examineTag: this.activeIndex,
          deptId: this.queryParamsList.deptId
        }
      })
    },
@@ -206,7 +259,7 @@
        series: [
          {
            name: '车辆考核',
            data: this.filterData(dataList, 0),
            data: this.filterData(dataList, 2),
            type: 'line',
            itemStyle: {
              color: 'rgba(62, 144, 247, 1)'
@@ -214,7 +267,7 @@
          },
          {
            name: '人脸考核',
            data: this.filterData(dataList, 1),
            data: this.filterData(dataList, 3),
            type: 'line',
            itemStyle: {
              color: 'rgba(85, 192, 191, 1)'
@@ -222,7 +275,7 @@
          },
          {
            name: '视频考核',
            data: this.filterData(dataList, 2),
            data: this.filterData(dataList, 1),
            type: 'line',
            itemStyle: {
              color: 'rgba(255, 165, 0, 1)'
@@ -262,6 +315,10 @@
    },
    getAllDay() {
      // const date = new Date();
      // const year = date.getFullYear();
      // const month = (date.getMonth() + 1) >= 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1);
      // this.date = year + '-' + month;
      const currentDate = this.date.split('-');
      const currentYear = currentDate[0];
      const currentMonth = currentDate[1];