qx
qx
1 天以前 e2ce0493b0978ed2706eed28555bd83ed329cb97
src/views/system/tijian/index.vue
@@ -248,7 +248,7 @@
                <el-button v-show="lishi" type="primary" @click="cope" size="mini">一键复制</el-button>
                <el-button type="primary" @click="inputChanges" v-show="lishi" size="mini"
                  :disabled="confirm">历史体检记录</el-button>
                <el-button :disabled="isDisabled" type="primary" size="mini" @click="submitForm">登记</el-button>
                <el-button :disabled="butopen" type="primary" size="mini" @click="submitForm">登记</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" @queryTable="getList">重置</el-button>
              </div>
            </el-col>
@@ -284,7 +284,7 @@
    <el-dialog title="选择套餐" :visible.sync="taocan" width="70%" height="700px" :close-on-click-modal="false">
      <el-tabs type="border-card" style="height: 560px; margin: 0 10px; width: 100%" v-model="activeNames"
        @tab-click="handleClick">
        <el-tab-pane label="套餐" name="first">
        <el-tab-pane label="套餐" name="first" :disabled ="form.sftj == 'Y'|| form.sftj == 'y'">
          <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" v-if="showSearch" label-width="auto"
            @submit.native.prevent="handle">
            <el-form-item label="套餐名称" prop="pacName">
@@ -306,7 +306,7 @@
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane label="组合" name="third">
        <el-tab-pane label="组合" name="third" :disabled ="form.sftj == 'Y'|| form.sftj == 'y'">
          <el-row :gutter="20" style="width: 100%">
            <el-col :span="6" style="min-width: 200px">
              <div style="text-align: center; margin-bottom: 10px; margin-top: 10px;">
@@ -367,7 +367,7 @@
            </el-col>
          </el-row>
        </el-tab-pane>
        <el-tab-pane label="单项" name="second">
        <el-tab-pane label="单项" name="second" :disabled ="form.sftj == 'Y'|| form.sftj == 'y'">
          <el-row :gutter="20" style="width: 100%">
            <el-col :span="6" style="min-width: 200px">
              <div style="text-align: center; margin-bottom: 10px; margin-top: 10px;">
@@ -421,13 +421,37 @@
            </el-col>
          </el-row>
        </el-tab-pane>
        <el-tab-pane label="亲属套餐" name="four" :disabled ="form.sftj == 'N'|| form.sftj == 'n'">
          <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" v-if="showSearch" label-width="auto"
            @submit.native.prevent="handle">
            <el-form-item label="姓名" prop="pacName">
              <el-input v-model="queryParam.pacName" placeholder="请输入姓名" clearable @keyup.enter.native="handle" />
            </el-form-item>
            <el-form-item label="身份证" prop="pacName">
              <el-input v-model="queryParam.pacName" placeholder="请输入身份证" clearable @keyup.enter.native="handle" />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" size="mini" @click="handle">查询</el-button>
            </el-form-item>
          </el-form>
          <div class="tab4">
            <div class="grid-content bg-purple" style="margin-left: 5px; width: 98%">
              <el-table v-loading="loading" element-loading-text="正在加载中..." element-loading-spinner="el-icon-loading"
                border :data="newpacName" @selection-change="handleSelectionChange" height="450px" ref="tb">
                <el-table-column type="selection" width="40px" align="center" label="选择" />
                <el-table-column label="套餐名称" align="center" prop="pacName" width="120px" />
                <el-table-column label="套餐价格" align="center" prop="price" width="120px" />
                <el-table-column label="套餐明细" align="center" prop="allProName" :show-overflow-tooltip="true" />
              </el-table>
            </div>
          </div>
        </el-tab-pane>
      </el-tabs>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </el-dialog>
    <!-- -->
    <el-row v-if="tcShow">
      <el-col :span="15">
        <div class="grid-content bg-purple">
@@ -479,8 +503,15 @@
                  :max="10" :min="0" @change="debounceNumberChange" :disabled="isfalse"></el-input-number>
              </el-form-item>
              <el-form-item label="实收金额">
                <el-input placeholder="实收金额" v-model="TotalPrice" style="width: 206px" @input="changeXianjia"
                <el-input placeholder="实收金额" v-model="TotalPrice" style="width: 205px" @input="changeXianjia"
                  @blur="numberChangeXianPrice(discount, discount)" />
              </el-form-item>
              <el-form-item label="是否替检" v-if="tjtype">
                <!-- <el-input placeholder="是否替检" v-model="sftj" style="width: 150px"></el-input> -->
                 <el-select  v-model="form.sftj" placeholder="是否替检" style="width: 150px">
                  <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label"
                    :value="dict.value"></el-option>
                </el-select>
              </el-form-item>
              <br />
@@ -912,6 +943,7 @@
      // 非单个禁用
      single: true,
      cardreader: false,
      butopen:false,
      // 非多个禁用
      multiple: true,
      nodeobj: {},
@@ -923,6 +955,8 @@
      proIds: [],
      // 显示搜索条件
      showSearch: true,
      tjtype: false,
      sftj: null,
      activeNames: "first",
      // 树状形状
      Treedata: [],
@@ -954,12 +988,10 @@
        pacName: null,
        pacRemark: null,
      },
      // valueUrl: "ws://127.0.0.1:18890",
      // valueUrl: "ws://192.168.1.3:6789/websocket",
      valueUrl: "ws://127.0.0.1:6789/websocket",
      valueUrls: "ws://127.0.0.1:6789/websocket",
      // valueUrls: "ws://"+getIp() +":6789/websocket",
      // valueUrl: "ws://192.168.1.244:6789/websocket",
      // valueUrls: "ws://192.168.1.244:6789/websocket",
      webSocket: null,
      // 身份证需要
      // socket: null,
@@ -1231,6 +1263,7 @@
      this.title = "添加体检单位信息维护";
    },
    idFn1() {
      this.tjtype = true
      if (this.form.firmName) {
        const originalCompId = this.form.firmId;
        this.CompanyList.forEach((item) => {
@@ -1713,43 +1746,57 @@
    /** 登记提交按钮 */
    submitForm() {
      let _this = this;
      _this.butopen = true;
      if (!this.form.cusPhone || !this.form.cusName) {
        this.$message.warning("请填选必填项");
      } else {
        this.$refs["form"].validate((valid) => {
          if (valid) {
            // 创建表单数据的副本并去除空格
            const formData = { ...this.form };
            formData.cusName = formData.cusName ? formData.cusName.replace(/\s/g, '') : '';
            formData.cusPhone = formData.cusPhone ? formData.cusPhone.replace(/\s/g, '') : '';
            formData.cusIdcard = formData.cusIdcard ? formData.cusIdcard.replace(/\s/g, '') : '';
            // 处理性别值
            if (formData.cusSex === "女") {
              formData.cusSex = 1;
            }
            if (formData.cusSex === "男") {
              formData.cusSex = 0;
            }
            if (formData.cusSex === "未知") {
              formData.cusSex = 2;
            }
            if (formData.tjType === "") {
              formData.tjType = this.dict.type.dict_team[0].value;
            }
            addCustomer(formData).then((response) => {
              this.responseList = response.data;
              this.form.tjType = this.dict.type.dict_team[0].value;
              this.$modal.msgSuccess("新增成功");
              _this.tcShow = true;
              _this.isDisabled = true;
              _this.top = false;
            });
          }
        });
        return;
      }
      this.$refs["form"].validate((valid) => {
        if (valid) {
          // 创建表单数据的副本并去除空格
          const formData = { ...this.form };
          formData.cusName = formData.cusName ? formData.cusName.replace(/\s/g, '') : '';
          formData.cusPhone = formData.cusPhone ? formData.cusPhone.replace(/\s/g, '') : '';
          formData.cusIdcard = formData.cusIdcard ? formData.cusIdcard.replace(/\s/g, '') : '';
          // 添加 sfzImg 字段
          formData.sfzImg = this.imageUrl || ''; // 使用 base64 格式的头像数据,若为空则传空字符串
          // 处理性别值
          if (formData.cusSex === "女") {
            formData.cusSex = 1;
          }
          if (formData.cusSex === "男") {
            formData.cusSex = 0;
          }
          if (formData.cusSex === "未知") {
            formData.cusSex = 2;
          }
          if (formData.tjType === "") {
            formData.tjType = this.dict.type.dict_team[0].value;
          }
          // 可选:检查 sfzImg 是否存在
          // if (!formData.sfzImg) {
          //   this.$message.warning("请先获取身份证头像");
          //   return;
          // }
          addCustomer(formData).then((response) => {
             _this.butopen = false;
            this.responseList = response.data;
            this.form.tjType = this.dict.type.dict_team[0].value;
            this.$modal.msgSuccess("新增成功");
            _this.tcShow = true;
            _this.isDisabled = true;
            _this.top = false;
          }).catch((error) => {
             _this.butopen = false;
            this.$modal.msgError("登记失败,请检查数据");
            console.error("Error in addCustomer:", error);
          });
        }
      });
    },
    getmailType() {
@@ -1935,7 +1982,7 @@
        if (isChineseChar(resultObj.data.sex)) {
          _this.form.cusSex = resultObj.data.sex == "女" ? 1 : 0
        } else {
          _this.form.cusSex = resultObj.data.sex;
          _this.form.cusSex = resultObj.data.sex ==  "1" ? 0 : 1;
        }
        _this.form.cusNational = resultObj.data.mz;
        _this.form.cusBrithday = resultObj.data.csrq;
@@ -2083,7 +2130,13 @@
        websocket.onmessage = function (event) {
          var resultObj = JSON.parse(event.data);
          _this.form.cusName = resultObj.data.name;
          _this.form.cusSex = resultObj.data.sex;
            const isChineseChar = (char) => /[\u4E00-\u9FA5]/.test(char)
          // _this.form.cusSex = resultObj.data.sex;
           if (isChineseChar(resultObj.data.sex)) {
          _this.form.cusSex = resultObj.data.sex == "女" ? 1 : 0
        } else {
          _this.form.cusSex = resultObj.data.sex ==  "1" ? 0 : 1;
        }
          _this.form.cusNational = resultObj.data.mz;
          _this.form.cusBrithday = resultObj.data.csrq;
          if (_this.form.cusBrithday) {
@@ -2241,11 +2294,6 @@
      this.form.cusIdcard = params[0].sfzh;
      this.handleQuery();
    },
    // 上传头像
    handleAvatarSuccess(res, file) {
      this.imageUrl = URL.createObjectURL(file.raw);
    },
    beforeAvatarUpload(file) {
      const isJPG = file.type === "image/jpeg";
      const isLt2M = file.size / 1024 / 1024 < 2;
@@ -2373,6 +2421,11 @@
          });
        } else if (!this.form.firmId && this.form.firmName) {
          this.taocan = true;
          if(this.form.sftj == "Y" || this.form.sftj == "y"){
            this.activeNames = "four"
          }else{
            this.activeNames = "first"
          }
          this.loading = true;
          deptTreeSelect(cusSex).then((response) => {
            this.newpacName = response.rows;
@@ -2398,6 +2451,11 @@
        else {
          this.taocan = true;
            if(this.form.sftj == "Y" || this.form.sftj == "y"){
            this.activeNames = "four"
          }else{
            this.activeNames = "first"
          }
          this.loading = true;
          tuantiSelect(param).then((res) => {
            this.newpacName = res.data;
@@ -2422,6 +2480,11 @@
        }
      } else {
        this.taocan = true;
          if(this.form.sftj == "Y" || this.form.sftj == "y"){
            this.activeNames = "four"
          }else{
            this.activeNames = "first"
          }
        this.loading = true;
        deptTreeSelect(cusSex).then((response) => {
          this.newpacName = response.rows;
@@ -2940,9 +3003,11 @@
    // 处理订单项目
    processOrderItems(cusId) {
      console.log(11222)
      getTransitionList1(cusId).then((response) => {
        this.tableData1 = response.data;
        // if (response.data.tjCategory != null) {
        //   this.tjCategory = response.data.tjCategory;
        // }
        let Price = 0;
        if (this.tableData1) {
          this.tableData1.forEach((item) => {
@@ -3253,7 +3318,7 @@
      let _this = this;
      this.loadingSubmit = true;
      if (_this.tjCategory !== "") {
        let List = _this.tableData1; //单个项目信息
        let List = _this.tableData1; // 单个项目信息
        if (this.responseList.cusId) {
          var userId = this.responseList.cusId;
        } else {
@@ -3264,7 +3329,7 @@
          var pacId = this.tableData[0].pacId;
        }
        //tjOrderList//这个是处理完的每一项套餐信息
        // tjOrderList 处理
        List.forEach((item) => {
          if (item.list) {
            item.list.forEach((item1) => {
@@ -3290,27 +3355,30 @@
            });
          }
        });
        let copeWith = this.TotalPrice1;
        let paidIn = this.TotalPrice.toString();
        let discount = this.discount;
        this.tjFlowingWater = { copeWith, paidIn, discount };
        const newArray = this.tableData1
          .filter((item) => item.discount < 10) // 过滤出 discount < 10 的项
          .filter((item) => item.discount < 10)
          .map((item) => ({
            discount: item.discount,
            parentProId: item.parentProId,
            cusIdCard: item.cusId,
            yhj: item.nowPrice
          })); // 创建新的对象,包含 discount 和 id
            yhj: item.nowPrice,
          }));
        gaibianzhekou(newArray).then((res) => {
          this.loadingSubmit = false;
          if (res.code === 200) {
            let data;
            if (pacId || this.tjOrderList.length > 0) {
              data = {
                photo: this.srcUrl,
                photo: this.srcUrl, // 保留原有 photo 字段(如果后端仍需要)
                sfzImg: this.imageUrl, // 添加 sfzImg 字段,优先使用服务器URL,若无则使用base64
                pacId,
                tjOrderList: this.tjOrderList,
                tjFlowingWater: this.tjFlowingWater,
@@ -3323,23 +3391,10 @@
              };
              this.listgetOrder(data);
            } else if (pacId || this.tjOrderList.length > 0) {
              data = {
                photo: this.srcUrl,
                tjOrderList: this.tjOrderList,
                tjFlowingWater: this.tjFlowingWater,
                userId,
                tjType,
                tjCategory: this.tjCategory,
                firmId: this.form.firmId,
                firmName: this.form.firmName,
                firmDeptName: this.form.firmDeptName,
              };
              this.listgetOrder(data);
            } else {
              this.loadingSubmit = false;
              this.$message({
                type: "warning ",
                type: "warning",
                message: "请选择套餐!",
              });
            }