lkk
2025-03-06 c3a1b74679f3bb9796611e431b18e420bba9de58
kuaijie&changyog
2个文件已添加
548 ■■■■■ 已修改文件
src/views/hosp/commonAdvice/index.vue 281 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hosp/quickAdvice/index.vue 267 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hosp/commonAdvice/index.vue
New file
@@ -0,0 +1,281 @@
<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="标题" prop="bt">
        <el-input
          v-model="queryParams.bt"
          placeholder="请输入标题"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="建议" prop="nr">
        <el-input
          v-model="queryParams.nr"
          placeholder="请输入检查项目"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>
    <el-table
      :data="dataList"
      ref="elTable"
      v-loading="loading"
      @selection-change="handleSelectionChange"
      border
      height="580px"
    >
      <el-table-column type="selection" width="40" align="center" />
      <el-table-column label="序号" width="70" align="center" prop="newID" />
      <el-table-column label="标题" width="120" align="center" prop="title" />
      <el-table-column label="建议内容" align="left" prop="advice" />
      <el-table-column
        label="操作"
        align="center"
        fixed="right"
        class-name="small-padding fixed-width"
        width="100px"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleEdit(scope.row)"
            title="修改"
          ></el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            title="删除"
          ></el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.page"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 修改快速建议标题和内容 -->
    <el-dialog
      :title="title"
      :visible.sync="open"
      width="1000px"
      append-to-body
      :close-on-click-modal="false"
    >
      <el-form ref="form" :model="form" label-width="80px" :inline="true">
        <el-form-item label="标题" prop="title">
          <el-input
            v-model="form.title"
            placeholder="请输入标题"
            style="width: 200px"
          />
        </el-form-item>
        <el-form-item label="内容" prop="advice">
          <el-input
            v-model="form.advice"
            type="textarea"
            placeholder="请输入主要内容"
            style="width: 780px"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
    <script>
import {
  updateAdvice,
  addAdvice,
  getAdvice,
  delAdvice
} from "@/api/advice/advice";
import {
  getKjTjAdviceKjbqBySex,
  getCyTjAdviceKjbqBySex,
} from "@/api/hosp/project";
import { getInfo } from "@/api/login";
export default {
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      // 总条数
      total: 0,
      // 体检项目建议规则新表表格数据
      dataList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      showSearch: true,
      // 查询参数
      queryParams: {
        page: 1,
        pageSize: 10,
        bt: "",
        nr: "",
        isZj: "",
        userId: "",
      },
      // 表单参数
      form: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询体检项目建议规则新表列表 */
    getList() {
      this.loading = true;
      getInfo().then((res) => {
        this.queryParams.userId = res.user.userId;
        this.queryParams.isZj = null;
        getCyTjAdviceKjbqBySex(this.queryParams).then((res) => {
          if (res.data) {
            this.dataList = res.data.records.map((item, index) => ({
              ...item,
              newID:
                (this.queryParams.page - 1) * this.queryParams.pageSize +
                index +
                1,
            }));
            this.total = res.data.total;
          } else {
            this.dataList = [];
            this.total = 0;
            this.$modal.msgError(res.msg);
          }
          this.loading = false;
        });
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        title: null,
        advice: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.$forceUpdate();
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateAdvice(this.form).then((response) => {
              console.log(response, 1111333);
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addAdvice(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    handleEdit(row) {
      this.reset();
      const id = row.id || this.ids;
      this.kjbq = [];
      getAdvice(id).then((response) => {
        console.log(response, 55566);
        this.form = response.data;
        this.open = true;
        // this.form.deptId = this.queryParams.deptId;
        this.title = "体检建议信息维护";
      });
    },
    handleDelete(row) {
      const ids = row.id || this.ids; // 获取主键值,如果row中没有主键值,则使用this.ids
      this.$modal
        .confirm(`是否确认删除"${ids}"的数据项?`)
        .then(() => {
          return delAdvice(ids); // 调用删除接口,传入主键值
        })
        .then(() => {
          this.getList(); // 删除成功后刷新列表
          this.$modal.msgSuccess("删除成功"); // 显示删除成功的提示
        })
        .catch(() => {
          // 异常处理
        });
    },
  },
};
</script>
src/views/hosp/quickAdvice/index.vue
New file
@@ -0,0 +1,267 @@
<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="标题" prop="bt">
        <el-input
          v-model="queryParams.bt"
          placeholder="请输入标题"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="建议" prop="nr">
        <el-input
          v-model="queryParams.nr"
          placeholder="请输入检查项目"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>
    <el-table
      :data="dataList"
      ref="elTable"
      v-loading="loading"
      @selection-change="handleSelectionChange"
      border
      height="580px"
    >
      <el-table-column type="selection" width="40" align="center" />
      <el-table-column label="序号" width="70" align="center" prop="newID" />
      <el-table-column label="标题" width="120" align="center" prop="title" />
      <el-table-column label="建议内容" align="left" prop="advice" />
      <el-table-column
        label="操作"
        align="center"
        fixed="right"
        class-name="small-padding fixed-width"
        width="100px"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleEdit(scope.row)"
            title="修改"
          ></el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            title="删除"
          ></el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.page"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 修改快速建议标题和内容 -->
    <el-dialog
      :title="title"
      :visible.sync="open"
      width="1000px"
      append-to-body
      :close-on-click-modal="false"
    >
      <el-form
        ref="form"
        :model="form"
        label-width="80px"
        :inline="true"
      >
        <el-form-item label="标题" prop="title">
          <el-input
            v-model="form.title"
            placeholder="请输入标题"
            style="width: 200px"
          />
        </el-form-item>
        <el-form-item label="内容" prop="advice">
          <el-input
            v-model="form.advice"
            type="textarea"
            placeholder="请输入主要内容"
            style="width: 780px"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
  <script>
import { listAdvice, updateAdvice, addAdvice,getAdvice,delAdvice } from "@/api/advice/advice";
export default {
  name: "Advicerules",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      // 总条数
      total: 0,
      // 体检项目建议规则新表表格数据
      dataList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      showSearch: true,
      // 查询参数
      queryParams: {
        page: 1,
        pageSize: 10,
        bt: "",
        nr: "",
      },
      querycharge: {
        pageNum: 1,
        pageSize: 10,
      },
      // 表单参数
      form: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询体检项目建议规则新表列表 */
    getList() {
      this.loading = true;
      listAdvice(this.queryParams).then((response) => {
        response.data.list.forEach((item, index) => {
          item.newID =
            (this.queryParams.page - 1) * this.queryParams.pageSize + index + 1;
        });
        this.dataList = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        title: null,
        advice: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.$forceUpdate();
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateAdvice(this.form).then((response) => {
              console.log(response, 1111333);
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addAdvice(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    handleEdit(row) {
      this.reset();
      const id = row.id || this.ids;
      this.kjbq = [];
      getAdvice(id).then((response) => {
        console.log(response,55566);
        this.form = response.data;
        this.open = true;
        // this.form.deptId = this.queryParams.deptId;
        this.title = "体检建议信息维护";
      });
    },
    handleDelete(row) {
      const id = row.id || this.ids; // 获取主键值,如果row中没有主键值,则使用this.ids
      this.$modal
        .confirm(`是否确认删除"${id}"的数据项?`)
        .then(() => {
          return delAdvice(id); // 调用删除接口,传入主键值
        })
        .then(() => {
          this.getList(); // 删除成功后刷新列表
          this.$modal.msgSuccess("删除成功"); // 显示删除成功的提示
        })
        .catch(() => {
          // 异常处理
        });
    },
  },
};
</script>