上海多工程设置完善
This commit is contained in:
parent
f4d8e88173
commit
48d9ad730c
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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) => {
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,12 @@ export const getShProjectListByWorkerIdAPI = (data) => {
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增上海工程入场
|
||||||
|
export const addShProjectEntryAPI = (data) => {
|
||||||
|
return http({
|
||||||
|
method: 'POST',
|
||||||
|
url: `/bmw/worker/insertProEin`,
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue