上海多工程设置完善

This commit is contained in:
BianLzhaoMin 2025-10-22 10:15:03 +08:00
parent f4d8e88173
commit 48d9ad730c
4 changed files with 66 additions and 30 deletions

View File

@ -1,4 +1,4 @@
# VITE_API_BASE_URL = http://112.29.103.165:1616
# VITE_API_BASE_URL = /api
VITE_API_BASE_URL = http://192.168.0.14:1999/hd-real-name
VITE_API_BASE_URL = /api
# VITE_API_BASE_URL = http://192.168.0.14:1999/hd-real-name
# VITE_API_BASE_URL = http://192.168.0.234:38080

View File

@ -201,6 +201,7 @@ import {
getTeamSelectListByConditionAPI,
getLotProjectSelectListByConditionAPI,
} from '@/services/common'
import { addShProjectEntryAPI } from '@/services/shProjectSetting'
const { safeAreaInsets } = uni.getSystemInfoSync()
const navBarTitle = ref('添加入场数据')
@ -209,19 +210,21 @@ const nextBtnRef = ref(null) // 下一步按钮ref
const nextBtnHeight = ref(0) //
const formRef = ref(null) // ref
const showLoading = ref(false) //
const workerId = ref('') // ID
//
const formData = ref({
name: '张小刚', //
idNumber: '430423197410120055', //
postId: '', // ID
postName: '', //
proId: '', // ID
proName: '', //
subId: '', // ID
subName: '', //
teamId: '', // ID
teamName: '', //
name: '',
idNumber: '',
postName: '',
proName: '',
subName: '',
teamName: '',
teamId: '',
subId: '',
proId: '',
postId: '',
id: '',
})
//
@ -313,6 +316,14 @@ const onConfirmPro = (e) => {
//
const onCancelPro = () => {
formData.value.proName = ''
formData.value.proId = ''
formData.value.subName = ''
formData.value.subId = ''
formData.value.teamName = ''
formData.value.teamId = ''
subPickerColumns.value[0] = []
teamPickerColumns.value[0] = []
proPickerShow.value = false
}
@ -330,6 +341,11 @@ const onConfirmSub = (e) => {
//
const onCancelSub = () => {
formData.value.subName = ''
formData.value.subId = ''
formData.value.teamName = ''
formData.value.teamId = ''
teamPickerColumns.value[0] = []
subPickerShow.value = false
}
@ -342,12 +358,15 @@ const onConfirmTeam = (e) => {
//
const onCancelTeam = () => {
formData.value.teamName = ''
formData.value.teamId = ''
teamPickerShow.value = false
}
//
const onHandleCancel = () => {
uni.navigateBack()
uni.$emit('refreshShProjectList', {})
}
//
@ -370,20 +389,12 @@ const submitData = async (isContinue) => {
}
showLoading.value = true
// TODO: API
// const result = await addProjectEntryAPI(formData.value)
// API
await new Promise((resolve) => setTimeout(resolve, 2000))
const result = await addShProjectEntryAPI(formData.value)
showLoading.value = false
//
const result = { code: 200, msg: '提交成功' }
if (result.code === 200) {
uni.$u.toast(result.msg)
uni.$u.toast('提交成功')
if (isContinue) {
//
@ -398,10 +409,12 @@ const submitData = async (isContinue) => {
subName: '',
teamId: '',
teamName: '',
id: workerId.value,
}
} else {
setTimeout(() => {
uni.navigateBack()
uni.$emit('refreshShProjectList', {})
}, 500)
}
}
@ -431,7 +444,9 @@ const getPostTypeSelectList = async () => {
//
const getLotProjectSelectListByCondition = async () => {
try {
const { data: res } = await getLotProjectSelectListByConditionAPI({})
const { data: res } = await getLotProjectSelectListByConditionAPI({
workerId: workerId.value,
})
if (res && res.length > 0) {
proPickerColumns.value[0] = res.map((item) => {
return {
@ -468,7 +483,10 @@ const getSubSelectListByCondition = async (proId) => {
//
const getTeamSelectListByCondition = async (subId) => {
try {
const { data: res } = await getTeamSelectListByConditionAPI({ subId })
const { data: res } = await getTeamSelectListByConditionAPI({
subId,
proId: formData.value.proId,
})
if (res && res.length > 0) {
teamPickerColumns.value[0] = res.map((item) => {
return {
@ -515,6 +533,10 @@ onLoad((options) => {
if (options?.idCard) {
formData.value.idNumber = options.idCard
}
if (options?.workerId) {
workerId.value = options.workerId
formData.value.id = workerId.value
}
})
</script>

View File

@ -5,7 +5,7 @@
<up-button type="primary" text="新增入场工程" @tap="onHandleAddProject" />
</view>
<scroll-view scroll-y @scrolltolower="onHandleScrollToLower" class="person-exit-content">
<scroll-view scroll-y class="person-exit-content">
<view :key="item.id" class="person-exit-item" v-for="(item, index) in shProjectList">
<view class="person-exit-item-header">
<text class="index-text"> {{ index + 1 }} </text>
@ -45,16 +45,14 @@
</view>
</view>
<view class="loading-text">
{{ !hasMore ? '没有更多数据了~' : '正在加载...' }}
</view>
<view class="loading-text"> 没有更多数据了~ </view>
</scroll-view>
</view>
</template>
<script setup name="ShProjectDetails">
import { debounce } from 'lodash-es'
import { ref, computed, onMounted, nextTick } from 'vue'
import { ref, computed, onMounted, nextTick, onUnmounted } from 'vue'
import { getShProjectListByWorkerIdAPI } from '@/services/shProjectSetting'
import { useCommonStore } from '@/stores'
@ -74,8 +72,10 @@ const getShProjectDetailsListFun = async () => {
workerId: workerId.value,
})
shProjectList.value = []
// total.value = res?.total
shProjectList.value = [...shProjectList.value, ...res?.rows]
shProjectList.value = [...res?.rows]
}
//
@ -87,6 +87,11 @@ const onHandleAddProject = () => {
onMounted(() => {
getShProjectDetailsListFun()
uni.$on('refreshShProjectList', getShProjectDetailsListFun)
})
onUnmounted(() => {
uni.$off('refreshShProjectList', getShProjectDetailsListFun)
})
onLoad((options) => {

View File

@ -17,3 +17,12 @@ export const getShProjectListByWorkerIdAPI = (data) => {
data,
})
}
// 新增上海工程入场
export const addShProjectEntryAPI = (data) => {
return http({
method: 'POST',
url: `/bmw/worker/insertProEin`,
data,
})
}