Sfoglia il codice sorgente

看板发现管理

wuyunfeng 4 anni fa
parent
commit
8295edd6bd

+ 0 - 10
src/api/calling-board.js

@@ -1,10 +0,0 @@
-//"get_board_titles?part_id=" + _this.partId,
-import request from '@/utils/request'
-
-export function getBoardTitles(partid) {
-    return request({
-        url: `/InfoBoard/get_board_titles?part_id=${partid}`,
-        method: 'get',
-        loading: false
-    })
-}

+ 15 - 0
src/api/ncs_board.js

@@ -0,0 +1,15 @@
+
+import request from '@/utils/request'
+
+/**
+ * 获取科室下的自定义看板标题
+ * @param partid
+ * @returns {*|Promise|Promise<unknown>}
+ */
+export function getBoardTitles(partid) {
+  return request({
+    url: `/ncs/boardtitle/partboardtitle/${partid}`,
+    method: 'get',
+    loading: false
+  })
+}

+ 319 - 80
src/views/calling-board/index.vue

@@ -1,33 +1,26 @@
 <template>
   <div class="app-container">
-    <en-table-layout
+    <ag-grid-layout
       toolbar
-      pagination
-      :table-data="tableData"
-      :height="tableHeight"
-      :loading="loading"
-      @selection-change="selectFun"
-      @sort-change="tableSort"
+      :table-height="tableHeight"
+      theme="ag-theme-alpine"
+      :column-defs="columnDefs"
+      :row-data="rowData"
+      :locale-text="localeText"
+      :grid-options="gridOptions"
+      :default-col-def="defaultColDef"
+      :animate-rows="true"
+      :row-selection="rowSelection"
+      :enable-cell-change-flash="true"
+      @filterChanged="filterModifed"
+      @sortChanged="gridSortChange"
     >
-      <!--工具栏-->
-      <div slot="toolbar" class="inner-toolbar" />
-      <!--表头-->
-      <template slot="table-columns">
-        <el-table-column prop="id" sortable="custom" label="识别码" width="200" align="center" />
-        <el-table-column prop="device_name" sortable="custom" label="别名" width="200" align="center" />
-        <el-table-column prop="device_wifi_mac" sortable="custom" label="mac地址" width="200" align="center" />
-        <el-table-column prop="device_eth_ip" sortable="custom" label="IP地址" width="200" align="center" />
-        <el-table-column prop="partid" sortable="custom" label="科室ID" width="200" align="center" />
-        <el-table-column label="操作" align="center">
-          <template slot-scope="scope">
-            <el-button type="primary" size="mini" @click="setPartBoard(scope.row)">设定</el-button>
-            <el-button type="primary" size="mini" @click="setBoard(scope.row)">设置</el-button>
-            <el-button type="danger" size="mini" @click="handlerDelete(scope.row.id)">删除</el-button>
-          </template>
-        </el-table-column>
-      </template>
-
-      <!--翻页-->
+      <!--        @rowDoubleClicked="getList"-->
+      <div slot="toolbar" class="inner-toolbar">
+        <div class="toolbar-search">
+          <en-table-search placeholder="请输入搜索关键字" @search="handlerSearch" />
+        </div>
+      </div>
       <el-pagination
         v-if="pageData"
         slot="pagination"
@@ -39,30 +32,77 @@
         @size-change="handlePageSizeChange"
         @current-change="handlePageCurrentChange"
       />
-    </en-table-layout>
+    </ag-grid-layout>
+
+    <!--    <en-table-layout-->
+    <!--      toolbar-->
+    <!--      pagination-->
+    <!--      :table-data="tableData"-->
+    <!--      :height="tableHeight"-->
+    <!--      :loading="loading"-->
+    <!--      @selection-change="selectFun"-->
+    <!--      @sort-change="tableSort"-->
+    <!--    >-->
+    <!--      &lt;!&ndash;工具栏&ndash;&gt;-->
+    <!--      <div slot="toolbar" class="inner-toolbar" />-->
+    <!--      &lt;!&ndash;表头&ndash;&gt;-->
+    <!--      <template slot="table-columns">-->
+    <!--        <el-table-column prop="id" sortable="custom" label="识别码" width="200" align="center" />-->
+    <!--        <el-table-column prop="device_name" sortable="custom" label="别名" width="200" align="center" />-->
+    <!--        <el-table-column prop="device_wifi_mac" sortable="custom" label="mac地址" width="200" align="center" />-->
+    <!--        <el-table-column prop="device_eth_ip" sortable="custom" label="IP地址" width="200" align="center" />-->
+    <!--        <el-table-column prop="partid" sortable="custom" label="科室ID" width="200" align="center" />-->
+    <!--        <el-table-column label="操作" align="center">-->
+    <!--          <template slot-scope="scope">-->
+    <!--            <el-button type="primary" size="mini" @click="setPartBoard(scope.row)">设定</el-button>-->
+    <!--            <el-button type="primary" size="mini" @click="setBoard(scope.row)">设置</el-button>-->
+    <!--            <el-button type="danger" size="mini" @click="handlerDelete(scope.row.id)">删除</el-button>-->
+    <!--          </template>-->
+    <!--        </el-table-column>-->
+    <!--      </template>-->
+
+    <!--      &lt;!&ndash;翻页&ndash;&gt;-->
+    <!--      <el-pagination-->
+    <!--        v-if="pageData"-->
+    <!--        slot="pagination"-->
+    <!--        :current-page="pageData.page_no"-->
+    <!--        :page-sizes="[10, 20, 50, 100]"-->
+    <!--        :page-size="pageData.page_size"-->
+    <!--        layout="total, sizes, prev, pager, next, jumper"-->
+    <!--        :total="pageData.data_total"-->
+    <!--        @size-change="handlePageSizeChange"-->
+    <!--        @current-change="handlePageCurrentChange"-->
+    <!--      />-->
+    <!--    </en-table-layout>-->
 
     <el-dialog title="设置看板" :visible.sync="formshow" width="50%">
-      <el-form>
+      <el-form ref="editform" v-model="boardConfig" label-width="120px">
         <fieldset>
           <legend>设置停留时长</legend>
-          <el-form ref="editform" label-width="120px">
-            <el-form-item label="第1屏">
-              <el-input v-model="staySeconds[0]" clearable placeholder="第1屏停留时长" />
-            </el-form-item>
-            <el-form-item label="第2屏">
-              <el-input v-model="staySeconds[1]" clearable placeholder="第2屏停留时长" />
-            </el-form-item>
-            <el-form-item v-for="(item,index) in boardTitles" v-if="boardTitles.length>0" :key="index" :label="'第'+(index+3)+'屏'">
-              <el-input v-model="staySeconds[index+2]" clearable :placeholder="'第'+(index+3)+'屏停留时长'" />
-            </el-form-item>
-          </el-form>
+          <el-form-item label="第1屏">
+            <el-input v-model="boardConfig.staySeconds[0]" clearable placeholder="第1屏停留时长" type="number">
+              <template slot="append">秒</template>
+            </el-input>
+
+          </el-form-item>
+          <el-form-item label="第2屏">
+            <el-input v-model="boardConfig.staySeconds[1]" clearable placeholder="第2屏停留时长" type="number">
+              <template slot="append">秒</template>
+            </el-input>
+          </el-form-item>
+          <el-form-item v-for="(item,index) in boardTitles" :key="index" :label="'第'+(index+3)+'屏'">
+            <el-input v-model="boardConfig.staySeconds[index+2]" clearable :placeholder="'第'+(index+3)+'屏停留时长'" type="number">
+              <template slot="append">秒</template>
+            </el-input>
+          </el-form-item>
         </fieldset>
-        <fieldset>
+        <fieldset class="margin-top-sm">
           <legend>设置固定屏显示</legend>
-          <el-form-item>
-            <el-radio-group v-model="stayIndex">
-              <el-radio label="1">第1屏</el-radio>
-              <el-radio label="2">第2屏</el-radio>
+          <el-form-item label-width="80">
+            <el-radio-group v-model="boardConfig.stayIndex">
+              <el-radio :label="0">不固定</el-radio>
+              <el-radio :label="1">第1屏</el-radio>
+              <el-radio :label="2">第2屏</el-radio>
               <el-radio v-for="(item,index) in boardTitles" :key="index" :label="(index+3)">第{{ index+3 }}屏</el-radio>
             </el-radio-group>
           </el-form-item>
@@ -77,29 +117,50 @@
 </template>
 
 <script>
+import { AG_GRID_LOCALE_CN } from '@/utils/AgGridVueLocaleCn'
+import ButtonCellRender from '../../components/AgGridCellRender/ButtonCellRender'
+import ListFilter from '@/components/AgGridCustomFilter/ListFilter'
+import RadioFilter from '@/components/AgGridCustomFilter/RadioFilter'
+import { DeviceUrl } from '@/utils/domain'
 import * as API_Device from '@/api/ncs_device'
-import * as API_Board from '@/api/calling-board'
-import { runtimeUrl } from '@/utils/domain'
-
+import * as API_FrameGroup from '@/api/ncs_frameGroup'
+import * as API_Board from '@/api/ncs_board'
 export default {
   name: 'Index',
+  components: { ButtonCellRender, ListFilter, RadioFilter },
   data() {
     return {
-      tableData: [],
       /** 列表参数 */
       params: {
         page_size: 20,
         page_no: 1,
-        fixedCondition: '(PARTID=' + this.$store.getters.partId + ' OR PARTID is null) AND DEVICE_TYPE=17'
+        fixedCondition: '(part_id=' + this.$store.getters.partId + ' OR part_id=0) AND device_type=17'
       },
+      treeData: [],
+      /** ag-grid参数 **/
       pageData: [],
       loading: false,
+      errorId: null,
+      shopVisible: false,
+      columnDefs: null,
+      rowData: null,
+      defaultColDef: null,
+      gridOptions: null,
+      gridApi: null,
+      columnApi: null,
+      localeText: AG_GRID_LOCALE_CN,
+      filterState: null,
+      rowSelection: null,
+      frameworkComponents: null,
 
       websock: null,
       boardObj: {},
-      staySeconds: [5, 5],
+      boardConfig: {
+        staySeconds: [30, 30],
+        stayIndex: 0
+      },
       boardTitles: [],
-      stayIndex: 0,
+
       formshow: false,
       rules: {
         device_type: [
@@ -113,8 +174,109 @@ export default {
       return this.mainAreaHeight - 130
     }
   },
+
+  beforeMount() {
+    this.gridOptions = {}
+    this.columnDefs = [
+      {
+        headerName: '#',
+        headerCheckboxSelection: true,
+        headerCheckboxSelectionFilteredOnly: true,
+        checkboxSelection: true,
+        sortable: false, filter: false,
+        width: 100,
+        resizable: false,
+        valueGetter: this.hashValueGetter
+      },
+      { headerName: 'ID', field: 'id', sortable: true, filter: 'agNumberColumnFilter', width: 130 },
+      {
+        headerName: '别名', field: 'name', sortable: true, filter: 'agTextColumnFilter', width: 150
+      },
+      {
+        headerName: 'mac地址', field: 'eth_mac', sortable: true, filterFramework: 'agTextColumnFilter', flex: 1
+      },
+      {
+        headerName: '科室ID', field: 'part_id', sortable: true, filterFramework: 'agNumberColumnFilter', width: 150
+
+      },
+      {
+        headerName: '设定', field: 'id',
+        cellRendererFramework: 'ButtonCellRender',
+        cellRendererParams: {
+          onClick: this.handEdit,
+          label: '设定到本科室',
+          buttonType: 'primary',
+          buttonSize: 'mini'
+        },
+        filter: false,
+        pinned: 'right',
+        lockPinned: true,
+        width: 150,
+        resizable: false,
+        sortable: false
+      },
+      {
+        headerName: '设置', field: 'id',
+        cellRendererFramework: 'ButtonCellRender',
+        cellRendererParams: {
+          onClick: this.setBoard,
+          label: '设置看板',
+          buttonType: 'primary',
+          buttonSize: 'mini'
+        },
+        filter: false,
+        pinned: 'right',
+        lockPinned: true,
+        width: 150,
+        resizable: false,
+        sortable: false
+      },
+      {
+        headerName: '删除', field: 'shop_id',
+        cellRendererFramework: 'ButtonCellRender',
+        cellRendererParams: param => {
+          return {
+            onClick: this.deleteSingle,
+            label: '删除',
+            buttonType: 'danger',
+            buttonSize: 'mini'
+          }
+        },
+        pinned: 'right',
+        lockPinned: true,
+        width: 100,
+        resizable: false,
+        filter: false,
+        sortable: false
+      }
+    ]
+    this.defaultColDef = {
+      sortable: true,
+      resizable: true,
+      comparator: this.dateCustomComparator,
+      filterParams: {
+        debounceMs: 200,
+        newRowsAction: 'keep',
+        textCustomComparator: this.textCustomComparator,
+        comparator: this.dateCustomComparator
+      }
+    }
+    this.rowSelection = 'multiple'
+  },
   mounted() {
-    this.getList()
+    window.onresize = this.windowResize
+    this.gridApi = this.gridOptions.api
+    this.gridColumnApi = this.gridOptions.columnApi
+    // 设置默认排序字段,应用列状态之后会触发 gridSortChange 函数,会调用getlist,后面不需要再调用this.getlist
+    this.gridColumnApi.applyColumnState({
+      state: [
+        {
+          colId: 'id',
+          sort: 'asc'
+        }
+      ]
+    })
+    this.getFrameTree()
     this.getBoardTitles()
     this.initWebSocket()
   },
@@ -123,6 +285,12 @@ export default {
     selectFun: function(val) {
       this.multipleSelection = val
     },
+    windowResize() {
+      this.$set(this, 'mainAreaHeight', Number(document.documentElement.clientHeight) - 84)
+    },
+    deleteSingle(row) {
+      this.handlerDelete(row.id)
+    },
     handlerDelete(ids) {
       this.$confirm('删除操作后数据不可复原,您确定要删除此数据?', '警告', {
         confirmButtonText: '确定',
@@ -165,9 +333,9 @@ export default {
     getList() {
       this.loading = true
       const param = this.MixinClone(this.params)
-      API_Device.getBoardPage(param).then(response => {
+      API_Device.getList(param).then(response => {
         this.loading = false
-        this.tableData = [...response.data]
+        this.rowData = [...response.data]
         this.pageData = {
           page_no: response.page_no,
           page_size: response.page_size,
@@ -194,10 +362,67 @@ export default {
       this.getList()
     },
 
-    setBoard(obj) {
-      this.boardObj = obj
+    gridSortChange(param) {
+      const columnState = param.columnApi.getColumnState()
+      // 排序状态
+      const sortState = columnState.filter(function(s) {
+        return s.sort != null
+      }).map(function(s) {
+        return {
+          colId: s.colId,
+          sort: s.sort,
+          sortIndex: s.sortIndex
+        }
+      }).sort(function(a, b) {
+        return a.sortIndex - b.sortIndex
+      })
+      if (sortState.length > 0) {
+        if (sortState.length === 1) {
+          this.params.sort = sortState[0].colId
+          this.params.dir = sortState[0].sort
+        } else {
+          let sortstring = ''
+          sortState.forEach(function(item) {
+            sortstring += item.colId + ' ' + item.sort + ','
+          })
+          this.params.sort = sortstring.substring(0, sortstring.length - 1)
+          this.params.dir = ' '
+        }
+      } else {
+        delete this.params.sort
+        delete this.params.dir
+      }
+
+      this.getList()
+      console.log(sortState)
+    },
+
+    /**
+     * 获取空间结构树形数据
+     * */
+    getFrameTree() {
+      return new Promise((resolve, reject) => {
+        API_FrameGroup.getframestruct(this.$store.getters.partId, 3).then(res => {
+          this.treeData = res.frameTree
+          resolve()
+        }).catch(err => {
+          reject(err)
+        })
+      })
+    },
+
+    setBoard(row) {
+      this.boardObj = { ...row }
       this.formshow = true
-      if (this.boardObj.device_soft_ver) this.staySeconds = this.boardObj.device_soft_ver.split(',')
+      if (this.boardObj.config === null || this.boardObj.config === '') { // 没有配置看板时,设置默认值
+        if (this.boardTitles.length > 0) {
+          this.boardTitles.forEach((item, index) => {
+            this.boardConfig.staySeconds[index + 2] = 30 // 添加默认时间
+          })
+        }
+      } else {
+        this.boardConfig = JSON.parse(this.boardObj.config)
+      }
       // if (this.boardObj.device_hard_ver) this.stayIndex = Number(this.boardObj.device_hard_ver)
     },
     getBoardTitles() {
@@ -205,42 +430,51 @@ export default {
         this.boardTitles = res
       })
     },
-    setPartBoard(obj) {
-      obj.partid = this.$store.getters.partId
-      API_Device.saveBoard(obj).then(() => {
-        this.$message.success('设定成功!')
-        this.getList()
-      }).catch(response => {
-        this.$message.warning(response.message)
-        this.getList()
-      })
-    },
+
     updateBoard() {
-      if (this.staySeconds.length !== this.boardTitles.length + 2) {
+      if (this.boardConfig.staySeconds.length !== this.boardTitles.length + 2) {
         this.$message.success('时长必须每项都设置!')
         return false
-      } else {
-        this.boardObj.device_soft_ver = this.staySeconds.join(',')
       }
-      if (this.stayIndex > 0) {
-        this.boardObj.device_hard_ver = this.stayIndex
-      } else {
-        this.boardObj.device_hard_ver = null
-      }
-      API_Device.saveBoard(this.boardObj).then(() => {
+      this.boardConfig.staySeconds = this.boardConfig.staySeconds.map(p => Number(p))
+      this.boardObj.config = JSON.stringify(this.boardConfig)
+      API_Device.update(this.boardObj.id, this.boardObj).then(() => {
         this.$message.success('设置成功!')
         this.getList()
         this.formshow = false
       }).catch(response => {
-        this.$message.warning(response.message)
+        this.$message.error(response.message)
         this.getList()
         this.formshow = false
       })
     },
+    /**
+     * 设定到科室
+     * @param row
+     */
+    handEdit(row) {
+      row.part_id = this.$store.getters.partId
+      row.frame_id = this.treeData[0].id
+      API_Device.update(row.id, row).then(res => {
+        this.$message.success('设定成功!')
+        this.gridApi.redrawRows()
+      }).catch(response => {
+        this.$message.error(response.message)
+        this.getList()
+      })
+    },
+
+    filterModifed(param) {
+      console.log(param)
+      var model = param.api.getFilterModel()
+      console.log('model', JSON.stringify(model))
+      this.params.filter = JSON.stringify(model)
+      this.getList()
+    },
 
     initWebSocket: function() {
-      var stockbase = runtimeUrl.replace('http', 'ws')
-      this.websock = new WebSocket(stockbase + '/board/0/' + this.$store.getters.partId)
+      var stockbase = DeviceUrl.replace('http', 'ws')
+      this.websock = new WebSocket(stockbase + '/boardinfo/0/' + this.$store.getters.uuid)
       this.websock.onopen = this.websocketonopen
       this.websock.onerror = this.websocketonerror
       this.websock.onmessage = this.websocketonmessage
@@ -264,5 +498,10 @@ export default {
 </script>
 
 <style scoped>
-
+  fieldset{
+    border-style: solid;
+    border-color: #DCDFE6;
+    border-width: 1px;
+  }
+  .margin-top-sm{margin-top: 20px}
 </style>

+ 0 - 111
src/views/calling-boardcast/components/BroadCastFilesViewer.vue

@@ -1,111 +0,0 @@
-<template>
-  <div>
-
-    <el-upload
-      class="upload-demo"
-      drag
-      :action="`${uploadServer}/mgr/zoneinfo/upload/${partid}`"
-      :show-file-list="false"
-      accept=".mp3"
-      :on-success="uploaded"
-    >
-      <i class="el-icon-upload" />
-      <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-      <div slot="tip" class="el-upload__tip">只能上传mp3文件</div>
-    </el-upload>
-    <en-table-layout
-      :table-data="tableData"
-      :loading="loading"
-      height="300"
-    >
-      <!--表头-->
-      <template slot="table-columns">
-        <el-table-column
-          label="序号"
-          type="index"
-          width="50"
-        />
-        <el-table-column prop="file_name" label="文件名称" align="center" />
-        <el-table-column prop="file_size" label="文件大小" width="300" align="center" />
-        <el-table-column
-          label="操作"
-          align="center"
-          width="240"
-        >
-          <template slot-scope="scope">
-            <el-button type="danger" size="mini" @click="handlerDelete(scope.row.file_name)">
-              删除
-            </el-button>
-            <el-button type="primary" size="mini" @click="selectFile(scope.row)">
-              选择
-            </el-button>
-          </template>
-        </el-table-column>
-
-      </template>
-    </en-table-layout>
-  </div>
-</template>
-
-<script>
-import * as API_BroadCast from '@/api/calling-broadcast'
-import { serverUrl } from '@/utils/domain'
-export default {
-  name: 'BroadCastFilesViewer',
-  data() {
-    return {
-      tableData: [],
-      loading: false,
-      uploadServer: serverUrl,
-      partid: this.$store.getters.partId
-    }
-  },
-  mounted() {
-    this.getFileList()
-  },
-  methods: {
-    getFileList() {
-      API_BroadCast.getZoneFileList(this.$store.getters.partId).then(res => {
-        this.tableData = [...res]
-      })
-    },
-    uploaded() {
-      this.getFileList()
-    },
-    handlerDelete(filename) {
-      this.$confirm('删除操作后数据不可复原,您确定要删除此数据?', '警告', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        API_BroadCast.deleteZoneFile(this.$store.getters.partId, { file_name: filename }).then(
-          response => {
-            this.getFileList()
-            this.$message({
-              type: 'success',
-              message: '删除成功!'
-            })
-          }
-        ).catch(response => {
-          this.$message({
-            type: 'info',
-            message: response.message
-          })
-        })
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消删除'
-        })
-      })
-    },
-    selectFile(row) {
-      this.$emit('selected', row)
-    }
-  }
-}
-</script>
-
-<style scoped>
-
-</style>

+ 0 - 351
src/views/calling-boardcast/components/GlobalBoardCast.vue

@@ -1,351 +0,0 @@
-<template>
-  <div>
-    <en-table-layout
-      :table-data="tableData"
-      :height="tableHeight"
-      :loading="loading"
-      @selection-change="selectFun"
-    >
-      <div slot="toolbar" class="inner-toolbar">
-        <div class="toolbar-search" />
-        <div class="toolbar-btns">
-          <el-popover
-            placement="top"
-            width="400"
-            trigger="click"
-          >
-            <el-slider v-model="vol" @change="setBroadVol" />
-            <el-button slot="reference" type="primary" icon="el-icon-bell">设置广播音量</el-button>
-          </el-popover>
-          <el-button type="primary" style="margin-left: 10px" @click="handlerAdd">添加文件</el-button>
-          <el-button type="primary" icon="el-icon-video-play" @click="handlerBroad">播放</el-button>
-          <el-button type="danger" icon="el-icon-video-pause" @click="handlerStop">停止</el-button>
-        </div>
-      </div>
-      <!--表头-->
-      <template slot="table-columns">
-        <el-table-column
-          type="selection"
-          width="55"
-          align="center"
-        />
-        <el-table-column
-          label="序号"
-          type="index"
-          width="50"
-        />
-        <el-table-column prop="filePath" sortable="custom" label="文件路径" align="center" />
-        <el-table-column prop="remark" sortable="custom" label="备注内容" width="300" align="center" />
-        <el-table-column
-          label="操作"
-          align="center"
-          width="240"
-        >
-          <template slot-scope="scope">
-            <el-button type="danger" size="mini" @click="handlerDelete(scope.$index)">
-              删除
-            </el-button>
-            <div v-if="scope.row.status==='playing'" style="display: inline-block;height: 23px;overflow: hidden;vertical-align: middle;margin-left: 20px">
-              <div id="container">
-                <span />
-                <span />
-                <span />
-                <span />
-                <span />
-              </div>
-            </div>
-            <!--            <el-button plain icon="el-icon-video-play" v-if="scope.row.status==='stop'" @click="handlerBroad(scope.row.filePath)" size="mini" circle></el-button>-->
-            <!--            <el-button plain icon="el-icon-video-pause" v-if="scope.row.status==='playing'" @click="handlerStop(scope.row.filePath)" size="mini" circle></el-button>-->
-          </template>
-        </el-table-column>
-
-      </template>
-    </en-table-layout>
-
-    <el-dialog title="添加文件" :visible.sync="formshow" width="30%">
-      <div>
-        <el-form ref="editform" :rules="rules" label-width="120px" :model="formmodel">
-          <el-form-item label="文件路径" prop="file_name">
-            <el-input v-model="formmodel.file_name" :readonly="true" clearable placeholder="选择文件">
-              <el-button slot="append" icon="el-icon-search" @click="filepopshow=true" />
-            </el-input>
-          </el-form-item>
-          <el-form-item label="备注" prop="remark">
-            <el-input
-              v-model="formmodel.remark"
-              type="textarea"
-              :rows="5"
-              placeholder="请输入内容"
-            />
-          </el-form-item>
-        </el-form>
-      </div>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="formshow = false">取 消</el-button>
-        <el-button type="primary" @click="handlerFormSubmit('editform')">确 定</el-button>
-      </div>
-    </el-dialog>
-
-    <el-dialog title="选择服务器文件" :visible.sync="filepopshow" width="60%">
-      <broad-cast-files-viewer @selected="selectFile" />
-    </el-dialog>
-  </div>
-
-</template>
-
-<script>
-import * as API_BroadCast from '@/api/calling-broadcast'
-import BroadCastFilesViewer from './BroadCastFilesViewer'
-import { runtimeUrl } from '@/utils/domain'
-import uuidv1 from 'uuid/v1'
-export default {
-  name: 'GlobalBoardCast',
-  components: { BroadCastFilesViewer },
-  props: {
-    zoneIndex: {
-      type: Number,
-      default: 0
-    }
-  },
-  data() {
-    return {
-      tableData: [],
-      loading: false,
-      zoneInfo: {},
-      formshow: false,
-      filepopshow: false,
-      formmodel: {
-        remark: '',
-        file_name: ''
-      },
-      vol: 0,
-      rules: {
-        file_name: [
-          { required: true, message: '请选择文件', trigger: 'blur' }
-        ]
-      },
-      /** 表格选中记录 */
-      multipleSelection: [],
-      zoneFileVirtualDir: '',
-      websock: null
-    }
-  },
-  computed: {
-    tableHeight() {
-      return this.mainAreaHeight - 170
-    }
-  },
-  async created() {
-    this.getList()
-    this.zoneFileVirtualDir = await API_BroadCast.getZoneVirtualDir()
-    this.initWebSocket()
-    this.getBroadVol()
-  },
-  methods: {
-
-    initWebSocket: function() {
-      var stockbase = runtimeUrl.replace('http', 'ws')
-      this.websock = new WebSocket(stockbase + '/deviceautoregister/' + uuidv1())
-      this.websock.onopen = this.websocketonopen
-      this.websock.onerror = this.websocketonerror
-      this.websock.onmessage = this.websocketonmessage
-      this.websock.onclose = this.websocketclose
-    },
-    websocketonopen: function() {
-      console.log('WebSocket连接成功')
-    },
-    websocketonerror: function(e) {
-      console.log('WebSocket连接发生错误')
-    },
-    websocketonmessage: function(e) {
-      this.tableData.forEach(item => {
-        item.status = 'stop'
-      })
-      const notice = JSON.parse(e.data)
-      if (notice.command === 'start') {
-        const td = this.tableData.find(p => p.filePath === notice.file)
-        td.status = 'playing'
-      } else if (notice.command === 'alldone') {
-        this.tableData.forEach((item) => {
-          item.status = 'stop'
-        })
-      } else if (notice.command === 'done') {
-        const te = this.tableData.find(p => p.filePath === notice.file)
-        te.status = 'stop'
-      }
-    },
-    websocketclose: function(e) {
-      console.log('connection closed (' + e.code + ')')
-    },
-    getList() {
-      this.loading = true
-      API_BroadCast.getBoardCast(this.$store.getters.partId, this.zoneIndex).then(response => {
-        this.loading = false
-        this.zoneInfo = { ...response }
-        if (this.zoneInfo.zone_filelist && this.zoneInfo.zone_filelist !== '') {
-          const fileList = this.zoneInfo.zone_filelist.split(',')
-          if (fileList.length > 0) {
-            this.tableData = []
-            for (var i = 0; i < fileList.length; i++) {
-              const fileItem = fileList[i].split('$')
-              this.tableData.push({ 'filePath': fileItem[0], 'remark': fileItem[1], 'status': 'stop' })
-            }
-          }
-        }
-      }).catch(() => {
-        this.loading = false
-      })
-    },
-    getBroadVol() {
-      API_BroadCast.broadVol({ partid: this.$store.getters.partId }).then(res => {
-        const jsonStr = res.substring(0, res.lastIndexOf(','))
-        const json = JSON.parse(jsonStr)
-        if (json.Code !== 'ERROR') { this.vol = Number(json.BroadcastVol) }
-      })
-    },
-    setBroadVol(val) {
-      API_BroadCast.broadVol({ partid: this.$store.getters.partId, broadcastvol: val }).then(res => {
-
-      })
-    },
-    handlerAdd() {
-      this.formshow = true
-      if (this.$refs.editform) { this.$refs.editform.resetFields() }
-    },
-    selectFile(file) {
-      this.filepopshow = false
-      this.formmodel.file_name = file.file_name
-    },
-    handlerFormSubmit(formName) {
-      this.$refs[formName].validate((valid) => {
-        if (valid) {
-          const files = [...this.tableData]
-          if (this.zoneFileVirtualDir.startsWith('/')) {
-            this.zoneFileVirtualDir = this.zoneFileVirtualDir.substring(1)
-          }
-          files.push({ 'filePath': this.zoneFileVirtualDir + this.$store.getters.partId + '/' + this.formmodel.file_name, 'remark': this.formmodel.remark })
-          const joinFiles = files.map(p => p.filePath + '$' + p.remark)
-          const filelist = joinFiles.join(',')
-          const param = { ...this.zoneInfo, ...{ partid: this.$store.getters.partId, zone_filelist: filelist, zone_zoneid: 0 }}
-          API_BroadCast.updateBroadCast(this.$store.getters.partId, this.zoneIndex, param).then(res => {
-            this.getList()
-            this.formshow = false
-            this.$message({
-              type: 'success',
-              message: '保存成功!'
-            })
-          }).catch(err => {
-            this.$message({
-              type: 'info',
-              message: err.message
-            })
-          })
-        }
-      })
-    },
-    handlerDelete(index) {
-      this.$confirm('您确定要删除此数据?', '警告', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        this.tableData.splice(index, 1)
-        const joinFiles = this.tableData.map(p => p.filePath + '$' + p.remark)
-        const filelist = joinFiles.join(',')
-        const param = { ...this.zoneInfo, ...{ partid: this.$store.getters.partId, zone_filelist: filelist, zone_zoneid: 0 }}
-        API_BroadCast.updateBroadCast(this.$store.getters.partId, this.zoneIndex, param).then(res => {
-          this.getList()
-          this.formshow = false
-          this.$message({
-            type: 'success',
-            message: '删除成功!'
-          })
-        }).catch(err => {
-          this.$message({
-            type: 'info',
-            message: err.message
-          })
-        })
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消删除'
-        })
-      })
-    },
-    /** 表格行选择变化记录选中行数据*/
-    selectFun: function(val) {
-      this.multipleSelection = val
-    },
-    handlerBroad(filename) {
-      if (this.multipleSelection.length === 0) {
-        this.$alert('没有选择任何记录!', '系统提示', {
-          confirmButtonText: '确定',
-          callback: action => {
-          }
-        })
-      } else {
-        const files = []
-        this.multipleSelection.forEach(function(item) {
-          files.push(item.filePath)
-        })
-        this.websock.send(JSON.stringify({ 'command': 'play', 'fileList': [...files], 'partid': this.$store.getters.partId, volume: this.vol }))
-      }
-    },
-    handlerStop(filename) {
-      this.websock.send(JSON.stringify({ 'command': 'stop', 'fileList': [filename], 'partid': this.$store.getters.partId }))
-      this.tableData.forEach(item => {
-        item.status = 'stop'
-      })
-    }
-  }
-}
-</script>
-
-<style scoped>
-  #container{
-    display: flex;
-    width: 30px;
-    justify-content: space-between;
-    align-items: center;
-  }
-
-  #container span{
-    width:2px;
-    height: 5px;
-    background:green;
-    -webkit-animation: bodong 0.5s infinite  ease;
-  }
-
-  #container span:first-child{
-    left:0px;
-    -webkit-animation-delay:.3s;
-  }
-
-  #container span:nth-child(2){
-    left:7px;
-    -webkit-animation-delay:.4s;
-
-  }
-  #container span:nth-child(3){
-    left:14px;
-    -webkit-animation-delay:.6s;
-  }
-  #container span:nth-child(4){
-    left:21px;
-    -webkit-animation-delay:.8s;
-  }
-  #container span:nth-child(5){
-    left:28px;
-    -webkit-animation-delay:1s;
-  }
-
-  @-webkit-keyframes bodong{
-    0%{height:5px; background:darkgreen;}
-    30%{height:15px; background:cadetblue;}
-    60%{height:20px; background:green;}
-    80%{height:15px; background:forestgreen;}
-    100%{height:5px; background:seagreen;}
-  }
-
-</style>

+ 0 - 268
src/views/calling-boardcast/components/TimeBoardCast.vue

@@ -1,268 +0,0 @@
-<template>
-  <div>
-    <en-table-layout
-      :table-data="tableData"
-      :height="tableHeight"
-      :loading="loading"
-    >
-      <div slot="toolbar" class="inner-toolbar">
-        <div class="toolbar-search" />
-        <div class="toolbar-btns">
-          <el-button type="primary" @click="handlerAdd">添加文件</el-button>
-        </div>
-      </div>
-      <!--表头-->
-      <template slot="table-columns">
-        <el-table-column
-          type="selection"
-          width="55"
-          align="center"
-        />
-        <el-table-column
-          label="序号"
-          type="index"
-          width="50"
-        />
-        <el-table-column prop="filePath" sortable="custom" label="文件路径" align="center" />
-        <el-table-column
-          label="操作"
-          align="center"
-          width="240"
-        >
-          <template slot-scope="scope">
-            <el-button type="danger" size="mini" @click="handlerDelete(scope.$index)">
-              删除
-            </el-button>
-          </template>
-        </el-table-column>
-
-      </template>
-    </en-table-layout>
-
-    <el-dialog title="添加文件" :visible.sync="formshow" width="30%">
-      <div>
-        <el-form ref="editform" :rules="rules" label-width="120px" :model="formmodel">
-          <el-form-item label="文件路径" prop="file_name">
-            <el-input v-model="formmodel.file_name" :readonly="true" clearable placeholder="选择文件">
-              <el-button slot="append" icon="el-icon-search" @click="filepopshow=true" />
-            </el-input>
-          </el-form-item>
-        </el-form>
-      </div>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="formshow = false">取 消</el-button>
-        <el-button type="primary" @click="handlerFormSubmit('editform')">确 定</el-button>
-      </div>
-    </el-dialog>
-
-    <el-dialog title="选择服务器文件" :visible.sync="filepopshow" width="60%">
-      <board-cast-files-viewer @selected="selectFile" />
-    </el-dialog>
-    <div>
-      <el-form ref="recordform" label-width="120px" :model="zoneInfo">
-        <el-row>
-          <el-col :span="4">
-            <el-form-item label="是否启用" prop="device_status">
-              <el-checkbox v-model="zoneInfo.zone_status" :true-label="1" :false-label="0">开启此语音广播</el-checkbox>
-            </el-form-item>
-          </el-col>
-          <el-col :span="10">
-            <el-form-item label="开启频次">
-              <el-checkbox-group v-model="checkWeek">
-                <el-checkbox label="周一" />
-                <el-checkbox label="周二" />
-                <el-checkbox label="周三" />
-                <el-checkbox label="周四" />
-                <el-checkbox label="周五" />
-                <el-checkbox label="周六" />
-                <el-checkbox label="周日" />
-              </el-checkbox-group>
-            </el-form-item>
-          </el-col>
-          <el-col :span="10">
-            <el-form-item label="开启时间段">
-              <el-time-picker
-                v-model="timeRange"
-                is-range
-                value-format="yyyy-MM-dd HH:mm:ss"
-                range-separator="至"
-                start-placeholder="开始时间"
-                end-placeholder="结束时间"
-                placeholder="选择时间范围"
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="备注" prop="remark">
-              <el-input
-                v-model="zoneInfo.content"
-                type="textarea"
-                :rows="5"
-                placeholder="请输入内容"
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-form-item align="center">
-          <el-button type="success" @click="onSubmit">保存设置</el-button>
-        </el-form-item>
-      </el-form>
-    </div>
-  </div>
-</template>
-
-<script>
-import * as API_BoardCast from '@/api/calling-broadcast'
-import BoardCastFilesViewer from './BroadCastFilesViewer'
-export default {
-  name: 'TimeBoardCast',
-  components: { BoardCastFilesViewer },
-  props: {
-    zoneIndex: {
-      type: Number
-    }
-  },
-  data() {
-    return {
-      tableData: [],
-      loading: false,
-      zoneInfo: {},
-      formshow: false,
-      filepopshow: false,
-      formmodel: {
-        file_name: ''
-      },
-      rules: {
-        file_name: [
-          { required: true, message: '请选择文件', trigger: 'blur' }
-        ]
-      },
-      zoneFileVirtualDir: '',
-      checkWeek: [],
-      timeRange: [new Date(2020, 11, 11, 8, 0), new Date(2020, 11, 11, 22, 0)]
-    }
-  },
-  computed: {
-    tableHeight() {
-      return this.mainAreaHeight - 370
-    }
-  },
-  async created() {
-    this.getList()
-    this.zoneFileVirtualDir = await API_BoardCast.getZoneVirtualDir()
-  },
-  methods: {
-    getList() {
-      this.loading = true
-      API_BoardCast.getBoardCast(this.$store.getters.partId, this.zoneIndex).then(response => {
-        this.loading = false
-        this.zoneInfo = { ...response }
-        /**  广播文件列表 **/
-        if (this.zoneInfo.zone_filelist && this.zoneInfo.zone_filelist !== '') {
-          const fileList = this.zoneInfo.zone_filelist.split(',')
-          if (fileList.length > 0) {
-            this.tableData = []
-            for (var i = 0; i < fileList.length; i++) {
-              const fileItem = fileList[i].replace('$', '')
-              this.tableData.push({ 'filePath': fileItem })
-            }
-          }
-        }
-        /** 播放频次处理 **/
-        if (this.zoneInfo.zone_week && this.zone_week !== '') {
-          const weekday = this.zoneInfo.zone_week.split(',')
-          this.checkWeek = []
-          for (var j = 0; j < weekday.length; j++) {
-            this.checkWeek.push('周' + weekday[j])
-          }
-        }
-        /** 时间段处理 */
-        if (this.zoneInfo.zone_starttime && this.zoneInfo.zone_starttime !== '' && this.zoneInfo.zone_endtime && this.zoneInfo.zone_endtime !== '') {
-          this.$set(this.timeRange, 0, new Date('2020-11-11 ' + this.zoneInfo.zone_starttime))
-          this.$set(this.timeRange, 1, new Date('2020-11-11 ' + this.zoneInfo.zone_endtime))
-        }
-      }).catch(() => {
-        this.loading = false
-      })
-    },
-    handlerAdd() {
-      this.formshow = true
-      if (this.$refs.editform) { this.$refs.editform.resetFields() }
-    },
-    selectFile(file) {
-      this.filepopshow = false
-      this.formmodel.file_name = file.file_name
-    },
-    handlerFormSubmit(formName) {
-      this.$refs[formName].validate((valid) => {
-        if (valid) {
-          this.tableData
-          if (this.zoneFileVirtualDir.startsWith('/')) {
-            this.zoneFileVirtualDir = this.zoneFileVirtualDir.substring(1)
-          }
-          this.tableData.push({ 'filePath': this.zoneFileVirtualDir + this.$store.getters.partId + '/' + this.formmodel.file_name })
-          this.formshow = false
-          // const joinFiles = files.map(p => p.filePath + '$')
-          // const filelist = joinFiles.join(',')
-          // const param = { ...this.zoneInfo, ...{ partid: this.$store.getters.partId, zone_filelist: filelist, zone_zoneid: this.zoneIndex }}
-          // API_BoardCast.updateBoardCast(this.$store.getters.partId, this.zoneIndex, param).then(res => {
-          //   this.getList()
-          //   this.formshow = false
-          //   this.$message({
-          //     type: 'success',
-          //     message: '保存成功!'
-          //   })
-          // }).catch(err => {
-          //   this.$message({
-          //     type: 'info',
-          //     message: err.message
-          //   })
-          // })
-
-          // console.log(filelist)
-        }
-      })
-    },
-    handlerDelete(index) {
-      this.$confirm('您确定要删除此数据?', '警告', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        this.tableData.splice(index, 1)
-      })
-    },
-    onSubmit() {
-      /** 拼合文件列表  */
-      const joinFiles = this.tableData.map(p => p.filePath + '$')
-      const filelist = joinFiles.join(',')
-      /** 设置选择频率 */
-      const weekdays = this.checkWeek.map(p => p.replace('周', '')).join(',')
-      /** 时间设置 */
-      const starttime = new Date(this.timeRange[0]).toLocaleTimeString('chinese', { hour12: false })
-      const endtime = new Date(this.timeRange[1]).toLocaleTimeString('chinese', { hour12: false })
-      const param = { ...this.zoneInfo, ...{ partid: this.$store.getters.partId, zone_filelist: filelist, zone_zoneid: this.zoneIndex, zone_week: weekdays, zone_starttime: starttime, zone_endtime: endtime }}
-      API_BoardCast.updateBroadCast(this.$store.getters.partId, this.zoneIndex, param).then(res => {
-        this.getList()
-        this.formshow = false
-        this.$message({
-          type: 'success',
-          message: '保存成功!'
-        })
-      }).catch(err => {
-        this.$message({
-          type: 'info',
-          message: err.message
-        })
-      })
-    }
-  }
-}
-</script>
-
-<style scoped>
-
-</style>

+ 0 - 58
src/views/calling-boardcast/index.vue

@@ -1,58 +0,0 @@
-<template>
-  <div class="tab-container">
-    <el-tabs v-model="activeName" style="margin:15px;" type="border-card">
-      <el-tab-pane v-for="(item,index) in tabMapOptions" :key="item.key" :label="item.label" :name="item.key">
-        <keep-alive>
-          <!--                    <tab-pane v-if="activeName==item.key" :type="item.key" @create="showCreatedTimes" />-->
-          <global-board-cast v-if="index===0" :zone-index="index" />
-            <time-board-cast v-else :zone-index="index"></time-board-cast>
-        </keep-alive>
-      </el-tab-pane>
-    </el-tabs>
-  </div>
-</template>
-
-<script>
-import GlobalBoardCast from './components/GlobalBoardCast'
-import TimeBoardCast from './components/TimeBoardCast'
-export default {
-  name: 'Index',
-  components: { TimeBoardCast, GlobalBoardCast },
-  data() {
-    return {
-      tabMapOptions: [
-        { label: '全局广播', key: 'zone0' },
-        { label: '定时广播分区1', key: 'zone1' },
-        { label: '定时广播分区2', key: 'zone2' },
-        { label: '定时广播分区3', key: 'zone3' },
-        { label: '定时广播分区4', key: 'zone4' },
-        { label: '定时广播分区5', key: 'zone5' }
-      ],
-      activeName: 'zone0',
-      createdTimes: 0
-    }
-  },
-  watch: {
-    activeName(val) {
-      this.$router.push(`${this.$route.path}?tab=${val}`)
-    }
-  },
-  created() {
-    // init the default selected tab
-    const tab = this.$route.query.tab
-    if (tab) {
-      this.activeName = tab
-    }
-  },
-  methods: {
-    showCreatedTimes() {
-      this.createdTimes = this.createdTimes + 1
-    }
-  }
-
-}
-</script>
-
-<style scoped>
-
-</style>

+ 1 - 1
src/views/ncs-broadcast/components/broadcastInfo.vue

@@ -260,7 +260,7 @@ export default {
     /** 获取科室房间结构 **/
     getRoomStructs() {
       API_FrameGroup.getframestruct(this.$store.getters.partId, 4).then(res => {
-        this.rooms = this.filterGroupFrames(res, this.formmodel.frame_ids)
+        this.rooms = this.filterGroupFrames(res.frameTree, this.formmodel.frame_ids)
       }).catch(err => {
         this.$message.error(err)
       })