wangziqian 5 лет назад
Родитель
Сommit
520d379554

+ 4 - 3
src/api/configure.js

@@ -203,10 +203,11 @@ export function getBizNoticeSettingEnum(id) {
 }
 
 // 通知列表
-export function getBizNoticeSettingList(bizId, status) {
+export function getBizNoticeSettingList(data) {
   return request({
-    url: TeamManagement + `/setting/getBizNoticeSettingList?bizId=${bizId}&status=${status}`,
-    method: 'get'
+    url: TeamManagement + `/setting/getBizNoticeSettingList`,
+    method: 'post',
+    data
   })
 }
 

+ 2 - 2
src/components/dialog/normalDialog.vue

@@ -89,10 +89,10 @@ export default {
 <style scoped lang="scss">
 >>>.el-dialog__header {
   padding: 20px !important;
-  border-bottom:1px solid rgba(238,238,238,1);
+  // border-bottom:1px solid rgba(238,238,238,1);
 }
 >>>.el-dialog__footer {
-  border-top:1px solid rgba(238,238,238,1);
+  // border-top:1px solid rgba(238,238,238,1);
   padding: 20px;
 }
 >>>.el-dialog__body {

+ 35 - 29
src/views/ToConfigure/components/modifyNotice.vue

@@ -13,7 +13,7 @@
       <el-form ref="form" :model="formData" label-width="100px" label-position="left">
         <el-form-item v-if="type === 'require'" label="需求方向">
           <el-cascader
-            v-model="formData.requireOrientId"
+            v-model="formData.requireOrientIdList"
             size="small"
             collapse-tags
             :props="requireProps"
@@ -24,7 +24,7 @@
         </el-form-item>
         <el-form-item v-if="type === 'task'" label="技术模块">
           <el-cascader
-            v-model="formData.techModuleId"
+            v-model="formData.techModuleIdList"
             size="small"
             collapse-tags
             :props="requireProps"
@@ -79,10 +79,10 @@
           <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.teamList" placeholder="请选择" size="small" :multiple="true">
+          <el-select v-show="item.type===1" v-model="item.teams" 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.customStaffList" :clearable="false" :multiple="true" />
+          <search-people v-show="item.type===2" :value.sync="item.customStaffs" :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>
@@ -92,10 +92,10 @@
           <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.teamList" placeholder="请选择" size="small" :multiple="true">
+          <el-select v-show="item.type===1" v-model="item.teams" 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.customStaffList" :clearable="false" :multiple="true" />
+          <search-people v-show="item.type===2" :value.sync="item.customStaffs" :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>
@@ -155,7 +155,8 @@ import {
   showRequireStatusEnum,
   showTaskStatusEnum,
   getBizNoticeSettingEnum,
-  addBizNoticeSetting
+  addBizNoticeSetting,
+  updateBizNoticeSetting
 } from '@/api/configure'
 import { settingQueryBizRqmtOrntList } from '@/api/requirement.js'
 import { settingQueryBizModuleList } from '@/api/defectManage'
@@ -196,8 +197,8 @@ export default {
       modulesList: [], // 任务模块列表
       formData: {
         bizId: Number(localStorage.getItem('bizId')),
-        requireOrientId: [], // 需求方向
-        techModuleId: [], // 技术模块
+        requireOrientIdList: [], // 需求方向
+        techModuleIdList: [], // 技术模块
         clientId: null, // 客户端
         clientVersionId: null, // 版本
         noticeConditionList: [], // 条件列表
@@ -240,7 +241,7 @@ export default {
       get() {
         if (this.formData.clientId !== null) {
           const obj = this.appClientList.find(item => item.code === this.formData.clientId)
-          return obj.childEnumInfos || []
+          return (obj && obj.childEnumInfos) || []
         } else {
           return []
         }
@@ -272,14 +273,14 @@ export default {
     'noticeList.Email': {
       handler(newV, oldV) {
         if (newV) {
-          if (this.EmailList.length === 0) this.EmailList.push({ type: 0, member: false, teamList: [], customStaffList: [] })
+          if (this.EmailList.length === 0) this.EmailList.push({ types: 0, member: false, teams: [], customStaffs: [] })
         }
       }
     },
     'noticeList.DChart': {
       handler(newV, oldV) {
         if (newV) {
-          if (this.DChartList.length === 0) this.DChartList.push({ type: 0, member: false, teamList: [], customStaffList: [] })
+          if (this.DChartList.length === 0) this.DChartList.push({ types: 0, member: false, teams: [], customStaffs: [] })
         }
       }
     }
@@ -296,24 +297,24 @@ export default {
     initData(data) {
       this.formData = {
         bizId: data.bizId,
-        requireOrientId: data.requireOrientId, // 需求方向
-        techModuleId: data.techModuleId, // 技术模块
+        requireOrientIdList: data.requireOrientIdList, // 需求方向
+        techModuleIdList: data.techModuleIdList, // 技术模块
         clientId: data.clientId || null, // 客户端
         clientVersionId: data.clientVersionId, // 版本
         noticeConditionList: data.noticeConditionList || [], // 条件列表
         noticeSetting: {}, // 通知方式
         noticeTime: data.noticeTime // 通知时刻
       }
-      if (data.email.length > 0) {
-        this.EmailList = data.email
+      if (data.noticeSetting.email && data.noticeSetting.email.length > 0) {
+        this.EmailList = data.noticeSetting.email || []
         this.noticeList.Email = true
       }
-      if (data.dChart.length > 0) {
-        this.DChartList = data.email
+      if (data.noticeSetting.dChat && data.noticeSetting.dChat.length > 0) {
+        this.DChartList = data.noticeSetting.dChat || []
         this.noticeList.DChart = true
       }
-      if (data.dChartGroup.length > 0) {
-        this.GroupList = data.email
+      if (data.noticeSetting.dChatGroup && data.noticeSetting.dChatGroup.length > 0) {
+        this.GroupList = data.noticeSetting.dChatGroup || []
         this.noticeList.Group = true
       }
     },
@@ -410,7 +411,7 @@ export default {
       this.formData.noticeConditionList.splice(index, 1)
     },
     addMembers(list) { // 添加成员
-      list.push({ type: 0, member: false, teamList: [], customStaffList: [] })
+      list.push({ types: 0, member: false, teams: [], customStaffs: [] })
     },
     removeMembers(list, index) { // 移除成员
       list.splice(index, 1)
@@ -448,10 +449,10 @@ export default {
       this.GroupList.splice(index, 1)
     },
     validate() { // 校验入参
-      if (this.formData.requireOrientId.length < 1 && this.type === 'require') {
+      if (this.formData.requireOrientIdList.length < 1 && this.type === 'require') {
         this.$message({ message: '请选择需求方向', type: 'error', duration: 1000, offset: 150 })
       }
-      if (this.formData.techModuleId.length < 1 && this.type === 'task') {
+      if (this.formData.techModuleIdList.length < 1 && this.type === 'task') {
         this.$message({ message: '请选择技术方向', type: 'error', duration: 1000, offset: 150 })
       }
       if (!this.formData.clientId) {
@@ -465,17 +466,22 @@ export default {
       }
       this.formData.noticeSetting = {
         email: this.noticeList.Email ? this.EmailList : [],
-        dChart: this.noticeList.DChart ? this.DChartList : [],
-        dChartGroup: this.noticeList.Group ? this.GroupList : []
+        dchat: this.noticeList.DChart ? this.DChartList : [],
+        dchatGroup: this.noticeList.Group ? this.GroupList : []
       }
-      this.addBizNoticeSetting()
+      this.data ? this.updateBizNoticeSetting() : this.addBizNoticeSetting()
     },
     async addBizNoticeSetting() { // 新增通知
       const res = await addBizNoticeSetting(this.formData)
       if (res.code === 200) {
-        this.data
-          ? this.$message({ message: '修改成功', type: 'success', duration: 1000, offset: 150 })
-          : this.$message({ message: '添加成功', type: 'success', duration: 1000, offset: 150 })
+        this.$message({ message: '添加成功', type: 'success', duration: 1000, offset: 150 })
+        this.$emit('confirm')
+      }
+    },
+    async updateBizNoticeSetting() { // 更新通知
+      const res = await updateBizNoticeSetting(this.formData)
+      if (res.code === 200) {
+        this.$message({ message: '修改成功', type: 'success', duration: 1000, offset: 150 })
         this.$emit('confirm')
       }
     },

+ 112 - 20
src/views/ToConfigure/components/noticeConfig.vue

@@ -22,14 +22,16 @@
       </el-popover>
     </div>
     <ul class="notice-list">
-      <li class="notice-item">
+      <li v-for="item in noticeList" :key="'notice'+item.id" class="notice-item">
         <div class="item-detail">
           <div class="require-img">
             <img :src="requireImg">
           </div>
-          <div class="item-title">需求定时通知</div>
+          <div v-show="item.requireOrientIdList && item.requireOrientIdList.length>0" class="item-title">需求定时通知</div>
+          <div v-show="item.techModuleIdList && item.techModuleIdList.length>0" class="item-title">任务定时通知</div>
           <div class="item-span">
-            <label>需求范围:</label>
+            <label v-show="item.requireOrientIdList && item.requireOrientIdList.length>0">需求范围:</label>
+            <label v-show="item.techModuleIdList &&item.techModuleIdList.length>0">任务范围:</label>
             <el-tooltip
               effect="dark"
               content="用户体验;营销增长;乘客端5.4.20"
@@ -61,9 +63,10 @@
           <el-button size="small" class="item-link">点击查看详情</el-button>
         </div>
         <div class="item-bottom">
-          <div class="item-status"><span />启用中</div>
+          <div v-show="item.isEnable" class="item-status show"><span />启用中</div>
+          <div v-show="!item.isEnable" class="item-status hidden"><span />未启用</div>
           <div class="item-creater"><span>朱晓菲</span>创建于2020-06-06</div>
-          <i class="el-icon-edit-outline" />
+          <i class="el-icon-edit-outline" @click="editNotice(item)" />
           <el-popover
             placement="bottom"
             width="150"
@@ -73,32 +76,56 @@
             <ul class="add-require-task">
               <li>停用</li>
               <li>复制</li>
-              <li>删除</li>
+              <li @click="deleteNotice(item)">删除</li>
             </ul>
             <i slot="reference" class="el-icon-more" />
           </el-popover>
         </div>
       </li>
-      <li class="notice-item" />
-      <li class="notice-item" />
     </ul>
+    <div align="right">
+      <el-pagination
+        :page-sizes="[6, 12, 18]"
+        :current-page.sync="pages.pageIndex"
+        :page-size="pages.pageSize"
+        background
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="total"
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+      />
+    </div>
     <modify-notice
       v-if="visibleModify"
       :visible.sync="visibleModify"
       :type="modifyType"
+      :data="modifyData"
       @confirm="confirmModify"
     />
+    <normal-dialog
+      :show-dialog.sync="controlShow"
+      :title="controlType?'停用通知':'删除确认'"
+      width="35%"
+      @confirm="confirmControl()"
+    >
+      <article class="control-dialog">
+        <span v-show="controlType === 0">是否要删除此定时通知</span>
+        <span v-show="controlType === 1">是否要停用此定时通知</span>
+      </article>
+    </normal-dialog>
   </section>
 </template>
 <script>
 import {
-  getBizNoticeSettingList
+  getBizNoticeSettingList,
+  deleteBizNoticeSetting
 } from '@/api/configure'
 import modifyNotice from './modifyNotice'
 import requireImg from '@/assets/detailPage/需求@2x.png'
 import taskImg from '@/assets/detailPage/任务@2x.png'
+import normalDialog from '@/components/dialog/normalDialog'
 export default {
-  components: { modifyNotice },
+  components: { modifyNotice, normalDialog },
   props: {
     bizId: {
       type: Number,
@@ -112,7 +139,17 @@ export default {
       requireImg: requireImg,
       taskImg: taskImg,
       visibleModify: false, // 添加修改弹框
-      modifyType: 'require'// 弹框类型
+      modifyType: 'require', // 弹框类型
+      modifyData: null, // 当前修改的通知
+      noticeList: [], // 通知列表
+      pages: {// 分页
+        pageIndex: 1,
+        pageSize: 1
+      },
+      total: 0,
+      controlShow: false, // 操作弹框
+      controlId: null, // 当前操作的id
+      controlType: 0 // 0 删除 1停用
     }
   },
   watch: {
@@ -126,19 +163,59 @@ export default {
     this.getBizNoticeSettingList()
   },
   methods: {
-    async getBizNoticeSettingList() {
-      const params = [Number(localStorage.getItem('bizId'))]
-      this.activeTab > 0 ? params.push(this.activeTab) : params.push()
-      const res = await getBizNoticeSettingList(...params)
+    async getBizNoticeSettingList() { // 获取列表
+      const params = {
+        bizId: Number(localStorage.getItem('bizId')),
+        pageIndex: this.pages.pageIndex,
+        pageSize: this.pages.pageSize
+      }
+      if (this.activeTab !== -1) {
+        params.status = this.activeTab
+      }
+      const res = await getBizNoticeSettingList(params)
       if (res.code === 200) {
-        console.log(res.data)
+        this.noticeList = res.data
+        this.total = res.total
+      }
+    },
+    editNotice(item) { // 编辑通知
+      if (item.requireOrientIdList.length > 0) {
+        this.modifyType = 'require'
+      } else if (item.techModuleIdList.length > 0) {
+        this.modifyType = 'task'
       }
+      this.modifyData = item
+      this.visibleModify = true
+    },
+    deleteNotice(item) { // 删除弹框
+      this.controlId = item.id
+      this.controlShow = true
+      this.controlType = 0
+    },
+    confirmControl() { // 操作确认
+      if (this.controlType === 0) this.deleteBizNoticeSetting()
     },
-    confirmModify() {
+    async deleteBizNoticeSetting() { // 删除请求
+      const res = await deleteBizNoticeSetting(this.controlId)
+      if (res.code === 200) {
+        this.$message({ message: '删除成功', type: 'success', duration: 1000, offset: 150 })
+        this.getBizNoticeSettingList()
+      }
+    },
+    handleSizeChange(val) {
+      this.pages.pageSize = val
+      this.getBizNoticeSettingList()
+    },
+    handleCurrentChange(val) {
+      this.pages.pageIndex = val
+      this.getBizNoticeSettingList()
+    },
+    confirmModify() { // 新增修改callback
       this.visibleModify = false
     },
-    addNotice(type) {
+    addNotice(type) { // 新增通知
       this.modifyType = type
+      this.modifyData = null
       this.visibleModify = true
     }
   }
@@ -269,17 +346,27 @@ ul,li{
     grid-template-columns: 20% 70% 5% 5%;
     align-items: center;
     .item-status {
-      color: #409EFF;
       padding-left: 19px;
       span{
         display: inline-block;
         height: 8px;
         width: 8px;
-        background-color: #409EFF;
         border-radius: 50%;
         margin-right: 5px;
       }
     }
+    .show {
+      color: #409EFF;
+      span{
+        background-color: #409EFF;
+      }
+    }
+    .hidden {
+      color: #999999;
+      span{
+        background-color: #999999;
+      }
+    }
     .item-creater {
       color: #999999;
       span{
@@ -292,6 +379,11 @@ ul,li{
     }
   }
 }
+.control-dialog {
+  width: 100%;
+  display: flex;
+  justify-content: center;
+}
 </style>
 <style>
 .notice-config-popper {