WXL
2024-01-16 ad70f145e8bea957b41043b4a1e37ce37cc5ed1e
src/views/knowledge/education/compilequer/index.vue
@@ -28,14 +28,19 @@
              filterable
              placeholder="请选择分类"
            >
              <el-option
                class="ruleFormaa"
                v-for="item in sortlist"
                :key="item.id"
                :label="item.assortname"
                :value="item.id"
              <el-option-group
                v-for="group in sortlist"
                :key="group.id"
                :label="group.assortname"
              >
              </el-option>
                <el-option
                  v-for="item in group.heLibraryAssortList"
                  :key="item.id"
                  :label="item.assortname"
                  :value="item.id"
                >
                </el-option>
              </el-option-group>
            </el-select>
          </el-form-item>
          <el-form-item label="宣教标题" prop="preachname">
@@ -43,9 +48,9 @@
              <el-input v-model="ruleForm.preachname"></el-input>
            </div>
          </el-form-item>
          <el-form-item label="宣教描述" prop="preachdescription">
          <el-form-item label="宣教描述" prop="preachcontent">
            <div style="width: 30%">
              <el-input v-model="ruleForm.preachdescription"></el-input>
              <el-input v-model="ruleForm.preachcontent"></el-input>
            </div>
          </el-form-item>
          <el-form-item label="通知变量" prop="name">
@@ -256,7 +261,9 @@
            <el-button type="success" @click="nextstep('ruleForm')"
              >下一步</el-button
            >
            <el-button @click="resetForm('ruleForm')">重置</el-button>
            <el-button type="success" @click="Departmenttreatment('ruleForm')"
              >保存</el-button
            >
            <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
          </el-form-item>
        </el-form>
@@ -537,34 +544,27 @@
  methods: {
    getList() {
      this.loading = true;
      getlibraryinfo({ id: this.$route.query.id }).then((res) => {
        this.ruleForm = res.data;
        this.tempDetpRelevanceslist = JSON.parse(this.ruleForm.deptNames);
        this.ruleForm.suitway = this.ruleForm.suitway.split(",");
        this.variablelist = JSON.parse(this.ruleForm.otherdata)
      this.id = this.$route.query.id;
      getlibraryinfo({ id: this.id }).then((res) => {
        this.ruleForm = res.data[0];
        if (this.ruleForm.deptNames) {
          this.tempDetpRelevanceslist = JSON.parse(this.ruleForm.deptNames);
        }
        if (this.ruleForm.suitway) {
          this.ruleForm.suitway = this.ruleForm.suitway.split(",");
        }
        this.variablelist = this.ruleForm.otherdata
          ? JSON.parse(this.ruleForm.otherdata)
          : this.variablelist;
      });
      getheLibraryAssort({}).then((res) => {
        this.sortlist = res.rows;
        console.log(res);
      });
      listDept(this.queryParams).then((response) => {
        this.deptList = this.handleTree(response.data, "deptId");
      });
      this.loading = false;
    },
    /** 查询标签列表 */
    gettabList() {
      const tagqueryParams = {
        pageNum: 1,
        pageSize: 1000,
        tagcategoryid: "0",
      };
      listtag(tagqueryParams).then((response) => {
        console.log(response);
        this.optionstag = response.rows;
      });
    },
    submitForm(formName) {
@@ -572,9 +572,15 @@
      this.dynamicTags.forEach((item) => {
        tgs.push(item.tagname);
      });
      this.ruleForm.labelInfo = tgs.join(",");
      console.log(tgs.length, "tgs");
      this.ruleForm.labelInfo = tgs.length != 0 ? tgs.join(", ") : "";
      this.ruleForm.otherdata = JSON.stringify(this.variablelist);
      this.ruleForm.suitway = this.ruleForm.suitway.join(",");
      console.log(22);
      this.ruleForm.suitway =
        this.ruleForm.suitway.length != 0
          ? this.ruleForm.suitway.join(",")
          : "";
      if (this.id) {
        this.ruleForm.isoperation = 2;
        compilelibrary(this.ruleForm).then((response) => {
@@ -619,11 +625,9 @@
    // 科室处理
    Departmenttreatment() {
      this.ruleForm.deptNames = JSON.stringify(this.tempDetpRelevanceslist);
      console.log(this.tempDetpRelevanceslist);
      const result = this.tempDetpRelevanceslist.map(
        (subArr) => subArr[subArr.length - 1]
      );
      console.log(result);
      // id数组查数组对象
      result.forEach((item) => {
        const condition = this.ruleForm.tempDetpRelevances.some(
@@ -631,13 +635,11 @@
        );
        if (!condition) {
          listDept({ deptId: item }).then((res) => {
            console.log(res.data[0]);
            res.data[0].type = 2;
            this.ruleForm.tempDetpRelevances.push(res.data[0]);
          });
        }
      });
      console.log(this.ruleForm.tempDetpRelevances);
      // 数组对象查id数组
      this.ruleForm.tempDetpRelevances.forEach((item) => {
        const condition = result.some((obj) => obj === item.deptId);
@@ -646,7 +648,6 @@
          this.ruleForm.tempDetpRelevances[index].delFlag = 1;
        }
      });
      console.log(this.ruleForm.tempDetpRelevances);
      setTimeout(() => {
        this.submitForm();
      }, 1000);
@@ -684,13 +685,10 @@
        tagcategoryid: "0",
      };
      listtag(tagqueryParams).then((response) => {
        console.log(response);
        this.optionstag = response.rows;
      });
    },
    handleClosetag(tag) {
      console.log(tag);
      console.log(this.dynamicTags.indexOf(tag));
      const lindex = this.dynamicTags.indexOf(tag);
      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
      this.ruleForm.heLibraryTagList[lindex].isoperation = 3;
@@ -745,12 +743,10 @@
        pageSize: 100,
      };
      getillnesslist(illnessqueryParams).then((response) => {
        console.log(response);
        this.optionsillness = response.rows;
      });
      getillness({ outid: this.$route.query.id, type: 6 }).then((res) => {
        this.illnesslist = res.rows;
        console.log(res);
      });
    },
    handleCloseillness(tag) {
@@ -760,7 +756,6 @@
      }
    },
    remoteMethod(value) {
      console.log(value);
      const illnessqueryParams = {
        pageNum: 1,
        pageSize: 100,