工器具退料

This commit is contained in:
hayu 2025-05-29 19:35:38 +08:00
parent f98cb0d953
commit a4bbeef334
11 changed files with 3271 additions and 1 deletions

View File

@ -51,8 +51,57 @@
}
},
// -
// {
// "path": "pages/toolsLease/toolsLeaseOut",
// "style": {
// "navigationStyle": "custom"
// }
// },
// 退
{
"path": "pages/toolsLease/toolsLeaseOut",
"path": "pages/toolsBack/toolsBack",
"style": {
"navigationStyle": "custom"
}
},
//退--
{
"path": "pages/toolsBack/toolsAddBack",
"style": {
"navigationStyle": "custom"
}
},
//退--
{
"path": "pages/toolsBack/toolsDetail",
"style": {
"navigationStyle": "custom"
}
},
//退--
{
"path": "pages/toolsBack/toolsBackCodeDetail",
"style": {
"navigationStyle": "custom"
}
},
//退--
{
"path": "pages/toolsBack/toolsBackNumDetail",
"style": {
"navigationStyle": "custom"
}
},
//退
{
"path": "pages/toolsBack/toolsBackCode",
"style": {
"navigationStyle": "custom"
}
},
//退
{
"path": "pages/toolsBack/toolsBackNum",
"style": {
"navigationStyle": "custom"
}

View File

@ -0,0 +1,428 @@
<template>
<uni-nav-bar
dark
:fixed="true"
shadow
background-color="#4AA4EA"
status-bar
left-icon="left"
left-text="返回"
:title="title"
@clickLeft="back"
right-icon="scan"
@clickRight="rightClick"
/>
<div class="content">
<uni-section title="任务信息" type="line"></uni-section>
<uni-forms ref="form" :rules="rules" :model="formData" label-width="80px">
<uni-forms-item label="退料班组" required name="teamId">
<uni-data-select
v-model="formData.teamId"
:localdata="teamRange"
filterable
:disabled="opts.isEdit"
@change="changeTeamd"
></uni-data-select>
</uni-forms-item>
<uni-forms-item label="工程名称" required name="projectId">
<eselect
style="width: 100%; height: 90rpx"
v-model="formData.projectId"
ref="treeSelect"
:options="prodRange"
:disabled="opts.isEdit"
@change="changeProd"
@clear="
() => {
formData.projectId = ''
}
"
></eselect>
</uni-forms-item>
<uni-forms-item label="退料人员" required name="backPerson">
<uni-easyinput v-model="formData.backPerson" placeholder="请输入内容"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="联系电话" required name="phone">
<uni-easyinput
v-model="formData.phone"
placeholder="请输入内容"
maxlength="11"
@blur="checkPhone"
></uni-easyinput>
</uni-forms-item>
<uni-section title="工器具退料" type="line"></uni-section>
<eselect
v-model="equipmentId"
style="width: 100%; height: 90rpx; margin: 10px 0"
ref="treeSelect"
:options="equipmentList"
@change="changeEquipment"
></eselect>
</uni-forms>
<uni-table ref="table" border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th width="60" align="center">序号</uni-th>
<uni-th width="140" align="center">类型名称</uni-th>
<uni-th width="140" align="center">规格型号</uni-th>
<uni-th width="80" align="center">在用数</uni-th>
<uni-th width="120" align="center">退料数</uni-th>
<uni-th width="120" align="center">损坏价值判定</uni-th>
<uni-th width="90" 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">{{ item.num }}</uni-td>
<uni-td align="center"
><uni-easyinput
v-model="item.preNum"
placeholder="请输入内容"
type="number"
@blur="checkPerNum(item)"
></uni-easyinput
></uni-td>
<uni-td align="center"
><uni-easyinput
v-model="item.apDetection"
placeholder="请输入内容"
></uni-easyinput
></uni-td>
<uni-td align="center">
<view>
<button
class="uni-button"
size="mini"
type="warn"
@click="
() => {
tableData.splice(index, 1)
}
"
>
删除
</button>
</view>
</uni-td>
</uni-tr>
</uni-table>
<button style="width: 100%; margin: 50px 0" size="mini" type="primary" @click="submit">
确定
</button>
</div>
</template>
<script setup>
import { onLoad } from '@dcloudio/uni-app'
import { ref, reactive } from 'vue'
import eselect from '@/components/tree-select/eselect.vue'
import {
getBmTeamList,
getProjectList,
getTypeTreeList,
backTask,
editLeaseTask,
getAgreementInfoById,
detailsLeaseTask
} from '@/services/back.js'
import { getUseTypeTree } from '../../services/back'
const title = ref('工器具退料申请')
const opts = ref({})
const form = ref()
const formData = reactive({
teamId: undefined,
projectId: '',
backPerson: '',
phone: '',
agreementId: undefined,
remark: undefined
})
const agreementId = ref('')
const equipmentId = ref()
const teamRange = ref([]) //
const prodRange = ref([]) //
const equipmentList = ref([]) //
const rules = {
teamId: {
rules: [{ required: true, errorMessage: '请选择班组' }],
},
projectId: {
rules: [{ required: true, errorMessage: '请选择工程' }],
},
backPerson: {
rules: [{ required: true, errorMessage: '请填写退料人' }],
},
phone: {
rules: [{ required: true, errorMessage: '请填写联系电话' }],
},
}
const tableData = ref([])
//
const getDetailsById = async () => {
try {
const res = await detailsLeaseTask(opts.value.id)
console.log('🚀 ~ getDetailsById ~ res:', res)
tableData.value = res.data.leaseApplyDetailsList
Object.assign(formData, res.data.leaseApplyInfo)
} catch (error) {
console.log('🚀 ~ getDetailsById ~ error:', error)
}
}
//
const getTeamList = async () => {
try {
const res = await getBmTeamList({ isAll: 0 })
// teamRange.value = res.data
if (res.data.length > 0) {
teamRange.value = res.data.map((item) => {
return {
...item,
value: item.id,
text: item.teamName,
}
})
}
} catch (error) {
console.log('🚀 ~ getTeamList ~ error:', error)
}
}
//
const getProjectListApi = async () => {
try {
const res = await getProjectList()
prodRange.value = res.data
} catch (error) {
console.log('🚀 ~ getProjectListApi ~ error:', error)
}
}
//
const getAgreement = () => {
console.log(formData.teamId,formData.projectId)
let obj = {
teamId: formData.teamId,
projectId: formData.projectId,
}
getAgreementInfoById(obj)
.then((res) => {
console.log(res)
if (res.code == 200) {
agreementId.value = res.data.agreementId
formData.agreementId = res.data.agreementId
getEquipmentList()
} else {
agreementId.value = ''
formData.agreementId=''
}
})
.catch((error) => {
formData.agreementId=''
console.log(error)
})
}
//
const getEquipmentList = async () => {
try {
let obj = {
agreementId: agreementId.value,
}
const res = await getUseTypeTree(obj)
// machineList.value = res.data
if (res.data.length > 0) {
equipmentList.value = formatEquipmentTree(res.data)
console.log('🚀 ~ getEquipmentList ~ machineList.value:', equipmentList.value)
}
} catch (error) {
console.log('🚀 ~ getMachineListApi ~ error:', error)
}
}
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) => {
if (!formData.phone) {
uni.showToast({
icon: 'none',
title: '请输入电话号码',
})
return false
}
if (!/^1[3-9][0-9]{9}$/.test(formData.phone)) {
uni.showToast({
icon: 'none',
title: '请输入正确的电话号码',
})
//
formData.phone = ''
return false
}
return true
}
//
const checkPerNum = (item) => {
// 1
if (!/^[1-9]\d*$/.test(item.preNum)) {
uni.showToast({
icon: 'none',
title: '请输入正确的数量',
})
// 1
item.preNum = 1
return false
}
}
//
const changeTeamd = (e) => {
console.log('🚀 ~ changeTeamd ~ e:', e)
formData.teamId = e
if (formData.teamId && formData.teamId.length > 0) {
getAgreement()
}
}
//
const changeProd = (e) => {
console.log('🚀 ~ changeProd ~ e:', e)
formData.projectId = e.id
if (formData.projectId && formData.projectId.length > 0) {
getAgreement()
}
}
//
const changeEquipment = (e) => {
console.log('🚀 ~ changeEquipment ~ e:', e)
// equipmentList.value id typeName
const equipment = findEquipmentById(equipmentList.value, e.parentId)
tableData.value.push({
...JSON.parse(JSON.stringify(e)),
maTypeName: equipment.typeName,
preNum: 1,
})
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 submit = () => {
console.log('🚀 ~ submit ~ submit:', formData)
//
form.value
.validate()
.then(async (valid) => {
console.log('🚀 ~ form.value.validate.then ~ valid:', valid)
if (tableData.value.length === 0) {
await uni.showToast({
title: '请添加退料数据',
icon: 'none',
duration: 1000,
})
return
}
// 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)
if (tableData.value[i].preNum < 1) {
await uni.showToast({
title: `${i + 1}行退料数量不能为0`,
icon: 'none',
duration: 1000,
})
return
} else if (tableData.value[i].preNum > tableData.value[i].num) {
await uni.showToast({
title: `${i + 1}行退料数量不能大于在用数量`,
icon: 'none',
duration: 1000,
})
return
}
}
const params = {
backApplyDetailsList: tableData.value,
backApplyInfo: formData,
}
console.log('🚀 ~ .then ~ params:', params)
try {
if (!opts.value.isEdit) {
const res = await backTask(params)
console.log('🚀 ~ .then ~ res:', res)
back()
} else {
const res = await editLeaseTask(params)
back()
}
} catch (error) {
console.log('🚀 ~ .then ~ error:', error)
}
})
.catch((err) => {
console.log('🚀 ~ form.value.validate.catch ~ err:', err)
})
}
const back = () => {
uni.navigateBack({
delta: 1,
})
}
const rightClick = () => {
console.log(2)
uni.navigateTo({ url: `/pages/back/backCodeAdd` })
}
onLoad((opt) => {
console.log('onLoad', opt)
opts.value = opt.params ? JSON.parse(opt.params) : {}
title.value = opts.value.isEdit ? '编辑工器具退料' : '新增工器具退料'
getTeamList()
getProjectListApi()
// getEquipmentList()
if (opts.value.isEdit) {
getDetailsById()
}
})
</script>
<style lang="scss" scoped>
.content {
padding: 10px;
background-color: #fafafa;
}
.col {
display: flex;
align-items: center;
margin-bottom: 15px;
}
</style>

View File

@ -0,0 +1,269 @@
<template>
<uni-nav-bar
dark
:fixed="true"
shadow
background-color="#4AA4EA"
status-bar
left-icon="left"
left-text="返回"
title="退料任务"
right-text="新增"
@clickLeft="back"
@clickRight="add"
/>
<div class="content">
<div class="query">
<uni-datetime-picker
v-model="queryParams.range"
type="daterange"
start-placeholder="开始"
end-placeholder="结束"
/>
<uni-easyinput
errorMessage
v-model="queryParams.keyWord"
focus
placeholder="请输入内容"
style="margin: 0 5px"
/>
<button size="mini" style="background-color: #f0a037; color: #fff" @click="handleQuery">
查询
</button>
</div>
<div style="width: 60%; margin: 10px auto">
<uni-segmented-control
:values="items"
:current="current"
@clickItem="onClickItem"
styleType="button"
activeColor="#007aff"
/>
</div>
<!-- 滚动列表 -->
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
<uni-swipe-action class="swipe-action">
<uni-swipe-action-item
:right-options="current == 0 ? options : []"
v-for="(item, index) in tableList"
:key="index"
@click="(e) => onClickSwipe(e, item)"
>
<div class="list" @click="handleItem(item)">
<div style="margin-right: 8px">{{ index + 1 }}.</div>
<div class="item">
<div>申请时间: {{ item.createTime }}</div>
<div>退料单号: {{ item.code }}</div>
<div>退料物资: {{ item.typeName }}</div>
<div>退料班组: {{ item.teamName }}</div>
<div>工程名称: {{ item.proName }}</div>
<div>退料人: {{ item.backPerson }}</div>
<div>联系电话: {{ item.phone }}</div>
<div>已退数量: {{ item.alNum || 0 }}</div>
<div>备注: {{ item.remark }}</div>
<div>
状态:
<uni-tag v-if="item.taskStatus == 0" text="未完成" type="warning" custom-style="warningStyle"/>
<uni-tag v-if="item.taskStatus == 1" text="已驳回" type="warning" custom-style="warningStyle"/>
<uni-tag v-if="item.taskStatus == 2" text="已完成" type="success" custom-style="successStyle"/>
</div>
</div>
</div>
</uni-swipe-action-item>
</uni-swipe-action>
<div style="display: flex; justify-content: center; align-items: center; height: 50px">
{{ finish ? '没有更多数据了~' : '正在加载...' }}
</div>
</scroll-view>
</div>
</template>
<script setup>
import { onLoad } from '@dcloudio/uni-app'
import { ref, reactive, computed } from 'vue'
import { getBackListAPI, deleteLeaseApplyApi } from '@/services/picking/outbound.js'
import { backSubmit, deleteBackApi } from '../../services/back'
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
range: [],
keyWord: '',
appTaskStatus: 0,
})
const items = ref(['未完成', '已完成'])
const current = ref(0)
const tableList = ref([])
const total = ref(0)
const options = ref([
{
text: '提交',
style: {
backgroundColor: '#2f8cf0',
},
},
{
text: '删除',
style: {
backgroundColor: '#ff4949',
},
},
])
const finish = computed(() => {
if (total.value === tableList.value.length) return true
})
const back = () => {
uni.navigateBack({
delta: 1,
})
}
const add = () => {
uni.navigateTo({ url: `/pages/toolsBack/toolsAddBack` })
}
const handleQuery = () => {
console.log('🚀 ~ handleQuery ~ handleQuery:', queryParams)
getList()
}
const getList = async () => {
const params = {
pageNum: queryParams.pageNum,
pageSize: queryParams.pageSize,
startTime: queryParams.range && queryParams.range[0],
endTime: queryParams.range && queryParams.range[1],
keyWord: queryParams.keyWord,
appTaskStatus: queryParams.appTaskStatus,
}
console.log('🚀 ~ getList ~ params:', params)
try {
const res = await getBackListAPI(params)
console.log('🚀 ~ getList ~ res:', res)
if (res.code == 200) {
tableList.value = res.data.rows
console.log('🚀 ~ getList ~ tableList.value:', tableList.value)
total.value = res.data.total
}
} catch (error) {
console.log('🚀 ~ getList ~ error:', error)
tableList.value = []
total.value = 0
}
}
//
const onClickItem = (item) => {
current.value = item.currentIndex
queryParams.appTaskStatus = item.currentIndex === 0 ? 0 : 1
getList()
}
//
const handleItem = (item) => {
console.log('🚀 ~ handleItem ~ item:', item)
uni.navigateTo({ url: `/pages/toolsBack/toolsDetail?id=${item.id}&taskId=${item.taskId}` })
}
//
const onScrollTolower = () => {
console.log('🚀 ~ onScrollTolower ~ onScrollTolower:')
if (total.value > tableList.value.length) {
queryParams.pageSize += 10
getList()
}
}
//
const onClickSwipe = async (e, item) => {
console.log('🚀 ~ onClickSwipe ~ e:', e, item)
try {
if (e.index == 0) {
//
const params = JSON.stringify({
id: item.id,
taskId: item.taskId
})
const res = await backSubmit(params)
console.log('🚀 ~ 提交结果 ~ res:', res)
if (res.code === 200) {
uni.showToast({
title: res.msg || '操作成功',
icon: 'success'
})
//
await getList()
} else {
uni.showToast({
title: res.msg || '操作失败',
icon: 'error'
})
}
} else {
//
await deleteItem(item)
}
} catch (error) {
console.error('操作失败:', error)
uni.showToast({
title: error.message || '操作失败',
icon: 'error'
})
}
}
//
const deleteItem = (item) => {
console.log('🚀 ~ deleteItem ~ item:', item)
uni.showModal({
title: '提示',
content: '确定删除吗?',
success: (res) => {
if (res.confirm) {
const params = JSON.stringify({
id: item.id
})
deleteBackApi(params)
.then((res) => {
console.log('🚀 ~ .then ~ res:', res)
if (res.code == 200) {
getList()
}
})
.catch((err) => {
console.log('🚀 ~ deleteItem ~ err:', err)
})
}
},
})
}
onLoad((options) => {
console.log('🚀 ~ onLoad ~ options:', options)
getList()
})
</script>
<style lang="scss" scoped>
.content {
padding: 10px;
height: calc(100vh - 147px);
.query {
display: flex;
justify-content: space-between;
align-items: center;
color: #f0a037;
}
.list {
min-height: 120px;
margin-bottom: 10px;
background: #fafafa;
border-radius: 6px;
padding: 8px;
display: flex;
}
}
</style>

View File

@ -0,0 +1,521 @@
<template>
<uni-nav-bar
dark
:fixed="true"
shadow
background-color="#4AA4EA"
status-bar
left-icon="left"
left-text="返回"
:title="title"
@clickLeft="back"
/>
<view class="accept page-common">
<div class="card">
<div>任务信息</div>
<uni-forms :model="taskInfo" label-width="170rpx" :border="true">
<uni-forms-item label="退料班组:" name="teamName">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.teamName }}</span>
</uni-forms-item>
<uni-forms-item label="退料工程:" name="proName">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.proName }}</span>
</uni-forms-item>
<uni-forms-item label="退料单号:" name="code">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.code }}</span>
</uni-forms-item>
<uni-forms-item label="退料人员:" name="backPerson">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.backPerson }}</span>
</uni-forms-item>
<uni-forms-item label="联系电话:" name="phone">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.phone }}</span>
</uni-forms-item>
</uni-forms>
</div>
<div class="card" style="margin-top: 10px;">
<uni-row :gutter="24">
<uni-col :span="6">接收方式</uni-col>
<uni-col :span="6">
<view class="coding-btn" @click="onCodeIdentify">编码识别</view>
</uni-col>
<uni-col :span="6">
<view class="coding-btn" @click="scanStart">二维码识别</view>
</uni-col>
</uni-row>
</div>
<div class="card" style="margin-top: 10px;">
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
<uni-col :span="6">设备编码</uni-col>
<uni-col :span="12">
<uni-easyinput placeholder="请输入内容" maxlength="30" v-model="maCode"/>
</uni-col>
<uni-col :span="6">
<view class="coding-btn search-btn"
@click="getMaInfo"
>编码检索</view>
</uni-col>
</uni-row>
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
<uni-col :span="6">物资类型</uni-col>
<uni-col :span="16">
{{ typeName }}
</uni-col>
</uni-row>
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
<uni-col :span="6">规格型号</uni-col>
<uni-col :span="16">
{{ materialName }}
</uni-col>
</uni-row>
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
<uni-col :span="6">设备状态</uni-col>
<uni-col :span="16">
{{ maStatusName }}
</uni-col>
</uni-row>
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
<uni-col :span="6">外观判定</uni-col>
<uni-col :span="16">
<!-- <uni-easyinput placeholder="请输入内容" v-model="apDetection"/> -->
<radio-group @change="changeRadio">
<radio value="完好" checked style="margin-right: 5px;">完好</radio>
<radio value="损坏">损坏</radio>
</radio-group>
</uni-col>
</uni-row>
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
<uni-col :span="6">附件</uni-col>
<uni-col :span="16">
<div class="upload" @click="uploadImg" v-if="imgBeseUrl==''">+</div>
<div class="upload" @click="uploadImg" v-else>
<image :src="imgBeseUrl" style="width: 160rpx;height: 160rpx;" mode=""></image>
</div>
</uni-col>
</uni-row>
</div>
<div class="btn">
<!-- <button class="btn-cont" @click="reject">取消</button> -->
<button class="btn-cont" @click="submitCode">确认</button>
</div>
</view>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getMachine,insertApp } from '../../services/back.js';
import { baseURL } from '@/utils/http'
const title = ref('退料接收')
const taskInfo = ref({})
const maId = ref("") //
const maCode = ref("") //
const typeName = ref("")//
const materialName = ref("") //
const typeId = ref("") //id
const maStatusName = ref("") //
const apDetection = ref("完好") //
const imgBeseUrl = ref("") //
const bmFileInfos = ref([])//
const changeRadio = (e) => {
console.log(e.detail.value)
apDetection.value = e.detail.value
}
//
const getMaInfo = () => {
console.log(maCode.value)
let param={
"maCode":maCode.value,
"unitId":taskInfo.value.unitId,
"proId":taskInfo.value.proId
}
getMachine(param).then(res => {
console.log(res)
if(res.code==200){
if(res.data&&res.data.length>0){
typeName.value = res.data[0].typeName;
materialName.value = res.data[0].materialName;
maStatusName.value = res.data[0].maStatusName;
maId.value = res.data[0].maId;
typeId.value = res.data[0].typeId;
}else{
uni.showToast({ title: '该编码非该班组工程领用,不可退料!', icon: 'none' })
}
}
}).catch(error => {
console.log(error)
})
}
const qrCode = ref("") //
//
const scanStart = async () => {
qrCode.value=""
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
mpaasScanModule.mpaasScan({
// qrCodebarCode
'scanType': ['qrCode','barCode'],
// false
'hideAlbum': false,
//ios zh-Hansen
'language' : 'en',
//(ios)
'failedMsg': '未识别到二维码,请重试',
//Android
'screenType': 'full'
},(ret) => {
console.log(ret)
if(ret.resp_code==10){
uni.showToast({ title: '用户取消', icon: 'none' })
}
if(ret.resp_code==11){
uni.showToast({ title: '扫码失败', icon: 'none' })
}
if(ret.resp_code==1000){
qrCode.value = ret.resp_result;
console.log(qrCode.value)
let param={
"qrCode":qrCode.value,
"unitId":taskInfo.value.unitId,
"proId":taskInfo.value.proId
}
getMachine(param).then(res => {
console.log(res)
console.log(res.data[0])
maCode.value = res.data[0].maCode
typeName.value = res.data[0].typeName;
materialName.value = res.data[0].typeModelName;
maStatusName.value = res.data[0].maStatusName;
maId.value = res.data[0].maId;
typeId.value = res.data[0].typeId;
}).catch(error => {
console.log(error)
})
}
})
}
// //
// const scanStart = () => {
// console.log('--')
// //
// uni.scanCode({
// onlyFromCamera: true,
// scanType: ['qrCode', 'pdf417'],
// success: (res) => {
// console.log('' + res.result);
// maCode.value = res.result;
// },
// fail: (err) => {
// // uni.showToast({
// // title: '',
// // icon: 'none'
// // });
// }
// });
// }
//
const onCodeIdentify = () => {
console.log('编码识别--')
uni.navigateTo({
url: `/pages/back/backCodeScan?queryParams=${JSON.stringify(taskInfo.value)}`,
})
}
//
const submitCode = () => {
console.log(taskInfo.value)
if(maId.value==""){
uni.showToast({ title: '请先添加退料设备编码!', icon: 'none' })
}else{
// console.log(typeList.value)
let obj = {
"maId":maId.value,
"maCode":maCode.value,
"typeId":typeId.value,
"apDetection":apDetection.value,
goodNum: apDetection.value == '完好' ? 1 : 0,
badNum: apDetection.value == '损坏' ? 1 : 0,
"bmFileInfos":bmFileInfos.value
}
let param = {
"backApplyInfo":taskInfo.value,
"backApplyDetails":obj
}
insertApp(param).then(res => {
console.log(res)
if(res.code==200){
uni.showToast({ title: '添加成功!', icon: 'none' })
typeName.value="";
materialName.value="";
maStatusName.value="";
typeId.value="";
maId.value=""
maCode.value=""
typeId.value=""
apDetection.value="完好"
bmFileInfos.value=[]
imgBeseUrl.value = ""
// uni.navigateBack({
// delta: 1 //
// });
}else{
uni.showToast({ title: res.msg, icon: 'none' })
}
}).catch(error => {
console.log(error)
})
}
}
//
const uploadImg = () => {
uni.chooseImage({
count: 1, //
sizeType: ['original', 'compressed'], //original compressed
sourceType: ['album', 'camera',], //album camera 使
success: res => {
console.log(res)
let imgFiles = res.tempFilePaths //
imgBeseUrl.value = imgFiles[0]
// console.log('', imgFiles)
// console.log('', baseURL+"/file/upload")
uni.uploadFile({
// url: baseURL+"/file/upload",//app
url: "/file/upload",//h5
filePath: imgFiles[0],
name: 'file',
success: (res) => {
res = JSON.parse(res.data)
console.log('上传成功', res.code);
console.log('上传成功', res.data);
if(res.code&&res.code==200){
let obj = {
"name":res.data.name,
"url":res.data.url,
"taskType":"10"
}
// console.log(obj)
bmFileInfos.value = [obj]
uni.showToast({ title: '上传成功', icon: 'none' })
}else{
bmFileInfos.value = []
uni.showToast({ title: '上传失败', icon: 'none' })
}
},
fail: (err) => {
console.error('上传失败', err);
}
});
// this.$refs.vForm.clearValidate()
}
})
}
const back = () => {
uni.navigateBack({
delta: 1,
})
}
onLoad((options)=>{
console.log(options)
taskInfo.value = JSON.parse(options.taskInfo)
console.log(taskInfo.value)
})
</script>
<style lang="scss" scoped>
::v-deep .uni-radio-input {
width: 16px;
height: 16px;
}
.accept {
padding: 24rpx;
height: 95vh;
word-break: break-all;
background-color: #f7f8fa;
display: flex;
flex-direction: column;
//
.card {
padding: 32rpx;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
margin-bottom: 24rpx;
//
> div:first-child {
font-size: 32rpx;
font-weight: 600;
color: #262626;
margin-bottom: 24rpx;
position: relative;
padding-left: 24rpx;
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 28rpx;
background: #3784fb;
border-radius: 6rpx;
}
}
//
:deep(.uni-forms) {
.uni-forms-item {
padding: 24rpx 0;
margin-bottom: 0;
border-bottom: 2rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
.uni-forms-item__label {
color: #8c8c8c;
}
span {
color: #262626;
font-size: 28rpx;
}
}
}
//
.coding-btn {
height: 88rpx;
line-height: 88rpx;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
border-radius: 12rpx;
text-align: center;
color: #fff;
font-size: 28rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
//
&.search-btn {
background: #fff7eb;
color: #fa8c16;
border: 2rpx solid #fa8c16;
box-shadow: none;
&:active {
background: #fff3e0;
}
}
}
//
:deep(.uni-row) {
margin-bottom: 24rpx;
&:last-child {
margin-bottom: 0;
}
.uni-col-6 {
color: #8c8c8c;
font-size: 28rpx;
}
.uni-col-16 {
color: #262626;
font-size: 28rpx;
}
//
.uni-easyinput__content {
background-color: #f7f8fa;
border: 2rpx solid #e8e8e8;
border-radius: 12rpx;
height: 88rpx;
padding: 0 24rpx;
transition: all 0.3s ease;
&:focus-within {
border-color: #3784fb;
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
}
.uni-easyinput__content-input {
font-size: 28rpx;
height: 88rpx;
line-height: 88rpx;
}
}
}
//
.upload {
width: 160rpx;
height: 160rpx;
background-color: #f7f8fa;
border: 2rpx dashed #d9d9d9;
border-radius: 12rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 48rpx;
color: #bfbfbf;
transition: all 0.3s ease;
&:active {
background-color: #f0f0f0;
border-color: #3784fb;
}
image {
width: 100%;
height: 100%;
border-radius: 12rpx;
object-fit: cover;
}
}
}
//
.btn {
margin-top: auto;
padding: 32rpx;
background: #fff;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
.btn-cont {
width: 100%;
height: 88rpx;
line-height: 88rpx;
text-align: center;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
}
}
}
</style>

View File

@ -0,0 +1,426 @@
<template>
<uni-nav-bar
dark
:fixed="true"
shadow
background-color="#4AA4EA"
status-bar
left-icon="left"
left-text="返回"
:title="title"
@clickLeft="back"
/>
<view class="accept page-common">
<uni-row :gutter="24" class="search-form">
<uni-col :span="12">
<view><uni-easyinput placeholder="请输入内容" v-model="searchValue"/></view>
</uni-col>
<uni-col :span="4">
<view class="search" @click="getCodeList()">查询</view>
</uni-col>
<uni-col :span="8">
<view class="addBtn" @click="goCode">编码新增</view>
</uni-col>
</uni-row>
<div class="card" style="margin-top: 10px;">
<div>退料物资</div>
<uni-forms :model="rowData" label-width="170rpx" :border="true">
<uni-forms-item label="物资名称:" name="unitName">
<span style="height: 100%;display: flex;align-items: center;">{{ rowData.typeName }}</span>
</uni-forms-item>
<uni-forms-item label="物资类型:" name="proName">
<span style="height: 100%;display: flex;align-items: center;">{{ rowData.typeModel }}</span>
</uni-forms-item>
<uni-forms-item label="已退数量:" name="code">
<span style="height: 100%;display: flex;align-items: center;">{{ codeList.length }}</span>
</uni-forms-item>
</uni-forms>
<div style="width: 92%;height: auto;margin: 10px;">
<uni-table stripe emptyText="暂无更多数据" >
<!-- 表头行 -->
<uni-tr>
<uni-th width="160px" style="font-size: 24rpx;" align="center">设备编码</uni-th>
<uni-th width="130px" style="font-size: 24rpx;" align="center">外观</uni-th>
<!-- <uni-th width="70px" style="font-size: 24rpx;" align="center">创建人</uni-th>-->
<!-- <uni-th width="100px" style="font-size: 24rpx;" align="center">创建时间</uni-th>-->
<uni-th width="80px" style="font-size: 24rpx;" align="center">操作</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item,index) in codeList" :key="item.id">
<uni-td style="font-size: 24rpx;text-align: center;">{{item.maCode}}</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">
<!-- <span>{{item.apDetection}}</span> -->
<!-- <uni-easyinput placeholder="外观" v-model="item.apDetection"/> -->
<span>{{ item.goodNum == 1 ? '完好' : '损坏' }}</span>
</uni-td>
<!-- <uni-td style="font-size: 24rpx;text-align: center;">{{item.createBy}}</uni-td>-->
<!-- <uni-td style="font-size: 24rpx;text-align: center;">{{item.createTime}}</uni-td>-->
<uni-td style="font-size: 24rpx;text-align: center;">
<view class="uni-group">
<uni-icons type="camera" size="20" style="color: #3784fb;" @click="uploadImg(item)"></uni-icons>
<uni-icons type="trash-filled" size="20" style="color: red;margin-left:10px;" @click="delRow(item)"></uni-icons>
</view>
</uni-td>
</uni-tr>
</uni-table>
</div>
</div>
<!-- <div class="btn">
<button class="btn-cont">取消</button>
<button class="btn-cont" @click="saveCodeList">确认</button>
</div> -->
</view>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { onLoad,onShow } from '@dcloudio/uni-app'
import { getMaCodeList,deleteMaCode,saveCode } from '../../services/back.js';
import { baseURL } from '@/utils/http'
const title = ref('退料任务')
const searchValue = ref('')
const taskInfo = ref({})
const rowData = ref({})
const codeList = ref([])
const imgBeseUrl = ref("")
const bmFileInfos = ref([])//
const goCode = () => {
uni.navigateTo({ url: `/pages/back/backCode?taskInfo=${JSON.stringify(taskInfo.value)}` })
}
const getCodeList = () => {
console.log(rowData.value)
let param = {
"typeId":rowData.value.typeId,
"parentId":rowData.value.parentId
}
// console.log(param)
getMaCodeList(param).then(res => {
console.log(res)
if(res.code=200){
codeList.value = res.data;
}
}).catch(error => {
console.log(error)
})
}
const saveCodeList = () => {
// console.log(codeList.value)
// console.log(rowData.value)
codeList.value.forEach(item=>{
item.id=rowData.value.id;
item.parentId=rowData.value.parentId;
})
let param = {
"maCodeDtoList":codeList.value
}
console.log(param)
saveCode(param).then(res => {
console.log(res)
if(res.code==200){
uni.showToast({ title: '保存成功', icon: 'none' })
uni.navigateBack({
delta: 1 //
});
}else{
uni.showToast({ title: '保存失败', icon: 'none' })
}
}).catch(error => {
console.log(error)
})
}
//
const uploadImg = (item) => {
uni.chooseImage({
count: 1, //
sizeType: ['original', 'compressed'], //original compressed
sourceType: ['album', 'camera',], //album camera 使
success: res => {
console.log(res)
let imgFiles = res.tempFilePaths //
// imgBeseUrl.value = imgFiles[0]
// console.log('', imgFiles)
// console.log('', baseURL+"/file/upload")
uni.uploadFile({
// url: baseURL+"/file/upload",//app
url: "/file/upload",//h5
filePath: imgFiles[0],
name: 'file',
success: (res) => {
res = JSON.parse(res.data)
console.log('上传成功', res.code);
console.log('上传成功', res.data);
if(res.code&&res.code==200){
let obj = {
"name":res.data.name,
"url":res.data.url
}
item.bmFileInfos.value = [obj]
uni.showToast({ title: '上传成功', icon: 'none' })
}else{
item.bmFileInfos.value = []
uni.showToast({ title: '上传失败', icon: 'none' })
}
},
fail: (err) => {
console.error('上传失败', err);
}
});
// this.$refs.vForm.clearValidate()
}
})
}
//
const delRow = (item) => {
console.log(item)
let param = {
"typeId":item.typeId,
"parentId":rowData.value.parentId,
"maId":item.maId,
}
console.log(param)
deleteMaCode(param).then(res => {
console.log(res)
if(res.code==200){
uni.showToast({ title: '删除成功', icon: 'none' })
getCodeList()
}else{
uni.showToast({ title: '删除失败', icon: 'none' })
}
}).catch(error => {
console.log(error)
})
}
const back = () => {
uni.navigateBack({
delta: 1,
})
}
onLoad((options)=>{
console.log(options)
taskInfo.value = JSON.parse(options.taskInfo)
console.log(taskInfo.value)
rowData.value = JSON.parse(options.rowData)
console.log(rowData.value)
// getCodeList()
})
onShow(()=>{
getCodeList()
})
</script>
<style lang="scss">
.accept {
padding: 24rpx;
height: 95vh;
word-break: break-all;
background-color: #f7f8fa;
display: flex;
flex-direction: column;
//
.search-form {
display: flex;
align-items: center;
background: #fff;
padding: 24rpx;
border-radius: 20rpx;
margin-bottom: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.05);
:deep(.uni-easyinput__content) {
background-color: #f7f8fa;
border: 2rpx solid #e8e8e8;
border-radius: 12rpx;
height: 88rpx;
padding: 0 24rpx;
transition: all 0.3s ease;
&:focus-within {
border-color: #3784fb;
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
}
.uni-easyinput__content-input {
font-size: 28rpx;
color: #262626;
}
}
.search, .addBtn {
height: 88rpx;
line-height: 88rpx;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
border-radius: 12rpx;
text-align: center;
color: #fff;
font-size: 28rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
}
}
//
.card {
padding: 32rpx;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
margin-bottom: 24rpx;
//
> div:first-child {
font-size: 32rpx;
font-weight: 600;
color: #262626;
margin-bottom: 24rpx;
position: relative;
padding-left: 24rpx;
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 28rpx;
background: #3784fb;
border-radius: 6rpx;
}
}
//
:deep(.uni-forms) {
.uni-forms-item {
padding: 24rpx 0;
margin-bottom: 0;
border-bottom: 2rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
.uni-forms-item__label {
color: #8c8c8c;
}
span {
color: #262626;
font-size: 28rpx;
}
}
}
//
:deep(.uni-table) {
margin: 24rpx -32rpx 0;
.uni-table-tr {
.uni-table-th {
padding: 20rpx 16rpx;
font-size: 26rpx;
color: #8c8c8c;
background-color: #f7f8fa;
border-right: 2rpx solid #f0f0f0;
border-bottom: 2rpx solid #f0f0f0;
&:last-child {
border-right: none;
}
}
.uni-table-td {
padding: 20rpx 16rpx;
font-size: 26rpx;
color: #262626;
border-right: 2rpx solid #f0f0f0;
border-bottom: 2rpx solid #f0f0f0;
&:last-child {
border-right: none;
}
//
.uni-easyinput__content {
height: 64rpx;
background-color: #f7f8fa;
border: 2rpx solid #e8e8e8;
border-radius: 8rpx;
padding: 0 16rpx;
&:focus-within {
border-color: #3784fb;
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
}
.uni-easyinput__content-input {
font-size: 26rpx;
height: 64rpx;
line-height: 64rpx;
}
}
//
.uni-group {
display: flex;
justify-content: center;
align-items: center;
.uni-icons {
padding: 8rpx;
border-radius: 8rpx;
transition: all 0.3s ease;
&:active {
transform: scale(0.9);
opacity: 0.8;
}
}
}
}
}
}
}
//
.btn {
margin-top: auto;
padding: 32rpx;
background: #fff;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
.btn-cont {
width: 100%;
height: 88rpx;
line-height: 88rpx;
text-align: center;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
}
}
}
</style>

View File

@ -0,0 +1,384 @@
<template>
<!-- 新购验收详情 -->
<view class="accept page-common">
<uni-row :gutter="24" class="search-form">
<uni-col :span="10">
<view><uni-easyinput placeholder="请输入内容" v-model="keyWord" maxlength="10"/></view>
</uni-col>
<uni-col :span="4">
<view class="search" @click="getTableList()">查询</view>
</uni-col>
<uni-col :span="5">
<view class="addBtn" @click="goCode">编码退料</view>
</uni-col>
<uni-col :span="5" style="padding-right: 0;">
<view class="addBtn" @click="goNum">数量退料</view>
</uni-col>
</uni-row>
<div class="table-list-item" v-for="(item, index) in tableList" :key="index">
<uni-swipe-action class="swipe-action">
<uni-swipe-action-item @click="onClick($event, item)" :right-options="item.manageType==1 ? options:options2">
<div class="title">
<span style="font-size: 15px; font-weight: 800">退料任务</span>
<!-- <span v-if="item.status == 2" style="color: #ff4d4f">未验收</span> -->
<!-- <span v-else-if="item.status != 2" style="color: #3784fb">已验收</span> -->
<!-- <span v-else-if="item.status == 12" style="color: #ff4d4f">不合格</span> -->
</div>
<div class="line"></div>
<uni-row :gutter="24">
<uni-col :span="8">物资名称</uni-col>
<uni-col :span="16"><div class="cont">{{ item.typeName }}</div></uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="8">规格型号</uni-col>
<uni-col :span="16"><div class="cont">{{ item.typeModel }}</div></uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="8">已退数量</uni-col>
<uni-col :span="16"><div class="cont">{{ item.preNum }}</div></uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="8">单位</uni-col>
<uni-col :span="16"><div class="cont">{{ item.unitName }}</div></uni-col>
</uni-row>
<uni-row :gutter="24" v-if="item.status != 2">
<uni-col :span="8">管理模式</uni-col>
<uni-col :span="16">
<div class="cont" v-if="item.manageType==0">编码</div>
<div class="cont" v-if="item.manageType==1">数量</div>
</uni-col>
</uni-row>
</uni-swipe-action-item>
</uni-swipe-action>
</div>
</view>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { getBackInfo,deleteNumType } from '../../services/back.js';
import { onLoad,onShow } from '@dcloudio/uni-app'
const keyWord = ref('')
const id = ref('')
const taskId = ref('')
const statusList = ref(["2","12"])
const tableList = ref([])
const taskInfo = ref({})
//
const options = ref([
{
text: '查看',
style: {
backgroundColor: '#65a1ff',
color: '#fff',
fontSize: '30rpx',
},
},
{
text: '删除',
style: {
backgroundColor: '#ed6042',
color: '#fff',
fontSize: '30rpx',
},
},
])
//
const options2 = ref([
{
text: '查看',
style: {
backgroundColor: '#65a1ff',
color: '#fff',
fontSize: '30rpx',
},
},
])
//
const getTableList = () => {
// let obj = {
// "id":id.value,
// // "taskId":taskId.value,
// // "statusList":statusList.value,
// }
// console.log(obj)
getBackInfo(id.value,keyWord.value).then(res => {
console.log(res)
taskInfo.value = res.data.backApplyInfo;
tableList.value = res.data.backApplyDetailsList;
console.log(taskInfo.value)
}).catch(error => {
console.log(error)
})
}
const search = () => {
console.log('🚀 ~ search ~ keyWord:', keyWord.value)
getTableList()
}
//
const goCode = () => {
uni.navigateTo({ url: `/pages/back/backCode?taskInfo=${JSON.stringify(taskInfo.value)}` })
}
//
const goNum = () => {
uni.navigateTo({ url: `/pages/back/backNum?taskInfo=${JSON.stringify(taskInfo.value)}` })
}
const onClick = (e, item) => {
const { index } = e
// 1.
if (index === 0) {
if (item.manageType == 0) {//
uni.navigateTo({ url: `/pages/toolsBack/toolsBackCodeDetail?taskInfo=${JSON.stringify(taskInfo.value)}&rowData=${JSON.stringify(item)}` })
} else if(item.manageType == 1) {//
uni.navigateTo({ url: `/pages/toolsBack/toolsBackNumDetail?taskInfo=${JSON.stringify(taskInfo.value)}&rowData=${JSON.stringify(item)}` })
}
}
// 2.
if (index === 1) {
let param = {
id:item.id,
parentId:item.parentId
}
deleteNumType(param).then(res => {
console.log(res)
if(res.code==200){
uni.showToast({ title: '删除成功', icon: 'none' })
getTableList()
}else{
uni.showToast({ title: '删除失败', icon: 'none' })
}
}).catch(error => {
console.log(error)
})
}
}
onLoad((options)=>{
console.log(options)
id.value = options.id
taskId.value = options.taskId
getTableList()
})
onShow(()=>{
getTableList()
})
</script>
<style lang="scss" scoped>
.accept {
height: 95vh;
word-break: break-all;
overflow-y: auto;
background-color: #f7f8fa;
padding: 24rpx;
//
.search-form {
display: flex;
align-items: center;
background: #fff;
padding: 24rpx;
border-radius: 20rpx;
margin-bottom: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.05);
:deep(.uni-col) {
padding-right: 16rpx; //
}
:deep(.uni-easyinput__content) {
background-color: #f7f8fa;
border: 2rpx solid #e8e8e8;
border-radius: 12rpx;
height: 88rpx; //
padding: 0 24rpx;
transition: all 0.3s ease;
&:focus-within {
border-color: #3784fb;
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
}
.uni-easyinput__content-input {
font-size: 28rpx;
color: #262626;
height: 88rpx;
line-height: 88rpx;
}
}
//
.search {
height: 80rpx; //
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
text-align: center;
line-height: 80rpx;
color: #fff;
border-radius: 12rpx;
font-size: 24rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
white-space: nowrap; //
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
}
//
.addBtn {
height: 80rpx; //
background: linear-gradient(135deg, #19be6b 0%, #16a75c 100%);
text-align: center;
line-height: 80rpx;
color: #fff;
border-radius: 12rpx;
font-size: 20rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(25, 190, 107, 0.2);
transition: all 0.3s ease;
white-space: nowrap; //
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(25, 190, 107, 0.2);
}
}
}
//
.table-list-item {
margin: 24rpx 0;
padding: 32rpx;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
transition: all 0.3s ease;
overflow: hidden; //
position: relative; //
//
.swipe-action {
:deep(.uni-swipe) {
width: calc(100% + 64rpx) !important; //
margin: -32rpx; //
padding: -10rpx; //
background-color: #fff; //
}
:deep(.uni-swipe_content) {
background: #fff; //
border-radius: 20rpx; //
overflow: hidden; //
}
:deep(.uni-swipe_right) {
height: 100%;
display: flex;
align-items: center;
transform: translateX(100%); //
transition: transform 0.3s;
}
}
.title {
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 20rpx;
padding-top: 10rpx;
span {
font-size: 32rpx;
font-weight: 600;
color: #3784fb;
background: linear-gradient(90deg, #3784fb, #4b8eff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
.line {
margin: 24rpx 0;
height: 2rpx;
background: linear-gradient(90deg,
rgba(232, 232, 232, 0) 0%,
rgba(232, 232, 232, 1) 50%,
rgba(232, 232, 232, 0) 100%
);
}
:deep(.uni-row) {
margin-bottom: 20rpx;
padding-left: 20rpx;
&:last-child {
margin-bottom: 0;
}
.uni-col-8 {
color: #8c8c8c;
font-size: 28rpx;
font-weight: 500;
}
.cont {
color: #262626;
font-size: 28rpx;
font-weight: 500;
line-height: 1.8;
text-align: right;
padding-right: 20rpx;
}
}
//
:deep(.uni-swipe_button-group) {
height: 100%;
display: flex;
align-items: stretch;
.uni-swipe_button {
padding: 0 50rpx;
font-size: 28rpx;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
height: auto;
margin: 0;
min-width: 120rpx; //
&:nth-child(1) {
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
box-shadow: 0 4rpx 16rpx rgba(55, 132, 251, 0.2);
border-radius: 0;
}
&:nth-child(2) {
background: linear-gradient(135deg, #ff4d4f 0%, #ed6042 100%);
box-shadow: 0 4rpx 16rpx rgba(237, 96, 66, 0.2);
border-radius: 0;
}
&:active {
opacity: 0.9;
transform: scale(0.98);
}
}
}
&:active {
transform: scale(0.985);
background-color: #fafbfc;
}
}
}
</style>

View File

@ -0,0 +1,495 @@
<template>
<uni-nav-bar
dark
:fixed="true"
shadow
background-color="#4AA4EA"
status-bar
left-icon="left"
left-text="返回"
:title="title"
@clickLeft="back"
/>
<view class="accept page-common">
<div class="card">
<div class="card-header">
<span class="title">任务信息</span>
</div>
<uni-forms :model="taskInfo" label-width="170rpx" :border="true">
<uni-forms-item label="班组:" name="teamName">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.teamName }}</span>
</uni-forms-item>
<uni-forms-item label="工程:" name="proName">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.proName }}</span>
</uni-forms-item>
<uni-forms-item label="单号:" name="code">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.code }}</span>
</uni-forms-item>
<uni-forms-item label="人员:" name="backPerson">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.backPerson }}</span>
</uni-forms-item>
<uni-forms-item label="电话:" name="phone">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.phone }}</span>
</uni-forms-item>
</uni-forms>
</div>
<div class="card">
<div class="card-header">
<span class="title">退料物资</span>
<div class="header-right">
<span class="tip">已选 {{ typeList.length }} </span>
</div>
</div>
<div class="select-area">
<uni-row :gutter="24" style="display: flex; align-items: center">
<uni-col :span="10">
<view>
<uni-data-select v-model="typeId"
placeholder="请选择物资类型"
:localdata="maTypeSelectList" @change="getMaCode" filterable >
</uni-data-select>
</view>
</uni-col>
<uni-col :span="10">
<view>
<uni-data-select v-model="typeCode"
placeholder="请选择规格型号"
:localdata="maCodeSelectList" @change="selectMaCode">
</uni-data-select>
</view>
</uni-col>
</uni-row>
</div>
<div class="table-area">
<uni-table border stripe emptyText="暂无更多数据">
<!-- 表头行 -->
<uni-tr>
<uni-th width="100px" style="font-size: 24rpx;" align="center">类型名称</uni-th>
<uni-th width="100px" style="font-size: 24rpx;" align="center">规格型号</uni-th>
<uni-th width="60px" style="font-size: 24rpx;" align="center">在用数</uni-th>
<uni-th width="90px" style="font-size: 24rpx;" align="center">退料数</uni-th>
<!-- <uni-th width="90px" style="font-size: 24rpx;" align="center">外观</uni-th> -->
<uni-th width="90px" style="font-size: 24rpx;" align="center">完好数量</uni-th>
<uni-th width="90px" style="font-size: 24rpx;" align="center">损坏数量</uni-th>
<uni-th width="70px" style="font-size: 24rpx;" align="center">操作</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item,index) in typeList" :key="item.id">
<uni-td style="font-size: 24rpx;text-align: center;">{{item.materialName}}</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">{{item.typeName}}</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">{{item.num}}</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">
<uni-easyinput
placeholder="退料数"
v-model="item.preNum"
type="number"
:clearable="false"
@input="onChangeNumber(item)"
:styles="{width: '100rpx'}"
/>
</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">
<uni-easyinput
placeholder="完好数量"
v-model="item.goodNum"
type="number"
:clearable="false"
@change="changeNum(item)"
:styles="{width: '100rpx'}"
:disabled="!item.preNum"
/>
</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">
<uni-easyinput
placeholder="损坏数量"
v-model="item.badNum"
type="number"
:clearable="false"
@change="changeNum(item)"
:styles="{width: '100rpx'}"
:disabled="!item.preNum"
/>
</uni-td>
<!-- <uni-td style="font-size: 24rpx;text-align: center;">
<uni-easyinput
placeholder="外观"
v-model="item.apDetection"
:styles="{width: '100rpx'}"
/>
</uni-td> -->
<uni-td style="font-size: 24rpx;text-align: center;">
<view class="uni-group">
<view class="action-btn" @click="uploadImg(item)">
<uni-icons type="camera" size="20" style="color: #3784fb;"/>
</view>
<view class="action-btn delete" @click="delRow(index)">
<uni-icons type="trash-filled" size="20" style="color: red;margin-left:10px;"/>
</view>
</view>
</uni-td>
</uni-tr>
</uni-table>
</div>
</div>
<div class="footer-btn">
<button class="btn-cont" @click="submitNum">确认</button>
</div>
</view>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getUseType,insertApp } from '../../services/back.js';
const title = ref('退料接收')
const taskInfo = ref({})
const maTypeSelectList = ref([])
const typeId = ref("")//
const maCodeSelectList = ref([])
const typeCode = ref("")//
const typeList = ref([])
//
const getMaType = () => {
let obj = {
"agreementId":taskInfo.value.agreementId,
}
getUseType(obj).then(res => {
console.log(res)
maTypeSelectList.value = res.data.map(option => {
return {
value:option.typeId,
text:option.typeName,
}
});
}).catch(error => {
console.log(error)
})
}
//
const getMaCode = () => {
let obj = {
"agreementId":taskInfo.value.agreementId,
"typeId":typeId.value
}
getUseType(obj).then(res => {
console.log(res)
maCodeSelectList.value = res.data.map(option => {
let obj = {
...option,
bmFileInfos:[],
value:option.typeId,
text:option.typeName,
}
return obj
});
}).catch(error => {
console.log(error)
})
}
//
const selectMaCode = (e) => {
console.log(e)
maCodeSelectList.value.forEach(item=>{
console.log(item)
if(item.typeId==e){
typeList.value.push(item)
}
})
console.log(typeList.value)
}
//
const submitNum = () => {
console.log(taskInfo.value)
console.log(typeList.value)
// preNum 0
if (typeList.value.length === 0) {
console.log('🚀 ~ submitNum ~ typeList.value:', typeList.value)
uni.showToast({
title: '请添加退料物资',
icon: 'none',
})
return
}
for (let i = 0; i < typeList.value.length; i++) {
if (typeList.value[i].preNum <= 0 || !typeList.value[i].preNum) {
uni.showToast({
title: '退料数不能为空或等于0',
icon: 'none',
})
return
}
}
let obj = {
"backApplyInfo":taskInfo.value,
"backApplyDetailsList":typeList.value
}
insertApp(obj).then(res => {
console.log(res)
if(res.code==200){
uni.showToast({ title: '编辑成功', icon: 'none' })
uni.navigateBack({
delta: 1 //
});
}else{
uni.showToast({ title: res.msg, icon: 'none' })
}
}).catch(error => {
console.log(error)
})
}
//
const uploadImg = (item) => {
uni.chooseImage({
count: 1, //
sizeType: ['original', 'compressed'], //original compressed
sourceType: ['album', 'camera',], //album camera 使
success: res => {
console.log(res)
let imgFiles = res.tempFilePaths //
// imgBeseUrl.value = imgFiles[0]
// console.log('', imgFiles)
// console.log('', baseURL+"/file/upload")
uni.uploadFile({
// url: baseURL+"/file/upload",//app
url: "/file/upload",//h5
filePath: imgFiles[0],
name: 'file',
success: (res) => {
res = JSON.parse(res.data)
console.log('上传成功', res.code);
console.log('上传成功', res.data);
if(res.code&&res.code==200){
let obj = {
"name":res.data.name,
"url":res.data.url
}
item.bmFileInfos.value = [obj]
uni.showToast({ title: '上传成功', icon: 'none' })
}else{
item.bmFileInfos.value = []
uni.showToast({ title: '上传失败', icon: 'none' })
}
},
fail: (err) => {
console.error('上传失败', err);
}
});
// this.$refs.vForm.clearValidate()
}
})
}
//
const delRow = (index) => {
console.log(index)
console.log(typeList.value)
typeList.value.splice(index,1)
}
// change
const onChangeNumber = (item) => {
console.log(item)
console.log(item.preNum)
console.log(item.preNum)
let maxNum = Number(item.num)
// outboundNum.value
setTimeout(()=>{
if(item.unitValue==1){
item.preNum = Number(String(item.preNum).replace(/[^\d.]/g,''))
}else{
item.preNum = Number(String(item.preNum).replace(/[^\d]/g,''))
}
if (Number(item.preNum)<= 0) {
item.preNum = 0;
}
if (Number(item.preNum) > maxNum) {
uni.showToast({
title: '已达到当前资最大在用数量!',
icon: 'none',
})
item.preNum = maxNum;
}
},500)
}
const changeNum = (row) => {
console.log('🚀 ~ changeNum ~ row:', row)
// badNum goodNum
// 西
if (row.badNum) {
row.badNum = Math.ceil(String(row.badNum).replace(/[^\d]/g, ''))
console.log('🚀 ~ changeNum ~ row.badNum:', row.badNum)
}
if (row.goodNum) {
console.log('🚀 ~ changeNum ~ row.goodNum:', row.goodNum)
row.goodNum = Math.ceil(String(row.goodNum).replace(/[^\d]/g, ''))
}
// preNum
if (Number(row.badNum) + Number(row.goodNum) > row.preNum) {
console.log('🚀 ~ changeNum ~ row.badNum + row.goodNum > row.preNum:', row.badNum , row.goodNum)
// this.$message.error('退')
uni.showToast({
title: '完好数量和损坏数量之和不能大于退料数量',
icon: 'none',
})
row.badNum = 0
row.goodNum = 0
}
}
const back = () => {
uni.navigateBack({
delta: 1,
})
}
onLoad((options)=>{
console.log(options)
taskInfo.value = JSON.parse(options.taskInfo)
console.log(taskInfo.value)
getMaType()
})
</script>
<style lang="scss">
.accept {
padding: 24rpx;
height: 95vh;
word-break: break-all;
background-color: #f7f8fa;
display: flex;
flex-direction: column;
//
.card {
padding: 32rpx;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
margin-bottom: 24rpx;
//
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
.title {
font-size: 32rpx;
font-weight: 600;
color: #262626;
position: relative;
padding-left: 24rpx;
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 28rpx;
background: #3784fb;
border-radius: 6rpx;
}
}
.header-right {
.tip {
font-size: 26rpx;
color: #8c8c8c;
}
}
}
//
.uni-group {
display: flex;
justify-content: center;
align-items: center;
.uni-icons {
padding: 8rpx;
border-radius: 8rpx;
transition: all 0.3s ease;
&:active {
transform: scale(0.9);
opacity: 0.8;
}
}
}
//
.select-area {
padding: 24rpx 0;
border-bottom: 2rpx solid #f5f5f5;
}
// //
// .table-area {
// margin-top: 24rpx;
// margin: 24rpx -32rpx 0;
// overflow-x: auto;
// :deep(.uni-table) {
// width: 1080rpx;
// padding: 0 10rpx;
// .uni-table-tr {
// .uni-table-th {
// min-width: 140rpx;
// &:last-child {
// min-width: 120rpx;
// }
// }
// .uni-table-td {
// .action-btn {
// display: inline-flex;
// padding: 12rpx;
// border-radius: 8rpx;
// transition: all 0.3s ease;
// margin: 0 8rpx;
// &:active {
// background-color: rgba(0, 0, 0, 0.05);
// }
// &.delete:active {
// background-color: rgba(255, 77, 79, 0.05);
// }
// }
// }
// }
// }
// }
}
//
.footer-btn {
margin-top: auto;
padding: 32rpx;
background: #fff;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
.btn-cont {
width: 100%;
height: 88rpx;
line-height: 88rpx;
text-align: center;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
}
}
}
</style>

View File

@ -0,0 +1,242 @@
<template>
<uni-nav-bar
dark
:fixed="true"
shadow
background-color="#4AA4EA"
status-bar
left-icon="left"
left-text="返回"
:title="title"
@clickLeft="back"
/>
<view class="accept page-common">
<div class="card">
<div class="card-header">
<span class="title">任务信息</span>
</div>
<uni-forms :model="taskInfo" label-width="160rpx" :border="true">
<uni-forms-item label="退料班组:" name="unitName">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.unitName }}</span>
</uni-forms-item>
<uni-forms-item label="工程名称:" name="proName">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.proName }}</span>
</uni-forms-item>
<uni-forms-item label="退料人员:" name="backPerson">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.backPerson }}</span>
</uni-forms-item>
<uni-forms-item label="退料电话:" name="phone">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.phone }}</span>
</uni-forms-item>
</uni-forms>
</div>
<div class="card" style="margin-top: 20px;">
<div>退料物资</div>
<div style="width: 92%;height: auto;margin: 10px;">
<uni-table border stripe emptyText="暂无更多数据" >
<!-- 表头行 -->
<uni-tr>
<uni-th width="100px" style="font-size: 24rpx;" align="center">类型名称</uni-th>
<uni-th width="100px" style="font-size: 24rpx;" align="center">规格型号</uni-th>
<uni-th width="80px" style="font-size: 24rpx;" align="center">在用数</uni-th>
<uni-th width="80px" style="font-size: 24rpx;" align="center">退料数</uni-th>
<uni-th width="100px" style="font-size: 24rpx;" align="center">损坏价值判定</uni-th>
<!-- <uni-th width="100px" style="font-size: 24rpx;" align="center">完好数量</uni-th> -->
<!-- <uni-th width="100px" style="font-size: 24rpx;" align="center">损坏数量</uni-th> -->
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item,index) in typeList" :key="item.id">
<uni-td style="font-size: 24rpx;text-align: center;">{{item.typeName}}</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">{{item.typeModel}}</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">{{item.num}}</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">
<span>{{item.preNum}}</span>
</uni-td>
<!-- &lt;!&ndash; <uni-td style="font-size: 24rpx;text-align: center;">-->
<!-- <span>{{item.apDetection}}</span> -->
<!-- </uni-td> &ndash;&gt;-->
<!-- <uni-td style="font-size: 24rpx;text-align: center;">-->
<!-- <span>{{item.goodNum}}</span> -->
<!-- </uni-td>-->
<!-- <uni-td style="font-size: 24rpx;text-align: center;">-->
<!-- <span>{{item.badNum}}</span> -->
<!-- </uni-td>-->
</uni-tr>
</uni-table>
</div>
</div>
<!-- <div class="btn"> -->
<!-- <button class="btn-cont" @click="reject">取消</button> -->
<!-- <button class="btn-cont">确认</button> -->
<!-- </div> -->
</view>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getDetailsByIdApi } from '../../services/back.js';
const title = ref('退料任务')
const taskInfo = ref({})
const rowData = ref({})
const typeList = ref([])
const detailInfo = ref({})
//
const getDetails = async () => {
let param={
parentId:rowData.value.parentId,
typeId:rowData.value.typeId
}
const res = await getDetailsByIdApi(param)
detailInfo.value=res.data[0]
}
const back = () => {
uni.navigateBack({
delta: 1,
})
}
onLoad((options)=>{
console.log(options)
taskInfo.value = JSON.parse(options.taskInfo)
console.log(taskInfo.value)
rowData.value = JSON.parse(options.rowData)
console.log(rowData.value)
typeList.value = [rowData.value]
console.log(typeList.value)
getDetails()
})
</script>
<style lang="scss">
.accept {
padding: 24rpx;
height: 100vh;
word-break: break-all;
background-color: #f7f8fa;
display: flex;
flex-direction: column;
//
.card {
padding: 32rpx;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
margin-bottom: 24rpx;
//
> div:first-child {
font-size: 32rpx;
font-weight: 600;
color: #262626;
margin-bottom: 24rpx;
position: relative;
padding-left: 24rpx;
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 28rpx;
background: #3784fb;
border-radius: 6rpx;
}
}
//
:deep(.uni-forms) {
.uni-forms-item {
padding: 24rpx 0;
margin-bottom: 0;
border-bottom: 2rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
.uni-forms-item__label {
color: #8c8c8c;
}
span {
color: #262626;
font-size: 28rpx;
}
}
}
// //
// :deep(.uni-table) {
// margin: 24rpx -32rpx 0;
// width: calc(100% + 64rpx);
// .uni-table-tr {
// .uni-table-th {
// padding: 20rpx 16rpx;
// font-size: 26rpx;
// color: #8c8c8c;
// background-color: #f7f8fa;
// border-right: 2rpx solid #f0f0f0;
// border-bottom: 2rpx solid #f0f0f0;
// &:last-child {
// border-right: none;
// }
// }
// .uni-table-td {
// padding: 20rpx 16rpx;
// font-size: 26rpx;
// color: #262626;
// border-right: 2rpx solid #f0f0f0;
// border-bottom: 2rpx solid #f0f0f0;
// &:last-child {
// border-right: none;
// }
// span {
// display: block;
// text-align: center;
// }
// }
// }
// }
}
//
.btn {
margin-top: auto;
padding: 32rpx;
background: #fff;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
.btn-cont {
width: 100%;
height: 88rpx;
line-height: 88rpx;
text-align: center;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
}
}
}
</style>

View File

@ -0,0 +1,415 @@
<template>
<uni-nav-bar
dark
:fixed="true"
shadow
background-color="#4AA4EA"
status-bar
left-icon="left"
left-text="返回"
:title="title"
@clickLeft="back"
/>
<!-- 新购验收详情 -->
<view class="accept page-common">
<uni-row :gutter="24" class="search-form">
<uni-col :span="10">
<view><uni-easyinput placeholder="请输入内容" v-model="keyWord" maxlength="10"/></view>
</uni-col>
<uni-col :span="4">
<view class="search" @click="getTableList()">查询</view>
</uni-col>
<uni-col :span="5">
<view class="addBtn" @click="goCode">编码退料</view>
</uni-col>
<uni-col :span="5" style="padding-right: 0;">
<view class="addBtn" @click="goNum">数量退料</view>
</uni-col>
</uni-row>
<div class="table-list-item" v-for="(item, index) in tableList" :key="index" @click="handleItem(item)">
<uni-swipe-action class="swipe-action">
<uni-swipe-action-item @click="onClick($event, item)" :right-options="item.manageType==1 ? options:options2">
<div class="title">
<span style="font-size: 15px; font-weight: 800">退料任务</span>
<!-- <span v-if="item.status == 2" style="color: #ff4d4f">未验收</span> -->
<!-- <span v-else-if="item.status != 2" style="color: #3784fb">已验收</span> -->
<!-- <span v-else-if="item.status == 12" style="color: #ff4d4f">不合格</span> -->
</div>
<div class="line"></div>
<uni-row :gutter="24">
<uni-col :span="8">物资名称</uni-col>
<uni-col :span="16"><div class="cont">{{ item.typeName }}</div></uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="8">规格型号</uni-col>
<uni-col :span="16"><div class="cont">{{ item.typeModel }}</div></uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="8">已退数量</uni-col>
<uni-col :span="16"><div class="cont">{{ item.preNum }}</div></uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="8">单位</uni-col>
<uni-col :span="16"><div class="cont">{{ item.unitName }}</div></uni-col>
</uni-row>
<uni-row :gutter="24" v-if="item.status != 2">
<uni-col :span="8">管理模式</uni-col>
<uni-col :span="16">
<div class="cont" v-if="item.manageType==0">编码</div>
<div class="cont" v-if="item.manageType==1">数量</div>
</uni-col>
</uni-row>
</uni-swipe-action-item>
</uni-swipe-action>
</div>
</view>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { getBackInfo,deleteNumType } from '../../services/back.js';
import { onLoad,onShow } from '@dcloudio/uni-app'
const title = ref('退料任务')
const keyWord = ref('')
const id = ref('')
const taskId = ref('')
const statusList = ref(["2","12"])
const tableList = ref([])
const taskInfo = ref({})
//
const options = ref([
{
text: '查看',
style: {
backgroundColor: '#65a1ff',
color: '#fff',
fontSize: '30rpx',
},
},
{
text: '删除',
style: {
backgroundColor: '#ed6042',
color: '#fff',
fontSize: '30rpx',
},
},
])
//
const options2 = ref([
{
text: '查看',
style: {
backgroundColor: '#65a1ff',
color: '#fff',
fontSize: '30rpx',
},
},
])
//
const getTableList = () => {
// let obj = {
// "id":id.value,
// // "taskId":taskId.value,
// // "statusList":statusList.value,
// }
// console.log(obj)
getBackInfo(id.value,keyWord.value).then(res => {
console.log(res)
taskInfo.value = res.data.backApplyInfo;
tableList.value = res.data.backApplyDetailsList;
console.log(taskInfo.value)
}).catch(error => {
console.log(error)
})
}
const search = () => {
console.log('🚀 ~ search ~ keyWord:', keyWord.value)
getTableList()
}
//
const goCode = () => {
uni.navigateTo({ url: `/pages/toolsBack/toolsBackCode?taskInfo=${JSON.stringify(taskInfo.value)}` })
}
//
const goNum = () => {
uni.navigateTo({ url: `/pages/toolsBack/toolsBackNum?taskInfo=${JSON.stringify(taskInfo.value)}` })
}
const onClick = (e, item) => {
const { index } = e
// 1.
if (index === 0) {
if (item.manageType == 0) {//
uni.navigateTo({ url: `/pages/toolsBack/toolsBackCodeDetail?taskInfo=${JSON.stringify(taskInfo.value)}&rowData=${JSON.stringify(item)}` })
} else if(item.manageType == 1) {//
uni.navigateTo({ url: `/pages/toolsBack/toolsBackNumDetail?taskInfo=${JSON.stringify(taskInfo.value)}&rowData=${JSON.stringify(item)}` })
}
}
// 2.
if (index === 1) {
let param = {
id:item.id,
parentId:item.parentId
}
deleteNumType(param).then(res => {
console.log(res)
if(res.code==200){
uni.showToast({ title: '删除成功', icon: 'none' })
getTableList()
}else{
uni.showToast({ title: '删除失败', icon: 'none' })
}
}).catch(error => {
console.log(error)
})
}
}
//
const handleItem = (item) => {
console.log('🚀 ~ handleItem ~ item:', item)
if (item.manageType == 0) {
//
uni.navigateTo({ url: `/pages/toolsBack/toolsBackCode?taskInfo=${JSON.stringify(taskInfo.value)}` })
} else if (item.manageType == 1) {
//
uni.navigateTo({ url: `/pages/toolsBack/toolsBackNum?taskInfo=${JSON.stringify(taskInfo.value)}` })
}
}
const back = () => {
uni.navigateBack({
delta: 1,
})
}
onLoad((options)=>{
console.log(options)
id.value = options.id
taskId.value = options.taskId
getTableList()
})
onShow(()=>{
getTableList()
})
</script>
<style lang="scss" scoped>
.accept {
height: 95vh;
word-break: break-all;
overflow-y: auto;
background-color: #f7f8fa;
padding: 24rpx;
//
.search-form {
display: flex;
align-items: center;
background: #fff;
padding: 24rpx;
border-radius: 20rpx;
margin-bottom: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.05);
:deep(.uni-col) {
padding-right: 16rpx; //
}
:deep(.uni-easyinput__content) {
background-color: #f7f8fa;
border: 2rpx solid #e8e8e8;
border-radius: 12rpx;
height: 88rpx; //
padding: 0 24rpx;
transition: all 0.3s ease;
&:focus-within {
border-color: #3784fb;
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
}
.uni-easyinput__content-input {
font-size: 28rpx;
color: #262626;
height: 88rpx;
line-height: 88rpx;
}
}
//
.search {
height: 80rpx; //
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
text-align: center;
line-height: 80rpx;
color: #fff;
border-radius: 12rpx;
font-size: 24rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
white-space: nowrap; //
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
}
//
.addBtn {
height: 80rpx; //
background: linear-gradient(135deg, #19be6b 0%, #16a75c 100%);
text-align: center;
line-height: 80rpx;
color: #fff;
border-radius: 12rpx;
font-size: 20rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(25, 190, 107, 0.2);
transition: all 0.3s ease;
white-space: nowrap; //
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(25, 190, 107, 0.2);
}
}
}
//
.table-list-item {
margin: 24rpx 0;
padding: 32rpx;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
transition: all 0.3s ease;
overflow: hidden; //
position: relative; //
//
.swipe-action {
:deep(.uni-swipe) {
width: calc(100% + 64rpx) !important; //
margin: -32rpx; //
padding: -10rpx; //
background-color: #fff; //
}
:deep(.uni-swipe_content) {
background: #fff; //
border-radius: 20rpx; //
overflow: hidden; //
}
:deep(.uni-swipe_right) {
height: 100%;
display: flex;
align-items: center;
transform: translateX(100%); //
transition: transform 0.3s;
}
}
.title {
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 20rpx;
padding-top: 10rpx;
span {
font-size: 32rpx;
font-weight: 600;
color: #3784fb;
background: linear-gradient(90deg, #3784fb, #4b8eff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
.line {
margin: 24rpx 0;
height: 2rpx;
background: linear-gradient(90deg,
rgba(232, 232, 232, 0) 0%,
rgba(232, 232, 232, 1) 50%,
rgba(232, 232, 232, 0) 100%
);
}
:deep(.uni-row) {
margin-bottom: 20rpx;
padding-left: 20rpx;
&:last-child {
margin-bottom: 0;
}
.uni-col-8 {
color: #8c8c8c;
font-size: 28rpx;
font-weight: 500;
}
.cont {
color: #262626;
font-size: 28rpx;
font-weight: 500;
line-height: 1.8;
text-align: right;
padding-right: 20rpx;
}
}
//
:deep(.uni-swipe_button-group) {
height: 100%;
display: flex;
align-items: stretch;
.uni-swipe_button {
padding: 0 50rpx;
font-size: 28rpx;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
height: auto;
margin: 0;
min-width: 120rpx; //
&:nth-child(1) {
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
box-shadow: 0 4rpx 16rpx rgba(55, 132, 251, 0.2);
border-radius: 0;
}
&:nth-child(2) {
background: linear-gradient(135deg, #ff4d4f 0%, #ed6042 100%);
box-shadow: 0 4rpx 16rpx rgba(237, 96, 66, 0.2);
border-radius: 0;
}
&:active {
opacity: 0.9;
transform: scale(0.98);
}
}
}
&:active {
transform: scale(0.985);
background-color: #fafbfc;
}
}
}
</style>

View File

@ -298,6 +298,42 @@ export const getTypeTreeList = (data) => {
})
}
// 类型规格-树
export const getUseTypeTree = (data) => {
return http({
method: 'POST',
url: '/material/select/getUseTypeTree',
data:data,
})
}
// 退料申请
export const backTask = (data) => {
return http({
method: 'POST',
url: '/material/back_apply_info',
data:data,
})
}
// 退料提交
export const backSubmit = (data) => {
return http({
method: 'POST',
url: '/material/back_apply_info/submitBackApply',
data:data,
})
}
// 删除
export const deleteBackApi = (data) => {
return http({
method: 'POST',
url: `/material/back_apply_info/deleteById`,
data:data,
})
}
// 工机具出库详情-列表
export const getOutNum = (data) => {
return http({

View File

@ -77,6 +77,11 @@ export const http = (options) => {
url: '/pages/login/index',
})
reject(res)
} else if (res.data.code === 400) {
uni.showToast({
icon: 'none',
title: `${res.data.msg}`,
})
} else if (res.data.code === 500) {
uni.showToast({
icon: 'none',