qx
2025-04-10 0d22dac3090ad057a5470610a321c936cdf0d535
Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb_region
6个文件已修改
1676 ■■■■■ 已修改文件
src/views/advice/advice/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/doctor/checkAll/index.vue 1160 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/doctor/inspectCheck/index.vue 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/doctor/pacsCheck/index.vue 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hosp/project/index.vue 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/package/index.vue 358 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/advice/advice/index.vue
@@ -7,6 +7,7 @@
      :inline="true"
      v-show="showSearch"
      label-width="68px"
      @submit.native.prevent
    >
      <el-form-item label="项目名称" prop="proName">
        <el-input
src/views/doctor/checkAll/index.vue
@@ -35,12 +35,10 @@
    <template>
      <el-table v-loading="loading" :data="checkList" ref="table" border style="margin: 20px; width: 98%"
        @current-change="handleCurrentChange">
        <!-- <template slot="empty">数据正在加载中</template> -->
        <el-table-column label="体检号" align="center" prop="tjNumber" :show-overflow-tooltip="true" width="160px"
          fixed="left" />
        <el-table-column label="姓名" align="center" prop="cusName" :show-overflow-tooltip="true" width="100px"
          fixed="left" />
        <el-table-column label="性别" align="center" prop="cusSex" :show-overflow-tooltip="true" width="55px">
          <template slot-scope="scope">
            <span v-if="scope.row.cusSex == '0'">男</span>
@@ -51,14 +49,6 @@
        </el-table-column>
        <el-table-column label="出生日期" align="center" prop="cusBrithday" :show-overflow-tooltip="true" width="110px" />
        <el-table-column label="电话" align="center" prop="cusPhone" :show-overflow-tooltip="true" width="130px" />
        <!-- <el-table-column
          label="体检时间"
          align="center"
          prop="tjTime"
          :show-overflow-tooltip="true"
          width="110px"
        /> -->
        <el-table-column label="审核时间" align="center" prop="shsj" :show-overflow-tooltip="true" width="180px" />
        <el-table-column label="完成时间" align="center" prop="finishTime" :show-overflow-tooltip="true" width="160px" />
        <el-table-column label="状态" align="center" prop="tjStatus" :show-overflow-tooltip="true" width="120px">
@@ -78,7 +68,6 @@
              icon="el-icon-edit-outline"></el-button>
            <el-button fixed="right" title="详情" type="text" size="mini" @click.stop="handleClick(scope.row)"
              icon="el-icon-document-copy"></el-button>
            <!-- <el-button type="text" size="mini" @click="generate(scope.row)" v-if="scope.row.tjStatus=='1'">生成</el-button> -->
            <el-button type="text" size="mini" @click.stop="viewReport(scope.row)" v-if="scope.row.tjStatus == '1'"
              title="预览" icon="el-icon-view"></el-button>
            <el-button type="text" size="mini" v-if="scope.row.tjStatus == '1'" title="撤销"
@@ -104,47 +93,19 @@
          <caption style="background-color: #f8f8f9; font-size: 18px">
            {{ tableAll.cusName }}的体检资料
          </caption>
          <tr style="
              border: 1px solid #dfe6ec;
              border-collapse: collapse;
              height: 36px;
            ">
          <tr style="border: 1px solid #dfe6ec; border-collapse: collapse; height: 36px;">
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">姓名:</td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">{{ tableAll.cusName }}</td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">性别:</td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              姓名:
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              {{ tableAll.cusName }}
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              性别:
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              {{
                tableAll.cusSex == 0
                  ? "男"
                  : tableAll.cusSex == 1
                    ? "女"
                    : "未知"
              }}
              {{ tableAll.cusSex == 0 ? "男" : tableAll.cusSex == 1 ? "女" : "未知" }}
            </td>
          </tr>
          <tr style="
              border: 1px solid #dfe6ec;
              border-collapse: collapse;
              height: 36px;
            ">
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              体检单号:
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              {{ tableAll.tjNumber }}
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              体检时间:
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              {{ tableAll.tjTime }}
            </td>
          <tr style="border: 1px solid #dfe6ec; border-collapse: collapse; height: 36px;">
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">体检单号:</td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">{{ tableAll.tjNumber }}</td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">体检时间:</td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">{{ tableAll.tjTime }}</td>
          </tr>
        </table>
        <i class="el-icon-close" @click="guanbi"></i>
@@ -165,7 +126,6 @@
        <div class="btn1" v-if="msgjianqian == 'y' || msgjianqian == 'Y'">
          <el-button @click="jianqian()" type="primary"><span class="vertical-text">检前问诊</span></el-button>
        </div>
        <div class="btn1">
          <el-button @click="xiangmuqingkuang()" type="primary"><span class="vertical-text">项目情况</span></el-button>
        </div>
@@ -177,11 +137,7 @@
        <div class="left-container">
          <div class="left">
            <div v-for="(item, index) in changedate" :key="index">
              <div style="
                  text-align: center;
                  background-color: #aad8df;
                  margin-top: 10px;
                ">
              <div style="text-align: center; background-color: #aad8df; margin-top: 10px;">
                {{ item.parent || "" }}
              </div>
              <div v-if="item.xmlb == '0'">
@@ -192,13 +148,10 @@
                      <div>{{ scope.row.proName }}</div>
                    </template>
                  </el-table-column>
                  <el-table-column align="center" prop="proResult" label="检测结果" width="180">
                  </el-table-column>
                  <el-table-column align="center" prop="proResult" label="检测结果" width="180"></el-table-column>
                  <el-table-column align="center" prop="" label="单位">
                    <template slot-scope="scope">
                      <div v-if="scope.row.project != null">
                        {{ scope.row.standard.company || "" }}
                      </div>
                      <div v-if="scope.row.project != null">{{ scope.row.standard.company || "" }}</div>
                      <div v-else>{{ scope.row.proAdvice }}</div>
                    </template>
                  </el-table-column>
@@ -206,11 +159,7 @@
                  <el-table-column align="center" prop="" label=" 参考范围">
                    <template slot-scope="scope">
                      <div v-if="scope.row.project != null">
                        {{
                          scope.row.standard.tjStandardGtValue ||
                          "/" + "-" + scope.row.standard.tjStandardLtValue ||
                          "/"
                        }}
                        {{ scope.row.standard.tjStandardGtValue || "/" + "-" + scope.row.standard.tjStandardLtValue || "/" }}
                      </div>
                      <div v-else>{{ scope.row.stanId || "/" }}</div>
                    </template>
@@ -218,50 +167,26 @@
                </el-table>
                <table style="width: 100%" v-if="tjproject != '1'">
                  <tr style="border: 1px solid #dfe6ec; border-collapse: collapse">
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 7%;
                      ">
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 7%;">
                      小结:
                    </td>
                    <td style="border: 1px solid #dfe6ec; width: 45%">
                      <el-input v-model="item.remark" disabled></el-input>
                    </td>
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 15%;
                      ">
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 15%;">
                      主检医师:
                    </td>
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="2">
                      {{ item.doctorName }}
                    </td>
                  </tr>
                  <tr style="
                      border: 1px solid #dfe6ec;
                      border-collapse: collapse;
                      width: 200px;
                    ">
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 240px;
                      ">
                  <tr style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 200px;">
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 240px;">
                      备注:
                    </td>
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="3">
                      <el-input type="textarea" autosize placeholder="请输入内容" v-model="changedate[index].remark"
                        v-on:input="change" style="width: 100%">
                      </el-input>
                      <!-- <textarea
                        placeholder="请输入内容"
                        :autosize="{ minRows: 2 }"
                        style="width: 100%; height: 240px; resize: none"
                        v-model="changedate[index].remark"
                        v-on:input="change"
                      ></textarea> -->
                        v-on:input="change" style="width: 100%"></el-input>
                    </td>
                  </tr>
                </table>
@@ -269,54 +194,23 @@
              <div v-else>
                <table style="width: 100%" v-if="tjproject != '1'">
                  <tr style="border: 1px solid #dfe6ec">
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 15%;
                        height: auto;
                      ">
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 15%; height: auto;">
                      检查所见:
                    </td>
                    <td style="border: 1px solid #dfe6ec; height: auto" colspan="2">
                      <el-input type="textarea" autosize placeholder="请输入内容" v-model="item.jgbx" style="width: 100%">
                      </el-input>
                      <!-- <textarea
                        placeholder="请输入内容"
                        :autosize="{ minRows: 3}"
                        style="width: 100%; height: auto; resize: none"
                        v-model="item.jgbx"
                      ></textarea> -->
                      <el-input type="textarea" autosize placeholder="请输入内容" v-model="item.jgbx" style="width: 100%"></el-input>
                    </td>
                  </tr>
                  <tr style="border: 1px solid #dfe6ec; border-collapse: collapse">
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 15%;
                      ">
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 15%;">
                      检查提示:
                    </td>
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="2">
                      <el-input type="textarea" autosize placeholder="请输入内容" v-model="item.remark" style="width: 100%">
                      </el-input>
                      <!-- <textarea
                        placeholder="请输入内容"
                        style="width: 100%;  resize: none"
                        v-model="item.remark"
                      ></textarea> -->
                      <el-input type="textarea" autosize placeholder="请输入内容" v-model="item.remark" style="width: 100%"></el-input>
                    </td>
                  </tr>
                  <tr style="
                      border: 1px solid #dfe6ec;
                      border-collapse: collapse;
                      width: 200px;
                    ">
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 15%;
                      ">
                  <tr style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 200px;">
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 15%;">
                      主检医师:
                    </td>
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="2">
@@ -334,8 +228,7 @@
            <el-form ref="numberValidateForm" label-width="80px" class="demo-ruleForm" v-if="tjproject != '1'">
              <el-form-item label="总检建议">
                <el-input type="textarea" placeholder="请输入内容" v-model="textarea1" :rows="3" style="width: 96%">
                </el-input>
                <el-input type="textarea" placeholder="请输入内容" v-model="textarea1" :rows="3" style="width: 96%"></el-input>
              </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footers">
@@ -352,11 +245,7 @@
          <div class="right">
            <template v-if="status1 == 0">
              <div v-for="(item, index) in yichangList" :key="index">
                <div style="
                    text-align: center;
                    background-color: #67c23a;
                    margin-top: 10px;
                  ">
                <div style="text-align: center; background-color: #67c23a; margin-top: 10px;">
                  {{ item.proName || "" }}
                </div>
                <template v-if="item.jyjc == '0'">
@@ -367,8 +256,7 @@
                        <div style="padding: 10px;">
                          <!-- 内容区域 -->
                          <div v-if="props.row.advices && props.row.advices.length > 0">
                            <div v-for="(jianyi, index1) in props.row.advices" :key="index1"
                              style="margin-bottom: 10px">
                            <div v-for="(jianyi, index1) in props.row.advices" :key="index1" style="margin-bottom: 10px">
                              <div>
                                标题:
                                <el-input v-model="jianyi.bt" size="small" type="textarea" autosize
@@ -381,7 +269,6 @@
                              </div>
                            </div>
                          </div>
                          <!-- 如果 advices 为空时,渲染空的输入框 -->
                          <div v-else>
                            <div>
@@ -395,28 +282,20 @@
                                @blur="handleAdviceBlur(props.row, -1)"></el-input>
                            </div>
                          </div>
                          <div style="margin-top: 10px;">
                            <el-button @click="shanchu(props.row)" type="danger" size="small">删除</el-button>
                          </div>
                        </div>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" label="检测项目" :show-overflow-tooltip="true" width="353">
                      <template slot-scope="scope">
                        <div>{{ scope.row.proName }}</div>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" prop="proResult" label="检测结果" width="85">
                    </el-table-column>
                    <el-table-column align="center" prop="stanId" label=" 参考范围" width="117">
                    </el-table-column>
                    <el-table-column align="center" prop="proAdvice" label="单位" width="78">
                    </el-table-column>
                    <el-table-column align="center" prop="proResult" label="检测结果" width="85"></el-table-column>
                    <el-table-column align="center" prop="stanId" label=" 参考范围" width="117"></el-table-column>
                    <el-table-column align="center" prop="proAdvice" label="单位" width="78"></el-table-column>
                  </el-table>
                </template>
                <template v-if="item.jyjc == '1'">
@@ -427,8 +306,7 @@
                        <div style="padding: 10px;">
                          <!-- 内容区域 -->
                          <div v-if="props.row.advices && props.row.advices.length > 0">
                            <div v-for="(jianyi, index1) in props.row.advices" :key="index1"
                              style="margin-bottom: 10px">
                            <div v-for="(jianyi, index1) in props.row.advices" :key="index1" style="margin-bottom: 10px">
                              <div>
                                标题:
                                <el-input v-model="jianyi.bt" size="small" type="textarea" autosize
@@ -441,7 +319,6 @@
                              </div>
                            </div>
                          </div>
                          <!-- 如果 advices 为空时,渲染空的输入框 -->
                          <div v-else>
                            <div>
@@ -455,41 +332,31 @@
                                @blur="handleAdviceBlur(props.row, -1)"></el-input>
                            </div>
                          </div>
                          <div style="margin-top: 10px;">
                            <el-button @click="shanchu(props.row)" type="danger" size="small">删除</el-button>
                          </div>
                        </div>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" label="检测项目" width="232" :show-overflow-tooltip="true">
                      <template slot-scope="scope">
                        <div>{{ scope.row.proName }}</div>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" prop="proResult" label="检测结果" width="403">
                    </el-table-column>
                    <el-table-column align="center" prop="proResult" label="检测结果" width="403"></el-table-column>
                  </el-table>
                </template>
              </div>
            </template>
            <template v-if="status1 == 1">
              <div>
                <div style="
                    text-align: center;
                    background-color: #e6a23c;
                    margin-top: 10px;
                  ">
                <div style="text-align: center; background-color: #e6a23c; margin-top: 10px;">
                  项目检查情况
                </div>
                <el-table :row-style="redxiangmu" :data="statusList" style="width: 100%"
                  :header-cell-style="{ background: '#e6a23c' }">
                  <el-table-column align="center" label="部门" width="144" prop="deptName">
                  </el-table-column>
                  <el-table-column align="center" prop="proName" label="项目" width="260">
                  </el-table-column>
                  <el-table-column align="center" label="部门" width="144" prop="deptName"></el-table-column>
                  <el-table-column align="center" prop="proName" label="项目" width="260"></el-table-column>
                  <el-table-column label="状态" align="center" prop="type" :show-overflow-tooltip="true" width="120">
                    <template slot-scope="scope">
                      <span v-if="scope.row.type == '0'">未审核</span>
@@ -578,7 +445,6 @@
            <el-collapse-item title="烟酒史" name="4">
              <div style="width: 100%">
                <el-form-item label="是否吸烟" prop="xiyan">
                  <!-- <el-input v-model="form.xiyanpinlv" placeholder="请输入吸烟频率" /> -->
                  <el-select disabled filterable v-model="formobj.xiyan" placeholder="请选择是否吸烟" clearable
                    style="width: 150px">
                    <el-option v-for="dict in dict.type.tj_smoking_pinlv" :key="dict.value" :label="dict.label"
@@ -589,9 +455,9 @@
                  <el-input v-model="formobj.xiyanpinlv" disabled style="width: 70px" />支/天
                </el-form-item>
                <el-form-item label="吸烟时间" prop="xiyanyear">
                  <el-input v-model="formobj.xiyanyear" disabled style="width: 70px" />年 </el-form-item><br />
                  <el-input v-model="formobj.xiyanyear" disabled style="width: 70px" />年
                </el-form-item><br />
                <el-form-item label="是否饮酒" prop="yinjiu">
                  <!-- <el-input v-model="form.yinjiupinlv" placeholder="请输入饮酒频率" /> -->
                  <el-select filterable v-model="formobj.yinjiu" disabled placeholder="请选择是否饮酒" clearable
                    style="width: 150px">
                    <el-option v-for="dict in dict.type.tj_smoking_pinlv" :key="dict.value" :label="dict.label"
@@ -634,7 +500,6 @@
                  </el-table-column>
                  <el-table-column label="是否痊愈" prop="isOk">
                    <template slot-scope="scope">
                      <!-- <el-input v-model="scope.row.isOk" placeholder="请输入是否痊愈" /> -->
                      <el-select disabled filterable size="mini" v-model="scope.row.isOk" placeholder="请选择是否痊愈"
                        clearable>
                        <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label"
@@ -650,7 +515,6 @@
                </el-table>
              </div>
            </el-collapse-item>
            <el-collapse-item title="职业史" name="7">
              <div style="width: 100%">
                <el-table border :data="formobj.workLogs" style="width: 98%">
@@ -688,7 +552,6 @@
                  </el-table-column>
                  <el-table-column label="有害因素" prop="harmTypeLogs">
                    <template slot-scope="scope">
                      <!-- <el-input v-model="scope.row.isOk" placeholder="请输入是否痊愈" /> -->
                      <el-select filterable disabled size="mini" v-model="scope.row.harmTypeLogs" multiple
                        placeholder="请选择有害因素" clearable>
                        <el-option v-for="dict in harmTypeList" :key="dict.aid" :label="dict.harmtype"
@@ -741,20 +604,18 @@
        <el-form-item label="单位" prop="dw">
          <el-input v-model="newItem.dw" placeholder="请输入单位" clearable></el-input>
        </el-form-item>
        <!-- 动态建议组 -->
        <div v-for="(advice, index) in newItem.map" :key="index" class="advice-group">
          <el-form-item label="建议标题" :prop="'map.' + index + '.bt'">
            <el-input v-model="advice.bt" placeholder="请输入建议标题" clearable @focus="tan"></el-input>
            <el-input v-model="advice.bt" placeholder="请输入建议标题" clearable @focus="tan($event)"></el-input>
          </el-form-item>
          <el-form-item label="建议内容" :prop="'map.' + index + '.nr'">
            <el-input v-model="advice.nr" type="textarea" rows="3" placeholder="请输入建议内容" resize="none"
              @focus="tan"></el-input>
              @focus="tan($event)"></el-input>
          </el-form-item>
          <el-button v-if="index > 0" type="danger" size="small" @click="removeAdvice(index)"
            style="margin-left: 100px; margin-bottom: 10px;">删除</el-button>
        </div>
        <el-form-item>
          <el-button type="primary" size="small" @click="addAdvice" style="margin-left: 100px;">添加建议</el-button>
        </el-form-item>
@@ -764,25 +625,28 @@
        <el-button type="primary" @click="submitNewItem">确定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="快捷建议选择" :visible.sync="showjianyi" width="1000px" class="custom-dialog">
      <!-- 替换为输入框 -->
    <el-dialog title="快捷建议选择" :visible.sync="showjianyi" width="1000px" class="custom-dialog"
      :before-close="handleCloseAdviceDialog">
      <!-- 搜索区域 -->
      <div style="margin-bottom: 15px;">
        <el-form :inline="true">
          <el-form-item label="建议名称">
            <el-input v-model="queryParams1.zyzd" placeholder="请输入建议名称进行筛选" clearable style="width: 200px"
              @input="filterAdvices(true)" onkeydown="if(event.keyCode === 32 || event.keyCode === 13) return false;" />
              @input="filterAdvices(true)" @keyup.enter.native="filterAdvices(true)" />
          </el-form-item>
        </el-form>
      </div>
      <el-table :data="advicerulesList" ref="adviceTable" border highlight-current-row
        @current-change="handleCurrentChangeAdvice" style="max-height: 400px; overflow-y: auto;">
      <!-- 建议表格 -->
      <el-table v-loading="adviceLoading" :data="advicerulesList" ref="adviceTable" border highlight-current-row
        @current-change="handleCurrentChangeAdvice" style="max-height: 400px; overflow-y: auto;"
        :empty-text="adviceEmptyText">
        <el-table-column label="科室" prop="ks" width="100" align="center" />
        <el-table-column label="建议名称" prop="jymc" align="center" />
        <el-table-column label="建议内容" prop="jynr" align="center" />
      </el-table>
      <!-- 分页组件 -->
      <!-- 分页 -->
      <div class="pag">
        <div class="pag2">
          <pagination v-show="total1 > 0" :total="total1" :page.sync="queryParams1.pageNum"
@@ -790,8 +654,9 @@
        </div>
      </div>
      <!-- 底部按钮 -->
      <span slot="footer" class="dialog-footer">
        <el-button @click="showjianyi = false">取消</el-button>
        <el-button @click="cancelAdviceDialog">取消</el-button>
        <el-button type="primary" @click="applySelectedAdvice" :disabled="!selectedAdvice">确定</el-button>
      </span>
    </el-dialog>
@@ -799,13 +664,9 @@
    <Prescription ref="Pre" :preObj="preObj" />
    <proposal ref="proposal" :cusobj="cusobj" @event1="eventchange($event)" />
    <createproposal ref="createproposal" :creatobj="creatobj" />
    <el-dialog title="常用建议维护" :visible.sync="propdialog" width="500px" append-to-body>
    </el-dialog>
    <el-dialog title="常用建议维护" :visible.sync="propdialog" width="500px" append-to-body></el-dialog>
  </div>
</template>
<script>
import _ from 'lodash';
import jianqianwenzhen from "@/components/jianqianwenzhen";
@@ -841,10 +702,8 @@
import { getNewDateList } from "@/api/hosp/order";
import { getconfigKey } from "@/api/login";
import moment from "moment";
import { get } from "sortablejs";
import {
  listAdvicerules,
} from "@/api/hosp/advicerules";
import { listAdvicerules } from "@/api/hosp/advicerules";
export default {
  components: {
    ViewPdf,
@@ -873,20 +732,25 @@
      activeAdviceIndex: 0,
      advicerulesList: [],
      showjianyi: false,
      adviceLoading: false, // 控制表格加载状态
      adviceEmptyText: '暂无数据', // 自定义空数据提示
      total1: 0,
      queryParams1: {
        pageNum: 1,
        pageSize: 10,
        zyzd: '', // 建议名称
      },
      adviceCache: new Map(), // 缓存建议数据
      addNewDialogVisible: false,
      newItem: {
        parentName: '',   // 项目分类,对应模板中的 parentName
        jcxm: '',         // 检测项目,对应模板中的 jcxm
        jcjg: '',         // 检测结果,对应模板中的 jcjg
        ckfw: '',         // 参考范围,对应模板中的 ckfw
        dw: '',           // 单位,对应模板中的 dw
        map: [{           // 建议列表,对应模板中的动态建议组 map
          bt: '',         // 建议标题,对应模板中的 map[index].bt
          nr: ''          // 建议内容,对应模板中的 map[index].nr
        }]
        parentName: '',
        jcxm: '',
        jcjg: '',
        ckfw: '',
        dw: '',
        map: [{ bt: '', nr: '' }]
      },
      projectCategories: [],
      // 更新总检建议
      emptyAdvice: {
        bt: "",
        nr: "",
@@ -952,9 +816,7 @@
      msgtuwen: "",
      msgjianqian: "",
      msgkcf: "",
      // 页面全部数据
      checkList: [],
      // 绑定单选按钮
      tjStatus: "0",
      tjproject: "0",
      total: 0,
@@ -964,21 +826,16 @@
      startTime: [],
      textarea1: "",
      loading: true,
      // 当前用户选中的值
      selectLettercurrent: " ",
      // 抽屉打开方式
      drawer: false,
      tableAll: {},
      tjNumber: "",
      // 全部小结
      DeptadviceAll: [],
      MsgId: "",
      Deptobj: "",
      // 点击参数
      changedate: [],
      dataText: [],
      status: {},
      // 查询参数
      queryParams: {
        page: 1,
        pageSize: 10,
@@ -990,7 +847,6 @@
        checkStatus: null,
      },
      formobj: {},
      // 查询参数
      yichangList: [],
      statusList: [],
      queryParam: {
@@ -1017,20 +873,13 @@
        tjCategory: undefined,
        payType: undefined,
      },
      total1: 0,
      queryParams1: {
        pageNum: 1,
        pageSize: 10,
        zyzd: ''
      },
      status1: 0, // 0展示异常1展示项目情况
      status1: 0,
      viewportHeight: 0,
      expends: [],
    };
  },
  created() {
    // this.getNowTime();
    this.getConfigKey();
    this.getdate();
  },
@@ -1038,33 +887,138 @@
  mounted() {
    this.$nextTick(() => {
      this.$refs.inputName.focus();
      this.viewportHeight =
        window.innerHeight || document.documentElement.clientHeight;
      this.viewportHeight = window.innerHeight || document.documentElement.clientHeight;
    });
  },
  methods: {
    // 打开建议选择弹窗
    tan(event) {
      this.activeAdviceIndex = event.target.closest('.advice-group')
        ? Array.from(event.target.closest('.el-form').querySelectorAll('.advice-group'))
          .indexOf(event.target.closest('.advice-group'))
        : 0;
      this.queryParams1.pageNum = 1;
      this.queryParams1.pageSize = 10;
      this.queryParams1.zyzd = '';
      this.selectedAdvice = null; // 重置选中建议
      this.advicerulesList = []; // 清空建议列表
      this.total1 = 0;
      this.adviceCache.clear(); // 清空缓存
      this.filterAdvices();
      this.showjianyi = true;
    },
    handleAdviceBlur(row, index) {
      // 构造 advices 数据
      let advicesToSubmit = [];
      if (index === -1) {
        // advices 为空,使用 emptyAdvice 的值
        if (this.emptyAdvice.bt || this.emptyAdvice.nr) {
          advicesToSubmit = [{ bt: this.emptyAdvice.bt || '', nr: this.emptyAdvice.nr || '' }];
          // 将 emptyAdvice 的值赋值给 row.advices
          this.$set(row, 'advices', advicesToSubmit);
        }
      } else {
        // advices 不为空,直接使用 row.advices
        advicesToSubmit = row.advices;
    // 筛选快捷建议(防抖 800ms,带缓存和加载状态)
    filterAdvices: _.debounce(function (resetPage = false) {
      if (resetPage) {
        this.queryParams1.pageNum = 1;
      }
      // 如果 advicesToSubmit 为空或没有有效数据,不提交
      if (!advicesToSubmit || advicesToSubmit.length === 0) {
      // 生成缓存 key,仅使用 zyzd 和分页参数
      const cacheKey = `${this.queryParams1.zyzd || ''}_${this.queryParams1.pageNum}_${this.queryParams1.pageSize}`;
      // 检查缓存
      if (this.adviceCache.has(cacheKey)) {
        const cachedData = this.adviceCache.get(cacheKey);
        this.advicerulesList = cachedData.rows;
        this.total1 = cachedData.total;
        this.adviceEmptyText = this.advicerulesList.length === 0 ? '暂无匹配的建议' : '暂无数据';
        return;
      }
      // 显示加载状态
      this.adviceLoading = true;
      this.adviceEmptyText = '加载中...';
      listAdvicerules(this.queryParams1)
        .then((response) => {
          this.advicerulesList = response.rows || [];
          this.total1 = response.total || 0;
          // 存入缓存
          this.adviceCache.set(cacheKey, {
            rows: this.advicerulesList,
            total: this.total1,
          });
          // 更新空数据提示
          this.adviceEmptyText = this.advicerulesList.length === 0 ? '暂无匹配的建议' : '暂无数据';
        })
        .catch((error) => {
          console.error('筛选快捷建议失败:', error);
          this.advicerulesList = [];
          this.total1 = 0;
          this.adviceEmptyText = '加载失败,请稍后重试';
          this.$message.error('加载建议失败,请检查网络后重试');
        })
        .finally(() => {
          this.adviceLoading = false;
        });
    }, 800), // 防抖时间为 800ms
    handleCurrentChangeAdvice(currentRow) {
      this.selectedAdvice = currentRow;
    },
    applySelectedAdvice() {
      if (this.selectedAdvice) {
        this.$set(this.newItem.map, this.activeAdviceIndex, {
          bt: this.selectedAdvice.jymc,
          nr: this.selectedAdvice.jynr,
        });
        this.showjianyi = false;
        this.selectedAdvice = null;
      } else {
        this.$message.warning('请先选择一条建议');
      }
    },
    // 取消选择并关闭对话框
    cancelAdviceDialog() {
      this.showjianyi = false;
      this.selectedAdvice = null;
      this.queryParams1.zyzd = '';
      this.queryParams1.pageNum = 1;
      this.advicerulesList = [];
      this.total1 = 0;
      this.adviceCache.clear();
    },
    // 关闭对话框前的确认
    handleCloseAdviceDialog(done) {
      if (this.selectedAdvice) {
        this.$confirm('您已选择一条建议,确定要关闭吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        })
          .then(() => {
            this.cancelAdviceDialog();
            done();
          })
          .catch(() => {});
      } else {
        this.cancelAdviceDialog();
        done();
      }
    },
    handleAdviceBlur(row, index) {
      let advicesToSubmit = [];
      if (index === -1) {
        if (this.emptyAdvice.bt || this.emptyAdvice.nr) {
          advicesToSubmit = [{ bt: this.emptyAdvice.bt || '', nr: this.emptyAdvice.nr || '' }];
          this.$set(row, 'advices', advicesToSubmit);
        }
      } else {
        advicesToSubmit = row.advices;
      }
      if (!advicesToSubmit || advicesToSubmit.length === 0) {
        return;
      }
      const parentItem = this.yichangList.find(item =>
        item.sone.some(soneItem => soneItem.orderDetailId === row.orderDetailId)
@@ -1076,20 +1030,20 @@
      }
      const data = {
        tjh: this.tableAll.tjNumber, // 体检号
        parentName: parentItem.proName, // 父级项目名称
        jcxm: row.proName, // 检测项目
        jcjg: row.proResult, // 检测结果
        ckfw: row.stanId, // 参考范围
        dw: row.proAdvice, // 单位
        map: advicesToSubmit, // 建议列表
        jyjc: parentItem.jyjc, // 检查类型(0 或 1)
        id: row.orderDetailId, // 当前项的 orderDetailId
        tjh: this.tableAll.tjNumber,
        parentName: parentItem.proName,
        jcxm: row.proName,
        jcjg: row.proResult,
        ckfw: row.stanId,
        dw: row.proAdvice,
        map: advicesToSubmit,
        jyjc: parentItem.jyjc,
        id: row.orderDetailId,
      };
      addOrder1(data).then((res) => {
        if (res.code === 200) {
          // 成功更新建议
        } else {
          this.$message.error('建议更新失败:' + (res.msg || '未知错误'));
        }
@@ -1098,60 +1052,14 @@
        this.$message.error('建议更新失败:' + error.message);
      });
    },
    handleCurrentChangeAdvice(currentRow) {
      this.selectedAdvice = currentRow; // 存储选中的建议项
    },
    applySelectedAdvice() {
      if (this.selectedAdvice) {
        this.$set(this.newItem.map, this.activeAdviceIndex, {
          bt: this.selectedAdvice.jymc, // 建议名称赋值给标题
          nr: this.selectedAdvice.jynr  // 建议内容赋值给内容
        });
        this.showjianyi = false; // 关闭弹窗
        this.selectedAdvice = null; // 清空选中项
      } else {
        this.$message.warning('请先选择一条建议');
      }
    },
    handleSelectionChange(selection) {
      console.log(selection);
    },
    tan(event) {
      // 获取当前建议组的索引
      this.activeAdviceIndex = event.target.closest('.advice-group')
        ? Array.from(event.target.closest('.el-form').querySelectorAll('.advice-group'))
          .indexOf(event.target.closest('.advice-group'))
        : 0;
      // 重置分页参数和筛选条件
      this.queryParams1.pageNum = 1;
      this.queryParams1.pageSize = 10;
      this.queryParams1.zyzd = ''; // 清空建议名称输入框
      // 移除科室筛选条件
      delete this.queryParams1.ks; // 确保不携带 ks 参数
      // 加载所有快捷建议列表
      this.filterAdvices();
      this.showjianyi = true;
    },
    // 下拉框筛选快捷建议(包含分页逻辑)
    filterAdvices: _.debounce(function (resetPage = false) {
      if (resetPage) {
        this.queryParams1.pageNum = 1;
      }
      listAdvicerules(this.queryParams1).then((response) => {
        this.advicerulesList = response.rows;
        this.total1 = response.total;
      }).catch((error) => {
        console.error('筛选快捷建议失败:', error);
        this.$message.error('筛选快捷建议失败');
      });
    }, 300),
    submitNewItem() {
      const data = {
        tjh: this.tableAll.tjNumber, // 体检号,从 tableAll 中获取
        tjh: this.tableAll.tjNumber,
        parentName: this.newItem.parentName,
        jcxm: this.newItem.jcxm,
        jcjg: this.newItem.jcjg,
@@ -1162,7 +1070,6 @@
      };
      addOrder1(data).then((res) => {
        console.log(res);
        if (res.code === 200) {
          this.$message.success('新增异常结果成功');
          this.addNewDialogVisible = false;
@@ -1175,6 +1082,7 @@
        this.$message.error('新增异常结果失败');
      });
    },
    addnew() {
      this.newItem = {
        parentName: '',
@@ -1187,7 +1095,6 @@
      this.addNewDialogVisible = true;
      cSWebGetPro(this.tjNumber).then((res) => {
        console.log(res);
        if (res.data && Array.isArray(res.data)) {
          this.projectCategories = res.data;
        } else {
@@ -1203,11 +1110,10 @@
    handleCategoryChange(value) {
      if (value) {
        this.newItem.jcxm = value; // 将选择的项目分类赋值给检测项目
        this.newItem.jcxm = value;
      }
    },
    // 添加新的建议组
    addAdvice() {
      this.newItem.map.push({ bt: '', nr: '' });
    },
@@ -1221,26 +1127,21 @@
    },
    shanchu(row) {
      // 禁用删除按钮,防止重复点击
      this.isdisabled = true;
      // 调用后端接口删除数据
      shanchu({
        id: row.orderDetailId,
      }).then((res) => {
        if (res.code === 200) {  // 后端删除成功
          // 找到要删除项所在的父级数组
        if (res.code === 200) {
          const parentItem = this.yichangList.find(item =>
            item.sone.some(soneItem => soneItem.orderDetailId === row.orderDetailId)
          );
          if (parentItem) {
            // 从父级的 sone 数组中删除该项
            const index = parentItem.sone.findIndex(item => item.orderDetailId === row.orderDetailId);
            if (index > -1) {
              parentItem.sone.splice(index, 1);
              // 如果删除后 sone 数组为空,则删除整个父级项
              if (parentItem.sone.length === 0) {
                const parentIndex = this.yichangList.indexOf(parentItem);
                if (parentIndex > -1) {
@@ -1248,16 +1149,9 @@
                }
              }
              // 更新 expends 数组,确保展开状态正确
              this.getExpends();
              // 强制刷新表格
              this.$forceUpdate();
              this.$message.success('删除成功');
              // 可选:调用 yichangjieguo 刷新数据(如果需要与后端同步)
              // this.yichangjieguo();
            } else {
              this.$message.error('未找到要删除的子项');
            }
@@ -1271,18 +1165,16 @@
        console.error('删除失败:', error);
        this.$message.error('删除操作失败:' + error.message);
      }).finally(() => {
        // 恢复删除按钮状态
        this.isdisabled = false;
      });
    },
    // 确保 getExpends 方法存在,用于更新展开状态
    getExpends() {
      this.expends = this.yichangList.flatMap(item =>
        item.sone.map(soneItem => soneItem.orderDetailId)
      );
      console.log('Updated expends:', this.expends);
    },
    getConfigKey() {
      getconfigKey("sfkqtwbg").then((res) => {
        this.msgtuwen = res.msg;
@@ -1294,26 +1186,26 @@
        this.msgkcf = res.msg;
      });
    },
    //设置table中的扩展项,展开的id,此处我需要全部展开
    getRowKeys(row) {
      return row.orderDetailId;
    },
    // 项目情况
    xiangmuqingkuang() {
      cSWebGetPro(this.tjNumber).then((res) => {
        this.status1 = 1;
        this.statusList = res.data;
        if (this.statusList.length == 0) {
          _this.$message.msgSuccess("暂无项目情况");
          this.$message.msgSuccess("暂无项目情况");
        }
      });
    },
    guanbi() {
      this.drawer = false;
    },
    yichangjieguo() {
      this.status1 = 0;
      let _this = this;
@@ -1322,43 +1214,29 @@
      }).then((res) => {
        this.yichangList = res.data;
        this.yichangList.forEach((item) => {
          item.sone.forEach((soneItem) => {
            if (
              !Array.isArray(soneItem.advices) ||
              soneItem.advices.length === 0
            ) {
              // 如果 advices 是空,设置默认值
              soneItem.advices = [
                {
                  bt: "",
                  nr: "",
                },
              ];
            if (!Array.isArray(soneItem.advices) || soneItem.advices.length === 0) {
              soneItem.advices = [{ bt: "", nr: "" }];
            }
          });
        });
        if (!this.yichangList) {
          _this.$message({
            type: "warning ",
            type: "warning",
            message: "暂无异常报告",
          });
        }
      });
    },
    getdate() {
      getNewDateList().then((res) => {
        /* this.startTime = [
          moment(res.data).format("YYYY-MM-DD 00:00:00"),
          moment(res.data).format("YYYY-MM-DD 23:59:00"),
        ]; */
        this.getList();
      });
    },
    // / 处理默认选中当前日期
    getNowTime() {
      var curDate = new Date().getTime();
      var dayNum = 7 * 24 * 3600 * 1000;
@@ -1367,9 +1245,11 @@
      var end = this.getLocalTime(curDate);
      this.startTime = [sDay, end];
    },
    add0(m) {
      return m < 10 ? "0" + m : m;
    },
    getLocalTime(nS) {
      var time = new Date(nS);
      var y = time.getFullYear();
@@ -1389,6 +1269,7 @@
        this.add0(mm)
      );
    },
    jianqian() {
      this.flags = true;
      this.jianqians = true;
@@ -1408,7 +1289,6 @@
        this.queryParams.endTime = null;
      }
      // 页面数据
      getcheckList(this.queryParams).then((response) => {
        if (response.code == 200) {
          this.loading = false;
@@ -1418,18 +1298,17 @@
            } else {
              this.checkList = response.data.customers;
            }
            this.total = response.data.total;
          } else {
            this.checkList = [];
          }
        }
      }),
        // 获取单位信息集合
        getCompany(this.queryParam).then((response) => {
          this.CompanyList = response.data;
          this.loading = false;
        });
      });
      getCompany(this.queryParam).then((response) => {
        this.CompanyList = response.data;
        this.loading = false;
      });
    },
    viewReport(row) {
@@ -1454,18 +1333,13 @@
              });
            } else {
              this.dialogVisible = true;
              this.url = window.webkitURL.createObjectURL(response); //将后端返回的blob文件读取出url
              this.url = window.webkitURL.createObjectURL(response);
            }
          });
        } else {
          let url = response.data.url;
          const params = { url };
          this.$tab.openPage(
            "健康证检查表",
            "/report/zongjianjiankangzheng",
            params
          );
          this.$tab.openPage("健康证检查表", "/report/zongjianjiankangzheng", params);
        }
      });
    },
@@ -1494,13 +1368,6 @@
                patagename: this.tableAll.age_unit,
                patbirth: this.tableAll.cusBrithday,
              };
              // let data = {
              //   patname: "脱能娥",
              //   sex: "女",
              //   patage: "60",
              //   patagename: "岁",
              //   patbirth: "1963-01-01"
              // }
              getTjYxjcList(data).then((res) => {
                this.baogao = res.data;
              });
@@ -1555,23 +1422,12 @@
        }
      });
    },
    // viewReport(row) {
    //   const tjNumber = row.tjNumber;
    //   const viewNum = "792997692059705344";
    //   const params = { viewNum, tjNumber };
    //   hasReportEnd(tjNumber).then((res) => {
    //     if (res == 1) {
    //       this.$tab.openPage("体检报告", "/report/viewReport", params);
    //     } else {
    //       this.$message.error("该用户体检暂未完成,无法打印体检报告!");
    //     }
    //   });
    // },
    downLoadFileImg(row) {
      const tjNumber = row.tjNumber;
      const flag = true;
      getPdf(tjNumber, flag).then((response) => {
        this.url = window.webkitURL.createObjectURL(response); //将后端返回的blob文件读取出url
        this.url = window.webkitURL.createObjectURL(response);
      });
    },
@@ -1585,7 +1441,6 @@
      this.$refs.Pre.title = "处方";
    },
    // 单选按钮
    radioChange(value) {
      this.loading = true;
      this.queryParams.checkStatus = value;
@@ -1601,27 +1456,27 @@
        this.loading = false;
      });
    },
    propoChange() {
      this.cusobj = { sex: this.tableAll.cusSex, isZj: 0 };
      this.$refs.proposal.open = true;
      this.$refs.proposal.title = "建议方案";
      // this.$refs.proposal.getList();
    },
    eventchange(data) {
      this.dataText = data;
      if (this.textarea1 == null) {
        this.textarea1 = "";
      }
      console.log(data)
      data.forEach((item) => {
        if(item.advice){
        if (item.advice) {
          this.textarea1 += item.advice;
        }else{
        } else {
          this.textarea1 += item.jynr;
        }
      });
    },
    proposalChange() {
      if (this.textarea1) {
        this.creatobj = { proParentList: this.textarea1, isZj: 0 };
@@ -1629,16 +1484,16 @@
        this.$refs.createproposal.title = "常用建议维护";
      } else {
        this.$message({
          type: "warning ",
          type: "warning",
          message: "请先填写总检建议",
        });
      }
    },
    radiotjprojectChange() {
      if (this.tjproject == "0") {
        getupdateCheckType(this.tjNumber).then((response) => {
          this.changedate = response.data;
          this.changedate.forEach((item) => {
            this.textarea1 = item.checkAdvice;
          });
@@ -1646,21 +1501,9 @@
            for (let i = 0; i < this.changedate.length; i++) {
              this.remark = this.changedate[i].remark;
            }
            this.changedate.forEach((item) => {
              // this.remark = item.remark;
              // item.sons.forEach((item3) => {
              //   if (item3.standard.tjStandardGtValue === null) {
              //     item3.standard.tjStandardGtValue = "";
              //   }
              //   if (item3.standard.tjStandardLtValue === null) {
              //     item3.standard.tjStandardLtValue = "";
              //   }
              // });
              // item.remark = "";
            });
          } else {
            this.$message({
              type: "warning ",
              type: "warning",
              message: "该客户没有体检项目数据",
            });
          }
@@ -1668,7 +1511,6 @@
      } else if (this.tjproject == "1") {
        getupdateCheckTypeHuaYan(this.tjNumber).then((res) => {
          if (res.data) {
            // this.Testitems = res.data
            this.changedate = res.data;
            this.changedate.forEach((item) => {
              this.textarea1 = item.checkAdvice;
@@ -1677,22 +1519,10 @@
              for (let i = 0; i < this.changedate.length; i++) {
                this.remark = this.changedate[i].remark;
              }
              this.changedate.forEach((item) => {
                // this.remark = item.remark;
                item.sons.forEach((item3) => {
                  // if (item3.standard.tjStandardGtValue === null) {
                  //   item3.standard.tjStandardGtValue = "";
                  // }
                  // if (item3.standard.tjStandardLtValue === null) {
                  //   item3.standard.tjStandardLtValue = "";
                  // }
                });
                // item.remark = "";
              });
            }
          } else {
            this.$message({
              type: "warning ",
              type: "warning",
              message: "该客户没有化验项目数据",
            });
          }
@@ -1700,7 +1530,6 @@
      }
    },
    // 体检公司拼音搜索
    getRemoteData(query) {
      if (query) {
        let compName = query;
@@ -1710,12 +1539,10 @@
      }
    },
    // 选框数据
    searchSelect(val) {
      this.CheckBox = val;
    },
    // 时间
    dateChangebirthday1(val) {
      this.startTime = val;
    },
@@ -1726,9 +1553,7 @@
      }
    },
    // 搜索
    submitForm() {
      console.log(this.tjStatus);
      this.loading = true;
      this.queryParams.compId = this.CheckBox.drugManufacturerId;
      this.queryParams.checkStatus = this.tjStatus;
@@ -1740,7 +1565,6 @@
        this.queryParams.endTime = null;
      }
      // 页面数据
      getcheckList(this.queryParams).then((response) => {
        if (response.code == 200) {
          this.loading = false;
@@ -1749,7 +1573,6 @@
            this.checkList.forEach((item) => {
              this.tjStatus = item.tjStatus.toString();
            });
            this.total = response.data.total;
          } else {
            this.checkList = [];
@@ -1757,61 +1580,45 @@
        }
      });
    },
    // 重置
    resetQuery() {
      this.startTime = [];
      this.resetForm("tableList");
      this.submitForm();
    },
    changRed({ row }) {
      if (row.ycbz != "" && row.ycbz != null) {
        // 变颜色的条件
        return {
          color: "red", // 这个return的就是样式 可以是color 也可以是backgroundColor
          color: "red",
        };
      }
    },
    red() {
      return {
        color: "red",
      };
    },
    redxiangmu({ row }) {
      if (row.type != 1) {
        // 变颜色的条件
        return {
          backgroundColor: "#AAD8DF !important", // 这个return的就是样式 可以是color 也可以是backgroundColor
          // color: "#AAD8DF ",
          backgroundColor: "#AAD8DF !important",
        };
      }
    },
    /*  changRed(row) {
      if (row.label === "↑") {
        return {
          color: "green", // 设置上箭头为绿色
        };
      } else if (row.label === "↓") {
        return {
          color: "red", // 设置下箭头为红色
        };
      }
      // 默认颜色
      return {
        color: "black",
      };
    }, */
    handleCurrentChange(val) {
      if (val != null) {
        this.handleClick(val);
      }
    },
    // 点击详情
    handleClick(row) {
      this.$refs.Pre.open = false;
      this.tableAll = row;
      this.tjproject = "0";
      this.tjNumber = this.tableAll.tjNumber;
      getState(this.tjNumber).then((res) => {
@@ -1836,32 +1643,14 @@
                      this.changedate.forEach((item) => {
                        this.textarea1 = item.checkAdvice || "";
                      });
                      // 这里设置初始值
                      this.initialTotalCheckAdvice = this.textarea1; // 保存总检建议
                      // 保存初始状态
                      this.initialState = JSON.parse(
                        JSON.stringify(this.changedate)
                      );
                      this.initialTotalCheckAdvice = this.textarea1;
                      this.initialState = JSON.parse(JSON.stringify(this.changedate));
                      for (let i = 0; i < this.changedate.length; i++) {
                        this.remark = this.changedate[i].remark;
                      }
                      this.changedate.forEach((item) => {
                        // this.remark = item.remark;
                        // item.sons.forEach((item3) => {
                        //   if (item3.standard.tjStandardGtValue === null) {
                        //     item3.standard.tjStandardGtValue = "";
                        //   }
                        //   if (item3.standard.tjStandardLtValue === null) {
                        //     item3.standard.tjStandardLtValue = "";
                        //   }
                        // });
                      });
                    } else {
                      this.$message({
                        type: "warning ",
                        type: "warning",
                        message: "该客户没有体检项目数据",
                      });
                    }
@@ -1870,20 +1659,15 @@
              }
            });
          } else {
            this.$confirm(
              "" + this.status.name + "正在修改该信息, 是否强制进去?",
              "提示",
              {
                confirmButtonText: "是",
                cancelButtonText: "否",
                type: "warning",
              }
            )
            this.$confirm("" + this.status.name + "正在修改该信息, 是否强制进去?", "提示", {
              confirmButtonText: "是",
              cancelButtonText: "否",
              type: "warning",
            })
              .then(() => {
                this.yichangjieguo();
                getInfo().then((response) => {
                  this.userId = response.user.userId;
                  if (this.userId) {
                    let data = {
                      userId: this.userId,
@@ -1899,32 +1683,13 @@
                          for (let i = 0; i < this.changedate.length; i++) {
                            this.remark = this.changedate[i].remark;
                          }
                          this.initialState = JSON.parse(
                            JSON.stringify(this.changedate)
                          );
                          this.initialState = JSON.parse(JSON.stringify(this.changedate));
                          this.changedate.forEach((item) => {
                            this.textarea1 = item.checkAdvice || "";
                            // this.remark = item.remark;
                            // item.sons.forEach((item3) => {
                            //   if (item3.standard.tjStandardGtValue === null) {
                            //     item3.standard.tjStandardGtValue = "";
                            //   }
                            //   if (item3.standard.tjStandardLtValue === null) {
                            //     item3.standard.tjStandardLtValue = "";
                            //   }
                            // });
                            // item.remark = "";
                          });
                          // 保存总检建议
                          this.totalCheckAdvice = this.changedate.map(
                            (item) => item.totalCheckAdvice
                          );
                        } else {
                          this.$message({
                            type: "warning ",
                            type: "warning",
                            message: "该客户没有体检项目数据",
                          });
                        }
@@ -1939,377 +1704,94 @@
                  message: "已取消进入",
                });
              });
            this.drawer = false;
          }
        } else {
          this.drawer = true;
          this.yichangjieguo();
          getInfo().then((response) => {
            this.userId = response.user.userId;
            if (this.userId) {
              let data = {
                userId: this.userId,
                tjNumber: this.tjNumber,
                state: 0,
              };
              getforceIn(data).then((res) => {
                this.MsgId = res.msg;
                this.drawer = true;
                getupdateCheckType(this.tjNumber).then((response) => {
                  this.changedate = response.data;
                  if (this.changedate) {
                    for (let i = 0; i < this.changedate.length; i++) {
                      this.remark = this.changedate[i].remark;
                    }
                    this.initialState = JSON.parse(
                      JSON.stringify(this.changedate)
                    );
                    this.changedate.forEach((item) => {
                      this.textarea1 = item.checkAdvice || "";
                      // this.remark = item.remark;
                      // item.sons.forEach((item3) => {
                      //   if (item3.standard.tjStandardGtValue === null) {
                      //     item3.standard.tjStandardGtValue = "";
                      //   }
                      //   if (item3.standard.tjStandardLtValue === null) {
                      //     item3.standard.tjStandardLtValue = "";
                      //   }
                      // });
                      // item.remark = "";
                    });
                    // 保存总检建议
                    this.totalCheckAdvice = this.changedate.map(
                      (item) => item.totalCheckAdvice
                    );
                  } else {
                    this.$message({
                      type: "warning ",
                      message: "该客户没有体检项目数据",
                    });
                  }
                });
              });
            }
          });
        }
      });
      // 获取小结
      // getDeptAdvice().then((response) => {
      //   response.data.forEach((item) => {
      //     this.DeptadviceAll = item;
      //   });
      // });
    },
    // 撤销
    getRevoke(row) {
      this.loading = true;
      const tjNumber = row.tjNumber;
      revoke(tjNumber).then((response) => {
        this.$modal.msgSuccess("撤回成功");
        if (response.code == 200) {
          this.loading = false;
          this.getList();
        }
      });
    },
    cancel() {
      this.propdialog = false;
    },
    // 是否关闭弹窗
    handleClose(done) {
      if (this.loading) {
        return;
      }
      // 检查是否有修改
      let isModified =
        JSON.stringify(this.changedate) !== JSON.stringify(this.initialState) ||
        (this.textarea1 !== this.initialTotalCheckAdvice &&
          this.textarea1 !== null);
      console.log("Initial Total Check Advice:", this.initialTotalCheckAdvice);
      console.log("Current textarea1:", this.textarea1);
      if (isModified) {
        // 如果有修改,弹出确认框
        this.$confirm("检测内容有修改,确定要提交吗?")
      if (JSON.stringify(this.initialState) !== JSON.stringify(this.changedate) || this.initialTotalCheckAdvice !== this.textarea1) {
        this.$confirm("您有未保存的更改,确定要关闭吗?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            this.loading = true;
            this.timer = setTimeout(() => {
              done();
              this.determine();
              setTimeout(() => {
                this.loading = false;
              }, 400);
            }, 2000);
          })
          .catch(() => {
            // 用户取消操作
            this.drawer = false;
            let data = {
              userId: this.userId,
              tjNumber: this.tjNumber,
              state: 1,
              id: this.MsgId,
            };
            getfiedState(data).then((res) => { });
            this.submitForm();
          });
            getfiedState(data).then((res) => {
              this.drawer = false;
              done();
            });
          })
          .catch(() => {});
      } else {
        // 如果没有修改,直接关闭
        done();
        let data = {
          userId: this.userId,
          tjNumber: this.tjNumber,
          state: 1,
        };
        getfiedState(data).then((res) => {
          this.drawer = false;
          done();
        });
      }
    },
    handleClose1() {
    handleClose1(done) {
      this.jianqians = false;
      this.wenzhen = false;
      this.flags = false;
      done();
    },
    // 生成报告
    // generate(row) {
    //   const tjNumber = row.tjNumber;
    //   getGenerate(tjNumber).then((response) => {
    //     this.$modal.msgSuccess("生成成功");
    //   });
    // },
    // xiAoJieChange(event) {
    //   if (event) {
    //     this.changedate.forEach((item) => {
    //       item.remark = "";
    //       item.parentAdvice.forEach((item1) => {
    //         event.forEach((item2) => {
    //           if (item2 == item1.id) {
    //             item.remark = item.remark + item1.advice + "。";
    //           }
    //         });
    //       });
    //     });
    //   }
    // },
    change(vale) { },
    // determine() {
    //   let tjNumber = this.tableAll.tjNumber;
    //   let tjh = this.tableAll.tjNumber;
    //   // let jyjc = this.yichangList.map(item => item.jyjc || null);
    //   let advice = this.textarea1;
    //   let data = {
    //     tjNumber,
    //     advice,
    //     checkStatus: 1,
    //   };
    //   console.log(this.yichangList, 66);
    //   let dataList = this.yichangList
    //     .map((item) => {
    //       return item.sone.map((soneItem) => ({
    //         tjh,
    //         parentName: item.proName,
    //         jcxm: soneItem.proName,
    //         map: soneItem.advices,
    //         jyjc: item.jyjc, // assuming jyjc belongs to the outer item, not soneItem
    //         jcjg: soneItem.proResult,
    //         ckfw: soneItem.stanId,
    //         dw: soneItem.proAdvice,
    //       }));
    //     })
    //     .flat(); // 使用 flat() 方法将嵌套数组展平
    //   console.log(dataList, 777);
    //   /*  addOrder(dataList).then((res) => {
    //     console.log(res, 999);
    //   }); */
    //   getTjdetailList(data)
    //     .then((response) => {
    //       if (response.code === 200) {
    //         this.$modal.msgSuccess("提交成功");
    //         // 准备生成报告的请求数据
    //         let reportData = {
    //           userId: this.userId,
    //           tjNumber: tjNumber,
    //           state: 1,
    //           id: this.MsgId,
    //         };
    //         // 生成报告并保持 loading 打开
    //         const reportPromise = gettoPdf(tjNumber)
    //           .then((res) => {
    //             this.$modal.msgSuccess("已生成报告!请前往报告核收页面确认!");
    //           })
    //           .catch((error) => {
    //             this.$modal.msgError(
    //               "打印报告失败,请前往报告打印页面补打报告!"
    //             );
    //           });
    //         // 更新状态并提交修改请求
    //         const statePromise = getfiedState(reportData).then((res) => {
    //           this.drawer = false;
    //         });
    //         // const addOrderPromise = addOrder(dataList).then((res) => {
    //         //   console.log(res, 999);
    //         // });
    //         // 处理其他修改操作
    //         const updatePromises = this.changedate.map((item) => {
    //           this.proIds = item.parentId;
    //           let remarks = item.remark;
    //           let updateOrderRemarkVos = [
    //             {
    //               tjNumber,
    //               proId: this.proIds.toString(),
    //               remarks,
    //             },
    //           ];
    //           return getModified(updateOrderRemarkVos); // 返回 Promise
    //         });
    //         // 等待所有请求完成
    //         Promise.all([
    //           reportPromise,
    //           statePromise,
    //           // addOrderPromise,
    //           ...updatePromises,
    //         ])
    //           .then(() => {
    //             // 所有请求完成,关闭 loading
    //             this.loading = false;
    //             // 更新分页信息
    //             this.queryParams.page = 1;
    //             this.queryParams.pageSize = 10;
    //             this.submitForm();
    //             this.$forceUpdate();
    //           })
    //           .catch((error) => {
    //             // 处理错误情况
    //             this.loading = false;
    //             console.error("发生错误:", error);
    //           });
    //       } else {
    //         // 提交失败,关闭 loading
    //         this.loading = false;
    //       }
    //     })
    //     .catch((error) => {
    //       // 提交请求失败,关闭 loading
    //       this.loading = false;
    //       console.error("提交请求失败:", error);
    //     });
    // },
    determine() {
      let tjNumber = this.tableAll.tjNumber;
      let tjh = this.tableAll.tjNumber;
      let advice = this.textarea1;
      let data = {
        tjNumber,
        advice,
        checkStatus: 1,
        checkAdvice: this.textarea1,
        proIds: this.changedate.map(item => item.proId),
        remarks: this.changedate.map(item => item.remark),
        jgbxs: this.changedate.map(item => item.jgbx),
        tjNumber: this.tjNumber,
      };
      console.log(this.yichangList, 6644);
      addOrder(data).then((res) => {
        if (res.code === 200) {
          this.$message.success('提交成功');
          this.drawer = false;
          this.submitForm();
        } else {
          this.$message.error('提交失败');
        }
      }).catch((error) => {
        console.error('提交失败:', error);
        this.$message.error('提交失败');
      });
    },
      let dataList = this.yichangList
        .map((item) => {
          return item.sone.map((soneItem) => ({
            tjh,
            parentName: item.proName,
            jcxm: soneItem.proName,
            map: soneItem.advices,
            jyjc: item.jyjc,
            jcjg: soneItem.proResult,
            ckfw: soneItem.stanId,
            dw: soneItem.proAdvice,
          }));
    getRevoke(row) {
      this.$confirm("确认撤销该报告吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          revoke(row.tjNumber).then((response) => {
            if (response.code === 200) {
              this.submitForm();
              this.$message.success("撤销成功");
            } else {
              this.$message.error("撤销失败");
            }
          });
        })
        .flat(); // 使用 flat() 方法将嵌套数组展平
      getTjdetailList(data)
        .then((response) => {
          if (response.code === 200) {
            this.$modal.msgSuccess("提交成功");
            // 准备生成报告的请求数据
            let reportData = {
              userId: this.userId,
              tjNumber: tjNumber,
              state: 1,
              id: this.MsgId,
            };
            // 调用 addOrderPromise
            console.log(dataList, 5555);
            addOrder(dataList)
              .then((res) => {
                console.log(res, 999);
                if (res.code == 200) {
                  gettoPdf(tjNumber)
                    .then((res) => {
                      this.$modal.msgSuccess(
                        "已生成报告!请前往报告核收页面确认!"
                      );
                    })
                    .catch(() => {
                      this.$modal.msgError(
                        "打印报告失败,请前往报告打印页面补打报告!"
                      );
                    });
                  const statePromise = getfiedState(reportData).then(() => {
                    this.drawer = false;
                  });
                  const updatePromises = this.changedate.map((item) => {
                    this.proIds = item.parentId;
                    let remarks = item.remark;
                    let updateOrderRemarkVos = [
                      {
                        tjNumber,
                        proId: this.proIds.toString(),
                        remarks,
                      },
                    ];
                    return getModified(updateOrderRemarkVos); // 返回 Promise
                  });
                  // 等待所有请求完成
                  Promise.all([statePromise, ...updatePromises])
                    .then(() => {
                      // 所有请求完成,关闭 loading
                      this.loading = false;
                      // 更新分页信息
                      this.queryParams.page = 1;
                      this.queryParams.pageSize = 10;
                      this.submitForm();
                      this.$forceUpdate();
                    })
                    .catch((error) => {
                      // 处理错误情况
                      this.loading = false;
                      console.error("发生错误:", error);
                    });
                }
              })
              .catch((error) => {
                // 如果 addOrderPromise 失败,处理错误
                this.loading = false;
                console.error("addOrderPromise 失败:", error);
              });
          } else {
            // 提交失败,关闭 loading
            this.loading = false;
          }
        })
        .catch((error) => {
          // 提交请求失败,关闭 loading
          this.loading = false;
          console.error("提交请求失败:", error);
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消撤销",
          });
        });
    },
  },
src/views/doctor/inspectCheck/index.vue
@@ -6,6 +6,7 @@
      size="small"
      :inline="true"
      label-width="68px"
      @submit.native.prevent
    >
      <el-form-item label="体检号" prop="reportDoctorCode">
        <el-input
@@ -54,19 +55,20 @@
      :data="exaLists"
      v-loading="loading"
      border
      max-height="350"
      @current-change="handleCurrentChange"
      @selection-change="handleSelectionChange"
      :row-class-name="tableRowClassName"
      style="width: 100%"
      height="350"
      @selection-change="handleCurrentChange"
      :header-cell-style="{ background: '#aad8df' }"
    >
    <!--  @selection-change="handleSelectionChange"  :row-class-name="tableRowClassName" -->
      <el-table-column
        fixed
        type="selection"
        align="center"
        label="选择"
        width="40"
        :selectable="isSelectable"
      >
      <!--    :selectable="isSelectable" -->
      </el-table-column>
      <el-table-column label="姓名" align="center" prop="name" width="80px" />
@@ -96,6 +98,7 @@
        align="center"
        prop="examinationDate"
        width="150px"
        :formatter="formatDate"
      />
      <el-table-column label="门诊号" align="center" prop="mzh" width="140px" />
@@ -202,6 +205,7 @@
  
  <script>
import { getlisList, getJyTjList, asyncPacs } from "@/api/doctor/pacsCheck";
import moment from "moment";
export default {
  dicts: ["dict_tj_status"],
@@ -277,23 +281,42 @@
    });
  },
  methods: {
    handleDateChange(val){
    handleDateChange(val) {
      if (val && val.length === 2) {
        this.queryParams.start = val[0]; // 设置开始时间
        this.queryParams.end = val[1];   // 设置结束时间
        this.queryParams.end = val[1]; // 设置结束时间
      } else {
        this.queryParams.start = null;
        this.queryParams.end = null;
      }
      console.log('Query Params:', this.queryParams);
      console.log("Query Params:", this.queryParams);
    },
    isSelectable(row) {
      return !!row.mzh;
    },
    // isSelectable(row) {
    //   return !!row.mzh;
    // },
    tableRowClassName({ row }) {
      return !row.mzh ? "row-disabled" : "";
    },
    handleSelectionChange(val) {
      console.log(val);
      /*  if (val.length > 1) {
        let del_row = val.shift();
        this.$refs.tb.toggleRowSelection(del_row, false); //设置这一行取消选中
      }
      console.log(val, 999); */
      if (val.length > 0) {
        // const selectedRow = val[0];
        // console.log(val[0], 555);
        this.selectedFirstTable = val;
        console.log("当前选中的行数据:", this.selectedFirstTable);
        // this.fetchRightTableData(selectedRow);
      } else {
        this.selectedFirstTable = null;
        this.checkList = [];
      }
    },
    handleSelectionChange(val) {
@@ -325,6 +348,18 @@
        this.checkList = response.data;
        this.loading = false;
      });
    },
    formatDate(row) {
      if (!row.examinationDate) return "";
      // 使用 moment 解析指定格式的日期字符串
      const date = moment(row.examinationDate, "MM DD YYYY hh:mmA");
      if (!date.isValid()) return "无效日期";
      // 格式化为所需格式
      return date.format("YYYY-MM-DD HH:mm");
    },
    handleSelectionChangeSecond(selectedRows) {
@@ -417,7 +452,7 @@
          clearInterval(this.clearTimeSet);
          this.clearTimeSet = null;
          this.$modal.closeLoading();
        })
        });
    },
  },
};
src/views/doctor/pacsCheck/index.vue
@@ -6,6 +6,7 @@
      size="small"
      :inline="true"
      label-width="68px"
      @submit.native.prevent
    >
      <el-form-item label="体检号" prop="reportDoctorCode">
        <el-input
@@ -17,7 +18,7 @@
          style="width: 170px"
        />
      </el-form-item>
     <!--  <el-form-item label="姓名" prop="name">
      <!--  <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
@@ -130,6 +131,7 @@
        align="center"
        prop="examinationDate"
        width="150px"
        :formatter="formatDate"
      />
      <el-table-column label="门诊号" align="center" prop="mzh" width="140px" />
@@ -329,17 +331,15 @@
    });
  },
  methods: {
    handleDateChange(val){
    handleDateChange(val) {
      if (val && val.length === 2) {
        this.queryParams.start = val[0]; // 设置开始时间
        this.queryParams.end = val[1];   // 设置结束时间
        this.queryParams.end = val[1]; // 设置结束时间
      } else {
        this.queryParams.start = null;
        this.queryParams.end = null;
      }
      console.log('Query Params:', this.queryParams);
      console.log("Query Params:", this.queryParams);
    },
    isSelectable(row) {
      return !!row.mzh;
@@ -445,6 +445,18 @@
        this.$modal.closeLoading();
      }, 300000);
    },
    formatDate(row) {
      if (!row.examinationDate) return "";
      // 使用 moment 解析指定格式的日期字符串
      const date = moment(row.examinationDate, "MM DD YYYY hh:mmA");
      if (!date.isValid()) return "无效日期";
      // 格式化为所需格式
      return date.format("YYYY-MM-DD HH:mm");
    },
    tongbu(row) {
      this.$modal.loading("正在同步,请稍候...");
      this.setTime();
@@ -476,7 +488,7 @@
          this.clearTimeSet = null;
          this.$modal.closeLoading();
          // this.$modal.error("操作失败,请稍后重试");
        })
        });
    },
  },
};
src/views/hosp/project/index.vue
@@ -9,8 +9,8 @@
        <div class="scrollable-container">
          <div class="content">
            <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false"
              :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId"
              highlight-current @node-click="handleNodeClick" :render-content="renderContent" v-loading="loadings"/>
              :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId"
              highlight-current @node-click="handleNodeClick" :render-content="renderContent" v-loading="loadings" />
          </div>
        </div>
      </el-col>
@@ -79,7 +79,7 @@
          </el-table-column>
          <el-table-column label="项目标准值" align="center" prop="proScope" :show-overflow-tooltip="true" width="90px">
          </el-table-column>
          <el-table-column label="Lis项目名称" align="center" prop="lisXmmc"  :show-overflow-tooltip="true" width="200px">
          <el-table-column label="Lis项目名称" align="center" prop="lisXmmc" :show-overflow-tooltip="true" width="200px">
          </el-table-column>
          <el-table-column label="Lis编码" align="center" prop="lisXmbm" :show-overflow-tooltip="true" width="90px">
          </el-table-column>
@@ -586,16 +586,25 @@
    });
  },
  methods: {
    debounceFilter: debounce(function(val) {
    debounceFilter: debounce(function (val) {
      this.$refs.tree.filter(val);
    }, 300),
    precomputePinyin() {
      const traverse = (nodes) => {
        nodes.forEach(node => {
          if (node.label) {
            const lowerSpell = node.label.spell('low', 'array').join('');
            const upperSpell = node.label.spell('up', 'array').join('');
            this.pinyinCache.set(node.id, { lowerSpell, upperSpell, label: node.label });
            const lowerSpell = cnchar.spell(node.label, 'low', 'array').join(''); // 完整小写拼音
            const upperSpell = cnchar.spell(node.label, 'up', 'array').join('');  // 完整大写拼音
            const shortPinyin = node.label
              .split('')
              .map(char => cnchar.spell(char, 'array')[0]?.[0]?.toLowerCase() || char) // 拼音首字母
              .join('');
            this.pinyinCache.set(node.id, {
              lowerSpell,
              upperSpell,
              shortPinyin, // 缓存拼音简写
              label: node.label
            });
          }
          if (node.children) traverse(node.children);
        });
@@ -603,13 +612,14 @@
      traverse(this.deptOptions);
    },
    filterNode(value, data) {
      if (!value) return true;
      if (!value) return true; // 如果搜索值为空,返回所有节点
      const cached = this.pinyinCache.get(data.id);
      if (!cached) return false;
      if (!cached) return false; // 如果没有缓存数据,不显示该节点
      const searchLower = value.toLowerCase(); // 将搜索词转为小写
      return (
        cached.label.includes(value) ||
        cached.lowerSpell.includes(value) ||
        cached.upperSpell.includes(value)
        cached.label.includes(value) ||           // 直接匹配汉字
        cached.shortPinyin.includes(searchLower) || // 匹配拼音简写
        cached.lowerSpell.includes(searchLower)   // 匹配完整拼音
      );
    },
    filterNode2(value, data) {
@@ -690,24 +700,24 @@
            this.form.proParentId = row.proId || 0;
            this.open = true;
          } else if (this.treeDate.id) {
           if(this.treeDate.qf == "0"){
            this.form.proParentId = "0"
            this.form.deptId=this.treeDate.id
           }else{
            this.form.proParentId = this.treeDate.id;
            this.projectOptions.forEach((item) => {
              item.children.forEach((item1) => {
                if (this.form.proParentId == item1.proId) {
                  this.form.deptId = item1.deptId;
                }
            if (this.treeDate.qf == "0") {
              this.form.proParentId = "0"
              this.form.deptId = this.treeDate.id
            } else {
              this.form.proParentId = this.treeDate.id;
              this.projectOptions.forEach((item) => {
                item.children.forEach((item1) => {
                  if (this.form.proParentId == item1.proId) {
                    this.form.deptId = item1.deptId;
                  }
                });
              });
            });
           }
            }
            this.open = true;
          } else {
             this.form.proParentId = "0"
            this.form.proParentId = "0"
            this.open = true;
          }
        }
@@ -824,7 +834,7 @@
      });
    },
    handleNodeClick(date) {
      this.treeDate = date;
      console.log(this.treeDate)
      this.xiugais = date.qf === "0";
@@ -1116,7 +1126,7 @@
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
        .catch(() => { });
    },
    handleExport() {
      this.download(
src/views/system/package/index.vue
@@ -9,8 +9,7 @@
      </el-form-item>
      <el-form-item label="体检类别" prop="tjCategory">
        <el-select v-model="queryParams.tjCategory" placeholder="请选择状态" style="width: 200px" filterable clearable>
          <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.id" :label="dict.label"
            :value="dict.value"></el-option>
          <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.id" :label="dict.label" :value="dict.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
@@ -21,34 +20,25 @@
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['system:package:add']">新增</el-button>
        <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:package:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUp"
          v-hasPermi="['system:package:edit']">修改</el-button>
        <el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUp" v-hasPermi="['system:package:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['system:package:remove']">删除</el-button>
        <el-button type="primary" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:package:remove']">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['system:package:export']">导出</el-button>
        <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:package:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <!--
    element-loading-background="rgba(0, 0, 0, 0.1)"
    element-loading-spinner="el-icon-loading"
        element-loading-text="正在加载中..." -->
    <template>
      <el-table v-loading="loading" style="width: 100%" :data="packageList" @selection-change="handleSelectionChange"
        border>
      <el-table v-loading="loading" style="width: 100%" :data="packageList" @selection-change="handleSelectionChange" border>
        <!-- 表格列保持不变 -->
        <el-table-column fixed type="selection" width="40" align="center" :show-overflow-tooltip="true" />
        <el-table-column label="序号" align="center" width="50" prop="newID" fixed />
        <!-- <el-table-column label="编号" align="center" prop="pacId" /> -->
        <el-table-column label="体检类别" width="100px" align="center" prop="categoryNames" fixed>
          <template slot-scope="scope">
            <dict-tag :options="dict.type.dict_tjtype" :value="scope.row.tjCategory" />
@@ -57,78 +47,38 @@
        <el-table-column label="套餐名称" align="center" prop="pacName" width="150px" fixed />
        <el-table-column label="原价" width="80px" align="center" prop="price" fixed></el-table-column>
        <el-table-column label="折扣" width="80px" align="center" prop="limits" fixed></el-table-column>
        <el-table-column label="现价" width="80px" align="center" prop="newPrice" fixed>
        </el-table-column>
        <el-table-column label="单项列表" align="center" prop="allProName" width="1200px">
        </el-table-column>
        <!-- <el-table-column
          label="项目明细"
          align="center"
          prop="allSonName"
          :show-overflow-tooltip="true"
        >
        </el-table-column>-->
        <el-table-column label="现价" width="80px" align="center" prop="newPrice" fixed></el-table-column>
        <el-table-column label="单项列表" align="center" prop="allProName" width="1200px"></el-table-column>
        <el-table-column label="套餐描述" align="center" :show-overflow-tooltip="true" width="120px">
          <template slot-scope="scope">
            <div class="showInline">{{ scope.row.pacRemark }}</div>
          </template>
        </el-table-column>
        <!-- <el-table-column
          label="图片"
          align="center"
          prop="pacPhone"
          width="100"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="scope">
            <image-preview :src="scope.row.pacPhone" :width="50" :height="50" />
          </template>
        </el-table-column> -->
        <el-table-column label="关键字" width="110px" align="center" prop="keyNames"></el-table-column>
        <el-table-column label="是否上架" width="94px" align="center" prop="isOnSale">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isOnSale" />
          </template>
        </el-table-column>
        <!-- <el-table-column
          label="详细介绍"
          :show-overflow-tooltip="true"
          width="100px"
          align="center"
          prop="detail"
        ></el-table-column> -->
        <el-table-column label="排序" width="50px" align="center" prop="sort"></el-table-column>
        <el-table-column label="小程序价格" width="90px" align="center" prop="retailPrice"></el-table-column>
        <!-- <el-table-column
          label="原价"
          width="90px"
          align="center"
          prop="counterPrice"
        ></el-table-column> -->
        <el-table-column label="已售数量" width="90px" align="center" prop="saleNum"></el-table-column>
        <el-table-column label="状态" align="center" prop="pacStatus" fixed="right" width="100px">
          <template slot-scope="scope">
            <el-switch v-model="scope.row.pacStatus" active-value="0" inactive-value="1"
              @change="handleStatusChange(scope.row)"></el-switch>
            <el-switch v-model="scope.row.pacStatus" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="80px" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
              v-hasPermi="['system:package:edit']" title="修改"></el-button>
            <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
              v-hasPermi="['system:package:remove']" title="删除"></el-button>
            <!-- <el-button size="mini" type="text" icon="el-icon-circle-check" @click="handleSeach(scope.row)"
              v-hasPermi="['system:package:Seach']" title="套餐详情"></el-button> -->
            <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:package:edit']" title="修改"></el-button>
            <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:package:remove']" title="删除"></el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="pag">
        <div class="pag1">
          <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getList" />
          <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
        </div>
      </div>
    </template>
@@ -136,60 +86,26 @@
    <!-- 修改体检套餐对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1400px" append-to-body :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="100px" :inline="true">
        <!-- <div class="dialo">
        <div class="dialo1"> -->
        <!-- 表单内容保持不变 -->
        <el-form-item label="套餐名称" prop="pacName">
          <span slot="label" style="display: inline-block; border-bottom: 2px solid blue" @click="handlePackage">
            套餐名称
          </span>
          <span slot="label" style="display: inline-block; border-bottom: 2px solid blue" @click="handlePackage">套餐名称</span>
          <el-input v-model="form.pacName" placeholder="请输入套餐名称" style="width: 150px" />
        </el-form-item>
        <el-form-item label="套餐状态" prop="pacStatus">
          <!-- <el-radio-group v-model="form.pacStatus">
              <el-radio :label="0">启用</el-radio>
              <el-radio :label="1">停用</el-radio>
            </el-radio-group> -->
          <el-select v-model="form.pacStatus" placeholder="请选择状态" style="width: 150px" filterable clearable>
            <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
            <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <!--  <el-form-item label="套餐类目" prop="categoryId">
          <el-select
            v-model="form.categoryId"
            placeholder="请选择套餐类目"
            style="width: 150px"
            @change="shangpin"
            filterable
            clearablez
          >
            <el-option
              v-for="item in categoryList"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item> -->
        <el-form-item label="体检类别" prop="tjCategory">
          <el-select v-model="form.tjCategory" placeholder="请选择体检类别" style="width: 150px" filterable clearable>
            <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
            <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否上架" prop="isOnSale">
          <!-- <el-radio-group v-model="form.pacStatus">
              <el-radio :label="0">启用</el-radio>
              <el-radio :label="1">停用</el-radio>
            </el-radio-group> -->
          <el-select v-model="form.isOnSale" placeholder="请选择是否上架" style="width: 140px" filterable clearable>
            <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
            <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>
        <el-form-item label="排序" prop="sort">
          <el-input v-model="form.sort" placeholder="请输入排序" style="width: 150px" />
        </el-form-item>
@@ -200,169 +116,79 @@
          <el-input v-model="pics" placeholder="请输入原价" style="width: 150px" />
        </el-form-item>
        <el-form-item label="折扣">
          <el-input-number style="width: 150px" v-model="youhui" :precision="2" :step="0.1" :max="10" :min="0.1"
          @change="debounceNumberChange" :debounce="3000"></el-input-number>
          <el-input-number style="width: 150px" v-model="youhui" :precision="2" :step="0.1" :max="10" :min="0.1" @change="debounceNumberChange" :debounce="3000"></el-input-number>
        </el-form-item>
        <el-form-item label="现价" prop="xianprice">
          <el-input v-model="form.xianprice" placeholder="现价" clearable style="width: 140px" @input="changeXianjia"
            @blur="numberChangeXianPrice(youhui, youhui)" type="number" :debounce="3000" min="0"/>
          <el-input v-model="form.xianprice" placeholder="现价" clearable style="width: 140px" @input="changeXianjia" @blur="numberChangeXianPrice(youhui, youhui)" type="number" :debounce="3000" min="0"/>
        </el-form-item>
        <el-form-item label="关键字" prop="keywords">
          <el-select multiple v-model="form.keywords" placeholder="请选择关键字" style="width: 160px" @change="sel" filterable
            clearable>
          <el-select multiple v-model="form.keywords" placeholder="请选择关键字" style="width: 160px" @change="sel" filterable clearable>
            <el-option v-for="item in keywordList" :key="item.id" :label="item.keyword" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
        <div v-if="!isCollapsed" style="display: flex">
          <div>
            <el-form-item label="套餐描述" prop="pacRemark">
              <el-input type="textarea" v-model="form.pacRemark" placeholder="请输入套餐描述" style="width: 670px"
                rows="2"></el-input>
              <el-input type="textarea" v-model="form.pacRemark" placeholder="请输入套餐描述" style="width: 670px" rows="2"></el-input>
            </el-form-item>
            <el-form-item label="详细介绍" prop="detail">
              <!-- <el-input
            v-model="form.detail"
            placeholder="请输入详细介绍"
            style="width: 200px"
          /> -->
              <editor v-model="form.detail" :min-height="192" style="width: 670px" />
            </el-form-item>
          </div>
          <!-- </div> -->
          <div class="dialo2">
            <el-form-item label="图片">
              <image-upload v-model="form.pacPhone" />
            </el-form-item>
          </div>
          <!-- </div> -->
        </div>
      </el-form>
      <el-button type="primary" plain size="mini" @click="toggleCollapse">{{
        isCollapsed ? "展开" : "收起"
      }}</el-button>
      <!-- <el-button type="primary" plain size="mini" icon="el-icon-plus" @click="addmembers()">新增单项</el-button>
      <el-table v-loading="loading" :data="form.tjProjectList" @selection-change="handleSelectionChange" border
        max-height="275" style="margin: 10px 0">
        <el-table-column label="序号" align="center" type="index" />
        <el-table-column label="项目名称" align="center" prop="proName" width="180px">
          <template slot-scope="scope">
            <el-select filterable v-model="scope.row.proName" placeholder="请选择项目名称" @change="getSelectValue">
              <el-option v-for="(item, index) in allList" :key="index" :label="item.proName" :value="item.proName">
              </el-option>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column label="项目明细" align="center" prop="allSonProName" width="400px" :show-overflow-tooltip="true">
        </el-table-column>
        <el-table-column label="原价(元)" align="center" prop="proPrice" width="80px" />
        <el-table-column label="现价(元)" align="center" prop="priceNow" width="80px">
          <template slot-scope="scope">
            <el-input v-model="scope.row.priceNow" autocomplete="off" placeholder="请输入内容"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button size="mini" type="text" icon="el-icon-circle-plus-outline" @click="addmembers(scope.row)"
              v-hasPermi="['system:package:edit']" title="新增行"></el-button>
            <el-button size="mini" type="text" icon="el-icon-delete" @click.native.prevent="Delete(scope.$index)"
              v-hasPermi="['hosp:consumables:remove']" title="删除"></el-button>
          </template>
        </el-table-column>
      </el-table> -->
      <el-button type="primary" plain size="mini" @click="toggleCollapse">{{ isCollapsed ? "展开" : "收起" }}</el-button>
      <el-row style="display: flex; width: 1300px">
        <el-col>
          <div style="text-align: center; margin-bottom: 10px; margin-top: 10px">
            项目列表
          </div>
          <el-input placeholder="输入关键字进行过滤" @input="handleFilterInput" v-model="queryParams1.nr" clearable />
          <div style="text-align: center; margin-bottom: 10px; margin-top: 10px">项目列表</div>
          <el-input placeholder="输入关键字进行过滤" v-model="filterText" @input="debounceFilter" clearable />
          <div class="tab3" style="height: 365px">
            <el-tree class="filter-tree" v-loading="loading" :data="Treedata" :props="defaultProps" show-checkbox
              node-key="proId" @check-change="handleCurrentChecked" :default-checked-keys="checkedkey"
              :filter-node-method="filterNode" ref="tree" :render-content="renderContent">
            </el-tree>
            <pagination small v-show="total1 > 0" :total="total1" :page.sync="queryParams1.page"
              :limit.sync="queryParams1.pageSize" @pagination="getDataList" />
          </div>
        </el-col>
        <!--  <el-col :span="6">
          <div
            style="text-align: center; margin-bottom: 10px; margin-top: 10px"
          >
            明细项目列表
          </div>
          <div class="tab3">
            <el-tree
              class="filter-tree"
              v-loading="loading"
              :data="TreedataList"
              node-key="proId"
              :data="filteredTreeData"
              :props="defaultProps"
              :filter-node-method="filterNode"
              show-checkbox
              @check-change="handleCurrentChecked1"
              :default-checked-keys="checkedListkey"
              ref="trees"
              node-key="proId"
              @check-change="handleCurrentChecked"
              :default-checked-keys="checkedkey"
              ref="tree"
              :render-content="renderContent"
            >
            </el-tree>
            <pagination
              small
              v-show="total1 > 0"
              :total="total1"
              :page.sync="queryParams1.page"
              :limit.sync="queryParams1.pageSize"
              @pagination="getDataList"
            />
          </div>
        </el-col> -->
        </el-col>
        <el-col>
          <div class="grid-content bg-purple">
            <div style="
                text-align: center;
                margin-bottom: 10px;
                margin-top: 10px;
                margin-left: 8%;
              ">
              已选项目列表
            </div>
            <el-table :data="DataList" border style="width: 90%; margin-left: 20px" height="400"
              :span-method="objectSpanMethod">
              <el-table-column prop="proName" label="检查项目">
              </el-table-column>
              <el-table-column prop="priceOrd" label="原价" align="center" width="80px">
              </el-table-column>
            <div style="text-align: center; margin-bottom: 10px; margin-top: 10px; margin-left: 8%;">已选项目列表</div>
            <el-table :data="DataList" border style="width: 90%; margin-left: 20px" height="400" :span-method="objectSpanMethod">
              <el-table-column prop="proName" label="检查项目"></el-table-column>
              <el-table-column prop="priceOrd" label="原价" align="center" width="80px"></el-table-column>
              <el-table-column label="折扣" width="100px">
                <template slot-scope="scope">
                  <!-- 只输入纯数字折扣 -->
                  <el-input v-model.number="scope.row.limits" @input="calculateDiscount(scope.row)" placeholder="输入折扣"
                    size="small" type="number" min="0" step="0.1" max="10">
                  </el-input>
                  <el-input v-model.number="scope.row.limits" @input="calculateDiscount(scope.row)" placeholder="输入折扣" size="small" type="number" min="0" step="0.1" max="10"></el-input>
                </template>
              </el-table-column>
              <el-table-column prop="priceNow" label="现价" width="80px" align="center">
              </el-table-column>
              <el-table-column prop="priceNow" label="现价" width="80px" align="center"></el-table-column>
              <el-table-column label="操作" align="center" width="80px">
                <template slot-scope="scope">
                  <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete1(scope.row)" title="删除">
                  </el-button>
                  <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete1(scope.row)" title="删除"></el-button>
                </template>
              </el-table-column>
              <!-- <el-table-column prop="proName" label="明细项目" width="260px">
              </el-table-column> -->
              <!-- <el-table-column
                label="操作"
                align="center"
                fixed="right"
                class-name="small-padding fixed-width"
                width="50px"
              >
                <template slot-scope="scope">
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-delete"
                    @click="handleDeletes(scope.row)"
                    title="删除"
                  ></el-button>
                </template>
              </el-table-column>-->
            </el-table>
            <h4 style="font-weight: 600;padding-left:20px">一共选中{{DataList.length}}项,合计:{{ form.xianprice }}元</h4>
          </div>
@@ -375,22 +201,6 @@
      </div>
    </el-dialog>
    <!-- 套餐详情 -->
    <!-- <el-dialog :title="title" :visible.sync="Seachopen" width="500px" append-to-body>
      <template>
        <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
        <div style="margin: 15px 0px; width: 60px"></div>
        <el-checkbox-group v-model="newproName" @change="handleCheckedCitiesChange">
          <el-checkbox style="margin: 15px 0px; width: 180px" v-for="item in allList" :label="item.proName"
            :key="item.proId">{{ item.proName }}</el-checkbox>
        </el-checkbox-group>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="submitcheckbox">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog> -->
    <Packages ref="aaa" @add="handleChanges" />
  </div>
</template>
@@ -425,7 +235,10 @@
  data() {
    return {
      pics: 0,
      filterText: "",
      filterText: '',
      filteredTreeData: [],
      debounceTimer: null,
      originalTreeData: [],
      DataList: [],
      list1: true,
      activeName: "1",
@@ -486,10 +299,15 @@
      },
      forms: {},
      youhui: 10,
      debounceTimer: null,
      rules: {},
      initializing: true, // 初始化标志
      initializing: true,
    };
  },
  watch: {
    Treedata(newVal) {
      this.originalTreeData = JSON.parse(JSON.stringify(newVal));
      this.filteredTreeData = this.originalTreeData;
    }
  },
  created() {
    this.getList();
@@ -497,11 +315,37 @@
    this.getCategory();
  },
  methods: {
    debounceFilter() {
      clearTimeout(this.debounceTimer);
      this.debounceTimer = setTimeout(() => {
        this.filterTree();
      }, 600);
    },
    filterTree() {
      if (!this.filterText) {
        this.filteredTreeData = this.originalTreeData;
        return;
      }
      const filterTextLower = this.filterText.toLowerCase();
      this.filteredTreeData = this.filterNodes(this.originalTreeData, filterTextLower);
    },
    filterNodes(nodes, filterText) {
      return nodes.filter(node => {
        const matches = node.proName.toLowerCase().includes(filterText) ||
                       (node.proEngName && node.proEngName.toLowerCase().includes(filterText));
        if (matches) return true;
        if (node.children && node.children.length) {
          node.children = this.filterNodes(node.children, filterText);
          return node.children.length > 0;
        }
        return false;
      });
    },
    debounceNumberChange(currentValue, oldValue) {
      clearTimeout(this.debounceTimer);
      this.debounceTimer = setTimeout(() => {
        this.numberChange(currentValue, oldValue);
      }, 300);
      }, 1000);
    },
    numberChange(currentValue, oldValue) {
      this.$confirm("确定修改所有子项的折扣吗?", "提示", {
@@ -547,10 +391,6 @@
    },
    toggleCollapse() {
      this.isCollapsed = !this.isCollapsed;
    },
    filterNode(value, data) {
      if (!value) return true;
      return data.proName.indexOf(value) !== -1 || data.proEngName.indexOf(value) !== -1;
    },
    getList() {
      this.loading = true;
@@ -607,7 +447,9 @@
        counterPrice: null,
        limits: 10,
      };
      this.initializing = true;
      this.filterText = '';
      this.filteredTreeData = this.originalTreeData;
      this.initializing = true;
      this.resetForm("form");
    },
    handleQuery() {
@@ -648,6 +490,7 @@
      this.queryParams1.page = 1;
      this.checkedListkey = [];
      this.checkedNodes = [];
      this.filterText = '';
      this.getDataList();
    },
    handleStatusChange(row) {
@@ -824,23 +667,20 @@
        this.Treedata = response.data.list;
        this.total1 = response.data.total;
        this.pics = this.DataList.reduce((total, item) => total + item.priceOrd, 0);
        this.filteredTreeData = this.Treedata;
        this.originalTreeData = JSON.parse(JSON.stringify(this.Treedata));
        this.$nextTick(() => {
          this.$refs.tree.setCheckedKeys(this.checkedNodes);
          this.initializing = false;
          this.loading = false;
        });
      });
      this.loading = false;
    },
    handleFilterInput() {
      this.queryParams1.page = 1;
      this.getDataList();
      this.$nextTick(() => {
        this.$refs.tree.setCheckedKeys(this.checkedNodes);
      }).catch(() => {
        this.loading = false;
      });
    },
    handleCurrentChecked(data, checked, indeterminate) {
      if (this.initializing) {
        return; // 初始化时不处理
        return;
      }
      if (checked) {
        if (!this.DataList.some((item) => item.proId === data.proId)) {
@@ -999,6 +839,7 @@
  },
};
</script>
<style>
.el-tooltip__popper {
  max-width: 800px;
@@ -1034,13 +875,4 @@
  overflow-y: auto;
  border: 1px solid #d9d9d9;
}
/* .custom-tree-node {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    padding-right: 8px;
  } */
</style>