yxh
昨天 0e5553e2390bb336e589e5b7f0fa890d59aed735
src/views/project/statistics/performanceStaristics/index.vue
@@ -1,129 +1,81 @@
<!--  -->
<template>
  <div class="app-container">
    绩效
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      label-width="70px"
    >
      <el-row :gutter="8">
        <el-col :span="6">
          <el-form-item label="业务人员" prop="name">
            <el-input
              v-model="queryParams.name"
              placeholder="请输入姓名"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item align="left" label="业务组" prop="treatmenthospitalno">
            <org-selecter
              ref="orgSelecter"
              :org-type="'3'"
              v-model="queryParams.treatmenthospitalno"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="案例状态">
    <el-form class="opo-query-form" :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
      <el-row :gutter="4">
        <!-- <el-col :span="6">
          <el-form-item align="left" label="业务组" prop="padeptno">
            <el-select
              v-model="queryParams.reporterno"
              placeholder="请选择案例状态"
              v-model="queryParams.padeptno"
              placeholder="请选择部门、业务组"
            >
              <el-option
                v-for="item in reportlist"
                :key="item.index"
                :label="item.reportername"
                :value="item.reporterno"
                v-for="item in deptList"
                :label="item.deptName"
                :value="item.deptId"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="8">
        <el-col :span="12">
        </el-col> -->
        <el-col :span="8">
          <el-form-item label="统计日期">
            <el-date-picker
              style="width: 100%"
              v-model="selecttime"
              type="monthrange"
              range-separator="至"
              start-placeholder="开始月份"
              end-placeholder="结束月份"
              value-format="yyyy-MM-dd"
              @change="getTimeList"
            >
            <el-date-picker style="width: 100%" v-model="selecttime" type="monthrange" range-separator="至"
              start-placeholder="开始月份" end-placeholder="结束月份" value-format="yyyy-MM-dd" @change="getTimeList">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="5">
          <el-form-item label="绩效类型">
            <el-radio-group v-model="queryParams.pabonustype">
              <el-radio v-for="item in reporttype" :key="item.value" :label="item.value">{{ item.label }}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="5">
          <el-form-item label="绩效人员" prop="pauserno">
            <el-input v-model="queryParams.pausername" placeholder="请输入姓名" clearable size="small"
              @keyup.enter.native="handleQuery" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" :loading="exportLoading"
          @click="handleExport">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <!--<el-table v-loading="loading" border :data="donatebaseinfoList">     -->
    <el-table v-loading="loading" border :data="jxidata">
    <el-table v-loading="loading" :data="jxidata" ref="table" border max-height="700" highlight-current-row
      :summary-method="getSummaries" show-summary>
      <el-table-column label="序号" align="center" prop="id" width="100">
      </el-table-column>
      <el-table-column label="统计月份" align="center" prop="name" />
      <el-table-column label="业务组" align="center" prop="name">
      </el-table-column>
      <el-table-column label="专职人员" align="center" prop="age" />
      <el-table-column
        label="案例数量"
        align="center"
        prop="treatmenthospitalname"
      />
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
        fixed="right"
      >
      <el-table-column label="统计月份" align="center" prop="bonusmonth" />
      <el-table-column label="科室业务组" align="center" prop="deptName">      </el-table-column>
      <el-table-column label="绩效人员/医院" align="center" prop="beneficiaryname" />
      <el-table-column label="绩效金额" align="center" prop="amount" :formatter="amountFormatter" />
      <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
        <template slot-scope="scope">
          <!--           v-if="scope.row.recordstate==2"
 -->
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleAdd(scope.row)"
            >医学评估</el-button
          >
          <el-button size="mini" type="text" icon="el-icon-edit">明细</el-button>
        </template>
      </el-table-column>
      </el-table-column> -->
    </el-table>
    <div style="margin: 10px;text-align: right;">
      <div>
        共 <span style="color:#1890FF ;">{{ total }}</span> 条数据
      </div>
    </div>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 添加或修改家属确认对话框 -->
  </div>
@@ -134,17 +86,11 @@
//例如:import 《组件名称》 from '《组件路径》';
import {
  listDonatebaseinfo,
  getDonatebaseinfo,
  addDonatebaseinfo,
  updateDonatebaseinfo
} from "@/api/project/donatebaseinfo";
import {
  listsfeistatistics,
  listbxiaostatistics,
  listjixstatistics,
  listanlstatistics
  listanlstatistics,
  exportPerformanceStatistics
} from "@/api/project/statistics";
import { listUser } from "@/api/project/organization";
@@ -152,6 +98,8 @@
import Li_area_select from "@/components/Address";
import OrgSelecter from "@/views/project/components/orgselect";
import AnnexUpload from "@/views/project/components/annexupload";
import { listDept } from "@/api/system/dept";
export default {
  //import引入的组件需要注入到对象中才能使用
@@ -172,7 +120,12 @@
      selecttime: "",
      reportervalue: "",
      reportlist: [],
      reporttype: [
        { label: "全部", value: "0" },
        { label: "月度", value: "68" },
        { label: "季度", value: "69" },
        { label: "年度", value: "70" }
      ],
      //省市区
      //默认值设置,可为空
      searchAddress: {
@@ -210,6 +163,7 @@
        shi: "",
        qu: ""
      },
      deptList: [],
      // 遮罩层
      loading: false,
      // 导出遮罩层
@@ -236,11 +190,13 @@
      daterangeReporttime: [],
      // 查询参数
      queryParams: {
        pabonustype: null,
        pageNum: 1,
        pageSize: 10
        pabonustype: "0",
        pabegtime: null,
        paendtime: null,
        pausername: "",
        padeptno: null,
      },
      // 表单参数
      form: {},
      // 表单校验
@@ -260,8 +216,8 @@
  },
  //监听属性 类似于data概念
  computed: {},
  activated() {},
  mounted() {},
  activated() { },
  mounted() { },
  //监控data中的数据变化
  watch: {},
@@ -269,78 +225,29 @@
  methods: {
    getTimeList(e) {
      if (this.selecttime != 0) {
        this.endtime = this.selecttime[1];
        this.starttime = this.selecttime[0];
        // if (this.endtime == this.starttime) {
        let num = Number(this.endtime.slice(5, 7));
        if (num < 9) {
          let mon = Number(this.endtime.slice(6, 7));
          this.endtime =
            this.endtime.slice(0, 5) +
            "0" +
            (mon + 1) +
            "-" +
            "01" +
            " " +
            "00" +
            ":" +
            "00" +
            ":" +
            "00";
        }
        // this.endtime=this.endtime.slice(0,5)年
        else if (num >= 10) {
          this.endtime =
            this.endtime.slice(0, 5) +
            (num + 1) +
            "-" +
            "01" +
            " " +
            "00" +
            ":" +
            "00" +
            ":" +
            "00";
        } else {
          this.endtime =
            this.endtime.slice(0, 5) +
            "10" +
            "-" +
            "01" +
            " " +
            "00" +
            ":" +
            "00" +
            ":" +
            "00";
        }
        this.starttime = this.starttime + " " + "00" + ":" + "00" + ":" + "00";
        this.queryParams.pabegtime = this.selecttime[0];
        this.queryParams.paendtime = this.selecttime[1];
        // if (this.queryParams.paendtime == this.queryParams.pabegtime) {
        // 结束时间取"所选结束月的次月 1 号",以包含整个结束月。
        // 原实现把月份 +1 后直接拼字符串,12 月会得到 13 月(2026-13-01),
        // MySQL 报 Incorrect datetime value,存储过程直接 500。
        this.queryParams.paendtime = this.$moment(this.queryParams.paendtime)
          .startOf("month")
          .add(1, "month")
          .format("YYYY-MM")
          .concat("-01 00:00:00");
        this.queryParams.pabegtime =
          this.queryParams.pabegtime + " " + "00" + ":" + "00" + ":" + "00";
        // }
      } else {
        // this.starttime = "1998-01-01 00:00:00";
        // this.endtime = "2998-01-01 00:00:00";
        // this.queryParams.pabegtime = "1998-01-01 00:00:00";
        // this.queryParams.paendtime = "2998-01-01 00:00:00";
      }
    },
    LoadReportList() {
      listDonatebaseinfo().then(res => {
        let list = res.rows;
        let reportlist = [];
        list.forEach(item => {
          reportlist.push({
            reporterno: item.reporterno,
            reportername: item.reportername
          });
        });
        if (reportlist != 0) {
          reportlist = this.resetArr(reportlist);
          this.reportlist = reportlist;
        }
      });
    },
    resetArr(Arr) {
      var hash = {};
      Arr = Arr.reduce(function(arr, current) {
      Arr = Arr.reduce(function (arr, current) {
        hash[current.reporterno]
          ? ""
          : (hash[current.reporterno] = true && arr.push(current));
@@ -349,13 +256,53 @@
      return Arr;
    },
    /** 查询捐献基础列表 */
    getList() {
      listjixstatistics(this.queryParams).then(res => {
        this.jxidata = res.rows;
      });
    /** 组装查询参数:未选择统计日期时查全部,绩效类型为空按全部 */
    buildQueryParams() {
      const query = { ...this.queryParams };
      if (!query.pabegtime || !query.paendtime) {
        // 新 SP 默认取近 6 个月,而绩效 jxrq 数据集中在 2023-08~2024-01,默认会查不到
        query.pabegtime = "2000-01-01 00:00:00";
        query.paendtime = "2999-12-31 23:59:59";
      }
      if (!query.pabonustype) {
        query.pabonustype = "0";
      }
      return query;
    },
    /** 查询捐献基础列表 */
    getList() {
      listjixstatistics(this.buildQueryParams()).then(res => {
        this.jxidata = res.rows;
        this.jxidata.forEach(($obj, $index) => {
          $obj.id = $index + 1;
        });
        this.total = res.total;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.buildQueryParams();
      this.$modal
        .confirm("是否确认导出当前筛选条件下的绩效统计数据?")
        .then(() => {
          this.exportLoading = true;
          return exportPerformanceStatistics(queryParams);
        })
        .then(response => {
          this.$download.name(response.msg);
          this.exportLoading = false;
        })
        .catch(() => {
          this.exportLoading = false;
        });
    },
    listDept() {
      listDept({}).then(response => {
        this.deptList = response.data;
        this.loading = false;
      });
    },
    // 表单重置
    reset() {
      this.form = {};
@@ -371,25 +318,13 @@
      this.reportervalue = "";
      this.form.treatmenthospitalno = "";
      this.queryParams = {
        doname: null,
        pageNum: 1,
        pageSize: 10,
        name: null,
        idcardno: null,
        residenceprovince: null,
        residencecity: null,
        residencetown: null,
        // "2"
        recordstate: null,
        treatmenthospitalname: null,
        donorno: null,
        acquisitiontissueno: null,
        reportername: null,
        reporttime: null,
        city: null
        pabonustype: "0",
        pabegtime: null,
        paendtime: null,
        pausername: "",
        padeptno: null
      };
      this.selecttime = [];
      this.getTimeList();
@@ -402,6 +337,52 @@
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 金额显示:保留两位小数,0.00 不显示 */
    formatAmount(value) {
      if (value === null || value === undefined || value === "") {
        return "";
      }
      const num = Number(value);
      if (!Number.isFinite(num) || num === 0) {
        return "";
      }
      return num.toFixed(2);
    },
    amountFormatter(row, column, cellValue) {
      return this.formatAmount(cellValue);
    },
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      var columnnames = ["applymonth", "deptmentName", "username", "deptName", "beneficiaryname"];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
          return;
        }
        //去除部分字段计算
        if (columnnames.indexOf(column.property) > -1) {
          return;
        }
        const values = data.map(item => Number(item[column.property]));
        if (!values.every(value => isNaN(value))) {
          const total = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return prev;
            }
          }, 0);
          // 合计保留 2 位小数;0.00 不显示
          sums[index] = total === 0 ? "" : Number(total).toFixed(2);
        } else {
          sums[index] = "";
        }
      });
      return sums;
    }
  },
@@ -409,6 +390,7 @@
  created() {
    //获取列表
    this.getList();
    this.listDept();
  }
  // //生命周期 - 挂载完成(可以访问DOM元素)
  //    mounted() {},