churf
2023-08-29 a46d9dd934920dd4b764c4f54dad903da2d1f619
eladmin-web-master/src/views/task/task/index.vue
@@ -59,10 +59,12 @@
        </el-select>
        <div class="block">
          <el-cascader
            v-model="queryUser"
            :options="options"
            :props="props"
            collapse-tags
            clearable
            placeholder="任务负责人"
            :show-all-levels="false"
            style="width: 185px;"
          />
        </div>
        <rrOperation :crud="crud" />
@@ -141,31 +143,34 @@
            </el-input>
          </el-form-item>
          <el-form-item label="任务成员" prop="containUserList">
            <el-select v-model="form.containUserList" multiple filterable clearable placeholder="请选择" style="width: 340px;" @change="getContainUserList">
              <el-option
                v-for="item in users"
                :key="item.id"
                :label="item.nickName"
                :value="item.id"
              >
                <span style="float: left">{{ item.nickName }}</span>
                <span style="float: right; color: #8492a6; font-size: 13px">{{ item.levelName }}</span>
              </el-option>
            </el-select>
            <div class="block">
              <el-cascader
                v-model="selectedValue"
                :filterable="true"
                :options="options"
                :props="props"
                clearable
                placeholder="任务负责人"
                :show-all-levels="false"
                style="width: 340px;"
              />
            </div>
          </el-form-item>
          <el-form-item label="任务负责人" prop="userId">
            <el-select v-model="form.userIdList" :no-data-text=" '没有任务成员' " multiple filterable clearable placeholder="请选择" style="width: 340px;">
            <el-select v-if="form.containUserList" v-model="form.userIdList" :no-data-text=" '没有任务成员' " multiple filterable clearable placeholder="请选择" style="width: 340px;">
              <el-option
                v-for="item in users"
                v-show="form.containUserList != undefined && form.containUserList.some(animal => animal === item.id)"
                :key="item.id"
                :label="item.nickName"
                :value="item.id"
                :show-all-levels="false"
              >
                <span style="float: left">{{ item.nickName }}</span>
                <span style="float: right; color: #8492a6; font-size: 13px">{{ item.levelName }}</span>
              </el-option>
            </el-select>
            <el-select v-else v-model="form.userIdList" :no-data-text=" '没有任务成员' " multiple filterable clearable placeholder="请选择" style="width: 340px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
@@ -356,10 +361,28 @@
      inputVisible: false,
      inputValue: null,
      containUserList: [],
      userList: [],
      options: [],
      deptList: [],
      jobList: [],
      userList: []
      selectedValue: [],
      queryUser: [],
      selectedValue_flag: false
    }
  },
  watch: {
    'selectedValue': function(newVal) {
      this.form.containUserList = []
      for (let i = 0; i < newVal.length; i++) {
        var temp = []
        temp = newVal[i]
        if (!this.form.containUserList.includes(temp[newVal[i].length - 1])) {
          // 如果不在
          this.form.containUserList.push(temp[newVal[i].length - 1])
        }
      }
    },
    'queryUser': function(newVal) {
      // this.query.userId = newVal[newVal.length - 1]
    }
  },
  created() {
@@ -374,25 +397,26 @@
  },
  methods: {
    [CRUD.HOOK.afterSubmit]() {
      this.form.containUserList = null
      this.form.containUserList = []
      this.selectedValue = null
    },
    [CRUD.HOOK.afterEditError]() {
      this.form.containUserList = null
      this.form.containUserList = []
      this.selectedValue = null
    },
    [CRUD.HOOK.afterEditCancel]() {
      this.form.containUserList = null
      this.form.containUserList = []
      this.selectedValue = null
    },
    [CRUD.HOOK.afterAddCancel]() {
      this.form.containUserList = null
      this.form.containUserList = []
      this.selectedValue = null
    },
    [CRUD.HOOK.afterAddError]() {
      this.form.containUserList = null
    },
    [CRUD.HOOK.beforeToCU]() {
      this.form.containUserList = null
      this.form.containUserList = []
      this.selectedValue = null
    },
    getContainUserList(e) {
      console.log(e)
      this.form.containUserList = e
    },
    getTags() {
@@ -411,6 +435,11 @@
      this.userRolesLevelMin = Math.min(...userRolesLevel)
      return true
    },
    [CRUD.HOOK.beforeToEdit]() {
      crudUser.getUserPidDept(this.form.containUserList).then(res => {
        this.selectedValue = res
      })
    },
    [CRUD.HOOK.beforeSubmit]() {
      if (!this.form.taskStatus) {
@@ -464,7 +493,8 @@
    },
    handleInputConfirm() {
      const inputValue = this.inputValue
      if (inputValue !== '') {
      console.log(inputValue)
      if (inputValue !== '' && inputValue !== null && inputValue !== ' ') {
        this.form.tagList.push(inputValue)
      }
      this.inputVisible = false
@@ -584,4 +614,15 @@
    margin-left: 10px;
    vertical-align: bottom;
  }
  .block{
    display: inline-block;
    vertical-align: middle;
    margin: 0 3px 10px 0;
      input {
      height: 30.5px;
      line-height: 30.5px;
      }
    }
</style>