|
@@ -2,8 +2,8 @@
|
|
|
<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 in data.form.audioList" :key="item.id">
|
|
|
- <el-tag v-show="item.type === 0 || item.type === 1" size="large" closable @close="handleClose(item)">
|
|
|
+ <div class="audioList" v-for="(item, index) in data.form.audioList" :key="item.id">
|
|
|
+ <el-tag v-show="item.type === 0 || item.type === 1" size="large" closable @close="handleClose(index)">
|
|
|
{{ item.audioName }}
|
|
|
</el-tag>
|
|
|
<div v-show="item.type === 2" class="audio">
|
|
@@ -27,14 +27,14 @@
|
|
|
@click="handlePushDate" />
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="所属门店:" style="width: 900px">
|
|
|
+ <el-form-item label="关联设备:" style="width: 900px" prop="tpresetContentInfoReq">
|
|
|
<el-table :data="data.form.tpresetContentInfoReq">
|
|
|
<el-table-column label="所属企业" align="center">
|
|
|
<template #default="scope">
|
|
|
<el-form-item :prop="`tpresetContentInfoReq.${scope.$index}.tenantId`"
|
|
|
:rules="{ required: true, trigger: 'change' }">
|
|
|
<el-select v-model="scope.row.tenantId" placeholder="请选择企业" style="width: 200px" filterable remote
|
|
|
- :remote-method="businessRemote" remote-show-suffix @change="handleChange">
|
|
|
+ :remote-method="businessRemote" remote-show-suffix @change="handleChangeTenant">
|
|
|
<el-option v-for="item in businessData.options" :key="item.id" :value="item.id" :label="item.name" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -62,6 +62,11 @@
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button type="danger" link @click="getDelete(scope.$index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</el-form-item>
|
|
|
<el-form-item style="width: 800px">
|
|
@@ -175,10 +180,45 @@ const data = reactive({
|
|
|
}],
|
|
|
listDate: [{
|
|
|
required: true, message: '请选择播放时间', trigger: 'change'
|
|
|
+ }],
|
|
|
+ tpresetContentInfoReq: [{
|
|
|
+ required: true, message: '请新增关联', trigger: 'change'
|
|
|
}]
|
|
|
},
|
|
|
})
|
|
|
|
|
|
+// 传参
|
|
|
+const getAudioList = () => {
|
|
|
+ if (proxy.$route.query.audioList) {
|
|
|
+ let e = JSON.parse(proxy.$route.query.audioList)
|
|
|
+ data.form.audioList.push({
|
|
|
+ audioId: e.id,
|
|
|
+ audioName: e.name,
|
|
|
+ audioType: e.audioType,
|
|
|
+ categoryId: e.sceneId,
|
|
|
+ type: e.type
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+getAudioList()
|
|
|
+
|
|
|
+// 详情
|
|
|
+const getDetail = () => {
|
|
|
+ let e = proxy.$route.query
|
|
|
+ if (e.id) {
|
|
|
+ detail({ id: e.id, storeId: e.storeId }).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ data.form = res.data
|
|
|
+ data.dateList = []
|
|
|
+ res.data.listDate.map(i => {
|
|
|
+ data.dateList.push([i.startTime, i.endTime])
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+getDetail()
|
|
|
+
|
|
|
// 弹窗
|
|
|
const dialogVisible = ref(false)
|
|
|
// 打开弹窗
|
|
@@ -192,9 +232,9 @@ function getDialog() {
|
|
|
proxy.$refs.table.clearSelection()
|
|
|
if (val && data.form.audioList.length > 0) {
|
|
|
data.form.audioList.map(i => {
|
|
|
- let row = val.find(j => j.id === i.id)
|
|
|
+ let row = val.find(j => j.id === i.audioId)
|
|
|
if (row) {
|
|
|
- proxy.$refs.table.toggleRowSelection(row)
|
|
|
+ proxy.$refs.table.toggleRowSelection(row, true)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -203,22 +243,74 @@ function getDialog() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-// 详情
|
|
|
-const getDetail = () => {
|
|
|
- let e = proxy.$route.query
|
|
|
- if (e.id) {
|
|
|
- detail({ id: e.id, storeId: e.storeId }).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- data.form = res.data
|
|
|
- data.dateList = []
|
|
|
- res.data.listDate.map(i => {
|
|
|
- data.dateList.push([i.startTime, i.endTime])
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+// 搜索
|
|
|
+const getSearch = () => {
|
|
|
+ audioData.form.pageNum = 1
|
|
|
+ getAudio()
|
|
|
+}
|
|
|
+
|
|
|
+// 重置
|
|
|
+const getRefresh = () => {
|
|
|
+ audioData.form = {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ type: 0
|
|
|
}
|
|
|
+ getAudio()
|
|
|
+}
|
|
|
+
|
|
|
+// 返回id
|
|
|
+const rowKey = (e) => {
|
|
|
+ return e.id
|
|
|
+}
|
|
|
+
|
|
|
+// 多选
|
|
|
+const handleSelectionChange = (e) => {
|
|
|
+ data.selectionList = []
|
|
|
+ e.map(i => {
|
|
|
+ if (data.selectionList.findIndex(j => j.id === i.id) === -1) {
|
|
|
+ data.selectionList.push({
|
|
|
+ audioId: i.id,
|
|
|
+ audioName: i.name,
|
|
|
+ audioType: i.audioType,
|
|
|
+ categoryId: i.sceneId,
|
|
|
+ type: i.type
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 单选
|
|
|
+const handleChooseAudio = (e) => {
|
|
|
+ data.form.audioList = []
|
|
|
+ data.form.audioList.push({
|
|
|
+ audioId: e.id,
|
|
|
+ audioName: e.name,
|
|
|
+ audioType: i.audioType,
|
|
|
+ categoryId: i.sceneId,
|
|
|
+ type: i.type
|
|
|
+ })
|
|
|
+ proxy.$modal.msgSuccess('选择成功!')
|
|
|
+ dialogVisible.value = false
|
|
|
+}
|
|
|
+
|
|
|
+// 确定
|
|
|
+const getPush = () => {
|
|
|
+ data.form.audioList = []
|
|
|
+ data.form.audioList = JSON.parse(JSON.stringify(data.selectionList))
|
|
|
+ proxy.$modal.msgSuccess('选择成功!')
|
|
|
+ dialogVisible.value = false
|
|
|
+}
|
|
|
+
|
|
|
+// 删除音频
|
|
|
+const handleClose = (index) => {
|
|
|
+ data.form.audioList.splice(index, 1)
|
|
|
+}
|
|
|
+
|
|
|
+// 删除所属门店
|
|
|
+const getDelete = (index) => {
|
|
|
+ data.form.tpresetContentInfoReq.splice(index, 1)
|
|
|
}
|
|
|
-getDetail()
|
|
|
|
|
|
// 增加时间
|
|
|
function handlePushDate() {
|
|
@@ -268,7 +360,8 @@ const getAdd = () => {
|
|
|
data.form.tpresetContentInfoReq.push({})
|
|
|
}
|
|
|
|
|
|
-const handleChange = (e) => {
|
|
|
+// 所属企业
|
|
|
+const handleChangeTenant = (e) => {
|
|
|
storeData.form.tenantId = e
|
|
|
getStore()
|
|
|
}
|
|
@@ -278,6 +371,7 @@ const getClose = () => {
|
|
|
proxy.$tab.closeOpenPage('/content/setting')
|
|
|
}
|
|
|
|
|
|
+// 提交
|
|
|
const getSubmit = () => {
|
|
|
proxy.$refs.form.validate(valid => {
|
|
|
if (valid) {
|
|
@@ -293,70 +387,6 @@ const getSubmit = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-// 搜索
|
|
|
-const getSearch = () => {
|
|
|
- audioData.form.pageNum = 1
|
|
|
- getAudio()
|
|
|
-}
|
|
|
-
|
|
|
-// 重置
|
|
|
-const getRefresh = () => {
|
|
|
- audioData.form = {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- type: 0
|
|
|
- }
|
|
|
- getAudio()
|
|
|
-}
|
|
|
-
|
|
|
-// 返回id
|
|
|
-const rowKey = (e) => {
|
|
|
- return e.id
|
|
|
-}
|
|
|
-
|
|
|
-// 多选
|
|
|
-const handleSelectionChange = (e) => {
|
|
|
- data.selectionList = []
|
|
|
- e.map(i => {
|
|
|
- if (data.selectionList.findIndex(j => j.id === i.id) === -1) {
|
|
|
- data.selectionList.push({
|
|
|
- audioId: i.id,
|
|
|
- audioName: i.name,
|
|
|
- audioType: i.audioType,
|
|
|
- categoryId: i.sceneId,
|
|
|
- type: i.type
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-// 单选
|
|
|
-const handleChooseAudio = (e) => {
|
|
|
- data.form.audioList = []
|
|
|
- data.form.audioList.push({
|
|
|
- audioId: e.id,
|
|
|
- audioName: e.name,
|
|
|
- audioType: i.audioType,
|
|
|
- categoryId: i.sceneId,
|
|
|
- type: i.type
|
|
|
- })
|
|
|
- proxy.$modal.msgSuccess('选择成功!')
|
|
|
- dialogVisible.value = false
|
|
|
-}
|
|
|
-
|
|
|
-// 删除
|
|
|
-const handleClose = (e) => {
|
|
|
- console.log(e);
|
|
|
-}
|
|
|
-
|
|
|
-// 确定
|
|
|
-const getPush = () => {
|
|
|
- data.form.audioList = []
|
|
|
- data.form.audioList = JSON.parse(JSON.stringify(data.selectionList))
|
|
|
- proxy.$modal.msgSuccess('选择成功!')
|
|
|
- dialogVisible.value = false
|
|
|
-}
|
|
|
-
|
|
|
// 字典
|
|
|
const statusFormatter = (row) => {
|
|
|
return proxy.selectDictLabel(sys_change_status.value, row.status)
|