|
|
<template>
|
|
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1000px">
|
|
|
<!-- 列表 -->
|
|
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
|
|
<el-table-column :label="t('ProductionPlan.Task.itemNeedTableItemNameColumn')" align="center" prop="itemName" />
|
|
|
<el-table-column :label="t('ProductionPlan.Task.itemNeedTableUnitNameColumn')" align="center" prop="unitName" />
|
|
|
<el-table-column :label="t('ProductionPlan.Task.itemNeedTableNumberColumn')" align="center" prop="number" />
|
|
|
<el-table-column :label="t('ProductionPlan.Task.itemNeedTableStockNumberColumn')" align="center" prop="stockNumber" />
|
|
|
<!-- <el-table-column label="车间仓库存" align="center" prop="stockWorkshopNumber" /> -->
|
|
|
</el-table>
|
|
|
<template #footer>
|
|
|
<!-- <el-button @click="openForm" type="primary" :disabled="loading">申 购</el-button> -->
|
|
|
<el-button @click="dialogVisible = false">{{ t('ProductionPlan.Task.itemNeedDialogCloseButtonText') }}</el-button>
|
|
|
</template>
|
|
|
</Dialog>
|
|
|
<!-- 表单弹窗:添加/修改 -->
|
|
|
<PurchaseOrderForm ref="formRef" @success="jumpToPurchase"/>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
|
|
|
import {TaskApi} from "@/api/mes/task";
|
|
|
import PurchaseOrderForm from "@/views/erp/purchase/order/PurchaseOrderForm.vue";
|
|
|
|
|
|
const props = defineProps<{
|
|
|
orderId?: number
|
|
|
taskId?: number
|
|
|
planId?: number
|
|
|
productId?: number
|
|
|
number?: number
|
|
|
}>()
|
|
|
const loading = ref(false) // 列表的加载中
|
|
|
const list = ref([]) // 列表的数据
|
|
|
|
|
|
const { push } = useRouter()
|
|
|
/**表单 */
|
|
|
defineOptions({ name: 'ItemNeedIndex' })
|
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
|
|
|
|
/** 打开弹窗 */
|
|
|
const open = async (type: string, title: string, id: number, number?:number) => {
|
|
|
dialogVisible.value = true
|
|
|
dialogTitle.value = t('ProductionPlan.Task.itemNeedDialogTitlePrefix') + title
|
|
|
loading.value = true
|
|
|
try {
|
|
|
if (type === 'order') {
|
|
|
list.value = await TaskApi.getOderItemNeedList(id)
|
|
|
}
|
|
|
else if (type === 'task') {
|
|
|
list.value = await TaskApi.getTaskItemNeedList(id)
|
|
|
}
|
|
|
else if (type === 'plan') {
|
|
|
list.value = await TaskApi.getPlanItemNeedList(id)
|
|
|
}
|
|
|
else if (type === 'product') {
|
|
|
list.value = await TaskApi.getProductItemNeedList(id, number)
|
|
|
}
|
|
|
else message.error(t('ProductionPlan.Task.itemNeedDialogUnknownTypeMessage'))
|
|
|
} finally {
|
|
|
loading.value = false
|
|
|
}
|
|
|
}
|
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
|
|
|
|
/** 提交表单 */
|
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
|
const submitForm = async () => {
|
|
|
|
|
|
}
|
|
|
/** 添加/修改操作 */
|
|
|
const formRef = ref()
|
|
|
const openForm = () => {
|
|
|
formRef.value.open('create',null , list.value)
|
|
|
}
|
|
|
/**
|
|
|
* 申购成功则转跳采购页面**/
|
|
|
const jumpToPurchase = () =>{
|
|
|
push('/erp/purchase/order')
|
|
|
}
|
|
|
</script>
|