|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<div class='app-container'>
|
|
<div class='app-container'>
|
|
<div class="left">
|
|
<div class="left">
|
|
- <el-button type="primary" plain icon="Plus" @click="getAddDialog()"
|
|
|
|
|
|
+ <el-button type="primary" plain icon="Plus" @click="getRouter('/scene/presets/sceneDetail')"
|
|
v-hasPermi="['scene:presets:addScene']">新增场景</el-button>
|
|
v-hasPermi="['scene:presets:addScene']">新增场景</el-button>
|
|
<el-input class="search" v-model="data.form.takeName" placeholder="搜索场景名称" clearable>
|
|
<el-input class="search" v-model="data.form.takeName" placeholder="搜索场景名称" clearable>
|
|
<template #append>
|
|
<template #append>
|
|
@@ -9,11 +9,11 @@
|
|
</template>
|
|
</template>
|
|
</el-input>
|
|
</el-input>
|
|
<draggable class="contentList" v-model="data.tableData" item-key="id" chosenClass="chosenClass" data-id="content"
|
|
<draggable class="contentList" v-model="data.tableData" item-key="id" chosenClass="chosenClass" data-id="content"
|
|
- :group="{ name: 'componentGroup', pull: 'clone', put: false }" :sort="false" filter=".auditStatus" @end="onEnd"
|
|
|
|
- forceFallback v-loading="loading">
|
|
|
|
|
|
+ :group="{ name: 'componentGroup', pull: 'clone', put: false }" :sort="false" @end="onEnd" forceFallback
|
|
|
|
+ v-loading="loading">
|
|
<template #item="{ element, index }">
|
|
<template #item="{ element, index }">
|
|
- <div :class="['item', element.auditStatus === 0 ? 'auditStatus' : '']" @click="getDialog(element)">
|
|
|
|
- <el-icon v-if="element.auditStatus === 2" class="close" size="18" @click.stop="getDelete(element)"
|
|
|
|
|
|
+ <div class="item" @click="getDetail(element)">
|
|
|
|
+ <el-icon class="close" size="18" @click.stop="getDelete(element)"
|
|
v-hasPermi="['scene:presets:deleteScene']">
|
|
v-hasPermi="['scene:presets:deleteScene']">
|
|
<CircleClose />
|
|
<CircleClose />
|
|
</el-icon>
|
|
</el-icon>
|
|
@@ -21,7 +21,6 @@
|
|
<span style="margin-top: 10px">
|
|
<span style="margin-top: 10px">
|
|
{{ element.takeName }}
|
|
{{ element.takeName }}
|
|
</span>
|
|
</span>
|
|
- <span v-if="element.auditStatus === 0">(待审核)</span>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</draggable>
|
|
</draggable>
|
|
@@ -31,31 +30,11 @@
|
|
<div class="right">
|
|
<div class="right">
|
|
<gantt-chart path="/scene/presets/detail" type="scene" />
|
|
<gantt-chart path="/scene/presets/detail" type="scene" />
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
- <!-- 弹窗 -->
|
|
|
|
- <el-dialog v-model="dialogVisible" :title="title" width="500px" :before-close="getClose">
|
|
|
|
- <el-form :model="data.dialogForm" ref="dialogForm" :rules="data.rules">
|
|
|
|
- <el-form-item label="播放音频:" prop="list">
|
|
|
|
- <CustomUpload v-if="title !== '编辑'" ref="customUpload" :url="`${baseUrl}/radio/tProgram/mp3/upload`" multiple
|
|
|
|
- showFileList @upload="upload" />
|
|
|
|
- <div v-else>
|
|
|
|
- <div v-for="item in data.dialogForm.list" :key="item.id">{{ item.name }}</div>
|
|
|
|
- </div>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="场景名称:" prop="takeName">
|
|
|
|
- <el-input v-model="data.dialogForm.takeName" placeholder="请输入场景名称" />
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- <template #footer>
|
|
|
|
- <el-button @click="getClose">取消</el-button>
|
|
|
|
- <el-button type="primary" @click="getSubmit">确定</el-button>
|
|
|
|
- </template>
|
|
|
|
- </el-dialog>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { list, submit, detail, remove } from '@/api/scene/presets'
|
|
|
|
|
|
+import { list, remove } from '@/api/scene/presets'
|
|
import { checkPermi } from '@/utils/permission'
|
|
import { checkPermi } from '@/utils/permission'
|
|
import GanttChart from '@/components/GanttChart/index.vue'
|
|
import GanttChart from '@/components/GanttChart/index.vue'
|
|
|
|
|
|
@@ -73,8 +52,6 @@ const data = reactive({
|
|
},
|
|
},
|
|
// 列表
|
|
// 列表
|
|
tableData: [],
|
|
tableData: [],
|
|
- // 弹窗表单
|
|
|
|
- dialogForm: {},
|
|
|
|
// 校验
|
|
// 校验
|
|
rules: {
|
|
rules: {
|
|
list: [{
|
|
list: [{
|
|
@@ -101,23 +78,19 @@ function getList() {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
getList()
|
|
getList()
|
|
|
|
+
|
|
// 搜索
|
|
// 搜索
|
|
function getSearch() {
|
|
function getSearch() {
|
|
data.form.pageNum = 1
|
|
data.form.pageNum = 1
|
|
getList()
|
|
getList()
|
|
}
|
|
}
|
|
|
|
|
|
-// 拖拽前
|
|
|
|
-const onMove = () => {
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// 拖拽结束
|
|
// 拖拽结束
|
|
function onEnd(params) {
|
|
function onEnd(params) {
|
|
if (checkPermi(['scene:presets:add'])) {
|
|
if (checkPermi(['scene:presets:add'])) {
|
|
if (params.from.className !== params.to.className) {
|
|
if (params.from.className !== params.to.className) {
|
|
proxy.$modal.confirm(`是否要添加?`).then(() => {
|
|
proxy.$modal.confirm(`是否要添加?`).then(() => {
|
|
- getRouter({ audioList: JSON.stringify(params.item.__draggable_context.element), disabled: true })
|
|
|
|
|
|
+ getRouter('/scene/presets/detail', { audioList: JSON.stringify(params.item.__draggable_context.element), disabled: true })
|
|
}).catch(() => { })
|
|
}).catch(() => { })
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -125,62 +98,14 @@ function onEnd(params) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// 弹窗
|
|
|
|
-const dialogVisible = ref(false)
|
|
|
|
-// 弹窗标题
|
|
|
|
-const title = ref('')
|
|
|
|
-const getAddDialog = () => {
|
|
|
|
- dialogVisible.value = true
|
|
|
|
- title.value = '新增'
|
|
|
|
-}
|
|
|
|
-// 打开弹窗
|
|
|
|
-function getDialog(row) {
|
|
|
|
- if (row.auditStatus === 2) {
|
|
|
|
- if (checkPermi(['scene:presets:editScene'])) {
|
|
|
|
- dialogVisible.value = true
|
|
|
|
- getDetail(row.takeId)
|
|
|
|
- }
|
|
|
|
|
|
+// 场景详情
|
|
|
|
+const getDetail = (query) => {
|
|
|
|
+ if (checkPermi(['scene:presets:editScene'])) {
|
|
|
|
+ getRouter('/scene/presets/sceneDetail', query)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-// 详情
|
|
|
|
-function getDetail(id) {
|
|
|
|
- title.value = '编辑'
|
|
|
|
- detail({ id: id }).then(res => {
|
|
|
|
- if (res.code === 0) {
|
|
|
|
- data.dialogForm = res.data
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-// 上传音频
|
|
|
|
-function upload(file) {
|
|
|
|
- data.dialogForm.list = file
|
|
|
|
-}
|
|
|
|
-// 提交
|
|
|
|
-function getSubmit() {
|
|
|
|
- proxy.$refs.dialogForm.validate((valid) => {
|
|
|
|
- if (valid) {
|
|
|
|
- submit(data.dialogForm).then(res => {
|
|
|
|
- if (res.code === 0) {
|
|
|
|
- proxy.$modal.msgSuccess('提交成功!')
|
|
|
|
- getClose()
|
|
|
|
- getList()
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-// 取消
|
|
|
|
-function getClose() {
|
|
|
|
- dialogVisible.value = false
|
|
|
|
- data.dialogForm = {}
|
|
|
|
- proxy.$refs.dialogForm.resetFields()
|
|
|
|
- if (title.value === '新增') {
|
|
|
|
- proxy.$refs.customUpload.onRefresh()
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-// 删除
|
|
|
|
|
|
+
|
|
|
|
+// 删除场景
|
|
function getDelete(row) {
|
|
function getDelete(row) {
|
|
proxy.$modal.confirm(`是否删除${row.takeName}`).then(() => {
|
|
proxy.$modal.confirm(`是否删除${row.takeName}`).then(() => {
|
|
remove(row.takeId).then(res => {
|
|
remove(row.takeId).then(res => {
|
|
@@ -193,9 +118,9 @@ function getDelete(row) {
|
|
}
|
|
}
|
|
|
|
|
|
// 新增预设
|
|
// 新增预设
|
|
-function getRouter(query) {
|
|
|
|
|
|
+function getRouter(path, query) {
|
|
proxy.$router.push({
|
|
proxy.$router.push({
|
|
- path: `/scene/presets/detail`,
|
|
|
|
|
|
+ path: path,
|
|
query
|
|
query
|
|
})
|
|
})
|
|
}
|
|
}
|