阅行客电子档案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

222 lines
8.4 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="app-container row-container">
  3. <div class="head-container">
  4. <div class="head-search">
  5. <!-- 搜索 -->
  6. <el-input v-model="query.search" clearable size="small" placeholder="输入关键字搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
  7. <date-range-picker v-model="blurryTime" class="date-item" />
  8. <rrOperation />
  9. </div>
  10. <crudOperation>
  11. <template v-slot:left>
  12. <el-button size="mini" @click="crud.toAdd">
  13. <i class="iconfont icon-fabu" />
  14. 发布
  15. </el-button>
  16. </template>
  17. </crudOperation>
  18. </div>
  19. <div class="container-wrap">
  20. <span class="right-top-line" />
  21. <span class="left-bottom-line" />
  22. <!--表格渲染-->
  23. <el-table
  24. ref="table"
  25. v-loading="crud.loading"
  26. :data="crud.data"
  27. style="width: 100%;"
  28. @row-dblclick="handleDbClick"
  29. >
  30. <el-table-column type="index" label="序号" width="55" align="center" />
  31. <el-table-column prop="noticeType" label="消息类型" align="center" min-width="100">
  32. <template slot-scope="scope">
  33. <span v-if="scope.row.noticeType===0">系统消息</span>
  34. </template>
  35. </el-table-column>
  36. <el-table-column prop="noticeTitle" :show-overflow-tooltip="true" label="标题" min-width="150" align="center" />
  37. <el-table-column prop="noticeContext" :show-overflow-tooltip="true" label="内容" align="center" min-width="200" />
  38. <el-table-column :show-overflow-tooltip="true" label="发送对象" align="center" min-width="200">
  39. <template v-if="scope.row.noticeDevices.length !== 0" slot-scope="scope">
  40. {{ scope.row.noticeDevices.join(',') }}
  41. <!-- <div class="tag-hidden">
  42. <el-tag v-for="(item,i) in scope.row.noticeDevices" :key="i" style="margin-left:3px; color: #fff">{{ item }}</el-tag>
  43. </div> -->
  44. </template>
  45. <template v-if="scope.row.noticeUsers.length !== 0" slot-scope="scope">
  46. <!-- <div class="tag-hidden">
  47. <el-tag v-for="(item,i) in scope.row.noticeUsers" :key="i" style="margin-left:3px; color: #fff">{{ item }}</el-tag>
  48. </div> -->
  49. {{ scope.row.noticeUsers.join(',') }}
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="create_by" label="创建人" align="center" min-width="100" />
  53. <el-table-column prop="create_time" label="创建时间" align="center" min-width="180">
  54. <template slot-scope="scope">
  55. <div>{{ scope.row.create_time | parseTime }}</div>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <!--分页组件-->
  60. <pagination />
  61. </div>
  62. <!-- 发布 -->
  63. <el-dialog append-to-body :close-on-click-modal="false" :modal-append-to-body="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" title="发布通知">
  64. <span class="dialog-right-top" />
  65. <span class="dialog-left-bottom" />
  66. <div class="setting-dialog">
  67. <el-form ref="form" :rules="rules" :model="form" size="small" label-width="100px">
  68. <el-form-item label="消息类型" prop="noticeType" class="down-select">
  69. <el-input v-model="form.noticeTypeName" disabled />
  70. <!-- <el-select v-model="noticeType" placeholder="请选择">
  71. <el-option
  72. v-for="item in msgTypeOptions"
  73. :key="item.name"
  74. :label="item.label"
  75. :value="item.value"
  76. :disabled="item.disabled"
  77. />
  78. </el-select> -->
  79. </el-form-item>
  80. <el-form-item label="标题" prop="noticeTitle">
  81. <el-input v-model="form.noticeTitle" placeholder="请输入" style="width: 580px;" />
  82. </el-form-item>
  83. <el-form-item label="内容" prop="noticeContext">
  84. <el-input v-model="form.noticeContext" placeholder="请输入" type="textarea" rows="3" style="width: 580px;" />
  85. </el-form-item>
  86. <el-form-item label="发送对象" prop="userId">
  87. <div class="send-obj">
  88. <span v-if="pushObjItem.length === 0">点击下方按钮选择对象</span>
  89. <el-tag
  90. v-for="tag in pushObjItem"
  91. v-else
  92. :key="tag.userId"
  93. :disable-transitions="false"
  94. >
  95. {{ tag.username }}
  96. </el-tag>
  97. </div>
  98. </el-form-item>
  99. <span class="select-btn iconfont icon-shezhi" @click="openSelectObj" />
  100. </el-form>
  101. <div slot="footer" class="dialog-footer">
  102. <el-button type="text" @click="crud.cancelCU">取消</el-button>
  103. <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
  104. </div>
  105. </div>
  106. </el-dialog>
  107. <SelectObj ref="selectObj" @selectObjItem="handleSelectObjItem" />
  108. <Detail ref="archiveDetailDom" />
  109. </div>
  110. </template>
  111. <script>
  112. import crudNotify from '@/api/system/notify'
  113. import CRUD, { presenter, header, form, crud } from '@crud/crud'
  114. import crudOperation from '@crud/CRUD.operation'
  115. import rrOperation from '@crud/RR.operation'
  116. import DateRangePicker from '@/components/DateRangePicker'
  117. import pagination from '@crud/Pagination'
  118. import SelectObj from './module/selectObj'
  119. import Detail from './module/detail'
  120. const defaultForm = { id: null, noticeTypeName: '系统消息', noticeType: null, noticeTitle: null, noticeContext: null, userId: [], deviceInfoId: [] }
  121. export default {
  122. name: 'NotifyManage',
  123. components: { crudOperation, rrOperation, DateRangePicker, pagination, SelectObj, Detail },
  124. cruds() {
  125. return CRUD({ title: '通知', url: 'api/notice/initNotice', crudMethod: { ...crudNotify }, sort: [], optShow: {
  126. add: false,
  127. edit: false,
  128. del: false,
  129. download: false,
  130. group: false
  131. }})
  132. },
  133. mixins: [presenter(), header(), form(defaultForm), crud()],
  134. data() {
  135. return {
  136. blurryTime: null,
  137. sendVisible: false,
  138. tableData: [],
  139. pushObjItem: [],
  140. msgTypeOptions: [
  141. { value: 1, label: '系统通知' }
  142. // { value: 2, label: '报警消息', disabled: true },
  143. // { value: 3, label: '借还消息', disabled: true },
  144. // { value: 4, label: '下载消息', disabled: true }
  145. ],
  146. rules: {
  147. noticeTitle: [
  148. { required: true, message: '标题不可为空', trigger: 'blur' }
  149. ],
  150. noticeContext: [
  151. { required: true, message: '内容不可为空', trigger: 'blur' }
  152. ],
  153. userId: [
  154. { required: true, message: '发送对象不可为空', trigger: 'blur' }
  155. ]
  156. }
  157. }
  158. },
  159. async created() {
  160. },
  161. methods: {
  162. [CRUD.HOOK.beforeRefresh]() {
  163. if (this.blurryTime) {
  164. this.crud.query.startTime = this.blurryTime[0]
  165. this.crud.query.endTime = this.blurryTime[1]
  166. } else {
  167. this.crud.query.startTime = null
  168. this.crud.query.endTime = null
  169. }
  170. },
  171. openSelectObj() {
  172. this.$refs.selectObj.sendObjVisible = true
  173. this.$refs.selectObj.getFondsDatas()
  174. },
  175. handleSelectObjItem(objType, selectItemAll) {
  176. this.pushObjItem = selectItemAll
  177. if (objType === 0) {
  178. this.form.userId = selectItemAll.map(item => item.userId)
  179. this.form.deviceInfoId = []
  180. } else {
  181. this.form.userId = []
  182. }
  183. },
  184. // 提交前的验证
  185. [CRUD.HOOK.afterValidateCU](crud) {
  186. console.log(crud.form)
  187. crud.form.noticeType = 0
  188. delete crud.form.noticeTypeName
  189. return true
  190. },
  191. handleDbClick(row) {
  192. this.$nextTick(() => {
  193. this.$refs.archiveDetailDom.detailVisible = true
  194. this.$refs.archiveDetailDom.rowData = row
  195. })
  196. }
  197. }
  198. }
  199. </script>
  200. <style lang="scss" scoped>
  201. .select-btn{
  202. display: inline-block;
  203. padding: 4px 11px 4px 14px;
  204. font-size: 18px;
  205. color: #fff;
  206. background: #0348F3;
  207. border-radius: 3px;
  208. margin: 10px 0 0 100px;
  209. text-align: center;
  210. cursor: pointer;
  211. }
  212. .send-obj{
  213. width: 580px;
  214. height: 180px;
  215. padding: 0 10px;
  216. border-radius: 3px 3px 3px 3px;
  217. border: 1px solid #E6E8ED;
  218. }
  219. </style>