You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
333 lines
13 KiB
333 lines
13 KiB
2 weeks ago
|
<template>
|
||
|
<div class="elementWrap">
|
||
|
<div>
|
||
|
<div class="pageheader">
|
||
|
<div class="pageheader-left">
|
||
|
<span class="pagetitle">站点列表</span>
|
||
|
<GuipButton type="ignore"><svg-icon :size="16" :path="require('@/assets/site/addIcon.svg')" :color="'#8A9099'" :hoverColor="'#006AFF'" />按钮</GuipButton>
|
||
|
<el-form>
|
||
|
<GuipSelect v-model="currentGroup" :options="siteGroups" defaultValue="选项1" placeholder="请选择分组" labelKey="name" valueKey="id" style="margin-bottom: 0px;" />
|
||
|
</el-form>
|
||
|
</div>
|
||
|
<GuipButton size="table" :href="addNewSiteUrl">新增站点</GuipButton>
|
||
|
</div>
|
||
|
<el-form>
|
||
|
<GuipTable
|
||
|
:tableData="filteredSites"
|
||
|
ref="multipleTable"
|
||
|
@selectChange="handleSelectionChange"
|
||
|
autoColumn="true"
|
||
|
:loading="tableLoading">
|
||
|
|
||
|
<el-table-column prop="short_name" label="站点简称">
|
||
|
<template slot-scope="scope">
|
||
|
<div class="flex cell_render">
|
||
|
<el-link :href="scope.row.domain" target="_blank" class="black">{{ scope.row.short_name }}</el-link>
|
||
|
<svg-icon :size="16" :path="require('@/assets/site/form_link.svg')" :color="'#8A9099'" :hoverColor="'#006AFF'" />
|
||
|
</div>
|
||
|
</template>
|
||
|
</el-table-column>
|
||
|
<el-table-column prop="regtime" label="注册时间"></el-table-column>
|
||
|
<el-table-column prop="group" label="站点分组">
|
||
|
<template #default="{ row,$index }">
|
||
|
<el-popover v-model="row.showPopover" :ref="`groupPopover-${row.uid}`"
|
||
|
placement="top"
|
||
|
trigger="manual" :append-to-body="false" :visible-arrow="true"
|
||
|
popper-class="custom-popover">
|
||
|
|
||
|
<div class="group_select">
|
||
|
<GuipSelect v-model="selected_group" :options="siteGroups" defaultValue="站点分组" labelKey="name" valueKey="id" placeholder="请选择分组" @change="addSiteGroup(row)" />
|
||
|
</div>
|
||
|
<template #reference>
|
||
|
<div class="flex cell_render" @click="showGroupSetting(row, $index)">
|
||
|
<span v-if="row.group">{{ row.group }}</span>
|
||
|
<span class="gray" v-else>未分组</span>
|
||
|
<svg-icon :size="16" :path="currentIcon" :color="'#8A9099'" :hoverColor="'#006AFF'" @click="toggleIcon" />
|
||
|
</div>
|
||
|
</template>
|
||
|
</el-popover>
|
||
|
</template>
|
||
|
</el-table-column>
|
||
|
<el-table-column prop="phone_services" label="手机服务">
|
||
|
<template slot="header">
|
||
|
<div class="flex cell_render" @click="visible = !visible">
|
||
|
<span>手机服务</span>
|
||
|
<img class="ml-4" src="@/assets/site/filter.svg" />
|
||
|
</div>
|
||
|
<el-select v-model="value" placeholder="请选择">
|
||
|
<el-option
|
||
|
v-for="item in options"
|
||
|
:key="item.value"
|
||
|
:label="item.label"
|
||
|
:value="item.value">
|
||
|
</el-option>
|
||
|
</el-select>
|
||
|
</template>
|
||
|
<template slot-scope="scope">
|
||
|
<span v-if="scope.row.phone_services">{{ scope.row.phone_services }}</span>
|
||
|
<span class="gray" v-else>一</span>
|
||
|
</template>
|
||
|
</el-table-column>
|
||
|
<el-table-column prop="config_progress_status_desc" label="状态">
|
||
|
<template slot-scope="scope">
|
||
|
<div class="flex cell_render">
|
||
|
<span class="green" v-if="scope.row.config_progress_status == 5">{{ scope.row.config_progress_status_desc }}</span>
|
||
|
<div class="flex cell_render" v-else>
|
||
|
<span class="red">{{ scope.row.config_progress_status_desc }}</span>
|
||
|
<svg-icon :size="16" :path="require('@/assets/site/more.svg')" :color="'#8A9099'" :hoverColor="'#006AFF'" @click="toggleIcon" />
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
</el-table-column>
|
||
|
<el-table-column label="操作" fixed="right">
|
||
|
<el-link type="primary" :href="serviceListUrl" target="_blank" class="mr-16">服务列表</el-link>
|
||
|
<el-link type="primary" :href="siteSettingUrl" target="_blank">站点设置</el-link>
|
||
|
</el-table-column>
|
||
|
</GuipTable>
|
||
|
</el-form>
|
||
|
</div>
|
||
|
<Footer></Footer>
|
||
|
</div>
|
||
|
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
|
||
|
import GuipTable from '@/components/GuipTable.vue';
|
||
|
import Footer from '@/components/Footer.vue';
|
||
|
// import GuipToolTip from '@/components/GuipToolTip.vue'
|
||
|
import SvgIcon from '@/components/SvgIcon.vue';
|
||
|
import GuipSelect from '@/components/GuipSelect.vue';
|
||
|
// import HoverButton from '@/components/HoverButton.vue'
|
||
|
import GuipButton from '@/components/GuipButton.vue';
|
||
|
// import GuipInput from '@/components/GuipInput.vue';
|
||
|
|
||
|
// import { mapState } from 'vuex'
|
||
|
// import store from '@/store';
|
||
|
|
||
|
export default {
|
||
|
name: 'siteList',
|
||
|
components: {
|
||
|
Footer,
|
||
|
GuipTable,
|
||
|
// GuipToolTip,
|
||
|
SvgIcon,
|
||
|
GuipSelect,
|
||
|
// HoverButton,
|
||
|
GuipButton,
|
||
|
// GuipInput,
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
tableLoading: true,
|
||
|
siteList: [],
|
||
|
siteGroups: [],
|
||
|
gid: 0,
|
||
|
serviceListUrl: '/ui',
|
||
|
siteSettingUrl: '/ui',
|
||
|
addNewSiteUrl: '/ui',
|
||
|
popoverFlag:false,
|
||
|
value: '',
|
||
|
selected_group: '',
|
||
|
isUpIco: false,
|
||
|
currentIcon: require('@/assets/site/drop_icon.svg'),
|
||
|
visible: false,
|
||
|
currentGroup: '',
|
||
|
}
|
||
|
},
|
||
|
mounted() {
|
||
|
this.getSiteList()
|
||
|
this.getSiteGroups()
|
||
|
},
|
||
|
methods: {
|
||
|
init() {
|
||
|
this.gid = this.$route.query.gid
|
||
|
this.getSiteList()
|
||
|
//this.getSiteGroups()
|
||
|
},
|
||
|
getSiteList() {
|
||
|
this.tableLoading = true
|
||
|
const that = this
|
||
|
that.siteList = []
|
||
|
this.$http('POST', '/agentnew/ajax_get_site_list', {
|
||
|
gid: this.gid,
|
||
|
},{
|
||
|
headers:{
|
||
|
'Auth': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NTAwNTM3MjQsIm5iZiI6MTc1MDA1MzcyNCwiZXhwIjoxNzUyNjQ1NzI0LCJ1c2VyIjoic3VidXNlciIsImxvZ2luX3R5cGUiOjAsImFpZCI6IjEifQ.xyIqBLelB-k6jCifgRevBJTyg_Qrm6m1e4OcHhOpepU'
|
||
|
}
|
||
|
}).then(response => {
|
||
|
this.tableLoading = false
|
||
|
this.$nextTick(() => {
|
||
|
that.siteList = response.data.sitelist
|
||
|
console.log(that.siteList,'---that.siteList');
|
||
|
})
|
||
|
}).catch(error => {
|
||
|
console.error(error, 'error')
|
||
|
})
|
||
|
},
|
||
|
getSiteGroups() {
|
||
|
const that = this
|
||
|
that.siteGroups = []
|
||
|
this.$http('POST', '/agentnew/ajax_get_site_groups', {
|
||
|
gid: this.gid,
|
||
|
},{
|
||
|
headers:{
|
||
|
'Auth': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NTAwNTM3MjQsIm5iZiI6MTc1MDA1MzcyNCwiZXhwIjoxNzUyNjQ1NzI0LCJ1c2VyIjoic3VidXNlciIsImxvZ2luX3R5cGUiOjAsImFpZCI6IjEifQ.xyIqBLelB-k6jCifgRevBJTyg_Qrm6m1e4OcHhOpepU'
|
||
|
}
|
||
|
}).then(response => {
|
||
|
this.$nextTick(() => {
|
||
|
that.siteGroups = response.data
|
||
|
console.log(that.siteGroups,'---that.siteGroups');
|
||
|
})
|
||
|
}).catch(error => {
|
||
|
console.error(error, 'error')
|
||
|
})
|
||
|
},
|
||
|
// 点击站点分组单元格时触发
|
||
|
showGroupSetting(row, index) {
|
||
|
// 如果存在分组 则显示已设置分组
|
||
|
this.selected_group = '';
|
||
|
if (row.group) {
|
||
|
this.selected_group = row.group;
|
||
|
}
|
||
|
|
||
|
// 关闭其他行的弹框
|
||
|
this.popoverFlag = true;
|
||
|
this.siteList.forEach((item, i) => {
|
||
|
if (i !== index) {
|
||
|
item['showPopover'] = false;
|
||
|
}
|
||
|
});
|
||
|
// 打开当前行的弹框
|
||
|
row['showPopover'] = true;
|
||
|
|
||
|
// 切换图标
|
||
|
this.toggleIcon();
|
||
|
},
|
||
|
// 保存站点分组
|
||
|
addSiteGroup(row) {
|
||
|
this.$http('POST', '/agentnew/ajax_add_site_group_index', {
|
||
|
groupid: this.selected_group,
|
||
|
uid: row.uid,
|
||
|
},{
|
||
|
headers:{
|
||
|
'Auth': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NTAwNTM3MjQsIm5iZiI6MTc1MDA1MzcyNCwiZXhwIjoxNzUyNjQ1NzI0LCJ1c2VyIjoic3VidXNlciIsImxvZ2luX3R5cGUiOjAsImFpZCI6IjEifQ.xyIqBLelB-k6jCifgRevBJTyg_Qrm6m1e4OcHhOpepU'
|
||
|
}
|
||
|
}).then(response => {
|
||
|
if (response.status) {
|
||
|
// 保存成功弹层提示
|
||
|
this.$message.success(response.info);
|
||
|
|
||
|
// 更新分组名称
|
||
|
this.siteGroups.forEach((item) => {
|
||
|
if (item.id === this.selected_group) {
|
||
|
row['group'] = item.name;
|
||
|
}
|
||
|
});
|
||
|
row['groupid'] = this.selected_group; // 更新价格
|
||
|
row['showPopover'] = false; // 关闭弹框
|
||
|
this.$set(this.siteList, row)
|
||
|
this.currentIcon = require('@/assets/site/drop_icon.svg');
|
||
|
} else {
|
||
|
this.$message.error(response.info);
|
||
|
}
|
||
|
}).catch(error => {
|
||
|
console.error(error, 'error')
|
||
|
})
|
||
|
},
|
||
|
// 取消编辑
|
||
|
cancleGroupSetting(row) {
|
||
|
// 关闭弹框
|
||
|
row['showPopover'] = false;
|
||
|
this.popoverFlag = false
|
||
|
// row[type + '_popover'] = false; // 关闭弹框
|
||
|
this.currentIcon = require('@/assets/site/drop_icon.svg');
|
||
|
this.$Message.info('已取消编辑');
|
||
|
|
||
|
},
|
||
|
toggleIcon() {
|
||
|
this.isUpIco = !this.isUpIco; // 切换状态
|
||
|
|
||
|
// 根据状态更新图标和颜色
|
||
|
if (this.isUpIco) {
|
||
|
this.currentIcon = require('@/assets/site/up_icon.svg'); // 向上图标
|
||
|
} else {
|
||
|
this.currentIcon = require('@/assets/site/drop_icon.svg'); // 向下图标
|
||
|
}
|
||
|
},
|
||
|
// 表格点击、选择
|
||
|
handleSelectionChange(data) {
|
||
|
// 多选模式下的时候 data 为数组格式
|
||
|
// 单选的时候是 对象
|
||
|
console.log(data, '表格行信息');
|
||
|
},
|
||
|
},
|
||
|
computed: {
|
||
|
filteredSites() {
|
||
|
console.log(this.currentGroup, 'this.currentGroup');
|
||
|
let result = this.siteList;
|
||
|
if (this.currentGroup) {
|
||
|
result = result.filter(site => site.groupid == this.currentGroup);
|
||
|
}
|
||
|
console.log(result, 'result');
|
||
|
return result;
|
||
|
}
|
||
|
},
|
||
|
}
|
||
|
</script>
|
||
|
<style lang="scss" scoped>
|
||
|
.elementWrap {
|
||
|
padding: 32px 36px;
|
||
|
background: #fff;
|
||
|
}
|
||
|
|
||
|
.pageheader {
|
||
|
display: flex;
|
||
|
justify-content: space-between; /* 关键属性 */
|
||
|
align-items: center;
|
||
|
margin: 16px 0px 16px 0px;
|
||
|
}
|
||
|
.pageheader-left {
|
||
|
display: flex; /* 左侧按钮组也是flex布局 */
|
||
|
gap: 15px; /* 按钮间距 */
|
||
|
}
|
||
|
|
||
|
.pagetitle {
|
||
|
font-size: 18px;
|
||
|
font-weight: bold;
|
||
|
line-height: normal;
|
||
|
letter-spacing: 0.08em;
|
||
|
color: #1E2226;
|
||
|
margin-top:8px;
|
||
|
}
|
||
|
|
||
|
.mr-16 {
|
||
|
margin-right: 16px;
|
||
|
}
|
||
|
.ml-4 {
|
||
|
margin-left: 4px;
|
||
|
}
|
||
|
|
||
|
.red {
|
||
|
color: #FF4D4F;
|
||
|
}
|
||
|
.green {
|
||
|
color: #0DAF49;
|
||
|
}
|
||
|
.black {
|
||
|
color: #1E2226;
|
||
|
}
|
||
|
.gray {
|
||
|
color: #8C8C8C;
|
||
|
}
|
||
|
|
||
|
::v-deep .custom-popover {
|
||
|
position: fixed !important;
|
||
|
// max-height: 290px;
|
||
|
// overflow-y: auto;
|
||
|
margin-top: 0 !important;
|
||
|
margin-left: 0 !important;
|
||
|
transform: none !important;
|
||
|
}
|
||
|
|
||
|
</style>
|