DESKTOP-SVI9JE1\muzen пре 1 година
родитељ
комит
aa0137b58d

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

@@ -2,15 +2,12 @@
   <div class='app-container'>
     <el-form class="form" label-width="100px" ref="form" :model="data.form" :rules="data.rules">
       <el-form-item class="chooseAudio" label="插播音频:" prop="audioList">
-        <div class="audioList" v-for="(item, index) in data.form.audioList" :key="item.id" :style="{'height': item.type !== 2 ? '45px' : ''}">
-          <el-tag v-show="item.type === 0 || item.type === 1" size="large" :closable="checkClose()"
+        <div class="audioList" v-for="(item, index) in data.form.audioList" :key="item.id"
+          :style="{ 'height': item.type !== 2 ? '45px' : '' }">
+          <el-tag size="large" :closable="checkClose()"
             @close="handleClose(index)">
             {{ item.audioName }}
           </el-tag>
-          <div v-show="item.type === 2" class="audio">
-            <img src="@/assets/icons/svg/file.svg" width="70" height="70" />
-            <span>{{ item.audioName }}</span>
-          </div>
         </div>
         <div style="width: 100%;">
           <el-button v-if="checkClose()" icon="Plus" @click="getDialog">新增</el-button>
@@ -38,7 +35,8 @@
       </el-form-item>
       <el-form-item v-if="data.form.id" label="当前状态:" prop="status">
         <el-select v-model="data.form.status" placeholder="请选择当前状态">
-          <el-option v-for="item in sys_change_status" :key="item.value" :value="Number(item.value)" :label="item.label" />
+          <el-option v-for="item in sys_change_status" :key="item.value" :value="Number(item.value)"
+            :label="item.label" />
         </el-select>
       </el-form-item>
     </el-form>
@@ -72,8 +70,8 @@
           <el-button icon="Refresh" @click="getRefresh">重置</el-button>
         </el-form-item>
       </el-form>
-      <el-table v-if="audioData.form.type !== 2" ref="table" :data="audioData.tableData" :row-key="rowKey"
-        @selection-change="handleSelectionChange" v-loading="audioData.loading">
+      <el-table ref="table" :data="audioData.tableData" :row-key="rowKey" @selection-change="handleSelectionChange"
+        v-loading="audioData.loading">
         <el-table-column type="selection" width="55" />
         <el-table-column label="ID" prop="id" align="center" show-overflow-tooltip />
         <el-table-column label="名称" prop="name" align="center" show-overflow-tooltip />
@@ -86,12 +84,6 @@
         <el-table-column label="当前状态" prop="status" align="center" :formatter="statusFormatter" />
         <el-table-column label="更新时间" prop="updateTime" align="center" show-overflow-tooltip />
       </el-table>
-      <div class="audio_table" v-else>
-        <div class="audio" v-for="item in audioData.tableData" :key="item.id" @click="handleChooseAudio(item)">
-          <img src="@/assets/icons/svg/file.svg" width="70" height="70" />
-          <span>{{ item.name }}</span>
-        </div>
-      </div>
       <pagination v-show="audioData.total > 0" :total="audioData.total" v-model:page="audioData.form.pageNum"
         v-model:limit="audioData.form.pageSize" @pagination="getAudio" />
       <template #footer>
@@ -157,9 +149,6 @@ const data = reactive({
   }, {
     value: 1,
     label: 'Ohplay音频'
-  }, {
-    value: 2,
-    label: '场景预设'
   }],
   // 多选
   selectionList: [],
@@ -245,8 +234,9 @@ function getDialog() {
     if (audioData.form.type !== 2) {
       nextTick(() => {
         proxy.$refs.table.clearSelection()
-        if (val && data.form.audioList.length > 0) {
-          data.form.audioList.map(i => {
+        data.selectionList = data.form.audioList
+        if (val && data.selectionList.length > 0) {
+          data.selectionList.map(i => {
             let row = val.find(j => j.id === i.audioId)
             if (row) {
               proxy.$refs.table.toggleRowSelection(row, true)
@@ -292,9 +282,8 @@ const rowKey = (e) => {
 
 // 多选
 const handleSelectionChange = (e) => {
-  data.selectionList = []
   e.map(i => {
-    if (data.selectionList.findIndex(j => j.id === i.id) === -1) {
+    if (data.selectionList.findIndex(j => j.audioId === i.id) === -1) {
       data.selectionList.push({
         audioId: i.id,
         audioName: i.name,
@@ -306,21 +295,6 @@ const handleSelectionChange = (e) => {
   })
 }
 
-// 单选
-const handleChooseAudio = (e) => {
-  data.form.audioList = []
-  data.form.audioList.push({
-    audioId: e.id,
-    audioName: e.name,
-    audioType: e.audioType,
-    categoryId: e.sceneId,
-    type: e.type
-  })
-  getPushTime(e)
-  proxy.$modal.msgSuccess('选择成功!')
-  dialogVisible_audio.value = false
-}
-
 // 选择时段
 const handleCheckTime = (e) => {
   data.form.timeId = e.timeId
@@ -473,15 +447,6 @@ watch(() => audioData.form.type, (val) => {
   }
 }
 
-.audio_table {
-  display: flex;
-  flex-wrap: wrap;
-
-  .audio {
-    margin: 10px;
-  }
-}
-
 .audio {
   width: 200px;
   height: 200px;

+ 0 - 1
src/views/content/scene/detail.vue

@@ -92,7 +92,6 @@
 <script setup>
 import { list, timeDetail, timeSubmit } from '@/api/content/scene.js'
 import { useBusinessSelect, useStoreSelect, useDeviceList } from '@/hooks/index.js'
-import { computed } from 'vue'
 
 // 公共方法
 const { deviceOptions } = useDeviceList()

+ 5 - 5
src/views/content/setting/detail.vue

@@ -265,10 +265,11 @@ function getDialog() {
     if (audioData.form.type !== 2) {
       nextTick(() => {
         proxy.$refs.table.clearSelection()
-        if (val && data.form.audioList.length > 0) {
-          data.form.audioList.map(i => {
+        data.selectionList = data.form.audioList
+        if (val && data.selectionList.length > 0) {
+          data.selectionList.map(i => {
             let row = val.find(j => j.id === i.audioId)
-            if (row) {
+            if(row) {
               proxy.$refs.table.toggleRowSelection(row, true)
             }
           })
@@ -301,9 +302,8 @@ const rowKey = (e) => {
 
 // 多选
 const handleSelectionChange = (e) => {
-  data.selectionList = []
   e.map(i => {
-    if (data.selectionList.findIndex(j => j.id === i.id) === -1) {
+    if (data.selectionList.findIndex(j => j.audioId === i.id) === -1) {
       data.selectionList.push({
         audioId: i.id,
         audioName: i.name,