|
@@ -1,37 +1,38 @@
|
|
<template>
|
|
<template>
|
|
- <view class="page-container uni-column">
|
|
|
|
- <view class="option-container uni-column">
|
|
|
|
- <!-- tab-bar -->
|
|
|
|
- <view class="tab-bars uni-row">
|
|
|
|
- <view :class="currentTabName === 1 ? 'active' : ''" @click.stop="handleTabBarClick(1)">
|
|
|
|
- <text>检查指导书</text>
|
|
|
|
- <view class="line"></view>
|
|
|
|
|
|
+ <view class="page-container" style="position: absolute;left: 0;right: 0;top: 0;bottom: 0">
|
|
|
|
+ <view class="option-container uni-column" style="display: flex;">
|
|
|
|
+ <!-- tab-bar -->
|
|
|
|
+ <view class="tab-bars uni-row">
|
|
|
|
+ <!-- <view :class="currentTabName === 1 ? 'active' : ''" @click.stop="handleTabBarClick(1)">
|
|
|
|
+ <text>检查指导书</text>
|
|
|
|
+ <view class="line"></view>
|
|
|
|
+ </view> -->
|
|
|
|
+ <view :class="currentTabName === 2 ? 'active' : ''">
|
|
|
|
+ <text>分选标准</text>
|
|
|
|
+ <view class="line"></view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <!-- 搜索框 -->
|
|
|
|
+ <view class="search-container uni-row">
|
|
|
|
+ <input type="text" v-model="keywords" placeholder="请输入关键字" />
|
|
|
|
+ <view class="btn" @click="handleSearch()">搜索</view>
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
- <view :class="currentTabName === 2 ? 'active' : ''" @click.stop="handleTabBarClick(2)">
|
|
|
|
- <text>分选标准</text>
|
|
|
|
- <view class="line"></view>
|
|
|
|
|
|
+ <view class="uni-row" style="background-color:#ffffff;height: 75%;padding-bottom: 12px;">
|
|
|
|
+ <view style="width: 100%;height: 100%;overflow: auto;">
|
|
|
|
+ <view v-if="dataList&& dataList.length == 0" style="align-items: center;margin-top: 30px">暂无分选标准数据</view>
|
|
|
|
+ <view v-else v-for="(item, index) in dataList" :key="index" :class="{'option-item':true,'selectedOptions':isSelectedOptions(item)}" @click="itemClick(item)">
|
|
|
|
+ <view class="uni-row">
|
|
|
|
+ <view class="value">{{ item.standard }}</view>
|
|
|
|
+ <uni-icons v-if="selection.includes(item)" class="arrow-right" type="checkmarkempty" size="24" />
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
- </view>
|
|
|
|
- <!-- 搜索框 -->
|
|
|
|
- <view class="search-container uni-row">
|
|
|
|
- <input type="text" v-model="keywords" placeholder="请输入关键字" />
|
|
|
|
- <view class="btn" @click="handleSearch()">搜索</view>
|
|
|
|
- </view>
|
|
|
|
- <!-- 选项 -->
|
|
|
|
- <view class="option-item" v-for="(item, index) in optionList" :key="index"
|
|
|
|
- @click="handleOptionChecked(item)">
|
|
|
|
- <view class="uni-row">
|
|
|
|
- <view class="label">检查项</view>
|
|
|
|
- <view class="value">{{ item.title }}</view>
|
|
|
|
|
|
+ <view class="bottom uni-row">
|
|
|
|
+ <button class="start-batch-btn" type="primary" :disabled="selection.length ==0" @click="handleAdd">添加</button>
|
|
</view>
|
|
</view>
|
|
- <view class="uni-row">
|
|
|
|
- <view class="label">检查标准</view>
|
|
|
|
- <view class="value">{{ item.standard }}</view>
|
|
|
|
- </view>
|
|
|
|
- <uni-icons class="arrow-right" type="right" size="24" />
|
|
|
|
- </view>
|
|
|
|
- </view>
|
|
|
|
- </view>
|
|
|
|
|
|
+</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
@@ -49,18 +50,19 @@
|
|
onShow
|
|
onShow
|
|
} from '@dcloudio/uni-app'
|
|
} from '@dcloudio/uni-app'
|
|
import {
|
|
import {
|
|
- getInspectionList
|
|
|
|
|
|
+ getInstructionInfo
|
|
} from '@/api/business/sortDaywork.js'
|
|
} from '@/api/business/sortDaywork.js'
|
|
|
|
+ import {
|
|
|
|
+ store
|
|
|
|
+ } from '@/store/index.js'
|
|
|
|
|
|
- const currentTabName = ref(1)
|
|
|
|
|
|
+ const currentTabName = ref(2)
|
|
const keywords = ref('')
|
|
const keywords = ref('')
|
|
- const optionList = ref([])
|
|
|
|
- // 检查指导书
|
|
|
|
- const optionList1 = ref([])
|
|
|
|
- // 分选标准
|
|
|
|
- const optionList2 = ref([])
|
|
|
|
- const dayworkItem = ref({})
|
|
|
|
- const index = ref(0)
|
|
|
|
|
|
+ const dataList = ref([])
|
|
|
|
+ const originalList = ref([])
|
|
|
|
+ const selection = ref([])
|
|
|
|
+ const dayworkItem = ref(null)
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
const instance = getCurrentInstance().proxy
|
|
const instance = getCurrentInstance().proxy
|
|
const eventChannel = instance.getOpenerEventChannel();
|
|
const eventChannel = instance.getOpenerEventChannel();
|
|
@@ -69,157 +71,103 @@
|
|
// console.log('acceptDataFromOpenerPage', data)
|
|
// console.log('acceptDataFromOpenerPage', data)
|
|
// 传入当前报工信息 通过当前报工的产品和工序获取检查指导书和分选标准
|
|
// 传入当前报工信息 通过当前报工的产品和工序获取检查指导书和分选标准
|
|
if (data && data.data) {
|
|
if (data && data.data) {
|
|
|
|
+ selection.value = []
|
|
dayworkItem.value = data.data
|
|
dayworkItem.value = data.data
|
|
console.log(dayworkItem.value)
|
|
console.log(dayworkItem.value)
|
|
- index.value = data.index
|
|
|
|
loadInspection({
|
|
loadInspection({
|
|
technologicalProcessId: dayworkItem.value.technologicalProcessId,
|
|
technologicalProcessId: dayworkItem.value.technologicalProcessId,
|
|
- processId: dayworkItem.value.processId,
|
|
|
|
|
|
+ processCode: dayworkItem.value.process.processCode,
|
|
lotId: dayworkItem.value.lotId
|
|
lotId: dayworkItem.value.lotId
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
})
|
|
})
|
|
|
|
+ const loadInspection = (data) => {
|
|
|
|
+ uni.showLoading({
|
|
|
|
+ title: '加载中'
|
|
|
|
+ });
|
|
|
|
+ // console.log(data)
|
|
|
|
+ getInstructionInfo(data).then(res => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ dataList.value = res.data
|
|
|
|
+ originalList.value = res.data
|
|
|
|
+ uni.hideLoading();
|
|
|
|
+ // console.log(optionList1.value, res.data.instructions)
|
|
|
|
+ // console.log(optionList2.value, res.data.standards)
|
|
|
|
+ } else {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ icon: 'none',
|
|
|
|
+ title: '分选标准获取失败'
|
|
|
|
+ })
|
|
|
|
+ uni.hideLoading();
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ function isSelectedOptions(item) {
|
|
|
|
+ return selection.value.includes(item);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function cateClick(item) {
|
|
|
|
+ selectionCategory.value = item
|
|
|
|
+ console.log(item)
|
|
|
|
+ console.log(categoryList.value)
|
|
|
|
+ let index = categoryList.value.findIndex(v=>v.id == item.id)
|
|
|
|
+ console.log(index)
|
|
|
|
+ currentData.value = index
|
|
|
|
+ if(categoryList.value[index].instructionList && categoryList.value[index].instructionList.length>0){
|
|
|
|
+ dataList.value = categoryList.value[index].instructionList
|
|
|
|
+ originalList.value = categoryList.value[index].instructionList
|
|
|
|
+ }else{
|
|
|
|
+ dataList.value = []
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function itemClick(item) {
|
|
|
|
+ const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
|
|
|
|
+ if (buttonIndex > -1) {
|
|
|
|
+ selection.value.splice(buttonIndex, 1); // 取消选中
|
|
|
|
+ } else {
|
|
|
|
+ selection.value.push(item); // 选中
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
function handleSearch() {
|
|
function handleSearch() {
|
|
- console.log(dayworkItem.value)
|
|
|
|
- let data = {
|
|
|
|
- technologicalProcessId: dayworkItem.value.technologicalProcessId,
|
|
|
|
- processId: dayworkItem.value.processId,
|
|
|
|
- keywords: keywords.value,
|
|
|
|
- lotId: dayworkItem.value.lotId
|
|
|
|
|
|
+ if(keywords.value == ""){
|
|
|
|
+ dataList.value = originalList.value
|
|
|
|
+ }else{
|
|
|
|
+ dataList.value = originalList.value.filter(item=>item.standard.includes(keywords.value))
|
|
}
|
|
}
|
|
- getInspectionList(data).then(res => {
|
|
|
|
- console.log(res)
|
|
|
|
- if (res.code === 200) {
|
|
|
|
- optionList1.value = res.data.instructions
|
|
|
|
- optionList2.value = res.data.standards
|
|
|
|
- if (currentTabName.value == 1) {
|
|
|
|
- optionList.value = optionList1.value
|
|
|
|
- } else {
|
|
|
|
- optionList.value = optionList2.value
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- uni.showToast({
|
|
|
|
- icon: 'none',
|
|
|
|
- title: '分选标准和检查指导项获取失败'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
// 页面生命周期函数
|
|
// 页面生命周期函数
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
- // optionList1.value = [
|
|
|
|
- // {
|
|
|
|
- // title: '001 台阶径',
|
|
|
|
- // standard: '角偏 < 0.05'
|
|
|
|
- // },
|
|
|
|
- // {
|
|
|
|
- // title: '002 台阶径',
|
|
|
|
- // standard: '角偏 < 0.04'
|
|
|
|
- // }
|
|
|
|
- // ]
|
|
|
|
-
|
|
|
|
- // optionList2.value = [
|
|
|
|
- // {
|
|
|
|
- // title: '划痕',
|
|
|
|
- // standard: '划痕描述'
|
|
|
|
- // },
|
|
|
|
- // {
|
|
|
|
- // title: '划伤',
|
|
|
|
- // standard: '划伤描述'
|
|
|
|
- // }
|
|
|
|
- // ]
|
|
|
|
|
|
|
|
- // optionList.value = optionList1.value
|
|
|
|
})
|
|
})
|
|
|
|
|
|
- const loadInspection = (data) => {
|
|
|
|
- // console.log(data)
|
|
|
|
- getInspectionList(data).then(res => {
|
|
|
|
- console.log(res)
|
|
|
|
- if (res.code === 200) {
|
|
|
|
- optionList1.value = res.data.instructions
|
|
|
|
- optionList2.value = res.data.standards
|
|
|
|
- //handleTabBarClick(currentTabName.value)
|
|
|
|
- currentTabName.value = 1
|
|
|
|
- optionList.value = optionList1.value
|
|
|
|
- // console.log(optionList1.value, res.data.instructions)
|
|
|
|
- // console.log(optionList2.value, res.data.standards)
|
|
|
|
- } else {
|
|
|
|
- uni.showToast({
|
|
|
|
- icon: 'none',
|
|
|
|
- title: '分选标准和检查指导项获取失败'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
|
|
// tabbar切换
|
|
// tabbar切换
|
|
- const handleTabBarClick = (val) => {
|
|
|
|
- switch (val) {
|
|
|
|
- case 1:
|
|
|
|
- keywords.value = ''
|
|
|
|
- var data = {
|
|
|
|
- technologicalProcessId: dayworkItem.value.technologicalProcessId,
|
|
|
|
- processId: dayworkItem.value.processId,
|
|
|
|
- lotId: dayworkItem.value.lotId
|
|
|
|
- }
|
|
|
|
- getInspectionList(data).then(res => {
|
|
|
|
- console.log(res)
|
|
|
|
- if (res.code === 200) {
|
|
|
|
- optionList1.value = res.data.instructions
|
|
|
|
- optionList2.value = res.data.standards
|
|
|
|
- optionList.value = optionList1.value
|
|
|
|
- } else {
|
|
|
|
- uni.showToast({
|
|
|
|
- icon: 'none',
|
|
|
|
- title: '检查指导项获取失败'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- break
|
|
|
|
- case 2:
|
|
|
|
- keywords.value = ''
|
|
|
|
- var data = {
|
|
|
|
- technologicalProcessId: dayworkItem.value.technologicalProcessId,
|
|
|
|
- processId: dayworkItem.value.processId,
|
|
|
|
- lotId: dayworkItem.value.lotId
|
|
|
|
- }
|
|
|
|
- getInspectionList(data).then(res => {
|
|
|
|
- console.log(res)
|
|
|
|
- if (res.code === 200) {
|
|
|
|
- optionList1.value = res.data.instructions
|
|
|
|
- optionList2.value = res.data.standards
|
|
|
|
- optionList.value = optionList2.value
|
|
|
|
- } else {
|
|
|
|
- uni.showToast({
|
|
|
|
- icon: 'none',
|
|
|
|
- title: '分选标准获取失败'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- currentTabName.value = val
|
|
|
|
- console.log(optionList.value)
|
|
|
|
- }
|
|
|
|
|
|
|
|
- const handleOptionChecked = (data) => {
|
|
|
|
- uni.$emit('addUnfitInfoEvent', {
|
|
|
|
- id: data.id,
|
|
|
|
- title: data.title,
|
|
|
|
- standard: data.standard,
|
|
|
|
- type: data.type,
|
|
|
|
- index: index.value + 1
|
|
|
|
- })
|
|
|
|
|
|
+
|
|
|
|
+ function handleAdd(){
|
|
|
|
+ console.log(selection.value)
|
|
|
|
+ uni.$emit('addUnfitInfoEvent',
|
|
|
|
+ selection.value
|
|
|
|
+
|
|
|
|
+ )
|
|
uni.navigateBack()
|
|
uni.navigateBack()
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
|
|
+ .selected {
|
|
|
|
+ border-left: 5px solid #c0c4fc;
|
|
|
|
+ font-weight: 700;
|
|
|
|
+ /* 选中之后样式 */
|
|
|
|
+ }
|
|
.page-container {
|
|
.page-container {
|
|
- height: 100%;
|
|
|
|
background-color: #ececec;
|
|
background-color: #ececec;
|
|
font-size: 28rpx;
|
|
font-size: 28rpx;
|
|
padding: 24rpx;
|
|
padding: 24rpx;
|
|
@@ -227,6 +175,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
.option-container {
|
|
.option-container {
|
|
|
|
+ height: 10%;
|
|
background-color: #ffffff;
|
|
background-color: #ffffff;
|
|
padding: 24rpx;
|
|
padding: 24rpx;
|
|
border-radius: 12rpx;
|
|
border-radius: 12rpx;
|
|
@@ -277,34 +226,58 @@
|
|
color: #ffffff;
|
|
color: #ffffff;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
.option-item {
|
|
.option-item {
|
|
position: relative;
|
|
position: relative;
|
|
margin-top: 24rpx;
|
|
margin-top: 24rpx;
|
|
padding-bottom: 8rpx;
|
|
padding-bottom: 8rpx;
|
|
border-bottom: 1px solid #BBBBBB;
|
|
border-bottom: 1px solid #BBBBBB;
|
|
-
|
|
|
|
|
|
+ margin-left: 24rpx;
|
|
|
|
+
|
|
.uni-row {
|
|
.uni-row {
|
|
padding-bottom: 16rpx;
|
|
padding-bottom: 16rpx;
|
|
-
|
|
|
|
|
|
+
|
|
.label {
|
|
.label {
|
|
width: 144rpx;
|
|
width: 144rpx;
|
|
}
|
|
}
|
|
-
|
|
|
|
.value {
|
|
.value {
|
|
flex: 1;
|
|
flex: 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
.uni-row:first-child {
|
|
.uni-row:first-child {
|
|
font-size: 32rpx;
|
|
font-size: 32rpx;
|
|
- font-weight: 700;
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ }
|
|
.arrow-right {
|
|
.arrow-right {
|
|
position: absolute;
|
|
position: absolute;
|
|
- top: 24rpx;
|
|
|
|
right: 24rpx;
|
|
right: 24rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ .uniui-checkmarkempty[data-v-d31e1c47]:before {
|
|
|
|
+ color: #1684FC;
|
|
|
|
+ }
|
|
|
|
+ .selectedOptions {
|
|
|
|
+ color: #1684FC;
|
|
|
|
+ }
|
|
|
|
+ .bottom {
|
|
|
|
+ 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;
|
|
|
|
+
|
|
|
|
+ .start-batch-btn {
|
|
|
|
+ flex: 1;
|
|
|
|
+ height: 80rpx;
|
|
|
|
+ line-height: 80rpx;
|
|
|
|
+ border-radius: 8rpx;
|
|
|
|
+ color: #FFFFFF;
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
</style>
|
|
</style>
|