EvaluateReport.vue 13.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531
<template>
  <div class="flex h-full w-full flex-col gap-4">
    <!-- 顶部搜索 -->
    <div class="w-ful flex items-center justify-between">
      <div class="flex items-center gap-4">
        <el-button
          type="primary"
          size="small"
          :loading="exportLoading"
          @click="exportExcel"
          >导出</el-button
        >
        <div class="text-[#909399]">
          评价次数:<span class="take-total-num">{{ total }}</span>
        </div>
        <div class="text-[14px] text-[#909399]">
          统计时间段:{{ searchForm.time[0] }} ~ {{ searchForm.time[1] }}
        </div>
      </div>
      <div class="flex items-center">
        <el-form ref="searchForm" inline size="small" :model="searchForm">
          <el-form-item>
            <el-select style="width: 130px" v-model="searchForm.type">
              <el-option
                v-for="(v, key) in searchType"
                :key="key"
                :label="v"
                :value="key"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-input
              v-model="searchForm.keyword"
              placeholder="请输入关键字"
              clearable
              @keyup.native.enter="handleSearch"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <y-date-picker
              v-model="searchForm.time"
              align="right"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            >
            </y-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="handleSearch">搜索</el-button>
          </el-form-item>
        </el-form>
      </div>
      <el-popover placement="bottom" trigger="click">
        <div class="w-full">
          <el-form ref="searchForm2" inline size="small" :model="searchForm2">
            <el-form-item>
              <el-select
                style="width: 150px"
                v-model="searchForm2.pjOption"
                clearable
                placeholder="请选择评价选项"
              >
                <el-option
                  v-for="(v, key) in dict.pjOption"
                  :key="key"
                  :label="key"
                  :value="v"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-select
                style="width: 180px"
                filterable
                clearable
                v-model="searchForm2.sectionName"
                placeholder="请选择部门"
              >
                <el-option
                  v-for="v in deptList"
                  :key="v.id"
                  :label="v.name"
                  :value="v.name"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-select
                style="width: 180px"
                v-model="searchForm2.hallName"
                filterable
                clearable
                placeholder="请选择大厅"
              >
                <el-option
                  v-for="v in hallList"
                  :key="v.id"
                  :label="v.hallName"
                  :value="v.hallName"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-select
                style="width: 150px"
                v-model="searchForm2.pjSource"
                clearable
                placeholder="请选择评价来源"
              >
                <el-option
                  v-for="(v, key) in dict.pjSource"
                  :key="key"
                  :label="key"
                  :value="v"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-select
                style="width: 150px"
                v-model="searchForm2.pjType"
                clearable
                placeholder="请选择评价指向"
              >
                <el-option
                  v-for="(v, key) in dict.pjType"
                  :key="key"
                  :label="key"
                  :value="v"
                ></el-option>
              </el-select>
            </el-form-item>

            <el-form-item>
              <el-button type="primary" @click="handleSearch">搜索</el-button>
            </el-form-item>
          </el-form>
        </div>
        <el-button type="text" slot="reference">
          高级搜索
          <i class="el-icon-d-arrow-right"></i>
        </el-button>
      </el-popover>
    </div>
    <div class="main max-w-[1396px] flex-1">
      <div>
        <y-table
          ref="MyTable"
          :loading="loading"
          :data="tableData"
          :column="column"
          border
          tooltip-effect="dark"
          :max-height="580"
          :row-key="(row) => row.id"
          @selection-change="handleSelectionChange"
        ></y-table>
      </div>
      <Pagination
        :total="total"
        :current.sync="current"
        :size.sync="size"
        @get="getEvaluateList"
      ></Pagination>
    </div>
    <!-- 详情 -->
    <EvaluateDetails :show.sync="show" :info="detailsInfo"></EvaluateDetails>
  </div>
</template>

<script>
import EvaluateDetails from "./components/EvaluateDetails.vue";
import { getEvaluateList } from "@/api/market";
import { getDepartment, getHall } from "@/api/site";
import { dataSection } from "@/utils";
import { export2Excel } from "@/utils/exportExcel";
import storage from "@/utils/storage";
let searchType = {
  windowFromnum: "按窗口编号",
  peopleName: "按群众姓名",
  peoplePhone: "按群众手机号",
};
export default {
  components: {
    EvaluateDetails,
  },
  data() {
    return {
      show: false,
      loading: false,
      exportLoading: false,
      searchType,
      size: 10,
      current: 1,
      total: 0,
      searchForm: {
        type: "windowFromnum",
        keyword: "",
        time: [
          this.$moment().format("YYYY-MM-DD"),
          this.$moment().format("YYYY-MM-DD"),
        ],
        siteId: storage.get(2, "siteId"),
      },
      searchForm2: {
        pjOption: "", // 评价选项
        sectionName: "", // 部门名称
        hallName: "", // 大厅名称
        pjSource: "", // 评价来源
        pjType: "", // 评价指向
      },
      tableData: [],
      dict: {},
      selectionRows: [],
      detailsInfo: {},
      deptList: [], // 部门列表
      hallList: [], // 大厅列表
      column: [
        {
          type: "selection",
          width: "50",
          align: "center",
          reserveSelection: true,
          fixed: "left",
        },
        {
          type: "index",
          label: "序号",
          width: "50",
          align: "center",
          fixed: "left",
          index: (index) => {
            return index + 1 + (this.current - 1) * this.size;
          },
        },
        {
          label: "站点名称",
          align: "center",
          width: "150",
          prop: "siteName",
        },
        {
          label: "身份证号",
          align: "center",
          width: "150",
          prop: "peopleIdcard",
        },
        {
          label: "姓名",
          align: "center",
          width: "150",
          prop: "peopleName",
        },
        {
          label: "性别",
          align: "center",
          width: "150",
          prop: "peopleSex",
        },
        {
          label: "手机号",
          align: "center",
          width: "150",
          prop: "peoplePhone",
        },
        {
          label: "评价选项",
          align: "center",
          width: "150",
          prop: "pjOption",
        },
        {
          label: "评价标签",
          align: "center",
          width: "150",
          prop: "contentTag",
        },
        {
          label: "部门",
          align: "center",
          width: "150",
          prop: "sectionName",
        },
        {
          label: "大厅",
          align: "center",
          width: "150",
          prop: "hallName",
        },
        {
          label: "评价来源",
          align: "center",
          width: "150",
          prop: "pjSource",
        },
        {
          label: "手输意见",
          align: "center",
          width: "150",
          prop: "opinion",
        },
        {
          label: "窗口名",
          align: "center",
          width: "150",
          prop: "windowName",
        },
        {
          label: "窗口编号",
          align: "center",
          width: "150",
          prop: "windowFromnum",
        },
        {
          label: "窗口评价",
          align: "center",
          width: "150",
          prop: "pjxt",
        },
        {
          label: "工作人员",
          align: "center",
          width: "150",
          prop: "workmanName",
        },
        {
          label: "工号",
          align: "center",
          width: "150",
          prop: "workmanNumber",
        },
        {
          label: "评价状态",
          align: "center",
          width: "150",
          prop: "evaluatestatus",
        },
        {
          label: "评价指向",
          align: "center",
          width: "150",
          prop: "pjType",
        },
        {
          label: "评价时间",
          align: "center",
          width: "150",
          prop: "pjTime",
        },

        {
          label: "扩展编号",
          align: "center",
          width: "150",
          prop: "extNum",
        },
        {
          label: "操作",
          align: "center",
          fixed: "right",
          width: "100",
          formatter: (row) => {
            return (
              <span
                class="primary cursor-pointer"
                onClick={() => {
                  this.checkDetails(row);
                }}
              >
                查看详情
              </span>
            );
          },
        },
      ],
    };
  },
  created() {
    this.getEvaluateList();
    this.getDepartment();
    this.getHall();
  },
  methods: {
    // 获取站点
    getSite(data) {
      this.current = 1;
      this.size = 10;
      if (data.type == "site") {
        this.searchForm.siteId = data.id;
        this.getEvaluateList();
        this.getDepartment();
        this.getHall();
      } else {
        this.tableData = [];
        this.total = 0;
      }
    },
    // 获取数据函数
    async getData(form = {}) {
      let obj = {
        page: this.current,
        size: this.size,
        pjTimeStart: this.searchForm.time[0],
        pjTimeEnd: this.searchForm.time[1],
        siteId: this.searchForm.siteId,
      };
      let val = `%${this.searchForm.keyword}%`;
      obj[this.searchForm.type] = val;

      let res = await getEvaluateList({
        ...obj,
        ...this.searchForm2,
        ...form,
      });
      if (res.data.code == 1) {
        return res.data.data;
      } else {
        return {
          data: [],
          total: 0,
        };
      }
    },

    // 获取表格数据
    async getEvaluateList(form = {}) {
      this.loading = true;
      let { data, total, dict } = await this.getData(form);
      data.forEach((v) => {
        v.pjTime = this.$moment(v.pjTime).format("YYYY-MM-DD HH:mm:ss");
      });
      this.tableData = data;
      this.total = total;
      this.dict = dict;
      this.loading = false;
    },

    // 获取站点部门
    async getDepartment() {
      let res = await getDepartment({
        page: 1,
        size: -1,
        siteId: this.searchForm.siteId,
      });
      if (res.data.code == 1) {
        let { data } = res.data.data;
        this.deptList = data;
      }
    },

    // 获取大厅
    async getHall() {
      let res = await getHall({
        page: 1,
        size: -1,
        siteId: this.searchForm.siteId,
      });
      if (res.data.code == 1) {
        let { data } = res.data.data;
        this.hallList = data;
      }
    },

    checkDetails(row) {
      let data = this.$cloneDeep(row);
      this.detailsInfo = data;
      this.show = true;
    },
    handleSelectionChange(rows) {
      this.selectionRows = rows;
    },
    handleSearch() {
      this.current = 1;
      this.$clearSelection("MyTable");
      this.getEvaluateList();
    },
    // 导出表格
    exportExcel() {
      this.exportLoading = true;
      let table = this.column.filter((v) => v.prop);
      let tHeader = table.map((v) => v.label);
      let filterVal = table.map((v) => v.prop);
      if (this.selectionRows.length) {
        let data = this.$cloneDeep(this.selectionRows);
        export2Excel(
          tHeader,
          filterVal,
          data,
          "评价数据报表" + this.$moment().format("YYYYMMDDHHmmss")
        );
      } else {
        dataSection(this.getData, {}, (data) => {
          if (!data.length) {
            this.$message.warning("暂无数据");
            return;
          }
          data.forEach((v) => {
            v.pjTime = this.$moment(v.pjTime).format("YYYY-MM-DD HH:mm:ss");
          });
          export2Excel(
            tHeader,
            filterVal,
            data,
            "评价数据报表" + this.$moment().format("YYYYMMDDHHmmss")
          );
        });
      }
      this.exportLoading = false;
    },
  },
};
</script>

<style lang="less" scoped>
.take-total-num {
  color: var(--primary);
  font-weight: 600;
}
:deep(.el-form--inline) {
  display: flex;
  align-items: center;
  .el-form-item {
    margin-bottom: 0px;
  }
}
.el-icon-d-arrow-right {
  transform: rotate(90deg);
}
</style>