qinxianzhangyao
2024-04-26 9cdbb01ce10a69fb00d0e9f6dc3b9523d266079b
src/components/createproposal/index.vue
@@ -6,12 +6,25 @@
      width="1200px"
      append-to-body
    >
    <el-form ref="form" :model="propform" label-width="80px">
      <el-form ref="form" :model="propform" label-width="80px">
        <el-form-item label="建议标题" prop="title">
          <el-input v-model="propform.title" placeholder="请输入名称标题" />
        </el-form-item>
        <el-form-item label="快捷标签" prop="title">
          <el-input v-model="propform.title" placeholder="请输入名称标题" />
        <el-form-item label="快捷标签" prop="kjbq">
          <span slot="label" style="display:inline-block;border-bottom: 2px solid blue;" @click="handleQuery">
            快捷标签
              </span>
          <el-checkbox-group
            v-model="propform.kjbq"
            @change="handleCheckedCitiesChange"
          >
            <el-checkbox
              v-for="(item, index) in dataList"
              :key="index"
              :label="item.id"
              >{{ item.kjbq }}</el-checkbox
            >
          </el-checkbox-group>
        </el-form-item>
        <el-form-item label="建议内容" prop="advice">
          <el-input
@@ -22,118 +35,138 @@
          />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="open = false">取 消</el-button>
        <el-button type="primary" @click="handleOk">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="添加快捷标签" :visible.sync="kjbqopen" width="500px" append-to-body>
      <el-form ref="form" :model="form"  label-width="80px">
        <el-form-item label="名称" prop="kjbq">
          <el-input v-model="form.kjbq" placeholder="请输入名称" />
        </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 {
  getKjTjAdviceKjbqBySex,
  getCyTjAdviceKjbqBySex,
} from "@/api/hosp/project";
  getTjAdviceKjbqByFl,
  addCyTjAdvice,addTjAdviceKjbq
} from "@/api/system/biaoqianzidian";
import { getInfo } from "@/api/login";
export default {
  name: "Packagese",
  name: "createproposal",
  props: {
    cusobj: Object,
    textarea1: String,
  },
  data() {
    return {
      tjproposal: "0",
      propform: {
        advice: "",
        kjbq: [],
      },
      form:{
      },
      kjbqopen: false,
      open: false,
      openone: false,
      // 弹出层标题
      title: "",
      total: 0,
      dataList: [],
      // 遮罩层
      loading: false,
      queryParams: {
        sex: "",
        isZj: "",
        userId: "",
        page: 1,
        pageNum: 1,
        pageSize: 10,
        userId: null,
        qyzt: 0,
      },
      list: [],
      fList: {},
      fList: [],
      id: "",
    };
  },
  watch: {
    cusobj(val, newVla) {
      // console.log(val,newVla,1111)
      this.fList= val
      this.queryParams.sex = val.sex;
      this.queryParams.isZj = val.isZj;
      if (this.queryParams.sex) {
        this.getList();
      }
    textarea1(val, newVla) {
      this.propform.advice = val;
    },
  },
  mounted() {
    // this.getList()
    this.propform.kjbq =[]
    this.getList()
  },
  created() {
    // if( this.queryParams){
    //     this.getList()
    // }
        this.getList()
  },
  methods: {
    getAllList() {
      this.loading = true;
      this.openone = true;
      getTjHyBgList(this.queryParams).then((res) => {
        this.dataList = res.data.records;
        this.loading = false;
      });
    },
    getList() {
      this.loading = true;
      getKjTjAdviceKjbqBySex(this.queryParams).then((res) => {
        this.dataList = res.data.records;
        this.total = res.data.total;
        this.loading = false;
      getInfo().then((res) => {
        this.form.userId = res.user.userId;
        this.queryParams.userId = res.user.userId;
        getTjAdviceKjbqByFl(this.queryParams).then((res) => {
          if (res.data) {
            this.dataList = res.data.records;
          }
          this.loading = false;
        });
      });
    },
    handleQuery() {
      this.getAllList();
    handleQuery(){
      this.kjbqopen = true;
    },
    handleSelectionChange(selection) {
    //   if (selection.length > 1) {
    //     this.$refs.elTable.clearSelection(); // 清空所有选择
    //     this.$refs.elTable.toggleRowSelection(selection.pop()); // 设置选择项
    //   }
      this.list = selection;
      console.log( this.list)
    cancel(){
      this.kjbqopen = false;
    },
    radiotjproposalChange() {
      if (this.tjproposal == "0") {
        this.queryParams.isZj = this.fList.isZj;
        this.getList();
      } else {
        this.loading = true;
        getInfo().then((res) => {
          this.queryParams.userId = res.user.userId;
          this.queryParams.isZj = null;
          getCyTjAdviceKjbqBySex(this.queryParams).then((res) => {
            this.dataList = res.data.records;
            this.total = res.data.total;
            this.loading = false;
          });
        });
      }
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateTjAdviceKjbq(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.kjbqopen = false;
              this.getList();
            });
          } else {
            addTjAdviceKjbq(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.kjbqopen = false;
              this.getList();
            });
          }
        }
      });
    },
    handleCheckedCitiesChange(val) {
    },
    handleOk() {
      this.open = false;
      if (this.list.length != 0) {
        this.$emit("event1", this.list);
      }
      let data = {
        title: this.propform.title,
        isZj: 1,
        kjbq: this.propform.kjbq.toString(),
        advice: this.propform.advice,
      };
      addCyTjAdvice(data).then((res) => {
        if (res.code == 200) {
          this.open = false;
        }
      });
      // if (this.list.length != 0) {
      //   this.$emit("event1", this.list);
      // }
    },
  },
};