123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504 |
- <template>
- <view style="height: 100%;display: flex;flex-direction: column;justify-content: space-between;">
- <view class="tab-container">
- <view :class="['tab-item', isActiveId === 1 ? 'active': '']" @click="handleClickInner(1)">车间内</view>
- <view :class="['tab-item', isActiveId === 2 ? 'active': '']" @click="handleClickOut(2)">车间外</view>
- </view>
- <view class="box-bg uni-row">
- <view class="input-view uni-row">
- <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
- <input class="nav-bar-input" type="text" v-model="keywords" placeholder="请输入关键字" />
- </view>
- <view class="search" @click="handleSearch">
- 搜索
- </view>
- </view>
- <view class="top-btn-container uni-row">
- <button v-if="!checkAll"
- :disabled="(isActiveId === 1 && innerTurnoverList.length === 0) || (isActiveId === 2 && outTurnoverList.length === 0)"
- class="bottom-btn" @click="handleAll">全选</button>
- <button v-else class="bottom-btn" @click="handleAll">取消全选</button>
- </view>
- <scroll-view class="scroll-container" scroll-y v-if="isActiveId == 1">
- <view v-if="innerTurnoverList.length == 0" class="no-date">
- <text>暂无车间内周转批次</text>
- </view>
- <!-- 车间内列表 -->
- <view v-for="(item, index) in innerTurnoverList" :key="index"
- :class="{'scroll-item':true,'selected':isSelected(item)}" @click="handleSelection(item)">
- <view class="title-container uni-row" style="justify-content: flex-start;">
- <view class="title uni-row">
- <text class="label">批次号:</text>
- <text class="label code">{{ item['lotCode'] }}</text>
- </view>
- </view>
- <view class="item-info uni-row">
- <text class="label">产品描述</text>
- <text class="label right">{{ item['productDescription'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">箱号</text>
- <text class="label right">{{ item['carrierName'] ? item['carrierName'] : '-' }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">合格数量</text>
- <text class="label right">{{ item['temporaryProcessQualifiedNum']}}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">当前工序</text>
- <view class="label right uni-row">
- {{ item.currentProcess ? item['currentProcess'].processAlias : '-' }}
- (<view style="color: #1684fc;" @click.stop="handleClickProcessList(item)"> 工艺列表
- </view>)
- </view>
- </view>
- <view class="item-info uni-row">
- <text class="label">下序工段</text>
- <text class="label right">{{ item['deptName'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">摆放位置</text>
- <text class="label right">{{ item['place'] ? item['place'] : '-' }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">操作者</text>
- <text class="label right">{{ item['creatorName'] }}</text>
- </view>
- </view>
- </scroll-view>
- <scroll-view class="scroll-container" scroll-y v-if="isActiveId == 2">
- <view v-if="outTurnoverList.length == 0" class="no-date">
- <text>暂无车间外周转批次</text>
- </view>
- <view v-for="(item, index) in outTurnoverList" :key="index"
- :class="{'scroll-item':true,'selected':isSelected(item)}" @click="handleSelection(item)">
- <view class="title-container uni-row" style="justify-content: flex-start;">
- <view class="title uni-row">
- <text class="label">批次号:</text>
- <text class="label code">{{ item['lotCode'] }}</text>
- </view>
- </view>
- <view class="item-info uni-row">
- <text class="label">产品描述</text>
- <text class="label right">{{ item['productDescription'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">箱号</text>
- <text class="label right">{{ item['carrierName'] ? item['carrierName'] : '-' }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">合格数量</text>
- <text class="label right">{{ item['temporaryProcessQualifiedNum']}}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">当前工序</text>
- <view class="label right uni-row">
- {{ item.currentProcess ? item['currentProcess'].processAlias : '-' }}
- (<view style="color: #1684fc;" @click.stop="handleClickProcessList(item)"> 工艺列表
- </view>)
- </view>
- </view>
- <view class="item-info uni-row">
- <text class="label">下序工段</text>
- <text class="label right">{{ item['deptName'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">摆放位置</text>
- <text class="label right">{{ item['place'] ? item['place'] : '-' }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">操作者</text>
- <text class="label right">{{ item['creatorName'] }}</text>
- </view>
- </view>
- </scroll-view>
- <!-- 抽屉 -->
- <uni-drawer ref="showRight" mode="right" :mask-click="true">
- <view style="text-align: center; font-size: 48rpx; padding: 48rpx 0 24rpx 0;">工艺列表</view>
- <view style="font-size: 24rpx;text-align: center;color: red; margin-bottom: 16rpx;">
- 仅显示当前工序后面工艺
- </view>
- <scroll-view scroll-y="true" style="height: 82%;" @touchmove.stop>
- <view v-for="(item,index) in curProcessAfte" :key="index"
- style="padding: 8rpx 5% 8rpx 14%; border-top: 1px solid #cccccc">
- <text>{{ index + 1 }}.{{item.processAlias}}</text>
- </view>
- </scroll-view>
- </uni-drawer>
- <view class="bottom-btn-container uni-row">
- <button class="bottom-btn" @click="handleStartTurnover">确认周转</button>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref
- } from 'vue'
- import {
- onLoad,
- onReady,
- onUnload,
- onShow
- } from '@dcloudio/uni-app'
- import {
- getInnerTurnoverByDeptId,
- getOutTurnoverByDeptId,
- updateDayworkItemInnerTurnover
- } from '@/api/business/dayWorkItem.js'
- import {
- store
- } from '@/store/index.js'
- const selectedInfo = ref({})
- const selection = ref([])
- const checkAll = ref(false)
- const curProcessAfte = ref([])
- const outTurnoverList = ref([])
- const innerTurnoverList = ref([])
- const deptId = ref(null)
- const showRight = ref(null) // 抽屉
- const isActiveId = ref(1)
- const keywords = ref(null)
- onShow(() => {
- deptId.value = store.curDeptDetails.deptId;
- init();
- })
- function init() {
- checkAll.value = false
- getInnerList()
- }
- function getInnerList() {
- getInnerTurnoverByDeptId({
- deptId: deptId.value,
- keywords: keywords.value
- }).then(res => {
- if (res.code == 200) {
- innerTurnoverList.value = res.data
- isActiveId.value = 1
- }
- })
- }
- function isSelected(item) {
- return selection.value.includes(item);
- }
- function handleSelection(item) {
- const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
- if (buttonIndex > -1) {
- selection.value.splice(buttonIndex, 1); // 取消选中
- } else {
- selection.value.push(item); // 选中
- }
- if (isActiveId.value == 1) {
- console.log(innerTurnoverList.value.length)
- console.log(selection.value.length)
- if (selection.value.length == innerTurnoverList.value.length) {
- checkAll.value = true;
- } else {
- checkAll.value = false;
- }
- } else {
- if (selection.value.length == outTurnoverList.value.length) {
- checkAll.value = true;
- } else {
- checkAll.value = false;
- }
- }
- }
- function handleSearch() {
- checkAll.value = false
- selection.value = []
- if (isActiveId.value == 1) {
- getInnerList()
- } else {
- getOutList()
- }
- }
- function getOutList() {
- getOutTurnoverByDeptId({
- deptId: deptId.value,
- keywords: keywords.value
- }).then(res => {
- if (res.code == 200) {
- outTurnoverList.value = res.data
- isActiveId.value = 2
- }
- })
- }
- // 全选按钮操作
- function handleAll() {
- //清空选中数据
- selection.value.length = 0;
- if (checkAll.value) {
- //变更选中状态
- checkAll.value = false;
- } else {
- checkAll.value = true;
- if (isActiveId.value == 1) {
- innerTurnoverList.value.findIndex(item => handleSelection(item))
- } else {
- outTurnoverList.value.findIndex(item => handleSelection(item))
- }
- }
- }
- function handleStartTurnover() {
- if (selection.value.length == 0) {
- uni.showToast({
- icon: "none",
- title: "至少选中一批周转",
- duration: 2000
- })
- } else {
- uni.showModal({
- title: '提示',
- content: `是否已经送达?`,
- success: function(res) {
- if (res.confirm) {
- let dayworkItemList = []
- selection.value.forEach(item => {
- dayworkItemList.push(item.dayworkItemList[0])
- })
- updateDayworkItemInnerTurnover(dayworkItemList).then(res => {
- if (res.code == 200) {
- if (isActiveId.value == 1) {
- getInnerList()
- } else {
- getOutList()
- }
- }
- })
- } else {}
- }
- })
- }
- }
- function handleClickProcessList(item) {
- let curProcessAfterList = [];
- console.log("工序列表", item)
- let nextIndex = 0;
- for (let i = 0; i < item.processSequence.length; i++) {
- if (item.currentProcess.processStepNumber == item.processSequence[i].processStepNumber) {
- nextIndex = i;
- }
- }
- for (let i = 0; i < item.processSequence.length; i++) {
- if (i > nextIndex) {
- curProcessAfterList.push(item.processSequence[i]);
- }
- }
- if (item.status == 3) {
- curProcessAfterList.splice(0, 1)
- }
- console.log(curProcessAfterList)
- curProcessAfte.value = curProcessAfterList;
- showRight.value.open();
- }
- function handleClickInner(val) {
- selection.value = []
- isActiveId.value = val
- checkAll.value = false
- getInnerList()
- }
- function handleClickOut(val) {
- selection.value = []
- isActiveId.value = val
- checkAll.value = false
- getOutList()
- }
- </script>
- <style lang="scss">
- .tab-container {
- display: flex;
- flex-direction: row;
- height: 24px;
- .tab-item {
- display: flex;
- flex-direction: row;
- flex: 1;
- font-size: 15px;
- color: #666;
- align-items: center;
- justify-content: center;
- }
- }
- .scroll-container {
- height: calc(100% - 206px);
- background-color: #f5f5f5;
- margin-bottom: 78px;
- .no-date {
- text-align: center;
- font-size: 12px;
- color: #666;
- padding-top: 16px;
- }
- .scroll-item {
- background-color: #fff;
- padding: 24rpx;
- margin: 24rpx;
- border-radius: 8rpx;
- .title-container {
- justify-content: space-between;
- margin-top: 8rpx;
- margin-bottom: 16rpx;
- .title {
- height: 48rpx;
- align-items: center;
- .label {
- color: #1684fc;
- font-size: 32rpx;
- font-weight: bold;
- &.code {
- color: #000000;
- margin-left: 32rpx;
- }
- }
- }
- }
- .item-info {
- margin-bottom: 16rpx;
- .label {
- font-size: 28rpx;
- width: 160rpx;
- color: #808080;
- &.right {
- flex: 1;
- color: #000000;
- }
- }
- }
- .right-info {
- justify-content: flex-end;
- margin-top: 2rpx;
- .label {
- font-size: 28rpx;
- color: #808080;
- }
- }
- }
- }
- .tab-item.active {
- color: rgba(25, 137, 250, 1);
- }
- .box-bg {
- width: 94%;
- background-color: #F5F5F5;
- padding: 5rpx 16rpx;
- height: 50px;
- justify-content: space-around;
- align-items: center;
- margin: 24rpx auto 0;
- .input-view {
- width: 100%;
- flex: 4;
- background-color: #f8f8f8;
- border: 1rpx solid #999;
- border-radius: 15rpx;
- padding: 0 15rpx;
- flex-wrap: nowrap;
- margin: 0 10rpx 0;
- .input-uni-icon {
- line-height: 60rpx;
- }
- .nav-bar-input {
- width: 80%;
- height: 30px;
- line-height: 30px;
- padding: 0 5rpx;
- background-color: #f8f8f8;
- }
- }
- .search {
- width: 20%;
- text-align: center;
- color: #808080;
- }
- }
- .tab-item.active {
- color: rgba(25, 137, 250, 1);
- font-weight: 700;
- }
- .selected {
- border: 3rpx solid #c0c4fc;
- background-color: #c0c4fc;
- /* 选中之后样式 */
- }
- .top-btn-container {
- margin: 8px 0 8px 0;
- height: 40px;
- padding: 0 16px;
- align-items: center;
- background-color: #fff;
- .bottom-btn {
- flex: 1;
- font-size: 28rpx;
- color: #FFFFFF;
- background-color: #1684fc;
- }
- }
- .bottom-btn-container {
- height: 10%;
- position: fixed;
- right: 0;
- bottom: 0;
- left: 0;
- height: 100rpx;
- border-top: 1px solid #999999;
- padding: 16rpx 32rpx;
- align-items: center;
- background-color: #fff;
- justify-content: space-evenly;
- .bottom-btn {
- flex: 1;
- height: 80rpx;
- line-height: 80rpx;
- border-radius: 8rpx;
- color: #FFFFFF;
- font-size: 28rpx;
- background-color: #1684fc;
- }
- }
- </style>
|