|
@@ -12,7 +12,7 @@
|
|
@click="handleAddWasteInfo">+添加</text></view>
|
|
@click="handleAddWasteInfo">+添加</text></view>
|
|
</view>
|
|
</view>
|
|
<view class="list-title uni-row" v-for="(item, index) in wasteInfo">
|
|
<view class="list-title uni-row" v-for="(item, index) in wasteInfo">
|
|
- <input class="input" style="width: 20%;" v-model="item.rejectNum" placeholder="废品量" />
|
|
|
|
|
|
+ <input class="input" @input="handleInputRejectNum" style="width: 20%;" v-model="item.rejectNum" placeholder="废品量" />
|
|
<!-- <input class="input" v-model="item.reason" placeholder="请输入废品原因" /> -->
|
|
<!-- <input class="input" v-model="item.reason" placeholder="请输入废品原因" /> -->
|
|
<uni-data-select style="margin-left: 40rpx;width: 70%;" v-model="item.reason" :localdata="reasonList"
|
|
<uni-data-select style="margin-left: 40rpx;width: 70%;" v-model="item.reason" :localdata="reasonList"
|
|
@change="handleTenantChange"></uni-data-select>
|
|
@change="handleTenantChange"></uni-data-select>
|
|
@@ -50,6 +50,9 @@
|
|
timestampToTime,
|
|
timestampToTime,
|
|
toHHmmss
|
|
toHHmmss
|
|
} from '@/utils/common.js'
|
|
} from '@/utils/common.js'
|
|
|
|
+ import {
|
|
|
|
+ getDictInfoByType
|
|
|
|
+ } from '@/api/dict/dict.js'
|
|
const baseDialog = ref(null)
|
|
const baseDialog = ref(null)
|
|
const workInfo = ref({})
|
|
const workInfo = ref({})
|
|
const wasteInfo = ref([])
|
|
const wasteInfo = ref([])
|
|
@@ -57,9 +60,22 @@
|
|
const emit = defineEmits(['reset'])
|
|
const emit = defineEmits(['reset'])
|
|
|
|
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
-
|
|
|
|
|
|
+ init();
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+ function init() {
|
|
|
|
+ getDictInfoByType("waste_causes").then(res => {
|
|
|
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
|
|
+ reasonList.value[i] = {
|
|
|
|
+ value: res.data[i].dictValue,
|
|
|
|
+ text: res.data[i].dictLabel
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ console.log(res);
|
|
|
|
+ console.log(reasonList.value);
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
function open(data) {
|
|
function open(data) {
|
|
workInfo.value = data;
|
|
workInfo.value = data;
|
|
workInfo.value.qualifiedNum = null;
|
|
workInfo.value.qualifiedNum = null;
|
|
@@ -82,22 +98,37 @@
|
|
workInfo.value.qualifiedNum = workInfo.value.qualifiedNum.replace(/^0+|^-+|[^\d]/g, '');
|
|
workInfo.value.qualifiedNum = workInfo.value.qualifiedNum.replace(/^0+|^-+|[^\d]/g, '');
|
|
}
|
|
}
|
|
|
|
|
|
- // function handleInputRejectNum() {
|
|
|
|
- // workInfo.value.rejectNum = workInfo.value.rejectNum.replace(/^0+|^-|[^\d]/g, '');
|
|
|
|
- // }
|
|
|
|
|
|
+ function handleInputRejectNum() {
|
|
|
|
+ for (let i = 0; i < wasteInfo.value.length; i++) {
|
|
|
|
+ wasteInfo.value[i].rejectNum = wasteInfo.value[i].rejectNum.replace(/^0+|^-|[^\d]/g, '');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
function handleFinishReporting() {
|
|
function handleFinishReporting() {
|
|
|
|
+ for (let i = 0; i < wasteInfo.value.length; i++) {
|
|
|
|
+ if ((!wasteInfo.value[i].rejectNum && wasteInfo.value[i].reason) ||
|
|
|
|
+ (wasteInfo.value[i].rejectNum && !wasteInfo.value[i].reason)) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ icon: "error",
|
|
|
|
+ title: "请输入废弃数或废弃原因",
|
|
|
|
+ duration: 2000
|
|
|
|
+ })
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
close();
|
|
close();
|
|
if (workInfo.value.status != '3') {
|
|
if (workInfo.value.status != '3') {
|
|
workInfo.value.status = '2';
|
|
workInfo.value.status = '2';
|
|
}
|
|
}
|
|
workInfo.value.endTime = timestampToTime(new Date());
|
|
workInfo.value.endTime = timestampToTime(new Date());
|
|
|
|
+ workInfo.value.wasteInfo = wasteInfo.value;
|
|
|
|
+ console.log(workInfo.value)
|
|
saveDayWorkItem(workInfo.value).then(res => {
|
|
saveDayWorkItem(workInfo.value).then(res => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
icon: 'success',
|
|
icon: 'success',
|
|
title: '操作成功',
|
|
title: '操作成功',
|
|
- duration: 2000
|
|
|
|
|
|
+ duration: 1000
|
|
});
|
|
});
|
|
uni.$emit('dayworkItemUpdate');
|
|
uni.$emit('dayworkItemUpdate');
|
|
baseDialog.value.close();
|
|
baseDialog.value.close();
|
|
@@ -106,7 +137,7 @@
|
|
uni.showToast({
|
|
uni.showToast({
|
|
icon: 'error',
|
|
icon: 'error',
|
|
title: '操作失败',
|
|
title: '操作失败',
|
|
- duration: 2000
|
|
|
|
|
|
+ duration: 1000
|
|
});
|
|
});
|
|
}
|
|
}
|
|
})
|
|
})
|