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

pref:测试接口变量

parent db627bbe
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
NODE_ENV = production NODE_ENV = production
# 地址 # 地址
VUE_APP_BASE_API = http://192.168.2.144:11091/m VUE_APP_BASE_API = /basics_api/m
# websocket地址 # websocket地址
VUE_APP_WEBSOCKET_API =192.168.2.144:18222/m VUE_APP_WEBSOCKET_API =192.168.0.98:18222/m
# 门户登录地址 # 门户登录地址
VUE_APP_PORTAL_URL = /portal_home VUE_APP_PORTAL_URL =/portal_home
# 站点请求地址 # 站点请求地址
VUE_APP_SITETREE_URL = http://192.168.2.144:11078/base/site/siteTree VUE_APP_SITETREE_URL = /basics_api/base/site/siteTree
\ No newline at end of file \ No newline at end of file
...@@ -35,6 +35,7 @@ instance.interceptors.request.use( ...@@ -35,6 +35,7 @@ instance.interceptors.request.use(
// console.log("sessionStorage",window.sessionStorage) // console.log("sessionStorage",window.sessionStorage)
config.headers.Authorization = window.sessionStorage.getItem("token") || ""; config.headers.Authorization = window.sessionStorage.getItem("token") || "";
//console.log("request config and session",config,window.sessionStorage); //console.log("request config and session",config,window.sessionStorage);
// config.baseURL = "";
console.log(">>>", config); console.log(">>>", config);
return config; return config;
}, },
......
<template> <template>
<el-breadcrumb separator="/"> <el-breadcrumb separator="/">
<el-breadcrumb-item <el-breadcrumb-item
:to='item.path' :to="item.path"
:key='index' :key="index"
v-for="(item, index) in breadcrumb" v-for="(item, index) in breadcrumb"
> >
{{item.name}} {{ item.name }}
</el-breadcrumb-item> </el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
</template> </template>
...@@ -13,83 +13,83 @@ ...@@ -13,83 +13,83 @@
<script> <script>
// 获取多级菜单 // 获取多级菜单
const types = { const types = {
list: '列表', list: "列表",
add: '新增', add: "新增",
edit: '编辑', edit: "编辑",
view: '查看', view: "查看",
importView: '导入', importView: "导入",
resetPwdView:'重置密码', resetPwdView: "重置密码",
}; };
const findEntity = (list, value, key) => { const findEntity = (list, value, key) => {
let data = {}; let data = {};
list.forEach((item, i)=>{ list.forEach((item, i) => {
if(item[key] === value) { if (item[key] === value) {
data = item; data = item;
return; return;
} }
}) });
return data; return data;
}; };
const find = (list, path, arr) => { const find = (list, path, arr) => {
// 获取二级菜单 // 获取二级菜单
let newList = JSON.parse(JSON.stringify(list)); let newList = JSON.parse(JSON.stringify(list));
let data = findEntity(newList, path, 'path'); let data = findEntity(newList, path, "path");
let parentId = data.parentId; let parentId = data.parentId;
arr.push(data); arr.push(data);
// 获取一级菜单 // 获取一级菜单
if(parentId){ if (parentId) {
let parent = findEntity(newList, parentId, 'id'); let parent = findEntity(newList, parentId, "id");
arr.unshift(parent); arr.unshift(parent);
} }
return arr return arr;
} };
export default { export default {
props: { props: {
list: { list: {
type: Array, type: Array,
default: () => [] default: () => [],
} },
}, },
watch: { watch: {
'$route'(route) { $route(route) {
this.query = route.query; this.query = route.query;
} },
}, },
computed: { computed: {
breadcrumb() { breadcrumb() {
// 如果用户指定面包屑,则使用用户配置 // 如果用户指定面包屑,则使用用户配置
if(this.list.length) { if (this.list.length) {
return this.list; return this.list;
} }
const path = this.$route.path.replace(/\/(list|add|edit|importView|view|resetPwdView)$/, '/list'); const path = this.$route.path.replace(
/\/(list|add|edit|importView|view|resetPwdView)$/,
"/list"
);
const group = find(this.menu, path, []); const group = find(this.menu, path, []);
let urlArray = this.$route.path.split('/'); let urlArray = this.$route.path.split("/");
const type = urlArray.pop(); const type = urlArray.pop();
if(types[type]) { if (types[type]) {
group.push({ group.push({
name: types[type] name: types[type],
}) });
} }
console.log("group",group) return group;
return group
}, },
menu() { menu() {
return this.$store.state.userData.flat || []; return this.$store.state.userData.flat || [];
}, },
}, },
data() { data() {
return { return {};
},
} };
}
}
</script> </script>
<style lang="less"> <style lang="less">
.el-breadcrumb{ .el-breadcrumb {
font-size: 12px; font-size: 12px;
} }
</style> </style>
......
...@@ -65,7 +65,6 @@ export default { ...@@ -65,7 +65,6 @@ export default {
return ( return (
<div> <div>
{this.tableData.map((item, index) => { {this.tableData.map((item, index) => {
console.log(item);
let arrs = this.columns let arrs = this.columns
.filter((i) => !i.type) .filter((i) => !i.type)
.filter((i) => !i.title) .filter((i) => !i.title)
......
<template> <template>
<span> <span>
<!-- 开启confirm时,操作之前会先调动确认窗口 --> <!-- 开启confirm时,操作之前会先调动确认窗口 -->
<el-popover <el-popover v-if="confirm" placement="top" width="160" v-model="visible">
v-if='confirm' <p>确认操作?</p>
placement="top" <div style="text-align: right; margin: 0">
width="160" <el-button size="mini" type="text" @click="visible = false"
v-model="visible"> >取消</el-button
<p>确认操作?</p> >
<div style="text-align: right; margin: 0"> <el-button type="primary" size="mini" @click="statusClick"
<el-button size="mini" type="text" @click="visible = false">取消</el-button> >确定</el-button
<el-button type="primary" size="mini" @click="statusClick">确定</el-button> >
</div> </div>
<label slot="reference" class="my-compontent-switch" <label slot="reference" class="my-compontent-switch" :checked="checked">
:checked='checked'> <span>{{ text }}</span>
<span>{{text}}</span> </label>
</label> </el-popover>
</el-popover>
<!-- 直接操作 --> <!-- 直接操作 -->
<label <label
v-else v-else
class="my-compontent-switch" class="my-compontent-switch"
:checked='checked' :checked="checked"
@click='statusClick' @click="statusClick"
> >
<span>{{text}}</span> <span>{{ text }}</span>
</label> </label>
</span> </span>
</template> </template>
<script> <script>
...@@ -37,56 +36,59 @@ export default { ...@@ -37,56 +36,59 @@ export default {
confirm: Boolean, confirm: Boolean,
on: { on: {
type: Object, type: Object,
default: ()=> {return {value: 1, text: '启用'}} default: () => {
return { value: 1, text: "启用" };
},
}, },
off: { off: {
type: Object, type: Object,
default: ()=> {return {value: 0, text: '停用'}} default: () => {
return { value: 0, text: "停用" };
},
}, },
url: String, url: String,
}, },
methods: { methods: {
async statusClick() { async statusClick() {
console.log("value",this.value) const enabled =
const enabled = this.row.enabled === this.on.value ? this.off.value : this.on.value; this.row.enabled === this.on.value ? this.off.value : this.on.value;
const id = this.row.id; const id = this.row.id;
//const getTokenUrl = this.url.replace('/save', '/edit'); //const getTokenUrl = this.url.replace('/save', '/edit');
// await this.$post(getTokenUrl, {id}); // await this.$post(getTokenUrl, {id});
this.$post(this.url, { this.$post(this.url, {
enabled, enabled,
id, id,
})
.then(res=>{
// 更新数据
let table = JSON.parse(JSON.stringify(this.value))
console.log("table",table)
let {index, data} = this.find(table, id);
data.enabled = enabled;
table.splice(index, 1, data);
this.$emit("input", table);
this.$emit("change");
})
.catch(error=>{
this.$message.error(error.message);
})
.then(data=>{
this.visible = false;
}) })
.then((res) => {
// 更新数据
let table = JSON.parse(JSON.stringify(this.value));
let { index, data } = this.find(table, id);
data.enabled = enabled;
table.splice(index, 1, data);
this.$emit("input", table);
this.$emit("change");
})
.catch((error) => {
this.$message.error(error.message);
})
.then((data) => {
this.visible = false;
});
}, },
find(list, id) { find(list, id) {
let index = -1; let index = -1;
let data = null; let data = null;
list.forEach((item, i)=>{ list.forEach((item, i) => {
if(item.id === id){ if (item.id === id) {
index = i; index = i;
data = Object.assign({}, item); data = Object.assign({}, item);
return; return;
} }
}) });
return { return {
index, index,
data, data,
} };
}, },
}, },
computed: { computed: {
...@@ -100,13 +102,13 @@ export default { ...@@ -100,13 +102,13 @@ export default {
data() { data() {
return { return {
visible: false, visible: false,
} };
} },
} };
</script> </script>
<style lang="less"> <style lang="less">
.my-compontent-switch{ .my-compontent-switch {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
position: relative; position: relative;
...@@ -114,16 +116,16 @@ export default { ...@@ -114,16 +116,16 @@ export default {
line-height: 19px; line-height: 19px;
height: 20px; height: 20px;
vertical-align: middle; vertical-align: middle;
&[checked] span{ &[checked] span {
border-color: #409eff; border-color: #409eff;
background-color: #409eff; background-color: #409eff;
padding:0 23px 0 10px; padding: 0 23px 0 10px;
&::after{ &::after {
left: 100%; left: 100%;
margin-left: -17px; margin-left: -17px;
} }
} }
span{ span {
margin: 0; margin: 0;
display: inline-block; display: inline-block;
position: relative; position: relative;
...@@ -131,20 +133,20 @@ export default { ...@@ -131,20 +133,20 @@ export default {
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
outline: none; outline: none;
color: #fff; color: #fff;
padding:0 10px 0 23px; padding: 0 10px 0 23px;
border-radius: 10px; border-radius: 10px;
box-sizing: border-box; box-sizing: border-box;
background: #dcdfe6; background: #dcdfe6;
cursor: pointer; cursor: pointer;
transition: border-color .3s,background-color .3s; transition: border-color 0.3s, background-color 0.3s;
vertical-align: middle; vertical-align: middle;
&::after{ &::after {
content: ""; content: "";
position: absolute; position: absolute;
top: 1px; top: 1px;
left: 1px; left: 1px;
border-radius: 100%; border-radius: 100%;
transition: all .3s; transition: all 0.3s;
width: 16px; width: 16px;
height: 16px; height: 16px;
background-color: #fff; background-color: #fff;
......
...@@ -123,7 +123,6 @@ export default { ...@@ -123,7 +123,6 @@ export default {
}, },
}, },
beforeDestroy() { beforeDestroy() {
console.log("beforeDestroy");
//window.removeEventListener("message", this.getsocketData, false); //window.removeEventListener("message", this.getsocketData, false);
}, },
mounted() { mounted() {
......
...@@ -107,13 +107,11 @@ export default { ...@@ -107,13 +107,11 @@ export default {
// this.getwaitedListdata(id); // this.getwaitedListdata(id);
}, },
getwaitedListdata() { getwaitedListdata() {
let url =
let url=process.env.VUE_APP_SITETREE_URL=='undefined'?'http://192.168.0.98:11078/base/site/siteTree':process.env.VUE_APP_SITETREE_URL process.env.VUE_APP_SITETREE_URL == "undefined"
console.log("url:"+url) ? "http://192.168.0.98:11078/base/site/siteTree"
console.log("url:"+process.env.VUE_APP_SITETREE_URL) : process.env.VUE_APP_SITETREE_URL;
this.$get(url).then((res) => { this.$get(url).then((res) => {
console.log(res.data);
const { siteTree } = res.data; const { siteTree } = res.data;
this.sitelist = siteTree; this.sitelist = siteTree;
let arr = []; let arr = [];
......
...@@ -74,15 +74,12 @@ export default { ...@@ -74,15 +74,12 @@ export default {
contentRender(h, params) { contentRender(h, params) {
//console.log(params.extData.extData.productId) //console.log(params.extData.extData.productId)
let value = params.extData.extData.productName; let value = params.extData.extData.productName;
console.log(">>>", params);
return <img src={require(`../assets/images/${value}.png`)} />; return <img src={require(`../assets/images/${value}.png`)} />;
}, },
getDeviceDetial() { getDeviceDetial() {
//获取设备列表 //获取设备列表
console.log("device siteId", this.info.siteId);
}, },
refresh(data) { refresh(data) {
console.log("刷新数据", data);
// this.markersGroupData = data; // this.markersGroupData = data;
//this.$refs.map.clear(); //this.$refs.map.clear();
let map = this.amapManager.getMap(); let map = this.amapManager.getMap();
...@@ -125,8 +122,6 @@ export default { ...@@ -125,8 +122,6 @@ export default {
this.$emit("input", false); this.$emit("input", false);
this.$emit("choose", JSON.parse(JSON.stringify(this.mapData)), (val) => { this.$emit("choose", JSON.parse(JSON.stringify(this.mapData)), (val) => {
//data = val; //data = val;
console.log("callback:" + val);
}); });
}, },
}, },
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
:page-size="currSize" :page-size="currSize"
:page-sizes="[10, 20, 50, 100, 200]" :page-sizes="[10, 20, 50, 100, 200]"
layout="sizes, total, prev, pager, next, jumper" layout="sizes, total, prev, pager, next, jumper"
:total="total"> :total="total"
>
</el-pagination> </el-pagination>
</div> </div>
</template> </template>
...@@ -27,49 +28,46 @@ export default { ...@@ -27,49 +28,46 @@ export default {
}, },
}, },
watch: { watch: {
'$route'(route) { $route(route) {
this.initPage(route.query); this.initPage(route.query);
} },
}, },
created() { created() {
this.initPage(this.$route.query); this.initPage(this.$route.query);
}, },
methods: { methods: {
initPage(query) { initPage(query) {
console.log("query",query) this.currPage = parseInt(query["page"]) || 1;
this.currPage = parseInt(query['page']) || 1; this.currSize = parseInt(query["size"]) || this.prePageResult;
this.currSize = parseInt(query['size']) || this.prePageResult;
}, },
changeHash(key, val) { changeHash(key, val) {
let {path, query} = this.$route; let { path, query } = this.$route;
this.$router.push({ this.$router.push({
path: path, path: path,
query: Object.assign({}, query, {[`${key}`]: val}) query: Object.assign({}, query, { [`${key}`]: val }),
}) });
}, },
handleSizeChange(currSize) { handleSizeChange(currSize) {
console.log("currsize"+currSize) this.changeHash("size", currSize);
this.changeHash('size', currSize);
}, },
handleCurrentChange(currPage) { handleCurrentChange(currPage) {
this.changeHash('page', currPage); this.changeHash("page", currPage);
}, },
}, },
data() { data() {
return { return {
currPage: 1, currPage: 1,
currSize: 10, currSize: 10,
} };
} },
} };
</script> </script>
<style lang="less"> <style lang="less">
.pagination-wapper{ .pagination-wapper {
background: #fff; background: #fff;
margin-top: 10px; margin-top: 10px;
.el-pagination{ .el-pagination {
margin-left: auto; margin-left: auto;
} }
} }
......
...@@ -202,7 +202,6 @@ export default { ...@@ -202,7 +202,6 @@ export default {
methods: { methods: {
remoteMethod(query, searchType) { remoteMethod(query, searchType) {
if (query == "") { if (query == "") {
console.log("查询参数为空!");
return; return;
} }
this.loading = true; this.loading = true;
...@@ -283,7 +282,6 @@ export default { ...@@ -283,7 +282,6 @@ export default {
encode(data, formTemp) { encode(data, formTemp) {
let newData = {}; let newData = {};
Object.keys(Qs.parse(data)).forEach((item) => { Object.keys(Qs.parse(data)).forEach((item) => {
console.log(item);
if (/^query\./.test(item)) { if (/^query\./.test(item)) {
let val = data[item]; let val = data[item];
let key = item.replace(/^query\./, ""); let key = item.replace(/^query\./, "");
...@@ -325,13 +323,12 @@ export default { ...@@ -325,13 +323,12 @@ export default {
) { ) {
//支持模糊查询,收尾增加百分号 //支持模糊查询,收尾增加百分号
val = val.trim(); val = val.trim();
if(val.charAt(0)!='%'){ if (val.charAt(0) != "%") {
val = "%" + val val = "%" + val;
} }
if(val.charAt(val.length-1)!='%'){ if (val.charAt(val.length - 1) != "%") {
val =val + "%"; val = val + "%";
} }
} }
}); });
newData[item] = this.decodeVal(val); newData[item] = this.decodeVal(val);
......
<template> <template>
<span> <span>
<!-- 开启confirm时,操作之前会先调动确认窗口 --> <!-- 开启confirm时,操作之前会先调动确认窗口 -->
<el-popover <el-popover v-if="confirm" placement="top" width="160" v-model="visible">
v-if='confirm' <p>确认操作?</p>
placement="top" <div style="text-align: right; margin: 0">
width="160" <el-button size="mini" type="text" @click="visible = false"
v-model="visible"> >取消</el-button
<p>确认操作?</p> >
<div style="text-align: right; margin: 0"> <el-button type="primary" size="mini" @click="statusClick"
<el-button size="mini" type="text" @click="visible = false">取消</el-button> >确定</el-button
<el-button type="primary" size="mini" @click="statusClick">确定</el-button> >
</div> </div>
<label slot="reference" class="my-compontent-switch" <label slot="reference" class="my-compontent-switch" :checked="checked">
:checked='checked'> <span>{{ text }}</span>
<span>{{text}}</span> </label>
</label> </el-popover>
</el-popover>
<!-- 直接操作 --> <!-- 直接操作 -->
<label <label
v-else v-else
class="my-compontent-switch" class="my-compontent-switch"
:checked='checked' :checked="checked"
@click='statusClick' @click="statusClick"
> >
<span>{{text}}</span> <span>{{ text }}</span>
</label> </label>
</span> </span>
</template> </template>
<script> <script>
...@@ -37,59 +36,58 @@ export default { ...@@ -37,59 +36,58 @@ export default {
confirm: Boolean, confirm: Boolean,
on: { on: {
type: Object, type: Object,
default: ()=> {return {value: 1, text: ''}} default: () => {
return { value: 1, text: "" };
},
}, },
off: { off: {
type: Object, type: Object,
default: ()=> {return {value: 0, text: ''}} default: () => {
return { value: 0, text: "" };
},
}, },
url: String, url: String,
}, },
methods: { methods: {
async statusClick() { async statusClick() {
const status = this.row.status === this.on.value ? this.off.value : this.on.value; const status =
this.row.status === this.on.value ? this.off.value : this.on.value;
const id = this.row.id; const id = this.row.id;
this.$post(this.url, { this.$post(this.url, {
status, status,
id, id,
}) })
.then(res=>{ .then((res) => {
// 更新数据 // 更新数据
console.log("table",this.value)
let table = JSON.parse(JSON.stringify(this.value))
let {index, data} = this.find(table, id);
console.log("data",data) let table = JSON.parse(JSON.stringify(this.value));
let { index, data } = this.find(table, id);
data.status = res.data.entity.status; data.status = res.data.entity.status;
table.splice(index, 1, data);
table.splice(index, 1, data); this.$emit("input", table);
this.$emit("change");
this.$emit("input", table); })
this.$emit("change"); .catch((error) => {
}) this.$message.error(error.message);
.catch(error=>{ })
this.$message.error(error.message); .then((data) => {
}) this.visible = false;
.then(data=>{ });
this.visible = false;
})
}, },
find(list, id) { find(list, id) {
let index = -1; let index = -1;
let data = null; let data = null;
list.forEach((item, i)=>{ list.forEach((item, i) => {
if(item.id === id){ if (item.id === id) {
index = i; index = i;
data = Object.assign({}, item); data = Object.assign({}, item);
return; return;
} }
}) });
return { return {
index, index,
data, data,
} };
}, },
}, },
computed: { computed: {
...@@ -103,13 +101,13 @@ export default { ...@@ -103,13 +101,13 @@ export default {
data() { data() {
return { return {
visible: false, visible: false,
} };
} },
} };
</script> </script>
<style lang="less"> <style lang="less">
.my-compontent-switch{ .my-compontent-switch {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
position: relative; position: relative;
...@@ -117,16 +115,16 @@ export default { ...@@ -117,16 +115,16 @@ export default {
line-height: 19px; line-height: 19px;
height: 20px; height: 20px;
vertical-align: middle; vertical-align: middle;
&[checked] span{ &[checked] span {
border-color: #409eff; border-color: #409eff;
background-color: #409eff; background-color: #409eff;
padding:0 23px 0 10px; padding: 0 23px 0 10px;
&::after{ &::after {
left: 100%; left: 100%;
margin-left: -17px; margin-left: -17px;
} }
} }
span{ span {
margin: 0; margin: 0;
display: inline-block; display: inline-block;
position: relative; position: relative;
...@@ -134,20 +132,20 @@ export default { ...@@ -134,20 +132,20 @@ export default {
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
outline: none; outline: none;
color: #fff; color: #fff;
padding:0 10px 0 23px; padding: 0 10px 0 23px;
border-radius: 10px; border-radius: 10px;
box-sizing: border-box; box-sizing: border-box;
background: #dcdfe6; background: #dcdfe6;
cursor: pointer; cursor: pointer;
transition: border-color .3s,background-color .3s; transition: border-color 0.3s, background-color 0.3s;
vertical-align: middle; vertical-align: middle;
&::after{ &::after {
content: ""; content: "";
position: absolute; position: absolute;
top: 1px; top: 1px;
left: 1px; left: 1px;
border-radius: 100%; border-radius: 100%;
transition: all .3s; transition: all 0.3s;
width: 16px; width: 16px;
height: 16px; height: 16px;
background-color: #fff; background-color: #fff;
......
...@@ -3,15 +3,22 @@ ...@@ -3,15 +3,22 @@
<template> <template>
<div class="my-upload"> <div class="my-upload">
<label> <label>
<el-button icon='el-icon-upload' size='mini' :loading='loading'>{{loading ? '上传中...' : tip}}</el-button> <el-button icon="el-icon-upload" size="mini" :loading="loading">{{
<input type="file" @change='chooseFile' :disabled="loading" ref="referenceUpload"> loading ? "上传中..." : tip
}}</el-button>
<input
type="file"
@change="chooseFile"
:disabled="loading"
ref="referenceUpload"
/>
</label> </label>
<div v-if='value' class='flex'> <div v-if="value" class="flex">
<div style="margin-right: 20px"> <div style="margin-right: 20px">
<div v-if='type === "thumb"' class='thumb' :style="imgCover"></div> <div v-if="type === 'thumb'" class="thumb" :style="imgCover"></div>
<div v-else>文件名: {{value}}</div> <div v-else>文件名: {{ value }}</div>
</div> </div>
<!-- <div> <!-- <div>
<el-button icon="el-icon-delete" size='mini' plain @click='del'>删除</el-button> <el-button icon="el-icon-delete" size='mini' plain @click='del'>删除</el-button>
</div>--> </div>-->
</div> </div>
...@@ -23,37 +30,38 @@ export default { ...@@ -23,37 +30,38 @@ export default {
props: { props: {
value: { value: {
type: String, type: String,
default: '', default: "",
}, },
type: { // 展示类型,文件名或缩略图 filename | thumb type: {
// 展示类型,文件名或缩略图 filename | thumb
type: String, type: String,
default: 'filename', default: "filename",
}, },
tip: { // 按钮文字 tip: {
// 按钮文字
type: String, type: String,
default: '上传文件', default: "上传文件",
}, },
prePath: { prePath: {
type: String, type: String,
default: '', default: "",
} },
}, },
methods: { methods: {
del() { del() {
this.$emit("input", "") this.$emit("input", "");
}, },
async chooseFile(e) { async chooseFile(e) {
this.loading = true; this.loading = true;
console.log(e);
try { try {
const {code, url} = await this.$upload('file/upload', { const { code, url } = await this.$upload("file/upload", {
uploadFile: e.target.files[0], uploadFile: e.target.files[0],
prePath: this.prePath prePath: this.prePath,
}); });
if(code === 1) { if (code === 1) {
this.$emit('input', url) this.$emit("input", url);
}else{ } else {
this.$message.error('上传文件失败'); this.$message.error("上传文件失败");
} }
} catch (error) { } catch (error) {
this.$message.error(error.message); this.$message.error(error.message);
...@@ -65,21 +73,21 @@ export default { ...@@ -65,21 +73,21 @@ export default {
computed: { computed: {
imgCover() { imgCover() {
return `background-image: url(${this.value})`; return `background-image: url(${this.value})`;
} },
}, },
data() { data() {
return { return {
loading: false, loading: false,
} };
} },
} };
</script> </script>
<style lang="less"> <style lang="less">
.my-upload{ .my-upload {
label{ label {
position: relative; position: relative;
input{ input {
display: block; display: block;
position: absolute; position: absolute;
width: 100%; width: 100%;
...@@ -89,7 +97,7 @@ export default { ...@@ -89,7 +97,7 @@ export default {
opacity: 0; opacity: 0;
} }
} }
.thumb{ .thumb {
width: 80px; width: 80px;
height: 80px; height: 80px;
background-size: contain; background-size: contain;
...@@ -99,7 +107,7 @@ export default { ...@@ -99,7 +107,7 @@ export default {
border-radius: 5px; border-radius: 5px;
overflow: hidden; overflow: hidden;
} }
p{ p {
color: #666; color: #666;
font-size: 14px; font-size: 14px;
} }
......
<template> <template>
<div id="dropMenu" <div
:style="style" id="dropMenu"
style="display: block;" :style="style"
v-show="show" style="display: block"
@mousedown.stop v-show="show"
@contextmenu.prevent><!--阻止冒泡事件 阻止右键的默认事件--> @mousedown.stop
@contextmenu.prevent
>
<!--阻止冒泡事件 阻止右键的默认事件-->
<slot></slot> <slot></slot>
</div> </div>
</template> </template>
...@@ -17,82 +20,78 @@ export default { ...@@ -17,82 +20,78 @@ export default {
x: null, x: null,
y: null, y: null,
style: {}, style: {},
binded: false binded: false,
} };
}, },
props: { props: {
target: null, target: null,
show: Boolean show: Boolean,
}, },
mounted() { mounted() {
this.bindEvents() this.bindEvents();
}, },
watch: { watch: {
show(show) { show(show) {
if (show) { if (show) {
this.bindHideEvents() this.bindHideEvents();
} else { } else {
this.unbindHideEvents() this.unbindHideEvents();
} }
}, },
target(target) { target(target) {
this.bindEvents() this.bindEvents();
} },
}, },
methods: { methods: {
// 初始化事件 // 初始化事件
bindEvents() { bindEvents() {
this.$nextTick(() => { this.$nextTick(() => {
var that = this if (!this.target || this.binded) return;
if (!this.target || this.binded) return this.triggerShowFn = this.contextMenuHandler.bind(this);
console.log(this); this.target.addEventListener("contextmenu", this.triggerShowFn);
this.triggerShowFn = this.contextMenuHandler.bind(this) });
this.target.addEventListener('contextmenu', this.triggerShowFn)
//this.binded = true
})
}, },
// 取消绑定事件 // 取消绑定事件
unbindEvents() { unbindEvents() {
if (!this.target) return if (!this.target) return;
this.target.removeEventListener('contextmenu', this.triggerShowFn) this.target.removeEventListener("contextmenu", this.triggerShowFn);
}, },
// 绑定隐藏菜单事件 // 绑定隐藏菜单事件
bindHideEvents() { bindHideEvents() {
this.triggerHideFn = this.clickDocumentHandler.bind(this) this.triggerHideFn = this.clickDocumentHandler.bind(this);
document.addEventListener('mousedown', this.triggerHideFn) document.addEventListener("mousedown", this.triggerHideFn);
document.addEventListener('mousewheel', this.triggerHideFn) document.addEventListener("mousewheel", this.triggerHideFn);
}, },
// 取消绑定隐藏菜单事件 // 取消绑定隐藏菜单事件
unbindHideEvents() { unbindHideEvents() {
document.removeEventListener('mousedown', this.triggerHideFn) document.removeEventListener("mousedown", this.triggerHideFn);
document.removeEventListener('mousewheel', this.triggerHideFn) document.removeEventListener("mousewheel", this.triggerHideFn);
}, },
// 鼠标按压事件处理器 // 鼠标按压事件处理器
clickDocumentHandler(e) { clickDocumentHandler(e) {
this.$emit('update:show', false) //隐藏 this.$emit("update:show", false); //隐藏
}, },
// 右键事件事件处理 // 右键事件事件处理
contextMenuHandler(e) { contextMenuHandler(e) {
e.target.click(); //这个是因为我需要获取tree节点的数据,所以我通过点击事件去获取数据
this.x = e.clientX;
this.y = e.clientY - 110;
this.layout();
this.$emit("update:show", true); //显示
e.preventDefault();
e.stopPropagation();
e.target.click()//这个是因为我需要获取tree节点的数据,所以我通过点击事件去获取数据 this.$emit("targetElement", e.target); //我还要获取右键的DOM元素进行操作
this.x = e.clientX
this.y = e.clientY - 110
this.layout()
this.$emit('update:show', true) //显示
e.preventDefault()
e.stopPropagation()
this.$emit('targetElement', e.target) //我还要获取右键的DOM元素进行操作
}, },
// 布局 // 布局
layout() { layout() {
this.style = { this.style = {
left: this.x + 'px', left: this.x + "px",
top: this.y + 'px' top: this.y + "px",
} };
} },
} },
} };
</script> </script>
<style lang="scss"> <style lang="scss">
#dropMenu { #dropMenu {
...@@ -114,16 +113,15 @@ export default { ...@@ -114,16 +113,15 @@ export default {
line-height: 30px; line-height: 30px;
background: #fff; background: #fff;
margin-bottom: 1px; margin-bottom: 1px;
font-size:16px; font-size: 16px;
cursor: pointer; cursor: pointer;
li:hover { li:hover {
color: deeppink; color: deeppink;
text-decoration: underline; text-decoration: underline;
} }
} }
} }
} }
</style> </style>
\ No newline at end of file
...@@ -471,7 +471,6 @@ export default { ...@@ -471,7 +471,6 @@ export default {
created() { created() {
// this.siteId = window.sessionStorage.getItem("siteid") || null // this.siteId = window.sessionStorage.getItem("siteid") || null
this.siteId = session.getSession("siteid") || null; this.siteId = session.getSession("siteid") || null;
console.log("cur siteId"+this.siteId)
let today = new Date(); let today = new Date();
let query = { let query = {
year: today.getFullYear(), year: today.getFullYear(),
...@@ -510,9 +509,7 @@ export default { ...@@ -510,9 +509,7 @@ export default {
this.pushChart.resize(); this.pushChart.resize();
}, },
syncDeviceStat() { syncDeviceStat() {
this.$post("/device/stat/syncDeviceStat", { siteId: this.siteId })
this.$post("/device/stat/syncDeviceStat", {siteId:this.siteId})
.then((res) => { .then((res) => {
if (res.code == 1) { if (res.code == 1) {
this.statData = res.data.data[0]; this.statData = res.data.data[0];
...@@ -529,11 +526,9 @@ export default { ...@@ -529,11 +526,9 @@ export default {
let query = { createTimeStart: this.formatterDate(beforeday) }; let query = { createTimeStart: this.formatterDate(beforeday) };
//当前选择站点id //当前选择站点id
query.siteId = this.siteId; query.siteId = this.siteId;
console.log(query);
this.$post("/device/stat/list", query) this.$post("/device/stat/list", query)
.then((res) => { .then((res) => {
if (res.code == 1) { if (res.code == 1) {
console.log("res", res);
this.statArrayData = res.data.data; this.statArrayData = res.data.data;
this.beforeday = this.statArrayData.map((i) => { this.beforeday = this.statArrayData.map((i) => {
let daystr = i.month + "-" + i.day; let daystr = i.month + "-" + i.day;
......
...@@ -59,15 +59,13 @@ export default { ...@@ -59,15 +59,13 @@ export default {
components: { dialogShow }, components: { dialogShow },
mixins: [table], mixins: [table],
created() { created() {
console.log("queryIn:", this.queryIn);
if (this.queryIn && this.queryIn.alarmDevice) { if (this.queryIn && this.queryIn.alarmDevice) {
this.query = {}; this.query = {};
this.query["alarmDevice"] = this.queryIn.alarmDevice; this.query["alarmDevice"] = this.queryIn.alarmDevice;
} }
this.changePath("/device/alarm/info"); this.changePath("/device/alarm/info");
this.query= Object.assign({}, this.query, {siteId:1}); this.query = Object.assign({}, this.query, { siteId: 1 });
}, },
methods: { methods: {
/** 重写新增方法 */ /** 重写新增方法 */
......
...@@ -77,7 +77,11 @@ ...@@ -77,7 +77,11 @@
prop="skinId" prop="skinId"
v-model="form.skinId" v-model="form.skinId"
@change="skinSelect" @change="skinSelect"
:enumData="!form.productCode?{0:'无'}:dict.skinProductCodeMap[form.productCode]" :enumData="
!form.productCode
? { 0: '无' }
: dict.skinProductCodeMap[form.productCode]
"
type="select" type="select"
placeholder="选择首页" placeholder="选择首页"
/> />
...@@ -185,8 +189,8 @@ export default { ...@@ -185,8 +189,8 @@ export default {
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
direction: "rtl", direction: "rtl",
urls: { urls: {
saveUrl: '/device/save', saveUrl: "/device/save",
}, },
toString: [ toString: [
"deviceFirmId", "deviceFirmId",
...@@ -225,9 +229,8 @@ export default { ...@@ -225,9 +229,8 @@ export default {
}, },
methods: { methods: {
changeProduct(val){ changeProduct(val) {
console.log("val",val) this.form.productCode = this.dict.productCode[val];
this.form.productCode= this.dict.productCode[val];
}, },
skinSelect(val) { skinSelect(val) {
this.form.skinName = this.form.skinName =
...@@ -252,7 +255,6 @@ export default { ...@@ -252,7 +255,6 @@ export default {
this.form.siteId = row.siteId; this.form.siteId = row.siteId;
this.siteName = row.siteName; this.siteName = row.siteName;
this.siteCode = row.siteCode; this.siteCode = row.siteCode;
console.log("row", row);
this.getData(); this.getData();
this.title = "新增设备"; this.title = "新增设备";
}, },
...@@ -271,7 +273,6 @@ export default { ...@@ -271,7 +273,6 @@ export default {
}, },
/**获取数据后弹框 */ /**获取数据后弹框 */
afterRender(data) { afterRender(data) {
console.log(data)
this.open = true; this.open = true;
if (this.pageInfo.type == "add" || this.pageInfo.type == "edit") { if (this.pageInfo.type == "add" || this.pageInfo.type == "edit") {
this.form.siteName = this.siteName; this.form.siteName = this.siteName;
...@@ -294,9 +295,7 @@ export default { ...@@ -294,9 +295,7 @@ export default {
this.$refs[refName].resetFields(); this.$refs[refName].resetFields();
} }
}, },
handleClose() { handleClose() {},
console.log("关闭");
},
}, },
}; };
</script> </script>
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
"deviceStatus", "deviceStatus",
"enabled", "enabled",
"deviceFirmId", "deviceFirmId",
"source" "source",
], ],
// 表单校验 // 表单校验
rules: { rules: {
...@@ -87,7 +87,6 @@ export default { ...@@ -87,7 +87,6 @@ export default {
this.getData(); this.getData();
this.pageInfo.type = "edit"; this.pageInfo.type = "edit";
this.title = "修改设备"; this.title = "修改设备";
}, },
/** 新增 */ /** 新增 */
add(row) { add(row) {
...@@ -112,15 +111,13 @@ export default { ...@@ -112,15 +111,13 @@ export default {
}, },
deleteDevice() { deleteDevice() {
console.log("删除设备信息");
this.$get("/device/delete", { this.$get("/device/delete", {
id: this.form.id, id: this.form.id,
}) })
.then((res) => { .then((res) => {
if (res.code == 1) { if (res.code == 1) {
this.$message.success("删除成功!"); this.$message.success("删除成功!");
this.open=false; this.open = false;
//this.getData(); //this.getData();
} }
}) })
...@@ -132,16 +129,12 @@ export default { ...@@ -132,16 +129,12 @@ export default {
/**获取数据后弹框 */ /**获取数据后弹框 */
afterRender(data) { afterRender(data) {
this.open = true; this.open = true;
console.log("form:", this.form);
Object.assign(this.viewInfo, this.form); Object.assign(this.viewInfo, this.form);
console.log("viewInfo", this.viewInfo); if (this.pageInfo.type == "add") {
if(this.pageInfo.type=='add'){ this.form.siteId = this.siteId;
this.form.siteId = this.siteId; this.form.siteName = this.siteName;
this.form.siteName = this.siteName; this.form.siteCode = this.siteCode;
this.form.siteCode = this.siteCode; }
}
console.log("form:", this.form);
}, },
afterSubmit(data) { afterSubmit(data) {
...@@ -159,9 +152,7 @@ export default { ...@@ -159,9 +152,7 @@ export default {
this.$refs[refName].resetFields(); this.$refs[refName].resetFields();
} }
}, },
handleClose() { handleClose() {},
console.log("关闭");
},
}, },
}; };
</script> </script>
...@@ -201,7 +201,6 @@ export default { ...@@ -201,7 +201,6 @@ export default {
components: { drawerShow, drawerView }, components: { drawerShow, drawerView },
mixins: [table, tree], mixins: [table, tree],
created() { created() {
console.log(this.$route);
this.siteId = this.$route.query.siteId; this.siteId = this.$route.query.siteId;
this.info = this.$route.query; this.info = this.$route.query;
this.query = { siteId: this.siteId }; this.query = { siteId: this.siteId };
...@@ -267,7 +266,6 @@ export default { ...@@ -267,7 +266,6 @@ export default {
/** 导出Excel */ /** 导出Excel */
doExport() { doExport() {
this.isExport = true; this.isExport = true;
console.log("ids", this.selection);
this.$download( this.$download(
"/device/exportExcel", "/device/exportExcel",
{ {
...@@ -363,8 +361,6 @@ export default { ...@@ -363,8 +361,6 @@ export default {
}, },
updateSite(row) { updateSite(row) {
console.log("update site");
this.$get("/sitestat/siteTree", {}).then(({ data }) => { this.$get("/sitestat/siteTree", {}).then(({ data }) => {
this.areaData = data.siteTree; this.areaData = data.siteTree;
this.tree.open = true; this.tree.open = true;
...@@ -373,7 +369,6 @@ export default { ...@@ -373,7 +369,6 @@ export default {
}, },
handleNodeClick(node) { handleNodeClick(node) {
console.log("click node", node);
this.currentNode = node; this.currentNode = node;
}, },
......
...@@ -28,8 +28,6 @@ export default { ...@@ -28,8 +28,6 @@ export default {
components: { dialogShow }, components: { dialogShow },
mixins: [table], mixins: [table],
created() { created() {
console.log("queryIn:", this.queryIn);
//this.config.addQuery = { deviceId, deviceType }; //this.config.addQuery = { deviceId, deviceType };
if (this.queryIn.deviceId) { if (this.queryIn.deviceId) {
...@@ -37,8 +35,6 @@ export default { ...@@ -37,8 +35,6 @@ export default {
this.query["deviceId"] = this.queryIn.deviceId; this.query["deviceId"] = this.queryIn.deviceId;
} }
console.log("pageInfo--before", this.pageInfo);
// this.changePath("/device/alarm/info") // this.changePath("/device/alarm/info")
this.pageInfo.list = "/device/module/use/list"; this.pageInfo.list = "/device/module/use/list";
...@@ -46,8 +42,6 @@ export default { ...@@ -46,8 +42,6 @@ export default {
this.pageInfo.add = "/device/module/use/add"; this.pageInfo.add = "/device/module/use/add";
this.pageInfo.edit = "/device/module/use/edit"; this.pageInfo.edit = "/device/module/use/edit";
this.pageInfo.view = "/device/module/use/view"; this.pageInfo.view = "/device/module/use/view";
console.log("pageInfo", this.pageInfo);
}, },
methods: { methods: {
/** 重写新增方法 */ /** 重写新增方法 */
......
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
> >
{{ util_formatters("deviceDataSourceWay", form.deviceDataSourceWay) }} {{ util_formatters("deviceDataSourceWay", form.deviceDataSourceWay) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item <el-descriptions-item
label="经度" label="经度"
label-class-name="labelClass" label-class-name="labelClass"
content-class-name="contentClass" content-class-name="contentClass"
...@@ -155,9 +155,7 @@ ...@@ -155,9 +155,7 @@
label-class-name="labelClass" label-class-name="labelClass"
content-class-name="contentClass" content-class-name="contentClass"
> >
<ImagePreview :src="form.devicePhotoPath" />
<ImagePreview :src="form.devicePhotoPath" />
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item <el-descriptions-item
...@@ -182,7 +180,7 @@ ...@@ -182,7 +180,7 @@
{{ util_formatters("enabled", form.enabled) }} {{ util_formatters("enabled", form.enabled) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item <el-descriptions-item
label="利旧设备 " label="利旧设备 "
label-class-name="labelClass" label-class-name="labelClass"
content-class-name="contentClass" content-class-name="contentClass"
...@@ -218,11 +216,10 @@ ...@@ -218,11 +216,10 @@
> >
{{ util_formatterDate(form.offlineTime) }} {{ util_formatterDate(form.offlineTime) }}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
<br/> <br />
<el-descriptions <el-descriptions
:title="title" :title="title"
:column="column" :column="column"
:size="size" :size="size"
...@@ -233,10 +230,8 @@ ...@@ -233,10 +230,8 @@
<i class="el-icon-tickets"></i> <i class="el-icon-tickets"></i>
设备位置 设备位置
</template> </template>
</el-descriptions>
</el-descriptions> <Map></Map>
<Map></Map>
</layout-view> </layout-view>
</template> </template>
...@@ -255,15 +250,12 @@ export default { ...@@ -255,15 +250,12 @@ export default {
}, },
}, },
components: {}, components: {},
created() { created() {},
console.log(this.form,this.dict);
},
methods: { methods: {
util_formatterDate(time) { util_formatterDate(time) {
if(time==null){ if (time == null) {
return '' return "";
} }
let date = new Date(Number(time)); let date = new Date(Number(time));
let Y = date.getFullYear() + "-"; let Y = date.getFullYear() + "-";
......
...@@ -23,19 +23,10 @@ export default { ...@@ -23,19 +23,10 @@ export default {
loginFail(error) { loginFail(error) {
this.$message.error(error.message || "请登录"); this.$message.error(error.message || "请登录");
console.log("href:" + process.env.VUE_APP_PORTAL_URL); // window.location.href =
window.location.href = // process.env.VUE_APP_PORTAL_URL == "undefined"
process.env.VUE_APP_PORTAL_URL == "undefined" // ? "http://192.168.0.98:11072"
? "http://192.168.0.98:11072" // : process.env.VUE_APP_PORTAL_URL;
: process.env.VUE_APP_PORTAL_URL;
// window.location.href=process.env.VUE_APP_PORTAL_URL
// this.$router.replace({
// path: '/login',
// query: {
// redirect: this.redirect,
// }
// });
}, },
}, },
computed: { computed: {
......
...@@ -3,24 +3,35 @@ ...@@ -3,24 +3,35 @@
<template> <template>
<div class="page page-login flex flex-v"> <div class="page page-login flex flex-v">
<div class="form-wrap flex flex-1"> <div class="form-wrap flex flex-1">
<el-form @submit.prevent='onSubmit' ref="form" :model="form" label-width="80px" size="small"> <el-form
@submit.prevent="onSubmit"
ref="form"
:model="form"
label-width="80px"
size="small"
>
<h1>设备管理平台</h1> <h1>设备管理平台</h1>
<el-form-item label="用户名"> <el-form-item label="用户名">
<el-input v-model="form.loginName"></el-input> <el-input v-model="form.loginName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码"> <el-form-item label="密码">
<el-input v-model="form.password" type='password'></el-input> <el-input v-model="form.password" type="password"></el-input>
</el-form-item> </el-form-item>
<el-form-item size="large"> <el-form-item size="large">
<el-button type="primary" native-type='submit' :loading='loading' @click='onSubmit'>登录</el-button> <el-button
type="primary"
native-type="submit"
:loading="loading"
@click="onSubmit"
>登录</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="footer"> <div class="footer">
登陆 &copy; <a href="">信宏翔网络科技有限公司</a> 出品 登陆 &copy; <a href="">信宏翔网络科技有限公司</a> 出品
</div> </div>
</div> </div>
</template> </template>
...@@ -30,20 +41,15 @@ import { createSocket } from "@/assets/utils/websocket"; ...@@ -30,20 +41,15 @@ import { createSocket } from "@/assets/utils/websocket";
export default { export default {
name: "login", name: "login",
created() { created() {
console.log("url:"+process.env.VUE_APP_PORTAL_URL)
// let obj = {}; // let obj = {};
// obj.lng = 104.21; // obj.lng = 104.21;
// obj.lat = 30.56; // obj.lat = 30.56;
// obj.address = "测试站点"; // obj.address = "测试站点";
// obj.siteId = 2; // obj.siteId = 2;
// this.originData.push(obj); // this.originData.push(obj);
// this.$nextTick(() => { // this.$nextTick(() => {
// this.$refs.map1.refresh(this.originData); // this.$refs.map1.refresh(this.originData);
// }); // });
// window.location.href=process.env.VUE_APP_PORTAL_URL=='undefined'?'http://192.168.0.98:11072':process.env.VUE_APP_PORTAL_URL // window.location.href=process.env.VUE_APP_PORTAL_URL=='undefined'?'http://192.168.0.98:11072':process.env.VUE_APP_PORTAL_URL
}, },
methods: { methods: {
...@@ -54,14 +60,12 @@ console.log("url:"+process.env.VUE_APP_PORTAL_URL) ...@@ -54,14 +60,12 @@ console.log("url:"+process.env.VUE_APP_PORTAL_URL)
.catch(this.loginFail); .catch(this.loginFail);
}, },
loginSuccess({ data }) { loginSuccess({ data }) {
console.log("userData", data);
this.$store.commit("setUserData", data); this.$store.commit("setUserData", data);
this.$router.replace({ this.$router.replace({
path: this.redirect, path: this.redirect,
}); });
//成功 创建websocket连接 process.env.VUE_WEBSOCKET_BASE_API + //成功 创建websocket连接 process.env.VUE_WEBSOCKET_BASE_API +
console.log("process", process.env);
// createSocket("ws://"+process.env.VUE_APP_BASE_API +"/ws?accessToken="+data.id) // createSocket("ws://"+process.env.VUE_APP_BASE_API +"/ws?accessToken="+data.id)
}, },
loginFail(error) { loginFail(error) {
......
<template> <template>
<!-- 弹出框表单 --> <!-- 弹出框表单 -->
<el-drawer <el-drawer
:title="title" :title="title"
:visible.sync="open" :visible.sync="open"
:direction="direction" :direction="direction"
size="50%"> size="50%"
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> >
<el-row> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<Field
:span="22"
label="所属平台"
prop="platformId"
v-model="form.platformId"
:enumData="dict.platformId"
type="select"
placeholder="请输入产品名称,名称唯一"
/>
<Field :span="22" label="所属平台" prop="platformId" v-model="form.platformId" :enumData="dict.platformId" type="select" placeholder="请输入产品名称,名称唯一"/> <Field
:span="22"
label="产品名称"
prop="productName"
v-model="form.productName"
placeholder="请输入产品名称,名称唯一"
/>
<Field
:span="22"
label="产品编码"
prop="productCode"
v-model="form.productCode"
placeholder="请输入产品编码"
/>
<Field :span="22" label="产品名称" prop="productName" v-model="form.productName" placeholder="请输入产品名称,名称唯一"/> <Field
<Field :span="22" label="产品编码" prop="productCode" v-model="form.productCode" placeholder="请输入产品编码"/> :span="22"
label="默认首页"
<Field :span="22" label="默认首页" prop="skinId" v-model="form.skinId" @change="skinSelect" :enumData="dict.skinProductCodeMap[form.productCode]" type="select" placeholder="请输入产品名称,名称唯一"/> prop="skinId"
v-model="form.skinId"
@change="skinSelect"
:enumData="dict.skinProductCodeMap[form.productCode]"
type="select"
placeholder="请输入产品名称,名称唯一"
/>
<Field :span="22" v-if="form.productCode=='pjq'" label="事件地址" prop="eventUrl" v-model="form.eventUrl" placeholder="请输入事件地址"/> <Field
<Field :span="22" label="备注" prop="productRemark" v-model="form.productRemark" type="textarea" placeholder="请输入备注"/> :span="22"
v-if="form.productCode == 'pjq'"
label="事件地址"
prop="eventUrl"
v-model="form.eventUrl"
placeholder="请输入事件地址"
/>
<Field
:span="22"
label="备注"
prop="productRemark"
v-model="form.productRemark"
type="textarea"
placeholder="请输入备注"
/>
</el-row>
</el-row> <form-buttons @submit="submitForm" noCancelBtn />
</el-form>
<form-buttons @submit='submitForm' noCancelBtn /> </el-drawer>
</el-form>
</el-drawer>
</template> </template>
<script> <script>
import form from "@/assets/mixins/formdialog"; import form from "@/assets/mixins/formdialog";
export default { export default {
name: "ProductDetail", name: "ProductDetail",
mixins: [form], mixins: [form],
components: { components: {},
created() {
}, this.changePath("product");
created() { },
this.changePath("product") data() {
}, return {
data() { // 遮罩层
return { loading: true,
// 遮罩层 // 弹出层标题
loading: true, title: "产品",
// 弹出层标题 // 是否显示弹出层
title: "产品", open: false,
// 是否显示弹出层 direction: "rtl",
open: false, toString: ["platformId", "skinId"],
direction:"rtl", toDate: [],
toString:['platformId','skinId' // 表单校验
], rules: {
toDate:[ productName: [
], {
// 表单校验 required: true,
rules: { message: "请输入产品名称,名称唯一",
productName: [ trigger: "blur",
{required: true,message: "请输入产品名称,名称唯一", trigger: "blur" }, },
{max: 20,message: "最多只能录入20个字符",trigger: "blur",}, { max: 20, message: "最多只能录入20个字符", trigger: "blur" },
], ],
productCode: [ productCode: [
{required: true,message: "请输入产品编码", trigger: "blur" }, { required: true, message: "请输入产品编码", trigger: "blur" },
{max: 256,message: "最多只能录入256个字符",trigger: "blur",}, { max: 256, message: "最多只能录入256个字符", trigger: "blur" },
], ],
homeUrl: [ homeUrl: [
{required: true,message: "请输入首页地址", trigger: "blur" }, { required: true, message: "请输入首页地址", trigger: "blur" },
{max: 512,message: "最多只能录入512个字符",trigger: "blur",}, { max: 512, message: "最多只能录入512个字符", trigger: "blur" },
] ],
} },
}; };
}, },
methods: {
skinSelect(val){
console.log("val:"+val)
console.log("label:"+this.dict.skinProductCodeMap[this.form.productCode][val])
this.form.skinName=this.dict.skinProductCodeMap[this.form.productCode][val]
}, methods: {
/** 编辑 */ skinSelect(val) {
edit(row) { this.form.skinName =
this.reset() this.dict.skinProductCodeMap[this.form.productCode][val];
this.query = { id: row.id }; },
this.urls.currUrl ="product/edit"; /** 编辑 */
this.getData(); edit(row) {
this.pageInfo.type="edit" this.reset();
this.title = "修改产品"; this.query = { id: row.id };
}, this.urls.currUrl = "product/edit";
/** 新增 */ this.getData();
add(row) { this.pageInfo.type = "edit";
this.reset() this.title = "修改产品";
this.urls.currUrl = "product/add"; },
this.getData(); /** 新增 */
this.pageInfo.type="add" add(row) {
this.title = "新增产品"; this.reset();
}, this.urls.currUrl = "product/add";
/** 查看*/ this.getData();
view(row) { this.pageInfo.type = "add";
this.reset() this.title = "新增产品";
this.query = { id: row.id }; },
this.urls.currUrl ="product/view"; /** 查看*/
this.getData(); view(row) {
this.pageInfo.type="view" this.reset();
this.title = "产品详细"; this.query = { id: row.id };
}, this.urls.currUrl = "product/view";
/**取消按钮 */ this.getData();
cancel() { this.pageInfo.type = "view";
this.open = false; this.title = "产品详细";
}, },
/**获取数据后弹框 */ /**取消按钮 */
afterRender(data) { cancel() {
this.open = true; this.open = false;
}, },
/**获取数据后弹框 */
afterRender(data) {
this.open = true;
},
afterSubmit(data) { afterSubmit(data) {
this.open = false; this.open = false;
this.$emit("ok"); this.$emit("ok");
}, },
// 表单重置 // 表单重置
reset() { reset() {
this.form = { this.form = {
platformId : null, platformId: null,
productName : "", productName: "",
productCode : "", productCode: "",
productRemark : "", productRemark: "",
}; };
this.resetForm("form"); this.resetForm("form");
}, },
resetForm(refName) { resetForm(refName) {
if (this.$refs[refName]) { if (this.$refs[refName]) {
this.$refs[refName].resetFields(); this.$refs[refName].resetFields();
} }
}, },
}, },
}; };
</script> </script>
...@@ -122,24 +122,19 @@ export default { ...@@ -122,24 +122,19 @@ export default {
}, },
switchStat() { switchStat() {
console.log("切换地图页面");
this.$router.push({ this.$router.push({
path: "/sitestat/maplist", path: "/sitestat/maplist",
}); });
}, },
handleNodeClick(node) { handleNodeClick(node) {
console.log("click node", node);
this.currentNode = node; this.currentNode = node;
if (node.type === "site") { if (node.type === "site") {
//分页查询站点业务列表 //分页查询站点业务列表
// this.siteMatterTable.siteId = node.id; // this.siteMatterTable.siteId = node.id;
//this.getSiteMatterTableData(); //this.getSiteMatterTableData();
console.log(node.id.search(",") > -1);
if (node.id.search(",") > -1) { if (node.id.search(",") > -1) {
console.log(node.id);
//this.query = { siteId: node.id.split(",")[0] ,siteIdList:node.id.split(",")} //this.query = { siteId: node.id.split(",")[0] ,siteIdList:node.id.split(",")}
this.query = { this.query = {
...@@ -150,12 +145,12 @@ export default { ...@@ -150,12 +145,12 @@ export default {
} }
this.getData(); this.getData();
}else if(node.type==='area'){ } else if (node.type === "area") {
this.query = { areaCode: node.areaCode }; this.query = { areaCode: node.areaCode };
this.getData(); this.getData();
} }
} },
}, },
data() { data() {
return { return {
......
...@@ -174,13 +174,11 @@ export default { ...@@ -174,13 +174,11 @@ export default {
components: { drawerShow, drawerView }, components: { drawerShow, drawerView },
mixins: [table], mixins: [table],
created() { created() {
console.log("route", this.$route);
let { siteId } = this.$route.query; let { siteId } = this.$route.query;
let { sitestatId } = this.$route.query; let { sitestatId } = this.$route.query;
this.$get("/sitestat/info", { id: sitestatId }) this.$get("/sitestat/info", { id: sitestatId })
.then(({ data }) => { .then(({ data }) => {
console.log(data);
this.info = data; this.info = data;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.map.relocate(this.info); this.$refs.map.relocate(this.info);
...@@ -237,7 +235,6 @@ export default { ...@@ -237,7 +235,6 @@ export default {
switchChange(val) { switchChange(val) {
let arr = []; let arr = [];
for (let item in this.items) { for (let item in this.items) {
console.log(this.items[item]);
if (this.items[item] && this.items[item] != 0) if (this.items[item] && this.items[item] != 0)
arr.push(this.items[item]); arr.push(this.items[item]);
} }
...@@ -248,7 +245,6 @@ export default { ...@@ -248,7 +245,6 @@ export default {
this.getData(); this.getData();
}, },
afterRender(data) { afterRender(data) {
console.log("tableData", data);
if (!this.sync) { if (!this.sync) {
this.$nextTick(() => { this.$nextTick(() => {
var count = 0; var count = 0;
......
...@@ -43,7 +43,6 @@ export default { ...@@ -43,7 +43,6 @@ export default {
components: { dialogShow }, components: { dialogShow },
mixins: [table, tree], mixins: [table, tree],
mounted() { mounted() {
console.log(this.pageInfo);
this.pageInfo.list = "/sitestat/list"; this.pageInfo.list = "/sitestat/list";
}, },
...@@ -89,7 +88,6 @@ export default { ...@@ -89,7 +88,6 @@ export default {
}, },
getDetailData(info, callback) { getDetailData(info, callback) {
console.log("info:", info);
this.$router.push({ this.$router.push({
path: "/sitestat/mapDetail", path: "/sitestat/mapDetail",
// query: info, // query: info,
...@@ -117,14 +115,12 @@ export default { ...@@ -117,14 +115,12 @@ export default {
}, },
switchStat() { switchStat() {
console.log("切换列表页面");
this.$router.push({ this.$router.push({
path: "/sitestat/list", path: "/sitestat/list",
}); });
}, },
handleNodeClick(node) { handleNodeClick(node) {
console.log("click node", node);
this.currentNode = node; this.currentNode = node;
if (node.type === "site") { if (node.type === "site") {
let obj = {}; let obj = {};
......
...@@ -108,7 +108,6 @@ export default { ...@@ -108,7 +108,6 @@ export default {
return this.$message.warning("请先完成上一个地址的填写"); return this.$message.warning("请先完成上一个地址的填写");
} }
urls.push({ value: "" }); urls.push({ value: "" });
console.log("urls", urls);
}, },
isRepeat(value) { isRepeat(value) {
return this.form.urls.filter((i) => value == i.value).length > 1; return this.form.urls.filter((i) => value == i.value).length > 1;
......
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