|
|
@@ -0,0 +1,361 @@
|
|
|
+<template>
|
|
|
+ <div class="linkage-plan-container">
|
|
|
+ <!-- 搜索区域 -->
|
|
|
+ <el-card class="search-card" shadow="never">
|
|
|
+ <el-form :inline="true" :model="searchForm" class="search-form">
|
|
|
+ <el-form-item label="订单编号">
|
|
|
+ <el-input
|
|
|
+ v-model="searchForm.billNo"
|
|
|
+ placeholder="请输入订单编号"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleSearch"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="客户编码">
|
|
|
+ <el-input
|
|
|
+ v-model="searchForm.customNo"
|
|
|
+ placeholder="请输入客户编码"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleSearch"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="订单类型">
|
|
|
+ <el-select v-model="searchForm.orderType" placeholder="请选择订单类型" clearable>
|
|
|
+ <el-option label="计划" value="计划" />
|
|
|
+ <el-option label="销售" value="销售" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="物料代码">
|
|
|
+ <el-input
|
|
|
+ v-model="searchForm.itemNumber"
|
|
|
+ placeholder="请输入物料代码"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleSearch"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" :icon="Search" @click="handleSearch">查询</el-button>
|
|
|
+ <el-button :icon="Refresh" @click="handleReset">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-card>
|
|
|
+
|
|
|
+ <!-- 表格区域 -->
|
|
|
+ <el-card class="table-card" shadow="never">
|
|
|
+ <!-- 表格 -->
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="tableData"
|
|
|
+ border
|
|
|
+ stripe
|
|
|
+ :cell-style="getCellStyle"
|
|
|
+ height="calc(100vh - 280px)"
|
|
|
+ >
|
|
|
+ <el-table-column prop="billNo" label="订单编号" width="180" fixed="left" />
|
|
|
+ <el-table-column prop="customNo" label="客户编码" width="120" />
|
|
|
+ <el-table-column prop="orderType" label="类型" width="80" />
|
|
|
+ <el-table-column prop="itemNumber" label="物料代码" width="150" />
|
|
|
+ <el-table-column prop="descr" label="物料名称" width="200" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="descr1" label="规格型号" width="150" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="itemType" label="产品类型" width="120" />
|
|
|
+ <el-table-column prop="qty" label="数量" width="80" align="right" />
|
|
|
+ <el-table-column prop="updateTime" label="生产通知" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.updateTime, row.type, 'updateTime') }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="sysCapacityDate" label="合同交期" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.sysCapacityDate, row.type, 'sysCapacityDate') }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="type" label="计划管控" width="100">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-tag v-if="row.type" :type="getTypeTag(row.type)">{{ row.type }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="bomstart" label="Bom设计开始" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.bomstart, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="bomend" label="Bom设计结束" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.bomend, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="linestart" label="工艺设计开始" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.linestart, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="lineend" label="工艺设计结束" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.lineend, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="productstart" label="生产开始" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.productstart, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="productend" label="生产结束" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.productend, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="needtime" label="物料需求" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.needtime, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="sysMaterialDate" label="物料满足" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.sysMaterialDate, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="cgneedtime" label="采购下单" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.cgneedtime, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="cgend" label="采购到货" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.cgend, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="blstart" label="备料开始" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.blstart, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="blend" label="备料结束" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.blend, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="starttime" label="报工开始" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.starttime, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="endtime" label="报工结束" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.endtime, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="ipqcjystart" label="IQC检验开始" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.ipqcjystart, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="ipqcjyend" label="IQC检验结束" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.ipqcjyend, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="fqcjystart" label="FQC检验开始" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.fqcjystart, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="fqcjyend" label="FQC检验结束" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.fqcjyend, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="rkstart" label="入库开始" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.rkstart, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="rkend" label="入库结束" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.rkend, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="fystarttime" label="发运开始" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.fystarttime, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="fyendtime" label="发运结束" width="110">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ formatDate(row.fyendtime, row.type) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="120" fixed="right">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button type="primary" link @click="handleTrack(row)">交付跟踪</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <!-- 分页 -->
|
|
|
+ <el-pagination
|
|
|
+ v-model:current-page="pagination.page"
|
|
|
+ v-model:page-size="pagination.pageSize"
|
|
|
+ :page-sizes="[20, 50, 100, 200]"
|
|
|
+ :total="pagination.total"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ class="pagination"
|
|
|
+ @size-change="handleSearch"
|
|
|
+ @current-change="handleSearch"
|
|
|
+ />
|
|
|
+ </el-card>
|
|
|
+
|
|
|
+ <!-- 销售订单表单(查看模式) -->
|
|
|
+ <SalesOrderForm ref="orderFormRef" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import { ref, reactive, onMounted } from 'vue'
|
|
|
+import { Search, Refresh } from '@element-plus/icons-vue'
|
|
|
+import { getLinkagePlanList, type LinkagePlanPageReqVO } from '@/api/jiaohuo/linkagePlan'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import SalesOrderForm from './components/SalesOrderForm.vue'
|
|
|
+
|
|
|
+const loading = ref(false)
|
|
|
+const tableData = ref([])
|
|
|
+const isInitialLoad = ref(true)
|
|
|
+
|
|
|
+const searchForm = reactive({
|
|
|
+ billNo: '',
|
|
|
+ customNo: '',
|
|
|
+ orderType: '',
|
|
|
+ itemNumber: ''
|
|
|
+})
|
|
|
+
|
|
|
+const pagination = reactive({
|
|
|
+ page: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ total: 0
|
|
|
+})
|
|
|
+
|
|
|
+const orderFormRef = ref(null)
|
|
|
+
|
|
|
+// 格式化日期或天数
|
|
|
+const formatDate = (date: string | undefined, type: string, fieldName?: string) => {
|
|
|
+ if (!date) return ''
|
|
|
+
|
|
|
+ // 生产通知和合同交期在偏差类型时不显示天数,只显示日期
|
|
|
+ const isDateOnlyField = fieldName === 'updateTime' || fieldName === 'sysCapacityDate'
|
|
|
+
|
|
|
+ // 如果是偏差类型且不是日期专用字段,显示天数
|
|
|
+ if (type === '偏差' && !isDateOnlyField) {
|
|
|
+ const days = parseInt(date)
|
|
|
+ if (isNaN(days)) return date
|
|
|
+ return days > 0 ? `+${days}天` : days < 0 ? `${days}天` : '0天'
|
|
|
+ }
|
|
|
+
|
|
|
+ // 否则格式化为日期
|
|
|
+ if (date.length >= 10) {
|
|
|
+ return date.substring(0, 10)
|
|
|
+ }
|
|
|
+ return date
|
|
|
+}
|
|
|
+
|
|
|
+// 获取类型标签
|
|
|
+const getTypeTag = (type: string) => {
|
|
|
+ const typeMap = {
|
|
|
+ '计划': 'info',
|
|
|
+ '实际': 'success',
|
|
|
+ '偏差': 'warning'
|
|
|
+ }
|
|
|
+ return typeMap[type] || 'info'
|
|
|
+}
|
|
|
+
|
|
|
+// 获取单元格样式
|
|
|
+const getCellStyle = ({ row, column }: { row: any; column: any }) => {
|
|
|
+ if (!row.background) return {}
|
|
|
+
|
|
|
+ const backgroundStr = row.background
|
|
|
+ const columnProp = column.property
|
|
|
+
|
|
|
+ // 解析background字符串,格式如:bomstart:red;bomend:yellow;
|
|
|
+ const styles = backgroundStr.split(';').filter((s: string) => s.trim())
|
|
|
+ for (const style of styles) {
|
|
|
+ const [field, color] = style.split(':')
|
|
|
+ if (field === columnProp) {
|
|
|
+ return {
|
|
|
+ backgroundColor: color === 'red' ? '#fef0f0' : color === 'yellow' ? '#fdf6ec' : ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return {}
|
|
|
+}
|
|
|
+
|
|
|
+// 查询
|
|
|
+const handleSearch = async () => {
|
|
|
+ loading.value = true
|
|
|
+ try {
|
|
|
+ const params: LinkagePlanPageReqVO = {
|
|
|
+ billNo: searchForm.billNo || undefined,
|
|
|
+ customNo: searchForm.customNo || undefined,
|
|
|
+ orderType: searchForm.orderType || undefined,
|
|
|
+ itemNumber: searchForm.itemNumber || undefined,
|
|
|
+ pageNo: pagination.page,
|
|
|
+ pageSize: pagination.pageSize,
|
|
|
+ initialLoad: isInitialLoad.value
|
|
|
+ }
|
|
|
+
|
|
|
+ const res = await getLinkagePlanList(params)
|
|
|
+ tableData.value = res?.list || []
|
|
|
+ pagination.total = res?.total || 0
|
|
|
+
|
|
|
+ // 首次加载后设置为false
|
|
|
+ if (isInitialLoad.value) {
|
|
|
+ isInitialLoad.value = false
|
|
|
+ }
|
|
|
+ } catch (error: any) {
|
|
|
+ console.error('查询失败:', error)
|
|
|
+ ElMessage.error('查询失败:' + (error.message || '未知错误'))
|
|
|
+ tableData.value = []
|
|
|
+ pagination.total = 0
|
|
|
+ } finally {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 重置
|
|
|
+const handleReset = () => {
|
|
|
+ searchForm.billNo = ''
|
|
|
+ searchForm.customNo = ''
|
|
|
+ searchForm.orderType = ''
|
|
|
+ searchForm.itemNumber = ''
|
|
|
+ pagination.page = 1
|
|
|
+ isInitialLoad.value = true // 重置时重新执行存储过程
|
|
|
+ handleSearch()
|
|
|
+}
|
|
|
+
|
|
|
+// 交付跟踪 - 打开销售订单表单(只读模式)
|
|
|
+const handleTrack = (row: any) => {
|
|
|
+ if (orderFormRef.value) {
|
|
|
+ orderFormRef.value.open('view', row.id)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 初始化
|
|
|
+onMounted(() => {
|
|
|
+ handleSearch()
|
|
|
+})
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.linkage-plan-container {
|
|
|
+ padding: 16px;
|
|
|
+
|
|
|
+ .search-card {
|
|
|
+ margin-bottom: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .table-card {
|
|
|
+ .pagination {
|
|
|
+ margin-top: 16px;
|
|
|
+ justify-content: flex-end;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|