From fc2a3221959fd405975b5a6fd5053e512968045e Mon Sep 17 00:00:00 2001
From: wang <3597712270@qq.com>
Date: 星期四, 18 四月 2024 11:20:25 +0800
Subject: [PATCH] 获取接口方式
---
UI-Project/config.js | 13 +++-
UI-Project/src/layout/MainErpView.vue | 2
UI-Project/src/views/Returns/returns.vue | 161 ++++++++++++++++++++++++-----------------------------
UI-Project/src/utils/request.js | 2
UI-Project/src/views/LoginView.vue | 2
5 files changed, 85 insertions(+), 95 deletions(-)
diff --git a/UI-Project/config.js b/UI-Project/config.js
index dc510d3..4d69e8e 100644
--- a/UI-Project/config.js
+++ b/UI-Project/config.js
@@ -1,5 +1,10 @@
+// export default {
+// serverUrl: "localhost:8083/api/loadGlass",
+// serverUrl2: "localhost:8085"
+// //serverUrl:"res.abeim.cn"
+// }
export default {
- serverUrl: "localhost:8085",
- serverUrl2: "localhost:8085"
- //serverUrl:"res.abeim.cn"
-}
\ No newline at end of file
+ serverUrl: "localhost:88/api",
+ serverUrl2: "localhost:8085"
+ //serverUrl:"res.abeim.cn"
+ }
\ No newline at end of file
diff --git a/UI-Project/src/layout/MainErpView.vue b/UI-Project/src/layout/MainErpView.vue
index 4638722..c3c3623 100644
--- a/UI-Project/src/layout/MainErpView.vue
+++ b/UI-Project/src/layout/MainErpView.vue
@@ -24,7 +24,7 @@
//鎻愬彇妯″潡鍒楄〃
let menuList = $ref([])
-request.get('/menu/sysMenu/list').then((res) => {
+request.get('/loadGlass/menu/sysMenu/list').then((res) => {
if (res.code == 200) {
menuList = deepClone(res.data)
} else {
diff --git a/UI-Project/src/utils/request.js b/UI-Project/src/utils/request.js
index 2159de6..35f97cb 100644
--- a/UI-Project/src/utils/request.js
+++ b/UI-Project/src/utils/request.js
@@ -4,7 +4,7 @@
const userStore=useUserInfoStore()
const request = axios.create({
baseURL: `http://${config.serverUrl}`, // 娉ㄦ剰锛侊紒 杩欓噷鏄叏灞�缁熶竴鍔犱笂浜� 鍚庣鎺ュ彛鍓嶇紑 鍓嶇紑锛屽悗绔繀椤昏繘琛岃法鍩熼厤缃紒
- timeout: 5000
+ timeout: 30000
})
//
diff --git a/UI-Project/src/views/LoginView.vue b/UI-Project/src/views/LoginView.vue
index 43eea2f..70fd9e6 100644
--- a/UI-Project/src/views/LoginView.vue
+++ b/UI-Project/src/views/LoginView.vue
@@ -48,7 +48,7 @@
if (valid) {
loginLoadings.value = true
request
- .post('/userinfo/login', userForm)
+ .post('/loadGlass/userinfo/login', userForm)
.then((res) => {
if (res['code'] == 200) {
store.$patch({user: res.data})
diff --git a/UI-Project/src/views/Returns/returns.vue b/UI-Project/src/views/Returns/returns.vue
index 1a07941..97d7b27 100644
--- a/UI-Project/src/views/Returns/returns.vue
+++ b/UI-Project/src/views/Returns/returns.vue
@@ -15,14 +15,14 @@
import { ref, onMounted } from "vue";
// import http from "@/http/index";
-const tableData = ref([])
-let app = ref({
- data(){
- return {
- enableState:'',
- }
- },
- })
+// const tableData = ref([])
+// let app = ref({
+// data(){
+// return {
+// enableState:'',
+// }
+// },
+// })
// const tableData = ref({
// workstationId:'',
// patternWidth :'',
@@ -49,25 +49,66 @@
// router.push("/login")
// }
// });
-onMounted(() => {
- request
- .get("/LoadGlass/list")
+
+ // request
+ // const requestData = {
+ // projectNo:"P24030805",
+ // state:0
+ // };
+
+
+ const requestData = {
+ // projectNo:"P24030805",
+ state:100
+ };
+
+ const tableData = reactive([]);
+
+// 鍙戦�佽幏鍙栬〃鏍兼暟鎹殑璇锋眰
+const fetchTableData = async () => {
+ try {
+ // 鍙戦�佽幏鍙栬〃鏍兼暟鎹殑璇锋眰锛屽苟绛夊緟鍝嶅簲
+ // const response = await request.post("/loadGlass/optimizeProject/listByState", requestData);
+ const response = await request.get("/loadGlass/LoadGlass/list");
+
+ // 妫�鏌ュ搷搴旂姸鎬�
+ if (response.code === 200) {
+ // 鏇存柊琛ㄦ牸鏁版嵁
+ console.log('鎴愬姛鑾峰彇琛ㄦ牸鏁版嵁:', response.data);
+ tableData.splice(0, tableData.length, ...response.data);
+ } else {
+ // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ // 澶勭悊璇锋眰澶辫触鐨勬儏鍐�
+ ElMessage.error('鑾峰彇琛ㄦ牸鏁版嵁澶辫触锛岃閲嶈瘯');
+ }
+};
+const user = ref('');
+const remoteMethod = () => {
+ request.post("/loadGlass/optimizeProject/listByState", requestData)
.then((res: any) => {
- if (res.code == 200) {
+ // if (res.code == 200) {
tableData.value = res.data;
// let self = this
- }
+ // }
})
.catch((err: any) => {});
-});
-onMounted(() => {
- request
- .post("/LoadGlass/selectPriority")
- .then((res: any) => {
- tableData.value = res.data;
- })
- .catch((err: any) => {});
-});
+}
+
+
+onMounted(fetchTableData);
+
+
+// onMounted(() => {
+// request
+// .post("/loadGlass/LoadGlass/selectPriority")
+// .then((res: any) => {
+// tableData.value = res.data;
+// })
+// .catch((err: any) => {});
+// });
interface User {
id: string
name: string
@@ -102,58 +143,7 @@
}
}
}
-}
-const options = [
- {
- value: 'Option1',
- label: 'P202561456',
- },
- {
- value: 'Option2',
- label: 'P202561456',
- },
- {
- value: 'Option3',
- label: 'P202561456',
- },
- {
- value: 'Option4',
- label: 'P202561456',
- },
- {
- value: 'Option5',
- label: 'P202561456',
- },
-]
-// const tableData: User[] = [
-
-// {
-// id: 'P202561456',
-// long: '1005',
-// wide: '183.6',
-// thick: '1991',
-// },
-// {
-// id: 'P202561456',
-// long: '105',
-// wide: '183',
-// thick: '191',
-// }
-// ]
-// const tableDataa = [
-// {
-// long: '1005',
-// wide: '183.6',
-// thick: '1991',
-// station: '1'
-// },
-// {
-// long: '105',
-// wide: '183',
-// thick: '191',
-// station: '1'
-// }
-// ]
+}
const open = () => {
ElMessageBox.confirm(
'鏄惁鍒犻櫎璇ユ潯淇℃伅?',
@@ -255,7 +245,7 @@
:data="tableData"
:span-method="objectSpanMethod"
>
- <el-table-column prop="workstationId" label="宸ョ▼鍙�" width="200" align="center"/>
+ <el-table-column prop="workstationId" label="宸ョ▼鍙�" width="200" align="center"/>
<el-table-column prop="patternWidth" label="鍘熺墖瀹�" align="center"/>
<el-table-column prop="patternHeigth" label="鍘熺墖闀�" align="center"/>
<el-table-column prop="filmsId" label="鑶滅郴" align="center"/>
@@ -267,8 +257,8 @@
min-width="80"
prop="enableState"
>
- <el-tag type="success" v-if=" tableData.enableState == '1'">灏辩华</el-tag>
- <!-- <el-tag type="danger" v-if="this.enableState === '2'">鏈氨缁�</el-tag> -->
+ <el-tag type="success">灏辩华</el-tag>
+ <!-- <el-tag type="danger" v-if="row.enableState==2">鏈氨缁�</el-tag> -->
</el-table-column>
</el-table>
</div>
@@ -290,21 +280,16 @@
clearable
placeholder="璇烽�夋嫨宸ョ▼"
style="width: 300px"
+ filterable
+ :remote-method="remoteMethod"
>
<el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
+ v-for="item in remoteMethod"
+ :key="item.projectNo"
+ :label="item.projectNo"
+ :value="item.projectNo"
/>
</el-select>
- <!-- <el-select clearable filterable size="mini" v-model="form.fvId"
- style="margin-right: 50px;width: 200px" placeholder="璇烽�夋嫨鏋滆敩绉嶇被">
- <el-option v-for="item in billall"
- :key="item.id"
- :label="item.fruitVagetableCate"
- :value="item.id"></el-option>
- </el-select> -->
</el-form-item>
</div>
<template #footer>
--
Gitblit v1.8.0