qx
qx
2025-04-15 d65aa7fee641733e13fcbcd6c326d6bd27a45d96
src/views/hosp/advicerules/index.vue
@@ -109,91 +109,127 @@
      ></right-toolbar>
    </el-row>
    <el-table
      v-loading="loading"
      :data="advicerulesList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" width="50" align="center">
        <template slot-scope="scope">
          {{ scope.$index + 1 }}
          <!-- 使用 $index 来显示序号,从1开始 -->
        </template>
      </el-table-column>
      <el-table-column label="编码" align="center" prop="bm" />
      <el-table-column label="科室" align="center" prop="ks" />
      <el-table-column label="检查项目" align="center" prop="jcxm" />
      <el-table-column
        label="主要诊断"
        align="center"
        :show-overflow-tooltip="true"
        width="120"
        prop="zyzd"
      />
      <el-table-column
        label="建议名称"
        align="center"
        :show-overflow-tooltip="true"
        width="150"
        prop="jymc"
      />
      <el-table-column
        label="建议内容"
        align="center"
        :show-overflow-tooltip="true"
        width="200"
        prop="jynr"
      />
      <el-table-column label="性别" align="center" prop="xb"  :formatter="formatSex" />
      <el-table-column label="范围" align="center" prop="fwz" />
      <el-table-column label="范围最小值" align="center" prop="fwzxz" />
      <el-table-column label="范围最大值" align="center" prop="fwzdz" />
      <el-table-column label="异常标志" align="center" prop="ycbz" />
      <el-table-column label="是否疾病" align="center" prop="sfjb">
      </el-table-column>
      <el-table-column label="是否常见病" align="center" prop="sfcjb">
      </el-table-column>
      <el-table-column label="是否慢性病" align="center" prop="sfmxb">
      </el-table-column>
      <el-table-column
        label="是否重大疾病"
        align="center"
        width="120"
        prop="sfzdjb"
      ></el-table-column>
      <el-table-column
        label="操作"
        align="center"
        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="['hosp:advicerules:edit']"
    <el-row :gutter="20" style="display: flex">
      <el-col :span="4" :xs="24">
        <div class="head-container">
          <el-input
            v-model="xmmc"
            placeholder="请输入项目名"
            clearable
            size="small"
            prefix-icon="el-icon-search"
            style="margin-bottom: 20px"
          />
        </div>
        <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"
            />
          </div>
        </div>
      </el-col>
      <div style="width: 100%">
        <el-table
          v-loading="loading"
          :data="advicerulesList"
          @selection-change="handleSelectionChange"
          height="520"
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="序号" width="50" align="center">
            <template slot-scope="scope">
              {{ scope.$index + 1 }}
              <!-- 使用 $index 来显示序号,从1开始 -->
            </template>
          </el-table-column>
          <el-table-column label="编码" align="center" prop="bm" />
          <el-table-column label="科室" align="center" prop="ks" />
          <el-table-column label="检查项目" align="center" prop="jcxm" />
          <el-table-column
            label="主要诊断"
            align="center"
            :show-overflow-tooltip="true"
            width="120"
            prop="zyzd"
          />
          <el-table-column
            label="建议名称"
            align="center"
            :show-overflow-tooltip="true"
            width="150"
            prop="jymc"
          />
          <el-table-column
            label="建议内容"
            align="center"
            :show-overflow-tooltip="true"
            width="200"
            prop="jynr"
          />
          <el-table-column
            label="性别"
            align="center"
            prop="xb"
            :formatter="formatSex"
          />
          <el-table-column label="范围" align="center" prop="fwz" />
          <el-table-column label="范围最小值" align="center" prop="fwzxz" />
          <el-table-column label="范围最大值" align="center" prop="fwzdz" />
          <el-table-column label="异常标志" align="center" prop="ycbz" />
          <el-table-column label="是否疾病" align="center" prop="sfjb">
          </el-table-column>
          <el-table-column label="是否常见病" align="center" prop="sfcjb">
          </el-table-column>
          <el-table-column label="是否慢性病" align="center" prop="sfmxb">
          </el-table-column>
          <el-table-column
            label="是否重大疾病"
            align="center"
            width="120"
            prop="sfzdjb"
          ></el-table-column>
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['hosp:advicerules:remove']"
          >
          </el-button>
        </template>
      </el-table-column>
    </el-table>
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['hosp:advicerules:edit']"
              >
              </el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['hosp:advicerules:remove']"
              >
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-row>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
      @pagination="getListByXmId"
    />
    <!-- 添加或修改体检项目建议规则新表对话框 -->
@@ -486,6 +522,7 @@
  delAdvicerules,
  addAdvicerules,
  updateAdvicerules,
  getTjProAdvicerulesKsList,
} from "@/api/hosp/advicerules";
import { listAdvice } from "@/api/advice/advice";
import { getToken } from "@/utils/auth";
@@ -512,8 +549,11 @@
      // 体检项目建议规则新表表格数据
      advicerulesList: [],
      adviceList: [],
      deptOptions: [],
      treeId: [],
      // 弹出层标题
      title: "",
      xmmc: "",
      // 是否显示弹出层
      open: false,
      key: "",
@@ -521,6 +561,10 @@
      businessName: "exampleBusiness", // 示例业务名
      objs: {},
      departmentOptions: [],
      defaultProps: {
        children: "children",
        label: "label",
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
@@ -573,15 +617,73 @@
  created() {
    this.getList();
  },
  watch: {
    // 根据名称筛选部门树
    xmmc(val) {
      this.$refs.tree.filter(val);
    },
    treeId(newVal, oldVal) {
      if (newVal) {
        this.$nextTick(() => {
          document
            .querySelector(".el-tree-node__children .el-tree-node__content")
            .click();
        });
      }
    },
  },
  methods: {
    /** 查询体检项目建议规则新表列表 */
    getList() {
      this.loading = true;
      /* this.loading = true;
      listAdvicerules(this.queryParams).then((response) => {
        this.advicerulesList = response.rows;
        this.total = response.total;
        this.loading = false;
      }); */
      getTjProAdvicerulesKsList().then((response) => {
        this.deptOptions = response.data.map((name, index) => {
          return {
            id: index + 1, // 可自定义唯一 ID
            label: name, // el-tree 默认的显示字段
          };
        });
        // 设置默认展开项
        this.treeId = [this.deptOptions[0]?.id];
        this.queryParams.proId = this.deptOptions[0]?.id;
        this.getListByXmId();
      });
    },
    getListByXmId() {
      this.loading = true;
      listAdvicerules(this.queryParams).then((response) => {
        response.rows.forEach((item, index) => {
          item.newID =
            (this.queryParams.pageNum - 1) * this.queryParams.pageSize +
            index +
            1;
        });
        this.advicerulesList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    handleNodeClick(data) {
      this.formIn = data;
      this.queryParams.ks = data.label;
      this.getListByXmId();
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true;
      // return data.label.indexOf(value) !== -1;
      return (
        data.label &&
        typeof data.label === "string" &&
        data.label.indexOf(value) !== -1
      );
    },
    idFn(value) {
@@ -820,4 +922,24 @@
  },
};
</script>
<style scoped>
.scrollable-container {
  width: 260px;
  /* 设置容器的宽度 */
  height: 629px;
  /* 设置容器的高度 */
  overflow: auto;
  /* 允许内容溢出时显示滚动条 */
  border: 1px solid #ccc;
  /* 可选:添加边框以更好地显示容器 */
  position: relative;
  /* 可选:使容器内的绝对定位元素能够正确显示 */
}
.content {
  width: 1000px;
  /* 设置内容的宽度,以触发水平滚动条 */
  height: 1000px;
  /* 设置内容的高度,以触发垂直滚动条 */
}
</style>