Commit 98820128 by 蒋勇

d

parent 59f0b415
...@@ -5,10 +5,13 @@ export const login = ({ userName, password }) => { ...@@ -5,10 +5,13 @@ export const login = ({ userName, password }) => {
userName, userName,
password password
} }
console.log("==============================login")
return axios.request({ return axios.request({
url: '/web/auth/userCtl/pmlogin', url: '/web/auth/userCtl/pmlogin',
data, data,
method: 'post' method: 'post'
}).catch((e)=>{
console.log(e)
}) })
} }
......
...@@ -3,6 +3,7 @@ export default { ...@@ -3,6 +3,7 @@ export default {
* @description 配置显示在浏览器标签的title * @description 配置显示在浏览器标签的title
*/ */
title: '智慧中台 ', title: '智慧中台 ',
appkey:'860b4f4f-ac2f-4623-8b16-62764d154e91',
/** /**
* @description token在Cookie中存储的天数,默认1天 * @description token在Cookie中存储的天数,默认1天
*/ */
......
import axios from 'axios' import axios from 'axios'
import store from '@/store' import store from '@/store'
import { getToken } from './util' import { getToken } from './util'
import configapp from '@/config'
// import { Spin } from 'iview' // import { Spin } from 'iview'
const addErrorLog = errorInfo => { const addErrorLog = errorInfo => {
const { statusText, status, request: { responseURL } } = errorInfo const { statusText, status, request: { responseURL } } = errorInfo
...@@ -19,10 +20,18 @@ class HttpRequest { ...@@ -19,10 +20,18 @@ class HttpRequest {
this.queue = {} this.queue = {}
} }
getInsideConfig () { getInsideConfig () {
let appkey=null
try{
let params = new URLSearchParams(location.search)
appkey=params.get("appkey")
}catch(e){
console.log(e)
}
const config = { const config = {
baseURL: this.baseUrl, baseURL: this.baseUrl,
headers: { headers: {
Authorization:"Bearer "+getToken() Authorization:"Bearer "+getToken(),
XAPPKEY:appkey?appkey:configapp.appkey
} }
} }
return config return config
...@@ -43,6 +52,7 @@ class HttpRequest { ...@@ -43,6 +52,7 @@ class HttpRequest {
this.queue[url] = true this.queue[url] = true
return config return config
}, error => { }, error => {
console.log(error)
return Promise.reject(error) return Promise.reject(error)
}) })
// 响应拦截 // 响应拦截
......
...@@ -107,7 +107,8 @@ export const getBreadCrumbList = (route, homeRoute) => { ...@@ -107,7 +107,8 @@ export const getBreadCrumbList = (route, homeRoute) => {
res = res.filter(item => { res = res.filter(item => {
return !item.meta.hideInMenu return !item.meta.hideInMenu
}) })
return [{ ...homeItem, to: homeRoute.path }, ...res] let rtn= [{ ...homeItem, to: homeRoute.path }, ...res]
return rtn
} }
export const getRouteTitleHandled = (route) => { export const getRouteTitleHandled = (route) => {
......
...@@ -10,7 +10,7 @@ Mock.setup({ ...@@ -10,7 +10,7 @@ Mock.setup({
}) })
// 登录相关和获取用户信息 // 登录相关和获取用户信息
Mock.mock(/\/login/, login) //Mock.mock(/\/login/, login)
//Mock.mock(/\/get_info/, getUserInfo) //Mock.mock(/\/get_info/, getUserInfo)
Mock.mock(/\/logout/, logout) Mock.mock(/\/logout/, logout)
//Mock.mock(/.*findAndCountAll/, getTableData) //Mock.mock(/.*findAndCountAll/, getTableData)
......
...@@ -85,7 +85,12 @@ ...@@ -85,7 +85,12 @@
<script> <script>
import Tables from "_c/tables"; import Tables from "_c/tables";
import Forms from "./forms/forms"; import Forms from "./forms/forms";
import { getTableData, saveFormData,deleteData,bulkDeleteData} from "@/api/data"; import {
getTableData,
saveFormData,
deleteData,
bulkDeleteData
} from "@/api/data";
export default { export default {
name: "biztables", name: "biztables",
components: { components: {
...@@ -117,16 +122,16 @@ export default { ...@@ -117,16 +122,16 @@ export default {
return []; return [];
} }
}, },
formatCol:{ formatCol: {
type:Function, type: Function,
default(){ default() {
return (row,key,index)=>row[key] return (row, key, index) => row[key];
} }
}, }
}, },
data() { data() {
return { return {
tblloading:false, tblloading: false,
metainfo: this.$store.getters[this.metaName], metainfo: this.$store.getters[this.metaName],
tableData: [], tableData: [],
isdel: false, isdel: false,
...@@ -151,7 +156,7 @@ export default { ...@@ -151,7 +156,7 @@ export default {
sumdata: {}, sumdata: {},
avgdata: {}, avgdata: {},
clickcount: { save: 0 }, clickcount: { save: 0 },
isrowdel:true isrowdel: true
}; };
}, },
methods: { methods: {
...@@ -188,33 +193,34 @@ export default { ...@@ -188,33 +193,34 @@ export default {
this.currentSels = sels; this.currentSels = sels;
}, },
delpost() { delpost() {
let url="" let url = "";
if(this.isrowdel){//行删除 if (this.isrowdel) {
let url=this.buildUrl("delete") //行删除
let data={id: this.currentRow.id} let url = this.buildUrl("delete");
deleteData(url,data).then(res=>{ let data = { id: this.currentRow.id };
if(res.data.data.status==0){ deleteData(url, data).then(res => {
this.$Message.success("当前记录已经成功删除."); if (res.data.data.status == 0) {
this.fetchData() this.$Message.success("当前记录已经成功删除.");
}else{ this.fetchData();
this.$Message.success("当前记录删除失败,请重试或联系管理员."); } else {
} this.$Message.success("当前记录删除失败,请重试或联系管理员.");
}) }
});
}else{//多行删除 } else {
let url=this.buildUrl("bulkDelete") //多行删除
let ids= this.currentSels.map(item=>{ let url = this.buildUrl("bulkDelete");
return item.id let ids = this.currentSels.map(item => {
}) return item.id;
bulkDeleteData(url,ids).then(res=>{ });
if(res.data.data.status==0){ bulkDeleteData(url, ids).then(res => {
this.$Message.success("批量删除已经成功完成."); if (res.data.data.status == 0) {
this.currentSels=[] this.$Message.success("批量删除已经成功完成.");
this.fetchData() this.currentSels = [];
}else{ this.fetchData();
this.$Message.success("当前删除失败,请重试或联系管理员."); } else {
} this.$Message.success("当前删除失败,请重试或联系管理员.");
}) }
});
} }
this.modal_loading = true; this.modal_loading = true;
setTimeout(() => { setTimeout(() => {
...@@ -227,14 +233,13 @@ export default { ...@@ -227,14 +233,13 @@ export default {
if (key == "delete") { if (key == "delete") {
this.currentRow = row; this.currentRow = row;
this.isdel = true; this.isdel = true;
this.isrowdel=true; this.isrowdel = true;
} }
if(key=="deletes"){ if (key == "deletes") {
if(this.currentSels.length==0){ if (this.currentSels.length == 0) {
} else {
}else{ this.isdel = true;
this.isdel = true; this.isrowdel = false;
this.isrowdel=false;
} }
} }
if (key == "edit") { if (key == "edit") {
...@@ -263,20 +268,20 @@ export default { ...@@ -263,20 +268,20 @@ export default {
msg = "当前的新增操作已成功."; msg = "当前的新增操作已成功.";
} }
saveFormData(url, row).then(res => { saveFormData(url, row).then(res => {
let rtn=res.data let rtn = res.data;
console.log(rtn) console.log(rtn);
if (rtn.status == 0) { if (rtn.status == 0) {
this.$refs.edform.resetForm(); this.$refs.edform.resetForm();
this.fm_status = "normal"; this.fm_status = "normal";
this.showedform = false; this.showedform = false;
this.clickcount["save"] = this.clickcount["save"] - 1; this.clickcount["save"] = this.clickcount["save"] - 1;
this.$Message.success(msg); this.$Message.success(msg);
this.fetchData() this.fetchData();
} else { } else {
this.fm_status = "normal"; this.fm_status = "normal";
this.showedform = false; this.showedform = false;
this.$Message.error("当前操作失败,请稍后重试或联系管理员."); this.$Message.error("当前操作失败,请稍后重试或联系管理员.");
this.fetchData() this.fetchData();
} }
}); });
} else { } else {
...@@ -287,8 +292,8 @@ export default { ...@@ -287,8 +292,8 @@ export default {
this.fm_status = "normal"; this.fm_status = "normal";
this.showedform = false; this.showedform = false;
this.$refs.edform.resetForm(); this.$refs.edform.resetForm();
if( this.clickcount["save"]==1){ if (this.clickcount["save"] == 1) {
this.clickcount["save"]=this.clickcount["save"]-1 this.clickcount["save"] = this.clickcount["save"] - 1;
} }
} }
if (key == "export") { if (key == "export") {
...@@ -317,26 +322,26 @@ export default { ...@@ -317,26 +322,26 @@ export default {
}, },
buildUrl(methodName) { buildUrl(methodName) {
let modelname = this.metaName.split("_")[0]; let modelname = this.metaName.split("_")[0];
console.log(modelname,">>>>>>>>>>>>>>>>>>") console.log(modelname, ">>>>>>>>>>>>>>>>>>");
let url = let url =
"/web/" + this.packageName + "/" + modelname + "Ctl/" + methodName; "/web/" + this.packageName + "/" + modelname + "Ctl/" + methodName;
return url; return url;
}, },
fetchData(q) { fetchData(q) {
let url = this.buildUrl("findAndCountAll"); let url = this.buildUrl("findAndCountAll");
let query = this.buildQuery(q); let query = this.buildQuery(q);
this.tblloading=true this.tblloading = true;
getTableData(url, query).then(res => { getTableData(url, query).then(res => {
let rtn=res.data let rtn = res.data;
if(rtn.status==0){ if (rtn.status == 0) {
console.log(res.data); console.log(res.data);
this.tableData = rtn.data.results.rows; this.tableData = rtn.data.results.rows;
this.pageInfo.total = rtn.data.results.count; this.pageInfo.total = rtn.data.results.count;
this.tblloading=false this.tblloading = false;
}else{ } else {
//this.$Message.error("查询数据有问题,请稍后重试或联系管理员"); //this.$Message.error("查询数据有问题,请稍后重试或联系管理员");
this.tblloading=false this.tblloading = false;
} }
}); });
} }
...@@ -347,11 +352,16 @@ export default { ...@@ -347,11 +352,16 @@ export default {
}, },
created() { created() {
if (this.isMulti && this.metainfo) { if (this.isMulti && this.metainfo) {
this.metainfo["list"].unshift({ let ft = this.metainfo["list"].filter(it => {
type: "selection", it.type == "selection";
width: 60,
align: "center"
}); });
if (!ft || (ft && ft.length==0)) {
this.metainfo["list"].unshift({
type: "selection",
width: 60,
align: "center"
});
}
} }
}, },
computed: { computed: {
...@@ -382,7 +392,7 @@ export default { ...@@ -382,7 +392,7 @@ export default {
}); });
this.metainfo["list"].forEach(c => { this.metainfo["list"].forEach(c => {
if (c.key == "handle") { if (c.key == "handle") {
c.button=[] c.button = [];
c.button.push(...listbtns); c.button.push(...listbtns);
} }
}); });
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
if(key=="roleName"){ if(key=="roleName"){
let rolestr=row.Roles.map(item=>item.name).join(",") let rolestr=row.Roles.map(item=>item.name).join(",")
row.roles=row.Roles.map(item=>item.id) row.roles=row.Roles.map(item=>item.id)
return `<span style="color:red">rolestr</span>` return `<span style="color:red">${rolestr}</span>`
} }
return row[key] return row[key]
} }
......
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