diff --git a/src/main.js b/src/main.js
index e62deec..9c3c051 100644
--- a/src/main.js
+++ b/src/main.js
@@ -13,7 +13,9 @@ axios.defaults.baseURL='https://a99zg89a.xiaomy.net'
axios.interceptors.request.use(config => {
config.headers.Authorization = "Basic c2FiZXI6c2FiZXJfc2VjcmV0"
- console.log(config.headers)
+
+ config.headers.common['Blade-Auth'] =localStorage.token
+
return config
})
let app=createApp(App)
diff --git a/src/view/login.vue b/src/view/login.vue
index 2ed690f..94ca32e 100644
--- a/src/view/login.vue
+++ b/src/view/login.vue
@@ -45,12 +45,8 @@ export default {
this.axios
.post("/hysc/auth/token", param)
.then(function (response) {
- console.log(response.data,"登录");
if (response.data.code == 200) {
-
- that.axios.defaults.headers.common['Blade-Auth'] ="bearer "+response.data.data.accessToken
- console.log( that.axios.defaults.headers);
- console.log();
+ localStorage.token="bearer "+response.data.data.accessToken
that.$router.push("/index");
}else{
that.$alert(response.data.msg,"登录失败", {
diff --git a/src/view/projectManagement.vue b/src/view/projectManagement.vue
index 605ad19..8f14602 100644
--- a/src/view/projectManagement.vue
+++ b/src/view/projectManagement.vue
@@ -12,7 +12,7 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
- Remove
+ 删除
@@ -54,15 +58,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 新建项目
+ 取消新建
+
+
+
+
+
@@ -78,8 +119,16 @@ export default {
},
data() {
return {
+ addProjectData:{
+ projectName:"",
+ projectUnit:"",
+ projectNote:""
+ },
+ drawer: false,
+ direction: "rtl",
projectName: "",
projectDate: "",
+
projectData: {
current: 1,
endTime: "",
@@ -87,98 +136,108 @@ export default {
size: "",
startTime: "",
},
- tableData: [
- {
- date: "2016-05-03",
- name: "王小虎",
- province: "上海",
- city: "普陀区",
- address: "上海市普陀区金沙江路 1518 弄",
- zip: 200333,
- },
- {
- date: "2016-05-02",
- name: "王小虎",
- province: "上海",
- city: "普陀区",
- address: "上海市普陀区金沙江路 1518 弄",
- zip: 200333,
- },
- {
- date: "2016-05-04",
- name: "王小虎",
- province: "上海",
- city: "普陀区",
- address: "上海市普陀区金沙江路 1518 弄",
- zip: 200333,
- },
- {
- date: "2016-05-01",
- name: "王小虎",
- province: "上海",
- city: "普陀区",
- address: "上海市普陀区金沙江路 1518 弄",
- zip: 200333,
- },
- {
- date: "2016-05-08",
- name: "王小虎",
- province: "上海",
- city: "普陀区",
- address: "上海市普陀区金沙江路 1518 弄",
- zip: 200333,
- },
- {
- date: "2016-05-06",
- name: "王小虎",
- province: "上海",
- city: "普陀区",
- address: "上海市普陀区金沙江路 1518 弄",
- zip: 200333,
- },
- {
- date: "2016-05-07",
- name: "王小虎",
- province: "上海",
- city: "普陀区",
- address: "上海市普陀区金沙江路 1518 弄",
- zip: 200333,
- },
- {
- date: "2016-05-07",
- name: "王小虎",
- province: "上海",
- city: "普陀区",
- address: "上海市普陀区金沙江路 1518 弄",
- zip: 200333,
- },
- ],
+ tableData: [],
+ pickerOptions: {
+ shortcuts: [
+ {
+ text: "本月",
+ onClick(picker) {
+ picker.$emit("pick", [new Date(), new Date()]);
+ },
+ },
+ {
+ text: "今年至今",
+ onClick(picker) {
+ const end = new Date();
+ const start = new Date(new Date().getFullYear(), 0);
+ picker.$emit("pick", [start, end]);
+ },
+ },
+ {
+ text: "最近六个月",
+ onClick(picker) {
+ const end = new Date();
+ const start = new Date();
+ start.setMonth(start.getMonth() - 6);
+ picker.$emit("pick", [start, end]);
+ },
+ },
+ ],
+ },
};
},
mounted() {
+ // 初始化获取数据
this.getProject();
},
methods: {
+ handleClose() {
+
+ this.drawer=false
+ },
deleteRow(index) {
console.log(index);
this.tableData.splice(index, 1);
},
- queryProject() {
- this.getProject();
- },
- getProject() {
- let param = new URLSearchParams();
+ // 时间格式转换
+ newDate(data) {
+ let yy = new Date(data).getFullYear();
+ let mm = new Date(data).getMonth() + 1;
+ let dd = new Date(data).getDate();
+ // let hh = new Date(data).getHours();
+ // let mf = new Date(data).getMinutes();
+ // let ss = new Date(data).getSeconds();
+ return yy + "-" + mm + "-" + "-" + dd;
+ },
+ // 打开弹窗
+ addProject(){
+ this.drawer=true
+ console.log( this.drawer);
+ },
+ addProjectManagement(){
+ let param = new URLSearchParams();
+
param.append("current", this.projectData.current);
param.append("endTime", this.projectData.endTime);
param.append("name", this.projectData.name);
param.append("size", this.projectData.size);
param.append("startTime", this.projectData.startTime);
-
+ let that = this;
this.axios
.get("/hysc/project/getProjectPage", param)
.then(function (response) {
- console.log(response);
+ console.log(response.data);
+
+ that.tableData = response.data.data.records;
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+
+ },
+ // 查询
+ queryProject() {
+ this.projectData.startTime = this.newDate(this.projectDate[0]);
+ this.projectData.endTime = this.newDate(this.projectDate[1]);
+ this.projectData.name = this.projectName;
+ this.getProject();
+ },
+ // 获取列表数据
+ getProject() {
+ let param = new URLSearchParams();
+ param.append("current", this.projectData.current);
+ param.append("endTime", this.projectData.endTime);
+ param.append("name", this.projectData.name);
+ param.append("size", this.projectData.size);
+ param.append("startTime", this.projectData.startTime);
+ let that = this;
+ this.axios
+ .get("/hysc/project/getProjectPage", param)
+ .then(function (response) {
+ console.log(response.data);
+
+ that.tableData = response.data.data.records;
})
.catch(function (error) {
console.log(error);
@@ -222,6 +281,9 @@ export default {
.searchInput .el-input__inner {
height: 40px;
}
+.elementUl .el-input__inner {
+ height: 40px;
+}
.searchInput {
margin-right: 10px;
width: 340px;