多媒体信息发布平台
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.

239 lines
8.0 KiB

3 years ago
  1. <template>
  2. <div class="app-container">
  3. <!-- 搜索栏 -->
  4. <div class="head-container">
  5. <el-row type="flex">
  6. <el-col :span="20" class="col_flex">
  7. <div class="form_item">
  8. <span>状态</span>
  9. <el-select v-model="query.state" size="small" class="filter-item" style="width: 120px">
  10. <el-option v-for="item in stateData" :key="item.key" :label="item.name" :value="item.key" />
  11. </el-select>
  12. </div>
  13. <div class="form_item">
  14. <span>设备ID</span>
  15. <el-input v-model="query.blurry" clearable size="small" placeholder="请输入设备ID" style="width: 200px" class="filter-item" @keyup.enter.native="crud.toQuery" />
  16. </div>
  17. <div class="form_item">
  18. <span>设备名称</span>
  19. <el-input v-model="query.blurry" clearable size="small" placeholder="请输入设备名称" style="width: 200px" class="filter-item" @keyup.enter.native="crud.toQuery" />
  20. </div>
  21. <rrOperation />
  22. </el-col>
  23. <el-col class="page_add" :span="4"><el-button class="table_add" type="primary" icon="el-icon-delete" disabled>清空</el-button></el-col>
  24. </el-row>
  25. </div>
  26. <el-row :gutter="15">
  27. <el-col>
  28. <el-card class="box-card" shadow="never">
  29. <el-table style="width: 100%;" :data="tableData">
  30. <el-table-column :selectable="checkboxT" type="selection" width="55" />
  31. <el-table-column prop="id" label="设备ID" align="center" />
  32. <el-table-column prop="account" label="设备账号" align="center" />
  33. <el-table-column prop="name" label="设备名称" align="center" />
  34. <el-table-column prop="orientation" label="设备方向" align="center" />
  35. <el-table-column prop="organization" label="所属机构" align="center" />
  36. <el-table-column prop="isDel" label="设备状态" align="center">
  37. <template slot-scope="scope">
  38. <div>{{ scope.row.isDel ? '在线' : '离线' }}</div>
  39. </template>
  40. </el-table-column>
  41. <el-table-column prop="content" label="发布内容" align="center">
  42. <template slot-scope="scope">
  43. <el-button type="text" size="small" @click="handleClick(scope.row)">查看</el-button>
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="date" label="创建时间" align="center" width="200" />
  47. <el-table-column fixed="right" label="操作" align="center">
  48. <template slot-scope="scope">
  49. <el-button type="primary" icon="el-icon-edit" @click="edit(scope.$index, scope.row)" />
  50. <el-button type="info" icon="el-icon-info" />
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <!--分页组件-->
  55. <pagination />
  56. </el-card>
  57. </el-col>
  58. </el-row>
  59. <!-- 编辑设备 -->
  60. <div class="layer">
  61. <el-dialog :title="dialogTitle" :close-on-click-modal="false" :visible.sync="addFromVisible" width="400px">
  62. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  63. <el-form-item label="设备账号" prop="account"><el-input v-model="form.account" autocomplete="off" disabled style="width: 200px" /></el-form-item>
  64. <el-form-item label="设备名称" prop="name"><el-input v-model="form.name" style="width: 200px" /></el-form-item>
  65. <el-form-item label="设备方向" prop="orientation">
  66. <el-select v-model="form.orientation" size="small" class="filter-item" style="width: 200px">
  67. <el-option v-for="item in deviceData" :key="item.key" :label="item.name" :value="item.key" />
  68. </el-select>
  69. </el-form-item>
  70. </el-form>
  71. <div slot="footer" class="dialog-footer">
  72. <el-button @click="addFromVisible = false"> </el-button>
  73. <el-button type="primary" @click="submitForm('form')"> </el-button>
  74. </div>
  75. </el-dialog>
  76. </div>
  77. <div class="layer">
  78. <el-dialog title="发布内容" :close-on-click-modal="false" :visible.sync="contentVisible" width="720px">
  79. <div class="content_warp">
  80. <h4>图片</h4>
  81. <ul class="item_list">
  82. <li class="item_cont">
  83. <img src="../../assets/images/background.jpg" alt="">
  84. <div class="item_info">
  85. <div class="item_format">
  86. <span class="item_type">JPG</span>
  87. <span class="item_time">30S</span>
  88. </div>
  89. <p class="item_name">1.3X2DD244</p>
  90. </div>
  91. <!-- 视频 -->
  92. <div class="item_player">1</div>
  93. </li>
  94. </ul>
  95. <h4>视频</h4>
  96. <h4>音频</h4>
  97. </div>
  98. </el-dialog>
  99. </div>
  100. </div>
  101. </template>
  102. <script>
  103. import crudUser from '@/api/system/user'
  104. import CRUD, { presenter, header, form, crud } from '@crud/crud'
  105. import rrOperation from '@crud/RR.operation'
  106. import pagination from '@crud/Pagination'
  107. const defaultForm = {
  108. account: null,
  109. name: null,
  110. orientation: null
  111. }
  112. export default {
  113. name: 'Device',
  114. components: { rrOperation, pagination },
  115. cruds() {
  116. return CRUD({
  117. title: '用户',
  118. url: 'api/users',
  119. crudMethod: { ...crudUser }
  120. })
  121. },
  122. mixins: [presenter(), header(), form(defaultForm), crud()],
  123. data() {
  124. return {
  125. dialogTitle: '',
  126. addFromVisible: false,
  127. contentVisible: false,
  128. tableData: [
  129. {
  130. id: 'XXXXXXXXX',
  131. account: '13476289682',
  132. name: 'GCXR2',
  133. orientation: '竖屏',
  134. organization: 'xx图书馆',
  135. content: '',
  136. date: '2021-09-14 16:35'
  137. }
  138. ],
  139. stateData: [{ key: '0', name: '全部' }, { key: '1', name: '在线' }, { key: '2', name: '离线' }],
  140. deviceData: [{ key: '0', name: '竖屏' }, { key: '1', name: '横屏' }],
  141. rules: {
  142. name: [{ required: true, message: '请输入设备名称', trigger: 'blur' }, { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }],
  143. orientation: [{ required: true, message: '请选择设备方向', trigger: 'change' }]
  144. }
  145. }
  146. },
  147. computed: {},
  148. watch: {},
  149. methods: {
  150. // 编辑
  151. edit(index, row) {
  152. this.dialogTitle = '编辑设备'
  153. this.addFromVisible = true
  154. this.form.account = row.account
  155. this.form.name = row.name
  156. },
  157. // 查看
  158. handleClick(row) {
  159. console.log(row)
  160. this.contentVisible = true
  161. },
  162. submitForm(formName) {
  163. this.$refs[formName].validate(valid => {
  164. if (valid) {
  165. alert('submit!')
  166. } else {
  167. console.log('error submit!!')
  168. return false
  169. }
  170. })
  171. }
  172. }
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. .col_flex {
  177. display: flex;
  178. }
  179. .layer {
  180. ::v-deep .el-dialog__body {
  181. padding: 0 0 30px 20px;
  182. }
  183. }
  184. .item_list {
  185. display: flex;
  186. flex-wrap: wrap;
  187. .item_cont {
  188. position: relative;
  189. width: 160px;
  190. height: 100px;
  191. overflow: hidden;
  192. background-color: #f1f1f1;
  193. margin: 0 10px 10px 0;
  194. img {
  195. display: block;
  196. width: 160px;
  197. height: 100px;
  198. }
  199. .item_info {
  200. position: absolute;
  201. left: 0;
  202. right: 0;
  203. bottom: 0;
  204. .item_format {
  205. display: flex;
  206. span {
  207. display: block;
  208. padding: 2px 5px;
  209. margin-right: 5px;
  210. background: rgba(255, 255, 255, 0.5);
  211. color: #fff;
  212. font-size: 12px;
  213. line-height: 12px;
  214. border-radius: 4px;
  215. }
  216. }
  217. .item_name {
  218. padding: 2px 0;
  219. margin: 5px 0 0 0;
  220. background: rgba(255, 255, 255, 0.5);
  221. color: #fff;
  222. }
  223. }
  224. .item_player {
  225. position: absolute;
  226. top: 50%;
  227. left: 50%;
  228. width: 50px;
  229. height: 50px;
  230. background: rgba(255, 255, 255, 0.5);
  231. border-radius: 50%;
  232. margin: -25px 0 0 -25px;
  233. z-index: 999;
  234. }
  235. }
  236. }
  237. </style>