|
@@ -10,7 +10,7 @@
|
|
<view class="" style="margin: 0 20rpx 20rpx 0;width: 88%;">
|
|
<view class="" style="margin: 0 20rpx 20rpx 0;width: 88%;">
|
|
<uni-section title="请选择下序工段" title-font-size="32rpx" style="margin: 0 0 0 -16rpx;">
|
|
<uni-section title="请选择下序工段" title-font-size="32rpx" style="margin: 0 0 0 -16rpx;">
|
|
<uni-data-select v-model="curDayworkItem.deptId" :localdata="deptList" @change="handleChange"
|
|
<uni-data-select v-model="curDayworkItem.deptId" :localdata="deptList" @change="handleChange"
|
|
- :clear="false"
|
|
|
|
|
|
+ :clear="false"
|
|
style="margin: 0 0 0 16rpx;outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
|
|
style="margin: 0 0 0 16rpx;outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
|
|
</uni-section>
|
|
</uni-section>
|
|
</view>
|
|
</view>
|
|
@@ -64,7 +64,7 @@
|
|
timestampToTime
|
|
timestampToTime
|
|
} from '@/utils/common.js'
|
|
} from '@/utils/common.js'
|
|
|
|
|
|
- const baseDialog = ref(null)
|
|
|
|
|
|
+ const baseDialog = ref(null)
|
|
const turnoverDoorChecked = ref([])
|
|
const turnoverDoorChecked = ref([])
|
|
const turnoverType = ref([])
|
|
const turnoverType = ref([])
|
|
const turnoverArea = ref([])
|
|
const turnoverArea = ref([])
|
|
@@ -82,8 +82,7 @@
|
|
})
|
|
})
|
|
|
|
|
|
function open(data) {
|
|
function open(data) {
|
|
- deptList.value = [];
|
|
|
|
- turnAreaList.value = [];
|
|
|
|
|
|
+ resetPage();
|
|
dayworkInfo.value = data;
|
|
dayworkInfo.value = data;
|
|
baseDialog.value.open();
|
|
baseDialog.value.open();
|
|
init();
|
|
init();
|
|
@@ -98,6 +97,18 @@
|
|
turnAreaList.value = [];
|
|
turnAreaList.value = [];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function resetPage() {
|
|
|
|
+ turnoverDoorChecked.value = []
|
|
|
|
+ turnoverType.value = []
|
|
|
|
+ turnoverArea.value = []
|
|
|
|
+ selection.value = []
|
|
|
|
+ curDayworkItem.value = {
|
|
|
|
+ turnoverType: 1
|
|
|
|
+ }
|
|
|
|
+ deptList.value = []
|
|
|
|
+ turnAreaList.value = []
|
|
|
|
+ }
|
|
|
|
+
|
|
function init() {
|
|
function init() {
|
|
getDictInfoByType('daywork_turnover_type').then(res => {
|
|
getDictInfoByType('daywork_turnover_type').then(res => {
|
|
turnoverType.value = res.data;
|
|
turnoverType.value = res.data;
|
|
@@ -120,7 +131,7 @@
|
|
tenantId: store.tenantId
|
|
tenantId: store.tenantId
|
|
}).then(res => {
|
|
}).then(res => {
|
|
console.log(res.data)
|
|
console.log(res.data)
|
|
- for (var i = 0; i < res.data.length; i++) {
|
|
|
|
|
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
deptList.value[i] = {
|
|
deptList.value[i] = {
|
|
text: res.data[i].deptName,
|
|
text: res.data[i].deptName,
|
|
value: res.data[i].deptId,
|
|
value: res.data[i].deptId,
|
|
@@ -138,21 +149,21 @@
|
|
function selectTurnoverDoor(item) {
|
|
function selectTurnoverDoor(item) {
|
|
// turnoverDoorChecked.value = item;
|
|
// turnoverDoorChecked.value = item;
|
|
// curDayworkItem.value.turnoverArea = item.dictValue;
|
|
// curDayworkItem.value.turnoverArea = item.dictValue;
|
|
- let index = selection.value.findIndex(selectedItem => selectedItem === item);
|
|
|
|
- if (index > -1) {
|
|
|
|
- selection.value.splice(index, 1);
|
|
|
|
- } else {
|
|
|
|
- selection.value.push(item);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ let index = selection.value.findIndex(selectedItem => selectedItem === item);
|
|
|
|
+ if (index > -1) {
|
|
|
|
+ selection.value.splice(index, 1);
|
|
|
|
+ } else {
|
|
|
|
+ selection.value.push(item);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
function handleTurnoverDoor(item) {
|
|
function handleTurnoverDoor(item) {
|
|
return selection.value.includes(item);
|
|
return selection.value.includes(item);
|
|
}
|
|
}
|
|
|
|
+
|
|
function handleValidate(data) {
|
|
function handleValidate(data) {
|
|
console.log(data)
|
|
console.log(data)
|
|
- if (data.turnoverType === "0" || data.turnoverArea === "" || data.deptId === "0") {
|
|
|
|
|
|
+ if (data.turnoverArea == "" || data.deptId == null || selection.value.length == 0) {
|
|
return false;
|
|
return false;
|
|
} else {
|
|
} else {
|
|
return true;
|
|
return true;
|
|
@@ -169,7 +180,18 @@
|
|
} else {
|
|
} else {
|
|
curDayworkItem.value.tenantId = store.tenantId;
|
|
curDayworkItem.value.tenantId = store.tenantId;
|
|
}
|
|
}
|
|
- console.log(deptList.value)
|
|
|
|
|
|
+ // 过滤出周转位置的数组,并转换成字符串
|
|
|
|
+ const newArray = selection.value.map((item) => {
|
|
|
|
+ if (item.code) {
|
|
|
|
+ return item.code;
|
|
|
|
+ } else if (item.dictLabel) {
|
|
|
|
+ return item.dictLabel;
|
|
|
|
+ } else {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ curDayworkItem.value.turnoverArea = newArray.join('、');
|
|
|
|
+ // curDayworkItem.value.dayworkId = store.dayworkInfo.id;
|
|
// 设置周转下一个车间名
|
|
// 设置周转下一个车间名
|
|
for (let i = 0; i < deptList.value.length; i++) {
|
|
for (let i = 0; i < deptList.value.length; i++) {
|
|
if (deptList.value[i].value == curDayworkItem.value.deptId) {
|
|
if (deptList.value[i].value == curDayworkItem.value.deptId) {
|
|
@@ -177,29 +199,26 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
console.log(curDayworkItem.value);
|
|
console.log(curDayworkItem.value);
|
|
|
|
+ console.log(dayworkInfo.value)
|
|
if (!handleValidate(curDayworkItem.value)) {
|
|
if (!handleValidate(curDayworkItem.value)) {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
icon: "error",
|
|
icon: "error",
|
|
- title: '请选择完整信息',
|
|
|
|
- duration: 2000
|
|
|
|
|
|
+ title: '请选择完整信息'
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
|
|
+ close();
|
|
saveDayWorkItem(curDayworkItem.value).then(res => {
|
|
saveDayWorkItem(curDayworkItem.value).then(res => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
icon: 'success',
|
|
icon: 'success',
|
|
- title: '操作成功',
|
|
|
|
- duration: 2000
|
|
|
|
|
|
+ title: '操作成功'
|
|
});
|
|
});
|
|
uni.$emit('dayworkItemUpdate');
|
|
uni.$emit('dayworkItemUpdate');
|
|
- close();
|
|
|
|
} else {
|
|
} else {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
icon: 'error',
|
|
icon: 'error',
|
|
- title: '操作失败',
|
|
|
|
- duration: 2000
|
|
|
|
|
|
+ title: '操作失败'
|
|
});
|
|
});
|
|
- close();
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -213,7 +232,7 @@
|
|
deptId: curDayworkItem.value.deptId,
|
|
deptId: curDayworkItem.value.deptId,
|
|
}).then(res => {
|
|
}).then(res => {
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
- if(res.data[i].status == 0){
|
|
|
|
|
|
+ if (res.data[i].status == 0) {
|
|
turnAreaList.value[i] = res.data[i];
|
|
turnAreaList.value[i] = res.data[i];
|
|
}
|
|
}
|
|
}
|
|
}
|