From 2fa9c764993b4a7ad51754d0e8587990f96f1529 Mon Sep 17 00:00:00 2001
From: 曹睿 <360930172@qq.com>
Date: 星期二, 22 四月 2025 16:33:27 +0800
Subject: [PATCH] feat: 完成至扫码
---
src/pages/production/twist/receive/monofil.vue | 68 ++-
src/types/global.d.ts | 2
src/pages/production/detail/wireDetail.vue | 33 +
src/components/worker-calling-card/index.vue | 25 +
src/pages/production/twist/report/index.vue | 58 ++-
src/pages/production/components/ProductionCard.vue | 8
src/models/base.ts | 13
src/enums/ResultCodeEnum.ts | 2
src/pages/production/wire/report/wire.vue | 83 +++-
src/pages/login/index.vue | 6
src/pages/production/list/index.vue | 80 ++++
src/api/product/wire.ts | 24 +
src/api/product/manage.ts | 41 ++
src/utils/request.ts | 5
src/api/auth/index.ts | 5
src/store/modules/user.ts | 17
src/pages/index/index.vue | 4
src/api/system/user.ts | 7
src/main.ts | 1
.env.development | 4
src/api/product/twist.ts | 24 +
src/components/z-paging-swiper-item/z-paging-swiper-item.vue | 303 +++++++++--------
src/pages/production/wire/report/wireForm.vue | 68 ++-
src/pages/production/detail/twistDetail.vue | 33 +
src/pages/production/index.vue | 61 +--
src/components/product_card/index.vue | 20
26 files changed, 657 insertions(+), 338 deletions(-)
diff --git a/.env.development b/.env.development
index c706c2c..a01cc4d 100644
--- a/.env.development
+++ b/.env.development
@@ -4,7 +4,7 @@
VITE_APP_PORT = 4096
# API 鍩虹璺緞锛屽紑鍙戠幆澧冧笅鐨勮姹傚墠缂�
-VITE_APP_BASE_API = '/mes'
+VITE_APP_BASE_API = 'http://114.132.189.42:7002/mes'
# API 鏈嶅姟鍣ㄧ殑 URL
-VITE_APP_API_URL = 'http://114.132.189.42:7002'
+VITE_APP_API_URL = 'http://114.132.189.42:7002/mes'
diff --git a/src/api/auth/index.ts b/src/api/auth/index.ts
index 8a40613..3437285 100644
--- a/src/api/auth/index.ts
+++ b/src/api/auth/index.ts
@@ -9,14 +9,10 @@
* @returns 杩斿洖 token
*/
login(data: LoginFormData): Promise<LoginResult> {
- console.log("data", data);
return request<LoginResult>({
url: "/login",
method: "POST",
data: data,
- header: {
- "Content-Type": "application/x-www-form-urlencoded",
- },
});
},
@@ -53,6 +49,7 @@
/** 鐧诲綍鍝嶅簲 */
export interface LoginResult {
/** 璁块棶token */
+ token: string;
accessToken: string;
/** token 绫诲瀷 */
tokenType?: string;
diff --git a/src/api/product/manage.ts b/src/api/product/manage.ts
new file mode 100644
index 0000000..a8dad1b
--- /dev/null
+++ b/src/api/product/manage.ts
@@ -0,0 +1,41 @@
+import request from "@/utils/request";
+import { BaseResult } from "@/models/base";
+
+const ManageApi = {
+ getProductList(params: any) {
+ return request<BaseResult<any>>({
+ url: "/app/intoProduction",
+ method: "GET",
+ data: params,
+ });
+ },
+
+ // 鏌ヨ鎷変笣缁炵嚎鎶ュ伐
+ getReportList(params: any) {
+ return request<BaseResult<any>>({
+ url: "/app/getWireOutput",
+ method: "GET",
+ data: params,
+ });
+ },
+
+ // 鏌ヨ鑷淇℃伅
+ getSelfInspection(params: any) {
+ return request<BaseResult<any>>({
+ url: "/app/getSelfInspection",
+ method: "GET",
+ data: params,
+ });
+ },
+
+ // 鏌ヨ棰嗙敤淇℃伅
+ getStrandedWireDish(params: any) {
+ return request<BaseResult<any>>({
+ url: "/app/getStrandedWireDish",
+ method: "GET",
+ data: params,
+ });
+ },
+};
+
+export default ManageApi;
diff --git a/src/api/product/twist.ts b/src/api/product/twist.ts
new file mode 100644
index 0000000..7f980af
--- /dev/null
+++ b/src/api/product/twist.ts
@@ -0,0 +1,24 @@
+import request from "@/utils/request";
+import { BaseResult } from "@/models/base";
+
+const TwistApi = {
+ // 鑾峰彇鎷変笣璇︽儏
+ getTwistDetailById(params: any) {
+ return request<BaseResult<any>>({
+ url: "/app/getById1",
+ method: "GET",
+ data: params,
+ });
+ },
+
+ // 鏂板鎷変笣鎶ュ伐
+ addWireOutput(data: any) {
+ return request<BaseResult<any>>({
+ url: "/app/addWireOutput",
+ method: "POST",
+ data: data,
+ });
+ },
+};
+
+export default TwistApi;
diff --git a/src/api/product/wire.ts b/src/api/product/wire.ts
new file mode 100644
index 0000000..0f192f7
--- /dev/null
+++ b/src/api/product/wire.ts
@@ -0,0 +1,24 @@
+import request from "@/utils/request";
+import { BaseResult } from "@/models/base";
+
+const WireApi = {
+ // 鑾峰彇鎷変笣璇︽儏
+ getWireDetailById(params: any) {
+ return request<BaseResult<any>>({
+ url: "/app/getById",
+ method: "GET",
+ data: params,
+ });
+ },
+
+ // 鏂板鎷変笣鎶ュ伐
+ addWireOutput(data: any) {
+ return request<BaseResult<any>>({
+ url: "/app/addWireOutput",
+ method: "POST",
+ data: data,
+ });
+ },
+};
+
+export default WireApi;
diff --git a/src/api/system/user.ts b/src/api/system/user.ts
index c7cf28d..c66b874 100644
--- a/src/api/system/user.ts
+++ b/src/api/system/user.ts
@@ -10,7 +10,7 @@
*/
getUserInfo(): Promise<UserInfo> {
return request<UserInfo>({
- url: `${USER_BASE_URL}/me`,
+ url: `/getUserInfo`,
method: "GET",
});
},
@@ -142,11 +142,14 @@
export interface UserInfo {
/** 鐢ㄦ埛ID */
userId?: number;
+ roleName?: string;
+ userName?: string;
/** 鐢ㄦ埛鍚� */
username?: string;
/** 鏄电О */
+ nickName?: string;
nickname?: string;
/** 澶村儚URL */
@@ -157,6 +160,8 @@
/** 鏉冮檺 */
perms?: string[];
+ user?: any;
+ role?: any;
}
/**
diff --git a/src/components/product_card/index.vue b/src/components/product_card/index.vue
index d0ffa6e..799875e 100644
--- a/src/components/product_card/index.vue
+++ b/src/components/product_card/index.vue
@@ -2,9 +2,9 @@
<wd-card class="card_bg">
<template #title>
<view class="flex justify-between w-full">
- <text class="font-medium text-[#252525]">璁惧缂栧彿: 1234567891</text>
+ <text class="font-medium text-[#252525]">璁惧缂栧彿: {{ data.deviceModel }}</text>
<wd-tag color="#0D867F" bg-color="#E7F4EC">
- <text class="text-xs">JL/B20-400-35</text>
+ <text class="text-xs">{{ data.model }}</text>
</wd-tag>
</view>
</template>
@@ -16,7 +16,7 @@
</view>
<text class="text-[#646874] mx-2">
鎬婚渶姹傛暟閲�:
- <text class="text-[#252525]">274m</text>
+ <text class="text-[#252525]">{{ data.totalAmount }}m</text>
</text>
</view>
</wd-col>
@@ -29,7 +29,7 @@
</view>
<text class="text-[#646874] mx-2">
宸茬敓浜ф暟閲�:
- <text class="text-[#252525]">202m</text>
+ <text class="text-[#252525]">{{ data.amount }}m</text>
</text>
</view>
</wd-col>
@@ -40,7 +40,7 @@
</view>
<text class="text-[#646874] mx-2">
寰呮帓浜ф暟閲�:
- <text class="text-[#252525]">72m</text>
+ <text class="text-[#252525]">{{ data.unAmount }}m</text>
</text>
</view>
</wd-col>
@@ -48,9 +48,17 @@
</wd-card>
</template>
+<script setup lang="ts">
+defineProps({
+ data: {
+ type: Object,
+ default: () => {},
+ },
+});
+</script>
+
<style lang="scss" scoped>
.card_bg {
- margin-top: 12px;
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.05);
padding-bottom: 10px;
}
diff --git a/src/components/worker-calling-card/index.vue b/src/components/worker-calling-card/index.vue
index 1f8be3b..8a0ee70 100644
--- a/src/components/worker-calling-card/index.vue
+++ b/src/components/worker-calling-card/index.vue
@@ -3,12 +3,12 @@
<template #title>
<view>
<text class="font-medium">
- 鍛ㄧ惣鐜�
- <text class="text-[#0D867F] text-xs">路鐢熶骇鎿嶄綔宸�</text>
+ {{ user.nickName }}
+ <text class="text-[#0D867F] text-xs">路{{ user.roleName }}</text>
</text>
</view>
<view>
- <text class="font-medium text-[#3D3D3D] text-sm">宸ュ彿: sc1989201</text>
+ <text class="font-medium text-[#3D3D3D] text-sm">宸ュ彿: {{ user.userName }}</text>
</view>
</template>
<view class="mt-2">
@@ -16,7 +16,24 @@
</view>
</wd-cell>
</template>
-<script setup lang="ts"></script>
+<script setup lang="ts">
+import { useUserStore } from "@/store/modules/user";
+import { nextTick } from "vue";
+const userStore = useUserStore();
+const userInfo: any = computed(() => userStore.userInfo);
+const user = reactive({
+ nickName: "",
+ userName: "",
+ roleName: "",
+});
+
+onLoad(() => {
+ nextTick();
+ user.nickName = userInfo.value.user?.nickName;
+ user.userName = userInfo.value.user?.userName;
+ user.roleName = userInfo.value.user?.roles[0].roleName;
+});
+</script>
<style lang="scss" scoped>
.calling_card {
background: #fff;
diff --git a/src/components/z-paging-swiper-item/z-paging-swiper-item.vue b/src/components/z-paging-swiper-item/z-paging-swiper-item.vue
index bf40f14..5852b81 100644
--- a/src/components/z-paging-swiper-item/z-paging-swiper-item.vue
+++ b/src/components/z-paging-swiper-item/z-paging-swiper-item.vue
@@ -5,156 +5,167 @@
<!-- 婊戝姩鍒囨崲閫夐」鍗wiper-item锛屾缁勪欢鏀寔easycom瑙勮寖锛屽彲浠ュ湪椤圭洰涓洿鎺ュ紩鐢� -->
<template>
- <view class="zp-swiper-item-container">
- <z-paging ref="paging" :fixed="false"
- :auto="false" :useVirtualList="useVirtualList" :useInnerList="useInnerList" :cellKeyName="cellKeyName" :innerListStyle="innerListStyle"
- :preloadPage="preloadPage" :cellHeightMode="cellHeightMode" :virtualScrollFps="virtualScrollFps" :virtualListCol="virtualListCol"
- @query="_queryList" @listChange="_updateList">
- <slot />
- <template #header>
- <slot name="header"/>
- </template>
- <template #cell="{item,index}">
- <slot name="cell" :item="item" :index="index"/>
- </template>
- <template #footer>
- <slot name="footer"/>
- </template>
- </z-paging>
- </view>
+ <view class="zp-swiper-item-container">
+ <z-paging
+ ref="paging"
+ :fixed="false"
+ :auto="false"
+ :useVirtualList="useVirtualList"
+ :useInnerList="useInnerList"
+ :cellKeyName="cellKeyName"
+ :innerListStyle="innerListStyle"
+ :preloadPage="preloadPage"
+ :cellHeightMode="cellHeightMode"
+ :virtualScrollFps="virtualScrollFps"
+ :virtualListCol="virtualListCol"
+ @query="_queryList"
+ @listChange="_updateList"
+ >
+ <slot />
+ <template #header>
+ <slot name="header" />
+ </template>
+ <template #cell="{ item, index }">
+ <slot name="cell" :item="item" :index="index" />
+ </template>
+ <template #footer>
+ <slot name="footer" />
+ </template>
+ </z-paging>
+ </view>
</template>
<script>
- import zPaging from '../z-paging/z-paging'
- /**
- * z-paging-swiper-item 缁勪欢
- * @description swiper+list鏋佺畝鍐欐硶涓娇鐢ㄥ埌锛屽疄闄呬笂灏辨槸瀵规櫘閫氱殑swiper+list涓璼wiper-item鐨勫寘瑁呭皝瑁咃紝鐢ㄤ互绠�鍖栧啓娉曪紝浣嗕釜鎬у寲閰嶇疆灞�闄愯緝澶�
- * @tutorial https://z-paging.zxlee.cn/api/sub-components/main.html#z-paging-swiper-item閰嶇疆
- * @notice 浠ヤ笅涓� z-paging-swiper-item 鐨勯厤缃」
- * @property {Number} tabIndex 褰撳墠缁勪欢鐨� index锛屼篃灏辨槸褰撳墠缁勪欢鏄� swiper 涓殑绗嚑涓紝榛樿涓� 0
- * @property {Number} currentIndex 褰撳墠 swiper 鍒囨崲鍒扮鍑犱釜 index锛岄粯璁や负 0
- * @property {Boolean} useVirtualList 鏄惁浣跨敤铏氭嫙鍒楄〃锛岄粯璁や负 false
- * @property {Boolean} useInnerList 鏄惁鍦� z-paging 鍐呴儴寰幆娓叉煋鍒楄〃锛堝唴缃垪琛級锛岄粯璁や负 false銆傝嫢 useVirtualList 涓� true锛屽垯姝ら」鎭掍负 true
- * @property {String} cellKeyName 鍐呯疆鍒楄〃 cell 鐨� key 鍚嶇О锛屼粎 nvue 鏈夋晥锛屽湪 nvue 涓紑鍚� useInnerList 鏃跺繀椤诲~姝ら」锛岄粯璁や负 ''
- * @property {Object} innerListStyle innerList 鏍峰紡锛岄粯璁や负 {}
- * @property {Number|String} preloadPage 棰勫姞杞界殑鍒楄〃鍙鑼冨洿锛堝垪琛ㄩ珮搴︼級椤垫暟锛岄粯璁や负 12銆傛鏁板�艰秺澶э紝鍒欒櫄鎷熷垪琛ㄤ腑鍔犺浇鐨� dom 瓒婂锛屽唴瀛樻秷鑰楄秺澶э紙浼氱淮鎸佸湪涓�涓ǔ瀹氬�硷級锛屼絾澧炲姞棰勫姞杞介〉闈㈡暟閲忓彲缂撹В蹇�熸粴鍔ㄧ煭鏆傜櫧灞忛棶棰�
- * @property {String} cellHeightMode 铏氭嫙鍒楄〃 cell 楂樺害妯″紡锛岄粯璁や负 'fixed'锛屼篃灏辨槸姣忎釜 cell 楂樺害瀹屽叏鐩稿悓锛屽皢浠ョ涓�涓� cell 楂樺害涓哄噯杩涜璁$畻銆傚彲閫夊�笺�恉ynamic銆戯紝鍗充唬琛ㄩ珮搴︽槸鍔ㄦ�侀潪鍥哄畾鐨勶紝銆恉ynamic銆戞�ц兘浣庝簬銆恌ixed銆�
- * @property {Number|String} virtualListCol 铏氭嫙鍒楄〃鍒楁暟锛岄粯璁や负 1銆傚父鐢ㄤ簬姣忚鏈夊鍒楃殑鎯呭喌锛屼緥濡傛瘡琛屾湁 2 鍒楁暟鎹紝闇�瑕佸皢姝ゅ�艰缃负 2
- * @property {Number|String} virtualScrollFps 铏氭嫙鍒楄〃 scroll 鍙栨牱甯х巼锛岄粯璁や负 60锛岃繃楂樺彲鑳藉嚭鐜板崱椤跨瓑闂
- * @example <z-paging-swiper-item ref="swiperItem" :tabIndex="index" :currentIndex="current" @query="queryList" @updateList="updateList"></z-paging-swiper-item>
- */
- export default {
- name: "z-paging-swiper-item",
- components: { zPaging },
- data() {
- return {
- firstLoaded: false
- }
- },
- props: {
- // 褰撳墠缁勪欢鐨刬ndex锛屼篃灏辨槸褰撳墠缁勪欢鏄痵wiper涓殑绗嚑涓�
- tabIndex: {
- type: Number,
- default: function() {
- return 0
- }
- },
- // 褰撳墠swiper鍒囨崲鍒扮鍑犱釜index
- currentIndex: {
- type: Number,
- default: function() {
- return 0
- }
- },
- // 鏄惁浣跨敤铏氭嫙鍒楄〃锛岄粯璁や负鍚�
- useVirtualList: {
- type: Boolean,
- default: false
- },
- // 鏄惁鍦▃-paging鍐呴儴寰幆娓叉煋鍒楄〃(鍐呯疆鍒楄〃)锛岄粯璁や负鍚︺�傝嫢use-virtual-list涓簍rue锛屽垯姝ら」鎭掍负true
- useInnerList: {
- type: Boolean,
- default: false
- },
- // 鍐呯疆鍒楄〃cell鐨刱ey鍚嶇О锛屼粎nvue鏈夋晥锛屽湪nvue涓紑鍚痷se-inner-list鏃跺繀椤诲~姝ら」
- cellKeyName: {
- type: String,
- default: ''
- },
- // innerList鏍峰紡
- innerListStyle: {
- type: Object,
- default: function() {
- return {};
- }
- },
- // 棰勫姞杞界殑鍒楄〃鍙鑼冨洿(鍒楄〃楂樺害)椤垫暟锛岄粯璁や负12锛屽嵆棰勫姞杞藉綋鍓嶉〉鍙婁笂涓嬪悇12椤电殑cell銆傛鏁板�艰秺澶э紝鍒欒櫄鎷熷垪琛ㄤ腑鍔犺浇鐨刣om瓒婂锛屽唴瀛樻秷鑰楄秺澶�(浼氱淮鎸佸湪涓�涓ǔ瀹氬��)锛屼絾澧炲姞棰勫姞杞介〉闈㈡暟閲忓彲缂撹В蹇�熸粴鍔ㄧ煭鏆傜櫧灞忛棶棰�
- preloadPage: {
- type: [Number, String],
- default: 12
- },
- // 铏氭嫙鍒楄〃cell楂樺害妯″紡锛岄粯璁や负fixed锛屼篃灏辨槸姣忎釜cell楂樺害瀹屽叏鐩稿悓锛屽皢浠ョ涓�涓猚ell楂樺害涓哄噯杩涜璁$畻銆傚彲閫夊�笺�恉ynamic銆戯紝鍗充唬琛ㄩ珮搴︽槸鍔ㄦ�侀潪鍥哄畾鐨勶紝銆恉ynamic銆戞�ц兘浣庝簬銆恌ixed銆戙��
- cellHeightMode: {
- type: String,
- default: 'fixed'
- },
- // 铏氭嫙鍒楄〃鍒楁暟锛岄粯璁や负1銆傚父鐢ㄤ簬姣忚鏈夊鍒楃殑鎯呭喌锛屼緥濡傛瘡琛屾湁2鍒楁暟鎹紝闇�瑕佸皢姝ゅ�艰缃负2
- virtualListCol: {
- type: [Number, String],
- default: 1
- },
- // 铏氭嫙鍒楄〃scroll鍙栨牱甯х巼锛岄粯璁や负60锛岃繃楂樺彲鑳藉嚭鐜板崱椤跨瓑闂
- virtualScrollFps: {
- type: [Number, String],
- default: 60
- },
- },
- watch: {
- currentIndex: {
- handler(newVal, oldVal) {
- if (newVal === this.tabIndex) {
- // 鎳掑姞杞斤紝褰撴粦鍔ㄥ埌褰撳墠鐨刬tem鏃讹紝鎵嶅幓鍔犺浇
- if (!this.firstLoaded) {
- this.$nextTick(()=>{
- let delay = 5;
- // #ifdef MP-TOUTIAO
- delay = 100;
- // #endif
- setTimeout(() => {
- this.$refs.paging.reload().catch(() => {});
- }, delay);
- })
- }
- }
- },
- immediate: true
- }
- },
- methods: {
- reload(data) {
- return this.$refs.paging.reload(data);
- },
- complete(data) {
- this.firstLoaded = true;
- return this.$refs.paging.complete(data);
- },
- _queryList(pageNo, pageSize, from) {
- this.$emit('query', pageNo, pageSize, from);
- },
- _updateList(list) {
- this.$emit('updateList', list);
- }
- }
- }
+import zPaging from "../z-paging/z-paging";
+/**
+ * z-paging-swiper-item 缁勪欢
+ * @description swiper+list鏋佺畝鍐欐硶涓娇鐢ㄥ埌锛屽疄闄呬笂灏辨槸瀵规櫘閫氱殑swiper+list涓璼wiper-item鐨勫寘瑁呭皝瑁咃紝鐢ㄤ互绠�鍖栧啓娉曪紝浣嗕釜鎬у寲閰嶇疆灞�闄愯緝澶�
+ * @tutorial https://z-paging.zxlee.cn/api/sub-components/main.html#z-paging-swiper-item閰嶇疆
+ * @notice 浠ヤ笅涓� z-paging-swiper-item 鐨勯厤缃」
+ * @property {Number} tabIndex 褰撳墠缁勪欢鐨� index锛屼篃灏辨槸褰撳墠缁勪欢鏄� swiper 涓殑绗嚑涓紝榛樿涓� 0
+ * @property {Number} currentIndex 褰撳墠 swiper 鍒囨崲鍒扮鍑犱釜 index锛岄粯璁や负 0
+ * @property {Boolean} useVirtualList 鏄惁浣跨敤铏氭嫙鍒楄〃锛岄粯璁や负 false
+ * @property {Boolean} useInnerList 鏄惁鍦� z-paging 鍐呴儴寰幆娓叉煋鍒楄〃锛堝唴缃垪琛級锛岄粯璁や负 false銆傝嫢 useVirtualList 涓� true锛屽垯姝ら」鎭掍负 true
+ * @property {String} cellKeyName 鍐呯疆鍒楄〃 cell 鐨� key 鍚嶇О锛屼粎 nvue 鏈夋晥锛屽湪 nvue 涓紑鍚� useInnerList 鏃跺繀椤诲~姝ら」锛岄粯璁や负 ''
+ * @property {Object} innerListStyle innerList 鏍峰紡锛岄粯璁や负 {}
+ * @property {Number|String} preloadPage 棰勫姞杞界殑鍒楄〃鍙鑼冨洿锛堝垪琛ㄩ珮搴︼級椤垫暟锛岄粯璁や负 12銆傛鏁板�艰秺澶э紝鍒欒櫄鎷熷垪琛ㄤ腑鍔犺浇鐨� dom 瓒婂锛屽唴瀛樻秷鑰楄秺澶э紙浼氱淮鎸佸湪涓�涓ǔ瀹氬�硷級锛屼絾澧炲姞棰勫姞杞介〉闈㈡暟閲忓彲缂撹В蹇�熸粴鍔ㄧ煭鏆傜櫧灞忛棶棰�
+ * @property {String} cellHeightMode 铏氭嫙鍒楄〃 cell 楂樺害妯″紡锛岄粯璁や负 'fixed'锛屼篃灏辨槸姣忎釜 cell 楂樺害瀹屽叏鐩稿悓锛屽皢浠ョ涓�涓� cell 楂樺害涓哄噯杩涜璁$畻銆傚彲閫夊�笺�恉ynamic銆戯紝鍗充唬琛ㄩ珮搴︽槸鍔ㄦ�侀潪鍥哄畾鐨勶紝銆恉ynamic銆戞�ц兘浣庝簬銆恌ixed銆�
+ * @property {Number|String} virtualListCol 铏氭嫙鍒楄〃鍒楁暟锛岄粯璁や负 1銆傚父鐢ㄤ簬姣忚鏈夊鍒楃殑鎯呭喌锛屼緥濡傛瘡琛屾湁 2 鍒楁暟鎹紝闇�瑕佸皢姝ゅ�艰缃负 2
+ * @property {Number|String} virtualScrollFps 铏氭嫙鍒楄〃 scroll 鍙栨牱甯х巼锛岄粯璁や负 60锛岃繃楂樺彲鑳藉嚭鐜板崱椤跨瓑闂
+ * @example <z-paging-swiper-item ref="swiperItem" :tabIndex="index" :currentIndex="current" @query="queryList" @updateList="updateList"></z-paging-swiper-item>
+ */
+export default {
+ name: "z-paging-swiper-item",
+ components: { zPaging },
+ props: {
+ // 褰撳墠缁勪欢鐨刬ndex锛屼篃灏辨槸褰撳墠缁勪欢鏄痵wiper涓殑绗嚑涓�
+ tabIndex: {
+ type: Number,
+ default: function () {
+ return 0;
+ },
+ },
+ // 褰撳墠swiper鍒囨崲鍒扮鍑犱釜index
+ currentIndex: {
+ type: Number,
+ default: function () {
+ return 0;
+ },
+ },
+ // 鏄惁浣跨敤铏氭嫙鍒楄〃锛岄粯璁や负鍚�
+ useVirtualList: {
+ type: Boolean,
+ default: false,
+ },
+ // 鏄惁鍦▃-paging鍐呴儴寰幆娓叉煋鍒楄〃(鍐呯疆鍒楄〃)锛岄粯璁や负鍚︺�傝嫢use-virtual-list涓簍rue锛屽垯姝ら」鎭掍负true
+ useInnerList: {
+ type: Boolean,
+ default: false,
+ },
+ // 鍐呯疆鍒楄〃cell鐨刱ey鍚嶇О锛屼粎nvue鏈夋晥锛屽湪nvue涓紑鍚痷se-inner-list鏃跺繀椤诲~姝ら」
+ cellKeyName: {
+ type: String,
+ default: "",
+ },
+ // innerList鏍峰紡
+ innerListStyle: {
+ type: Object,
+ default: function () {
+ return {};
+ },
+ },
+ // 棰勫姞杞界殑鍒楄〃鍙鑼冨洿(鍒楄〃楂樺害)椤垫暟锛岄粯璁や负12锛屽嵆棰勫姞杞藉綋鍓嶉〉鍙婁笂涓嬪悇12椤电殑cell銆傛鏁板�艰秺澶э紝鍒欒櫄鎷熷垪琛ㄤ腑鍔犺浇鐨刣om瓒婂锛屽唴瀛樻秷鑰楄秺澶�(浼氱淮鎸佸湪涓�涓ǔ瀹氬��)锛屼絾澧炲姞棰勫姞杞介〉闈㈡暟閲忓彲缂撹В蹇�熸粴鍔ㄧ煭鏆傜櫧灞忛棶棰�
+ preloadPage: {
+ type: [Number, String],
+ default: 12,
+ },
+ // 铏氭嫙鍒楄〃cell楂樺害妯″紡锛岄粯璁や负fixed锛屼篃灏辨槸姣忎釜cell楂樺害瀹屽叏鐩稿悓锛屽皢浠ョ涓�涓猚ell楂樺害涓哄噯杩涜璁$畻銆傚彲閫夊�笺�恉ynamic銆戯紝鍗充唬琛ㄩ珮搴︽槸鍔ㄦ�侀潪鍥哄畾鐨勶紝銆恉ynamic銆戞�ц兘浣庝簬銆恌ixed銆戙��
+ cellHeightMode: {
+ type: String,
+ default: "fixed",
+ },
+ // 铏氭嫙鍒楄〃鍒楁暟锛岄粯璁や负1銆傚父鐢ㄤ簬姣忚鏈夊鍒楃殑鎯呭喌锛屼緥濡傛瘡琛屾湁2鍒楁暟鎹紝闇�瑕佸皢姝ゅ�艰缃负2
+ virtualListCol: {
+ type: [Number, String],
+ default: 1,
+ },
+ // 铏氭嫙鍒楄〃scroll鍙栨牱甯х巼锛岄粯璁や负60锛岃繃楂樺彲鑳藉嚭鐜板崱椤跨瓑闂
+ virtualScrollFps: {
+ type: [Number, String],
+ default: 60,
+ },
+ },
+ data() {
+ return {
+ firstLoaded: false,
+ };
+ },
+ watch: {
+ currentIndex: {
+ handler(newVal, oldVal) {
+ if (newVal === this.tabIndex) {
+ // 鎳掑姞杞斤紝褰撴粦鍔ㄥ埌褰撳墠鐨刬tem鏃讹紝鎵嶅幓鍔犺浇
+ if (!this.firstLoaded) {
+ this.$nextTick(() => {
+ let delay = 5;
+ // #ifdef MP-TOUTIAO
+ delay = 100;
+ // #endif
+ setTimeout(() => {
+ this.$refs.paging.reload().catch(() => {});
+ }, delay);
+ });
+ }
+ }
+ },
+ immediate: true,
+ },
+ },
+ methods: {
+ reload(data) {
+ return this.$refs.paging.reload(data);
+ },
+ complete(data) {
+ this.firstLoaded = true;
+ return this.$refs.paging.complete(data);
+ },
+ _queryList(pageNo, pageSize, from) {
+ this.$emit("query", pageNo, pageSize, from);
+ },
+ _updateList(list) {
+ this.$emit("updateList", list);
+ },
+ },
+};
</script>
<style scoped>
- .zp-swiper-item-container {
- /* #ifndef APP-NVUE */
- height: 100%;
- /* #endif */
- /* #ifdef APP-NVUE */
- flex: 1;
- /* #endif */
- }
+.zp-swiper-item-container {
+ /* #ifndef APP-NVUE */
+ height: 100%;
+ /* #endif */
+ /* #ifdef APP-NVUE */
+ flex: 1;
+ /* #endif */
+}
</style>
diff --git a/src/enums/ResultCodeEnum.ts b/src/enums/ResultCodeEnum.ts
index 7a71a04..755edff 100644
--- a/src/enums/ResultCodeEnum.ts
+++ b/src/enums/ResultCodeEnum.ts
@@ -5,7 +5,7 @@
/**
* 鎴愬姛
*/
- SUCCESS = "00000",
+ SUCCESS = 200,
/**
* 閿欒
*/
diff --git a/src/main.ts b/src/main.ts
index cb34f51..939297b 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -6,7 +6,6 @@
import "@/styles/global.scss";
import { setupStore } from "@/store";
-
export function createApp() {
const app = createSSRApp(App);
diff --git a/src/models/base.ts b/src/models/base.ts
new file mode 100644
index 0000000..5deb994
--- /dev/null
+++ b/src/models/base.ts
@@ -0,0 +1,13 @@
+export interface BaseResult<T> {
+ code: number; // 鍝嶅簲鐮�
+ msg: string; // 鍝嶅簲淇℃伅
+ data?: T | any; // 鍝嶅簲鍙傛暟
+}
+
+export interface PageResult<T = any> {
+ total: number; // 鎬绘暟
+ records: Array<T>; // 鏌ヨ鏁版嵁鍒楄〃
+ size: number; // 姣忛〉鏄剧ず鏉℃暟锛岄粯璁� 10
+ current: number; // 褰撳墠椤�
+ pages: boolean; // 鏄惁瀛樺湪涓嬩竴椤�
+}
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 152aa6e..a52c19c 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -201,8 +201,8 @@
};
onReady(() => {
- loadVisitStatsData();
- loadVisitTrendData();
+ // loadVisitStatsData();
+ // loadVisitTrendData();
});
</script>
diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue
index fc40501..7e29461 100644
--- a/src/pages/login/index.vue
+++ b/src/pages/login/index.vue
@@ -96,8 +96,9 @@
// 鐧诲綍琛ㄥ崟鏁版嵁
const loginFormData = ref<LoginFormData>({
- username: "admin",
- password: "123456",
+ // username: "31601016",
+ username: "32308027",
+ password: "cxjt1234",
});
// 鑾峰彇閲嶅畾鍚戝弬鏁�
@@ -120,7 +121,6 @@
.then(() => userStore.getInfo())
.then(() => {
toast.success("鐧诲綍鎴愬姛");
-
// 妫�鏌ョ敤鎴蜂俊鎭槸鍚﹀畬鏁�
if (!userStore.isUserInfoComplete()) {
// 淇℃伅涓嶅畬鏁达紝璺宠浆鍒板畬鍠勪俊鎭〉闈�
diff --git a/src/pages/production/components/ProductionCard.vue b/src/pages/production/components/ProductionCard.vue
index b9e1236..cf16aae 100644
--- a/src/pages/production/components/ProductionCard.vue
+++ b/src/pages/production/components/ProductionCard.vue
@@ -4,7 +4,7 @@
<view class="flex justify-between w-full h-[20px]">
<view class="text-[#646874] pl-1">{{ item.label }}</view>
<view class="font-medium pr-1" :style="{ color: item.color ?? color }">
- {{ item.value }}
+ {{ value[item.prop] }}
</view>
</view>
</wd-col>
@@ -19,6 +19,12 @@
return [];
},
},
+ value: {
+ type: Object,
+ default: () => {
+ return {};
+ },
+ },
color: {
type: String,
default: "#333333",
diff --git a/src/pages/production/detail/twistDetail.vue b/src/pages/production/detail/twistDetail.vue
index c4e5230..5c12575 100644
--- a/src/pages/production/detail/twistDetail.vue
+++ b/src/pages/production/detail/twistDetail.vue
@@ -1,12 +1,12 @@
<template>
<view>
- <ProductCard />
+ <ProductCard :data="cardData" />
<view class="mx-3">
<wd-grid class="rounded-lg" clickable>
<wd-grid-item
icon="computer"
link-type="navigateTo"
- url="/pages/production/twist/report/index"
+ :url="`/pages/production/twist/report/index?id=${paramsId}`"
text="鎶ュ伐"
/>
<!-- <wd-grid-item
@@ -24,7 +24,7 @@
<wd-grid-item
icon="wallet"
link-type="navigateTo"
- url="/pages/production/twist/receive/index"
+ :url="`/pages/production/twist/receive/index?id=${paramsId}`"
text="鏉愭枡棰嗙敤"
/>
</wd-grid>
@@ -33,7 +33,34 @@
</template>
<script lang="ts" setup>
+import { onLoad } from "@dcloudio/uni-app";
import ProductCard from "@/components/product_card/index.vue";
+import TwistApi from "@/api/product/twist";
+
+const paramsId = ref();
+const cardData = reactive({
+ deviceModel: undefined,
+ model: undefined,
+ totalAmount: undefined,
+ amount: undefined,
+ unAmount: undefined,
+});
+
+const getDetailData = async (id: string) => {
+ const { data } = await TwistApi.getTwistDetailById({
+ id: id,
+ });
+ cardData.deviceModel = data.deviceModel;
+ cardData.model = data.model;
+ cardData.totalAmount = data.totalLength;
+ cardData.amount = data.length;
+ cardData.unAmount = data.unLength;
+};
+
+onLoad((options: any) => {
+ paramsId.value = options.id;
+ getDetailData(options.id);
+});
</script>
<style lang="scss" scoped></style>
diff --git a/src/pages/production/detail/wireDetail.vue b/src/pages/production/detail/wireDetail.vue
index 6413c4e..1e67d52 100644
--- a/src/pages/production/detail/wireDetail.vue
+++ b/src/pages/production/detail/wireDetail.vue
@@ -1,12 +1,12 @@
<template>
- <view>
- <ProductCard />
+ <view class="pt-2">
+ <ProductCard :data="cardData" />
<view class="mx-3">
<wd-grid class="rounded-lg" clickable>
<wd-grid-item
icon="computer"
link-type="navigateTo"
- url="/pages/production/wire/report/wire"
+ :url="`/pages/production/wire/report/wire?id=${paramsId}`"
text="鎶ュ伐"
/>
<!-- <wd-grid-item
@@ -33,7 +33,34 @@
</template>
<script lang="ts" setup>
+import { onLoad } from "@dcloudio/uni-app";
import ProductCard from "@/components/product_card/index.vue";
+import WireApi from "@/api/product/wire";
+
+const paramsId = ref();
+const cardData = reactive({
+ deviceModel: undefined,
+ model: undefined,
+ totalAmount: undefined,
+ amount: undefined,
+ unAmount: undefined,
+});
+
+const getDetailData = async (id: string) => {
+ const { data } = await WireApi.getWireDetailById({
+ id: id,
+ });
+ cardData.deviceModel = data.deviceModel;
+ cardData.model = data.model;
+ cardData.totalAmount = data.totalAmount;
+ cardData.amount = data.amount;
+ cardData.unAmount = data.unAmount;
+};
+
+onLoad((options: any) => {
+ paramsId.value = options.id;
+ getDetailData(options.id);
+});
</script>
<style lang="scss" scoped></style>
diff --git a/src/pages/production/index.vue b/src/pages/production/index.vue
index cc33983..16dc0c3 100644
--- a/src/pages/production/index.vue
+++ b/src/pages/production/index.vue
@@ -10,45 +10,37 @@
</view>
</wd-col>
</wd-row>
- <wd-tabs v-model="tab" :lineWidth="110">
- <block v-for="(item, index) in productList" :key="index" class="tab_bg">
- <wd-tab :title="item.label">
- <view class="card_box">
- <Statistics class="statistics_box" />
- <ProductCard v-for="(item, index) in 10" @click="toDetail(index)" />
- <wd-loadmore custom-class="loadmore" state="loading" />
- </view>
- </wd-tab>
- </block>
+ <wd-tabs v-model="tab" auto-line-width>
+ <wd-tab :title="`寰呯敓浜�(${total.wait})`" class="tab_bg">
+ <ProductList :api="ManageApi.getProductList" state="寰呭畬鎴�" @ok="changeWait" />
+ </wd-tab>
+ <wd-tab :title="`宸茬敓浜�(${total.already})`" class="tab_bg">
+ <ProductList :api="ManageApi.getProductList" state="宸插畬鎴�" @ok="changeAlready" />
+ </wd-tab>
</wd-tabs>
</view>
</template>
<script lang="ts" setup>
-import ProductCard from "@/components/product_card/index.vue";
-import Statistics from "./components/Statistics.vue";
+import ManageApi from "@/api/product/manage";
+import { onMounted, ref } from "vue";
+import ProductList from "./list/index.vue";
+
const tab = ref<number>(0);
+const total = reactive({
+ wait: 0,
+ already: 0,
+});
-const productList = ref<any[]>([
- {
- label: "寰呯敓浜�(10)",
- },
- {
- label: "宸茬敓浜�(20)",
- },
-]);
-
-const toDetail = (type: number) => {
- if (Math.floor(type) % 2 === 0) {
- uni.navigateTo({
- url: "/pages/production/detail/wireDetail",
- });
- } else {
- uni.navigateTo({
- url: "/pages/production/detail/twistDetail",
- });
- }
+const changeWait = (num: number) => {
+ total.wait = num;
};
+
+const changeAlready = (num: number) => {
+ total.already = num;
+};
+
+onMounted(() => {});
</script>
<style lang="scss" scoped>
@@ -71,7 +63,7 @@
border-bottom: 1px #dddddd solid;
}
.tab_bg {
- background: linear-gradient(0, #ffffff 29%, #f3f9f8 100%);
+ background: #f3f9f8;
}
.icon_box {
@@ -83,10 +75,7 @@
background: #e7f4ec99;
border-radius: 50%;
}
-.card_box {
- height: calc(100vh - 160px);
- overflow: scroll;
-}
+
.statistics_box {
margin: 15px;
}
diff --git a/src/pages/production/list/index.vue b/src/pages/production/list/index.vue
new file mode 100644
index 0000000..2fb4362
--- /dev/null
+++ b/src/pages/production/list/index.vue
@@ -0,0 +1,80 @@
+<template>
+ <view class="card_box">
+ <z-paging
+ ref="pagingRef"
+ v-model="list"
+ :fixed="false"
+ :auto-show-back-to-top="true"
+ @query="getList"
+ >
+ <template #top>
+ <Statistics class="statistics_box" />
+ </template>
+ <ProductCard
+ v-for="(item, index) in list"
+ :key="index"
+ :data="item"
+ @click="toDetail(item.id, item.type)"
+ />
+ </z-paging>
+ </view>
+</template>
+
+<script setup lang="ts">
+import Statistics from "../components/Statistics.vue";
+import ProductCard from "@/components/product_card/index.vue";
+import { useUserStore } from "@/store/modules/user";
+import zPaging from "@/components/z-paging/z-paging.vue";
+
+const pagingRef = ref();
+const props = defineProps({
+ api: {
+ type: Function,
+ default: () => {},
+ },
+ state: {
+ type: String,
+ default: "",
+ },
+});
+
+const emits = defineEmits(["ok"]);
+const list = ref<any[]>([]);
+
+const toDetail = (id: number, type: string) => {
+ if (type == "鎷変笣") {
+ uni.navigateTo({
+ url: `/pages/production/detail/wireDetail?id=${id}`,
+ });
+ } else if (type == "缁炵嚎") {
+ uni.navigateTo({
+ url: `/pages/production/detail/twistDetail?id=${id}`,
+ });
+ }
+};
+
+const getList = async (pageNo: number, pageSize: number) => {
+ const userStore = useUserStore();
+ const userInfo: any = computed(() => userStore.userInfo);
+ const { code, data } = await props.api({
+ userName: userInfo.value.user?.userName,
+ state: props.state,
+ current: pageNo,
+ size: pageSize,
+ });
+ if (code == 200) {
+ if (data.total == 0) {
+ pagingRef.value.complete(true);
+ } else {
+ pagingRef.value.complete(data.records);
+ }
+ emits("ok", data.total);
+ }
+};
+</script>
+
+<style lang="scss" scoped>
+.card_box {
+ height: calc(100vh - 140px);
+}
+</style>
diff --git a/src/pages/production/twist/receive/monofil.vue b/src/pages/production/twist/receive/monofil.vue
index 884b6f6..f781ff7 100644
--- a/src/pages/production/twist/receive/monofil.vue
+++ b/src/pages/production/twist/receive/monofil.vue
@@ -1,15 +1,23 @@
<template>
- <view class="page">
- <CardTitle title="鍗曚笣棰嗙敤" :hideAction="false">
- <template #action>
- <wd-button type="icon" icon="scan" color="#0D867F" @click="openScan"></wd-button>
+ <view class="list_box">
+ <z-paging
+ ref="pagingRef"
+ v-model="cardList"
+ :fixed="false"
+ :auto-show-back-to-top="true"
+ @query="getList"
+ >
+ <template #top>
+ <CardTitle title="鍗曚笣棰嗙敤" :hideAction="false">
+ <template #action>
+ <wd-button type="icon" icon="scan" color="#0D867F" @click="openScan"></wd-button>
+ </template>
+ </CardTitle>
</template>
- </CardTitle>
- <view class="list_box">
<MonofilCard v-for="(item, index) in cardList" :key="index" />
- </view>
- <Scan ref="scanRef" />
+ </z-paging>
</view>
+ <Scan ref="scanRef" />
</template>
<script setup lang="ts">
@@ -17,10 +25,13 @@
import MonofilCard from "../components/MonofilCard.vue";
import { onLoad, onUnload, onShow, onHide } from "@dcloudio/uni-app";
import Scan from "@/components/scan/index.vue";
+import ManageApi from "@/api/product/manage";
+import zPaging from "@/components/z-paging/z-paging.vue";
// import { useZebraScan } from "@/hooks/useZebraScan";
-
// const { init, start, stop, triggerScan } = useZebraScan();
+const paramsId = ref();
+const pagingRef = ref();
const scanRef = ref();
const cardList = ref<any[]>([]);
@@ -31,45 +42,38 @@
};
const openScan = () => {
- // uni.scanCode({
- // onlyFromCamera: true,
- // success: (res) => {
- // console.log("鏉$爜绫诲瀷锛�" + res.scanType);
- // console.log("鏉$爜鍐呭锛�" + res.result);
- // cardList.value.push(res.result);
- // },
- // });
- // triggerScan();
scanRef.value.triggerScan();
};
-onLoad(() => {
+const getList = async () => {
+ const { code, data } = await ManageApi.getStrandedWireDish({
+ wireId: paramsId.value,
+ type: "鍗曚笣",
+ });
+ if (code == 200) {
+ pagingRef.value.complete(data);
+ }
+};
+
+onLoad((options: any) => {
// 寮�鍚箍鎾洃鍚簨浠�
uni.$on("scan", getScanCode);
- // init(getScanCode);
+ paramsId.value = options.id;
});
onUnload(() => {
// 寮�鍚箍鎾洃鍚簨浠�
uni.$off("scan", getScanCode);
- // stop();
});
-onShow(() => {
- // start();
-});
+onShow(() => {});
-onHide(() => {
- // stop();
-});
+onHide(() => {});
</script>
<style lang="scss" scoped>
-.page {
+.list_box {
+ height: calc(100vh - 100px);
background: #f3f9f8;
- .list_box {
- height: calc(100% - 100px);
- overflow: scroll;
- }
}
:deep(.wd-button__content) {
color: #0d867f;
diff --git a/src/pages/production/twist/report/index.vue b/src/pages/production/twist/report/index.vue
index db4ab66..9c6b5c0 100644
--- a/src/pages/production/twist/report/index.vue
+++ b/src/pages/production/twist/report/index.vue
@@ -1,10 +1,10 @@
<template>
<view class="page pt-2">
- <z-paging ref="paging" refresher-only class="list">
+ <z-paging ref="pagingRef" v-model="twistReportList" class="list" @query="getTwistReportList">
<template #top>
<CardTitle title="鎶ュ伐淇℃伅" :hideAction="true" :full="false" @action="addReport" />
</template>
- <wd-card v-for="(item, index) in 6" type="rectangle" custom-class="round">
+ <wd-card v-for="(item, index) in twistReportList" type="rectangle" custom-class="round">
<template #title>
<view class="flex justify-between">
<view>
@@ -15,12 +15,11 @@
<view class="text-[#A8A8A8]" @click="toEdit">缂栬緫</view>
</view>
</template>
- <ProductionCard :data="cardAttr" />
+ <ProductionCard :data="cardAttr" :value="item" />
<template #footer>
<wd-button size="small" plain @click="toCheck">鑷</wd-button>
</template>
</wd-card>
- <wd-loadmore custom-class="loadmore" state="loading" />
</z-paging>
<wd-popup v-model="dialog.visible" position="bottom" custom-class="yl-popup">
@@ -38,7 +37,11 @@
import TwistForm from "./form.vue";
import { useToast } from "wot-design-uni";
import ProductionCard from "../../components/ProductionCard.vue";
+import { onLoad } from "@dcloudio/uni-app";
+import ManageApi from "@/api/product/manage";
+const pagingRef = ref();
+const paramsId = ref();
const toast = useToast();
const dialog = reactive({
visible: false,
@@ -46,42 +49,36 @@
const cardAttr = ref<any[]>([
{
- label: "鍚堝悓鍙�",
- value: "ht2921246",
+ label: "棰嗙敤鏉嗗彿",
+ prop: "poleNumber",
},
{
- label: "鐘舵��",
- value: "-----",
+ label: "鏉嗛噸(kg)",
+ prop: "poleWeight",
},
{
- label: "瀹㈡埛鍚嶇О",
- value: "澶忓織璞�",
- },
- {
- label: "鏈哄彴",
- value: "-----",
+ label: "鍗曚笣鐩樺彿",
+ prop: "monofilamentNumber",
},
{
label: "瑙勬牸鍨嬪彿",
- value: "2921246",
- },
- {
- label: "宸茬敓浜ф暟閲�",
- value: "0",
+ prop: "model",
},
{
label: "鐩橀暱(m)",
- value: "292",
+ prop: "ontLength",
},
{
- label: "璁″垝鏁伴噺",
- value: "100",
+ label: "鐞嗚閲嶉噺(kg)",
+ prop: "theoryWeight",
},
{
- label: "璐ㄩ噺杩芥函鍙�",
- value: "JX-1838",
+ label: "瀹為檯閲嶉噺(kg)",
+ prop: "actuallyWeight",
},
]);
+
+const twistReportList = ref<any[]>([]);
const toEdit = () => {
uni.navigateTo({
@@ -108,6 +105,19 @@
url: "/pages/production/twist/selfInspect/index",
});
};
+
+// 鑾峰彇鎷変笣鎶ュ伐鍒楄〃
+const getTwistReportList = async () => {
+ const { data } = await ManageApi.getReportList({
+ wireId: paramsId.value,
+ type: "缁炵嚎",
+ });
+ pagingRef.value.complete(data);
+};
+
+onLoad((options: any) => {
+ paramsId.value = options.id;
+});
</script>
<style lang="scss" scoped>
diff --git a/src/pages/production/wire/report/wire.vue b/src/pages/production/wire/report/wire.vue
index 2416d38..496ae82 100644
--- a/src/pages/production/wire/report/wire.vue
+++ b/src/pages/production/wire/report/wire.vue
@@ -1,26 +1,30 @@
<template>
<view class="page pt-2">
- <z-paging ref="paging" refresher-only class="list">
+ <z-paging ref="pagingRef" v-model="wireReportList" class="list" @query="getWireReportList">
<template #top>
<CardTitle title="鎶ュ伐淇℃伅" :hideAction="true" :full="false" @action="addReport" />
</template>
- <wd-card v-for="(item, index) in 6" type="rectangle" custom-class="round">
+ <wd-card
+ v-for="(item, index) in wireReportList"
+ :key="index"
+ type="rectangle"
+ custom-class="round"
+ >
<template #title>
<view class="flex justify-between">
<view>
<wd-icon name="user" color="#0D867F"></wd-icon>
<text class="text-[#0D867F] ml-2 font-medium">鐢熶骇浜�</text>
- <text class="text-[#333333] ml-2">鏂瑰厗鐜�</text>
+ <text class="text-[#333333] ml-2">{{ item.productUser }}</text>
</view>
<view class="text-[#A8A8A8]" @click="toEdit">缂栬緫</view>
</view>
</template>
- <ProductionCard :data="cardAttr" />
+ <ProductionCard :data="cardAttr" :value="item" />
<template #footer>
- <wd-button size="small" plain @click="toCheck">鑷</wd-button>
+ <wd-button size="small" plain @click="toCheck(item.id)">鑷</wd-button>
</template>
</wd-card>
- <wd-loadmore custom-class="loadmore" state="loading" />
</z-paging>
<wd-popup v-model="dialog.visible" position="bottom" custom-class="yl-popup">
@@ -28,7 +32,7 @@
<wd-button type="text" @click="cancel">鍙栨秷</wd-button>
<wd-button type="text" @click="submit">纭畾</wd-button>
</view>
- <WireForm />
+ <WireForm ref="wireFormRef" />
</wd-popup>
<wd-toast />
</view>
@@ -39,7 +43,13 @@
import { useToast } from "wot-design-uni";
import ProductionCard from "../../components/ProductionCard.vue";
import zPaging from "@/components/z-paging/z-paging.vue";
+import { onLoad } from "@dcloudio/uni-app";
+import ManageApi from "@/api/product/manage";
+import WireApi from "@/api/product/wire";
+const pagingRef = ref();
+const wireFormRef = ref();
+const paramsId = ref();
const toast = useToast();
const dialog = reactive({
visible: false,
@@ -47,38 +57,36 @@
const cardAttr = ref<any[]>([
{
- label: "鍚堝悓鍙�",
- value: "ht2921246",
+ label: "棰嗙敤鏉嗗彿",
+ prop: "poleNumber",
},
{
- label: "鐘舵��",
- value: "-----",
+ label: "鏉嗛噸(kg)",
+ prop: "poleWeight",
},
{
- label: "瀹㈡埛鍚嶇О",
- value: "澶忓織璞�",
- },
- {
- label: "鏈哄彴",
- value: "-----",
+ label: "鍗曚笣鐩樺彿",
+ prop: "monofilamentNumber",
},
{
label: "瑙勬牸鍨嬪彿",
- value: "2921246",
- },
- {
- label: "宸茬敓浜ф暟閲�",
- value: "0",
+ prop: "model",
},
{
label: "鐩橀暱(m)",
- value: "292",
+ prop: "ontLength",
},
{
- label: "璁″垝鏁伴噺",
- value: "100",
+ label: "鐞嗚閲嶉噺(kg)",
+ prop: "theoryWeight",
+ },
+ {
+ label: "瀹為檯閲嶉噺(kg)",
+ prop: "actuallyWeight",
},
]);
+
+const wireReportList = ref<any[]>([]);
const toEdit = () => {
uni.navigateTo({
@@ -90,9 +98,13 @@
dialog.visible = true;
};
-const submit = () => {
+const submit = async () => {
toast.show("鎻愪氦");
- dialog.visible = false;
+ await WireApi.addWireOutput({
+ wireId: paramsId.value,
+ type: "鎷変笣",
+ ...wireFormRef.value.model,
+ });
};
const cancel = () => {
@@ -100,11 +112,24 @@
dialog.visible = false;
};
-const toCheck = () => {
+const toCheck = (id: number) => {
uni.navigateTo({
- url: "/pages/production/wire/selfInspect/index",
+ url: `/pages/production/wire/selfInspect/index?id=${id}`,
});
};
+
+// 鑾峰彇鎷変笣鎶ュ伐鍒楄〃
+const getWireReportList = async () => {
+ const { data } = await ManageApi.getReportList({
+ wireId: paramsId.value,
+ type: "鎷変笣",
+ });
+ pagingRef.value.complete(data);
+};
+
+onLoad((options: any) => {
+ paramsId.value = options.id;
+});
</script>
<style lang="scss" scoped>
diff --git a/src/pages/production/wire/report/wireForm.vue b/src/pages/production/wire/report/wireForm.vue
index 52d7823..4fb91c4 100644
--- a/src/pages/production/wire/report/wireForm.vue
+++ b/src/pages/production/wire/report/wireForm.vue
@@ -2,52 +2,60 @@
<wd-form ref="form" :model="model" class="relative form_box">
<wd-cell-group :border="true">
<wd-input
- v-model="model.contractNo"
- label="鍚堝悓鍙�"
+ v-model="model.poleNumber"
+ label="棰嗙敤鏉嗗彿"
label-width="100px"
- prop="contractNo"
+ prop="poleNumber"
clearable
- placeholder="璇疯緭鍏ュ悎鍚屽彿"
+ placeholder="璇疯緭鍏ラ鐢ㄦ潌鍙�"
/>
<wd-input
- v-model="model.clientName"
- label="瀹㈡埛鍚嶇О"
+ v-model="model.poleWeight"
+ label="鏉嗛噸"
label-width="100px"
- prop="clientName"
+ prop="poleWeight"
clearable
- placeholder="璇疯緭鍏ュ鎴峰悕绉�"
+ placeholder="璇疯緭鍏ユ潌閲�"
/>
<wd-input
- v-model="model.workbench"
- label="鏈哄彴"
+ v-model="model.monofilamentNumber"
+ label="鍗曚笣鐩樺彿"
label-width="100px"
- prop="workbench"
+ prop="monofilamentNumber"
clearable
placeholder="璇疯緭鍏ユ満鍙�"
/>
<wd-input
- v-model="model.monofilNo"
- label="鍗曚綋缂栧彿"
+ v-model="model.model"
+ label="瑙勬牸鍨嬪彿"
label-width="100px"
- prop="monofilNo"
+ prop="model"
clearable
- placeholder="璇疯緭鍏ュ崟浣撶紪鍙�"
+ placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"
/>
<wd-input
- v-model="model.specification"
- label="瑙勬牸"
+ v-model="model.ontLength"
+ label="鐩橀暱"
label-width="100px"
- prop="specification"
+ prop="ontLength"
clearable
- placeholder="璇疯緭鍏ヨ鏍�"
+ placeholder="璇疯緭鍏ョ洏闀�"
/>
<wd-input
- v-model="model.singleDisc"
- label="鍗曚笣鐩橀暱"
+ v-model="model.theoryWeight"
+ label="鐞嗚閲嶉噺"
label-width="100px"
- prop="singleDisc"
+ prop="theoryWeight"
clearable
- placeholder="璇疯緭鍏ュ崟涓濈洏闀�"
+ placeholder="璇疯緭鍏ョ悊璁洪噸閲�"
+ />
+ <wd-input
+ v-model="model.actuallyWeight"
+ label="瀹為檯閲嶉噺"
+ label-width="100px"
+ prop="actuallyWeight"
+ clearable
+ placeholder="璇疯緭鍏ュ疄闄呴噸閲�"
/>
</wd-cell-group>
</wd-form>
@@ -57,13 +65,17 @@
import useFormData from "@/hooks/useFormData";
const { form: model } = useFormData({
- contractNo: undefined, // 鍚堝悓鍙�
- clientName: undefined, // 瀹㈡埛鍚嶇О
- workbench: undefined, // 鏈哄彴
- monofilNo: undefined, // 鍗曚綋缂栧彿
- specification: undefined, // 瑙勬牸
+ poleNumber: undefined, // 棰嗙敤鏉嗗彿
+ poleWeight: undefined, // 瀹㈡埛鍚嶇О
+ monofilamentNumber: undefined, // 鍗曚笣鐩樺彿
+ model: undefined, // 瑙勬牸鍨嬪彿
+ ontLength: undefined, // 鐩橀暱
singleDisc: undefined, // 鍗曚笣鐩橀暱
});
+
+defineExpose({
+ model,
+});
</script>
<style lang="scss" scoped>
diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index 0f364f9..b3dba33 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -10,9 +10,9 @@
const login = (data: LoginFormData) => {
return new Promise((resolve, reject) => {
AuthAPI.login(data)
- .then((data) => {
- setToken(data.accessToken);
- resolve(data);
+ .then((data: any) => {
+ setToken(data.data.token);
+ resolve(data.data);
})
.catch((error) => {
console.error("鐧诲綍澶辫触", error);
@@ -40,10 +40,10 @@
const getInfo = () => {
return new Promise((resolve, reject) => {
UserAPI.getUserInfo()
- .then((data) => {
- setUserInfo(data);
- userInfo.value = data;
- resolve(data);
+ .then((data: any) => {
+ setUserInfo(data.data);
+ userInfo.value = data.data.user;
+ resolve(data.data);
})
.catch((error) => {
console.error("鑾峰彇鐢ㄦ埛淇℃伅澶辫触", error);
@@ -68,7 +68,8 @@
const isUserInfoComplete = (): boolean => {
if (!userInfo.value) return false;
- return !!(userInfo.value.nickname && userInfo.value.avatar);
+ // return !!(userInfo.value.nickName && userInfo.value.avatar);
+ return !!userInfo.value.nickName;
};
return {
diff --git a/src/types/global.d.ts b/src/types/global.d.ts
index 93331d7..508766b 100644
--- a/src/types/global.d.ts
+++ b/src/types/global.d.ts
@@ -33,7 +33,7 @@
* 鍝嶅簲鏁版嵁
*/
interface ResponseData<T = any> {
- code: string;
+ code: number | string;
data: T;
msg: string;
}
diff --git a/src/utils/request.ts b/src/utils/request.ts
index 5909a49..8fa1c60 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -7,8 +7,7 @@
// #ifdef H5
baseApi = import.meta.env.VITE_APP_BASE_API;
// #endif
-
- return new Promise((resolve, reject) => {
+ return new Promise((resolve: any, reject: any) => {
uni.request({
...options,
url: `${baseApi}${options.url}`,
@@ -22,7 +21,7 @@
// 涓氬姟鐘舵�佺爜 00000 琛ㄧず鎴愬姛
if (resData.code === ResultCodeEnum.SUCCESS) {
- resolve(resData.data);
+ resolve(resData);
}
// 浠ょ墝澶辨晥鎴栬繃鏈熷鐞�
else if (resData.code === ResultCodeEnum.TOKEN_INVALID) {
--
Gitblit v1.9.3