363 lines
9.1 KiB
Vue
Raw Normal View History

2025-04-14 10:57:27 +08:00
<template>
2025-05-26 18:12:54 +08:00
<z-paging ref="paging" v-model="dataList" @query="queryList" :default-page-no="Number('1')"
:default-page-size="Number('10')" :auto-show-back-to-top="Boolean(true)">
<!-- z-paging默认铺满全屏此时页面所有view都应放在z-paging标签内否则会被盖住 -->
<!-- 需要固定在页面顶部的view请通过slot="top"插入包括自定义的导航栏 -->
2025-04-14 10:57:27 +08:00
<template #top>
<view class="flex">
<view class="search">
<uni-search-bar radius="5" placeholder="输入部件类型查询" v-model="componentType" @blur="searchInfo"
@confirm="searchInfo" />
</view>
<view class="searchmore" @click="showDrawer('showRight')">
2025-05-26 18:12:54 +08:00
<image :src="`${imgPath}/static/image/更多.png`" alt="" />
2025-04-14 10:57:27 +08:00
</view>
</view>
</template>
<view class="container">
<view class="list-panel">
<view class="list-item" v-for="(item,index) in dataList" :key="index">
<uni-row>
<view class="list-title-row">
<uni-col :span="18">
2025-05-26 18:12:54 +08:00
<view class="list-title" @click="opendetail(item)">
2025-04-14 10:57:27 +08:00
{{item.typeName}}
</view>
</uni-col>
<uni-col :span="6">
2025-05-26 18:12:54 +08:00
<view class="list-tag-right">
<view v-if="item.state=='1'">
<uni-tag :inverted="true" text="已出库"
custom-style="background-color: #ecca7733; border-color: #fff; color: #d97340;" />
2025-04-14 10:57:27 +08:00
</view>
2025-05-26 18:12:54 +08:00
<view v-else-if="item.state=='2'">
<uni-tag :inverted="true" text="已归还"
custom-style="background-color: #78f18c1a; border-color: #fff; color: #4cd964;" />
</view>
<view v-else-if="item.state=='-1'">
<uni-tag :inverted="true" text="已取消"
custom-style="background-color: #dedede4d; border-color: #fff; color: #c0c0c0;" />
</view>
<view v-else-if="item.state=='-2'">
<uni-tag :inverted="true" text="已作废"
custom-style="background-color: #e6434033; border-color: #fff; color: #e64340;" />
</view>
<view v-else>
<uni-tag :inverted="true" text="待出库"
custom-style="background-color: #31d3f31a; border-color: #fff; color: #007aff;" />
</view>
</view>
2025-04-14 10:57:27 +08:00
</uni-col>
</view>
</uni-row>
<uni-row>
2025-05-26 18:12:54 +08:00
<uni-col :span="5">
<view class="list-image-panel" @click="opendetail(item)">
<view v-if="item.typeCover == null || item.typeCover == ''" class="list-image-box">
<uni-icons type="image" size="50" color="#e1e1e1" />
2025-04-14 10:57:27 +08:00
</view>
2025-05-26 18:12:54 +08:00
<image v-if="item.typeCover != null && item.typeCover != ''" class="list-image-box"
mode="scaleToFill" :src="item.typeCover"></image>
</view>
</uni-col>
<uni-col :span="19">
<uni-row>
<uni-col :span="20">
<view class="list-item-row" @click="opendetail(item)">
原部件处理方案{{item.oldComponentHandleOption}}
</view>
</uni-col>
<uni-col :span="20">
<view class="list-item-row font-weight-6" @click="opendetail(item)">
出库数量{{item.outQuantity}}
</view>
</uni-col>
</uni-row>
</uni-col>
2025-04-14 10:57:27 +08:00
</uni-row>
<uni-row>
<uni-col :span="24">
<view class="list-botton-box">
2025-05-26 18:12:54 +08:00
<button class="mini-btn" type="primary" size="mini" plain="true" v-if="item.state=='0'"
@click="opendetail(item)">出库</button>
<button class="mini-btn" type="default"
style="color:#1AAD19;backgroundColor:#ffffff;borderColor:#1AAD19" size="mini"
plain="true" v-if="item.state=='1'" @click="opendetail(item)">归还</button>
<button class="mini-btn" type="warn" size="mini" plain="true" v-if="item.state=='1'"
@click="dealstate(item.componentOutRecordId,'invalidateOutDevicePart','作废')">作废</button>
<button class="mini-btn" type="default" size="mini" plain="true" v-if="item.state=='0'"
@click="dealstate(item.componentOutRecordId,'cancelOutDevicePart','取消')">取消</button>
2025-04-14 10:57:27 +08:00
</view>
</uni-col>
</uni-row>
</view>
</view>
<uni-drawer ref="showRight" mode="right" :mask-click="false">
<view>
<uni-nav-bar left-icon="left" leftText="返回" rightText="X" title="筛选"
@clickLeft="closeDrawer('showRight')" @clickRight="closeDrawer('showRight')" />
</view>
<view class="searchlist">
<uni-section title="出库状态" type="line">
<uni-data-checkbox mode="tag" v-model="statevalue" :localdata="rkstatelist" />
</uni-section>
</view>
</uni-drawer>
</view>
<template #bottom>
<view class="nav-panel">
<uni-goods-nav :fill="true" :options="[]" :buttonGroup="navButtonGroup" @buttonClick="navButtonClick" />
</view>
</template>
</z-paging>
</template>
<script setup>
import {
ref
} from 'vue';
2025-05-26 18:12:54 +08:00
import {
onLoad,
onShow,
onBackPress
} from "@dcloudio/uni-app";
2025-04-14 10:57:27 +08:00
import {
showModelMessage,
dataFormat
} from '@/utils/tools.js';
import * as api from '@/utils/api.js';
2025-04-15 11:27:28 +08:00
import config from '@/utils/config';
const imgPath = config.imgPath;
2025-04-14 10:57:27 +08:00
const userInfo = ref(null);
2025-05-26 18:12:54 +08:00
const paging = ref(null);
const dataList = ref([]);
2025-04-14 10:57:27 +08:00
const navButtonGroup = [{
text: '新增出库',
2025-04-28 11:40:00 +08:00
backgroundColor: '#0078D4',
2025-04-14 10:57:27 +08:00
color: '#fff'
}];
// 查询条件定义
2025-05-26 18:12:54 +08:00
const componentType = ref("");
2025-04-14 10:57:27 +08:00
const statevalue = ref(''); //状态
2025-05-26 18:12:54 +08:00
const rkstate = ref('0'); //状态
2025-04-14 10:57:27 +08:00
const rkstatelist = ref([{
text: '全部',
value: ''
}, {
text: '待出库',
value: '0'
}, {
text: '已出库',
value: '1'
}, {
text: '已归还',
value: '2'
}, {
text: '已取消',
value: '-1'
}, {
text: '已作废',
value: '-2'
}])
2025-05-26 18:12:54 +08:00
onShow(() => {
if (paging && paging.value) paging.value.refresh();
});
onLoad((options) => {
userInfo.value = uni.getStorageSync('userInfo');
});
2025-04-14 10:57:27 +08:00
const queryList = (pageNo, pageSize) => {
// 组装参数
const params = {
"componentType": componentType.value,
2025-05-26 18:12:54 +08:00
"state": statevalue.value,
"sortBy": 'created_at',
"sortMethod": 'desc',
2025-04-14 10:57:27 +08:00
"pageParam": {
"pageNum": pageNo,
"pageSize": pageSize
}
}
api.callOperateApi("ebikeComponentOutRecords/list", params).then((res) => {
if (res.code === 200) {
paging.value.complete(res.data.records);
} else {
paging.value.complete(false);
}
});
};
2025-05-26 18:12:54 +08:00
2025-04-14 10:57:27 +08:00
// 创建 drawer 的 ref 引用
const showRight = ref(null);
2025-05-26 18:12:54 +08:00
2025-04-14 10:57:27 +08:00
// 打开窗口
const showDrawer = (e) => {
const drawer = showRight.value
drawer.open()
}
// 关闭窗口
const closeDrawer = (e) => {
const drawer = showRight.value
drawer.close();
searchInfo();
}
2025-05-26 18:12:54 +08:00
2025-04-14 10:57:27 +08:00
//搜索
const searchInfo = () => {
paging.value.reload();
}
2025-05-26 18:12:54 +08:00
2025-04-14 10:57:27 +08:00
//按钮事件
const navButtonClick = (e) => {
const index = e.index;
2025-05-26 18:12:54 +08:00
if (index == 0) {
2025-04-14 10:57:27 +08:00
setTimeout(() => {
uni.navigateTo({
url: `/pages/warehouse/component/outdetails`, //
});
}, 200); // 延迟100毫秒后执行
}
}
2025-05-26 18:12:54 +08:00
const dealstate = (componentOutRecordId, url, mes) => {
api.callOperateApi("ebikeComponent/" + url + "?componentOutRecordId=" + componentOutRecordId, {}, "get")
.then((res) => {
if (res.code == '200') {
uni.showToast({
title: mes + "成功",
icon: 'success',
duration: 5000
});
queryList(1, 10)
} else {
uni.showToast({
title: mes + "失败",
icon: 'error',
duration: 5000
});
};
});
2025-04-14 10:57:27 +08:00
}
2025-05-26 18:12:54 +08:00
const savestate = (componentOutRecordId, state) => {
2025-04-14 10:57:27 +08:00
// 组装参数
const params = {
"componentOutRecordId": componentOutRecordId,
"state": state,
"updateUser": userInfo.value.username,
2025-05-26 18:12:54 +08:00
"updateAt": dataFormat(new Date(), 'yyyy-MM-dd HH:mm:ss')
2025-04-14 10:57:27 +08:00
}
api.callOperateApi("ebikeComponentOutRecords/update", params).then((res) => {
if (res.code != 200) {
2025-05-26 18:12:54 +08:00
showModelMessage(res.message)
return
2025-04-14 10:57:27 +08:00
}
paging.value.refresh();
});
}
2025-05-26 18:12:54 +08:00
const opendetail = (record) => {
2025-04-14 10:57:27 +08:00
setTimeout(() => {
uni.navigateTo({
2025-05-26 18:12:54 +08:00
url: `/pages/warehouse/component/outdetails?componentOutRecordId=${record.componentOutRecordId}&state=${record.state}`, //
2025-04-14 10:57:27 +08:00
});
}, 200); // 延迟100毫秒后执行
}
</script>
<style scoped>
.container {
padding: 0px 0px;
background-color: #f3f3f3;
}
2025-05-26 18:12:54 +08:00
.list-panel {
2025-04-14 10:57:27 +08:00
padding: 10px 5px 0px 0px;
}
2025-05-26 18:12:54 +08:00
2025-04-14 10:57:27 +08:00
.close {
padding: 10px;
}
.search {
width: 90%;
}
.searchmore {
width: 10%;
padding-top: 15px;
}
.searchmore image {
width: 25px;
height: 25px;
}
.searchlist {
padding: 15px;
}
.nav-panel {
padding-bottom: 20px;
background-color: #fff;
}
2025-05-26 18:12:54 +08:00
.list-item {
2025-04-28 14:18:45 +08:00
padding: 10px;
margin: 10px;
/* border: 1px solid #d6d4d4; */
border-radius: 5px;
2025-04-14 10:57:27 +08:00
background-color: #fff;
2025-04-28 14:18:45 +08:00
/* box-shadow: 2px 2px 4px 2px rgba(212, 212, 212, 0.6); */
2025-04-14 10:57:27 +08:00
}
2025-05-26 18:12:54 +08:00
.list-title-row {
2025-04-14 10:57:27 +08:00
line-height: 25px;
}
2025-05-26 18:12:54 +08:00
.list-title {
2025-04-14 10:57:27 +08:00
font-weight: 600;
font-size: 15px;
}
2025-05-26 18:12:54 +08:00
.list-tag-right {
2025-04-14 10:57:27 +08:00
width: 100%;
text-align: right;
font-size: 12px;
}
2025-05-26 18:12:54 +08:00
.list-image-panel {
2025-04-14 10:57:27 +08:00
width: 100%;
text-align: left;
}
2025-05-26 18:12:54 +08:00
.list-image-box {
width: 50px;
height: 50px;
2025-04-14 10:57:27 +08:00
background-color: #fafafa;
}
2025-05-26 18:12:54 +08:00
.list-item-row {
2025-04-14 10:57:27 +08:00
font-size: 12px;
padding: 4px 0px;
}
2025-05-26 18:12:54 +08:00
.font-weight-6 {
2025-04-14 10:57:27 +08:00
font-weight: 600;
}
2025-05-26 18:12:54 +08:00
.list-botton-box {
2025-04-14 10:57:27 +08:00
border-top: 1px solid #d6d4d4;
padding: 10px 0px 0px 0px;
text-align: right;
}
2025-05-26 18:12:54 +08:00
2025-04-14 10:57:27 +08:00
button {
margin-left: 5px;
border-radius: 5px;
2025-05-26 18:12:54 +08:00
}
2025-04-14 10:57:27 +08:00
</style>