Compare commits
5 Commits
8c5a9534c9
...
1382a19d3d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1382a19d3d | ||
|
|
b70f6b1fac | ||
|
|
ab120a1256 | ||
|
|
01ff77f49f | ||
|
|
051a1bec6a |
@ -20,6 +20,9 @@ importers:
|
|||||||
axios:
|
axios:
|
||||||
specifier: ^1.6.5
|
specifier: ^1.6.5
|
||||||
version: 1.14.0
|
version: 1.14.0
|
||||||
|
dhtmlx-gantt:
|
||||||
|
specifier: ^9.1.4
|
||||||
|
version: 9.1.4
|
||||||
disable-devtool:
|
disable-devtool:
|
||||||
specifier: ^0.3.9
|
specifier: ^0.3.9
|
||||||
version: 0.3.9
|
version: 0.3.9
|
||||||
@ -615,6 +618,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
|
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
|
dhtmlx-gantt@9.1.4:
|
||||||
|
resolution: {integrity: sha512-XCNA5QUiuV79Xq1ykNpH9LFNR2IVpDZMqnmBV6dsBeOkHyPMOpkyQ/gqAPCcK2GAvYHoN2nGAMYb2LldCWhMuQ==}
|
||||||
|
|
||||||
disable-devtool@0.3.9:
|
disable-devtool@0.3.9:
|
||||||
resolution: {integrity: sha512-WHCpC8f93Cn2DnTeaq57NFLcdw4921sovh1ammnp/2o8Snb704HK/Vw1/D2D1Pihc0zc8/mVKb5nchHtoadObQ==}
|
resolution: {integrity: sha512-WHCpC8f93Cn2DnTeaq57NFLcdw4921sovh1ammnp/2o8Snb704HK/Vw1/D2D1Pihc0zc8/mVKb5nchHtoadObQ==}
|
||||||
|
|
||||||
@ -1330,6 +1336,8 @@ snapshots:
|
|||||||
detect-libc@2.1.2:
|
detect-libc@2.1.2:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
dhtmlx-gantt@9.1.4: {}
|
||||||
|
|
||||||
disable-devtool@0.3.9: {}
|
disable-devtool@0.3.9: {}
|
||||||
|
|
||||||
dunder-proto@1.0.1:
|
dunder-proto@1.0.1:
|
||||||
|
|||||||
@ -116,6 +116,19 @@ const routes: RouteRecordRaw[] = [
|
|||||||
component: () => import('@/views/org/post/index.vue'),
|
component: () => import('@/views/org/post/index.vue'),
|
||||||
meta: { title: '岗位管理', icon: 'IdCardOutline' }
|
meta: { title: '岗位管理', icon: 'IdCardOutline' }
|
||||||
},
|
},
|
||||||
|
// 项目管理
|
||||||
|
{
|
||||||
|
path: 'biz/orderProject',
|
||||||
|
name: 'OrderProject',
|
||||||
|
component: () => import('@/views/biz/orderProject/index.vue'),
|
||||||
|
meta: { title: '项目管理', icon: 'PersonOutline' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'biz/orderProject/gantt',
|
||||||
|
name: 'OrderProjectGantt',
|
||||||
|
component: () => import('@/views/biz/orderProject/components/GanttSchedule.vue'),
|
||||||
|
meta: { title: '甘特图排产', icon: 'CalendarOutline', activeMenu: '/biz/orderProject' }
|
||||||
|
},
|
||||||
//运营管理
|
//运营管理
|
||||||
{
|
{
|
||||||
path: 'biz/orderItem',
|
path: 'biz/orderItem',
|
||||||
@ -129,12 +142,6 @@ const routes: RouteRecordRaw[] = [
|
|||||||
component: () => import('@/views/biz/orderProcessPlan/index.vue'),
|
component: () => import('@/views/biz/orderProcessPlan/index.vue'),
|
||||||
meta: { title: '工序计划', icon: 'ListOutline' }
|
meta: { title: '工序计划', icon: 'ListOutline' }
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: 'biz/orderProcessPlan/board',
|
|
||||||
name: 'orderProcessPlanBoard',
|
|
||||||
component: () => import('@/views/biz/orderProcessPlan/board.vue'),
|
|
||||||
meta: { title: '工序计划看板', icon: 'GridOutline' }
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: 'biz/user',
|
path: 'biz/user',
|
||||||
name: 'user',
|
name: 'user',
|
||||||
@ -233,18 +240,6 @@ const routes: RouteRecordRaw[] = [
|
|||||||
component: () => import('@/views/biz/submitLog/index.vue'),
|
component: () => import('@/views/biz/submitLog/index.vue'),
|
||||||
meta: { title: '派工工单汇报记录', icon: 'ListOutline' }
|
meta: { title: '派工工单汇报记录', icon: 'ListOutline' }
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: 'biz/processRoute',
|
|
||||||
name: 'processRoute',
|
|
||||||
component: () => import('@/views/biz/processRoute/index.vue'),
|
|
||||||
meta: { title: '工艺路线主表', icon: 'ListOutline' }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'biz/processRouteStep',
|
|
||||||
name: 'processRouteStep',
|
|
||||||
component: () => import('@/views/biz/processRouteStep/index.vue'),
|
|
||||||
meta: { title: '工艺路线工序明细', icon: 'ListOutline' }
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
// 开发工具
|
// 开发工具
|
||||||
path: 'tool/gen',
|
path: 'tool/gen',
|
||||||
|
|||||||
@ -66,7 +66,10 @@
|
|||||||
@update:checked-row-keys="handleCheck"
|
@update:checked-row-keys="handleCheck"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
-->
|
-->
|
||||||
|
<!--flex-height-->
|
||||||
<n-data-table
|
<n-data-table
|
||||||
|
ref="tableRef"
|
||||||
|
id="my-table"
|
||||||
size="small"
|
size="small"
|
||||||
remote
|
remote
|
||||||
striped
|
striped
|
||||||
@ -75,6 +78,10 @@
|
|||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
|
virtual-scroll
|
||||||
|
:virtual-scroll-x="true"
|
||||||
|
:scroll-x="scrollX"
|
||||||
|
:max-height="580"
|
||||||
/>
|
/>
|
||||||
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
<n-pagination
|
<n-pagination
|
||||||
@ -129,7 +136,6 @@
|
|||||||
clearable
|
clearable
|
||||||
remote
|
remote
|
||||||
:clear-filter-after-select="false"
|
:clear-filter-after-select="false"
|
||||||
|
|
||||||
@update:value="xmselupdate"
|
@update:value="xmselupdate"
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
@ -219,8 +225,20 @@
|
|||||||
</n-form-item>
|
</n-form-item>
|
||||||
</n-gi>
|
</n-gi>
|
||||||
<n-gi>
|
<n-gi>
|
||||||
<n-form-item label="派工接收人" path="assingWorkId">
|
<n-form-item label="派工接收人" path="assingWorkList">
|
||||||
<n-input v-model:value="formData.assingWorkId" placeholder="请输入派工接收人" />
|
<!-- <n-input v-model:value="formData.assingWorkId" placeholder="请选择派工接收人" /> -->
|
||||||
|
<n-select
|
||||||
|
multiple
|
||||||
|
filterable
|
||||||
|
v-model:value="formData.assingWorkList"
|
||||||
|
placeholder="请输入用户名称搜索"
|
||||||
|
:options="yglist"
|
||||||
|
:loading="loadingRef"
|
||||||
|
clearable
|
||||||
|
remote
|
||||||
|
:clear-filter-after-select="false"
|
||||||
|
@search="slehand"
|
||||||
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</n-gi>
|
</n-gi>
|
||||||
</n-grid>
|
</n-grid>
|
||||||
@ -308,17 +326,16 @@
|
|||||||
<n-form-item label="工单名称">
|
<n-form-item label="工单名称">
|
||||||
<n-input v-model:value="dispatchform.name" disabled />
|
<n-input v-model:value="dispatchform.name" disabled />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item label="指派员工" path="userid">
|
<n-form-item label="指派员工" path="assingWorkList">
|
||||||
<!-- <n-select
|
<!-- <n-select
|
||||||
v-model:value="dispatchform.userid"
|
v-model:value="dispatchform.userid"
|
||||||
:options="yglist"
|
:options="yglist"
|
||||||
clearable
|
clearable
|
||||||
placeholder="请选择员工"
|
placeholder="请选择员工"
|
||||||
/> -->
|
/> -->
|
||||||
|
<!--v-model:value="dispatchform.assingWorkList"-->
|
||||||
<n-select
|
<n-select
|
||||||
v-model:value="dispatchform.userid"
|
multiple
|
||||||
|
|
||||||
filterable
|
filterable
|
||||||
placeholder="请输入用户名称搜索"
|
placeholder="请输入用户名称搜索"
|
||||||
:options="yglist"
|
:options="yglist"
|
||||||
@ -327,6 +344,7 @@
|
|||||||
remote
|
remote
|
||||||
:clear-filter-after-select="false"
|
:clear-filter-after-select="false"
|
||||||
@search="slehand"
|
@search="slehand"
|
||||||
|
@update:value="updatesle"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- <n-input v-model:value="dispatchform.userid" placeholder="请选择员工" /> -->
|
<!-- <n-input v-model:value="dispatchform.userid" placeholder="请选择员工" /> -->
|
||||||
@ -435,14 +453,15 @@ const defaultFormData = {
|
|||||||
projectId: '',
|
projectId: '',
|
||||||
projectName:'',
|
projectName:'',
|
||||||
parentId: '',
|
parentId: '',
|
||||||
sfProduct: '',
|
sfProduct: 0,
|
||||||
procurement: '',
|
procurement: 0,
|
||||||
beginTime: null,
|
beginTime: null,
|
||||||
endTime: null,
|
endTime: null,
|
||||||
actualStartTime: null,
|
actualStartTime: null,
|
||||||
actualEndTime: null,
|
actualEndTime: null,
|
||||||
assingWorkId: '',
|
assingWorkId: '',
|
||||||
assingWorkTime: null,
|
assingWorkList:[],
|
||||||
|
assingWorkTime: null,
|
||||||
assingWorkOperationId: '',
|
assingWorkOperationId: '',
|
||||||
assingWorkOperationTime: null,
|
assingWorkOperationTime: null,
|
||||||
starter: '',
|
starter: '',
|
||||||
@ -465,13 +484,16 @@ const columns = [
|
|||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
align:'center',
|
align:'center',
|
||||||
minWidth: 150,
|
minWidth: 260,
|
||||||
title: '产品名称',
|
title: '产品名称',
|
||||||
key: 'projectName'
|
key: 'projectName',
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align:'center',
|
align:'center',
|
||||||
minWidth: 150,
|
minWidth: 200,
|
||||||
title: '物料名称',
|
title: '物料名称',
|
||||||
key: 'name'
|
key: 'name'
|
||||||
},
|
},
|
||||||
@ -579,9 +601,9 @@ const columns = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
align:'center',
|
align:'center',
|
||||||
minWidth: 150,
|
|
||||||
title: '备注',
|
title: '备注',
|
||||||
key: 'remark'
|
key: 'remark',
|
||||||
|
minWidth:200
|
||||||
},
|
},
|
||||||
// { title: '创建时间', key: 'createTime', width: 100 },
|
// { title: '创建时间', key: 'createTime', width: 100 },
|
||||||
// { title: '创建人', key: 'createBy' },
|
// { title: '创建人', key: 'createBy' },
|
||||||
@ -638,6 +660,19 @@ const columns = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
//根据内容设置表格滚动条
|
||||||
|
let scrollX = ref(0)
|
||||||
|
|
||||||
|
function updateScrollX() {
|
||||||
|
const tableElement = document.querySelector('#my-table .n-data-table-table')
|
||||||
|
if (tableElement) {
|
||||||
|
// 使用 scrollWidth 可以获取表格内容的总宽度,确保滚动条出现
|
||||||
|
scrollX.value = tableElement.scrollWidth
|
||||||
|
} else {
|
||||||
|
scrollX.value = 2000;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@ -859,6 +894,17 @@ function handleEdit(row: OrderItem) {
|
|||||||
modalVisible.value = true
|
modalVisible.value = true
|
||||||
planList.value.splice(0)
|
planList.value.splice(0)
|
||||||
Object.assign(formData, row)
|
Object.assign(formData, row)
|
||||||
|
if(formData.sfProduct == null){
|
||||||
|
formData.sfProduct = 0
|
||||||
|
}
|
||||||
|
if(formData.procurement == null){
|
||||||
|
formData.procurement = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if(formData.assingWorkId){
|
||||||
|
formData.assingWorkList = formData.assingWorkId.split(',')
|
||||||
|
}
|
||||||
|
|
||||||
if (formData.beginTime && typeof formData.beginTime === 'string') {
|
if (formData.beginTime && typeof formData.beginTime === 'string') {
|
||||||
formData.beginTime = new Date(formData.beginTime.replace(' ', 'T')).getTime()
|
formData.beginTime = new Date(formData.beginTime.replace(' ', 'T')).getTime()
|
||||||
}
|
}
|
||||||
@ -880,7 +926,9 @@ function handleEdit(row: OrderItem) {
|
|||||||
if (formData.assingWorkOperationTime && typeof formData.assingWorkOperationTime === 'string') {
|
if (formData.assingWorkOperationTime && typeof formData.assingWorkOperationTime === 'string') {
|
||||||
formData.assingWorkOperationTime = new Date(formData.assingWorkOperationTime.replace(' ', 'T')).getTime()
|
formData.assingWorkOperationTime = new Date(formData.assingWorkOperationTime.replace(' ', 'T')).getTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slehand()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
@ -939,15 +987,22 @@ let dispatchmodal = ref(false)
|
|||||||
let dispatchform = reactive<any>({
|
let dispatchform = reactive<any>({
|
||||||
id:'',
|
id:'',
|
||||||
name:'',
|
name:'',
|
||||||
userid:'',
|
//userid:'',
|
||||||
username:''
|
username:'',
|
||||||
|
assingWorkList:''
|
||||||
})
|
})
|
||||||
|
|
||||||
let yglist = ref<any>([])
|
let yglist = ref<any>([])
|
||||||
|
|
||||||
const dispatchrules = {
|
const dispatchrules = {
|
||||||
userid:[{ required: true, message: '请选择员工', trigger: 'blur' }]
|
assingWorkList:[{ required: true, message: '请选择员工', trigger: 'blur' }]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updatesle(v:any) {
|
||||||
|
dispatchform.assingWorkList = v.join()
|
||||||
|
console.log(v)
|
||||||
|
}
|
||||||
|
|
||||||
let dispatchLoading = ref(false)
|
let dispatchLoading = ref(false)
|
||||||
let dispatchddbtn = ref(false)
|
let dispatchddbtn = ref(false)
|
||||||
|
|
||||||
@ -959,7 +1014,7 @@ function slehand(v?:any) {
|
|||||||
loadingRef.value = true
|
loadingRef.value = true
|
||||||
userApi.page({
|
userApi.page({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 100,
|
pageSize: 200,
|
||||||
username: v,
|
username: v,
|
||||||
}).then((rps:any) =>{
|
}).then((rps:any) =>{
|
||||||
if(rps.list && rps.list.length > 0){
|
if(rps.list && rps.list.length > 0){
|
||||||
@ -982,12 +1037,13 @@ function disphand(v:any){
|
|||||||
dispatchformRef.value?.restoreValidation()
|
dispatchformRef.value?.restoreValidation()
|
||||||
dispatchform.id = v.id
|
dispatchform.id = v.id
|
||||||
dispatchform.name = v.name
|
dispatchform.name = v.name
|
||||||
dispatchform.userid = ''
|
//dispatchform.userid = ''
|
||||||
|
dispatchform.assingWorkList = ''
|
||||||
slehand()
|
slehand()
|
||||||
}
|
}
|
||||||
|
|
||||||
function dispatchSubmit() {
|
function dispatchSubmit() {
|
||||||
console.log(dispatchform.userid,'dispatchform.userid')
|
|
||||||
dispatchformRef.value?.validate((v:any) => {
|
dispatchformRef.value?.validate((v:any) => {
|
||||||
if(!v){
|
if(!v){
|
||||||
// dispatchLoading.value = true
|
// dispatchLoading.value = true
|
||||||
@ -1000,7 +1056,7 @@ function dispatchSubmit() {
|
|||||||
// dispatchddbtn.value = false
|
// dispatchddbtn.value = false
|
||||||
// loadData()
|
// loadData()
|
||||||
// },1000)
|
// },1000)
|
||||||
orderItemApi.assignWork(dispatchform).then(() => {
|
orderItemApi.assignWork(Object.assign({},dispatchform,{assingWorkList:dispatchform.assingWorkList.split(',')}) ).then(() => {
|
||||||
message.success('操作成功!')
|
message.success('操作成功!')
|
||||||
setTimeout(()=> {
|
setTimeout(()=> {
|
||||||
dispatchmodal.value = false
|
dispatchmodal.value = false
|
||||||
@ -1122,7 +1178,11 @@ async function loadDictOptions() {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadData()
|
loadData()
|
||||||
loadDictOptions()
|
loadDictOptions()
|
||||||
|
|
||||||
|
updateScrollX()
|
||||||
|
window.addEventListener('resize', updateScrollX)
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
686
src/views/biz/orderItem/index1.vue
Normal file
686
src/views/biz/orderItem/index1.vue
Normal file
@ -0,0 +1,686 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page-container">
|
||||||
|
<n-card>
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<div class="search-form">
|
||||||
|
<n-form inline :model="searchForm" label-placement="left">
|
||||||
|
<n-form-item label="物料编码">
|
||||||
|
<n-input v-model:value="searchForm.code" placeholder="请输入物料编码" clearable />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="产品id">
|
||||||
|
<n-input v-model:value="searchForm.projectId" placeholder="请输入产品id" clearable />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="开始时间">
|
||||||
|
<n-date-picker v-model:value="searchForm.beginTime" type="datetime" clearable />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="结束时间">
|
||||||
|
<n-date-picker v-model:value="searchForm.endTime" type="datetime" clearable />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item>
|
||||||
|
<n-space>
|
||||||
|
<n-button type="primary" @click="handleSearch">
|
||||||
|
<template #icon><n-icon><SearchOutline /></n-icon></template>
|
||||||
|
搜索
|
||||||
|
</n-button>
|
||||||
|
<n-button @click="handleReset">
|
||||||
|
<template #icon><n-icon><RefreshOutline /></n-icon></template>
|
||||||
|
重置
|
||||||
|
</n-button>
|
||||||
|
</n-space>
|
||||||
|
</n-form-item>
|
||||||
|
</n-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 工具栏 -->
|
||||||
|
<div class="table-toolbar">
|
||||||
|
<n-space>
|
||||||
|
<n-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleAdd"
|
||||||
|
>
|
||||||
|
<template #icon><n-icon><AddOutline /></n-icon></template>
|
||||||
|
新增/补单
|
||||||
|
</n-button>
|
||||||
|
<!-- <n-button @click="importModalVisible = true">
|
||||||
|
<template #icon><n-icon><CloudUploadOutline /></n-icon></template>
|
||||||
|
导入
|
||||||
|
</n-button>
|
||||||
|
<n-button @click="handleExport">
|
||||||
|
<template #icon><n-icon><DownloadOutline /></n-icon></template>
|
||||||
|
导出{{ selectedIds.length > 0 ? `(${selectedIds.length})` : '' }}
|
||||||
|
</n-button> -->
|
||||||
|
<!-- <n-button type="error" :disabled="selectedIds.length === 0" @click="handleBatchDelete">
|
||||||
|
<template #icon><n-icon><TrashOutline /></n-icon></template>
|
||||||
|
删除
|
||||||
|
</n-button> -->
|
||||||
|
</n-space>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 表格 -->
|
||||||
|
<!--:pagination="pagination"
|
||||||
|
@update:page="handlePageChange"
|
||||||
|
@update:page-size="handlePageSizeChange"
|
||||||
|
@update:checked-row-keys="handleCheck"
|
||||||
|
-->
|
||||||
|
<n-data-table
|
||||||
|
size="small"
|
||||||
|
remote
|
||||||
|
:bordere="false"
|
||||||
|
:single-line="false"
|
||||||
|
:columns="columns"
|
||||||
|
:data="tableData"
|
||||||
|
:loading="loading"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- <div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
|
<n-pagination
|
||||||
|
v-model:page="pagination.page"
|
||||||
|
v-model:page-size="pagination.pageSize"
|
||||||
|
:item-count="pagination.itemCount"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
show-size-picker
|
||||||
|
show-quick-jumper
|
||||||
|
@update:page="handlePageChange"
|
||||||
|
@update:page-size="handlePageSizeChange"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
共 {{ pagination.itemCount }} 条
|
||||||
|
</template>
|
||||||
|
</n-pagination>
|
||||||
|
</div> -->
|
||||||
|
</n-card>
|
||||||
|
|
||||||
|
<!-- 新增/编辑弹窗 -->
|
||||||
|
<n-modal v-model:show="modalVisible" preset="card" :title="modalTitle" style="width: 600px">
|
||||||
|
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="100px">
|
||||||
|
<n-form-item label="生产令号" path="productionCode">
|
||||||
|
<n-input v-model:value="formData.productionCode" placeholder="请输入生产令号" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="物料名称" path="name">
|
||||||
|
<n-input v-model:value="formData.name" placeholder="请输入物料名称" readonly />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="物料编码" path="code">
|
||||||
|
<n-input v-model:value="formData.code" placeholder="请输入物料编码" readonly />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="产品序列" path="sort">
|
||||||
|
<n-input v-model:value="formData.sort" placeholder="请输入产品序列" readonly />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="生产数量" path="quantity">
|
||||||
|
<n-input v-model:value="formData.quantity" placeholder="请输入生产数量" readonly />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="产品名称" path="projectName">
|
||||||
|
<n-input v-model:value="formData.projectName" placeholder="请输入产品名称" readonly />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="是否半成品" path="sfProduct">
|
||||||
|
<n-input v-model:value="formData.sfProduct" placeholder="请输入是否半成品, 1是 0不是" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="是否采购" path="procurement">
|
||||||
|
<n-input v-model:value="formData.procurement" placeholder="请输入是否采购, 1是 0不是" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="预计开始时间" path="beginTime">
|
||||||
|
<n-date-picker v-model:value="formData.beginTime" type="datetime" clearable style="width: 100%" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="预计结束时间" path="endTime">
|
||||||
|
<n-date-picker v-model:value="formData.endTime" type="datetime" clearable style="width: 100%" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="派工接收人" path="assingWorkId">
|
||||||
|
<n-input v-model:value="formData.assingWorkId" placeholder="请输入派工接收人" />
|
||||||
|
</n-form-item>
|
||||||
|
</n-form>
|
||||||
|
<template #footer>
|
||||||
|
<n-space justify="end">
|
||||||
|
<n-button @click="modalVisible = false">取消</n-button>
|
||||||
|
<n-button type="primary" @click="handleSubmit">确定</n-button>
|
||||||
|
</n-space>
|
||||||
|
</template>
|
||||||
|
</n-modal>
|
||||||
|
|
||||||
|
<!-- 导入弹窗 -->
|
||||||
|
<n-modal v-model:show="importModalVisible" preset="card" title="导入生产订单" style="width: 500px">
|
||||||
|
<n-space vertical>
|
||||||
|
<n-alert type="info">
|
||||||
|
<template #header>导入说明</template>
|
||||||
|
<ul style="margin: 0; padding-left: 16px; line-height: 1.8">
|
||||||
|
<li>请先下载导入模板,按模板格式填写数据</li>
|
||||||
|
<li>支持 .xlsx 或 .xls 格式</li>
|
||||||
|
</ul>
|
||||||
|
</n-alert>
|
||||||
|
<n-space>
|
||||||
|
<n-button type="primary" @click="handleDownloadTemplate">
|
||||||
|
<template #icon><n-icon><DownloadOutline /></n-icon></template>
|
||||||
|
下载模板
|
||||||
|
</n-button>
|
||||||
|
</n-space>
|
||||||
|
<n-upload :max="1" accept=".xlsx,.xls" :show-file-list="true" :custom-request="handleImportUpload">
|
||||||
|
<n-upload-dragger>
|
||||||
|
<div style="margin-bottom: 12px">
|
||||||
|
<n-icon size="48" :depth="3"><CloudUploadOutline /></n-icon>
|
||||||
|
</div>
|
||||||
|
<n-text style="font-size: 16px">点击或拖拽文件到此处上传</n-text>
|
||||||
|
<n-p depth="3" style="margin: 8px 0 0 0">支持 .xlsx 或 .xls 格式</n-p>
|
||||||
|
</n-upload-dragger>
|
||||||
|
</n-upload>
|
||||||
|
</n-space>
|
||||||
|
<template #footer>
|
||||||
|
<n-button @click="importModalVisible = false">关闭</n-button>
|
||||||
|
</template>
|
||||||
|
</n-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
reactive,
|
||||||
|
h,
|
||||||
|
onMounted
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
NButton,
|
||||||
|
NSpace,
|
||||||
|
NIcon,
|
||||||
|
NUpload,
|
||||||
|
useMessage,
|
||||||
|
useDialog,
|
||||||
|
type DataTableColumns,
|
||||||
|
type UploadCustomRequestOptions
|
||||||
|
} from 'naive-ui'
|
||||||
|
import {
|
||||||
|
SearchOutline,
|
||||||
|
RefreshOutline,
|
||||||
|
AddOutline,
|
||||||
|
CloudUploadOutline,
|
||||||
|
DownloadOutline
|
||||||
|
} from '@vicons/ionicons5'
|
||||||
|
import {
|
||||||
|
orderItemApi,
|
||||||
|
type OrderItem
|
||||||
|
} from '@/api/orderItem'
|
||||||
|
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
|
||||||
|
const message = useMessage()
|
||||||
|
const dialog = useDialog()
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
// 权限检查
|
||||||
|
const hasPermission = (permission: string) => userStore.hasPermission(permission)
|
||||||
|
|
||||||
|
// 搜索表单
|
||||||
|
const searchForm = reactive<any>({
|
||||||
|
code: '',
|
||||||
|
projectId: '',
|
||||||
|
beginTime: '',
|
||||||
|
endTime: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
// 表格数据
|
||||||
|
const tableData = ref<any>([])
|
||||||
|
const loading = ref(false)
|
||||||
|
const selectedIds = ref<any>([])
|
||||||
|
const pagination = reactive<any>({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
itemCount: 0,
|
||||||
|
showSizePicker: true,
|
||||||
|
pageSizes: [10, 20, 50]
|
||||||
|
})
|
||||||
|
|
||||||
|
// 弹窗
|
||||||
|
const modalVisible = ref(false)
|
||||||
|
const modalTitle = ref('')
|
||||||
|
const importModalVisible = ref(false)
|
||||||
|
const formRef = ref()
|
||||||
|
const defaultFormData = {
|
||||||
|
id: '',
|
||||||
|
productionCode:'',
|
||||||
|
name: '',
|
||||||
|
code: '',
|
||||||
|
sort: '',
|
||||||
|
quantity: '',
|
||||||
|
projectId: '',
|
||||||
|
projectName:'',
|
||||||
|
parentId: '',
|
||||||
|
sfProduct: '',
|
||||||
|
procurement: '',
|
||||||
|
beginTime: '',
|
||||||
|
endTime: '',
|
||||||
|
actualStartTime: '',
|
||||||
|
actualEndTime: '',
|
||||||
|
assingWorkId: '',
|
||||||
|
assingWorkTime: '',
|
||||||
|
assingWorkOperationId: '',
|
||||||
|
assingWorkOperationTime: '',
|
||||||
|
starter: ''
|
||||||
|
}
|
||||||
|
const formData = reactive<any>({ ...defaultFormData })
|
||||||
|
|
||||||
|
// 字典选项(下拉框/单选框/复选框关联字典时使用)
|
||||||
|
|
||||||
|
// 表单校验规则
|
||||||
|
const formRules = {
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表格列
|
||||||
|
const columns = [
|
||||||
|
{ type: 'selection' },
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '产品名称',
|
||||||
|
key: 'projectName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '物料名称',
|
||||||
|
key: 'name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '物料编码',
|
||||||
|
key: 'code'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '产品序列',
|
||||||
|
key: 'sort'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '生产数量',
|
||||||
|
key: 'quantity'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '是否半成品',
|
||||||
|
key: 'sfProduct'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '是否采购',
|
||||||
|
key: 'procurement'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '开始时间',
|
||||||
|
key: 'beginTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '结束时间',
|
||||||
|
key: 'endTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '实际开始时间',
|
||||||
|
key: 'actualStartTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '实际结束时间',
|
||||||
|
key: 'actualEndTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '派工操作人',
|
||||||
|
key: 'assingWorkOperationName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '派工操作时间',
|
||||||
|
key: 'assingWorkOperationTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '派工接收人',
|
||||||
|
key: 'assingWorkName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '派工时间',
|
||||||
|
key: 'assingWorkTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '是否开工',
|
||||||
|
key: 'starter'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
minWidth: 150,
|
||||||
|
title: '备注',
|
||||||
|
key: 'remark'
|
||||||
|
},
|
||||||
|
// { title: '创建时间', key: 'createTime', width: 100 },
|
||||||
|
// { title: '创建人', key: 'createBy' },
|
||||||
|
{
|
||||||
|
align:'center',
|
||||||
|
title: '操作',
|
||||||
|
key: 'actions',
|
||||||
|
width: 140,
|
||||||
|
fixed: 'right',
|
||||||
|
render(row:any) {
|
||||||
|
|
||||||
|
const buttons:any = [
|
||||||
|
|
||||||
|
// h(NButton, {
|
||||||
|
// size: 'small',
|
||||||
|
// type:'warning',
|
||||||
|
// ghost:true,
|
||||||
|
// onClick: () => handleEdit(row) },
|
||||||
|
// //{ default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 暂停' ]}
|
||||||
|
// { default: () => '暂停'}
|
||||||
|
// )
|
||||||
|
]
|
||||||
|
|
||||||
|
if(hasPermission('biz:assingWork:edit')){
|
||||||
|
buttons.push(h(NButton, {
|
||||||
|
size: 'small',
|
||||||
|
type:'primary',
|
||||||
|
ghost:true,
|
||||||
|
onClick: () => { handleEdit(row) } },
|
||||||
|
//{ default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 编辑' ]}
|
||||||
|
{ default: () => '编辑'}
|
||||||
|
))
|
||||||
|
}
|
||||||
|
if(hasPermission('biz:assingWork:transfer')){
|
||||||
|
buttons.push(h(NButton, {
|
||||||
|
size: 'small',
|
||||||
|
type:'success',
|
||||||
|
ghost:true,
|
||||||
|
onClick: () => { handleDelete(row) } },
|
||||||
|
{ default: () => '派工'}
|
||||||
|
))
|
||||||
|
}
|
||||||
|
// if(hasPermission('biz:assingWork:pauseResume')){
|
||||||
|
// buttons.push(h(NButton, {
|
||||||
|
// size: 'small',
|
||||||
|
// type:'warning',
|
||||||
|
// ghost:true,
|
||||||
|
// onClick:()=>{ handlpause(row) }
|
||||||
|
// },
|
||||||
|
// { default: () => '暂停'}
|
||||||
|
// ))
|
||||||
|
// }
|
||||||
|
// buttons.push(
|
||||||
|
|
||||||
|
// )
|
||||||
|
|
||||||
|
return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-'
|
||||||
|
|
||||||
|
|
||||||
|
// return h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap' } }, [
|
||||||
|
// h(NButton, { size: 'small', quaternary: true, onClick: () => handleEdit(row) }, {
|
||||||
|
// default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 编辑']
|
||||||
|
// }),
|
||||||
|
// h(NButton, { size: 'small', quaternary: true, type: 'error', onClick: () => handleDelete(row) }, {
|
||||||
|
// default: () => [h(NIcon, null, { default: () => h(TrashOutline) }), ' 派工']
|
||||||
|
// })
|
||||||
|
// ])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
// 加载数据
|
||||||
|
async function loadData() {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const res = await orderItemApi.page({
|
||||||
|
page: pagination.page,
|
||||||
|
pageSize: pagination.pageSize,
|
||||||
|
code: searchForm.code,
|
||||||
|
projectId: searchForm.projectId,
|
||||||
|
beginTime: searchForm.beginTime,
|
||||||
|
endTime: searchForm.endTime
|
||||||
|
})
|
||||||
|
tableData.value = res.list
|
||||||
|
pagination.itemCount = res.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
function handleSearch() {
|
||||||
|
pagination.page = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置
|
||||||
|
function handleReset() {
|
||||||
|
searchForm.code = ''
|
||||||
|
|
||||||
|
searchForm.projectId = ''
|
||||||
|
|
||||||
|
searchForm.beginTime = ''
|
||||||
|
|
||||||
|
searchForm.endTime = ''
|
||||||
|
|
||||||
|
handleSearch()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.page = page
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSizeChange(pageSize: number) {
|
||||||
|
pagination.pageSize = pageSize
|
||||||
|
pagination.page = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 选择
|
||||||
|
// function handleCheck(keys: Array<string | number>) {
|
||||||
|
// selectedIds.value = keys as number[]
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
function handleAdd() {
|
||||||
|
modalTitle.value = '新增生产订单'
|
||||||
|
Object.assign(formData, defaultFormData)
|
||||||
|
modalVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
function handleEdit(row: OrderItem) {
|
||||||
|
modalTitle.value = '编辑生产订单'
|
||||||
|
Object.assign(formData, row)
|
||||||
|
if (formData.beginTime && typeof formData.beginTime === 'string') {
|
||||||
|
formData.beginTime = new Date(formData.beginTime.replace(' ', 'T')).getTime()
|
||||||
|
}
|
||||||
|
if (formData.endTime && typeof formData.endTime === 'string') {
|
||||||
|
formData.endTime = new Date(formData.endTime.replace(' ', 'T')).getTime()
|
||||||
|
}
|
||||||
|
if (formData.actualStartTime && typeof formData.actualStartTime === 'string') {
|
||||||
|
formData.actualStartTime = new Date(formData.actualStartTime.replace(' ', 'T')).getTime()
|
||||||
|
}
|
||||||
|
if (formData.actualEndTime && typeof formData.actualEndTime === 'string') {
|
||||||
|
formData.actualEndTime = new Date(formData.actualEndTime.replace(' ', 'T')).getTime()
|
||||||
|
}
|
||||||
|
if (formData.createTime && typeof formData.createTime === 'string') {
|
||||||
|
formData.createTime = new Date(formData.createTime.replace(' ', 'T')).getTime()
|
||||||
|
}
|
||||||
|
if (formData.assingWorkTime && typeof formData.assingWorkTime === 'string') {
|
||||||
|
formData.assingWorkTime = new Date(formData.assingWorkTime.replace(' ', 'T')).getTime()
|
||||||
|
}
|
||||||
|
if (formData.assingWorkOperationTime && typeof formData.assingWorkOperationTime === 'string') {
|
||||||
|
formData.assingWorkOperationTime = new Date(formData.assingWorkOperationTime.replace(' ', 'T')).getTime()
|
||||||
|
}
|
||||||
|
modalVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
async function handleSubmit() {
|
||||||
|
await formRef.value?.validate()
|
||||||
|
try {
|
||||||
|
const submitData = { ...formData } as OrderItem
|
||||||
|
if (typeof submitData.beginTime === 'number') {
|
||||||
|
submitData.beginTime = new Date(submitData.beginTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||||
|
}
|
||||||
|
if (typeof submitData.endTime === 'number') {
|
||||||
|
submitData.endTime = new Date(submitData.endTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||||
|
}
|
||||||
|
if (typeof submitData.actualStartTime === 'number') {
|
||||||
|
submitData.actualStartTime = new Date(submitData.actualStartTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||||
|
}
|
||||||
|
if (typeof submitData.actualEndTime === 'number') {
|
||||||
|
submitData.actualEndTime = new Date(submitData.actualEndTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||||
|
}
|
||||||
|
if (typeof submitData.createTime === 'number') {
|
||||||
|
submitData.createTime = new Date(submitData.createTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||||
|
}
|
||||||
|
if (typeof submitData.assingWorkTime === 'number') {
|
||||||
|
submitData.assingWorkTime = new Date(submitData.assingWorkTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||||
|
}
|
||||||
|
if (typeof submitData.assingWorkOperationTime === 'number') {
|
||||||
|
submitData.assingWorkOperationTime = new Date(submitData.assingWorkOperationTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||||
|
}
|
||||||
|
if (submitData.id) {
|
||||||
|
await orderItemApi.update(submitData)
|
||||||
|
message.success('修改成功')
|
||||||
|
} else {
|
||||||
|
await orderItemApi.create(submitData)
|
||||||
|
message.success('新增成功')
|
||||||
|
}
|
||||||
|
modalVisible.value = false
|
||||||
|
loadData()
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
function handleDelete(row:any) {
|
||||||
|
dialog.warning({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除该记录吗?',
|
||||||
|
positiveText: '确定',
|
||||||
|
negativeText: '取消',
|
||||||
|
onPositiveClick: async () => {
|
||||||
|
try {
|
||||||
|
await orderItemApi.delete([row.id!])
|
||||||
|
message.success('删除成功')
|
||||||
|
loadData()
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量删除
|
||||||
|
function handleBatchDelete() {
|
||||||
|
dialog.warning({
|
||||||
|
title: '提示',
|
||||||
|
content: `确定要删除选中的 ${selectedIds.value.length} 条记录吗?`,
|
||||||
|
positiveText: '确定',
|
||||||
|
negativeText: '取消',
|
||||||
|
onPositiveClick: async () => {
|
||||||
|
try {
|
||||||
|
await orderItemApi.delete(selectedIds.value)
|
||||||
|
message.success('删除成功')
|
||||||
|
selectedIds.value = []
|
||||||
|
loadData()
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
async function handleExport() {
|
||||||
|
try {
|
||||||
|
const params: Record<string, any> = {}
|
||||||
|
if (selectedIds.value.length > 0) params.ids = selectedIds.value
|
||||||
|
if (searchForm.code) params.code = searchForm.code
|
||||||
|
if (searchForm.projectId != null) params.projectId = searchForm.projectId
|
||||||
|
if (searchForm.beginTime != null) params.beginTime = searchForm.beginTime
|
||||||
|
if (searchForm.endTime != null) params.endTime = searchForm.endTime
|
||||||
|
const blob = await orderItemApi.export(params)
|
||||||
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = '生产订单数据.xlsx'
|
||||||
|
link.click()
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下载导入模板
|
||||||
|
async function handleDownloadTemplate() {
|
||||||
|
try {
|
||||||
|
const blob = await orderItemApi.downloadTemplate()
|
||||||
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = '生产订单导入模板.xlsx'
|
||||||
|
link.click()
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导入上传
|
||||||
|
async function handleImportUpload({ file }: UploadCustomRequestOptions) {
|
||||||
|
if (!file.file) return
|
||||||
|
try {
|
||||||
|
const result = await orderItemApi.importData(file.file)
|
||||||
|
if (result.fail > 0) {
|
||||||
|
dialog.warning({
|
||||||
|
title: '导入结果',
|
||||||
|
content: `成功: ${result.success} 条,失败: ${result.fail} 条\n错误信息: ${(result.errors || []).join('\n') || '无'}`,
|
||||||
|
positiveText: '确定'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
message.success(`导入成功,共 ${result.success} 条数据`)
|
||||||
|
importModalVisible.value = false
|
||||||
|
}
|
||||||
|
loadData()
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载字典选项
|
||||||
|
async function loadDictOptions() {
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadData()
|
||||||
|
loadDictOptions()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.search-form {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-toolbar {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -16,11 +16,14 @@ export default defineConfig({
|
|||||||
emptyOutDir: true
|
emptyOutDir: true
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
host: true,
|
host: "192.168.5.231",
|
||||||
|
//host: true,
|
||||||
port: 3000,
|
port: 3000,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target:'http://localhost:8888',
|
//target:'http://192.168.6.107:8080', //'http://192.168.5.230:8888',
|
||||||
|
target:'http://192.168.5.230:8888',
|
||||||
|
//target:'http://192.168.5.200:8888',
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
},
|
},
|
||||||
'/druid': {
|
'/druid': {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user