浏览代码

Merge branch 'develop/0.0.2(样式修改)' into test

DESKTOP-SVI9JE1\muzen 1 年之前
父节点
当前提交
7b5777e120

src/api/content/insert.js → src/api/insert/insertContent.js


src/api/content/scene.js → src/api/scene/presets.js


+ 3 - 2
src/api/system/menu.js

@@ -27,10 +27,11 @@ export function treeselect(query) {
 }
 
 // 根据角色ID查询菜单下拉树结构
-export function roleMenuTreeselect(roleId) {
+export function roleMenuTreeselect(roleId, query) {
   return request({
     url: '/system/menu/roleMenuTreeselect/' + roleId,
-    method: 'get'
+    method: 'get',
+    params: query
   })
 }
 

+ 2 - 2
src/components/GanttChart/index.vue

@@ -69,8 +69,8 @@
 
 <script setup>
 import { settimgTime, removeSetting } from '@/api/content/setting'
-import { sceneTime, removeScene } from '@/api/content/scene'
-import { insetTime } from '@/api/content/insert'
+import { sceneTime, removeScene } from '@/api/scene/presets'
+import { insetTime } from '@/api/insert/insertContent'
 import { useBusinessSelect, useStoreSelect, useDeviceList } from '@/hooks/index'
 import { checkPermi } from '@/utils/permission'
 

+ 12 - 12
src/router/index.js

@@ -180,31 +180,31 @@ export const dynamicRoutes = [
   },
   // 场景预设
   {
-    path: "/content",
+    path: "/scene",
     component: Layout,
     hidden: true,
-    permissions: ["content:scene:list"],
+    permissions: ["scene:presets:list"],
     children: [
       {
-        path: "scene/detail",
-        component: () => import("@/views/content/scene/detail"),
-        name: "sceneDetail",
-        meta: { title: "预设详情", activeMenu: "/content/scene" },
+        path: "presets/detail",
+        component: () => import("@/views/scene/presets/detail"),
+        name: "presetsDetail",
+        meta: { title: "预设详情", activeMenu: "/scene/presets" },
       },
     ],
   },
   // 内容插播
   {
-    path: "/content",
+    path: "/insert",
     component: Layout,
     hidden: true,
-    permissions: ["content:insert:list"],
+    permissions: ["insert:insertContent:list"],
     children: [
       {
-        path: "insert/detail",
-        component: () => import("@/views/content/insert/detail"),
-        name: "insertDetail",
-        meta: { title: "插播详情", activeMenu: "/content/insert" },
+        path: "insertContent/detail",
+        component: () => import("@/views/insert/insertContent/detail"),
+        name: "insertContentDetail",
+        meta: { title: "插播详情", activeMenu: "/insert/insertContent" },
       },
     ],
   },

+ 18 - 1
src/views/content/list/index.vue

@@ -43,13 +43,16 @@
       <el-table-column label="更新时间" prop="updateTime" align="center" />
       <el-table-column label="操作" align="center">
         <template #default="scope">
+          <el-button type="primary" link :icon="scope.row.play ? 'VideoPause' : 'VideoPlay'"
+            @click="getPlay(scope.row)" />
           <el-button type="primary" link @click="getDialog(scope.row.id, '编辑')"
             v-hasPermi="['content:list:edit']">编辑</el-button>
           <el-button v-if="scope.row.status === 1" type="primary" link @click="getChange(scope.row.id, '上架', 0)"
             v-hasPermi="['content:list:on']">上架</el-button>
           <el-button v-else type="primary" link @click="getChange(scope.row.id, '下架', 1)"
             v-hasPermi="['content:list:off']">下架</el-button>
-          <el-button type="danger" link @click="getDelete(scope.row)" v-hasPermi="['content:list:delete']">删除</el-button>
+          <el-button type="danger" link @click="getDelete(scope.row)"
+            v-hasPermi="['content:list:delete']">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -242,6 +245,20 @@ function getDelete(row) {
   })
 }
 
+// 播放
+const audio = new Audio()
+const getPlay = (e) => {
+  data.tableData.map(i => i.play = false)
+  audio.pause()
+  if (e.play) {
+    e.play = false
+  } else {
+    audio.src = e.playsrc
+    audio.play()
+    e.play = true
+  }
+}
+
 // 字典
 function sceneFormatter(row) {
   let e = audioClassData.options.find(i => i.id === row.sceneId)

+ 9 - 2
src/views/content/setting/detail.vue

@@ -122,7 +122,7 @@
         </el-form-item>
       </el-form>
       <el-table v-show="audioData.form.type !== 2" ref="table" :data="audioData.tableData" :row-key="rowKey"
-        @selection-change="handleSelectionChange" v-loading="audioData.loading">
+        @selection-change="handleSelectionChange" @select="handleSelectChange" v-loading="audioData.loading">
         <el-table-column type="selection" width="55" key="selection" />
         <el-table-column label="ID" prop="id" align="center" key="id" show-overflow-tooltip />
         <el-table-column label="音频名称" prop="name" align="center" key="name" show-overflow-tooltip />
@@ -233,7 +233,6 @@ const getPushTime = (e) => {
 const getAudioList = () => {
   if (proxy.$route.query.audioList) {
     var e = JSON.parse(proxy.$route.query.audioList)
-    console.log(e);
     data.form.audioList.push({
       audioId: e.id,
       audioName: e.name,
@@ -328,6 +327,14 @@ const handleSelectionChange = (e) => {
   })
 }
 
+// 取消勾选
+const handleSelectChange = (arr, row) => {
+  if(arr.findIndex(i => i.id === row.id) === -1) {
+    let index = data.selectionList.findIndex(i => i.audioId === row.id)
+    data.selectionList.splice(index, 1)
+  }
+}
+
 // 单选
 const handleChooseAudio = (e) => {
   data.form.audioList = []

+ 11 - 3
src/views/content/insert/detail.vue

@@ -76,7 +76,7 @@
         </el-form-item>
       </el-form>
       <el-table ref="table" :data="audioData.tableData" :row-key="rowKey" @selection-change="handleSelectionChange"
-        v-loading="audioData.loading">
+        @select="handleSelectChange" v-loading="audioData.loading">
         <el-table-column type="selection" width="55" key="selection" />
         <el-table-column label="ID" prop="id" align="center" key="id" show-overflow-tooltip />
         <el-table-column label="音频名称" prop="name" align="center" key="name" show-overflow-tooltip />
@@ -127,7 +127,7 @@
 </template>
 
 <script setup>
-import { submit } from '@/api/content/insert'
+import { submit } from '@/api/insert/insertContent'
 import { useAudioList, useAudioClass, useSettingList } from '@/hooks/index'
 
 const { proxy } = getCurrentInstance();
@@ -301,6 +301,14 @@ const handleSelectionChange = (e) => {
   })
 }
 
+// 取消勾选
+const handleSelectChange = (arr, row) => {
+  if (arr.findIndex(i => i.id === row.id) === -1) {
+    let index = data.selectionList.findIndex(i => i.audioId === row.id)
+    data.selectionList.splice(index, 1)
+  }
+}
+
 // 选择时段
 const handleCheckTime = (e) => {
   data.form.timeId = e.timeId
@@ -403,7 +411,7 @@ const handleChangeTenant = (e, i) => {
 
 // 取消
 const getClose = () => {
-  proxy.$tab.closeOpenPage('/content/insert')
+  proxy.$tab.closeOpenPage('/insert/insertContent')
 }
 
 // 提交

+ 5 - 5
src/views/content/insert/index.vue

@@ -45,7 +45,7 @@
       </div>
     </div>
     <div class="right">
-      <gantt-chart path="/content/insert/detail" type="insert" :date="nowDate" />
+      <gantt-chart path="/insert/insertContent/detail" type="insert" :date="nowDate" />
     </div>
   </div>
 </template>
@@ -119,11 +119,11 @@ const getSearch = () => {
 
 // 拖拽结束
 function onEnd(params) {
-  if (checkPermi(['content:insert:add'])) {
+  if (checkPermi(['insert:insertContent:add'])) {
     if (params.from.className !== params.to.className) {
       proxy.$modal.confirm(`是否要添加?`).then(() => {
         getRouter({ audioList: JSON.stringify(params.item.__draggable_context.element) })
-      }).catch(() => {})
+      }).catch(() => { })
     }
   } else {
     proxy.$modal.msgError('暂无权限')
@@ -133,14 +133,14 @@ function onEnd(params) {
 // 新增
 function getRouter(query) {
   proxy.$router.push({
-    path: `/content/setting/detail`,
+    path: `/insert/insertContent/detail`,
     query
   })
 }
 
 // 拖动样式
 const chosenClass = () => {
-  return '  background: none !important;color: #3979F9 !important; line-height: 60px;'
+  return 'background: none !important;color: #3979F9 !important; line-height: 60px;'
 }
 
 </script>

+ 2 - 2
src/views/content/scene/detail.vue

@@ -92,7 +92,7 @@
 </template>
 
 <script setup>
-import { list, timeDetail, timeSubmit } from '@/api/content/scene.js'
+import { list, timeDetail, timeSubmit } from '@/api/scene/presets'
 import { useBusinessSelect, useStoreSelect, useDeviceList } from '@/hooks/index.js'
 
 // 公共方法
@@ -296,7 +296,7 @@ const getSubmit = () => {
 
 // 取消
 const getClose = () => {
-  proxy.$tab.closeOpenPage('/content/scene')
+  proxy.$tab.closeOpenPage('/scene/presets')
 }
 
 </script>

+ 7 - 7
src/views/content/scene/index.vue

@@ -2,7 +2,7 @@
   <div class='app-container'>
     <div class="left">
       <el-button type="primary" plain icon="Plus" @click="getDialog()"
-        v-hasPermi="['content:scene:addScene']">新增场景</el-button>
+        v-hasPermi="['scene:presets:addScene']">新增场景</el-button>
       <el-input class="search" v-model="data.form.takeName" placeholder="搜索场景名称" clearable>
         <template #append>
           <el-button icon="Search" @click="getSearch" />
@@ -14,7 +14,7 @@
         <template #item="{ element, index }">
           <div class="item" @click="getDialog(element.takeId)">
             <el-icon class="close" size="18" @click.stop="getDelete(element)"
-              v-hasPermi="['content:scene:deleteScene']">
+              v-hasPermi="['scene:presets::deleteScene']">
               <CircleClose />
             </el-icon>
             <img src="@/assets/icons/svg/file.svg" width="50" height="50" />
@@ -26,7 +26,7 @@
         v-model:page="data.form.pageNum" v-model:limit="data.form.pageSize" @pagination="getList" />
     </div>
     <div class="right">
-      <gantt-chart path="/content/scene/detail" type="scene" />
+      <gantt-chart path="/scene/presets/detail" type="scene" />
     </div>
 
     <!-- 弹窗 -->
@@ -52,7 +52,7 @@
 </template>
 
 <script setup>
-import { list, submit, detail, remove } from '@/api/content/scene'
+import { list, submit, detail, remove } from '@/api/scene/presets'
 import { checkPermi } from '@/utils/permission'
 import GanttChart from '@/components/GanttChart/index.vue'
 
@@ -106,7 +106,7 @@ function getSearch() {
 
 // 拖拽结束
 function onEnd(params) {
-  if (checkPermi(['content:scene:add'])) {
+  if (checkPermi(['scene:presets:add'])) {
     if (params.from.className !== params.to.className) {
       proxy.$modal.confirm(`是否要添加?`).then(() => {
         getRouter({ audioList: JSON.stringify(params.item.__draggable_context.element), disabled: true })
@@ -123,7 +123,7 @@ const dialogVisible = ref(false)
 const title = ref('')
 // 打开弹窗
 function getDialog(id) {
-  if (checkPermi(['content:scene:editScene'])) {
+  if (checkPermi(['scene:presets:editScene'])) {
     dialogVisible.value = true
     title.value = '新增'
     if (id) {
@@ -184,7 +184,7 @@ function getDelete(row) {
 // 新增预设
 function getRouter(query) {
   proxy.$router.push({
-    path: `/content/scene/detail`,
+    path: `/scene/presets/detail`,
     query
   })
 }

+ 3 - 3
src/views/store/list/index.vue

@@ -92,7 +92,7 @@
               :label="data.dialogForm.groupName ? data.dialogForm.groupName : '无'" :value="data.dialogForm.groupId" />
           </el-select>
         </el-form-item>
-        <el-form-item label="休眠时间:">
+        <el-form-item label="休眠时间:" prop="timeRestList">
           <div class="time_list" v-for="(item, index) in data.timeList">
             <el-time-picker v-model="data.timeList[index]" is-range format="HH:mm:ss" value-format="HH:mm:ss"
               start-placeholder="开始时间" end-placeholder="结束时间" @change="handleChangeTime($event, index)" />
@@ -205,6 +205,8 @@ const dialogVisible = ref(false)
 const title = ref('')
 // 打开弹窗
 function getDialog(id) {
+  data.timeList = [[]]
+  data.areaList = []
   dialogVisible.value = true
   title.value = '新增'
   if (id) {
@@ -315,8 +317,6 @@ const getSubmit = () => {
 const getClose = () => {
   dialogVisible.value = false
   data.dialogForm = {}
-  data.timeList = [[]]
-  data.areaList = []
   proxy.$refs.dialogForm.resetFields()
 }
 

+ 1 - 1
src/views/system/menu/index.vue

@@ -383,7 +383,7 @@ async function handleUpdate(row) {
 function submitForm() {
    proxy.$refs["menuRef"].validate(valid => {
       if (valid) {
-         if (form.value.roleType.length > 0) {
+         if (form.value.roleType && form.value.roleType.length > 0) {
             form.value.roleType = form.value.roleType.join(',')
          } else {
             form.value.roleType = ''

+ 6 - 5
src/views/system/role/index.vue

@@ -301,7 +301,6 @@ function handleAuthUser(row) {
 }
 /** 查询菜单树结构 */
 function getMenuTreeselect(val) {
-  console.log(val);
   let obj = {}
   val !== undefined ? obj.roleType = val : ''
   menuTreeselect(obj).then(response => {
@@ -351,7 +350,7 @@ function handleAdd() {
 function handleUpdate(row) {
   reset();
   const roleId = row.roleId || ids.value;
-  const roleMenu = getRoleMenuTreeselect(roleId);
+  const roleMenu = getRoleMenuTreeselect(roleId, row.roleType);
   getRole(roleId).then(response => {
     form.value = response.data;
     form.value.roleSort = Number(form.value.roleSort);
@@ -370,8 +369,8 @@ function handleUpdate(row) {
   });
 }
 /** 根据角色ID查询菜单树结构 */
-function getRoleMenuTreeselect(roleId) {
-  return roleMenuTreeselect(roleId).then(response => {
+function getRoleMenuTreeselect(roleId, roleType) {
+  return roleMenuTreeselect(roleId, { roleType: roleType }).then(response => {
     menuOptions.value = response.menus;
     return response;
   });
@@ -493,7 +492,9 @@ function cancelDataScope() {
 
 // 检测功能类型
 watch(() => form.value.roleType, (val) => {
-  getMenuTreeselect(val)
+  if (form.value.roleId === null) {
+    getMenuTreeselect(val)
+  }
 })
 
 getList();