SysnotionConfig.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <template>
  2. <div class="sysnotion-config">
  3. <div class="tophead">
  4. <div><img src="@/views/message/reportmessage/img/rollback.png" />返回</div>
  5. <span>新建系统通知</span>
  6. </div>
  7. <div class="content">
  8. <div class="left">
  9. <el-form
  10. ref="ruleFormRef"
  11. style="max-width: 600px"
  12. label-width="auto"
  13. :model="ruleForm"
  14. :label-position="labelPosition"
  15. class="el-form-outer"
  16. >
  17. <el-form-item
  18. label="消息标题"
  19. prop="title"
  20. :rules="[{ required: true, message: '请输入消息标题' }]"
  21. >
  22. <el-input
  23. v-model="ruleForm.title"
  24. placeholder="请输入20字以内的消息标题"
  25. maxlength="20"
  26. show-word-limit
  27. />
  28. </el-form-item>
  29. <el-form-item label="消息内容" prop="content" class="transprant">
  30. <el-input
  31. v-model="ruleForm.content"
  32. placeholder="请输入500字以内的消息内容"
  33. type="textarea"
  34. :rows="5"
  35. maxlength="500"
  36. show-word-limit
  37. />
  38. </el-form-item>
  39. <el-form-item
  40. label="推送渠道"
  41. prop="channel"
  42. :rules="[{ required: true, message: '请选择推送渠道' }]"
  43. >
  44. <el-checkbox
  45. v-model="ruleForm.channel"
  46. v-for="item in pushChannelName"
  47. :key="item.value"
  48. :value="item.value"
  49. :label="item.label"
  50. />
  51. </el-form-item>
  52. <PushObject
  53. ref="childFromRef"
  54. :recipientType="ruleForm.object.recipientType"
  55. :userGroupList="ruleForm.object.userGroupList"
  56. :customUserList="ruleForm.object.customUserList"
  57. />
  58. <el-form-item label="操作人" prop="operator" class="transprant">
  59. <el-input v-model="ruleForm.operator" :disabled="true" />
  60. </el-form-item>
  61. </el-form>
  62. <div class="btns">
  63. <el-button>重置</el-button>
  64. <el-button>暂存</el-button>
  65. <el-button type="primary" @click="submitForm()">确定</el-button>
  66. </div>
  67. </div>
  68. <div class="right">
  69. <div class="top-head">
  70. 实时效果
  71. <el-tooltip
  72. effect="dark"
  73. content="实例样式仅供参考,最终展示以线上为准"
  74. placement="top-start"
  75. >
  76. <img src="@/assets/icons/info.png" />
  77. </el-tooltip>
  78. </div>
  79. <div class="tabs">
  80. <el-tabs v-model="activeName">
  81. <el-tab-pane label="平台侧" name="platform" class="platform">
  82. <div class="tabs-content">
  83. <div class="title">
  84. <div class="vertical"></div>
  85. <span>卡片页:</span>
  86. </div>
  87. <div class="card">
  88. <div class="card-title"
  89. >系统公告<a>去查看<img src="@/assets/icons/arrow.png" /></a
  90. ></div>
  91. <div class="card-content">
  92. <p style="font-size: 12px; color: #969799">2024年6月25日 16:45:06</p>
  93. <p style="margin-top: 5px; font-size: 13px; color: #646566">
  94. {{ ruleForm.title || title }}
  95. </p>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="tabs-content">
  100. <div class="title">
  101. <div class="vertical"></div>
  102. <span>详情页:</span>
  103. </div>
  104. <div class="info">
  105. <div class="info-title"> {{ ruleForm.title || title }} </div>
  106. <div class="info-content">
  107. <span>{{ ruleForm.content || content }}</span>
  108. </div>
  109. </div>
  110. </div>
  111. </el-tab-pane>
  112. <el-tab-pane label="蓝信侧" name="lanxin" class="lanxin">
  113. <div class="tabs-content">
  114. <div class="title">
  115. <div class="vertical"></div>
  116. <span>卡片页:</span>
  117. </div>
  118. <div class="card">
  119. <div class="card-title">系统公告</div>
  120. <div class="card-content">
  121. <p style="margin-top: 5px; font-size: 13px; color: #646566">
  122. {{ ruleForm.title || title }}
  123. </p>
  124. </div>
  125. <img src="@/assets/icons/link_icon.png" />
  126. </div>
  127. </div>
  128. <div class="tabs-content">
  129. <div class="title">
  130. <div class="vertical"></div>
  131. <span>详情页:</span>
  132. </div>
  133. <div class="info">
  134. <div class="info-title"> {{ ruleForm.title || title }} </div>
  135. <div class="info-content">
  136. <span>{{ ruleForm.content || content }}</span>
  137. </div>
  138. </div>
  139. </div>
  140. </el-tab-pane>
  141. </el-tabs>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. </template>
  147. <script lang="ts" setup>
  148. import { ref, reactive } from 'vue';
  149. import { storeToRefs } from 'pinia';
  150. import { useUserStore } from '@/store/modules/user';
  151. import { pushChannelName } from '../constant';
  152. import type { FormProps } from 'element-plus';
  153. import PushObject from '../components/PushObject.vue';
  154. import type { FormInstance } from 'element-plus';
  155. const title = ref<string>('本系统进行了重大升级,请查看详细内容');
  156. const content = ref<string>(
  157. '尊敬的用户:\n 我们计划于2024年9月5日进行平台系统升级,以提升服务性能和用户体验,升级期间,平台将暂时不可用,预计停机时间为4小时,从上午2:00至6:00。请您提前做好相关安排,以避免不便,感谢您的理解与支持。如有疑问,请联系客服支持团队。\n敬请留意。\n天眼团队',
  158. );
  159. const ruleFormRef = ref<FormInstance>();
  160. const childFromRef = ref();
  161. const validate = ref<boolean>();
  162. const useUser = useUserStore();
  163. const { info } = storeToRefs(useUser);
  164. const labelPosition = ref<FormProps['labelPosition']>('left');
  165. interface UserList {
  166. id: string;
  167. name: string;
  168. userId: number;
  169. }
  170. interface ObjectFrom {
  171. recipientType?: number;
  172. userGroupList?: number[];
  173. customUserList?: UserList[];
  174. }
  175. interface RuleForm {
  176. title: string;
  177. content: string;
  178. channel: number[];
  179. object: ObjectFrom;
  180. operator: string;
  181. }
  182. const ruleForm = reactive<RuleForm>({
  183. title: '',
  184. content: '',
  185. channel: [],
  186. object: {},
  187. operator: info.value.nickname,
  188. });
  189. const activeName = ref('platform');
  190. const submitForm = () => {
  191. console.log(childFromRef.value!.getChildValue())
  192. childFromRef.value!.submitForm().then((res) => {
  193. validate.value = res;
  194. });
  195. ruleFormRef.value!.validate((valid) => {
  196. if (validate.value && valid) {
  197. console.log(ruleForm);
  198. } else {
  199. console.log('下发失败');
  200. }
  201. });
  202. };
  203. </script>
  204. <style lang="scss" scoped>
  205. .sysnotion-config {
  206. position: relative;
  207. height: calc(100vh - 64px - 18px);
  208. background-color: rgba(255, 255, 255, 1);
  209. box-sizing: border-box !important;
  210. .tophead {
  211. display: flex;
  212. gap: 20px;
  213. width: 100%;
  214. height: 50px;
  215. padding: 16px 0 14px 21px;
  216. border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  217. div {
  218. display: flex;
  219. align-items: center;
  220. font-weight: 400;
  221. font-size: 14px;
  222. color: #303133;
  223. line-height: 22px;
  224. cursor: pointer;
  225. img {
  226. margin-right: 4px;
  227. }
  228. }
  229. }
  230. .content {
  231. display: flex;
  232. width: 100%;
  233. height: calc(100vh - 64px - 18px - 50px);
  234. padding: 0 30px 0 0;
  235. .left {
  236. flex: 1;
  237. position: relative;
  238. padding: 21px;
  239. border-right: 1px solid rgba(0, 0, 0, 0.06);
  240. .el-form-outer {
  241. display: flex;
  242. flex-direction: column;
  243. gap: 32px;
  244. }
  245. .transprant {
  246. :deep(.el-form-item__label::before) {
  247. content: '**';
  248. opacity: 0;
  249. }
  250. }
  251. .btns {
  252. position: absolute;
  253. right: 27px;
  254. bottom: 21px;
  255. }
  256. }
  257. .right {
  258. width: 380px;
  259. height: 100%;
  260. padding: 20px 9px 0 20px;
  261. .top-head {
  262. display: flex;
  263. gap: 7px;
  264. align-items: center;
  265. width: 100%;
  266. height: 22px;
  267. font-weight: 600;
  268. font-size: 14px;
  269. color: rgba(0, 0, 0, 0.85);
  270. line-height: 22px;
  271. img {
  272. cursor: pointer;
  273. }
  274. }
  275. .tabs {
  276. margin-top: 14px;
  277. :deep(.el-tabs__header) {
  278. margin: 0 0 22px;
  279. }
  280. :deep(.is-top) {
  281. font-weight: 550;
  282. font-size: 14px;
  283. line-height: 22px;
  284. }
  285. :deep(.el-tabs__nav-wrap::after) {
  286. height: 0px;
  287. }
  288. .platform {
  289. display: flex;
  290. flex-direction: column;
  291. gap: 24px;
  292. .tabs-content {
  293. width: 100%;
  294. height: auto;
  295. max-height: calc(100vh - 450px);
  296. .title {
  297. display: flex;
  298. gap: 18px;
  299. width: 100%;
  300. height: 31px;
  301. .vertical {
  302. width: 4px;
  303. height: 12px;
  304. background: #1777ff;
  305. border-radius: 3px;
  306. }
  307. span {
  308. font-weight: 400;
  309. font-size: 14px;
  310. color: #303133;
  311. line-height: 20px;
  312. }
  313. }
  314. .card {
  315. width: 100%;
  316. height: 124px;
  317. padding: 10px 14px 0 12px;
  318. background: #ffffff;
  319. border-radius: 4px;
  320. border: 1px solid rgba(0, 0, 0, 0.06);
  321. .card-title {
  322. display: flex;
  323. justify-content: space-between;
  324. font-weight: 600;
  325. font-size: 15px;
  326. color: #646566;
  327. line-height: 20px;
  328. a {
  329. display: flex;
  330. gap: 8px;
  331. cursor: default;
  332. }
  333. }
  334. .card-content {
  335. margin-top: 15px;
  336. font-weight: 400;
  337. line-height: 20px;
  338. }
  339. }
  340. .info {
  341. width: 100%;
  342. max-height: calc(100vh - 450px - 32px);
  343. background: #ffffff;
  344. border-radius: 4px;
  345. border: 1px solid rgba(0, 0, 0, 0.06);
  346. .info-title {
  347. display: flex;
  348. justify-content: center;
  349. align-items: center;
  350. width: 100%;
  351. height: 41px;
  352. font-weight: 600;
  353. font-size: 14px;
  354. color: rgba(0, 0, 0, 0.85);
  355. line-height: 22px;
  356. border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  357. }
  358. .info-content {
  359. width: 100%;
  360. max-height: calc(100vh - 450px - 32px - 41px);
  361. overflow-y: auto;
  362. padding: 12px 7px 12px 12px;
  363. font-weight: 400;
  364. font-size: 14px;
  365. color: #646566;
  366. line-height: 22px;
  367. word-wrap: break-word;
  368. white-space: pre-wrap;
  369. }
  370. }
  371. }
  372. }
  373. .lanxin {
  374. display: flex;
  375. flex-direction: column;
  376. gap: 24px;
  377. .tabs-content {
  378. width: 100%;
  379. height: auto;
  380. max-height: calc(100vh - 400px);
  381. .title {
  382. display: flex;
  383. gap: 18px;
  384. width: 100%;
  385. height: 31px;
  386. .vertical {
  387. width: 4px;
  388. height: 12px;
  389. background: #1777ff;
  390. border-radius: 3px;
  391. }
  392. span {
  393. font-weight: 400;
  394. font-size: 14px;
  395. color: #303133;
  396. line-height: 20px;
  397. }
  398. }
  399. .card {
  400. width: 100%;
  401. height: 79px;
  402. padding: 10px 14px 0 12px;
  403. background: #ffffff;
  404. border-radius: 4px;
  405. border: 1px solid rgba(0, 0, 0, 0.06);
  406. position: relative;
  407. .card-title {
  408. display: flex;
  409. justify-content: space-between;
  410. font-weight: 600;
  411. font-size: 15px;
  412. color: #646566;
  413. line-height: 20px;
  414. a {
  415. display: flex;
  416. gap: 8px;
  417. }
  418. }
  419. .card-content {
  420. margin-top: 15px;
  421. font-weight: 400;
  422. line-height: 20px;
  423. }
  424. img {
  425. position: absolute;
  426. top: 10px;
  427. right: 17px;
  428. }
  429. }
  430. .info {
  431. width: 100%;
  432. max-height: calc(100vh - 400px - 32px);
  433. background: #ffffff;
  434. border-radius: 4px;
  435. border: 1px solid rgba(0, 0, 0, 0.06);
  436. .info-title {
  437. display: flex;
  438. justify-content: center;
  439. align-items: center;
  440. width: 100%;
  441. height: 41px;
  442. font-weight: 600;
  443. font-size: 14px;
  444. color: rgba(0, 0, 0, 0.85);
  445. line-height: 22px;
  446. border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  447. }
  448. .info-content {
  449. width: 100%;
  450. max-height: calc(100vh - 400px - 32px - 41px);
  451. overflow-y: auto;
  452. padding: 12px 7px 12px 12px;
  453. font-weight: 400;
  454. font-size: 14px;
  455. color: #646566;
  456. line-height: 22px;
  457. word-wrap: break-word;
  458. white-space: pre-wrap;
  459. }
  460. }
  461. }
  462. }
  463. }
  464. }
  465. }
  466. }
  467. </style>