|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
- <view class="uni-column" style="height: 100%; background-color: #f5f5f5;">
|
|
|
+ <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(index)">
|
|
|
+ <view v-for="(item, index) in listData" :key="index" :class="{'list-item':true,'selected':isSelected(item)}"
|
|
|
+ @click="handleSelection(item,index)">
|
|
|
<view class="title-container uni-row">
|
|
|
<view class="title uni-row">
|
|
|
<text class="label">{{ item['door'] }}</text>
|
|
@@ -12,7 +12,8 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="right-info uni-row">
|
|
|
- <view class="uni-row"><text class="label right">删除</text></view>
|
|
|
+ <view class="uni-row"><text class="label right" @click="handleDeleteTurnover(item)">删除</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item-info uni-row"> <text class="label ">产品描述</text>
|
|
@@ -33,7 +34,7 @@
|
|
|
</scroll-view>
|
|
|
<view class="bottom uni-row">
|
|
|
<button class="bottom-btn left-btn ">继续扫码</button>
|
|
|
- <button class="bottom-btn right-btn" @click="handleTurnoverTask(null)">确认周转</button>
|
|
|
+ <button class="bottom-btn right-btn" @click="handleStartTurnover(null)">确认周转</button>
|
|
|
</view>
|
|
|
<dialog-turnoverTask ref="turnoverTaskDialog" />
|
|
|
</view>
|
|
@@ -51,86 +52,119 @@
|
|
|
} from '@dcloudio/uni-app'
|
|
|
|
|
|
|
|
|
- onLoad(() => {
|
|
|
+ onLoad((option) => {
|
|
|
+ listData.value = JSON.parse(option.turnoverList);
|
|
|
|
|
|
})
|
|
|
const active = ref(false)
|
|
|
- const selection =ref([])
|
|
|
+ const selection = ref([])
|
|
|
const turnoverTaskDialog = ref(null)
|
|
|
- const listData = ref([{
|
|
|
- door: "A门",
|
|
|
- process: "粗磨",
|
|
|
- car: "NC车",
|
|
|
- description: "万博_039561419_15*110.1",
|
|
|
- batch: "DC23727410070",
|
|
|
- cases: 5,
|
|
|
- caseNumber: "X12522、X55222、X15522、J5211、J5211"
|
|
|
-
|
|
|
- },
|
|
|
- {
|
|
|
- door: "A门",
|
|
|
- process: "粗磨",
|
|
|
- car: "NC车",
|
|
|
- description: "万博_039561419_15*110.1",
|
|
|
- batch: "DC23727410070",
|
|
|
- cases: 5,
|
|
|
- caseNumber: "X12522、X55222、X15522、J5211、J5211"
|
|
|
-
|
|
|
- },
|
|
|
- {
|
|
|
- door: "A门",
|
|
|
- process: "粗磨",
|
|
|
- car: "NC车",
|
|
|
- description: "万博_039561419_15*110.1",
|
|
|
- batch: "DC23727410070",
|
|
|
- cases: 5,
|
|
|
- caseNumber: "X12522、X55222、X15522、J5211、J5211"
|
|
|
-
|
|
|
- },
|
|
|
- {
|
|
|
- door: "A门",
|
|
|
- process: "粗磨",
|
|
|
- car: "NC车",
|
|
|
- description: "万博_039561419_15*110.1",
|
|
|
- batch: "DC23727410070",
|
|
|
- cases: 5,
|
|
|
- caseNumber: "X12522、X55222、X15522、J5211、J5211"
|
|
|
-
|
|
|
- },
|
|
|
- {
|
|
|
- door: "A门",
|
|
|
- process: "粗磨",
|
|
|
- car: "NC车",
|
|
|
- description: "万博_039561419_15*110.1",
|
|
|
- batch: "DC23727410070",
|
|
|
- cases: 5,
|
|
|
- caseNumber: "X12522、X55222、X15522、J5211、J5211"
|
|
|
+ const listData = ref([
|
|
|
+ //{
|
|
|
+ // door: "A门",
|
|
|
+ // process: "粗磨",
|
|
|
+ // car: "NC车",
|
|
|
+ // description: "万博_039561419_15*110.1",
|
|
|
+ // batch: "DC23727410070",
|
|
|
+ // cases: 5,
|
|
|
+ // caseNumber: "X12522、X55222、X15522、J5211、J5211"
|
|
|
|
|
|
- }
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // door: "A门",
|
|
|
+ // process: "粗磨",
|
|
|
+ // car: "NC车",
|
|
|
+ // description: "万博_039561419_15*110.1",
|
|
|
+ // batch: "DC23727410070",
|
|
|
+ // cases: 5,
|
|
|
+ // caseNumber: "X12522、X55222、X15522、J5211、J5211"
|
|
|
+
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // door: "A门",
|
|
|
+ // process: "粗磨",
|
|
|
+ // car: "NC车",
|
|
|
+ // description: "万博_039561419_15*110.1",
|
|
|
+ // batch: "DC23727410070",
|
|
|
+ // cases: 5,
|
|
|
+ // caseNumber: "X12522、X55222、X15522、J5211、J5211"
|
|
|
+
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // door: "A门",
|
|
|
+ // process: "粗磨",
|
|
|
+ // car: "NC车",
|
|
|
+ // description: "万博_039561419_15*110.1",
|
|
|
+ // batch: "DC23727410070",
|
|
|
+ // cases: 5,
|
|
|
+ // caseNumber: "X12522、X55222、X15522、J5211、J5211"
|
|
|
+
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // door: "A门",
|
|
|
+ // process: "粗磨",
|
|
|
+ // car: "NC车",
|
|
|
+ // description: "万博_039561419_15*110.1",
|
|
|
+ // batch: "DC23727410070",
|
|
|
+ // cases: 5,
|
|
|
+ // caseNumber: "X12522、X55222、X15522、J5211、J5211"
|
|
|
+
|
|
|
+ // }
|
|
|
|
|
|
])
|
|
|
- const handleStartTurnover = (data) => {
|
|
|
- let _data = data ?? {}
|
|
|
+ const handleStartTurnover = () => {
|
|
|
+ if(selection.value.length >0) {
|
|
|
+ turnoverTaskDialog.value.open(selection.value)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '未选中周转内容',
|
|
|
+ icon:'error',
|
|
|
+ duration: 1000//1后消失
|
|
|
+ });
|
|
|
+ }
|
|
|
// 调用子组件中的方法
|
|
|
- turnoverTaskDialog.value.open(_data)
|
|
|
+
|
|
|
}
|
|
|
- const isSelected = (index) => {
|
|
|
- return selection.value.includes(index)
|
|
|
+ const isSelected = (item) => {
|
|
|
+ return selection.value.includes(item);
|
|
|
}
|
|
|
- const handleSelection = (index) => {
|
|
|
- console.log(index)
|
|
|
-
|
|
|
- const buttonIndex = selection.value.indexOf(index);
|
|
|
- if (buttonIndex > -1) {
|
|
|
- selection.value.splice(buttonIndex, 1); // 取消选中
|
|
|
- } else {
|
|
|
- selection.value.push(index); // 选中
|
|
|
- }
|
|
|
- console.log(selection.value)
|
|
|
+
|
|
|
+ const handleSelection = (item, index) => {
|
|
|
+ const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
|
|
|
+ if (buttonIndex > -1) {
|
|
|
+ selection.value.splice(buttonIndex, 1); // 取消选中
|
|
|
+ } else {
|
|
|
+ selection.value.push(item); // 选中
|
|
|
+ }
|
|
|
+ console.log(selection.value, "selection");
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleDeleteTurnover(item) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示', // 标题
|
|
|
+ content: '是否删除此条周转', // 提示内容
|
|
|
+ cancelText: "取消", // 取消按钮的文字
|
|
|
+ confirmText: "确认", // 确认按钮的文字
|
|
|
+ //点击确定之后执行的代码
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ const checkIndex = listData.value.findIndex(selectedItem => selectedItem === item);
|
|
|
+ if (checkIndex > -1) {
|
|
|
+ listData.value.splice(checkIndex, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
+ .container {
|
|
|
+ height: 100%;
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ }
|
|
|
.scroll-container {
|
|
|
position: absolute;
|
|
|
top: 24rpx;
|