|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<dialog-base ref="baseDialog" title="请选择">
|
|
<dialog-base ref="baseDialog" title="请选择">
|
|
<!-- <view class="equipment-container uni-row ">
|
|
<!-- <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 equipments" :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> -->
|
|
<view>
|
|
<view>
|
|
@@ -12,7 +12,7 @@
|
|
</view>
|
|
</view>
|
|
<view>
|
|
<view>
|
|
<uni-section title="设备" type="line">
|
|
<uni-section title="设备" type="line">
|
|
- <uni-data-select v-model="selectedEquiment" :localdata="equipmentList" :clear="false"
|
|
|
|
|
|
+ <uni-data-select v-model="selectedEquipment" :localdata="equipmentList" :clear="false"
|
|
@change="handleEquipmentChange"></uni-data-select>
|
|
@change="handleEquipmentChange"></uni-data-select>
|
|
</uni-section>
|
|
</uni-section>
|
|
</view>
|
|
</view>
|
|
@@ -23,9 +23,9 @@
|
|
<switch class="switch" @change="switchChange" />
|
|
<switch class="switch" @change="switchChange" />
|
|
<text>是</text>
|
|
<text>是</text>
|
|
</view>
|
|
</view>
|
|
- </view>
|
|
|
|
|
|
+ </view>
|
|
<view v-if="flag">
|
|
<view v-if="flag">
|
|
- <uni-easyinput class="uni-mt-5" suffixIcon="search" focus v-model="userName" placeholder="请输入协作者编号"
|
|
|
|
|
|
+ <uni-easyinput class="uni-mt-5" suffixIcon="search" focus v-model="userName" placeholder="请输入协作者编号"
|
|
@iconClick="iconClick"></uni-easyinput>
|
|
@iconClick="iconClick"></uni-easyinput>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
@@ -58,20 +58,23 @@
|
|
import {
|
|
import {
|
|
store
|
|
store
|
|
} from '@/store/index.js'
|
|
} from '@/store/index.js'
|
|
|
|
+ import {
|
|
|
|
+ getEquipmentByUidAndDid
|
|
|
|
+ } from '@/api/resourceGroup/resourceGroupDetail.js'
|
|
import {
|
|
import {
|
|
timestampToTime
|
|
timestampToTime
|
|
} from '@/utils/common.js'
|
|
} from '@/utils/common.js'
|
|
|
|
|
|
const baseDialog = ref(null)
|
|
const baseDialog = ref(null)
|
|
- const equiments = ref([]) // 接收设备列表信息
|
|
|
|
|
|
+ const equipments = ref([]) // 接收设备列表信息
|
|
const equipmentList = 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 processList = ref([])
|
|
const selectedProcess = ref(null)
|
|
const selectedProcess = ref(null)
|
|
- const selectedEquiment = ref(null)
|
|
|
|
|
|
+ const selectedEquipment = ref(null)
|
|
const flag = ref(false)
|
|
const flag = ref(false)
|
|
const userName = ref(null)
|
|
const userName = ref(null)
|
|
|
|
|
|
@@ -86,7 +89,6 @@
|
|
deptId: store.curDeptDetails
|
|
deptId: store.curDeptDetails
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
- console.log(res)
|
|
|
|
for (var i = 0; i < res.rows.length; i++) {
|
|
for (var i = 0; i < res.rows.length; i++) {
|
|
processList.value[i] = {
|
|
processList.value[i] = {
|
|
text: res.rows[i].processAlias,
|
|
text: res.rows[i].processAlias,
|
|
@@ -96,13 +98,43 @@
|
|
selectedProcess.value = res.rows[0].processId;
|
|
selectedProcess.value = res.rows[0].processId;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+ getEquipmentByUidAndDid(store.userInfo.userId, store.curDeptDetails).then(res => {
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
+ getDayWorkItemList({
|
|
|
|
+ userId: store.userInfo.userId,
|
|
|
|
+ dayworkId: store.dayworkInfo.id,
|
|
|
|
+ status: 1
|
|
|
|
+ }).then(response => {
|
|
|
|
+ equipmentList.value = res.rows
|
|
|
|
+ if (response.code = 200) {
|
|
|
|
+ for (let i = 0; i < res.rows.length; i++) {
|
|
|
|
+ for (let j = 0; j < response.rows.length; j++) {
|
|
|
|
+ if (response.rows[j].equipmentDetailId == res.rows[i].commonId) {
|
|
|
|
+ equipmentList.value.splice(j, 1)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ for (var i = 0; i < equipmentList.value.length; i++) {
|
|
|
|
+ equipmentList.value[i] = {
|
|
|
|
+ text: equipmentList.value[i].commonName,
|
|
|
|
+ value: equipmentList.value[i]
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ selectedEquipment.value = equipmentList.value[0];
|
|
|
|
+ console.log(selectedEquipment.value)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ selectedEquipment.value = equipmentList.value[0];
|
|
|
|
+ }
|
|
|
|
+ })
|
|
// let reqParam = {
|
|
// let reqParam = {
|
|
// userId: userId.value,
|
|
// userId: userId.value,
|
|
// 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
|
|
|
|
|
|
+ // equipments.value = res.rows
|
|
// getDayWorkItemList({
|
|
// getDayWorkItemList({
|
|
// userId: store.userInfo.userId,
|
|
// userId: store.userInfo.userId,
|
|
// dayworkId: store.dayworkInfo.id,
|
|
// dayworkId: store.dayworkInfo.id,
|
|
@@ -110,14 +142,14 @@
|
|
// }).then(response => {
|
|
// }).then(response => {
|
|
// // 过滤人员可选择的设备列表(选择之后不予展示)
|
|
// // 过滤人员可选择的设备列表(选择之后不予展示)
|
|
// 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++) {
|
|
|
|
- // if (response.rows[i].equipmentDetailId == equiments.value[j]
|
|
|
|
|
|
+ // for (let j = 0; j < equipments.value.length; j++) {
|
|
|
|
+ // if (response.rows[i].equipmentDetailId == equipments.value[j]
|
|
// .equipmentDetailId) {
|
|
// .equipmentDetailId) {
|
|
- // equiments.value.splice(j, 1);
|
|
|
|
|
|
+ // equipments.value.splice(j, 1);
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
- // console.log(equiments.value)
|
|
|
|
|
|
+ // console.log(equipments.value)
|
|
// baseDialog.value.open()
|
|
// baseDialog.value.open()
|
|
// })
|
|
// })
|
|
// }
|
|
// }
|
|
@@ -151,43 +183,43 @@
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- function handleSelection(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 handleSelection(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() {
|
|
function handleStart() {
|
|
- if (!selectedProcess.value || !selectedEquiment.value) {
|
|
|
|
|
|
+ if (!selectedProcess.value || !selectedEquipment.value) {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
icon: "none",
|
|
icon: "none",
|
|
title: "未选择工序或设备"
|
|
title: "未选择工序或设备"
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+ selectedProcess.value = null;
|
|
|
|
+ selectedEquipment.value = null;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
close();
|
|
close();
|
|
if (firstItem.value) {
|
|
if (firstItem.value) {
|
|
- 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;
|
|
|
|
-
|
|
|
|
|
|
+ sendReqParam.value = {
|
|
|
|
+ ...firstItem.value,
|
|
|
|
+ processId: selectedProcess.value,
|
|
|
|
+ equipmentDetailId: selectedEquipment.value.commonId,
|
|
|
|
+ equipmentDetailCode: selectedEquipment.value.commonCode,
|
|
|
|
+ startTime: timestampToTime(new Date()),
|
|
|
|
+ status: 1
|
|
|
|
+ };
|
|
emit('handleAddDayWorkItem', sendReqParam.value);
|
|
emit('handleAddDayWorkItem', sendReqParam.value);
|
|
- selectedProcess.value = null;
|
|
|
|
- selectedEquiment.value = null;
|
|
|
|
} else {
|
|
} else {
|
|
- console.log(selection.value);
|
|
|
|
- emit('handleAddDayWorkItem', selection.value);
|
|
|
|
- selectedProcess.value = null;
|
|
|
|
- selectedEquiment.value = null;
|
|
|
|
|
|
+ emit('handleAddDayWorkItem', {
|
|
|
|
+ processId: selectedProcess.value,
|
|
|
|
+ equipmentDetailId: selectedEquipment.value.commonId,
|
|
|
|
+ equipmentDetailCode: selectedEquipment.value.commonCode
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|