This commit is contained in:
parent
8923fca4f3
commit
1ba8b6eb90
|
|
@ -55,6 +55,13 @@
|
|||
@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>
|
||||
<uni-section title="工器具退料" type="line"></uni-section>
|
||||
<eselect
|
||||
v-model="equipmentId"
|
||||
|
|
@ -112,7 +119,9 @@
|
|||
>
|
||||
删除
|
||||
</button>
|
||||
<button class="uni-button" size="mini" type="primary" @click="">出库</button>
|
||||
<!-- <button class="uni-button" size="mini" type="primary" @click="submit(1, item)">
|
||||
出库
|
||||
</button> -->
|
||||
</uni-td>
|
||||
</uni-tr>
|
||||
</uni-table>
|
||||
|
|
@ -122,7 +131,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { onLoad, onShow, onBackPress } from '@dcloudio/uni-app'
|
||||
import { ref, reactive } from 'vue'
|
||||
import eselect from '@/components/tree-select/eselect.vue'
|
||||
import {
|
||||
|
|
@ -147,6 +156,7 @@ const formData = reactive({
|
|||
agreementId: undefined,
|
||||
remark: undefined,
|
||||
isBack: 1,
|
||||
remark: '',
|
||||
})
|
||||
const agreementId = ref('')
|
||||
const equipmentId = ref()
|
||||
|
|
@ -172,7 +182,7 @@ const getDetailsById = async () => {
|
|||
const res = await detailsBackTask(opts.value.id)
|
||||
console.log('🚀 ~ getDetailsById ~ res:', res)
|
||||
res.data.backApplyInfo.projectId = res.data.backApplyInfo.proId
|
||||
if (res.data && res.data.backApplyDetailsList.length > 0) {
|
||||
if (res.data && res.data.backApplyDetailsList && res.data.backApplyDetailsList.length > 0) {
|
||||
tableData.value = res.data.backApplyDetailsList.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
|
|
@ -435,16 +445,18 @@ const submit = (isBack) => {
|
|||
title: '提交中...',
|
||||
})
|
||||
try {
|
||||
let res = null
|
||||
if (!opts.value.isEdit) {
|
||||
const res = await backTask(params)
|
||||
console.log('🚀 ~ .then ~ res:', res)
|
||||
uni.hideLoading()
|
||||
back()
|
||||
console.log('🚀 ~ .then ~ 新增:')
|
||||
res = await backTask(params)
|
||||
} else {
|
||||
const res = await editBackTask(params)
|
||||
console.log('🚀 ~ .then ~ 编辑:')
|
||||
res = await editBackTask(params)
|
||||
}
|
||||
console.log('🚀 ~ .then ~ res:', res)
|
||||
tableData.value = []
|
||||
uni.hideLoading()
|
||||
back()
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ .then ~ error:', error)
|
||||
uni.hideLoading()
|
||||
|
|
@ -504,6 +516,22 @@ onShow(() => {
|
|||
})
|
||||
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({
|
||||
title: '当前有未提交数据, 请暂存或提交',
|
||||
icon: 'none',
|
||||
duration: 1000,
|
||||
})
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ const getList = async () => {
|
|||
]
|
||||
return {
|
||||
...item,
|
||||
options: item.taskStatus == 4 ? [] : options, // 如果任务状态为4,则不显示操作按钮
|
||||
options: item.taskStatus == 2 ? [] : options, // 如果任务状态为4,则不显示操作按钮
|
||||
}
|
||||
})
|
||||
console.log('🚀 ~ getList ~ tableList.value:', tableList.value)
|
||||
|
|
|
|||
|
|
@ -48,6 +48,27 @@
|
|||
<text>{{ isSelectNum }} / {{ codeDeviceList.length }} 条已选</text>
|
||||
</checkbox-group>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="" name="">
|
||||
<div
|
||||
style="display: flex; align-items: center; flex-wrap: wrap"
|
||||
>
|
||||
<div
|
||||
v-for="(item, index) in codeDeviceList"
|
||||
style="margin: 0 5px"
|
||||
v-show="item.checked"
|
||||
>
|
||||
<span
|
||||
>{{ item.maCode }}
|
||||
<uni-icons
|
||||
type="close"
|
||||
size="18"
|
||||
color="red"
|
||||
@click="handleItemChecked(item)"
|
||||
></uni-icons
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
</uni-forms-item>
|
||||
<!--
|
||||
|
||||
<uni-forms-item
|
||||
|
|
@ -243,14 +264,15 @@ const getCodeList = async () => {
|
|||
materialModel: item.typeName,
|
||||
}
|
||||
})
|
||||
// 将 queryParamsTemp.value.maCodeList 有的值设置 为 checked= true
|
||||
queryParamsTemp.value.maCodeList.forEach((e) => {
|
||||
const index = codeDeviceList.value.findIndex((item) => item.maId === e.maId)
|
||||
console.log('🚀 ~ queryParamsTemp.value.maCodeList.forEach ~ index:', index)
|
||||
if (index !== -1) {
|
||||
codeDeviceList.value[index].checked = true
|
||||
}
|
||||
})
|
||||
// 将queryParamsTemp.value.maCodeList 与 codeDeviceList.value 去重合并
|
||||
codeDeviceList.value = [
|
||||
...new Map(
|
||||
[...codeDeviceList.value, ...queryParamsTemp.value.maCodeList].map((item) => [
|
||||
item.maId,
|
||||
item,
|
||||
]),
|
||||
).values(),
|
||||
]
|
||||
// 更新全选状态
|
||||
allChecked.value = codeDeviceList.value.every((e) => e.checked)
|
||||
console.log('🚀 ~ getCodeList ~ allChecked.value:', allChecked.value)
|
||||
|
|
@ -302,6 +324,11 @@ const getCodeDetailData = async (id, publishTask, typeId) => {
|
|||
// 获取编码列表
|
||||
const getCodeDeviceListData = async () => {
|
||||
console.log('🚀 ~ getCodeDeviceListData ~ queryCodeParams.value:', queryCodeParams.value)
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
})
|
||||
const res = await getCodeDeviceListAPI(queryCodeParams.value)
|
||||
console.log('🚀 ~ getCodeDeviceListData ~ res:', res)
|
||||
codeDeviceList.value.push(...res.data)
|
||||
|
|
@ -311,12 +338,20 @@ const getCodeDeviceListData = async () => {
|
|||
})
|
||||
}
|
||||
total.value = res.total
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
}, 500)
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ getCodeDeviceListData ~ error:', error)
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
// 编码搜索按钮
|
||||
const onCodeSearch = () => {
|
||||
queryCodeParams.value.pageNum = 1
|
||||
codeDeviceList.value = []
|
||||
allChecked.value = false
|
||||
getCodeDeviceListData()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,13 @@
|
|||
@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>
|
||||
<uni-section title="领用工具器" type="line" />
|
||||
<eselect
|
||||
v-model="equipmentId"
|
||||
|
|
@ -145,7 +152,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { onLoad, onShow, onBackPress } from '@dcloudio/uni-app'
|
||||
import { ref, reactive } from 'vue'
|
||||
import eselect from '@/components/tree-select/eselect.vue'
|
||||
import {
|
||||
|
|
@ -169,6 +176,7 @@ const formData = reactive({
|
|||
leasePerson: '',
|
||||
phone: '',
|
||||
isOut: 1,
|
||||
remark: '',
|
||||
})
|
||||
const equipmentId = ref()
|
||||
const teamRange = ref([]) // 班组
|
||||
|
|
@ -569,6 +577,22 @@ onShow(() => {
|
|||
})
|
||||
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({
|
||||
title: '当前有未提交数据, 请暂存或提交',
|
||||
icon: 'none',
|
||||
duration: 1000,
|
||||
})
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
Loading…
Reference in New Issue