Selaa lähdekoodia

业务线初步完成

wangziqian 5 vuotta sitten
vanhempi
sitoutus
1118e09abc

+ 58 - 27
src/views/ToConfigure/components/modifyNotice.vue

@@ -48,7 +48,7 @@
       </el-form>
       <h2 class="form-title">通知条件</h2>
       <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-form-item v-for="(item,index) in formData.noticeConditionList" :key="'condition'+index" label="条件">
           <el-select v-model="item.type" placeholder="请选择类型" size="small" class="condition-select" @change="changeNoticeItem(item)">
             <el-option v-for="key in typeList" :key="key.label" :label="key.label" :value="key.value" />
           </el-select>
@@ -62,7 +62,10 @@
             <el-option v-for="key in noticeEventList" :key="'event'+key.code" :label="key.name" :value="key.code" />
           </el-select>
           <el-select v-show="item.type === 0" v-model="item.greaterTime" placeholder="请选择" size="small" class="condition-select">
-            <el-option v-for="key in rangDaysList" :key="key.label" :label="key.label" :value="key.value" />
+            <el-option v-for="key in rangDaysList" :key="'greaterTime'+key.value" :label="key.label" :value="key.value" />
+          </el-select>
+          <el-select v-show="item.type === 1" v-model="item.lessTime" placeholder="请选择" size="small" class="condition-select">
+            <el-option v-for="key in aheadDaysList" :key="'lessTime'+key.value" :label="key.label" :value="key.value" />
           </el-select>
           <i class="el-icon-remove-outline" @click="removeItem(index)" />
         </el-form-item>
@@ -73,26 +76,26 @@
         <!-- 邮件方式 -->
         <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-select v-model="item.type" placeholder="请选择" size="small" class="condition-select" @change="changeNoticeType(item)">
             <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-select v-show="item.type===1" v-model="item.teamList" placeholder="请选择" size="small" :multiple="true">
             <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" />
+          <search-people v-show="item.type===2" :value.sync="item.customStaffList" :clearable="false" :multiple="true" />
           <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-select v-model="item.type" placeholder="请选择" size="small" class="condition-select" @change="changeNoticeType(item)">
             <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-select v-show="item.type===1" v-model="item.teamList" placeholder="请选择" size="small" :multiple="true">
             <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" />
+          <search-people v-show="item.type===2" :value.sync="item.customStaffList" :clearable="false" :multiple="true" />
           <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>
@@ -102,7 +105,7 @@
           <ul v-show="GroupList.length>0" class="group-list">
             <li v-for="(item,index) in GroupList" :key="'gourp-item'+ index" class="group-item">
               <div>{{ item.name }}</div>
-              <div>{{ item.link }}</div>
+              <div>{{ item.url }}</div>
               <span><i class="el-icon-delete" @click.stop="removeGroup(index)" /></span>
             </li>
           </ul>
@@ -118,9 +121,9 @@
                   :autosize="{ minRows: 1, maxRows: 5 }"
                 />
               </el-form-item>
-              <el-form-item prop="link" label="机器人webhook地址">
+              <el-form-item prop="url" label="机器人webhook地址">
                 <el-input
-                  v-model="GroupItem.link"
+                  v-model="GroupItem.url"
                   type="textarea"
                   maxlength="200"
                   show-word-limit
@@ -135,6 +138,15 @@
           </section>
         </div>
       </el-form>
+      <h2 class="form-title">通知方式</h2>
+      <div class="notice-time">
+        <el-time-picker
+          v-model="formData.noticeTime"
+          placeholder="任意时间点"
+          size="small"
+          value-format="HH:mm:ss"
+        />
+      </div>
     </article>
   </normal-dialog>
 </template>
@@ -186,17 +198,18 @@ export default {
         techModuleId: [], // 技术模块
         clientId: null, // 客户端
         clientVersionId: null, // 版本
-        conditionList: [], // 条件列表
-        noticeType: [] // 通知方式
+        noticeConditionList: [], // 条件列表
+        noticeSetting: [], // 通知方式
+        noticeTime: null // 通知时刻
       },
       EmailList: [], // Email通知列表
       DChartList: [], // DChart系统通知列表
       GroupList: [], // DChart群通知列表
-      GroupItem: { name: null, link: null }, // 当前群添加对象
+      GroupItem: { name: null, url: null }, // 当前群添加对象
       showGroupForm: false,
       groupRules: {// 群填写规则
         name: [{ required: true, message: '请填写群名称或群ID', trigger: 'change' }],
-        link: [{ required: true, message: '请填写机器人webhook地址', trigger: 'change' }]
+        url: [{ required: true, message: '请填写机器人webhook地址', trigger: 'change' }]
       },
       noticeList: {// 通知方式列表
         Email: false, // 邮件通知
@@ -251,24 +264,20 @@ export default {
     },
     'formData.clientId': { // 客户端改变,版本默认取第一个版本
       handler(newV) {
-        this.formData.clientVersionId = this.clientList[0] || null
+        this.formData.clientVersionId = (this.clientList[0] && this.clientList[0].code) || 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 = []
+          if (this.EmailList.length === 0) this.EmailList.push({ type: 0, member: false, teamList: [], customStaffList: [] })
         }
       }
     },
     'noticeList.DChart': {
       handler(newV, oldV) {
         if (newV) {
-          if (this.DChartList.length === 0) this.DChartList.push({ type: 0, team: null, people: null })
-        } else {
-          this.DChartList = []
+          if (this.DChartList.length === 0) this.DChartList.push({ type: 0, member: false, teamList: [], customStaffList: [] })
         }
       }
     }
@@ -286,7 +295,6 @@ export default {
       const res = await getBizNoticeSettingEnum(this.bizId)
       if (res.code === 200) {
         this.triggerList = res.data.noticeConditionOpList
-        console.log(this.triggerList)
         this.type === 'require'
           ? this.noticeEventList = res.data.noticeEventRequireOpList
           : this.noticeEventList = res.data.noticeEventTaskOpList
@@ -364,7 +372,7 @@ export default {
       }
     },
     addCondition() { // 添加条件
-      this.formData.conditionList.push({
+      this.formData.noticeConditionList.push({
         type: 0, // 1 需求状态 2 需求事件 3 任务状态 4 任务事件
         status: 0,
         triggerEvent: 0, // 触发事件: 0 停留 1 交付 2 提测
@@ -373,25 +381,48 @@ export default {
       })
     },
     removeItem(index) { // 移除条件
-      this.formData.conditionList.splice(index, 1)
+      this.formData.noticeConditionList.splice(index, 1)
     },
     addMembers(list) { // 添加成员
-      list.push({ type: 0, team: null, people: null })
+      list.push({ type: 0, member: false, teamList: [], customStaffList: [] })
     },
     removeMembers(list, index) { // 移除成员
       list.splice(index, 1)
     },
+    changeNoticeType(item) { // 修改通知
+      switch (item.type) {
+        case 0:
+          item.member = true
+          item.teamList = []
+          item.customStaffList = []
+          break
+        case 1:
+          item.member = false
+          item.customStaffList = []
+          break
+        case 2:
+          item.member = false
+          item.teamList = []
+          break
+      }
+    },
     addGroup() { // 添加DChart群
       this.GroupList.push({
         ...this.GroupItem
       })
-      this.GroupItem = { name: null, link: null }
+      this.GroupItem = { name: null, url: null }
       this.showGroupForm = false
     },
     removeGroup(index) { // 移除DChart群
       this.GroupList.splice(index, 1)
     },
     confirmForm() {
+      this.formData.noticeSetting = {
+        email: this.noticeList.Email ? this.EmailList : [],
+        dChart: this.noticeList.DChart ? this.DChartList : [],
+        dchartGroup: this.noticeList.Group ? this.GroupList : []
+      }
+      console.log(this.formData)
       this.$emit('confirm')
     },
     cancel() {

+ 1 - 1
src/views/ToConfigure/components/noticeConfig.vue

@@ -109,7 +109,7 @@ export default {
       activeTab: 1,
       requireImg: requireImg,
       taskImg: taskImg,
-      visibleModify: true, // 添加修改弹框
+      visibleModify: false, // 添加修改弹框
       modifyType: 'require'// 弹框类型
     }
   },