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

316 lines
9.8 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
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
  11. v-for="item in stateData"
  12. :key="item.key"
  13. :label="item.name"
  14. :value="item.key"
  15. />
  16. </el-select>
  17. </div>
  18. <!-- @keyup.enter.native="crud.toQuery" -->
  19. <div class="form_item">
  20. <span>设备ID</span>
  21. <el-input
  22. v-model="query.device_id"
  23. clearable
  24. size="small"
  25. placeholder="请输入设备ID"
  26. style="width: 200px"
  27. class="filter-item"
  28. @keyup.enter.native='queryDevice(query.device_id)'
  29. />
  30. </div>
  31. <div class="form_item">
  32. <span>设备名称</span>
  33. <el-input
  34. v-model="query.name"
  35. clearable
  36. size="small"
  37. placeholder="请输入设备名称"
  38. style="width: 200px"
  39. class="filter-item"
  40. />
  41. </div>
  42. </el-col>
  43. <el-col class="page_add" :span="4">
  44. <el-button class="table_add clear_btn" plain disabled>清空</el-button>
  45. </el-col>
  46. </el-row>
  47. </div>
  48. <!-- table -->
  49. <el-row :gutter="15">
  50. <el-col>
  51. <el-table
  52. style="width: 100%;"
  53. :data="deviceList"
  54. :header-cell-style="{ background: '#3a8aeb', color: '#fff' }"
  55. >
  56. <el-table-column type="selection" width="55" />
  57. <el-table-column prop="device_id" label="设备ID" align="center" />
  58. <el-table-column prop="device_account" label="设备账号" align="center" />
  59. <el-table-column prop="device_name" label="设备名称" align="center" />
  60. <el-table-column label="设备方向" align="center" >
  61. <template slot-scope="{row}">
  62. <div>{{row.device_direction ? '竖屏' : '横屏' }}</div>
  63. </template>
  64. </el-table-column>
  65. <el-table-column prop="organ_name" label="所属机构" align="center"/> >
  66. <el-table-column prop="isDel" label="设备状态" align="center">
  67. <template slot-scope="scope">
  68. <div>{{ scope.row.isDel ? '在线' : '离线' }}</div>
  69. </template>
  70. </el-table-column>
  71. <el-table-column prop="content" label="发布内容" align="center">
  72. <template slot-scope="scope">
  73. <el-button type="text" size="small" @click="handleClick(scope.row)">查看</el-button>
  74. </template>
  75. </el-table-column>
  76. <el-table-column prop="create_time" label="创建时间" align="center" width="160" />
  77. <el-table-column fixed="right" label="操作" align="center" width="120">
  78. <template slot-scope="scope">
  79. <el-button
  80. type="primary"
  81. class="edit_btn"
  82. @click="editFormData(scope.row)"
  83. >编辑</el-button>
  84. <el-button type="danger" class="record_btn" @click="recordData(scope.$index, scope.row)">记录</el-button>
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. </el-col>
  89. </el-row>
  90. <!-- 编辑设备 -->
  91. <div class="layer">
  92. <el-dialog
  93. :title="dialogTitle"
  94. :close-on-click-modal="false"
  95. :show-close="false"
  96. :visible.sync="addFromVisible"
  97. width="576px"
  98. >
  99. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  100. <el-form-item label="设备账号" prop="account">
  101. <el-input v-model="form.account" autocomplete="off" disabled />
  102. </el-form-item>
  103. <el-form-item label="设备名称" prop="name">
  104. <el-input v-model="form.name" />
  105. </el-form-item>
  106. <el-form-item label="设备方向" prop="orientation">
  107. <el-select v-model="form.orientation" size="small" class="filter-item">
  108. <el-option
  109. v-for="item in deviceData"
  110. :key="item.key"
  111. :label="item.name"
  112. :value="item.key"
  113. />
  114. </el-select>
  115. </el-form-item>
  116. </el-form>
  117. <div slot="footer" class="dialog-footer">
  118. <el-button type="primary" round @click="submitForm('form')"> </el-button>
  119. <el-button round @click="addFromVisible = false"> </el-button>
  120. </div>
  121. </el-dialog>
  122. </div>
  123. <div class="publish_layer">
  124. <el-dialog
  125. title="发布内容"
  126. :close-on-click-modal="false"
  127. :visible.sync="contentVisible"
  128. width="970px"
  129. height="590px"
  130. >
  131. <div class="content_warp">
  132. <h4>图片</h4>
  133. <ul class="item_list">
  134. <li class="item_cont">
  135. <img src="@/assets/images/background.jpg" alt />
  136. <div class="item_format">
  137. <span class="item_type">JPG</span>
  138. </div>
  139. <div class="file_name">人工智能</div>
  140. </li>
  141. </ul>
  142. <h4>视频</h4>
  143. <ul class="item_list">
  144. <li class="item_cont">
  145. <img src="@/assets/images/background.jpg" alt />
  146. <div class="item_format">
  147. <span class="item_type">Video</span>
  148. <span class="item_time">03:00</span>
  149. </div>
  150. <div class="file_name">防控疫情小贴士</div>
  151. </li>
  152. </ul>
  153. <h4>音频</h4>
  154. <ul class="item_list">
  155. <li class="item_cont">
  156. <div class="radio_img"></div>
  157. <div class="item_format">
  158. <span class="item_type">Video</span>
  159. <span class="item_time">03:00</span>
  160. </div>
  161. <div class="file_name">防控疫情小贴士</div>
  162. </li>
  163. </ul>
  164. </div>
  165. </el-dialog>
  166. </div>
  167. <!-- 记录 -->
  168. <el-dialog
  169. append-to-body
  170. :close-on-click-modal="false"
  171. :visible.sync="recordVisible"
  172. title="记录"
  173. class="record_layer"
  174. width="750px"
  175. >
  176. <el-table :data="recordData">
  177. <el-table-column property="name" label="操作人" />
  178. <el-table-column property="permissionType" label="角色权限" />
  179. <el-table-column property="account" label="登录账号" />
  180. <el-table-column property="type" label="操作类型" />
  181. <el-table-column property="date" label="操作时间" />
  182. </el-table>
  183. </el-dialog>
  184. </div>
  185. </template>
  186. <script>
  187. import { ReqDeviceEdit } from '@/api/device/deviceList.js'
  188. import {mapState} from 'vuex'
  189. import {parseTime} from '@/utils/index.js'
  190. export default {
  191. name: 'Device',
  192. data() {
  193. return {
  194. page:'1',
  195. size:'3',
  196. // device_id:'',
  197. dialogTitle: '',
  198. // 编辑的对话框
  199. addFromVisible: false,
  200. contentVisible: false,
  201. recordVisible: false,
  202. stateData: [{ key: '0', name: '全部' }, { key: '1', name: '在线' }, { key: '2', name: '离线' }],
  203. deviceData: [{ key: '0', name: '竖屏' }, { key: '1', name: '横屏' }],
  204. query:{
  205. state:null,
  206. name:null,
  207. device_id:'',
  208. },
  209. form: {
  210. account: null,
  211. name: null,
  212. orientation: null,
  213. device_id:'',
  214. orga_id:''
  215. },
  216. rules: {
  217. name: [{ required: true, message: '请输入设备名称', trigger: 'blur' }, { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }],
  218. orientation: [{ required: true, message: '请选择设备方向', trigger: 'change' }]
  219. }
  220. }
  221. },
  222. watch: {},
  223. mounted(){
  224. this.getDevice()
  225. },
  226. computed:{
  227. ...mapState({
  228. deviceList:(state)=>state.device.deviceList
  229. })
  230. },
  231. methods: {
  232. // 获取设备列表的数据
  233. getDevice(){
  234. const{page,size}=this
  235. this.$store.dispatch('getDeviceList',{page,size})
  236. },
  237. // 编辑
  238. editFormData(row) {
  239. this.addFromVisible = true
  240. this.form.account = row.device_account
  241. this.form.name=row.device_name
  242. this.form.orientation=row.device_direction ? '竖屏' : '横屏'
  243. this.form.device_id=row.device_id
  244. // console.log(id)
  245. // ReqDeviceEdit(params).then(res => {
  246. // console.log(res)
  247. // })
  248. },
  249. recordData(index, row) {
  250. this.recordVisible = true
  251. },
  252. // 查看
  253. handleClick(row) {
  254. console.log(row)
  255. this.contentVisible = true
  256. },
  257. // 修改设备信息并提交
  258. submitForm(formName) {
  259. this.$refs[formName].validate(valid => {
  260. if (valid) {
  261. const params = {
  262. account:this.form.account,
  263. device_name:this.form.name,
  264. device_direction:this.form.orientation,
  265. device_id:this.form.device_id
  266. }
  267. // console.log(account,device_name,device_direction)
  268. console.log(params)
  269. ReqDeviceEdit(params).then(res => {
  270. console.log(res)
  271. })
  272. } else {
  273. console.log('error submit!!')
  274. return false
  275. }
  276. })
  277. },
  278. // 查询设备
  279. queryDevice(id){
  280. const params={
  281. device_id:id
  282. }
  283. ReqQueryDevice(params).then(res=>{
  284. console.log(res)
  285. })
  286. }
  287. }
  288. }
  289. </script>
  290. <style lang="scss" scoped>
  291. .clear_btn {
  292. color: #3a8aeb;
  293. border-color: #3a8aeb;
  294. }
  295. .publish_layer {
  296. ::v-deep .el-dialog__body {
  297. padding: 0 20px 30px 20px;
  298. height: 590px;
  299. overflow-y: auto;
  300. }
  301. }
  302. .content_warp {
  303. padding-top: 16px;
  304. h4 {
  305. margin: 6px 0 16px 0;
  306. font-size: 16px;
  307. color: #333;
  308. }
  309. }
  310. </style>