上海多工程设置完善

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 = http://112.29.103.165:1616
# VITE_API_BASE_URL = /api 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.14:1999/hd-real-name
# VITE_API_BASE_URL = http://192.168.0.234:38080 # VITE_API_BASE_URL = http://192.168.0.234:38080

View File

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

View File

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

View File

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