Commit 5c5b1b42 by qinjianhui

feat: 新订单批次管理修改

parent 253f46ce
<template>
<ElDialog
v-model="visible"
:title="dialogTitle"
width="520px"
:close-on-click-modal="false"
>
<ElForm :model="form">
<ElFormItem
v-if="showAutoSwitch"
label="自动排版(烫画工艺推荐自动排版)"
style="margin-bottom: 10px"
>
<el-switch
v-model="isAuto"
inline-prompt
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
active-text="是"
inactive-text="否"
@change="handleAutoChange"
/>
</ElFormItem>
<template v-if="isAuto || !showAutoSwitch">
<ElFormItem label="排版类型">
<el-radio-group v-model="form.type">
<el-radio label="tiff">tiff</el-radio>
<el-radio label="png">png</el-radio>
</el-radio-group>
</ElFormItem>
<ElFormItem label="排版宽度">
<el-radio-group v-model="form.templateWidth">
<el-radio :value="42">40+2cm</el-radio>
<el-radio :value="60">60cm</el-radio>
</el-radio-group>
</ElFormItem>
</template>
</ElForm>
<template #footer>
<div style="text-align: center">
<ElButton @click="visible = false">取消</ElButton>
<ElButton type="primary" :loading="submitting" @click="handleSubmit">
确定
</ElButton>
</div>
</template>
</ElDialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import { arrangeFinishApi } from '@/api/podCnOrder'
type OpenPayload = {
productIdList: number[]
title?: string
showAutoSwitch?: boolean
}
const emit = defineEmits<{
success: []
}>()
const visible = ref(false)
const submitting = ref(false)
const payload = ref<OpenPayload | null>(null)
const isAuto = ref(true)
const form = ref<{ type?: string; templateWidth?: number }>({})
const showAutoSwitch = ref(true)
const dialogTitle = ref('排单')
const handleAutoChange = () => {
form.value = {}
}
const open = (p: OpenPayload) => {
payload.value = p
showAutoSwitch.value = p.showAutoSwitch ?? true
dialogTitle.value = p.title || '排单'
isAuto.value = true
form.value = {}
visible.value = true
}
const handleSubmit = async () => {
if (!payload.value?.productIdList?.length) {
return ElMessage.warning('请选择订单')
}
const { templateWidth, type } = form.value
const mustFill = isAuto.value || !showAutoSwitch.value
if (mustFill && (!templateWidth || !type)) {
return ElMessage.warning('排版类型和排版宽度为必选项')
}
if (!templateWidth && type) return ElMessage.warning('请选择排版宽度')
if (templateWidth && !type) return ElMessage.warning('请选择排版类型')
submitting.value = true
try {
await arrangeFinishApi({
productIdList: payload.value.productIdList,
templateWidth: isAuto.value ? templateWidth : undefined,
type: isAuto.value ? type : undefined,
})
ElMessage.success('操作成功')
visible.value = false
emit('success')
} catch (e: unknown) {
ElMessage.error((e as Error)?.message || '排单失败')
} finally {
submitting.value = false
}
}
defineExpose({ open })
</script>
...@@ -13,12 +13,20 @@ ...@@ -13,12 +13,20 @@
/> />
</ElFormItem> </ElFormItem>
<ElFormItem label="创建人"> <ElFormItem label="创建人">
<ElInput <ElSelect
v-model="filterForm.creator" v-model="filterForm.creator"
placeholder="创建人" placeholder="请选择"
clearable clearable
filterable
style="width: 120px" style="width: 120px"
/> >
<ElOption
v-for="item in employeeList"
:key="item.id"
:label="item.account"
:value="item.account"
/>
</ElSelect>
</ElFormItem> </ElFormItem>
<ElFormItem label="工艺类型"> <ElFormItem label="工艺类型">
<ElSelect <ElSelect
...@@ -30,6 +38,9 @@ ...@@ -30,6 +38,9 @@
<ElOption label="烫画" value="TH" /> <ElOption label="烫画" value="TH" />
<ElOption label="直喷" value="ZP" /> <ElOption label="直喷" value="ZP" />
<ElOption label="刺绣" value="CX" /> <ElOption label="刺绣" value="CX" />
<ElOption label="雕刻" value="DK" />
<ElOption label="白胚" value="BP" />
<ElOption label="其他" value="QT" />
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
<ElFormItem label="下载状态"> <ElFormItem label="下载状态">
...@@ -98,21 +109,37 @@ ...@@ -98,21 +109,37 @@
</el-tag> </el-tag>
</template> </template>
<template #operation="{ row }"> <template #operation="{ row }">
<ElButton type="primary" link size="small" @click="handleView(row)">
查看
</ElButton>
<ElButton <ElButton
type="primary" type="primary"
link link
size="small" size="small"
@click="handleDownload(row)" @click="handleDownload()"
> >
下载 下载
</ElButton> </ElButton>
<ElButton type="primary" link size="small" @click="handlePrintPick()">
拣货单
</ElButton>
<ElButton
type="primary"
link
size="small"
@click="handlePrintProduction()"
>
生产单
</ElButton>
<ElButton type="warning" link size="small" @click="handleReArrange(row)">
重排
</ElButton>
<ElButton type="danger" link size="small" @click="handleDelete()">
删除
</ElButton>
</template> </template>
</TableView> </TableView>
</div> </div>
<ArrangeDialog ref="arrangeDialogRef" @success="loadData" />
<ElPagination <ElPagination
v-model:current-page="currentPage" v-model:current-page="currentPage"
v-model:page-size="pageSize" v-model:page-size="pageSize"
...@@ -134,6 +161,9 @@ import { getBatchManageListApi, batchDeleteApi } from '@/api/factoryOrderNew' ...@@ -134,6 +161,9 @@ import { getBatchManageListApi, batchDeleteApi } from '@/api/factoryOrderNew'
import type { BatchManageData } from '@/types/api/factoryOrderNew' import type { BatchManageData } from '@/types/api/factoryOrderNew'
import type { CustomColumn } from '@/types/table' import type { CustomColumn } from '@/types/table'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import ArrangeDialog from './ArrangeDialog.vue'
import { getEmployeeListApi } from '@/api/common'
import type { userData } from '@/types/api/user'
const loading = ref(false) const loading = ref(false)
const tableData = ref<BatchManageData[]>([]) const tableData = ref<BatchManageData[]>([])
...@@ -141,6 +171,8 @@ const selectedRows = ref<BatchManageData[]>([]) ...@@ -141,6 +171,8 @@ const selectedRows = ref<BatchManageData[]>([])
const currentPage = ref(1) const currentPage = ref(1)
const pageSize = ref(50) const pageSize = ref(50)
const total = ref(0) const total = ref(0)
const employeeList = ref<userData[]>([])
const arrangeDialogRef = ref<InstanceType<typeof ArrangeDialog>>()
const columns: CustomColumn<BatchManageData>[] = [ const columns: CustomColumn<BatchManageData>[] = [
{ key: 'batchNo', prop: 'batchNo', label: '批次号', minWidth: 120 }, { key: 'batchNo', prop: 'batchNo', label: '批次号', minWidth: 120 },
...@@ -230,6 +262,16 @@ const loadData = async () => { ...@@ -230,6 +262,16 @@ const loadData = async () => {
} }
} }
const loadEmployeeList = async () => {
try {
const res = await getEmployeeListApi()
if (res.code !== 200) return
employeeList.value = res.data || []
} catch (e) {
console.error(e)
}
}
const handleSelectionChange = (rows: BatchManageData[]) => { const handleSelectionChange = (rows: BatchManageData[]) => {
selectedRows.value = rows selectedRows.value = rows
} }
...@@ -252,12 +294,30 @@ const handleBatchDelete = async () => { ...@@ -252,12 +294,30 @@ const handleBatchDelete = async () => {
} }
} }
const handleView = (row: BatchManageData) => {
ElMessage.info(`查看批次 ${row.batchNo}`) const handleDownload = () => {
ElMessage.info('接口待提供')
} }
const handleDownload = (row: BatchManageData) => { const handlePrintPick = () => {
ElMessage.info(`下载批次 ${row.batchNo}`) ElMessage.info('接口待提供')
}
const handlePrintProduction = () => {
ElMessage.info('接口待提供')
}
const handleDelete = () => {
ElMessage.info('接口待提供')
}
const handleReArrange = (row: BatchManageData) => {
// 后端未提供“批次 -> 商品ID列表”映射时,暂用行 id 作为占位
arrangeDialogRef.value?.open({
productIdList: [row.id],
title: '重排',
showAutoSwitch: false,
})
} }
const handlePageSizeChange = (size: number) => { const handlePageSizeChange = (size: number) => {
...@@ -277,6 +337,7 @@ const refresh = () => { ...@@ -277,6 +337,7 @@ const refresh = () => {
} }
onMounted(() => { onMounted(() => {
loadEmployeeList()
loadData() loadData()
}) })
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
v-model="form.reason" v-model="form.reason"
placeholder="请选择取消原因" placeholder="请选择取消原因"
style="width: 100%" style="width: 100%"
clearable
> >
<ElOption <ElOption
v-for="item in cancelReasons" v-for="item in cancelReasons"
...@@ -23,17 +24,19 @@ ...@@ -23,17 +24,19 @@
</ElFormItem> </ElFormItem>
</ElForm> </ElForm>
<template #footer> <template #footer>
<ElButton @click="visible = false">取消</ElButton> <div class="dialog-footer" style="text-align: center">
<ElButton type="primary" :loading="submitLoading" @click="handleSubmit"> <ElButton @click="visible = false">取消</ElButton>
确认 <ElButton type="primary" :loading="submitLoading" @click="handleSubmit">
</ElButton> 确认
</ElButton>
</div>
</template> </template>
</ElDialog> </ElDialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import { cancelOrderWithReasonApi } from '@/api/factoryOrderNew' import { cancelOrderWithReasonApi } from '@/api/factoryOrderNew'
...@@ -75,10 +78,8 @@ const handleSubmit = async () => { ...@@ -75,10 +78,8 @@ const handleSubmit = async () => {
ElMessage.success('取消订单成功') ElMessage.success('取消订单成功')
visible.value = false visible.value = false
emit('success') emit('success')
} catch (e: any) { } catch (e: unknown) {
ElMessageBox.alert(e?.message || '取消订单失败', '取消订单失败', { console.error(e)
type: 'error',
})
} finally { } finally {
submitLoading.value = false submitLoading.value = false
} }
......
...@@ -36,11 +36,24 @@ ...@@ -36,11 +36,24 @@
<div v-if="item.customizedQuantity" class="quantity-badge"> <div v-if="item.customizedQuantity" class="quantity-badge">
{{ item.customizedQuantity }} {{ item.customizedQuantity }}
</div> </div>
<Icon name="caozuorizhi" style="width: 28px; height: 28px">
<template #title>
<title>操作日志</title>
</template>
</Icon>
<Icon name="chakanxiangqing">
<template #title>
<title>查看详情</title>
</template>
</Icon>
</template> </template>
<template #info> <template #info>
<div class="card-info-grid"> <div class="card-info-grid">
<div class="card-info-row full"> <div class="card-info-row full">
<span class="info-value ellipsis" :title="(item.productName as string) || ''"> <span
class="info-value ellipsis"
:title="(item.productName as string) || ''"
>
{{ item.productName }} {{ item.productName }}
</span> </span>
</div> </div>
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
:placeholder="placeholder" :placeholder="placeholder"
readonly readonly
clearable clearable
:style="{ width: width }"
@clear="clearValue" @clear="clearValue"
> >
<template #suffix> <template #suffix>
...@@ -81,6 +82,7 @@ const props = withDefaults( ...@@ -81,6 +82,7 @@ const props = withDefaults(
options: ProductTypeGroup[] options: ProductTypeGroup[]
multiple?: boolean multiple?: boolean
placeholder?: string placeholder?: string
width?: string
}>(), }>(),
{ {
multiple: false, multiple: false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment