11
WXL
2024-07-17 21fe2968337eb8eab97adc88750b71c4057e98f8
src/views/project/donatefinish/index.vue
@@ -8,7 +8,6 @@
      label-width="70px"
    >
      <el-row :gutter="8">
        <el-col :span="6">
          <el-form-item label="姓名" prop="name">
            <el-input
@@ -51,13 +50,13 @@
        <el-col :span="6">
          <el-form-item label="捐献进度" prop="recordstate">
            <el-select
              v-model="queryParams.recordstate"
              v-model="queryParams.workflow"
              placeholder="请选择记录状态"
              clearable
              size="small"
            >
              <el-option
                v-for="dict in dict.type.sys_DonationStatus"
                v-for="dict in dict.type.sys_donornode"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
@@ -69,7 +68,10 @@
      <el-row :gutter="8">
        <el-col :span="6">
          <el-form-item label="报告人">
            <el-select v-model="queryParams.reporterno" placeholder="请选择报告人">
            <el-select
              v-model="queryParams.reporterno"
              placeholder="请选择报告人"
            >
              <el-option
                v-for="item in reportlist"
                :key="item.index"
@@ -111,7 +113,6 @@
            >
          </el-form-item>
        </el-col>
      </el-row>
      <!-- <el-row>
        <el-col :span="14">
@@ -136,18 +137,16 @@
      :data="donatebaseinfoList"
    >
      <el-table-column
        label="报告时间"
        label="案例时间"
        align="center"
        prop="reporttime"
        prop="donatetime"
        width="120"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.reporttime, "{y}-{m}-{d}") }}</span>
          <span>{{ parseTime(scope.row.donatetime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="姓名" align="center" prop="name" width="100" />
      <el-table-column label="性别" align="center" prop="sex" width="100">
        <template slot-scope="scope">
          <dict-tag
@@ -162,13 +161,13 @@
        align="center"
        prop="treatmenthospitalname"
      />
       <el-table-column
      <el-table-column
        label="完成时间"
        align="center"
        prop="completetime"
        width="200"
      >
       <template slot-scope="scope">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createtime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
@@ -183,13 +182,17 @@
      <el-table-column
        label="捐献进度"
        align="center"
        prop="recordstate"
        prop="workflow"
        width="120"
      >
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.sys_DonationStatus"
            :value="scope.row.recordstate"
          />
          <div v-if="!scope.row.terminationCase">
            <dict-tag
              :options="dict.type.sys_donornode"
              :value="scope.row.workflow"
            />
          </div>
          <div v-else>任务终止</div>
        </template>
      </el-table-column>
@@ -319,7 +322,7 @@
              label="器官名称"
              align="center"
              prop="organname"
              width="80"
              width="100"
            />
            <el-table-column
              label="移植医院(接收单位)"
@@ -494,31 +497,32 @@
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :disabled="loading" type="primary" @click="submitForm">保 存</el-button>
        <el-button :disabled="loading" type="primary" @click="submitForm"
          >保 存</el-button
        >
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<style scoped>
</style>
<style scoped></style>
<script>
import {
  listOrganization,
  listReportname,
  listUser,
  listUser
} from "@/api/project/organization";
import {
  listDonatebaseinfo,
  getDonatebaseinfo,
  addDonatebaseinfo,
  updateDonatebaseinfo,
  updateDonatebaseinfo
  // exportProvincemessage,
} from "@/api/project/donatebaseinfo";
import {
  updatedonatorno,
  updateDonateNumber,
  updateDonateNumber
} from "@/api/project/relativesconfirmation";
import {
  getDonatecompletioninfo,
@@ -526,25 +530,27 @@
  addDonatecompletioninfo,
  updateDonatecompletioninfo,
  listDonatecompletioninfo,
  downloadcompletioninfo,
  downloadcompletioninfo
} from "@/api/project/donatecompletioninfo";
import Li_area_select from "@/components/Address";
import OrgSelecter from "@/views/project/components/orgselect";
import AnnexUpload from "@/views/project/components/annexupload";
import { getToken } from "@/utils/auth";
import {
  listDonateorgan,
  addDonateorgan,
  delDonateorgan,
  updateDonateorgan,
  getDonateorgan,
  getDonateorgan
} from "@/api/project/donateorgan";
export default {
  components: {
    Li_area_select,
    OrgSelecter,
    AnnexUpload,
    AnnexUpload
  },
  name: "Donatefinish",
  dicts: [
@@ -563,12 +569,12 @@
    "sys_Infectious",
    "sys_InfoSources",
    "sys_OtherCases",
    "sys_DonationStatus",
    "sys_donornode",
    "sys_DiseaseType",
    "sys_SelfWill",
    "sys_FamilyRelation",
    "sys_Organ",
    "sys_organstate",
    "sys_organstate"
  ],
  data() {
    return {
@@ -592,7 +598,7 @@
        { label: "衢州市", value: "8" },
        { label: "舟山市", value: "9" },
        { label: "台州市", value: "A" },
        { label: "丽水市", value: "B" },
        { label: "丽水市", value: "B" }
      ],
      //省市区
@@ -601,17 +607,17 @@
        sheng: "",
        shi: "",
        qu: "",
        organizationname: null,
        organizationname: null
      },
      residenceAddresss: {
        sheng: "浙江省",
        shi: "",
        qu: "",
        qu: ""
      },
      registerAddresss: {
        sheng: "浙江省",
        shi: "",
        qu: "",
        qu: ""
      },
      //用户表
@@ -644,6 +650,9 @@
      open: false,
      // 获取组织名称时间范围
      daterangeReporttime: [],
      headers: {
        Authorization: "Bearer " + getToken()
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
@@ -659,30 +668,30 @@
        donorno: null,
        reportername: null,
        reporttime: null,
        city: null,
        city: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        completetime: [
          { required: true, message: "请输入完成时间", trigger: "blur" },
          { required: true, message: "请输入完成时间", trigger: "blur" }
        ],
        coordinatedusernameo: [
          { required: true, message: "请选择协调员一", trigger: "blur" },
          { required: true, message: "请选择协调员一", trigger: "blur" }
        ],
        coordinatedusernamet: [
          { required: true, message: "请选择协调员二", trigger: "blur" },
          { required: true, message: "请选择协调员二", trigger: "blur" }
        ],
        responsibleusername: [
          { required: true, message: "请选择负责人", trigger: "blur" },
        ],
          { required: true, message: "请选择负责人", trigger: "blur" }
        ]
      },
      curCase: {
        donorno: "",
        name: "",
        registerAddresss: "",
        infoid: "",
        infoid: ""
      },
      //器官列表
      // donateorganList: [],
@@ -692,13 +701,14 @@
      //流程名称
      flowname: "捐献完成登记",
      //流程名称-伦理审查
      annexno: "",
      annexno: ""
    };
  },
  created() {
    // this.getDicts('country').then(res=>{
    //   this.nationality =res.data
    // })
    if (sessionStorage.getItem("donatefinish")) {
      this.queryParams = JSON.parse(sessionStorage.getItem("donatefinish"));
      console.log(this.queryParams, "queryParams");
    }
  },
  activated() {
    this.selecttime = "";
@@ -711,9 +721,7 @@
    if (this.$route.params.starttime != null && this.$route.params.endtime) {
      this.selecttime = [
        this.$moment(this.$route.params.starttime).format("YYYY-MM-DD"),
        this.$moment(this.$route.params.endtime)
          .add(-1, "month")
          .format("YYYY-MM-DD"),
        this.$moment(this.$route.params.endtime).format("YYYY-MM-DD")
      ];
    }
    if (this.$route.params.reporterno != "") {
@@ -750,14 +758,14 @@
  },
  methods: {
    LoadReportList() {
      listDonatebaseinfo().then((res) => {
      listDonatebaseinfo().then(res => {
        console.log("潜在捐献表", res);
        let list = res.rows;
        let reportlist = [];
        list.forEach((element) => {
        list.forEach(element => {
          reportlist.push({
            reporterno: element.reporterno,
            reportername: element.reportername,
            reportername: element.reportername
          });
        });
        console.log("dwada", reportlist);
@@ -769,7 +777,7 @@
    },
    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));
@@ -836,7 +844,7 @@
    },
    updatedonorno(row) {
      console.log("row", row);
      updatedonatorno(row.infoid).then((res) => {
      updatedonatorno(row.infoid).then(res => {
        console.log("1221212", res);
        this.getList();
      });
@@ -847,7 +855,7 @@
      if (e.organstate === 99) {
        this.$prompt("请输入启用原因", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          cancelButtonText: "取消"
        })
          .then(({ value }) => {
            console.log("启用原因", value);
@@ -856,7 +864,7 @@
          .catch(() => {
            this.$message({
              type: "info",
              message: "取消",
              message: "取消"
            });
          });
      }
@@ -864,28 +872,28 @@
    //获取用户表
    getuserlist() {
      listUser().then((res) => {
      listUser().then(res => {
        this.users = res.data;
      });
    },
    //获取负责人
    getLeaderList() {
      listReportname("fzr").then((res) => {
      listReportname("fzr").then(res => {
        this.leaderlist = res.data;
      });
    },
    //获取协调员一
    getCoordinatorList1() {
      listReportname("xty1").then((res) => {
      listReportname("xty1").then(res => {
        this.coordinatorlist1 = res.data;
      });
    },
    //获取协调员二
    getCoordinatorList2() {
      listReportname("xty2").then((res) => {
      listReportname("xty2").then(res => {
        this.coordinatorlist2 = res.data;
      });
    },
@@ -949,9 +957,12 @@
    getList() {
      this.loading = true;
      this.queryParams.params = {};
      sessionStorage.removeItem("donatefinish");
      sessionStorage.setItem("donatefinish", JSON.stringify(this.queryParams));
      if (null != this.daterangeReporttime && "" != this.daterangeReporttime) {
        this.queryParams.params["beginReporttime"] =
          this.daterangeReporttime[0];
        this.queryParams.params[
          "beginReporttime"
        ] = this.daterangeReporttime[0];
        this.queryParams.params["endReporttime"] = this.daterangeReporttime[1];
      }
@@ -967,7 +978,7 @@
        // this.queryParams.residenceprovince = this.$refs.areaSelect.getSheng();
        // this.queryParams.residencecity = this.$refs.areaSelect.getShi();
        // this.queryParams.residencetown = this.$refs.areaSelect.getQu();
        listnewDonatecompletioninfo(this.queryParams).then((response) => {
        listnewDonatecompletioninfo(this.queryParams).then(response => {
          this.donatebaseinfoList = response.rows;
          this.total = response.total;
          this.loading = false;
@@ -1003,7 +1014,7 @@
        coordinatedusernamet: null,
        assessannex: null,
        donateorgan: "",
        donateorganList: [],
        donateorganList: []
      };
      this.resetForm("form");
    },
@@ -1029,7 +1040,7 @@
        reportername: null,
        reporttime: null,
        city: null,
        treatmenthospitalno: null,
        treatmenthospitalno: null
      };
      this.selecttime = [];
      this.getTimeList();
@@ -1037,7 +1048,7 @@
        sheng: "",
        shi: "",
        qu: "",
        organizationname: null,
        organizationname: null
      };
      //this.$refs.areaSelect.clean();
@@ -1057,7 +1068,7 @@
        path: "/organ/donationdetails/",
        query: {
          id: row.id,
          organType: "edit",
          organType: "edit"
        }
      });
      // this.reset();
@@ -1136,15 +1147,15 @@
      //查询
      let searchParam = {
        id: row.id,
        id: row.id
      };
      let oraganqueryParam = {
        infoid: row.id,
        infoid: row.id
        // donorname: this.curCase.name,
        // donorno: this.curCase.donorno,
        // registeraddress: this.curCase.registeraddresss,
      };
      listDonateorgan(oraganqueryParam).then((response) => {
      listDonateorgan(oraganqueryParam).then(response => {
        if (response.code == 200) {
          console.log("2", response);
          this.tableData = response.rows;
@@ -1155,7 +1166,7 @@
        //获取器官分配信息
        // this.GetDonortedList();
      });
      listnewDonatecompletioninfo(searchParam).then((response) => {
      listnewDonatecompletioninfo(searchParam).then(response => {
        if (response.code == 200 && response.rows.length == 1) {
          this.open = true;
          this.form = response.rows[0];
@@ -1175,7 +1186,7 @@
    /** 提交按钮 */
    submitForm() {
      this.loading = true;
      this.$refs["form"].validate((valid) => {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.form.donorno = this.curCase.donorno;
          this.form.infoid = this.curCase.id;
@@ -1184,33 +1195,36 @@
          //负责人 //leaderlist
          let responsibleuseridIndex = this.leaderlist.findIndex(
            (item) => this.form.responsibleuserid == item.reportNo
            item => this.form.responsibleuserid == item.reportNo
          );
          if (responsibleuseridIndex > -1) {
            this.form.responsibleusername =
              this.leaderlist[responsibleuseridIndex].reportName;
            this.form.responsibleusername = this.leaderlist[
              responsibleuseridIndex
            ].reportName;
          }
          //协调员1
          let coordinatedusernameIndex = this.coordinatorlist1.findIndex(
            (item) => this.form.coordinateduserido == item.reportNo
            item => this.form.coordinateduserido == item.reportNo
          );
          if (coordinatedusernameIndex > -1) {
            this.form.coordinatedusernameo =
              this.coordinatorlist1[coordinatedusernameIndex].reportName;
            this.form.coordinatedusernameo = this.coordinatorlist1[
              coordinatedusernameIndex
            ].reportName;
          }
          //协调员2
          let coordinatedusernametIndex = this.coordinatorlist1.findIndex(
            (item) => this.form.coordinateduseridt == item.reportNo
            item => this.form.coordinateduseridt == item.reportNo
          );
          if (coordinatedusernametIndex > -1) {
            this.form.coordinatedusernamet =
              this.coordinatorlist1[coordinatedusernametIndex].reportName;
            this.form.coordinatedusernamet = this.coordinatorlist1[
              coordinatedusernametIndex
            ].reportName;
          }
          if (this.form.id != null) {
            console.log("更新form", this.form);
            updateDonatecompletioninfo(this.form).then((response) => {
            updateDonatecompletioninfo(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.loading = false;
              this.open = false;
@@ -1218,15 +1232,16 @@
              //更新器官表
              for (let k = 0; k < this.tableData.length; k++) {
                try {
                  this.tableData[k].transplanthospitalname =
                    this.$refs.transplanthosselect.getOptionByValue(
                      this.tableData[k].transplanthospitalno
                    ).organizationname;
                  this.tableData[
                    k
                  ].transplanthospitalname = this.$refs.transplanthosselect.getOptionByValue(
                    this.tableData[k].transplanthospitalno
                  ).organizationname;
                } catch {
                  console.log("获取机构名称失败!");
                }
                updateDonateorgan(this.tableData[k]).then((response1) => {
                updateDonateorgan(this.tableData[k]).then(response1 => {
                  if (response1.code == 200) {
                    // this.$modal.msgSuccess("器官记录修改成功");
                  }
@@ -1235,10 +1250,10 @@
              //更新捐献状态
              this.curCase.recordstate = 12;
              getDonatebaseinfo(this.curCase.infoid).then((res) => {
              getDonatebaseinfo(this.curCase.infoid).then(res => {
                let donatebasedata = res.data;
                donatebasedata.recordstate = 12;
                updateDonatebaseinfo(donatebasedata).then((response) => {
                updateDonatebaseinfo(donatebasedata).then(response => {
                  //this.$modal.msgSuccess("审核成功");
                  //this.isShowReviewDialog = false;
                  this.getList();
@@ -1246,22 +1261,23 @@
              });
            });
          } else {
            addDonatecompletioninfo(this.form).then((response) => {
              this.loading=false
            addDonatecompletioninfo(this.form).then(response => {
              this.loading = false;
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              //更新器官表
              for (let k = 0; k < this.tableData.length; k++) {
                try {
                  this.tableData[k].transplanthospitalname =
                    this.$refs.transplanthosselect.getOptionByValue(
                      this.tableData[k].transplanthospitalno
                    ).organizationname;
                  this.tableData[
                    k
                  ].transplanthospitalname = this.$refs.transplanthosselect.getOptionByValue(
                    this.tableData[k].transplanthospitalno
                  ).organizationname;
                } catch {
                  console.log("获取机构名称失败");
                }
                updateDonateorgan(this.tableData[k]).then((response1) => {
                updateDonateorgan(this.tableData[k]).then(response1 => {
                  if (response1.code == 200) {
                    this.$modal.msgSuccess("器官记录修改成功");
                  }
@@ -1270,15 +1286,14 @@
              //更新捐献状态
              this.curCase.recordstate = 12;
              updateDonatebaseinfo(this.curCase).then((response) => {
              updateDonatebaseinfo(this.curCase).then(response => {
                //this.$modal.msgSuccess("审核成功");
                //this.isShowReviewDialog = false;
                this.getList();
              });
            });
          }
        }
        else{
        } else {
          this.loading = false;
        }
      });
@@ -1289,32 +1304,32 @@
      this.$confirm("是否确认将登记记录上报?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          //查找是否存在登记完成记录
          //判断是否存在上报记录
          let searchParam = {
            infoid: row.id,
            infoid: row.id
          };
          console.log("上报参数", searchParam);
          listDonatecompletioninfo(searchParam).then((response) => {
          listDonatecompletioninfo(searchParam).then(response => {
            console.log("上报", response);
            if (response.code == 200 && response.rows.length == 1) {
              row.recordstate = 13;
              row.birthday = this.$moment(row.birthday).format(
                "YYYY-MM-DD HH:mm:ss"
              );
              updateDonatebaseinfo(row).then((response1) => {
              updateDonatebaseinfo(row).then(response1 => {
                this.$message({
                  type: "success",
                  message: "上报成功",
                  message: "上报成功"
                });
              });
            } else {
              this.$message({
                type: "error",
                message: "捐献完成登记记录不存在!",
                message: "捐献完成登记记录不存在!"
              });
            }
            this.loading = false;
@@ -1323,7 +1338,7 @@
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消上报",
            message: "已取消上报"
          });
        });
    },
@@ -1332,18 +1347,36 @@
    handledownload(row) {
      const id = row.id || this.ids;
      console.log("22222", row);
      downloadcompletioninfo(row.dcid).then((response) => {
        var fileUrl = response;
      downloadcompletioninfo(row.dcid).then(res => {
        var fileUrl = res;
        //获取当前网址
        var urlBase = process.env.VUE_APP_BASE_API;
        var curWWWPath = window.document.location.href;
        var pos = curWWWPath.indexOf(window.document.location.pathname);
        // 创建a标签
        var aEle = document.createElement("a");
        aEle.href =
          curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"];
        aEle.click();
        console.log(aEle.href);
        // 添加Authorization头部
        fetch(aEle.href, {
          headers: this.headers
        })
          .then(response => {
            // 将文件下载链接作为blob对象进行下载
            return response.blob();
          })
          .then(blob => {
            const url = window.URL.createObjectURL(new Blob([blob]));
            console.log(url);
            const link = document.createElement("a");
            link.href = url;
            const name = fileUrl["downloadName"];
            link.setAttribute("download", name); // 替换file.pdf为实际的文件名
            document.body.appendChild(link);
            link.click();
            link.parentNode.removeChild(link);
          });
      });
    },
@@ -1351,9 +1384,9 @@
    GetDonortedList(row) {
      this.loading = true;
      let oraganqueryParam = {
        infoid: row.infoid,
        infoid: row.infoid
      };
      listDonateorgan(oraganqueryParam).then((response) => {
      listDonateorgan(oraganqueryParam).then(response => {
        this.loading = false;
        if (response.code == 200) {
          this.form.donateorganList = [];
@@ -1366,7 +1399,7 @@
          // this.$modal.msgError("获取捐献器官失败:" + response.msg);
        }
      });
    },
  },
    }
  }
};
</script>