fangyuan
2022-12-16 9ff66017debadfc89bc0c1b796684a4d1dbe2bc3
src/views/operate/message/myIndex/update/index.vue
@@ -9,9 +9,10 @@
          :model="role"
          :rules="createRoleRules"
          label-position="right"
          :disabled="type === 'view'"
        >
          <!-- 提醒方式 -->
          <el-form-item class="optionItem" label="提醒方式:" prop="channelCode">
          <el-form-item class="optionItem" label="提醒方式:" prop="channelCode" >
            <el-radio-group v-model="role.channelCode">
              <el-radio label="01">站内信</el-radio>
              <el-radio label="03">邮件</el-radio>
@@ -66,6 +67,7 @@
                    show-checkbox
                    @check="handleCheck"
                    default-expand-all
                    :default-checked-keys="checkedList"
                    node-key="id"
                  >
                  </el-tree>
@@ -83,21 +85,24 @@
                type="primary"
                @click.native.prevent="handleSubmit(0)"
                class="btn save"
                v-if="type !== 'view'"
                >保存
              </el-button>
              <el-button
                type="primary"
                @click.native.prevent="handleSubmit(1)"
                class="btn submit"
                v-if="type !== 'view'"
                >发布
              </el-button>
              <el-button
                type="primary"
                @click.native.prevent="handleView"
                class="btn submit"
                v-if="type !== 'view'"
                >预览
              </el-button>
              <el-button class="btn cancel" @click.native.prevent="handleReset"
              <el-button class="btn cancel" @click.native.prevent="handleReset" v-if="type !== 'view'"
                >重置</el-button
              >
            </div>
@@ -196,7 +201,10 @@
      getMessageById(this.myDataRow.id)
          .then(res => {
            this.role = res;
            this.role.targetTo = `${this.role.targetTo.split(',').length}人`;
            if (res.targetTo) {
              this.checkedList = res.targetTo.split(',');
              this.role.targetTo = `${this.checkedList.length}人`;
            }
          })
          .catch(err => this.$message.error(`${err}`))
    }
@@ -205,6 +213,7 @@
    if (this.type !== 'create') {
      this.$refs.edit.editor.txt.append(this.myDataRow.body);
    }
  },
  methods: {
    // 关闭弹窗
@@ -231,7 +240,9 @@
        this.getColumnList();
      }
    },
    getType(){
      return this.type;
    },
    // 获取部门树
    async getDepartList() {
      await this.$axios({
@@ -265,13 +276,10 @@
    // 选中id
    handleCheck(data, node) {
      node.checkedNodes.forEach((item) => {
        if (!item.hasOwnProperty("departType")) {
          this.checkedList.push(item.id);
          this.tempNameArr.push(item.departName);
        }
      });
      this.role.targetTo = this.checkedList.length + "人";
      const checkedNodes = node.checkedNodes.filter(item => !item.children);
      this.checkedList = checkedNodes.map(item => item.id);
      this.tempNameArr = checkedNodes.map(item => item.departName);
      this.role.targetTo = this.checkedList.length ? this.checkedList.length + "人" : null;
    },
    // 新建/保存消息(1:新建,0保存消息)