|
@@ -1,9 +1,22 @@
|
|
<template>
|
|
<template>
|
|
- <dialog-base ref="baseDialog" title="选择设备">
|
|
|
|
- <view class="equipment-container uni-row ">
|
|
|
|
|
|
+ <dialog-base ref="baseDialog" title="请选择">
|
|
|
|
+ <!-- <view class="equipment-container uni-row ">
|
|
<view v-for="(item, index) in equiments" :class="{'item':true,'selected': isSelected(item)}" :key="index"
|
|
<view v-for="(item, index) in equiments" :class="{'item':true,'selected': isSelected(item)}" :key="index"
|
|
@click="handleSelection(item)"><text class="label">{{item['equipmentDetailCode']}}</text></view>
|
|
@click="handleSelection(item)"><text class="label">{{item['equipmentDetailCode']}}</text></view>
|
|
|
|
+ </view> -->
|
|
|
|
+ <view>
|
|
|
|
+ <uni-section title="工序" type="line">
|
|
|
|
+ <uni-data-select v-model="selectedProcess" :localdata="processList" :clear="false"
|
|
|
|
+ @change="handleProcessChange"></uni-data-select>
|
|
|
|
+ </uni-section>
|
|
</view>
|
|
</view>
|
|
|
|
+ <view>
|
|
|
|
+ <uni-section title="设备" type="line">
|
|
|
|
+ <uni-data-select v-model="selectedEquiment" :localdata="equipmentList" :clear="false"
|
|
|
|
+ @change="handleEquipmentChange"></uni-data-select>
|
|
|
|
+ </uni-section>
|
|
|
|
+ </view>
|
|
|
|
+
|
|
<view class="add-btn-container uni-row">
|
|
<view class="add-btn-container uni-row">
|
|
<button type="primary" class="btn" @click="handleStart">开始</button>
|
|
<button type="primary" class="btn" @click="handleStart">开始</button>
|
|
</view>
|
|
</view>
|
|
@@ -24,7 +37,8 @@
|
|
getUserInfo
|
|
getUserInfo
|
|
} from '@/api/login/index.js'
|
|
} from '@/api/login/index.js'
|
|
import {
|
|
import {
|
|
- saveDayWorkItem,getDayWorkItemList
|
|
|
|
|
|
+ saveDayWorkItem,
|
|
|
|
+ getDayWorkItemList
|
|
} from '@/api/business/dayWorkItem.js'
|
|
} from '@/api/business/dayWorkItem.js'
|
|
import {
|
|
import {
|
|
store
|
|
store
|
|
@@ -34,12 +48,16 @@
|
|
} from '@/utils/common.js'
|
|
} from '@/utils/common.js'
|
|
|
|
|
|
const baseDialog = ref(null)
|
|
const baseDialog = ref(null)
|
|
- const selection = ref([])
|
|
|
|
- const equiments = ref([]) // 接收设备列表信息
|
|
|
|
|
|
+ const equiments = ref([]) // 接收设备列表信息
|
|
|
|
+ const equipmentList = ref([])
|
|
const emit = defineEmits(['handleAddDayWorkItem'])
|
|
const emit = defineEmits(['handleAddDayWorkItem'])
|
|
const userId = ref(null)
|
|
const userId = ref(null)
|
|
const firstItem = ref(null);
|
|
const firstItem = ref(null);
|
|
const sendReqParam = ref([])
|
|
const sendReqParam = ref([])
|
|
|
|
+ const processList = ref([])
|
|
|
|
+ const selectedProcess = ref(null)
|
|
|
|
+ const selectedEquiment = ref(null)
|
|
|
|
+
|
|
|
|
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
userId.value = store.userInfo.userId || "";
|
|
userId.value = store.userInfo.userId || "";
|
|
@@ -51,7 +69,7 @@
|
|
processId: store.dayworkInfo.currentProcess.id,
|
|
processId: store.dayworkInfo.currentProcess.id,
|
|
}
|
|
}
|
|
getUserequipmentList(reqParam).then(res => {
|
|
getUserequipmentList(reqParam).then(res => {
|
|
- if(res.code == 200){
|
|
|
|
|
|
+ if (res.code == 200) {
|
|
equiments.value = res.rows
|
|
equiments.value = res.rows
|
|
getDayWorkItemList({
|
|
getDayWorkItemList({
|
|
userId: store.userInfo.userId,
|
|
userId: store.userInfo.userId,
|
|
@@ -61,13 +79,14 @@
|
|
// 过滤人员可选择的设备列表(选择之后不予展示)
|
|
// 过滤人员可选择的设备列表(选择之后不予展示)
|
|
for (let i = 0; i < response.rows.length; i++) {
|
|
for (let i = 0; i < response.rows.length; i++) {
|
|
for (let j = 0; j < equiments.value.length; j++) {
|
|
for (let j = 0; j < equiments.value.length; j++) {
|
|
- if(response.rows[i].equipmentDetailId == equiments.value[j].equipmentDetailId){
|
|
|
|
- equiments.value.splice(j,1);
|
|
|
|
|
|
+ if (response.rows[i].equipmentDetailId == equiments.value[j]
|
|
|
|
+ .equipmentDetailId) {
|
|
|
|
+ equiments.value.splice(j, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
console.log(equiments.value)
|
|
console.log(equiments.value)
|
|
- baseDialog.value.open()
|
|
|
|
|
|
+ baseDialog.value.open()
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -86,8 +105,12 @@
|
|
open
|
|
open
|
|
})
|
|
})
|
|
|
|
|
|
- function isSelected(item) {
|
|
|
|
- return selection.value.includes(item);
|
|
|
|
|
|
+ function handleProcessChange() {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function handleEquipmentChange() {
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
function handleSelection(item) {
|
|
function handleSelection(item) {
|
|
@@ -101,34 +124,32 @@
|
|
}
|
|
}
|
|
|
|
|
|
function handleStart() {
|
|
function handleStart() {
|
|
- if(selection.value.length == 0){
|
|
|
|
|
|
+ if (!selectedProcess.value || !selectedEquiment.value) {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
- icon: "error",
|
|
|
|
- title: "未选择设备"
|
|
|
|
|
|
+ icon: "none",
|
|
|
|
+ title: "未选择工序或设备"
|
|
})
|
|
})
|
|
- close();
|
|
|
|
|
|
+
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
close();
|
|
close();
|
|
if (firstItem.value) {
|
|
if (firstItem.value) {
|
|
- for (var i = 0; i < selection.value.length; i++) {
|
|
|
|
- sendReqParam.value.push(firstItem.value);
|
|
|
|
- sendReqParam.value[i].equipmentDetailId = selection.value[i].equipmentDetailId;
|
|
|
|
- sendReqParam.value[i].equipmentDetailCode = selection.value[i].equipmentDetailCode;
|
|
|
|
- sendReqParam.value[i].startTime = timestampToTime(new Date());
|
|
|
|
- sendReqParam.value[i].status = 1;
|
|
|
|
- if (i > 0) {
|
|
|
|
- sendReqParam.value[i].id = null;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ sendReqParam.value.push(firstItem.value);
|
|
|
|
+ sendReqParam.value[i].id = null;
|
|
|
|
+ sendReqParam.value[i].processId = selectedProcess.value;
|
|
|
|
+ sendReqParam.value[i].equipmentDetailId = selectedEquiment.value.equipmentDetailId;
|
|
|
|
+ sendReqParam.value[i].equipmentDetailCode = selectedEquiment.value.equipmentDetailCode;
|
|
|
|
+ sendReqParam.value[i].startTime = timestampToTime(new Date());
|
|
|
|
+ sendReqParam.value[i].status = 1;
|
|
|
|
+
|
|
emit('handleAddDayWorkItem', sendReqParam.value);
|
|
emit('handleAddDayWorkItem', sendReqParam.value);
|
|
- selection.value = [];
|
|
|
|
- equiments.value = [];
|
|
|
|
- }else{
|
|
|
|
|
|
+ selectedProcess.value = null;
|
|
|
|
+ selectedEquiment.value = null;
|
|
|
|
+ } else {
|
|
console.log(selection.value);
|
|
console.log(selection.value);
|
|
emit('handleAddDayWorkItem', selection.value);
|
|
emit('handleAddDayWorkItem', selection.value);
|
|
- equiments.value = [];
|
|
|
|
- selection.value = [];
|
|
|
|
|
|
+ selectedProcess.value = null;
|
|
|
|
+ selectedEquiment.value = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|