luobisheng
2022-11-29 237197fbfb7e54bdbeb0f16e7907790a8097c9f6
src/views/operate/message/myIndex/update/index.vue
@@ -13,8 +13,8 @@
          <!-- 提醒方式 -->
          <el-form-item class="optionItem" label="提醒方式:" prop="channelCode">
            <el-radio-group v-model="role.channelCode">
              <el-radio value="01">站内信</el-radio>
              <el-radio value="03">邮件</el-radio>
              <el-radio label="01">站内信</el-radio>
              <el-radio label="03">邮件</el-radio>
            </el-radio-group>
            <span class="message-tip">(短信可用数: 1000条)</span>
          </el-form-item>
@@ -66,6 +66,7 @@
                    show-checkbox
                    @check="handleCheck"
                    default-expand-all
                    :default-checked-keys="checkedList"
                    node-key="id"
                  >
                  </el-tree>
@@ -148,11 +149,11 @@
    };
    return {
      role: {
        messageType: "",
        messageType: null,
        head: "",
        targetTo: "",
        body: "",
        channelCode: "01",
        channelCode: null,
      },
      createRoleRules: {
        messageType: [
@@ -196,7 +197,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}人`;
            }
          })
          .catch(err => this.$message.error(`${err}`))
    }
@@ -218,7 +222,7 @@
    async getColumnList() {
      await this.$axios({
        method: "get",
        url: "sccg/message_column/getAllColumn",
        url: "sccg/message_column/getShowColumn",
      }).then((res) => {
        this.colList = res.data;
      });
@@ -265,13 +269,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保存消息)
@@ -289,6 +290,9 @@
            targetTo: this.checkedList.join(","),
            status: mystatus,
          };
          if (this.role.channelCode === '03') {
            delete params.messageType;
          }
          if (this.type === "create") {
            sendMessage(params)
              .then(() => {
@@ -302,7 +306,7 @@
                })
              );
          } else {
            updateMessage(params)
            updateMessage({ id: this.myDataRow.id, ...params })
              .then(() => {
                this.$emit("closeMyDialog");
                this.$message({ type: "success", message: "操作成功" });
@@ -340,6 +344,7 @@
    // 消息预览
    handleView() {
      this.role.body = this.$refs.edit.editor.txt.html();
      this.$refs.user.validate((valid) => {
        if (valid) {
          const { body, head, channelCode } = this.role;