|
@@ -1,122 +1,101 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <SidebarLayout
|
|
|
|
|
- :menuItems="menuItems"
|
|
|
|
|
- :userName="authStore.user?.name"
|
|
|
|
|
- :activeKey="'cut-batches'"
|
|
|
|
|
- @logout="handleLogout"
|
|
|
|
|
- >
|
|
|
|
|
- <div class="cut-batches-page">
|
|
|
|
|
- <a-card>
|
|
|
|
|
- <a-space>
|
|
|
|
|
- <a-input-search v-model:value="searchKeyword" placeholder="搜索批次号" style="width: 300px" @search="loadBatches" />
|
|
|
|
|
- <a-button type="primary" @click="showCreateModal">创建批次</a-button>
|
|
|
|
|
- </a-space>
|
|
|
|
|
- </a-card>
|
|
|
|
|
-
|
|
|
|
|
- <a-card class="mt-4" title="裁床批次列表">
|
|
|
|
|
- <a-table :columns="columns" :dataSource="batches" :loading="loading" rowKey="id">
|
|
|
|
|
- <template #status="{ record }">
|
|
|
|
|
- <a-tag :color="getStatusColor(record.status)">{{ getStatusText(record.status) }}</a-tag>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #action="{ record }">
|
|
|
|
|
- <a-space>
|
|
|
|
|
- <a-button size="small" @click="showBundlesModal(record)">查看扎号</a-button>
|
|
|
|
|
- <a-button size="small" @click="showEditModal(record)">编辑</a-button>
|
|
|
|
|
- <a-popconfirm title="确定删除此批次吗?" @confirm="deleteBatch(record.id)">
|
|
|
|
|
- <a-button size="small" danger>删除</a-button>
|
|
|
|
|
- </a-popconfirm>
|
|
|
|
|
- </a-space>
|
|
|
|
|
- </template>
|
|
|
|
|
- </a-table>
|
|
|
|
|
- </a-card>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 创建/编辑批次模态框 -->
|
|
|
|
|
- <a-modal v-model:open="modalVisible" :title="modalTitle" @ok="handleSubmit" :confirmLoading="submitting" width="600px">
|
|
|
|
|
- <a-form ref="formRef" :model="formState" :rules="formRules" layout="vertical">
|
|
|
|
|
- <a-form-item label="工单" name="work_order_id" v-if="!isEdit">
|
|
|
|
|
- <a-select v-model:value="formState.work_order_id" placeholder="请选择工单">
|
|
|
|
|
- <a-select-option v-for="wo in workOrders" :key="wo.id" :value="wo.id">
|
|
|
|
|
- {{ wo.order_no }} - {{ wo.style_name }}
|
|
|
|
|
- </a-select-option>
|
|
|
|
|
- </a-select>
|
|
|
|
|
- </a-form-item>
|
|
|
|
|
- <a-form-item label="批次号" name="batch_no" v-if="!isEdit">
|
|
|
|
|
- <a-input v-model:value="formState.batch_no" placeholder="请输入批次号" />
|
|
|
|
|
- </a-form-item>
|
|
|
|
|
- <a-form-item label="颜色" name="color">
|
|
|
|
|
- <a-input v-model:value="formState.color" placeholder="请输入颜色" />
|
|
|
|
|
- </a-form-item>
|
|
|
|
|
- <a-form-item label="总数量" name="total_qty">
|
|
|
|
|
- <a-input-number v-model:value="formState.total_qty" :min="1" :max="100000" style="width: 100%" />
|
|
|
|
|
- </a-form-item>
|
|
|
|
|
- </a-form>
|
|
|
|
|
- </a-modal>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 扎号管理模态框 -->
|
|
|
|
|
- <a-modal v-model:open="bundlesModalVisible" :title="`扎号管理 - ${currentBatch?.batch_no}`" width="900px" :footer="null">
|
|
|
|
|
- <a-space class="mb-4">
|
|
|
|
|
- <a-button type="primary" @click="showAddBundleModal">添加扎号</a-button>
|
|
|
|
|
- <a-button @click="generateAllQRCodes">批量生成二维码</a-button>
|
|
|
|
|
- </a-space>
|
|
|
|
|
- <a-table :columns="bundleColumns" :dataSource="bundles" rowKey="id" size="small">
|
|
|
|
|
- <template #action="{ record }">
|
|
|
|
|
- <a-space>
|
|
|
|
|
- <a-button size="small" @click="showBundleQRCode(record)">二维码</a-button>
|
|
|
|
|
- <a-popconfirm title="删除此扎号?" @confirm="deleteBundle(record.id)">
|
|
|
|
|
- <a-button size="small" danger>删除</a-button>
|
|
|
|
|
- </a-popconfirm>
|
|
|
|
|
- </a-space>
|
|
|
|
|
- </template>
|
|
|
|
|
- </a-table>
|
|
|
|
|
- </a-modal>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 添加扎号模态框 -->
|
|
|
|
|
- <a-modal v-model:open="addBundleModalVisible" title="添加扎号" @ok="handleAddBundle" :confirmLoading="addingBundle">
|
|
|
|
|
- <a-form layout="vertical">
|
|
|
|
|
- <a-form-item label="尺码" required>
|
|
|
|
|
- <a-input v-model:value="newBundle.size" placeholder="如:S/M/L/XL" />
|
|
|
|
|
- </a-form-item>
|
|
|
|
|
- <a-form-item label="数量" required>
|
|
|
|
|
- <a-input-number v-model:value="newBundle.quantity" :min="1" :max="10000" style="width: 100%" />
|
|
|
|
|
- </a-form-item>
|
|
|
|
|
- </a-form>
|
|
|
|
|
- </a-modal>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 单个扎号二维码展示 -->
|
|
|
|
|
- <a-modal v-model:open="bundleQRVisible" title="扎号二维码" :footer="null" width="400px">
|
|
|
|
|
- <div class="qr-code-container">
|
|
|
|
|
- <img :src="bundleQRUrl" alt="扎号二维码" style="width: 100%" />
|
|
|
|
|
- <p class="qr-code-tip">扎号: {{ currentBundle?.bundle_no }}</p>
|
|
|
|
|
- </div>
|
|
|
|
|
- </a-modal>
|
|
|
|
|
- </div>
|
|
|
|
|
- </SidebarLayout>
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <a-card>
|
|
|
|
|
+ <a-space>
|
|
|
|
|
+ <a-input-search v-model:value="searchKeyword" placeholder="搜索批次号" style="width: 300px" @search="loadBatches" />
|
|
|
|
|
+ <a-button type="primary" @click="showCreateModal">创建批次</a-button>
|
|
|
|
|
+ </a-space>
|
|
|
|
|
+ </a-card>
|
|
|
|
|
+
|
|
|
|
|
+ <a-card class="mt-4" title="裁床批次列表">
|
|
|
|
|
+ <a-table :columns="columns" :dataSource="batches" :loading="loading" rowKey="id">
|
|
|
|
|
+ <template #status="{ record }">
|
|
|
|
|
+ <a-tag :color="getStatusColor(record.status)">{{ getStatusText(record.status) }}</a-tag>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #action="{ record }">
|
|
|
|
|
+ <a-space>
|
|
|
|
|
+ <a-button size="small" @click="showBundlesModal(record)">查看扎号</a-button>
|
|
|
|
|
+ <a-button size="small" @click="showEditModal(record)">编辑</a-button>
|
|
|
|
|
+ <a-popconfirm title="确定删除此批次吗?" @confirm="deleteBatch(record.id)">
|
|
|
|
|
+ <a-button size="small" danger>删除</a-button>
|
|
|
|
|
+ </a-popconfirm>
|
|
|
|
|
+ </a-space>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </a-table>
|
|
|
|
|
+ </a-card>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 创建/编辑批次模态框 -->
|
|
|
|
|
+ <a-modal v-model:open="modalVisible" :title="modalTitle" @ok="handleSubmit" :confirmLoading="submitting" width="600px">
|
|
|
|
|
+ <a-form ref="formRef" :model="formState" :rules="formRules" layout="vertical">
|
|
|
|
|
+ <a-form-item label="工单" name="work_order_id" v-if="!isEdit">
|
|
|
|
|
+ <a-select v-model:value="formState.work_order_id" placeholder="请选择工单">
|
|
|
|
|
+ <a-select-option v-for="wo in workOrders" :key="wo.id" :value="wo.id">
|
|
|
|
|
+ {{ wo.order_no }} - {{ wo.style_name }}
|
|
|
|
|
+ </a-select-option>
|
|
|
|
|
+ </a-select>
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ <a-form-item label="批次号" name="batch_no" v-if="!isEdit">
|
|
|
|
|
+ <a-input v-model:value="formState.batch_no" placeholder="请输入批次号" />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ <a-form-item label="颜色" name="color">
|
|
|
|
|
+ <a-input v-model:value="formState.color" placeholder="请输入颜色" />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ <a-form-item label="总数量" name="total_qty">
|
|
|
|
|
+ <a-input-number v-model:value="formState.total_qty" :min="1" :max="100000" style="width: 100%" />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ </a-form>
|
|
|
|
|
+ </a-modal>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 扎号管理模态框 -->
|
|
|
|
|
+ <a-modal v-model:open="bundlesModalVisible" :title="`扎号管理 - ${currentBatch?.batch_no}`" width="900px" :footer="null">
|
|
|
|
|
+ <a-space class="mb-4">
|
|
|
|
|
+ <a-button type="primary" @click="showAddBundleModal">添加扎号</a-button>
|
|
|
|
|
+ <a-button @click="generateAllQRCodes">批量生成二维码</a-button>
|
|
|
|
|
+ </a-space>
|
|
|
|
|
+ <a-table :columns="bundleColumns" :dataSource="bundles" rowKey="id" size="small">
|
|
|
|
|
+ <template #action="{ record }">
|
|
|
|
|
+ <a-space>
|
|
|
|
|
+ <a-button size="small" @click="showBundleQRCode(record)">二维码</a-button>
|
|
|
|
|
+ <a-popconfirm title="删除此扎号?" @confirm="deleteBundle(record.id)">
|
|
|
|
|
+ <a-button size="small" danger>删除</a-button>
|
|
|
|
|
+ </a-popconfirm>
|
|
|
|
|
+ </a-space>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </a-table>
|
|
|
|
|
+ </a-modal>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 添加扎号模态框 -->
|
|
|
|
|
+ <a-modal v-model:open="addBundleModalVisible" title="添加扎号" @ok="handleAddBundle" :confirmLoading="addingBundle">
|
|
|
|
|
+ <a-form layout="vertical">
|
|
|
|
|
+ <a-form-item label="尺码" required>
|
|
|
|
|
+ <a-input v-model:value="newBundle.size" placeholder="如:S/M/L/XL" />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ <a-form-item label="数量" required>
|
|
|
|
|
+ <a-input-number v-model:value="newBundle.quantity" :min="1" :max="10000" style="width: 100%" />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ </a-form>
|
|
|
|
|
+ </a-modal>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 单个扎号二维码展示 -->
|
|
|
|
|
+ <a-modal v-model:open="bundleQRVisible" title="扎号二维码" :footer="null" width="400px">
|
|
|
|
|
+ <div class="text-center">
|
|
|
|
|
+ <img :src="bundleQRUrl" alt="扎号二维码" style="width: 100%" />
|
|
|
|
|
+ <p class="mt-4 text-gray-600 text-sm">扎号: {{ currentBundle?.bundle_no }}</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </a-modal>
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { ref, reactive, onMounted } from 'vue';
|
|
import { ref, reactive, onMounted } from 'vue';
|
|
|
-import { useRouter } from 'vue-router';
|
|
|
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
-import { useAuthStore } from '@/stores/auth';
|
|
|
|
|
-import { SidebarLayout } from '@smartcut/shared-components';
|
|
|
|
|
import { WorkOrderApi, createApiClient } from '@smartcut/api-client';
|
|
import { WorkOrderApi, createApiClient } from '@smartcut/api-client';
|
|
|
import { STORAGE_KEYS } from '@smartcut/shared-utils';
|
|
import { STORAGE_KEYS } from '@smartcut/shared-utils';
|
|
|
|
|
+import { getApiBaseUrl } from '@/apiConfig';
|
|
|
import type { WorkOrder, CutBatch, CutBundle } from '@smartcut/types';
|
|
import type { WorkOrder, CutBatch, CutBundle } from '@smartcut/types';
|
|
|
|
|
|
|
|
-const router = useRouter();
|
|
|
|
|
-const authStore = useAuthStore();
|
|
|
|
|
-
|
|
|
|
|
-const menuItems = [
|
|
|
|
|
- { key: 'dashboard', label: '主页看板', icon: 'DashboardOutlined', path: '/' },
|
|
|
|
|
- { key: 'work-orders', label: '工单管理', icon: 'FileOutlined', path: '/work-orders' },
|
|
|
|
|
- { key: 'processes', label: '工序管理', icon: 'AppstoreOutlined', path: '/processes' },
|
|
|
|
|
- { key: 'records', label: '计件记录', icon: 'UnorderedListOutlined', path: '/records' },
|
|
|
|
|
- { key: 'salary', label: '工资管理', icon: 'PayCircleOutlined', path: '/salary' },
|
|
|
|
|
- { key: 'users', label: '用户管理', icon: 'UserOutlined', path: '/users' }
|
|
|
|
|
-];
|
|
|
|
|
-
|
|
|
|
|
const apiClient = createApiClient({
|
|
const apiClient = createApiClient({
|
|
|
- baseURL: window.location.origin,
|
|
|
|
|
|
|
+ baseURL: getApiBaseUrl(),
|
|
|
tokenKey: STORAGE_KEYS.FACTORY_TOKEN
|
|
tokenKey: STORAGE_KEYS.FACTORY_TOKEN
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -352,22 +331,8 @@ async function generateAllQRCodes() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function handleLogout() {
|
|
|
|
|
- authStore.logout();
|
|
|
|
|
- message.success('已退出登录');
|
|
|
|
|
- router.push('/login');
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
loadBatches();
|
|
loadBatches();
|
|
|
loadWorkOrders();
|
|
loadWorkOrders();
|
|
|
});
|
|
});
|
|
|
-</script>
|
|
|
|
|
-
|
|
|
|
|
-<style scoped lang="postcss">
|
|
|
|
|
-.cut-batches-page { padding: 0; }
|
|
|
|
|
-.mt-4 { margin-top: 16px; }
|
|
|
|
|
-.mb-4 { margin-bottom: 16px; }
|
|
|
|
|
-.qr-code-container { text-align: center; }
|
|
|
|
|
-.qr-code-tip { margin-top: 16px; color: #666; font-size: 14px; }
|
|
|
|
|
-</style>
|
|
|
|
|
|
|
+</script>
|