|
@@ -6,51 +6,58 @@
|
|
|
<!-- <uni-icons type="scan" size="24" /> -->
|
|
|
</view>
|
|
|
|
|
|
- <view class="time-controls" style="margin-top: 10rpx;">
|
|
|
- <uni-section title="检查日期:" type="square" class="uni-row sta">
|
|
|
- <input v-model="startTime" type="date" @input="timeSizer" />
|
|
|
- </uni-section>
|
|
|
+ <view class="time-controls"
|
|
|
+ style="margin-top: 10rpx;display: flex;margin-right: 0px;background-color: #ffffff;">
|
|
|
+ <view class="uni-row sta">
|
|
|
+ <span style="align-items: center;display: flex;font-size: 16px;margin-left: 12rpx;">检查日期:</span>
|
|
|
+ <view class="uni-row" style="flex: 1;width: 100%;">
|
|
|
+ <input v-model="startTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
|
|
|
+ <span style="align-items: center;display: flex;">—</span>
|
|
|
+ <input v-model="endTime" type="date" @input="timeSizer" style="flex: 1;width: 100%;" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- <view class="uni-row" style="margin-top: 10rpx;">
|
|
|
- <view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;" @click.stop="handleScan">扫码</view>
|
|
|
+ </view>
|
|
|
+ <view class="uni-row" style="margin-top: 10rpx;">
|
|
|
+ <view class="scan-btn " style="background-color: #aaaaff;min-height: 80rpx;" @click.stop="handleScan">扫码</view>
|
|
|
+ </view>
|
|
|
+ <view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
|
|
|
+ @click="handleSelection(item)">
|
|
|
+ <view class="lot-code uni-row">
|
|
|
+ <text>批次号:{{ item.lotCode }}</text>
|
|
|
+ <text :style="selectType(item)">{{ selectText(item) }}</text>
|
|
|
+ <text v-if="delable(item)" class="fa fa-trash" style="font-size: 16; color: red;"
|
|
|
+ @click.stop="deleteItem(item)"></text>
|
|
|
+ <text v-else class="fa fa-trash" style="font-size: 16; color: white;"></text>
|
|
|
</view>
|
|
|
- <view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
|
|
|
- @click="handleSelection(item)">
|
|
|
- <view class="lot-code uni-row">
|
|
|
- <text>批次号:{{ item.lotCode }}</text>
|
|
|
- <text :style="selectType(item)">{{ selectText(item) }}</text>
|
|
|
- <text v-if="delable(item)" class="fa fa-trash" style="font-size: 16; color: red;"
|
|
|
- @click.stop="deleteItem(item)"></text>
|
|
|
- <text v-else class="fa fa-trash" style="font-size: 16; color: white;"></text>
|
|
|
+ <view class="info">
|
|
|
+ <view class="info-row uni-row">
|
|
|
+ <view class="label">检查箱号:</view>
|
|
|
+ <view class="value">{{ item.carrierCode }}</view>
|
|
|
+ <view class="label">检察员:</view>
|
|
|
+ <view class="value">{{ item.technicianName }}</view>
|
|
|
</view>
|
|
|
- <view class="info">
|
|
|
- <view class="info-row uni-row">
|
|
|
- <view class="label">检查箱号:</view>
|
|
|
- <view class="value">{{ item.carrierCode }}</view>
|
|
|
- <view class="label">检察员:</view>
|
|
|
- <view class="value">{{ item.technicianName }}</view>
|
|
|
- </view>
|
|
|
- <view class="info-row uni-row">
|
|
|
- <view class="label">检查数量:</view>
|
|
|
- <view class="value">{{ item.examiningNum }}</view>
|
|
|
- <view class="label">不良品量:</view>
|
|
|
- <view class="value">{{ item.disqualificationNum }}</view>
|
|
|
- </view>
|
|
|
- <view class="info-row uni-row">
|
|
|
- <view class="label">产品描述:</view>
|
|
|
- <view class="value">{{ item.productDescription }}</view>
|
|
|
- </view>
|
|
|
- <view class="info-row uni-row">
|
|
|
- <view class="label">检测载具:</view>
|
|
|
- <view class="value">{{ item.inspectionCarrierCode }}
|
|
|
- {{ item.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
|
|
|
- </view>
|
|
|
- <button class="reporting-tag" size="mini" type="primary"
|
|
|
- @click.stop="changeCheckCarrier(item)">检测载具</button>
|
|
|
+ <view class="info-row uni-row">
|
|
|
+ <view class="label">检查数量:</view>
|
|
|
+ <view class="value">{{ item.examiningNum }}</view>
|
|
|
+ <view class="label">不良品量:</view>
|
|
|
+ <view class="value">{{ item.disqualificationNum }}</view>
|
|
|
+ </view>
|
|
|
+ <view class="info-row uni-row">
|
|
|
+ <view class="label">产品描述:</view>
|
|
|
+ <view class="value">{{ item.productDescription }}</view>
|
|
|
+ </view>
|
|
|
+ <view class="info-row uni-row">
|
|
|
+ <view class="label">检测载具:</view>
|
|
|
+ <view class="value">{{ item.inspectionCarrierCode }}
|
|
|
+ {{ item.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
|
|
|
</view>
|
|
|
+ <button class="reporting-tag" size="mini" type="primary"
|
|
|
+ @click.stop="changeCheckCarrier(item)">检测载具</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
@@ -79,8 +86,8 @@
|
|
|
} from '@/store/index.js'
|
|
|
const keyword = ref('')
|
|
|
const inspecionList = ref([]); //时间后筛选数组
|
|
|
-
|
|
|
const startTime = ref(new Date().toISOString().split("T")[0])
|
|
|
+ const endTime = ref(new Date().toISOString().split("T")[0])
|
|
|
const shouldCallList = ref(false)
|
|
|
const pageSize = ref(10)
|
|
|
const pageNum = ref(1)
|
|
@@ -104,60 +111,60 @@
|
|
|
|
|
|
/***************************** 页面生命周期函数 *****************************/
|
|
|
onShow(() => {
|
|
|
- console.log(inspecionList.value,15151)
|
|
|
+ console.log(inspecionList.value, 15151)
|
|
|
inspecionList.value = []
|
|
|
shouldCallList.value = false
|
|
|
- const instance = getCurrentInstance().proxy;
|
|
|
- const eventChannel = instance.getOpenerEventChannel();
|
|
|
- // 声明一个变量来保存 setTimeout 的 ID
|
|
|
- let timeoutId;
|
|
|
-
|
|
|
- // 监听 'inspectionChamberInfo' 事件
|
|
|
- eventChannel.on('inspectionChamberInfo', function(data) {
|
|
|
- console.log("Event received with data:", data);
|
|
|
-
|
|
|
- // 事件触发时取消 setTimeout
|
|
|
- clearTimeout(timeoutId);
|
|
|
-
|
|
|
- // 更新状态
|
|
|
- quer.value.inspectionChamberId = data.data;
|
|
|
- shouldCallList.value = true;
|
|
|
-
|
|
|
- // 事件触发时执行的逻辑
|
|
|
- getList();
|
|
|
- });
|
|
|
-
|
|
|
- // 设置 setTimeout,在没有接收到事件的情况下调用 getList
|
|
|
- timeoutId = setTimeout(() => {
|
|
|
- if (!shouldCallList.value) {
|
|
|
- console.log("777 - No event received, calling getList");
|
|
|
- getList();
|
|
|
- }
|
|
|
- }, 1000); // 例如,1 秒后执行
|
|
|
+ const instance = getCurrentInstance().proxy;
|
|
|
+ const eventChannel = instance.getOpenerEventChannel();
|
|
|
+ // 声明一个变量来保存 setTimeout 的 ID
|
|
|
+ let timeoutId;
|
|
|
+
|
|
|
+ // 监听 'inspectionChamberInfo' 事件
|
|
|
+ eventChannel.on('inspectionChamberInfo', function(data) {
|
|
|
+ console.log("Event received with data:", data);
|
|
|
+
|
|
|
+ // 事件触发时取消 setTimeout
|
|
|
+ clearTimeout(timeoutId);
|
|
|
+
|
|
|
+ // 更新状态
|
|
|
+ quer.value.inspectionChamberId = data.data;
|
|
|
+ shouldCallList.value = true;
|
|
|
+
|
|
|
+ // 事件触发时执行的逻辑
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+
|
|
|
+ // 设置 setTimeout,在没有接收到事件的情况下调用 getList
|
|
|
+ timeoutId = setTimeout(() => {
|
|
|
+ if (!shouldCallList.value) {
|
|
|
+ console.log("777 - No event received, calling getList");
|
|
|
+ getList();
|
|
|
+ }
|
|
|
+ }, 1000); // 例如,1 秒后执行
|
|
|
})
|
|
|
- onReachBottom(()=>{
|
|
|
- console.log(status.value)
|
|
|
- if(status.value) {
|
|
|
+ onReachBottom(() => {
|
|
|
+ console.log(status.value)
|
|
|
+ if (status.value) {
|
|
|
pageNum.value += 1
|
|
|
quer.value.pageNum = pageNum.value
|
|
|
quer.value.pageSize = pageSize.value
|
|
|
- getProcessInspecionList(quer.value).then(res =>{
|
|
|
- const existingIds = new Set(inspecionList.value.map(item => item.id));
|
|
|
-
|
|
|
- // 过滤出那些不在 existingIds 中的项,即新数据
|
|
|
- const newRows = res.rows.filter(row => !existingIds.has(row.id));
|
|
|
-
|
|
|
- // 如果有新数据,将其添加到 listData
|
|
|
- if (newRows.length > 0) {
|
|
|
- inspecionList.value = inspecionList.value.concat(newRows);
|
|
|
- original.value = original.value.concat(newRows);
|
|
|
- } else {
|
|
|
- // 如果没有新数据,更新状态表示没有更多数据
|
|
|
- status.value = false;
|
|
|
- }
|
|
|
+ getProcessInspecionList(quer.value).then(res => {
|
|
|
+ const existingIds = new Set(inspecionList.value.map(item => item.id));
|
|
|
+
|
|
|
+ // 过滤出那些不在 existingIds 中的项,即新数据
|
|
|
+ const newRows = res.rows.filter(row => !existingIds.has(row.id));
|
|
|
+
|
|
|
+ // 如果有新数据,将其添加到 listData
|
|
|
+ if (newRows.length > 0) {
|
|
|
+ inspecionList.value = inspecionList.value.concat(newRows);
|
|
|
+ original.value = original.value.concat(newRows);
|
|
|
+ } else {
|
|
|
+ // 如果没有新数据,更新状态表示没有更多数据
|
|
|
+ status.value = false;
|
|
|
+ }
|
|
|
})
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
/***************************** 定义了一些方法 *****************************/
|
|
|
|
|
@@ -167,25 +174,50 @@
|
|
|
});
|
|
|
pageNum.value = 1
|
|
|
quer.value.startTime = startTime.value;
|
|
|
+ quer.value.endTime = endTime.value;
|
|
|
// quer.value.deptId = store.curDeptDetails.deptId
|
|
|
quer.value.type = "instrumentRoomInspection"
|
|
|
quer.value.pageNum = pageNum.value
|
|
|
quer.value.pageSize = pageSize.value
|
|
|
- getProcessInspecionList(quer.value).then(res => {
|
|
|
- console.log("res", res);
|
|
|
- if (res.code == 200) {
|
|
|
- inspecionList.value = res.rows;
|
|
|
- console.log(1111111)
|
|
|
- uni.hideLoading();
|
|
|
- }
|
|
|
- });
|
|
|
- uni.hideLoading();
|
|
|
+ if (!checkTime(quer.value.startTime, quer.value.endTime)) {
|
|
|
+
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: "开始日期不能大于结束日期",
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ getProcessInspecionList(quer.value).then(res => {
|
|
|
+ console.log("res", res);
|
|
|
+ if (res.code == 200) {
|
|
|
+ inspecionList.value = res.rows;
|
|
|
+ console.log(1111111)
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //判断开始时间是否大于结束时间
|
|
|
+ function checkTime(time1, time2) {
|
|
|
+ let date1 = new Date(startTime.value);
|
|
|
+ let date2 = new Date(endTime.value);
|
|
|
+ if (date1 > date2) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
}
|
|
|
+
|
|
|
function handleSearch() {
|
|
|
pageNum.value = 1
|
|
|
status.value = true
|
|
|
getList()
|
|
|
}
|
|
|
+
|
|
|
function delable(item) {
|
|
|
if (item.creatorId === store.userInfo.userId) {
|
|
|
return true
|
|
@@ -209,7 +241,7 @@
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
} else if (res.cancel) {
|
|
|
uni.showToast({
|
|
|
title: '已取消',
|
|
@@ -267,8 +299,8 @@
|
|
|
);
|
|
|
} else {
|
|
|
// 测试时用
|
|
|
- quer.value.keyword = ""
|
|
|
- getList()
|
|
|
+ quer.value.keyword = ""
|
|
|
+ getList()
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -406,6 +438,7 @@
|
|
|
align-items: center;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.scan-btn {
|
|
|
height: 64rpx;
|
|
|
color: #ffffff;
|
|
@@ -413,7 +446,7 @@
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
border-radius: 8rpx;
|
|
|
- flex:1;
|
|
|
+ flex: 1;
|
|
|
}
|
|
|
|
|
|
.daywork-item {
|