modifyNotice.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. <template>
  2. <normal-dialog
  3. :show-dialog.sync="show"
  4. :title="title"
  5. :is-default-close="false"
  6. width="60%"
  7. :show-footer="!disabled"
  8. @confirm="confirmForm()"
  9. @cancel="cancel()"
  10. >
  11. <article>
  12. <h2 v-show="type==='require'" class="form-title">需求范围</h2>
  13. <h2 v-show="type==='task'" class="form-title">任务范围</h2>
  14. <el-form ref="form" :model="formData" label-width="100px" label-position="left">
  15. <el-form-item v-if="type === 'require'" label="需求方向">
  16. <el-cascader
  17. v-model="formData.requireOrientIdList"
  18. size="small"
  19. collapse-tags
  20. :props="requireProps"
  21. :options="directionList"
  22. placeholder="请选择"
  23. clearable
  24. :disabled="disabled"
  25. class="input-width"
  26. />
  27. </el-form-item>
  28. <el-form-item v-if="type === 'task'" label="技术模块">
  29. <el-cascader
  30. v-model="formData.techModuleIdList"
  31. size="small"
  32. collapse-tags
  33. :props="taskProps"
  34. :options="modulesList"
  35. placeholder="请选择"
  36. clearable
  37. :disabled="disabled"
  38. class="input-width"
  39. />
  40. </el-form-item>
  41. </el-form>
  42. <el-form ref="form" :model="formData" label-width="100px" label-position="left" :inline="true">
  43. <el-form-item label="跟版客户端">
  44. <el-select v-model="formData.clientId" placeholder="请选择" size="small" :disabled="disabled" clearable>
  45. <el-option v-for="item in appClientList" :key="'app'+item.code" :label="item.msg" :value="item.code" />
  46. </el-select>
  47. </el-form-item>
  48. <el-form-item>
  49. <el-select v-model="formData.clientVersionId" placeholder="请选择" size="small" :disabled="disabled" clearable>
  50. <el-option v-for="item in clientList" :key="'client'+item.code" :label="item.msg" :value="item.code" />
  51. </el-select>
  52. </el-form-item>
  53. </el-form>
  54. <h2 class="form-title">通知条件(必选)</h2>
  55. <el-form ref="form" :model="formData" label-width="100px" label-position="left">
  56. <el-form-item v-for="(item,index) in formData.noticeConditionList" :key="'condition'+index" label="条件">
  57. <el-select v-model="item.type" placeholder="请选择类型" size="small" class="condition-select" :disabled="disabled" @change="changeNoticeItem(item)">
  58. <el-option v-for="key in typeList" :key="key.label" :label="key.label" :value="key.value" />
  59. </el-select>
  60. <el-select v-show="item.type === 1 || item.type === 3" v-model="item.status" placeholder="请选择状态" size="small" class="condition-select" :disabled="disabled">
  61. <el-option v-for="key in statusList" :key="'status'+key.code" :label="key.msg" :value="key.code" />
  62. </el-select>
  63. <el-select v-show="item.type === 1 || item.type === 3" v-model="item.triggerEvent" placeholder="请选择" size="small" class="condition-select" :disabled="disabled">
  64. <el-option v-for="key in triggerList" :key="'trigger'+key.code" :label="key.name" :value="key.code" />
  65. </el-select>
  66. <el-select v-show="item.type === 2 || item.type === 4" v-model="item.triggerEvent" placeholder="请选择" size="small" class="condition-select" :disabled="disabled">
  67. <el-option v-for="key in noticeEventList" :key="'event'+key.code" :label="key.name" :value="key.code" />
  68. </el-select>
  69. <el-select v-show="item.type === 1 || item.type === 3" v-model="item.greaterTime" placeholder="请选择" size="small" class="condition-select" :disabled="disabled">
  70. <el-option v-for="key in rangDaysList" :key="'greaterTime'+key.value" :label="key.label" :value="key.value" />
  71. </el-select>
  72. <el-select v-show="item.type === 2 || item.type === 4" v-model="item.lessTime" placeholder="请选择" size="small" class="condition-select" :disabled="disabled">
  73. <el-option v-for="key in aheadDaysList" :key="'lessTime'+key.value" :label="key.label" :value="key.value" />
  74. </el-select>
  75. <i v-show="!disabled" class="el-icon-remove-outline" @click="removeItem(index)" />
  76. </el-form-item>
  77. <div v-show="!disabled" class="add-condition" @click="addCondition()"><i class="el-icon-circle-plus-outline" /> 添加条件</div>
  78. </el-form>
  79. <h2 class="form-title">通知方式(必选)</h2>
  80. <el-form ref="form" :model="formData" label-width="100px" label-position="left">
  81. <!-- 邮件方式 -->
  82. <el-checkbox v-model="noticeList.Email" class="notice-check" :disabled="disabled">邮件</el-checkbox>
  83. <el-form-item v-for="(item,index) in EmailList" :key="'email'+index" :label="index===0?'通知人群':''">
  84. <el-select v-model="item.type" placeholder="请选择" size="small" class="condition-select" :disabled="disabled" @change="changeNoticeType(item)">
  85. <el-option v-for="key in noticeGroupList" :key="'email-type'+key.label" :label="key.label" :value="key.value" />
  86. </el-select>
  87. <el-select v-show="item.type===1" v-model="item.teams" placeholder="请选择" size="small" :multiple="true" :disabled="disabled">
  88. <el-option v-for="key in teamList" :key="'email-team'+key.code" :label="key.name" :value="key.code" />
  89. </el-select>
  90. <search-people v-show="item.type===2" :value.sync="item.customStaffs" :clearable="false" :multiple="true" :disabled="disabled" />
  91. <i v-if="index!==0 && !disabled" class="el-icon-remove-outline" @click="removeMembers(EmailList,index)" />
  92. </el-form-item>
  93. <div v-show="noticeList.Email && !disabled" class="add-notice" @click="addMembers(EmailList)"><i class="el-icon-circle-plus-outline" /> 添加人群</div>
  94. <!-- DChart系统方式 -->
  95. <el-checkbox v-model="noticeList.DChart" class="notice-check" :disabled="disabled">DChart系统通知</el-checkbox>
  96. <el-form-item v-for="(item,index) in DChartList" :key="'DChart'+index" :label="index===0?'通知人群':''">
  97. <el-select v-model="item.type" placeholder="请选择" size="small" class="condition-select" :disabled="disabled" @change="changeNoticeType(item)">
  98. <el-option v-for="key in noticeGroupList" :key="'DChart-type'+key.label" :label="key.label" :value="key.value" />
  99. </el-select>
  100. <el-select v-show="item.type===1" v-model="item.teams" placeholder="请选择" size="small" :multiple="true" :disabled="disabled">
  101. <el-option v-for="key in teamList" :key="'DChart-team'+key.code" :label="key.name" :value="key.code" />
  102. </el-select>
  103. <search-people v-show="item.type===2" :value.sync="item.customStaffs" :clearable="false" :multiple="true" :disabled="disabled" />
  104. <i v-if="index!==0 && !disabled" class="el-icon-remove-outline" @click="removeMembers(DChartList,index)" />
  105. </el-form-item>
  106. <div v-show="noticeList.DChart && !disabled" class="add-notice" @click="addMembers(DChartList)"><i class="el-icon-circle-plus-outline" /> 添加人群</div>
  107. <!-- DChart群方式 -->
  108. <el-checkbox v-model="noticeList.Group" class="notice-check" :disabled="disabled">DChart群通知</el-checkbox>
  109. <div v-show="noticeList.Group && !disabled" class="add-condition">
  110. <ul v-show="GroupList.length>0" class="group-list">
  111. <li v-for="(item,index) in GroupList" :key="'gourp-item'+ index" class="group-item">
  112. <div>{{ item.name }}</div>
  113. <div>{{ item.url }}</div>
  114. <span><i class="el-icon-delete" @click.stop="removeGroup(index)" /></span>
  115. </li>
  116. </ul>
  117. <span @click="showGroupForm = true"><i class="el-icon-circle-plus-outline" /> 添加DChart群</span>
  118. <section v-if="showGroupForm" class="group-form">
  119. <el-form ref="groupForm" :model="GroupItem" :rules="groupRules" label-width="200px" label-position="left">
  120. <el-form-item prop="name" label="群名称或群ID">
  121. <el-input
  122. v-model="GroupItem.name"
  123. type="textarea"
  124. maxlength="150"
  125. show-word-limit
  126. :autosize="{ minRows: 1, maxRows: 5 }"
  127. />
  128. </el-form-item>
  129. <el-form-item prop="url" label="机器人webhook地址">
  130. <el-input
  131. v-model="GroupItem.url"
  132. type="textarea"
  133. maxlength="200"
  134. show-word-limit
  135. :autosize="{ minRows: 3, maxRows: 6 }"
  136. />
  137. </el-form-item>
  138. </el-form>
  139. <div class="group-confirm">
  140. <el-button size="small" @click.stop="showGroupForm = false">取消</el-button>
  141. <el-button type="primary" size="small" @click.stop="addGroup()">确认</el-button>
  142. </div>
  143. </section>
  144. </div>
  145. </el-form>
  146. <h2 class="form-title">通知时刻</h2>
  147. <div class="notice-time">
  148. <el-time-select
  149. v-model="formData.noticeTime"
  150. placeholder="任意时间点"
  151. size="small"
  152. value-format="HH:mm"
  153. :picker-options="{
  154. start: '00:00',
  155. step: '00:15',
  156. end: '23:45',
  157. }"
  158. :disabled="disabled"
  159. />
  160. </div>
  161. </article>
  162. </normal-dialog>
  163. </template>
  164. <script>
  165. const _ = require('lodash')
  166. import { mapGetters } from 'vuex'
  167. import {
  168. showRequireStatusEnum,
  169. showTaskStatusEnum,
  170. getBizNoticeSettingEnum,
  171. addBizNoticeSetting,
  172. updateBizNoticeSetting
  173. } from '@/api/configure'
  174. import { teamQueryTeamListBelowBiz } from '@/api/toConfigure.js'
  175. import { settingQueryBizRqmtOrntList } from '@/api/requirement.js'
  176. import { settingQueryBizModuleList } from '@/api/defectManage'
  177. // import { queryTeamInfoList } from '@/api/workSchedule'
  178. import { showAppClientEnum } from '@/api/version.js'
  179. import normalDialog from '@/components/dialog/normalDialog'
  180. import searchPeople from '@/components/select/searchPeople'
  181. export default {
  182. components: { normalDialog, searchPeople },
  183. props: {
  184. data: {
  185. type: Object,
  186. default: () => null,
  187. required: false
  188. },
  189. visible: {
  190. type: Boolean,
  191. default: false,
  192. required: true
  193. },
  194. type: {
  195. type: String,
  196. default: 'require', // 需求:require,任务:task
  197. required: false
  198. },
  199. disabled: {// 查看状态,不可修改
  200. type: Boolean,
  201. default: false,
  202. required: false
  203. },
  204. copy: {// 复制
  205. type: Boolean,
  206. default: false,
  207. required: false
  208. }
  209. },
  210. data() {
  211. return {
  212. title: '',
  213. requireProps: {
  214. value: 'id',
  215. label: 'rqmtOrntName',
  216. children: 'childRqmtOrnts',
  217. multiple: true
  218. },
  219. taskProps: {
  220. value: 'id',
  221. label: 'moduleName',
  222. children: 'childModules',
  223. multiple: true
  224. },
  225. directionList: [], // 需求方面列表
  226. modulesList: [], // 任务模块列表
  227. formData: {
  228. type: this.type === 'require' ? 0 : 1,
  229. bizId: this.bizId,
  230. requireOrientIdList: [], // 需求方向
  231. techModuleIdList: [], // 技术模块
  232. clientId: null, // 客户端
  233. clientVersionId: null, // 版本
  234. noticeConditionList: [], // 条件列表
  235. noticeSetting: {}, // 通知方式
  236. noticeTime: null // 通知时刻
  237. },
  238. EmailList: [], // Email通知列表
  239. DChartList: [], // DChart系统通知列表
  240. GroupList: [], // DChart群通知列表
  241. GroupItem: { name: null, url: null }, // 当前群添加对象
  242. showGroupForm: false,
  243. groupRules: {// 群填写规则
  244. name: [{ required: true, message: '请填写群名称或群ID', trigger: 'change' }],
  245. url: [{ required: true, message: '请填写机器人webhook地址', trigger: 'change' }]
  246. },
  247. noticeList: {// 通知方式列表
  248. Email: false, // 邮件通知
  249. DChart: false, // DChart系统通知
  250. Group: false // DChart群通知
  251. },
  252. noticeGroupList: [], // 通知人群类型选择列表
  253. teamList: [], // 团队选择列表
  254. show: this.visible, // 显示弹框
  255. appClientList: [], // 客户端选择列表
  256. typeList: [], // 条件类型选择列表
  257. statusList: [], // 状态选择列表
  258. noticeEventList: [], // 事件列表
  259. triggerList: [], // 触发事件: 0 停留 1 交付 2 提测
  260. aheadDaysList: [
  261. { label: '3天前开始提醒', value: 3 },
  262. { label: '2天前开始提醒', value: 2 },
  263. { label: '1天前开始提醒', value: 1 },
  264. { label: '过期提醒', value: 0 }
  265. ], // 提前几天提醒
  266. rangDaysList: [] // 条件中大于天数列表
  267. }
  268. },
  269. computed: {
  270. clientList: { // 版本列表
  271. get() {
  272. if (this.formData.clientId !== null) {
  273. const obj = this.appClientList.find(item => item.code === this.formData.clientId)
  274. return (obj && obj.childEnumInfos) || []
  275. } else {
  276. return []
  277. }
  278. }
  279. },
  280. ...mapGetters(['bizId'])
  281. },
  282. watch: {
  283. data: {
  284. handler(newV) {
  285. if (newV) {
  286. this.initData(_.cloneDeep(newV))
  287. }
  288. },
  289. deep: true,
  290. immediate: true
  291. },
  292. type: {
  293. handler(newV) {
  294. this.type = newV
  295. },
  296. immediate: true
  297. },
  298. visible: {
  299. handler(newV) {
  300. this.show = newV
  301. },
  302. immediate: true
  303. },
  304. copy: {
  305. handler(newV) {
  306. this.copy = newV
  307. },
  308. immediate: true
  309. },
  310. disabled: {
  311. handler(newV) {
  312. this.disabled = newV
  313. },
  314. immediate: true
  315. },
  316. 'formData.clientId': { // 客户端改变,版本默认取第一个版本
  317. handler(newV) {
  318. // this.formData.clientVersionId = (this.clientList[0] && this.clientList[0].code) || null
  319. if (newV === null || newV === '' || newV === undefined) {
  320. this.formData.clientVersionId = null
  321. }
  322. }
  323. },
  324. 'noticeList.Email': {
  325. handler(newV, oldV) {
  326. if (newV) {
  327. if (this.EmailList.length === 0) this.EmailList.push({ type: 0, member: true, teams: [], customStaffs: [] })
  328. } else {
  329. this.EmailList = []
  330. }
  331. }
  332. },
  333. 'noticeList.DChart': {
  334. handler(newV, oldV) {
  335. if (newV) {
  336. if (this.DChartList.length === 0) this.DChartList.push({ type: 0, member: true, teams: [], customStaffs: [] })
  337. } else {
  338. this.DChartList = []
  339. }
  340. }
  341. },
  342. 'noticeList.Group': {
  343. handler(newV, oldV) {
  344. if (!newV) {
  345. this.GroupList = []
  346. }
  347. }
  348. },
  349. bizId: {
  350. handler(newV) {
  351. this.formData.bizId = newV
  352. },
  353. immediate: true
  354. }
  355. },
  356. created() {
  357. this.getBizNoticeSettingEnum()
  358. this.getRequireDirection()
  359. this.settingQueryBizModuleList()
  360. this.showAppClientEnum()
  361. this.queryTeamInfoList()
  362. this.init()
  363. },
  364. methods: {
  365. initData(data) {
  366. this.formData = {
  367. type: data.type,
  368. id: data.id,
  369. bizId: data.bizId,
  370. requireOrientIdList: data.requireOrientIdList, // 需求方向
  371. techModuleIdList: data.techModuleIdList, // 技术模块
  372. clientId: data.clientId || null, // 客户端
  373. clientVersionId: data.clientVersionId, // 版本
  374. noticeConditionList: data.noticeConditionList || [], // 条件列表
  375. noticeSetting: {}, // 通知方式
  376. noticeTime: data.noticeTime // 通知时刻
  377. }
  378. if (data.noticeSetting.email && data.noticeSetting.email.length > 0) {
  379. this.EmailList = Array(data.noticeSetting.email.length).fill({ type: 0, member: true, teams: [], customStaffs: [] })
  380. this.$nextTick(() => {
  381. this.EmailList = data.noticeSetting.email
  382. })
  383. this.noticeList.Email = true
  384. }
  385. if (data.noticeSetting.dChat && data.noticeSetting.dChat.length > 0) {
  386. this.DChartList = Array(data.noticeSetting.dChat.length).fill({ type: 0, member: true, teams: [], customStaffs: [] })
  387. this.$nextTick(() => {
  388. this.DChartList = data.noticeSetting.dChat
  389. })
  390. this.noticeList.DChart = true
  391. }
  392. if (data.noticeSetting.dChatGroup && data.noticeSetting.dChatGroup.length > 0) {
  393. this.GroupList = data.noticeSetting.dChatGroup || []
  394. this.noticeList.Group = true
  395. }
  396. },
  397. async getBizNoticeSettingEnum() { // 任务需求事件列表
  398. const res = await getBizNoticeSettingEnum(this.bizId)
  399. if (res.code === 200) {
  400. this.triggerList = res.data.noticeConditionOpList
  401. this.type === 'require'
  402. ? this.noticeEventList = res.data.noticeEventRequireOpList
  403. : this.noticeEventList = res.data.noticeEventTaskOpList
  404. }
  405. },
  406. async getRequireDirection() { // 需求方向列表
  407. const res = await settingQueryBizRqmtOrntList(this.bizId)
  408. if (res.code === 200) {
  409. this.directionList = this.getRequireData(res.data)
  410. }
  411. },
  412. async settingQueryBizModuleList() { // 任务模块列表
  413. const res = await settingQueryBizModuleList(this.bizId)
  414. if (res.code === 200) {
  415. this.modulesList = this.getTaskData(res.data)
  416. }
  417. },
  418. getRequireData(data) {
  419. for (let i = 0; i < data.length; i++) {
  420. data[i].childRqmtOrnts.length < 1 ? delete data[i].childRqmtOrnts : this.getRequireData(data[i].childRqmtOrnts)
  421. }
  422. return data
  423. },
  424. getTaskData(data) {
  425. for (let i = 0; i < data.length; i++) {
  426. data[i].childModules.length < 1 ? delete data[i].childModules : this.getTaskData(data[i].childModules)
  427. }
  428. return data
  429. },
  430. async showAppClientEnum() { // 获取客户端列表
  431. const res = await showAppClientEnum()
  432. if (res.code === 200) {
  433. this.appClientList = res.data.appClient
  434. }
  435. },
  436. async showRequireStatusEnum() { // 获取需求状态列表
  437. const res = await showRequireStatusEnum(this.bizId)
  438. if (res.code === 200) {
  439. this.statusList = res.data.requirementStatus || []
  440. }
  441. },
  442. async showTaskStatusEnum() { // 获取任务状态列表
  443. const res = await showTaskStatusEnum(this.bizId)
  444. if (res.code === 200) {
  445. this.statusList = res.data.taskStatus || []
  446. }
  447. },
  448. async queryTeamInfoList() { // 获取用户团队列表
  449. const res = await teamQueryTeamListBelowBiz(this.bizId)
  450. if (res.code === 200) {
  451. this.teamList = res.data
  452. }
  453. // const res = await queryTeamInfoList({ curIndex: 1, pageSize: 9999 })
  454. // if (res.code === 200 && res.data) {
  455. // this.teamList = res.data.list
  456. // }
  457. },
  458. init() {
  459. if (this.type === 'require') {
  460. this.data && !this.copy ? this.title = '编辑需求定时通知' : this.title = '新建需求定时通知'
  461. this.typeList = [{ label: '需求状态', value: 1 }, { label: '需求事件', value: 2 }]
  462. this.noticeGroupList = [{ label: '需求成员', value: 0 }, { label: '团队', value: 1 }, { label: '自定义人员', value: 2 }]
  463. this.showRequireStatusEnum()
  464. } else {
  465. this.data && !this.copy ? this.title = '编辑任务定时通知' : this.title = '新建任务定时通知'
  466. this.typeList = [{ label: '任务状态', value: 3 }, { label: '任务事件', value: 4 }]
  467. this.noticeGroupList = [{ label: '任务成员', value: 0 }, { label: '团队', value: 1 }, { label: '自定义人员', value: 2 }]
  468. this.showTaskStatusEnum()
  469. }
  470. let i = 1
  471. while (i <= 100) {
  472. this.rangDaysList.push({ label: `大于${i}天`, value: i })
  473. i++
  474. }
  475. },
  476. changeNoticeItem(item) { // 修改条件
  477. if (item.type === 1 || item.type === 3) {
  478. item.triggerEvent = this.triggerList[0].code
  479. } else if (item.type === 2 || item.type === 4) {
  480. item.triggerEvent = this.noticeEventList[0].code
  481. }
  482. },
  483. addCondition() { // 添加条件
  484. this.formData.noticeConditionList.push({
  485. type: this.typeList[0].value, // 1 需求状态 2 需求事件 3 任务状态 4 任务事件
  486. status: 0,
  487. triggerEvent: this.triggerList[0].code, // 触发事件
  488. greaterTime: 1, // 大于的时间
  489. lessTime: 3 // 提前提醒的时间
  490. })
  491. },
  492. removeItem(index) { // 移除条件
  493. this.formData.noticeConditionList.splice(index, 1)
  494. },
  495. addMembers(list) { // 添加成员
  496. list.push({ type: 0, member: true, teams: [], customStaffs: [] })
  497. },
  498. removeMembers(list, index) { // 移除成员
  499. list.splice(index, 1)
  500. },
  501. changeNoticeType(item) { // 修改通知
  502. switch (item.type) {
  503. case 0:
  504. item.member = true
  505. item.teamList = []
  506. item.customStaffList = []
  507. break
  508. case 1:
  509. item.member = false
  510. item.customStaffList = []
  511. break
  512. case 2:
  513. item.member = false
  514. item.teamList = []
  515. break
  516. }
  517. },
  518. addGroup() { // 添加DChart群
  519. this.$refs['groupForm'].validate((valid) => {
  520. if (valid) {
  521. this.GroupList.push({
  522. type: 3,
  523. ...this.GroupItem
  524. })
  525. this.GroupItem = { name: null, url: null }
  526. this.showGroupForm = false
  527. }
  528. })
  529. },
  530. removeGroup(index) { // 移除DChart群
  531. this.GroupList.splice(index, 1)
  532. },
  533. validate() { // 校验入参
  534. if (this.formData.noticeConditionList.length < 1) {
  535. this.$message({ message: '请添加通知条件', type: 'error', duration: 1000, offset: 150 })
  536. return false
  537. }
  538. if (this.EmailList.length === 0 && this.DChartList.length === 0 && this.GroupList.length === 0) {
  539. this.$message({ message: '请选择一种通知方式', type: 'error', duration: 1000, offset: 150 })
  540. return false
  541. }
  542. if (!this.formData.noticeTime) {
  543. this.$message({ message: '请选择通知时刻', type: 'error', duration: 1000, offset: 150 })
  544. return false
  545. }
  546. this.formData.noticeSetting = {
  547. email: this.noticeList.Email ? this.EmailList : [],
  548. dChat: this.noticeList.DChart ? this.DChartList : [],
  549. dChatGroup: this.noticeList.Group ? this.GroupList : []
  550. }
  551. this.data && !this.copy ? this.updateBizNoticeSetting() : this.addBizNoticeSetting()
  552. },
  553. async addBizNoticeSetting() { // 新增通知
  554. if (this.formData.id) {
  555. delete this.formData.id
  556. }
  557. const res = await addBizNoticeSetting(this.formData)
  558. if (res.code === 200) {
  559. this.$message({ message: '添加成功', type: 'success', duration: 1000, offset: 150 })
  560. this.$emit('confirm')
  561. }
  562. },
  563. async updateBizNoticeSetting() { // 更新通知
  564. const res = await updateBizNoticeSetting(this.formData)
  565. if (res.code === 200) {
  566. this.$message({ message: '修改成功', type: 'success', duration: 1000, offset: 150 })
  567. this.$emit('confirm')
  568. }
  569. },
  570. confirmForm() {
  571. this.validate()
  572. },
  573. cancel() {
  574. this.show = false
  575. this.$emit('update:visible', this.show)
  576. this.$emit('cancel')
  577. }
  578. }
  579. }
  580. </script>
  581. <style lang="scss" scoped>
  582. /deep/.el-input {
  583. width: auto;
  584. }
  585. article::-webkit-scrollbar{
  586. display: none;
  587. }
  588. article{
  589. max-height: 500px;
  590. overflow: scroll;
  591. padding: 0 45px;
  592. .form-title {
  593. margin: 0;
  594. padding: 0;
  595. font-size: 18px;
  596. color: #333333;
  597. margin: 20px 0;
  598. }
  599. .form-title:nth-child(1){
  600. margin-top: 0;
  601. }
  602. /deep/.el-form-item {
  603. font-size: 14px;
  604. margin-bottom: 10px;
  605. label {
  606. color: #666666;
  607. font-weight: 400;
  608. }
  609. }
  610. .condition-select {
  611. width: 22%;
  612. }
  613. .add-condition,.add-notice {
  614. cursor: pointer;
  615. color: #409EFF;
  616. position: relative;
  617. }
  618. .add-notice {
  619. margin-left: 100px;
  620. width: 150px;
  621. }
  622. .notice-check{
  623. margin: 15px 0;
  624. display: block;
  625. width: 150px;
  626. }
  627. .notice-check:nth-child(1){
  628. margin-top: 0;
  629. }
  630. .el-icon-remove-outline {
  631. cursor: pointer;
  632. color: #409EFF;
  633. font-size: 14px;
  634. margin-left: 5px;
  635. }
  636. .input-width {
  637. /deep/.el-input {
  638. width: 402px;
  639. }
  640. }
  641. }
  642. .group-form {
  643. width: 280px;
  644. position: absolute;
  645. bottom: 30px;
  646. left: 0;
  647. padding: 10px;
  648. z-index: 99;
  649. background:rgba(255,255,255,1);
  650. box-shadow:0px 0px 12px rgba(0,0,0,0.1);
  651. /deep/.el-form-item{
  652. display: flex;
  653. flex-direction: column;
  654. margin-bottom: 10px;
  655. .el-form-item__content {
  656. margin: 0 !important;
  657. width: 100%;
  658. line-height: 10px;
  659. }
  660. }
  661. .group-confirm {
  662. display: flex;
  663. justify-content: center;
  664. margin-top: 20px;
  665. button:nth-child(1) {
  666. margin-right: 10px;
  667. }
  668. }
  669. }
  670. .group-list{
  671. margin: 0;
  672. padding: 0;
  673. list-style: none;
  674. width: 100%;
  675. color: #333333;
  676. font-size: 14px;
  677. .group-item {
  678. margin: 0;
  679. padding: 0;
  680. list-style: none;
  681. width: 100%;
  682. display: grid;
  683. grid-template-columns: 30% 60% 10%;
  684. border:1px solid rgba(209,208,208,1);
  685. height:37px;
  686. border-radius: 4px;
  687. margin-bottom: 10px;
  688. align-items: center;
  689. div{
  690. border-right:1px solid rgba(209,208,208,1);
  691. overflow: hidden;
  692. text-overflow: ellipsis;
  693. white-space: nowrap;
  694. text-align: center;
  695. line-height: 37px;
  696. padding: 0 5px;
  697. }
  698. span {
  699. height: 100%;
  700. display: flex;
  701. align-items: center;
  702. justify-content: center;
  703. font-size: 18px;
  704. }
  705. }
  706. }
  707. </style>