Commit bf508e9b authored by “yiyousong”'s avatar “yiyousong”

perf: 优化站点详情

parent 245633dc
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
>同步数据</a-button >同步数据</a-button
> >
<a-button <a-button
type="primary"
v-permission="[1]" v-permission="[1]"
type="primary"
@click="editSiteInfo(siteData[0])" @click="editSiteInfo(siteData[0])"
>编辑</a-button >编辑</a-button
> >
<a-button <a-button
type="danger"
v-permission="[1]" v-permission="[1]"
type="danger"
@click="deleteSite(siteData[0].id, 0)" @click="deleteSite(siteData[0].id, 0)"
>删除</a-button >删除</a-button
> >
...@@ -160,27 +160,14 @@ ...@@ -160,27 +160,14 @@
<a-row> <a-row>
<a-col :span="16"> <a-col :span="16">
<span>工作日:</span> <span>工作日:</span>
<span class="work-day" v-if="item.workday1 === 1" <template v-for="(day, i) in workday">
>星期一</span <span
> :key="day"
<span class="work-day" v-if="item.workday2 === 1" class="work-day"
>星期二</span v-if="item[`workday${i + 1}`]"
> >{{ day }}</span
<span class="work-day" v-if="item.workday3 === 1" >
>星期三</span </template>
>
<span class="work-day" v-if="item.workday4 === 1"
>星期四</span
>
<span class="work-day" v-if="item.workday5 === 1"
>星期五</span
>
<span class="work-day" v-if="item.workday6 === 1"
>星期六</span
>
<span class="work-day" v-if="item.workday7 === 1"
>星期天</span
>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
...@@ -267,6 +254,15 @@ import { ...@@ -267,6 +254,15 @@ import {
getSiteList, getSiteList,
SyncSiteData, SyncSiteData,
} from "@/services/basicsetFun"; } from "@/services/basicsetFun";
const workday = [
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六",
"星期日",
];
export default { export default {
components: { components: {
sitetree, sitetree,
...@@ -277,6 +273,7 @@ export default { ...@@ -277,6 +273,7 @@ export default {
data() { data() {
return { return {
workday,
loading: false, loading: false,
title: "新增站点", title: "新增站点",
formVisible: false, formVisible: false,
...@@ -310,7 +307,7 @@ export default { ...@@ -310,7 +307,7 @@ export default {
if (res.data.code === 1) { if (res.data.code === 1) {
let { data, dict } = res.data.data; let { data, dict } = res.data.data;
data.forEach((v) => { data.forEach((v) => {
v.modelIds = v.modelIds.split(","); v.modelIds = v.modelIds && v.modelIds.split(",");
v.modelData = Object.keys(dict.modelIds) v.modelData = Object.keys(dict.modelIds)
.reduce( .reduce(
(pre, cur) => ( (pre, cur) => (
...@@ -329,10 +326,9 @@ export default { ...@@ -329,10 +326,9 @@ export default {
async getSiteInfo() { async getSiteInfo() {
this.loading = true; this.loading = true;
let res = await siteInfo({ id: this.siteId }); let res = await siteInfo({ id: this.siteId });
this.loading = false;
if (res.data.code === 1) { if (res.data.code === 1) {
let { data, dict } = res.data; let { data, dict } = res.data;
data.modelIds = data.modelIds.split(","); data.modelIds = data.modelIds && data.modelIds.split(",");
data.modelData = Object.keys(dict.modelIds) data.modelData = Object.keys(dict.modelIds)
.reduce( .reduce(
(pre, cur) => ( (pre, cur) => (
...@@ -345,6 +341,7 @@ export default { ...@@ -345,6 +341,7 @@ export default {
}); });
this.siteData = [data]; this.siteData = [data];
} }
this.loading = false;
}, },
// 删除 // 删除
...@@ -378,18 +375,18 @@ export default { ...@@ -378,18 +375,18 @@ export default {
}, },
//查看全部 //查看全部
cookAll(text) { cookAll(text) {
this.allShow = true;
this.details = text; this.details = text;
this.allShow = true;
}, },
//新增站点 //新增站点
addSiteAll() { addSiteAll() {
if (this.areaID) { if (!this.areaID) {
this.title = "新增站点";
this.formVisible = true;
this.$refs.addsite.onAdd();
} else {
this.$message.warning("请先选择区域"); this.$message.warning("请先选择区域");
return;
} }
this.title = "新增站点";
this.formVisible = true;
this.$refs.addsite.onAdd();
}, },
// 切换站点 // 切换站点
changePage(num) { changePage(num) {
...@@ -399,10 +396,11 @@ export default { ...@@ -399,10 +396,11 @@ export default {
this.formVisible = false; this.formVisible = false;
}, },
// 编辑 // 编辑
editSiteInfo(data) { editSiteInfo(row) {
this.title = "编辑站点"; this.title = "编辑站点";
this.formVisible = true; let data = this.$_.cloneDeep(row);
this.$refs.addsite.onEdit(data); this.$refs.addsite.onEdit(data);
this.formVisible = true;
}, },
// 同步数据 // 同步数据
handleSync(id) { handleSync(id) {
...@@ -564,18 +562,22 @@ export default { ...@@ -564,18 +562,22 @@ export default {
.item_box { .item_box {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 10px;
.item { .item {
width: 140px; width: 140px;
height: 54px; height: 54px;
margin-right: 10px;
margin-bottom: 10px;
padding: 6px; padding: 6px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: #38b6ff; background-color: #38b6ff;
text-align: center;
color: #fff; color: #fff;
border-radius: 5px; border-radius: 5px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment