151 lines
4.8 KiB
Vue
Raw Normal View History

2025-03-21 09:20:29 +08:00
<template>
2025-03-27 23:36:30 +08:00
<el-dialog :model-value="props.showes" width="70%">
<avue-crud
ref="crudRef"
:data="props.listData"
:option="state.option"
>
<template #nowSendQty="{row}">
<div style="display: flex;align-items: center;justify-content: center">
<el-input-number v-model="row.nowSendQty" :min="1"/>
</div>
</template>
<template #chengNuoJiaoQi="{row}">
<div style="display: flex;align-items: center;justify-content: center">
<el-date-picker v-model="row.chengNuoJiaoQi" type="date" size="large" style="width: 100%" format="YYYY/MM/DD"
value-format="YYYY-MM-DD" @change="chengNuoJiaoQiChange(row)"/>
</div>
</template>
<template #newChengNuoJiaoQi="{row}">
<div style="display: flex;align-items: center;justify-content: center">
<el-date-picker v-model="row.newChengNuoJiaoQi" type="date" size="large" style="width: 100%" format="YYYY/MM/DD"
value-format="YYYY-MM-DD" @change="newChengNuoJiaoQiChange(row)"/>
</div>
</template>
</avue-crud>
<div class="btnList">
<el-button type="primary" @click="batchAddInvoiceOrderFun">生成通知单</el-button>
</div>
</el-dialog>
2025-03-21 09:20:29 +08:00
</template>
<script setup lang="ts">
2025-03-27 23:36:30 +08:00
import { defineProps, reactive, defineEmits, computed } from 'vue';
import { listApi } from '../../api/list/index'
const emits = defineEmits(['generateDocuments']);
2025-03-24 16:46:34 +08:00
import { useI18n } from 'vue-i18n';
2025-03-27 23:36:30 +08:00
import {ElMessage} from "element-plus";
const { t } = useI18n();
2025-03-21 09:20:29 +08:00
const props = defineProps({
2025-03-27 23:36:30 +08:00
listData: {
type: Array,
default: () => [],
},
showes: {
type: Boolean,
default: false,
},
2025-03-21 09:20:29 +08:00
});
2025-03-27 23:36:30 +08:00
2025-03-21 09:20:29 +08:00
const state = reactive({
2025-03-27 23:36:30 +08:00
dialogVisible: true,
data: [],
show:true,
formData: {},
option: {
tip: false,
selection: false,
index: true,
menu: false,
menuWidth: 150,
border: true,
delBtn: false,
editBtn: false,
align: 'center',
searchLabelWidth: 140,
searchMenuSpan: 6,
addBtn: false,
column: [
{ label: computed(() => t('message.list.MaterialCode')), prop: 'materialCode', width: 200 },
{ label: computed(() => t('message.list.MaterialName')), prop: 'materialName', width: 200 },
{ label: computed(() => t('message.list.Specification')), prop: 'specificationModel', width: 200 },
{ label: computed(() => t('message.list.PurchaseUnit')), prop: 'FUnitId', width: 200 },
{ label: '采购数量', prop: 'qty', width: 200 },
{ label: '处理中数量', prop: 'processingQty', width: 200 },
{ label: '已发货数量', prop: 'sendedQty', width: 200 },
{ label: '未发货数量', prop: 'notSendQty', width: 200 },
{ label: '本次发货数量', prop: 'nowSendQty', width: 200,fixed:true },
{ label: computed(() => t('message.list.UP')), prop: 'amount1', width: 200 },
{ label: computed(() => t('message.list.TotalAmount')), prop: 'amount2', width: 200 },
{ label: computed(() => t('message.list.AccumulatedReceiptQTY')), prop: 'FReceiveQty', width: 200 },
{ label: computed(() => t('message.list.TaxAmount')), prop: 'taxAmount', width: 200 },
{ label: computed(() => t('message.list.CommittedDeliveryDate')), prop: 'chengNuoJiaoQi',
width: 200, type: 'datetime', searchSpan: 12, searchRange: true, searchLabelWidth: 150,fixed:true },
{
label: computed(() => t('message.list.LatestCommittedDeliveryDate')),
prop: 'newChengNuoJiaoQi',
width: 200,
type: 'datetime',
searchSpan: 12,
searchRange: true,
searchLabelWidth: 150,
fixed:true
},
{ label: computed(() => t('message.list.Comments2')), prop: 'remark', width: 200 },
],
},
topId: '',
2025-03-21 09:20:29 +08:00
});
2025-03-27 23:36:30 +08:00
const chengNuoJiaoQiChange = (item:any) => {
listApi().batchSetChengNuoJiaoQi([{
id:item.id,
newTime:item.chengNuoJiaoQi
}]).then((res:any) => {
if(res.resultCode === 0){
ElMessage.success('操作成功');
}
if(res.resultCode === -1){
ElMessage.success(res.errorMessage);
}
})
}
const newChengNuoJiaoQiChange = (item:any) => {
listApi().batchSetNewChengNuoJiaoQi([{
id:item.id,
newTime:item.newChengNuoJiaoQi
}]).then((res:any) => {
if(res.resultCode === 0){
ElMessage.success('操作成功');
}
if(res.resultCode === -1){
ElMessage.success(res.errorMessage);
}
})
}
const batchAddInvoiceOrderFun = () => {
console.log(props.listData)
let arr:any = []
props.listData.forEach((item:any) => {
arr.push({
id:item.id,
qty:item.nowSendQty
})
})
listApi().batchAddInvoiceOrder(arr).then((res:any) => {
if(res.resultCode === 0){
ElMessage.success('操作成功');
emits('generateDocuments')
}
if(res.resultCode === -1){
ElMessage.success(res.errorMessage);
}
})
}
2025-03-21 09:20:29 +08:00
</script>
<style scoped lang="scss">
2025-03-27 23:36:30 +08:00
.btnList {
margin-top: 26px;
display: flex;
justify-content: center;
2025-03-21 09:20:29 +08:00
}
2025-03-27 23:36:30 +08:00
</style>