|
@@ -1,37 +1,54 @@
|
|
<template>
|
|
<template>
|
|
|
|
+ <el-form class="search" inline>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-select v-model="organizationIds" placeholder="请选择企业" style="width: 200px" filterable remote
|
|
|
|
+ :remote-method="businessRemote" remote-show-suffix>
|
|
|
|
+ <el-option v-for="item in businessData.options" :key="item.id" :value="item.id" :label="item.name" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-select v-model="storeId" placeholder="请选择门店" style="width: 200px" filterable remote
|
|
|
|
+ :remote-method="storeRemote" remote-show-suffix>
|
|
|
|
+ <el-option v-for="item in storeData.options" :key="item.id" :value="item.id" :label="item.name" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item style="float:right">
|
|
|
|
+ <el-button type="primary" icon="Plus" @click="getDetail()">新增预设</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
<div class="timer">
|
|
<div class="timer">
|
|
- <div class="item" v-for="item in data.timeList" :key="item">
|
|
|
|
|
|
+ <div class="item" v-for="(item, index) in data.timeList" :key="item">
|
|
<div class="value">
|
|
<div class="value">
|
|
- <span>{{ parseTime(item.timer, '{h}:{i}') }}</span>
|
|
|
|
|
|
+ <span>{{ item.time[0].slice(0, 5) }}</span>
|
|
<span class="solid"></span>
|
|
<span class="solid"></span>
|
|
</div>
|
|
</div>
|
|
- <draggable class="label_box" v-model="item.list" group="componentGroup" :item-key="item.value" :move="onMove"
|
|
|
|
- @end="onEnd">
|
|
|
|
|
|
+ <draggable class="label_box" v-model="item.list" group="componentGroup" :item-key="index.toString()"
|
|
|
|
+ :move="onMove" @end="onEnd">
|
|
<template #item="{ element, index }">
|
|
<template #item="{ element, index }">
|
|
<div @mousedown.stop style="width: 100%">
|
|
<div @mousedown.stop style="width: 100%">
|
|
<el-popover placement="bottom" trigger="click" width="300px" popper-class="popper"
|
|
<el-popover placement="bottom" trigger="click" width="300px" popper-class="popper"
|
|
:popper-style="popperStyle" :hide-after="0">
|
|
:popper-style="popperStyle" :hide-after="0">
|
|
<div class="title">
|
|
<div class="title">
|
|
- <h2>双12活动内容</h2>
|
|
|
|
|
|
+ <h2>{{ element.takeName }}</h2>
|
|
<div style="display:flex; justify-content: space-between;">
|
|
<div style="display:flex; justify-content: space-between;">
|
|
- <span>1月23日22:00 - 23:00</span>
|
|
|
|
|
|
+ <span>{{ element.listDate.startTime }} - {{ element.listDate.endTime }}</span>
|
|
<div style="display:flex; align-items: center">
|
|
<div style="display:flex; align-items: center">
|
|
<el-icon style="margin-right: 10px" @click="getDetail(element)">
|
|
<el-icon style="margin-right: 10px" @click="getDetail(element)">
|
|
<Edit />
|
|
<Edit />
|
|
</el-icon>
|
|
</el-icon>
|
|
- <el-icon>
|
|
|
|
|
|
+ <el-icon @click="getDelete(element)">
|
|
<Delete />
|
|
<Delete />
|
|
</el-icon>
|
|
</el-icon>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="main">
|
|
<div class="main">
|
|
- <span>当前门店:瑞幸中国</span>
|
|
|
|
- <span>当前设备:猫2</span>
|
|
|
|
- <span>当前状态:上架</span>
|
|
|
|
|
|
+ <span>当前门店:{{ storeData.options.find(i => i.id === element.storeId).name }}</span>
|
|
|
|
+ <span>当前设备:{{ element.deviceIds }}</span>
|
|
|
|
+ <span>当前状态:{{ proxy.selectDictLabel(sys_change_status, element.status) }}</span>
|
|
</div>
|
|
</div>
|
|
<template #reference>
|
|
<template #reference>
|
|
- <span class="label">{{ element.label }}</span>
|
|
|
|
|
|
+ <span class="label">{{ element.takeName }}</span>
|
|
</template>
|
|
</template>
|
|
</el-popover>
|
|
</el-popover>
|
|
</div>
|
|
</div>
|
|
@@ -42,44 +59,64 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
|
+import { timeList, removeScene } from '@/api/content/scene'
|
|
|
|
+import { useBusinessSelect, useStoreSelect } from '@/hooks/index'
|
|
|
|
+
|
|
|
|
+const { storeData, getStore, storeRemote } = useStoreSelect()
|
|
|
|
+const { businessData, getBusiness, businessRemote } = useBusinessSelect(true)
|
|
|
|
+getBusiness()
|
|
|
|
+
|
|
const { proxy } = getCurrentInstance();
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
+const { sys_change_status } = proxy.useDict("sys_change_status");
|
|
|
|
+
|
|
|
|
+const props = defineProps({
|
|
|
|
+ path: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: null
|
|
|
|
+ }
|
|
|
|
+})
|
|
|
|
|
|
const data = reactive({
|
|
const data = reactive({
|
|
timeList: [
|
|
timeList: [
|
|
- { value: '0', list: [{ value: 1, label: '双十一' }] },
|
|
|
|
- { value: '1', list: [] },
|
|
|
|
- { value: '2', list: [] },
|
|
|
|
- { value: '3', list: [] },
|
|
|
|
- { value: '4', list: [] },
|
|
|
|
- { value: '5', list: [] },
|
|
|
|
- { value: '6', list: [] },
|
|
|
|
- { value: '7', list: [] },
|
|
|
|
- { value: '8', list: [] },
|
|
|
|
- { value: '9', list: [] },
|
|
|
|
- { value: '10', list: [] },
|
|
|
|
- { value: '11', list: [] },
|
|
|
|
- { value: '12', list: [] },
|
|
|
|
- { value: '13', list: [] },
|
|
|
|
- { value: '14', list: [] },
|
|
|
|
- { value: '15', list: [] },
|
|
|
|
- { value: '16', list: [] },
|
|
|
|
- { value: '17', list: [] },
|
|
|
|
- { value: '18', list: [] },
|
|
|
|
- { value: '19', list: [] },
|
|
|
|
- { value: '20', list: [] },
|
|
|
|
- { value: '21', list: [] },
|
|
|
|
- { value: '22', list: [] },
|
|
|
|
- { value: '23', list: [] },
|
|
|
|
- { value: '24', list: [] }
|
|
|
|
- ]
|
|
|
|
|
|
+ { time: ['00:00:00', '01:00:00'], list: [] },
|
|
|
|
+ { time: ['01:00:00', '02:00:00'], list: [] },
|
|
|
|
+ { time: ['02:00:00', '03:00:00'], list: [] },
|
|
|
|
+ { time: ['03:00:00', '04:00:00'], list: [] },
|
|
|
|
+ { time: ['04:00:00', '05:00:00'], list: [] },
|
|
|
|
+ { time: ['05:00:00', '06:00:00'], list: [] },
|
|
|
|
+ { time: ['06:00:00', '07:00:00'], list: [] },
|
|
|
|
+ { time: ['07:00:00', '08:00:00'], list: [] },
|
|
|
|
+ { time: ['08:00:00', '09:00:00'], list: [] },
|
|
|
|
+ { time: ['09:00:00', '10:00:00'], list: [] },
|
|
|
|
+ { time: ['10:00:00', '11:00:00'], list: [] },
|
|
|
|
+ { time: ['11:00:00', '12:00:00'], list: [] },
|
|
|
|
+ { time: ['12:00:00', '13:00:00'], list: [] },
|
|
|
|
+ { time: ['13:00:00', '14:00:00'], list: [] },
|
|
|
|
+ { time: ['14:00:00', '15:00:00'], list: [] },
|
|
|
|
+ { time: ['15:00:00', '16:00:00'], list: [] },
|
|
|
|
+ { time: ['16:00:00', '17:00:00'], list: [] },
|
|
|
|
+ { time: ['17:00:00', '18:00:00'], list: [] },
|
|
|
|
+ { time: ['18:00:00', '19:00:00'], list: [] },
|
|
|
|
+ { time: ['19:00:00', '20:00:00'], list: [] },
|
|
|
|
+ { time: ['20:00:00', '21:00:00'], list: [] },
|
|
|
|
+ { time: ['21:00:00', '22:00:00'], list: [] },
|
|
|
|
+ { time: ['22:00:00', '23:00:00'], list: [] },
|
|
|
|
+ { time: ['23:00:00', '00:00:00'], list: [] },
|
|
|
|
+ { time: ['00:00:00', '01:00:00'], list: [] }
|
|
|
|
+ ],
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+// 时间轴表单
|
|
|
|
+const organizationIds = ref(null)
|
|
|
|
+const storeId = ref(null)
|
|
|
|
+
|
|
// 时间段
|
|
// 时间段
|
|
function getTime() {
|
|
function getTime() {
|
|
- data.timeList.map(i => {
|
|
|
|
- // i.list = []
|
|
|
|
- i.timer = new Date(new Date(new Date().toLocaleDateString()).getTime() + i.value * 3600000).getTime()
|
|
|
|
- })
|
|
|
|
|
|
+ for (let i = 0; i <= data.timeList.length - 1; i++) {
|
|
|
|
+ data.timeList[i].timer = []
|
|
|
|
+ data.timeList[i].timer[0] = proxy.hoursToSeconds(data.timeList[i].time[0])
|
|
|
|
+ data.timeList[i].timer[1] = proxy.hoursToSeconds(data.timeList[i].time[1])
|
|
|
|
+ }
|
|
}
|
|
}
|
|
getTime()
|
|
getTime()
|
|
|
|
|
|
@@ -88,6 +125,30 @@ const popperStyle = ref({
|
|
borderRadius: '10px'
|
|
borderRadius: '10px'
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+// 时间轴
|
|
|
|
+function getTimeList() {
|
|
|
|
+ timeList({ storeId: storeId.value }).then(res => {
|
|
|
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
|
|
+ for (let j = 0; j < res.data[i].listDate.length; j++) {
|
|
|
|
+ let start = proxy.hoursToSeconds(res.data[i].listDate[j].startTime)
|
|
|
|
+ let end = proxy.hoursToSeconds(res.data[i].listDate[j].endTime)
|
|
|
|
+ const index1 = data.timeList.findIndex(e => {
|
|
|
|
+ let st = e.timer[0]
|
|
|
|
+ let en = e.timer[1]
|
|
|
|
+ return st <= start && start <= en || st <= end && end <= en
|
|
|
|
+ })
|
|
|
|
+ data.timeList[index1].list.push({ ...res.data[i], listDate: res.data[i].listDate[j] })
|
|
|
|
+ const index2 = data.timeList.findIndex(e => {
|
|
|
|
+ let st = e.timer[0]
|
|
|
|
+ let en = e.timer[1]
|
|
|
|
+ return st >= start && en <= end || st >= end && en <= start
|
|
|
|
+ })
|
|
|
|
+ data.timeList[index2].list.push({ ...res.data[i], listDate: res.data[i].listDate[j] })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
// 拖拽内容
|
|
// 拖拽内容
|
|
function onMove(params) {
|
|
function onMove(params) {
|
|
if (params.to.childElementCount < 1) {
|
|
if (params.to.childElementCount < 1) {
|
|
@@ -111,10 +172,43 @@ function onEnd(params) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// 新增
|
|
|
|
|
|
+// 删除
|
|
|
|
+const getDelete = (row) => {
|
|
|
|
+ proxy.$modal.confirm(`是否删除预设名称为:${row.takeName}的数据?`).then(() => {
|
|
|
|
+ removeScene({ id: row.id }).then(res => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ proxy.$modal.msgSuccess('删除成功!')
|
|
|
|
+ getTimeList()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }).catch(() => { })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+watch(() => businessData.options, (val) => {
|
|
|
|
+ if (val) {
|
|
|
|
+ organizationIds.value = val[0].id
|
|
|
|
+ }
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+watch(organizationIds, (val) => {
|
|
|
|
+ if (val) {
|
|
|
|
+ storeData.form.tenantId = val
|
|
|
|
+ getStore()
|
|
|
|
+ }
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+watch(() => storeData.storeId, (val) => {
|
|
|
|
+ data.timeList.map(i => i.list = [])
|
|
|
|
+ storeId.value = val
|
|
|
|
+ if (val) {
|
|
|
|
+ getTimeList()
|
|
|
|
+ }
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+// 新增预设
|
|
function getDetail(query) {
|
|
function getDetail(query) {
|
|
proxy.$router.push({
|
|
proxy.$router.push({
|
|
- path: `/content/setting/detail`,
|
|
|
|
|
|
+ path: props.path,
|
|
query
|
|
query
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -126,6 +220,8 @@ function getDetail(query) {
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
width: calc(100% - 50px);
|
|
width: calc(100% - 50px);
|
|
margin-left: 50px;
|
|
margin-left: 50px;
|
|
|
|
+ overflow-y: auto;
|
|
|
|
+ padding: 20px 20px 20px 50px;
|
|
|
|
|
|
.item {
|
|
.item {
|
|
width: 100%;
|
|
width: 100%;
|
|
@@ -137,6 +233,7 @@ function getDetail(query) {
|
|
align-items: center;
|
|
align-items: center;
|
|
|
|
|
|
.value {
|
|
.value {
|
|
|
|
+ width: 100px;
|
|
margin-left: -50px;
|
|
margin-left: -50px;
|
|
|
|
|
|
.solid {
|
|
.solid {
|
|
@@ -193,4 +290,8 @@ function getDetail(query) {
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+.search {
|
|
|
|
+ padding-left: 70px;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|