2025-06-24 17:44:17 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<uni-nav-bar dark :fixed="true" shadow background-color="#4AA4EA" status-bar title="工器具领料"
|
|
|
|
|
|
><template v-slot:left>
|
|
|
|
|
|
<view style="font-size: 18px; display: flex; align-items: center" @click="back">
|
|
|
|
|
|
<!-- 图标 -->
|
|
|
|
|
|
<uni-icons type="left" size="20" color="#fff"></uni-icons>
|
|
|
|
|
|
<!-- 文本 -->
|
|
|
|
|
|
<text>返回</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:right v-if="opts.isOut">
|
2025-09-27 16:04:37 +08:00
|
|
|
|
<view
|
|
|
|
|
|
v-if="formData.pickType == 0 || !formData.pickType"
|
|
|
|
|
|
@click="submit(0)"
|
|
|
|
|
|
style="font-size: 18px; display: flex; align-items: center"
|
|
|
|
|
|
>
|
2025-06-24 17:44:17 +08:00
|
|
|
|
<!-- 文本 -->
|
|
|
|
|
|
<text>暂存</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</uni-nav-bar>
|
|
|
|
|
|
<div class="content">
|
|
|
|
|
|
<uni-section title="任务信息" type="line"></uni-section>
|
2025-07-02 17:56:52 +08:00
|
|
|
|
<uni-forms ref="form" :rules="rules" :model="formData" label-width="90px">
|
2025-09-27 16:04:37 +08:00
|
|
|
|
<uni-forms-item label="领用类型" required name="pickType" v-if="opts.isOut && !opts.isEdit">
|
|
|
|
|
|
<uni-data-select
|
|
|
|
|
|
v-model="formData.pickType"
|
|
|
|
|
|
:localdata="pickTypeList"
|
|
|
|
|
|
:clear="false"
|
|
|
|
|
|
filterable
|
|
|
|
|
|
@change="changePickType"
|
|
|
|
|
|
></uni-data-select>
|
|
|
|
|
|
</uni-forms-item>
|
2025-07-14 17:27:25 +08:00
|
|
|
|
<uni-forms-item label="领用工程" required name="proId">
|
2025-07-10 18:02:22 +08:00
|
|
|
|
<uni-data-select
|
2025-07-14 17:27:25 +08:00
|
|
|
|
v-model="formData.proId"
|
2025-07-10 18:02:22 +08:00
|
|
|
|
:localdata="prodRange"
|
|
|
|
|
|
:clear="false"
|
|
|
|
|
|
filterable
|
|
|
|
|
|
@change="changeProd"
|
|
|
|
|
|
></uni-data-select>
|
|
|
|
|
|
</uni-forms-item>
|
2025-09-27 16:04:37 +08:00
|
|
|
|
<uni-forms-item label="领用项目部" required name="departId" v-if="formData.pickType == 1">
|
|
|
|
|
|
<uni-data-select
|
|
|
|
|
|
v-model="formData.departId"
|
|
|
|
|
|
:localdata="proDeptList"
|
|
|
|
|
|
:clear="false"
|
|
|
|
|
|
filterable
|
|
|
|
|
|
@change="changeDept"
|
|
|
|
|
|
></uni-data-select>
|
|
|
|
|
|
</uni-forms-item>
|
|
|
|
|
|
<uni-forms-item
|
|
|
|
|
|
label="领料班组"
|
|
|
|
|
|
required
|
|
|
|
|
|
name="teamId"
|
|
|
|
|
|
v-if="formData.pickType == 0 || !formData.pickType"
|
|
|
|
|
|
>
|
2025-06-24 17:44:17 +08:00
|
|
|
|
<uni-data-select
|
|
|
|
|
|
v-model="formData.teamId"
|
|
|
|
|
|
:localdata="teamRange"
|
|
|
|
|
|
filterable
|
|
|
|
|
|
:clear="false"
|
|
|
|
|
|
@change="changeTeamd"
|
|
|
|
|
|
></uni-data-select>
|
|
|
|
|
|
</uni-forms-item>
|
2025-09-27 16:04:37 +08:00
|
|
|
|
<uni-forms-item
|
2025-09-28 14:43:02 +08:00
|
|
|
|
label="领料人"
|
2025-09-27 16:04:37 +08:00
|
|
|
|
required
|
|
|
|
|
|
name="leasePerson"
|
|
|
|
|
|
>
|
2025-06-24 17:44:17 +08:00
|
|
|
|
<uni-easyinput
|
|
|
|
|
|
v-model="formData.leasePerson"
|
|
|
|
|
|
placeholder="请输入内容"
|
2025-09-28 14:43:02 +08:00
|
|
|
|
:disabled="formData.pickType == 0"
|
2025-06-24 17:44:17 +08:00
|
|
|
|
></uni-easyinput>
|
|
|
|
|
|
</uni-forms-item>
|
2025-07-10 18:02:22 +08:00
|
|
|
|
<uni-forms-item label="联系电话" name="relPhone">
|
2025-06-24 17:44:17 +08:00
|
|
|
|
<uni-easyinput
|
2025-07-10 18:02:22 +08:00
|
|
|
|
v-model="formData.relPhone"
|
2025-06-24 17:44:17 +08:00
|
|
|
|
placeholder="请输入内容"
|
|
|
|
|
|
maxlength="11"
|
2025-09-28 14:43:02 +08:00
|
|
|
|
:disabled="isEdit"
|
2025-06-24 17:44:17 +08:00
|
|
|
|
@blur="checkPhone"
|
|
|
|
|
|
></uni-easyinput>
|
|
|
|
|
|
</uni-forms-item>
|
|
|
|
|
|
<uni-forms-item label="备注" name="remark">
|
|
|
|
|
|
<uni-easyinput
|
|
|
|
|
|
v-model="formData.remark"
|
|
|
|
|
|
placeholder="请输入内容"
|
|
|
|
|
|
maxlength="200"
|
|
|
|
|
|
></uni-easyinput>
|
|
|
|
|
|
</uni-forms-item>
|
2025-09-17 20:43:34 +08:00
|
|
|
|
<uni-forms-item label="所属分包" name="subUnitName">
|
|
|
|
|
|
<uni-easyinput
|
|
|
|
|
|
v-model="formData.subUnitName"
|
|
|
|
|
|
:placeholder="formData.subUnitName ? '请输入所属分包' : '暂无分包'"
|
|
|
|
|
|
maxlength="200"
|
|
|
|
|
|
disabled
|
|
|
|
|
|
></uni-easyinput>
|
|
|
|
|
|
</uni-forms-item>
|
2025-07-03 10:12:01 +08:00
|
|
|
|
<!-- <uni-forms-item label="适用班组数" name="fitNum" v-if="!opts.isOut">
|
2025-07-02 17:56:52 +08:00
|
|
|
|
<uni-easyinput
|
|
|
|
|
|
v-model="formData.fitNum"
|
|
|
|
|
|
type="number"
|
|
|
|
|
|
placeholder="请输入内容"
|
|
|
|
|
|
maxlength="10"
|
|
|
|
|
|
:clearable="false"
|
|
|
|
|
|
@blur="fitNumChange"
|
|
|
|
|
|
></uni-easyinput>
|
2025-07-03 10:12:01 +08:00
|
|
|
|
</uni-forms-item> -->
|
2025-06-24 17:44:17 +08:00
|
|
|
|
<uni-section title="领用工具器" type="line" />
|
|
|
|
|
|
<eselect
|
|
|
|
|
|
v-model="equipmentId"
|
|
|
|
|
|
style="width: 100%; height: 90rpx; margin: 10px 0"
|
|
|
|
|
|
ref="treeSelect"
|
|
|
|
|
|
:options="equipmentList"
|
2025-07-14 17:27:25 +08:00
|
|
|
|
:disabled="!formData.teamId || !formData.proId"
|
2025-06-24 17:44:17 +08:00
|
|
|
|
@change="changeEquipment"
|
|
|
|
|
|
></eselect>
|
|
|
|
|
|
</uni-forms>
|
|
|
|
|
|
|
|
|
|
|
|
<uni-table ref="table" border stripe emptyText="暂无更多数据">
|
|
|
|
|
|
<uni-tr>
|
|
|
|
|
|
<uni-th width="50" align="center">序号</uni-th>
|
|
|
|
|
|
<uni-th width="160" align="center">类型名称</uni-th>
|
|
|
|
|
|
<uni-th width="180" align="center">规格型号</uni-th>
|
2025-07-11 16:51:18 +08:00
|
|
|
|
<uni-th width="100" align="center">{{ opts.isOut ? '出库数' : '领用数' }}</uni-th>
|
2025-06-24 17:44:17 +08:00
|
|
|
|
<uni-th width="80" align="center">在库数</uni-th>
|
|
|
|
|
|
<uni-th width="80" align="center">在用数</uni-th>
|
2025-06-26 17:46:00 +08:00
|
|
|
|
<uni-th width="80" align="center" v-if="opts.isOut">预领数</uni-th>
|
2025-09-17 20:43:34 +08:00
|
|
|
|
<uni-th width="100" align="center">备注</uni-th>
|
2025-06-24 17:44:17 +08:00
|
|
|
|
<uni-th width="100" align="center">操作</uni-th>
|
|
|
|
|
|
</uni-tr>
|
|
|
|
|
|
<uni-tr v-for="(item, index) in tableData" :key="index">
|
|
|
|
|
|
<uni-td align="center">{{ index + 1 }}</uni-td>
|
|
|
|
|
|
<uni-td align="center">{{ item.maTypeName }}</uni-td>
|
|
|
|
|
|
<uni-td align="center">
|
|
|
|
|
|
<view class="name">{{ item.typeName }}</view>
|
|
|
|
|
|
</uni-td>
|
|
|
|
|
|
<uni-td align="center"
|
|
|
|
|
|
><uni-easyinput
|
|
|
|
|
|
v-if="item.manageType == 1 || !opts.isOut"
|
|
|
|
|
|
v-model="item.preNum"
|
|
|
|
|
|
placeholder="请输入数量"
|
2025-07-11 16:51:18 +08:00
|
|
|
|
:clearable="false"
|
2025-07-11 10:17:13 +08:00
|
|
|
|
@change="checkPerNum(item)"
|
2025-06-24 17:44:17 +08:00
|
|
|
|
></uni-easyinput>
|
|
|
|
|
|
<!-- 编码 -->
|
|
|
|
|
|
<span v-else style="color: #409eff" @click="getCode(item)">{{
|
|
|
|
|
|
!item.maCodeList || item.maCodeList.length == 0 ? '选择编码' : item.maCodeList.length
|
|
|
|
|
|
}}</span>
|
|
|
|
|
|
</uni-td>
|
2025-07-11 16:51:18 +08:00
|
|
|
|
<uni-td align="center">{{ item.storageNum }}</uni-td>
|
|
|
|
|
|
<uni-td align="center">{{ item.useNum }}</uni-td>
|
|
|
|
|
|
<uni-td align="center" v-if="opts.isOut">{{ item.preNum }}</uni-td>
|
2025-09-17 20:43:34 +08:00
|
|
|
|
<uni-td align="center">
|
|
|
|
|
|
<uni-easyinput
|
|
|
|
|
|
v-if="opts.isOut"
|
|
|
|
|
|
v-model="item.remark"
|
|
|
|
|
|
placeholder="请输入备注"
|
|
|
|
|
|
></uni-easyinput>
|
|
|
|
|
|
</uni-td>
|
2025-06-24 17:44:17 +08:00
|
|
|
|
<uni-td align="center">
|
|
|
|
|
|
<view
|
|
|
|
|
|
style="
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
"
|
|
|
|
|
|
>
|
|
|
|
|
|
<button
|
|
|
|
|
|
class="uni-button"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
type="warn"
|
|
|
|
|
|
@click="
|
|
|
|
|
|
() => {
|
|
|
|
|
|
tableData.splice(index, 1)
|
|
|
|
|
|
}
|
|
|
|
|
|
"
|
|
|
|
|
|
>
|
|
|
|
|
|
删除
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
2025-06-26 17:46:00 +08:00
|
|
|
|
v-if="item.manageType == 0 && item.maCodeList"
|
2025-06-24 17:44:17 +08:00
|
|
|
|
class="uni-button"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
@click="handleDetail(item)"
|
|
|
|
|
|
style="margin-top: 5px"
|
|
|
|
|
|
>
|
|
|
|
|
|
详情
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</uni-td>
|
|
|
|
|
|
</uni-tr>
|
|
|
|
|
|
</uni-table>
|
|
|
|
|
|
|
|
|
|
|
|
<button v-if="opts.isOut" style="width: 100%; margin: 50px 0" type="primary" @click="submit(1)">
|
2025-09-02 16:40:41 +08:00
|
|
|
|
提 交
|
2025-06-24 17:44:17 +08:00
|
|
|
|
</button>
|
|
|
|
|
|
<button v-else style="width: 100%; margin: 50px 0" type="primary" @click="submit(0)">
|
2025-09-02 16:40:41 +08:00
|
|
|
|
提 交
|
2025-06-24 17:44:17 +08:00
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<uni-popup ref="popup" type="center" border-radius="6px 6px 6px 6px" background-color="#fff">
|
|
|
|
|
|
<div style="padding: 20px">
|
|
|
|
|
|
<div>编码详情</div>
|
|
|
|
|
|
<div class="code-list">
|
|
|
|
|
|
<div v-for="(item, index) in popupRow" :key="index">
|
|
|
|
|
|
<span>{{ item.maCode }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</uni-popup>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { onLoad, onShow, onBackPress } from '@dcloudio/uni-app'
|
|
|
|
|
|
import { ref, reactive } from 'vue'
|
2025-07-11 16:51:18 +08:00
|
|
|
|
import eselect from '@/pages/materialsStation/toolsLease/components/eselect.vue'
|
2025-06-24 17:44:17 +08:00
|
|
|
|
import {
|
|
|
|
|
|
getBmTeamList,
|
|
|
|
|
|
getProjectList,
|
|
|
|
|
|
getTypeTreeList,
|
|
|
|
|
|
addLeaseTask,
|
|
|
|
|
|
editLeaseTask,
|
|
|
|
|
|
detailsLeaseTask,
|
|
|
|
|
|
getAgreementInfoByIdApi,
|
2025-09-27 16:04:37 +08:00
|
|
|
|
getPickDepartListApi,
|
2025-06-24 17:44:17 +08:00
|
|
|
|
} from '@/services/materialsStation'
|
|
|
|
|
|
import { useMemberStore } from '@/stores'
|
|
|
|
|
|
const memberStore = useMemberStore()
|
|
|
|
|
|
const userInfo = ref(memberStore.userInfo || {})
|
|
|
|
|
|
|
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
const title = ref('工器具领料申请')
|
|
|
|
|
|
const opts = ref({})
|
|
|
|
|
|
const form = ref()
|
|
|
|
|
|
const formData = reactive({
|
|
|
|
|
|
teamId: undefined,
|
|
|
|
|
|
projectId: undefined,
|
|
|
|
|
|
leasePerson: '',
|
2025-07-10 18:02:22 +08:00
|
|
|
|
relPhone: '',
|
2025-06-24 17:44:17 +08:00
|
|
|
|
isOut: 1,
|
|
|
|
|
|
remark: '',
|
2025-07-02 17:56:52 +08:00
|
|
|
|
fitNum: 1,
|
2025-07-10 18:02:22 +08:00
|
|
|
|
proId: undefined,
|
2025-09-27 16:04:37 +08:00
|
|
|
|
pickType: 0,
|
|
|
|
|
|
departId: undefined,
|
|
|
|
|
|
departName: '',
|
2025-06-24 17:44:17 +08:00
|
|
|
|
})
|
2025-07-02 17:56:52 +08:00
|
|
|
|
const lastFitNum = ref(formData.fitNum)
|
2025-06-24 17:44:17 +08:00
|
|
|
|
const equipmentId = ref()
|
|
|
|
|
|
const teamRange = ref([]) // 班组
|
|
|
|
|
|
const prodRange = ref([]) // 工程
|
|
|
|
|
|
const equipmentList = ref([]) // 工器具
|
|
|
|
|
|
const rules = ref({
|
|
|
|
|
|
teamId: {
|
|
|
|
|
|
rules: [{ required: true, errorMessage: '请选择班组' }],
|
|
|
|
|
|
},
|
2025-07-14 17:27:25 +08:00
|
|
|
|
proId: {
|
2025-06-24 17:44:17 +08:00
|
|
|
|
rules: [{ required: true, errorMessage: '请选择工程' }],
|
|
|
|
|
|
},
|
|
|
|
|
|
leasePerson: {
|
|
|
|
|
|
rules: [{ required: true, errorMessage: '请填写领用人' }],
|
|
|
|
|
|
},
|
2025-07-10 18:02:22 +08:00
|
|
|
|
// relPhone: {
|
2025-06-24 17:44:17 +08:00
|
|
|
|
// rules: [{ required: true, errorMessage: '请填写联系电话' }],
|
|
|
|
|
|
// },
|
|
|
|
|
|
})
|
|
|
|
|
|
const tableData = ref([])
|
|
|
|
|
|
const popup = ref()
|
|
|
|
|
|
const popupRow = ref({})
|
2025-09-27 16:04:37 +08:00
|
|
|
|
const proDeptList = ref([])
|
|
|
|
|
|
const pickTypeList = ref([
|
|
|
|
|
|
{ text: '班组', value: 0 },
|
|
|
|
|
|
{ text: '项目部', value: 1 },
|
|
|
|
|
|
])
|
2025-06-24 17:44:17 +08:00
|
|
|
|
|
2025-07-02 17:56:52 +08:00
|
|
|
|
// 适用班组数
|
|
|
|
|
|
const fitNumChange = () => {
|
|
|
|
|
|
const newVal = Math.min(5, Math.max(1, parseInt(formData.fitNum) || 1))
|
|
|
|
|
|
|
|
|
|
|
|
// 计算变化比例
|
|
|
|
|
|
const ratio = newVal / lastFitNum.value
|
|
|
|
|
|
|
|
|
|
|
|
// 更新每条数据的预领数量
|
|
|
|
|
|
tableData.value.forEach((item) => {
|
|
|
|
|
|
// 仅当是数字才执行,避免 null 或空
|
|
|
|
|
|
if (typeof item.preNum === 'number') {
|
|
|
|
|
|
item.preNum = Math.max(1, Math.floor(item.preNum * ratio)) // 向下取整,且至少为1
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 更新 formData.fitNum 和记录的 lastFitNum
|
|
|
|
|
|
formData.fitNum = newVal
|
|
|
|
|
|
lastFitNum.value = newVal
|
|
|
|
|
|
}
|
2025-06-24 17:44:17 +08:00
|
|
|
|
// 编辑获取详情
|
|
|
|
|
|
const getDetailsById = async () => {
|
|
|
|
|
|
try {
|
2025-08-04 10:18:44 +08:00
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
title: '加载中...',
|
|
|
|
|
|
mask: true, // 遮罩层
|
|
|
|
|
|
})
|
2025-06-24 17:44:17 +08:00
|
|
|
|
const res = await detailsLeaseTask(opts.value.id)
|
|
|
|
|
|
console.log('🚀 ~ getDetailsById ~ res:', res)
|
|
|
|
|
|
tableData.value = res.data.leaseApplyDetailsList
|
2025-07-16 11:30:27 +08:00
|
|
|
|
tableData.value.forEach((item) => {
|
|
|
|
|
|
item.maCodeList = item.maCodeVoList || item.maCodeList || []
|
|
|
|
|
|
})
|
2025-06-24 17:44:17 +08:00
|
|
|
|
Object.assign(formData, res.data.leaseApplyInfo)
|
2025-07-14 17:27:25 +08:00
|
|
|
|
formData.proId = res.data.leaseApplyInfo.proId
|
2025-09-27 16:04:37 +08:00
|
|
|
|
formData.projectId = prodRange.value.find(
|
|
|
|
|
|
(item) => item.proId == res.data.leaseApplyInfo.proId,
|
|
|
|
|
|
)?.projectId
|
2025-09-02 16:40:41 +08:00
|
|
|
|
formData.relPhone = res.data.leaseApplyInfo.phone || res.data.leaseApplyInfo.relPhone || ''
|
2025-09-22 20:04:53 +08:00
|
|
|
|
await getTeamList()
|
|
|
|
|
|
await getAgreementInfoById()
|
2025-09-28 21:23:31 +08:00
|
|
|
|
if (res.msg.includes('您所选择的')) {
|
|
|
|
|
|
// 弹框提示
|
|
|
|
|
|
uni.showModal({
|
|
|
|
|
|
content: res.msg,
|
|
|
|
|
|
showCancel: false,
|
|
|
|
|
|
confirmText: '关闭',
|
|
|
|
|
|
confirmColor: '#ccc',
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-06-24 17:44:17 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.log('🚀 ~ getDetailsById ~ error:', error)
|
2025-08-04 10:18:44 +08:00
|
|
|
|
} finally {
|
|
|
|
|
|
uni.hideLoading()
|
2025-06-24 17:44:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-27 16:04:37 +08:00
|
|
|
|
// 获取项目部列表
|
|
|
|
|
|
const getProDeptList = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getPickDepartListApi({ proId: formData.projectId })
|
|
|
|
|
|
if (!res.data || res.data.length == 0) return
|
|
|
|
|
|
proDeptList.value = res.data.map((item) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
value: item.departId,
|
|
|
|
|
|
text: item.departName,
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.log('🚀 ~ getProDeptList ~ error:', error)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-06-24 17:44:17 +08:00
|
|
|
|
// 获取班组
|
|
|
|
|
|
const getTeamList = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
isAll: 0,
|
2025-07-10 18:02:22 +08:00
|
|
|
|
projectId: formData.projectId,
|
2025-09-27 16:04:37 +08:00
|
|
|
|
idCard: uni.getStorageSync('idCard'),
|
2025-06-24 17:44:17 +08:00
|
|
|
|
}
|
2025-07-10 18:02:22 +08:00
|
|
|
|
// if (!opts.value.isOut) {
|
|
|
|
|
|
// params.idCard = uni.getStorageSync('idCard')
|
|
|
|
|
|
// }
|
2025-06-24 17:44:17 +08:00
|
|
|
|
console.log('🚀 ~ getTeamList ~ params:', params)
|
|
|
|
|
|
const res = await getBmTeamList(params)
|
|
|
|
|
|
// teamRange.value = res.data
|
|
|
|
|
|
if (res.data.length > 0) {
|
|
|
|
|
|
teamRange.value = res.data.map((item) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
value: item.id,
|
|
|
|
|
|
text: item.teamName,
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
// console.log('🚀 ~ teamRange.value=res.data.map ~ teamRange.value:', teamRange.value)
|
|
|
|
|
|
// 如果 teamRange.value 列表中的 idCard 有与userInfo.userName 一致的,则设置 teamId
|
2025-09-26 18:08:14 +08:00
|
|
|
|
if (opts.value.isEdit) {
|
|
|
|
|
|
const team = res.data.find((item) => item.teamName == formData.teamName)
|
2025-09-27 16:04:37 +08:00
|
|
|
|
console.log('xxxxxxxxx', team)
|
2025-06-24 17:44:17 +08:00
|
|
|
|
formData.teamId = team.id
|
|
|
|
|
|
formData.teamName = team.teamName
|
|
|
|
|
|
formData.leasePerson = team.relName
|
2025-07-10 18:02:22 +08:00
|
|
|
|
formData.relPhone = team.relPhone || ''
|
|
|
|
|
|
formData.relName = team.relName
|
|
|
|
|
|
formData.teamLeaderIdCard = team.teamLeaderIdCard
|
2025-09-17 20:43:34 +08:00
|
|
|
|
formData.subUnitName = team.subUnitName || ''
|
2025-06-24 17:44:17 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
formData.teamId = res.data[0].id
|
|
|
|
|
|
formData.teamName = res.data[0].teamName
|
|
|
|
|
|
formData.leasePerson = res.data[0].relName
|
2025-07-10 18:02:22 +08:00
|
|
|
|
formData.relPhone = res.data[0].relPhone || ''
|
|
|
|
|
|
formData.relName = res.data[0].relName
|
|
|
|
|
|
formData.teamLeaderIdCard = res.data[0].teamLeaderIdCard
|
2025-09-17 20:43:34 +08:00
|
|
|
|
formData.subUnitName = res.data[0].subUnitName || ''
|
2025-06-24 17:44:17 +08:00
|
|
|
|
}
|
2025-07-10 18:02:22 +08:00
|
|
|
|
// getProjectListApi()
|
2025-09-22 20:04:53 +08:00
|
|
|
|
// getAgreementInfoById()
|
2025-09-23 18:50:34 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
2025-09-28 19:10:15 +08:00
|
|
|
|
title: '暂无班组入场信息',
|
2025-09-23 18:50:34 +08:00
|
|
|
|
})
|
2025-06-24 17:44:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.log('🚀 ~ getTeamList ~ error:', error)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 获取工程
|
|
|
|
|
|
const getProjectListApi = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getProjectList({ unitId: null, isApp: true, teamName: formData.teamName })
|
|
|
|
|
|
if (!res.data || !res.data.length) return
|
|
|
|
|
|
console.log('🚀 ~ getProjectListApi ~ res:', res)
|
|
|
|
|
|
prodRange.value = res.data.map((item) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
2025-07-14 17:27:25 +08:00
|
|
|
|
value: item.proId,
|
2025-06-24 17:44:17 +08:00
|
|
|
|
text: item.proName,
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.log('🚀 ~ getProjectListApi ~ error:', error)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取协议信息
|
|
|
|
|
|
const getAgreementInfoById = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
teamId: formData.teamId,
|
2025-07-10 18:02:22 +08:00
|
|
|
|
proId: formData.proId,
|
|
|
|
|
|
// projectId: formData.projectId,
|
2025-06-24 17:44:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
const res = await getAgreementInfoByIdApi(params)
|
|
|
|
|
|
console.log('🚀 ~ getAgreementInfoById ~ res:', res)
|
2025-09-22 20:04:53 +08:00
|
|
|
|
if (!res.data) {
|
|
|
|
|
|
equipmentList.value = []
|
2025-07-05 17:19:14 +08:00
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
const agreementId = res.data
|
2025-09-23 18:50:34 +08:00
|
|
|
|
if (agreementId.length > 0) {
|
|
|
|
|
|
getEquipmentList(agreementId)
|
|
|
|
|
|
} else {
|
2025-09-27 16:04:37 +08:00
|
|
|
|
console.log('工程和班组没有协议')
|
2025-09-23 18:50:34 +08:00
|
|
|
|
}
|
2025-06-24 17:44:17 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.log('🚀 ~ getAgreementInfoById ~ error:', error)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 获取工具器
|
|
|
|
|
|
const getEquipmentList = async (params) => {
|
|
|
|
|
|
console.log('🚀 ~ getEquipmentList ~ params:', params)
|
2025-08-05 09:20:41 +08:00
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
title: '加载中...',
|
|
|
|
|
|
mask: true, // 遮罩层
|
|
|
|
|
|
})
|
2025-06-24 17:44:17 +08:00
|
|
|
|
try {
|
2025-09-27 16:04:37 +08:00
|
|
|
|
const res = await getTypeTreeList({
|
|
|
|
|
|
agreementIdList: params,
|
|
|
|
|
|
proId: formData.proId,
|
|
|
|
|
|
teamName: formData.teamName,
|
|
|
|
|
|
})
|
2025-09-22 20:04:53 +08:00
|
|
|
|
if (res.data) {
|
2025-06-24 17:44:17 +08:00
|
|
|
|
equipmentList.value = formatEquipmentTree(res.data)
|
|
|
|
|
|
console.log('🚀 ~ getEquipmentList ~ machineList.value:', equipmentList.value)
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.log('🚀 ~ getMachineListApi ~ error:', error)
|
2025-08-05 09:20:41 +08:00
|
|
|
|
} finally {
|
|
|
|
|
|
uni.hideLoading()
|
2025-06-24 17:44:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
function formatEquipmentTree(list) {
|
|
|
|
|
|
return list.map((item) => {
|
|
|
|
|
|
const newItem = {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
id: item.typeId,
|
|
|
|
|
|
name: item.typeName,
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.children && item.children.length > 0) {
|
|
|
|
|
|
newItem.children = formatEquipmentTree(item.children)
|
|
|
|
|
|
}
|
|
|
|
|
|
return newItem
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// 校验电话
|
|
|
|
|
|
const checkPhone = (rule, value, callback) => {
|
2025-07-10 18:02:22 +08:00
|
|
|
|
if (!/^1[3-9][0-9]{9}$/.test(formData.relPhone)) {
|
2025-06-24 17:44:17 +08:00
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
title: '请输入正确的电话号码',
|
|
|
|
|
|
})
|
|
|
|
|
|
// 清空
|
2025-07-10 18:02:22 +08:00
|
|
|
|
formData.relPhone = ''
|
2025-06-24 17:44:17 +08:00
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 检查数量
|
|
|
|
|
|
const checkPerNum = (item) => {
|
|
|
|
|
|
// 大于1的正整数 正则校验
|
2025-07-11 10:17:13 +08:00
|
|
|
|
if (item.unitValue == 1) {
|
|
|
|
|
|
item.preNum = Number(String(item.preNum).replace(/[^\d.]/g, ''))
|
|
|
|
|
|
} else {
|
|
|
|
|
|
item.preNum = Number(String(item.preNum).replace(/[^\d]/g, ''))
|
2025-06-24 17:44:17 +08:00
|
|
|
|
}
|
2025-07-11 10:17:13 +08:00
|
|
|
|
// if (!/^[1-9]\d*$/.test(item.preNum)) {
|
|
|
|
|
|
// uni.showToast({
|
|
|
|
|
|
// icon: 'none',
|
|
|
|
|
|
// title: '请输入正确的数量',
|
|
|
|
|
|
// })
|
|
|
|
|
|
// // 重置为1
|
|
|
|
|
|
// item.preNum = 1
|
|
|
|
|
|
// return false
|
|
|
|
|
|
// }
|
2025-06-24 17:44:17 +08:00
|
|
|
|
if (opts.value.isOut) {
|
|
|
|
|
|
if (item.preNum > item.storageNum) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
title: '出库数量不能大于库存数量',
|
|
|
|
|
|
})
|
|
|
|
|
|
// 重置为库存数量
|
|
|
|
|
|
item.preNum = item.storageNum
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-27 16:04:37 +08:00
|
|
|
|
const changeDept = (e) => {
|
|
|
|
|
|
console.log('🚀 ~ changeDept ~ e:', e)
|
|
|
|
|
|
const dept = proDeptList.value.find((item) => item.departId === e)
|
|
|
|
|
|
console.log('🚀 ~ changeDept ~ dept:', dept)
|
|
|
|
|
|
formData.teamId = dept.departId
|
|
|
|
|
|
formData.teamName = dept.departName
|
|
|
|
|
|
getAgreementInfoById()
|
|
|
|
|
|
}
|
2025-06-24 17:44:17 +08:00
|
|
|
|
// 选择班组
|
|
|
|
|
|
const changeTeamd = (e) => {
|
|
|
|
|
|
console.log('🚀 ~ changeTeamd ~ e:', e)
|
|
|
|
|
|
const team = teamRange.value.find((item) => item.id === e)
|
|
|
|
|
|
console.log('🚀 ~ changeTeamd ~ team:', team)
|
2025-07-10 18:02:22 +08:00
|
|
|
|
// formData.projectId = null
|
2025-06-24 17:44:17 +08:00
|
|
|
|
formData.teamName = team ? team.teamName : ''
|
|
|
|
|
|
formData.leasePerson = team ? team.relName : ''
|
2025-07-10 18:02:22 +08:00
|
|
|
|
formData.relPhone = team ? team.relPhone : ''
|
|
|
|
|
|
formData.relName = team ? team.relName : ''
|
2025-06-24 17:44:17 +08:00
|
|
|
|
formData.phone = team ? team.relPhone : ''
|
2025-07-10 18:02:22 +08:00
|
|
|
|
formData.teamLeaderIdCard = team ? team.teamLeaderIdCard : ''
|
2025-09-27 16:04:37 +08:00
|
|
|
|
formData.subUnitName = team ? team.subUnitName : ''
|
2025-06-24 17:44:17 +08:00
|
|
|
|
equipmentList.value = []
|
2025-07-10 18:02:22 +08:00
|
|
|
|
// getProjectListApi()
|
|
|
|
|
|
getAgreementInfoById()
|
2025-06-24 17:44:17 +08:00
|
|
|
|
}
|
2025-09-27 16:04:37 +08:00
|
|
|
|
const changePickType = (e) => {
|
|
|
|
|
|
tableData.value = []
|
|
|
|
|
|
formData.teamId = null
|
|
|
|
|
|
if (e == 0) {
|
|
|
|
|
|
getTeamList()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
getProDeptList()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-06-24 17:44:17 +08:00
|
|
|
|
// 选择工程
|
2025-09-22 20:04:53 +08:00
|
|
|
|
const changeProd = async (e) => {
|
2025-06-24 17:44:17 +08:00
|
|
|
|
console.log('🚀 ~ changeProd ~ e:', e)
|
2025-07-14 17:27:25 +08:00
|
|
|
|
formData.proId = e
|
2025-09-27 16:04:37 +08:00
|
|
|
|
formData.projectId = prodRange.value.find((item) => item.proId == e)?.projectId
|
2025-09-29 13:43:31 +08:00
|
|
|
|
formData.teamId = null
|
|
|
|
|
|
formData.leasePerson = ''
|
2025-09-27 16:04:37 +08:00
|
|
|
|
console.log('xxxxxxxxxxxxxxxxxxxxxx', formData.projectId)
|
2025-09-22 20:04:53 +08:00
|
|
|
|
tableData.value = []
|
2025-09-27 16:04:37 +08:00
|
|
|
|
if (formData.pickType == 0) {
|
|
|
|
|
|
await getTeamList()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
await getProDeptList()
|
|
|
|
|
|
}
|
2025-09-22 20:04:53 +08:00
|
|
|
|
await getAgreementInfoById()
|
2025-06-24 17:44:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 选择工器具
|
|
|
|
|
|
const changeEquipment = (e) => {
|
|
|
|
|
|
console.log('🚀 ~ changeEquipment ~ e:', e)
|
|
|
|
|
|
// 判断是否已添加同型号
|
|
|
|
|
|
if (tableData.value.some((item) => item.typeId === e.typeId)) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
title: '该型号已添加',
|
|
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 从 equipmentList.value 中获取点击id的上一级的 typeName
|
|
|
|
|
|
const equipment = findEquipmentById(equipmentList.value, e.parentId)
|
2025-07-11 10:17:13 +08:00
|
|
|
|
tableData.value.unshift({
|
2025-06-24 17:44:17 +08:00
|
|
|
|
...JSON.parse(JSON.stringify(e)),
|
2025-06-26 17:46:00 +08:00
|
|
|
|
storageNum: e.num,
|
2025-06-24 17:44:17 +08:00
|
|
|
|
maTypeName: equipment.typeName,
|
2025-06-26 17:46:00 +08:00
|
|
|
|
preNum: 1, // 数量默认为1
|
2025-06-24 17:44:17 +08:00
|
|
|
|
maCodeList: [],
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
equipmentId.value = ''
|
|
|
|
|
|
}, 300)
|
|
|
|
|
|
}
|
|
|
|
|
|
// 递归查找指定 id 的节点
|
|
|
|
|
|
function findEquipmentById(list, id) {
|
|
|
|
|
|
for (const item of list) {
|
|
|
|
|
|
if (item.id === id) {
|
|
|
|
|
|
return item
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.children && item.children.length > 0) {
|
|
|
|
|
|
const found = findEquipmentById(item.children, id)
|
|
|
|
|
|
if (found) return found
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 处理详情
|
|
|
|
|
|
const handleDetail = (item) => {
|
|
|
|
|
|
console.log('🚀 ~ handleDetail ~ item:', item)
|
|
|
|
|
|
// 弹框展示编码详情 uni-popup 展示详情
|
|
|
|
|
|
popup.value.open()
|
|
|
|
|
|
popupRow.value = item.maCodeList
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取编码
|
|
|
|
|
|
const getCode = (item) => {
|
|
|
|
|
|
console.log('🚀 ~ getCode ~ item:', item)
|
|
|
|
|
|
if (item.maCodeList && item.maCodeList.length > 0) {
|
|
|
|
|
|
item.maCodeList.forEach((code) => {
|
|
|
|
|
|
code.checked = true
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
item.isEdit = opts.value.isEdit
|
|
|
|
|
|
uni.navigateTo({
|
2025-06-26 17:46:00 +08:00
|
|
|
|
url:
|
|
|
|
|
|
'/pages/materialsStation/toolsLease/codeOut?params=' +
|
2025-09-30 18:28:02 +08:00
|
|
|
|
JSON.stringify({ ...item, proId: formData.proId, teamId: formData.teamId}),
|
2025-06-24 17:44:17 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const submit = (isOut) => {
|
|
|
|
|
|
console.log('🚀 ~ submit ~ submit:', formData)
|
|
|
|
|
|
// 校验表单
|
|
|
|
|
|
form.value
|
|
|
|
|
|
.validate()
|
|
|
|
|
|
.then(async (valid) => {
|
|
|
|
|
|
formData.isOut = isOut
|
2025-09-02 16:40:41 +08:00
|
|
|
|
formData.phone = formData.relPhone
|
2025-06-24 17:44:17 +08:00
|
|
|
|
formData.createBy = uni.getStorageSync('username') || ''
|
|
|
|
|
|
console.log('🚀 ~ form.value.validate.then ~ valid:', valid)
|
|
|
|
|
|
if (tableData.value.length === 0) {
|
|
|
|
|
|
await uni.showToast({
|
|
|
|
|
|
title: '请添加领用数据',
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
duration: 1000,
|
|
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
tableData.value.forEach((item) => {
|
|
|
|
|
|
if (item.manageType == 0 && opts.value.isOut) {
|
|
|
|
|
|
item.preNum = item.maCodeList ? item.maCodeList.length : 0
|
|
|
|
|
|
}
|
|
|
|
|
|
item.outNum = item.preNum
|
|
|
|
|
|
})
|
|
|
|
|
|
// tableData.value 循环 preNum 不能小于 0, 小于0的提示到具体行
|
|
|
|
|
|
for (let i = 0; i < tableData.value.length; i++) {
|
|
|
|
|
|
console.log('🚀 ~ .then ~ tableData.value[i].preNum:', tableData.value[i].preNum)
|
2025-07-26 14:28:21 +08:00
|
|
|
|
if (tableData.value[i].preNum < 0) {
|
2025-06-24 17:44:17 +08:00
|
|
|
|
await uni.showToast({
|
|
|
|
|
|
title: `第${i + 1}行出库数量不能为0`,
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
duration: 1000,
|
|
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
leaseApplyDetailsList: tableData.value,
|
|
|
|
|
|
leaseApplyInfo: formData,
|
|
|
|
|
|
}
|
|
|
|
|
|
console.log('🚀 ~ .then ~ params:', params)
|
2025-09-02 16:40:41 +08:00
|
|
|
|
if (isOut != 0) {
|
|
|
|
|
|
// 弹框确定
|
|
|
|
|
|
const resp = await uni.showModal({
|
|
|
|
|
|
title: '提示',
|
|
|
|
|
|
content: '是否确认提交?',
|
|
|
|
|
|
confirmText: '提交',
|
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log('🚀 ~ .confirm ~ resp:', resp)
|
|
|
|
|
|
if (!resp.confirm) return
|
|
|
|
|
|
}
|
2025-06-24 17:44:17 +08:00
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
title: '提交中...',
|
|
|
|
|
|
mask: true, // 遮罩层
|
|
|
|
|
|
})
|
|
|
|
|
|
try {
|
|
|
|
|
|
if (!opts.value.isEdit) {
|
|
|
|
|
|
console.log('新增')
|
|
|
|
|
|
const res = await addLeaseTask(params)
|
|
|
|
|
|
tableData.value = []
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
console.log('🚀 ~ .then ~ res:', res)
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
title: '操作成功',
|
|
|
|
|
|
})
|
|
|
|
|
|
back()
|
|
|
|
|
|
} else if (opts.value.isEdit) {
|
|
|
|
|
|
const res = await editLeaseTask(params)
|
|
|
|
|
|
tableData.value = []
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
title: '操作成功',
|
|
|
|
|
|
})
|
|
|
|
|
|
back()
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.log('🚀 ~ .then ~ error:', error)
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
|
console.log('🚀 ~ form.value.validate.catch ~ err:', err)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const back = () => {
|
2025-09-27 16:04:37 +08:00
|
|
|
|
if (tableData.value.length > 0 && formData.pickType != 1) {
|
2025-06-24 17:44:17 +08:00
|
|
|
|
uni
|
|
|
|
|
|
.showModal({
|
|
|
|
|
|
title: '提示',
|
|
|
|
|
|
content: '当前有未提交的数据,是否暂存?',
|
2025-08-04 10:18:44 +08:00
|
|
|
|
confirmText: '暂存',
|
|
|
|
|
|
cancelText: '不暂存',
|
2025-06-24 17:44:17 +08:00
|
|
|
|
})
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
|
submit(0)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.navigateBack({
|
|
|
|
|
|
delta: 1,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.navigateBack({
|
|
|
|
|
|
delta: 1,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onLoad((opt) => {
|
|
|
|
|
|
console.log('onLoad', opt)
|
|
|
|
|
|
opts.value = opt.params ? JSON.parse(opt.params) : {}
|
|
|
|
|
|
title.value = opts.value.title
|
|
|
|
|
|
if (opts.value.isEdit) {
|
2025-09-22 20:04:53 +08:00
|
|
|
|
getProjectListApi().then(() => {
|
|
|
|
|
|
getDetailsById()
|
|
|
|
|
|
})
|
2025-06-24 17:44:17 +08:00
|
|
|
|
} else {
|
2025-07-10 18:02:22 +08:00
|
|
|
|
// getTeamList()
|
|
|
|
|
|
getProjectListApi()
|
2025-06-24 17:44:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
onShow(() => {
|
|
|
|
|
|
console.log('onShow')
|
|
|
|
|
|
// 监听添加编码
|
|
|
|
|
|
uni.$on('maCodeList', (data) => {
|
|
|
|
|
|
console.log('🚀 ~ onShow ~ data:', data)
|
2025-06-26 17:46:00 +08:00
|
|
|
|
const item = tableData.value.find((item) => item.typeId == data[0].typeId)
|
2025-06-24 17:44:17 +08:00
|
|
|
|
console.log('🚀 ~ onShow ~ item:', item)
|
|
|
|
|
|
if (item) {
|
|
|
|
|
|
item.maCodeList = data
|
|
|
|
|
|
item.preNum = data.length
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log('🚀 ~ onShow ~ tableData.value:', tableData.value)
|
|
|
|
|
|
})
|
|
|
|
|
|
onBackPress((opt) => {
|
|
|
|
|
|
console.log('🚀 ~ onBackPress ~ opt:', opt)
|
|
|
|
|
|
if (opt.from == 'backbutton') {
|
|
|
|
|
|
if (tableData.value.length > 0) {
|
|
|
|
|
|
// 仅提示数据未提交
|
|
|
|
|
|
uni.showToast({
|
2025-09-27 16:04:37 +08:00
|
|
|
|
title: `当前有未提交数据, 请先${formData.pickType != 1 ? '提交' : '暂存或提交'}`,
|
2025-06-24 17:44:17 +08:00
|
|
|
|
icon: 'none',
|
|
|
|
|
|
duration: 1000,
|
|
|
|
|
|
})
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.content {
|
|
|
|
|
|
padding: 10px;
|
|
|
|
|
|
background-color: #fafafa;
|
|
|
|
|
|
}
|
|
|
|
|
|
.col {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|