Commit 98820128 by 蒋勇

d

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