Browse Source

业务线通知

wangziqian 5 years ago
parent
commit
993a3382bd
2 changed files with 216 additions and 17 deletions
  1. 16 0
      src/api/configure.js
  2. 200 17
      src/views/ToConfigure/components/modifyNotice.vue

+ 16 - 0
src/api/configure.js

@@ -177,3 +177,19 @@ export function settingUpdateBizRqmtOrnt(data) {
     data
   })
 }
+
+// 需求状态列表
+export function showRequireStatusEnum(id) {
+  return request({
+    url: TeamManagement + `config/showRequireStatusEnum?bizId=` + id,
+    method: 'get'
+  })
+}
+
+// 任务状态列表
+export function showTaskStatusEnum(id) {
+  return request({
+    url: TeamManagement + `config/showTaskStatusEnum?bizId=` + id,
+    method: 'get'
+  })
+}

+ 200 - 17
src/views/ToConfigure/components/modifyNotice.vue

@@ -33,28 +33,97 @@
       <el-form ref="form" :model="formData" label-width="100px" label-position="left">
         <el-form-item v-for="(item,index) in formData.conditionList" :key="'condition'+index" label="条件">
           <el-select v-model="item.type" placeholder="请选择" size="small" class="condition-select">
-            <el-option v-for="key in requireTypeList" :key="key.label" :label="key.label" :value="key.value" />
+            <el-option v-for="key in typeList" :key="key.label" :label="key.label" :value="key.value" />
           </el-select>
           <el-select v-model="item.status" placeholder="请选择" size="small" class="condition-select">
-            <el-option v-for="key in requireTypeList" :key="key.label" :label="key.label" :value="key.value" />
+            <el-option v-for="key in typeList" :key="key.label" :label="key.label" :value="key.value" />
           </el-select>
           <el-select v-model="item.delay" placeholder="请选择" size="small" class="condition-select">
-            <el-option v-for="key in requireTypeList" :key="key.label" :label="key.label" :value="key.value" />
+            <el-option v-for="key in typeList" :key="key.label" :label="key.label" :value="key.value" />
           </el-select>
           <el-select v-model="item.more" placeholder="请选择" size="small" class="condition-select">
-            <el-option v-for="key in requireTypeList" :key="key.label" :label="key.label" :value="key.value" />
+            <el-option v-for="key in typeList" :key="key.label" :label="key.label" :value="key.value" />
           </el-select>
+          <i class="el-icon-remove-outline" @click="removeItem(index)" />
         </el-form-item>
         <div class="add-condition" @click="addCondition()"><i class="el-icon-circle-plus-outline" /> 添加条件</div>
       </el-form>
+      <h2 class="form-title">通知方式</h2>
+      <el-form ref="form" :model="formData" label-width="100px" label-position="left">
+        <!-- 邮件方式 -->
+        <el-checkbox v-model="noticeList.Email" class="notice-check">邮件</el-checkbox>
+        <el-form-item v-for="(item,index) in EmailList" :key="'email'+index" :label="index===0?'通知人群':''">
+          <el-select v-model="item.type" placeholder="请选择" size="small" class="condition-select">
+            <el-option v-for="key in noticeGroupList" :key="'email-type'+key.label" :label="key.label" :value="key.value" />
+          </el-select>
+          <el-select v-show="item.type===1" v-model="item.team" placeholder="请选择" size="small">
+            <el-option v-for="key in teamList" :key="'email-team'+key.teamId" :label="key.teamName" :value="key.teamId" />
+          </el-select>
+          <search-people v-show="item.type===2" :value.sync="item.people" :clearable="false" />
+          <i v-if="index!==0" class="el-icon-remove-outline" @click="removeMembers(EmailList,index)" />
+        </el-form-item>
+        <div v-show="noticeList.Email" class="add-notice" @click="addMembers(EmailList)"><i class="el-icon-circle-plus-outline" /> 添加人群</div>
+        <!-- DChart系统方式 -->
+        <el-checkbox v-model="noticeList.DChart" class="notice-check">DChart系统通知</el-checkbox>
+        <el-form-item v-for="(item,index) in DChartList" :key="'DChart'+index" :label="index===0?'通知人群':''">
+          <el-select v-model="item.type" placeholder="请选择" size="small" class="condition-select">
+            <el-option v-for="key in noticeGroupList" :key="'DChart-type'+key.label" :label="key.label" :value="key.value" />
+          </el-select>
+          <el-select v-show="item.type===1" v-model="item.team" placeholder="请选择" size="small">
+            <el-option v-for="key in teamList" :key="'DChart-team'+key.teamId" :label="key.teamName" :value="key.teamId" />
+          </el-select>
+          <search-people v-show="item.type===2" :value.sync="item.people" :clearable="false" />
+          <i v-if="index!==0" class="el-icon-remove-outline" @click="removeMembers(DChartList,index)" />
+        </el-form-item>
+        <div v-show="noticeList.DChart" class="add-notice" @click="addMembers(DChartList)"><i class="el-icon-circle-plus-outline" /> 添加人群</div>
+        <!-- DChart群方式 -->
+        <el-checkbox v-model="noticeList.Group" class="notice-check">DChart群通知</el-checkbox>
+        <el-popover
+          placement="bottom-start"
+          width="280"
+          trigger="click"
+        >
+          <section class="group-form">
+            <el-form ref="groupForm" :model="GroupItem" :rules="groupRules" label-width="0" label-position="left">
+              <el-form-item prop="name">
+                <el-input
+                  v-model="GroupItem.name"
+                  type="textarea"
+                  maxlength="150"
+                  show-word-limit
+                  :autosize="{ minRows: 1, maxRows: 5 }"
+                />
+              </el-form-item>
+              <el-form-item prop="link">
+                <el-input
+                  v-model="GroupItem.link"
+                  type="textarea"
+                  maxlength="200"
+                  show-word-limit
+                  :autosize="{ minRows: 3, maxRows: 6 }"
+                />
+              </el-form-item>
+            </el-form>
+          </section>
+          <div v-show="noticeList.Group" slot="reference" class="add-condition" @click="addGroup()">
+            <i class="el-icon-circle-plus-outline" /> 添加DChart群
+          </div>
+        </el-popover>
+      </el-form>
     </article>
   </normal-dialog>
 </template>
 <script>
+import {
+  showRequireStatusEnum,
+  showTaskStatusEnum
+} from '@/api/configure'
+import { queryTeamInfoList } from '@/api/workSchedule'
 import { showAppClientEnum } from '@/api/version.js'
 import normalDialog from '@/components/dialog/normalDialog'
+import searchPeople from '@/components/select/searchPeople'
 export default {
-  components: { normalDialog },
+  components: { normalDialog, searchPeople },
   props: {
     data: {
       type: Object,
@@ -74,16 +143,34 @@ export default {
   },
   data() {
     return {
+      bizId: localStorage.getItem('bizId'),
       title: '新建需求定时通知',
       formData: {
-        direction: null,
-        app: null,
-        client: null,
-        conditionList: []
+        direction: null, // 方向
+        app: null, // 客户端
+        client: null, // 版本
+        conditionList: [], // 条件列表
+        noticeType: [] // 通知方式
+      },
+      EmailList: [], // Email通知列表
+      DChartList: [], // DChart系统通知列表
+      GroupList: [], // DChart群通知列表
+      GroupItem: { name: null, link: null }, // 当前群添加对象
+      groupRules: {// 群填写规则
+        name: [{ required: true, message: '请填写群名称或群ID', trigger: 'change' }],
+        link: [{ required: true, message: '请填写机器人webhook地址', trigger: 'change' }]
       },
+      noticeList: {// 通知方式列表
+        Email: false, // 邮件通知
+        DChart: false, // DChart系统通知
+        Group: false // DChart群通知
+      },
+      noticeGroupList: [], // 通知人群类型选择列表
+      teamList: [], // 团队选择列表
       show: this.visible, // 显示弹框
       appClientList: [], // 客户端选择列表
-      requireTypeList: [{ label: '需求状态', value: 0 }, { label: '需求事件', value: 1 }] // 需求条件类型选择列表
+      typeList: [], // 条件类型选择列表
+      statusList: []// 状态选择列表
     }
   },
   computed: {
@@ -119,10 +206,39 @@ export default {
       handler(newV) {
         this.formData.client = this.clientList[0] || null
       }
+    },
+    'noticeList.Email': {
+      handler(newV, oldV) {
+        if (newV) {
+          if (this.EmailList.length === 0) this.EmailList.push({ type: 0, team: null, people: null })
+        } else {
+          this.EmailList = []
+        }
+      }
+    },
+    'noticeList.DChart': {
+      handler(newV, oldV) {
+        if (newV) {
+          if (this.DChartList.length === 0) this.DChartList.push({ type: 0, team: null, people: null })
+        } else {
+          this.DChartList = []
+        }
+      }
+    },
+    'noticeList.Group': {
+      handler(newV, oldV) {
+        if (newV) {
+          if (this.GroupList.length === 0) this.GroupList.push({ name: null, link: null })
+        } else {
+          this.GroupList = []
+        }
+      }
     }
   },
   created() {
     this.showAppClientEnum()
+    this.queryTeamInfoList()
+    this.init()
   },
   methods: {
     async showAppClientEnum() { // 获取客户端列表
@@ -131,13 +247,52 @@ export default {
         this.appClientList = res.data.appClient
       }
     },
+    async showRequireStatusEnum() { // 获取需求状态列表
+      const res = await showRequireStatusEnum(this.bizId)
+      if (res.code === 200) {
+        this.statusList = res.data || []
+      }
+    },
+    async showTaskStatusEnum() { // 获取任务状态列表
+      const res = await showTaskStatusEnum(this.bizId)
+      if (res.code === 200) {
+        this.statusList = res.data || []
+      }
+    },
+    async queryTeamInfoList() { // 获取用户团队列表
+      const res = await queryTeamInfoList({ curIndex: 1, pageSize: 9999 })
+      if (res.code === 200 && res.data) {
+        this.teamList = res.data.list
+      }
+    },
+    init() {
+      if (this.type === 'require') {
+        this.typeList = [{ label: '需求状态', value: 0 }, { label: '需求事件', value: 1 }]
+        this.noticeGroupList = [{ label: '需求成员', value: 0 }, { label: '团队', value: 1 }, { label: '自定义人员', value: 2 }]
+        // this.showRequireStatusEnum()
+      } else {
+        this.typeList = [{ label: '任务状态', value: 0 }, { label: '任务事件', value: 1 }]
+        this.noticeGroupList = [{ label: '任务成员', value: 0 }, { label: '团队', value: 1 }, { label: '自定义人员', value: 2 }]
+        // this.showTaskStatusEnum()
+      }
+    },
     addCondition() { // 添加条件
-      this.formData.conditionList.push({
-        type: 0,
-        status: 0,
-        delay: 0,
-        more: 1
-      })
+      this.formData.conditionList.push({ type: 0, status: 0, delay: 0, more: 1 })
+    },
+    removeItem(index) { // 移除条件
+      this.formData.conditionList.splice(index, 1)
+    },
+    addMembers(list) { // 添加成员
+      list.push({ type: 0, team: null, people: null })
+    },
+    removeMembers(list, index) { // 移除成员
+      list.splice(index, 1)
+    },
+    addGroup() { // 添加DChart群
+      this.GroupList.push({ name: null, link: null })
+    },
+    removeGroup(index) { // 移除DChart群
+      this.GroupList.splice(index, 1)
     },
     confirmForm() {
       this.$emit('confirm')
@@ -174,9 +329,37 @@ article{
   .condition-select {
     width: 22%;
   }
-  .add-condition {
+  .add-condition,.add-notice {
     cursor: pointer;
     color: #409EFF;
   }
+  .add-notice {
+    margin-left: 100px;
+    width: 150px;
+  }
+  .notice-check{
+    margin: 15px 0;
+    display: block;
+    width: 150px;
+  }
+  .notice-check:nth-child(1){
+    margin-top: 0;
+  }
+  .el-icon-remove-outline {
+    cursor: pointer;
+    color: #409EFF;
+    font-size: 14px;
+    margin-left: 5px;
+  }
+}
+.group-form {
+  /deep/.el-form-item{
+    display: flex;
+    .el-form-item__content {
+      margin: 0;
+      width: 100%;
+      line-height: 10px;
+    }
+  }
 }
 </style>