|
@@ -24,7 +24,7 @@
|
|
|
getUserInfo
|
|
|
} from '@/api/login/index.js'
|
|
|
import {
|
|
|
- saveDayWorkItem
|
|
|
+ saveDayWorkItem,getDayWorkItemList
|
|
|
} from '@/api/business/dayWorkItem.js'
|
|
|
import {
|
|
|
store
|
|
@@ -35,7 +35,7 @@
|
|
|
|
|
|
const baseDialog = ref(null)
|
|
|
const selection = ref([])
|
|
|
- const equiments = ref([])
|
|
|
+ const equiments = ref([]) // 接收设备列表信息
|
|
|
const emit = defineEmits(['handleAddDayWorkItem'])
|
|
|
const userId = ref(null)
|
|
|
const firstItem = ref(null);
|
|
@@ -43,24 +43,39 @@
|
|
|
|
|
|
onLoad(() => {
|
|
|
userId.value = store.userInfo.userId || "";
|
|
|
- init();
|
|
|
})
|
|
|
|
|
|
function init() {
|
|
|
let reqParam = {
|
|
|
userId: userId.value,
|
|
|
- processId: store.dayworkInfo.currentProcess.id
|
|
|
+ processId: store.dayworkInfo.currentProcess.id,
|
|
|
}
|
|
|
getUserequipmentList(reqParam).then(res => {
|
|
|
- console.log(res)
|
|
|
- equiments.value = res.rows
|
|
|
+ if(res.code == 200){
|
|
|
+ equiments.value = res.rows
|
|
|
+ getDayWorkItemList({
|
|
|
+ userId: store.userInfo.userId,
|
|
|
+ dayworkId: store.dayworkInfo.id,
|
|
|
+ status: 1
|
|
|
+ }).then(response => {
|
|
|
+ // 过滤人员可选择的设备列表(选择之后不予展示)
|
|
|
+ for (let i = 0; i < response.rows.length; i++) {
|
|
|
+ for (let j = 0; j < equiments.value.length; j++) {
|
|
|
+ if(response.rows[i].equipmentDetailId == equiments.value[j].equipmentDetailId){
|
|
|
+ equiments.value.splice(j,1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(equiments.value)
|
|
|
+ baseDialog.value.open()
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
|
|
|
function open(data) {
|
|
|
firstItem.value = data;
|
|
|
- console.log(firstItem.value)
|
|
|
- baseDialog.value.open()
|
|
|
+ init();
|
|
|
}
|
|
|
|
|
|
function close() {
|
|
@@ -76,16 +91,24 @@
|
|
|
}
|
|
|
|
|
|
function handleSelection(item) {
|
|
|
- const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
|
|
|
- if (buttonIndex > -1) {
|
|
|
- selection.value.splice(buttonIndex, 1); // 取消选中
|
|
|
- } else {
|
|
|
- selection.value.push(item); // 选中
|
|
|
- }
|
|
|
+ // const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
|
|
|
+ // if (buttonIndex > -1) {
|
|
|
+ // selection.value.splice(buttonIndex, 1); // 取消选中
|
|
|
+ // } else {
|
|
|
+ // selection.value.push(item); // 选中
|
|
|
+ // }
|
|
|
+ selection.value[0] = item;
|
|
|
}
|
|
|
|
|
|
function handleStart() {
|
|
|
- console.log(selection.value)
|
|
|
+ if(selection.value.length == 0){
|
|
|
+ uni.showToast({
|
|
|
+ icon: "error",
|
|
|
+ title: "未选择设备"
|
|
|
+ })
|
|
|
+ close();
|
|
|
+ return;
|
|
|
+ }
|
|
|
close();
|
|
|
if (firstItem.value) {
|
|
|
for (var i = 0; i < selection.value.length; i++) {
|
|
@@ -100,9 +123,11 @@
|
|
|
}
|
|
|
emit('handleAddDayWorkItem', sendReqParam.value);
|
|
|
selection.value = [];
|
|
|
+ equiments.value = [];
|
|
|
}else{
|
|
|
console.log(selection.value);
|
|
|
emit('handleAddDayWorkItem', selection.value);
|
|
|
+ equiments.value = [];
|
|
|
selection.value = [];
|
|
|
}
|
|
|
}
|