123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 |
- <template>
- <view class="uni-column container" >
- <scroll-view class="scroll-container" scroll-y>
- <view v-for="(item, index) in listData" :key="index"
- :class="{'list-item':true,'selected':isSelected(index)}" @click="handleSelection(item,index)">
- <view class="title-container uni-row">
- <view class="title uni-row">
- <text class="label">批次号:</text>
- <text class="label code">{{ item['lotCode'] }}</text>
- </view>
- <view class="right-info uni-row">
- <view class="right-info uni-row"> <text class="label ">工时</text>
- <text class="label time">{{ item['taskTime'] }}h</text>
- </view>
- <view class="right-info uni-row" style="margin-left:32px;"> <text class="label">合格数</text>
- <text class="label number ">{{ item['qualifiedQuantity'] }}</text>
- </view>
- </view>
- </view>
- <view class="item-info uni-row">
- <text class="label">操作者</text>
- <text class="label right">{{ item['nickName'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">开始时间</text>
- <text class="label right">{{ item['startTime']}}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">结束时间</text>
- <text class="label right">{{ (item['endTime'] !="")?item['endTime']:'-'}}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">废品数</text>
- <text class="label right">{{ item['rejectNum']}}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">废品原因</text>
- <text class="label right">{{ (item['remark'] != "")?item['remark']:'-'}}</text>
- </view>
- <view v-if="item['status'] == 0" class="status-btn uni-row ">
- <button class="finished-turnover-tag" size="mini"
- @click="handleShowEndWorkDialog(item)">结束报工</button>
- </view>
- </view>
- </scroll-view>
- <view class="bottom uni-row">
- <button class="bottom-btn left-btn" @click="HandleChangevehicle"><text class="label">更换载具</text></button>
- <button class="bottom-btn right-btn" @click="handleAddItem"><text class="label">开始加工</text></button>
- </view>
- <dialog-end-work ref="endWorkDialog" />
- </view>
- </template>
- <script setup>
- import {
- ref
- } from 'vue'
- import {
- onLoad,
- onReady
- } from '@dcloudio/uni-app'
- import { getDayWorkItemList,saveDayWorkItem } from "@/api/business/dayWorkItem.js"
- const listData = ref([{
- equipment: "051-7",
- taskTime: 2.8,
- qualifiedQuantity: 0,
- operator: "张三",
- jobNumber: 15223,
- startTime: "2023.05.06 14:23",
- endTime: "",
- rejectNumber: 0,
- refectReason: "*******",
- status: 0
- },
- {
- equipment: "051-7",
- taskTime: 3.6,
- qualifiedQuantity: 300,
- operator: "张三",
- jobNumber: 15223,
- startTime: "2023.05.06 14:23",
- endTime: "2023.05.06 18:23",
- rejectNumber: 0,
- refectReason: "",
- status: 1
- },
- {
- equipment: "051-7",
- taskTime: 3.6,
- qualifiedQuantity: 300,
- operator: "张三",
- jobNumber: 15223,
- startTime: "2023.05.06 14:23",
- endTime: "2023.05.06 18:23",
- rejectNumber: 0,
- refectReason: "",
- status: 1
- },
- {
- equipment: "051-7",
- taskTime: 3.6,
- qualifiedQuantity: 300,
- operator: "张三",
- jobNumber: 15223,
- startTime: "2023.05.06 14:23",
- endTime: "2023.05.06 18:23",
- rejectNumber: 0,
- refectReason: "",
- status: 0
- },
- {
- equipment: "051-7",
- taskTime: 3.6,
- qualifiedQuantity: 300,
- operator: "张三",
- jobNumber: 15223,
- startTime: "2023.05.06 14:23",
- endTime: "2023.05.06 18:23",
- rejectNumber: 0,
- refectReason: "",
- status: 1
- }
- ])
- const selection = ref([])
- const endWorkDialog = ref(null)
-
- onReady(() => {
- init();
- })
-
- function init(){
- getDayWorkItemList().then(res => {
- listData.value = res.rows;
- console.log(listData)
- })
- }
-
- const isSelected = (index) => {
- return selection.value.includes(index)
- }
- const handleSelection = (item,index) => {
- const buttonIndex = selection.value.indexOf(index);
- if (buttonIndex > -1) {
- selection.value.splice(buttonIndex, 1); // 取消选中
- } else {
- selection.value.push(index); // 选中
- }
- }
- const handleShowEndWorkDialog = (data) => {
- let _data = data ?? {}
- // 调用子组件中的方法
- endWorkDialog.value.open(_data)
- }
-
- function HandleChangevehicle(){
- uni.navigateTo({
- url:"/pages/changeBox/index"
- })
- }
-
- function handleAddItem(){
- console.log("111111111111111111111111")
- let date = new Date()
- saveDayWorkItem({
- dayworkId: '1',
- startTime: date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate()
- }).then(res => {
- if(res.code === 200){
- uni.showToast({
- icon: 'success',
- title: '操作成功',
- duration: 2000
- });
- }else{
- uni.showToast({
- icon: 'error',
- title: '操作失败',
- duration: 2000
- });
- }
- })
- }
- </script>
- <style lang="scss">
- .container {
- height: 2000rpx;
- background-color: #f5f5f5;
- overflow: auto;
- }
- .scroll-container {
- position: absolute;
- top: 24rpx;
- right: 0;
- bottom: 144rpx;
- left: 0;
- }
- .selected {
- border: 1px solid #1684fc;
- }
- .list-item {
- background-color: #fff;
- position: relative;
- padding: 16rpx;
- padding-bottom: 24rpx;
- margin: 0 24rpx;
- margin-bottom: 24rpx;
- border-radius: 8rpx;
- .title-container {
- justify-content: space-between;
- margin-top: 8rpx;
- margin-bottom: 16rpx;
- .title {
- height: 48rpx;
- align-items: center;
- .label {
- font-size: 32rpx;
- font-weight: bold;
- &.code {
- margin-left: 8rpx;
- }
- }
- }
- }
- .item-info {
- margin-bottom: 8rpx;
- .label {
- font-size: 28rpx;
- width: 152rpx;
- color: #808080;
- &.right {
- flex: 1;
- color: #000000;
- }
- }
- }
- .right-info {
- justify-content: flex-end;
- margin-top: 5rpx;
- .label {
- font-size: 28rpx;
- color: #000000;
- &.time {
- margin-left: 8rpx;
- color: #1684fc;
- }
- &.number {
- margin-left: 8rpx;
- color: rgba(0, 226, 166, 1);
- }
- }
- }
- }
- .bottom {
- position: fixed;
- right: 0;
- bottom: 0;
- left: 0;
- height: 100rpx;
- padding: 16rpx 24rpx;
- align-items: center;
- background-color: #FFFFFF;
- justify-content: space-between;
- .bottom-btn {
- flex: 1;
- font-size: 28rpx;
- color: #FFFFFF;
- &.left-btn {
- background-color: #1684fc;
- }
- &.right-btn {
- background-color: rgb(255, 121, 1);
- margin-left: 24rpx;
- }
- }
- }
- .status-btn {
- width: 100%;
- justify-content: flex-end;
- .finished-turnover-tag {
- margin: unset;
- border-radius: 8rpx;
- background-color: rgb(255, 85, 85);
- font-size: 28rpx;
- color: #FFFFFF;
- }
- }
- </style>
|