QuestionNotifications.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div class="questionNotifications">
  3. <div style="padding-bottom: 24px; border-top: 1px solid rgba(0, 0, 0, 0.06)">
  4. <div class="pushWorkShopBar">
  5. <span class="pushiWorkShopSpan">选择推送范围:</span>
  6. <el-select
  7. v-model="cameraChosen"
  8. multiple
  9. collapse-tags
  10. collapse-tags-tooltip
  11. placeholder="请选择相机"
  12. style="width: 258px"
  13. @click="handleWorkShopEdit"
  14. @change="handleWorkShopEdit"
  15. >
  16. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  17. </el-select>
  18. </div>
  19. <div class="descriptionSpan"
  20. >当所选相机下发生违规问题并需要闭环处理时,系统将依据下方各阶段配置(开关启用后)自动发送待办消息!</div
  21. >
  22. </div>
  23. <el-scrollbar>
  24. <ManageContent />
  25. </el-scrollbar>
  26. <el-dialog
  27. v-model="workDialog"
  28. title="选择相机范围"
  29. align-center
  30. :close-on-click-modal="false"
  31. style="height: 583px"
  32. :width="731"
  33. :destroy-on-close="true"
  34. class="workShopDialog"
  35. >
  36. <WorkShopTree @cancel="handleCancle" :selectedUser="selectedUser" :refresh-camera="setCameraChosen" />
  37. </el-dialog>
  38. <el-dialog
  39. v-model="showDialog"
  40. title="编辑推送文案"
  41. align-center
  42. width="400"
  43. @close="closeDialog()"
  44. :close-on-click-modal="false"
  45. class="contentDialog"
  46. >
  47. <el-input
  48. v-model="content"
  49. style="width: 370px"
  50. :autosize="{ minRows: 4, maxRows: 5 }"
  51. maxlength="100"
  52. show-word-limit
  53. type="textarea"
  54. placeholder="请输入推送文案"
  55. />
  56. <template #footer>
  57. <div class="dialog-footer">
  58. <el-button @click="closeDialog()">取消</el-button>
  59. <el-button type="primary" @click="submitDialog()">确认</el-button>
  60. </div>
  61. </template>
  62. </el-dialog>
  63. </div>
  64. </template>
  65. <script lang="ts" setup>
  66. import { ref, onMounted, computed } from 'vue';
  67. import { modifyContent, modifyWorkshopList, getPushRange } from '@/api/message/question-notifications';
  68. import WorkShopTree from './components/WorkShopTree.vue';
  69. import ManageContent from './components/ManageContent.vue';
  70. import { ElMessage } from 'element-plus';
  71. import { treeSelected } from './type';
  72. const cameraChosen = ref<any>([]);
  73. const options = computed(() => {
  74. return cameraChosen.value.map((item: any) => {
  75. return {
  76. value: item,
  77. label: item,
  78. };
  79. });
  80. });
  81. const setCameraChosen = (arr: treeSelected[]) => {
  82. cameraChosen.value = arr.map((arr) => arr.name);
  83. workDialog.value = false;
  84. };
  85. const workDialog = ref<boolean>(false);
  86. const showDialog = ref<boolean>(false);
  87. const content = ref<string>('');
  88. const editId = ref<number>(0);
  89. const handleWorkShopEdit = () => {
  90. workDialog.value = true;
  91. };
  92. const submitDialog = () => {
  93. modifyContent(content.value, editId.value).then(() => {
  94. ElMessage({
  95. message: '修改成功',
  96. type: 'success',
  97. plain: true,
  98. });
  99. closeDialog();
  100. });
  101. };
  102. const closeDialog = () => {
  103. showDialog.value = false;
  104. };
  105. interface UserList {
  106. code: number | string;
  107. name: string;
  108. id: number;
  109. }
  110. const selectedUser = ref<UserList[]>([]);
  111. const handleCancle = () => {
  112. workDialog.value = false;
  113. };
  114. const handleSubmit = (selectedData: UserList[]) => {
  115. const params = selectedData.map((item) => item.id);
  116. modifyWorkshopList(params).then(() => {
  117. ElMessage({
  118. message: '添加成功',
  119. type: 'success',
  120. plain: true,
  121. });
  122. workDialog.value = false;
  123. // queryIssueData();
  124. });
  125. };
  126. const initCameraChosen = () => {
  127. getPushRange().then((res) => {
  128. cameraChosen.value = res.map((res) => res.name);
  129. });
  130. };
  131. onMounted(() => {
  132. initCameraChosen();
  133. });
  134. </script>
  135. <style lang="scss" scoped>
  136. .questionNotifications {
  137. // height: calc(100vh - 64px - 18px);
  138. background-color: rgba(255, 255, 255, 1);
  139. padding: 21px;
  140. }
  141. .pushWorkShopBar {
  142. margin: 11px 0 8px 0;
  143. display: flex;
  144. img {
  145. cursor: pointer;
  146. }
  147. // :nth-of-type(1) {
  148. // margin-right: 12px;
  149. // margin-bottom: 16px;
  150. // }
  151. .pushiWorkShopSpan {
  152. // width: 56px;
  153. height: 32px;
  154. font-weight: 600;
  155. font-size: 14px;
  156. color: rgba(0, 0, 0, 0.85);
  157. line-height: 32px;
  158. }
  159. }
  160. .descriptionSpan {
  161. // width: 300px;
  162. margin-left: 100px;
  163. height: 10px;
  164. font-weight: 400;
  165. font-size: 10px;
  166. color: #a8abb2;
  167. line-height: 10px;
  168. }
  169. .workshopList {
  170. display: flex;
  171. .left {
  172. display: flex;
  173. flex-wrap: wrap;
  174. width: 95%;
  175. max-height: 24px;
  176. overflow-y: hidden;
  177. gap: 20px;
  178. }
  179. .right {
  180. flex: 1;
  181. cursor: pointer;
  182. span {
  183. font-weight: 400;
  184. font-size: 12px;
  185. color: #303133;
  186. line-height: 17px;
  187. }
  188. img {
  189. margin-left: 4px;
  190. }
  191. }
  192. }
  193. .emptyDiv {
  194. margin-top: 78px;
  195. margin: auto;
  196. width: 396px;
  197. .emptyImg {
  198. height: 257px;
  199. }
  200. .emptySpan {
  201. font-family: PingFangSC, PingFang SC;
  202. font-weight: 400;
  203. font-size: 18px;
  204. color: rgba(0, 0, 0, 0.45);
  205. text-align: left;
  206. font-style: normal;
  207. }
  208. }
  209. .operation {
  210. display: flex;
  211. justify-content: center;
  212. width: 100%;
  213. }
  214. </style>