马宇豪
2023-07-11 2aa05e09b21af76f4803f0f33174453db72b9433
src/views/Admin/massSend.vue
@@ -101,8 +101,11 @@
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <div>
          <div style="display:flex;justify-content: space-between;align-items: center;">
            <b>平级接收人选择:</b>
            <a-checkbox :checked="checkSlAll" @change="checkSlChange">
              全选
            </a-checkbox>
          </div>
          <a-form-model-item>
            <a-select mode="multiple" placeholder="选择平级接收单位" v-model="form.recipient" @change="handle">
@@ -174,6 +177,7 @@
          horizontalRecipient: []
        },
        checkAll: false,
        checkSlAll: false,
        areaUsers: [],
        replaceFields: {
          children:'children',
@@ -272,6 +276,26 @@
        }
      },
      //选择平级部门部分
      handle(selectedItems) {
        const t = this
        if(t.form.recipient.length == t.filteredOptions.length){
          t.checkSlAll = true
        }else{
          t.checkSlAll = false
        }
      },
      checkSlChange(e) {
        const t = this
        t.checkSlAll = !t.checkSlAll
        if(t.checkSlAll == true){
          t.form.recipient = t.filteredOptions.map(i=>i.id)
        }else{
          t.form.recipient = []
        }
      },
      confirmSend(){
        this.$refs.ruleForm.validate(valid => {
          if (valid) {
@@ -284,7 +308,7 @@
            }
            const newAList = [].concat(...aList)
            for(let i of newAList){
              const {realName,id,roleId,...data} = i
              const {id,roleId,...data} = i
              const {company: recipientUnit,...rest} = data
              const obj = {recipientUnit,recipientType:1,...rest}
              this.form.verticalRecipient.push(obj)
@@ -293,7 +317,7 @@
              const bList = this.form.recipient.map(item => this.filteredOptions.find(i=>i.id == item))
              for(let i of bList){
                const {recipientName: name, company: recipientUnit,...rest} = i
                const obj = {name,recipientUnit,recipientType:2,...rest}
                const obj = {name,recipientUnit,recipientType:2,realName: name,...rest}
                const {id,...noId} = obj
                this.form.horizontalRecipient.push(noId)
              }
@@ -304,6 +328,9 @@
                this.$message.success('信息群发成功')
                this.$refs.ruleForm.clearValidate()
                this.$refs.ruleForm.resetFields()
                this.form.recipient = []
                this.checkAll = false
                this.checkSlAll = false
              }else{
                this.$message.error(res.data.msg)
                this.$refs.ruleForm.clearValidate()
@@ -330,9 +357,6 @@
      handleLevel(selectedItems) {
        // this.selectedItems = selectedItems;
      },
         handle(selectedItems) {
            // this.selectedItems = selectedItems;
         },
         onChange(){
            console.log(this.value)
         },