diff --git a/backend/plugin/article/resource/database/migrations/2026_09_01_000001_update_article_menu_icons.php b/backend/plugin/article/resource/database/migrations/2026_09_01_000001_update_article_menu_icons.php new file mode 100644 index 0000000..b62523e --- /dev/null +++ b/backend/plugin/article/resource/database/migrations/2026_09_01_000001_update_article_menu_icons.php @@ -0,0 +1,32 @@ +hasTable('sys_menu')) { + return; + } + + $icons = [ + 'article' => 'ant-design:read-outlined', + 'article:index' => 'ant-design:file-text-outlined', + 'article:category:index' => 'ant-design:folder-open-outlined', + 'article:tag:index' => 'ant-design:tags-outlined', + 'article:recycle:index' => 'ant-design:delete-outlined', + ]; + foreach ($icons as $code => $icon) { + $schema->getConnection()->table('sys_menu')->where('app', 'article')->where('code', $code)->update([ + 'icon' => $icon, + 'updated_at' => time(), + ]); + } + } + + public function down(Builder $schema): void + { + } +}; diff --git a/backend/plugin/article/resource/menu/admin.php b/backend/plugin/article/resource/menu/admin.php index 237bee6..e60ce08 100644 --- a/backend/plugin/article/resource/menu/admin.php +++ b/backend/plugin/article/resource/menu/admin.php @@ -11,7 +11,7 @@ return [ 'code' => 'article', 'app' => 'article', 'path' => '/article', - 'icon' => 'plugin', + 'icon' => 'ant-design:read-outlined', 'children' => [ [ 'name' => '内容中心', @@ -19,6 +19,7 @@ return [ 'app' => 'article', 'path' => '/article/index', 'component' => '/article/content/index', + 'icon' => 'ant-design:file-text-outlined', ], [ 'name' => '内容分类', @@ -26,6 +27,7 @@ return [ 'app' => 'article', 'path' => '/article/category', 'component' => '/article/category/index', + 'icon' => 'ant-design:folder-open-outlined', ], [ 'name' => '标签管理', @@ -33,6 +35,7 @@ return [ 'app' => 'article', 'path' => '/article/tag', 'component' => '/article/tag/index', + 'icon' => 'ant-design:tags-outlined', ], [ 'name' => '内容回收站', @@ -40,6 +43,7 @@ return [ 'app' => 'article', 'path' => '/article/recycle', 'component' => '/article/recycle/index', + 'icon' => 'ant-design:delete-outlined', ], ], ], diff --git a/backend/plugin/produce/app/dao/ScanDataDao.php b/backend/plugin/produce/app/dao/ScanDataDao.php index 091e050..e471fb1 100644 --- a/backend/plugin/produce/app/dao/ScanDataDao.php +++ b/backend/plugin/produce/app/dao/ScanDataDao.php @@ -41,14 +41,13 @@ class ScanDataDao extends BaseDao { $query = $this->query(); - if (($where['keyword'] ?? '') !== '') { - $query->where(function (Builder $builder) use ($where) { - $keyword = '%' . $where['keyword'] . '%'; - $builder->where('order_no', 'like', $keyword) - ->orWhere('user_code', 'like', $keyword) - ->orWhere('operator', 'like', $keyword) - ->orWhere('remark', 'like', $keyword); - }); + foreach (['order_no', 'user_code', 'operator', 'remark'] as $field) { + $value = trim((string) ($where['LIKE_' . $field] ?? '')); + if ($value === '') { + continue; + } + + $query->where($field, 'like', '%' . $value . '%'); } if (($where['process_id'] ?? '') !== '') { diff --git a/backend/plugin/produce/app/service/admin/WorkStatisticsService.php b/backend/plugin/produce/app/service/admin/WorkStatisticsService.php index fad7c40..6d72c7b 100644 --- a/backend/plugin/produce/app/service/admin/WorkStatisticsService.php +++ b/backend/plugin/produce/app/service/admin/WorkStatisticsService.php @@ -5,11 +5,18 @@ declare(strict_types=1); namespace plugin\produce\app\service\admin; use Illuminate\Database\Query\Builder; +use plugin\produce\app\model\ExceptionRecord; +use plugin\produce\app\model\Process; +use plugin\produce\app\model\ProcessStep; use plugin\produce\app\model\ProductRecord; +use plugin\produce\app\model\ProduceConfig; +use plugin\produce\app\model\RepairRecord; use plugin\produce\app\model\ScanData; class WorkStatisticsService { + private ?array $repairFlow = null; + public function monthly(array $params): array { $month = $this->normalizeMonth($params['month'] ?? null); @@ -44,9 +51,70 @@ class WorkStatisticsService $rows = array_merge($rows, $this->queryProductRecord($params, $start, $end, $periodExpression)->get()->all()); } + if ($dataType === 'all' || $dataType === 'exception') { + $rows = array_merge($rows, $this->queryExceptionRecord($params, $start, $end, $periodExpression)->get()->all()); + } + + if ($dataType === 'all' || $dataType === 'repair') { + $rows = array_merge($rows, $this->queryRepairRecord($params, $start, $end, $periodExpression)->get()->all()); + } + return $rows; } + private function queryExceptionRecord(array $params, int $start, int $end, callable $periodExpression): Builder + { + $model = new ExceptionRecord(); + $connection = $model->getConnection(); + $table = $model->getTable(); + $processTable = 'produce_process'; + $stepTable = 'produce_process_step'; + $query = $connection->table($table) + ->leftJoin($processTable, $processTable . '.id', '=', $table . '.process_id') + ->leftJoin($stepTable, $stepTable . '.id', '=', $table . '.step_id') + ->whereBetween($table . '.reported_at', [$start, $end]) + ->whereNull($table . '.deleted_at'); + + $this->applyStatisticsFilters($query, $params, $table, $processTable, $stepTable, 'reporter'); + return $query->select([$table . '.user_code', $table . '.reporter as operator']) + ->selectRaw($periodExpression($connection->getTablePrefix() . $table . '.reported_at') . ' as period') + ->selectRaw($connection->getTablePrefix() . $processTable . '.process_name as process_name') + ->selectRaw($connection->getTablePrefix() . $stepTable . '.step_name as step_name') + ->selectRaw('COUNT(*) as amount') + ->groupBy('user_code', 'operator', 'process_name', 'step_name', 'period'); + } + + private function queryRepairRecord(array $params, int $start, int $end, callable $periodExpression): Builder + { + $model = new RepairRecord(); + $exceptionModel = new ExceptionRecord(); + $connection = $model->getConnection(); + $table = $model->getTable(); + $exceptionTable = $exceptionModel->getTable(); + $flow = $this->getRepairFlow(); + $query = $connection->table($table) + ->leftJoin($exceptionTable, $exceptionTable . '.id', '=', $table . '.exception_id') + ->whereBetween($table . '.repaired_at', [$start, $end]) + ->whereNull($table . '.deleted_at'); + + if (!$this->matchesRepairFlow($params, $flow)) { + $query->whereRaw('1 = 0'); + } + if (($params['user_code'] ?? '') !== '') { + $query->where($exceptionTable . '.user_code', 'like', '%' . $params['user_code'] . '%'); + } + if (($params['operator'] ?? '') !== '') { + $query->where($table . '.operator', 'like', '%' . $params['operator'] . '%'); + } + + return $query->select([$exceptionTable . '.user_code', $table . '.operator']) + ->selectRaw($periodExpression($connection->getTablePrefix() . $table . '.repaired_at') . ' as period') + ->selectRaw('? as process_name', [$flow['process_name']]) + ->selectRaw('? as step_name', [$flow['step_name']]) + ->selectRaw('COUNT(*) as amount') + ->groupBy('user_code', 'operator', 'process_name', 'step_name', 'period'); + } + private function queryScanData(array $params, int $start, int $end, callable $periodExpression): Builder { $scanDataModel = new ScanData(); @@ -61,7 +129,7 @@ class WorkStatisticsService ->whereBetween($scanDataTable . '.scan_time', [$start, $end]) ->whereNull($scanDataTable . '.deleted_at'); - foreach (['process_id', 'step_id', 'scan_result'] as $field) { + foreach (['process_id', 'step_id'] as $field) { if (($params[$field] ?? '') !== '') { $query->where($scanDataTable . '.' . $field, $params[$field]); } @@ -139,6 +207,65 @@ class WorkStatisticsService ->orderBy('step_name'); } + private function applyStatisticsFilters(Builder $query, array $params, string $table, string $processTable, string $stepTable, string $operatorField): void + { + foreach (['process_id', 'step_id', 'scan_result'] as $field) { + if (($params[$field] ?? '') !== '') { + $query->where($table . '.' . $field, $params[$field]); + } + } + if (($params['user_code'] ?? '') !== '') { + $query->where($table . '.user_code', 'like', '%' . $params['user_code'] . '%'); + } + if (($params['operator'] ?? '') !== '') { + $query->where($table . '.' . $operatorField, 'like', '%' . $params['operator'] . '%'); + } + foreach (['process_name' => $processTable . '.process_name', 'step_name' => $stepTable . '.step_name'] as $field => $column) { + if (($params[$field] ?? '') !== '') { + $query->where($column, 'like', '%' . $params[$field] . '%'); + } + } + } + + private function matchesRepairFlow(array $params, array $flow): bool + { + if (($params['process_id'] ?? '') !== '' && (string) $params['process_id'] !== (string) $flow['process_id']) { + return false; + } + if (($params['step_id'] ?? '') !== '' && (string) $params['step_id'] !== (string) $flow['step_id']) { + return false; + } + if (($params['process_name'] ?? '') !== '' && !str_contains($flow['process_name'], (string) $params['process_name'])) { + return false; + } + return ($params['step_name'] ?? '') === '' || str_contains($flow['step_name'], (string) $params['step_name']); + } + + private function getRepairFlow(): array + { + if ($this->repairFlow !== null) { + return $this->repairFlow; + } + $configs = ProduceConfig::query() + ->whereIn('group_code', ['basic_setting', 'repair_flow']) + ->whereIn('code', ['repair_process_id', 'repair_step_id']) + ->get(['group_code', 'code', 'content']) + ->groupBy('group_code'); + $basic = $configs->get('basic_setting', collect())->pluck('content', 'code'); + $flow = $configs->get('repair_flow', collect())->pluck('content', 'code'); + $processId = (int) (($basic['repair_process_id'] ?? '') ?: ($flow['repair_process_id'] ?? 0)); + $stepId = (int) (($basic['repair_step_id'] ?? '') ?: ($flow['repair_step_id'] ?? 0)); + $process = $processId > 0 ? Process::query()->withTrashed()->find($processId) : null; + $step = $stepId > 0 ? ProcessStep::query()->withTrashed()->find($stepId) : null; + + return $this->repairFlow = [ + 'process_id' => $processId, + 'step_id' => $stepId, + 'process_name' => (string) ($process?->process_name ?? '维修'), + 'step_name' => (string) ($step?->step_name ?? '维修'), + ]; + } + private function formatRows(iterable $rows, int $periodCount, callable $periodLabel): array { $grouped = []; diff --git a/backend/plugin/produce/resource/database/migrations/2026_09_01_000002_update_produce_menu_icons.php b/backend/plugin/produce/resource/database/migrations/2026_09_01_000002_update_produce_menu_icons.php new file mode 100644 index 0000000..b558b50 --- /dev/null +++ b/backend/plugin/produce/resource/database/migrations/2026_09_01_000002_update_produce_menu_icons.php @@ -0,0 +1,50 @@ +hasTable('sys_menu')) { + return; + } + + $icons = [ + 'produce' => 'ant-design:dashboard-outlined', + 'produce:material-category:index' => 'ant-design:tags-outlined', + 'produce:material:index' => 'ant-design:database-outlined', + 'produce:config:index' => 'ant-design:setting-outlined', + 'produce:process:index' => 'ant-design:apartment-outlined', + 'produce:process-step:index' => 'ant-design:ordered-list-outlined', + 'produce:step-status:index' => 'ant-design:flag-outlined', + 'produce:step-relation:index' => 'ant-design:share-alt-outlined', + 'produce:status-transition:index' => 'ant-design:swap-outlined', + 'produce:product-record:index' => 'ant-design:desktop-outlined', + 'produce:scan-data:index' => 'ant-design:qrcode-outlined', + 'produce:transition-log:index' => 'ant-design:swap-right-outlined', + 'produce:exception:index' => 'ant-design:warning-outlined', + 'produce:exception-data:list' => 'ant-design:exception-outlined', + 'produce:exception-setting:list' => 'ant-design:setting-outlined', + 'produce:exception-analysis:read' => 'ant-design:pie-chart-outlined', + 'produce:repair:index' => 'ant-design:tool-outlined', + 'produce:repair-record:list' => 'ant-design:tool-outlined', + 'produce:repair-setting:list' => 'ant-design:setting-outlined', + 'produce:hardware-fault-description:list' => 'ant-design:bug-outlined', + 'produce:statistics:index' => 'ant-design:bar-chart-outlined', + 'produce:statistics:monthly' => 'ant-design:calendar-outlined', + 'produce:statistics:daily' => 'ant-design:clock-circle-outlined', + ]; + foreach ($icons as $code => $icon) { + $schema->getConnection()->table('sys_menu')->where('app', 'produce')->where('code', $code)->update([ + 'icon' => $icon, + 'updated_at' => time(), + ]); + } + } + + public function down(Builder $schema): void + { + } +}; diff --git a/backend/plugin/produce/resource/menu/admin.php b/backend/plugin/produce/resource/menu/admin.php index 6d3e28d..fd6cbf4 100644 --- a/backend/plugin/produce/resource/menu/admin.php +++ b/backend/plugin/produce/resource/menu/admin.php @@ -11,7 +11,7 @@ return [ 'code' => 'produce', 'app' => 'produce', 'path' => '/produce', - 'icon' => 'plugin', + 'icon' => 'ant-design:dashboard-outlined', 'children' => [ [ 'name' => '物料分类', @@ -19,6 +19,7 @@ return [ 'app' => 'produce', 'path' => '/produce/material-category', 'component' => '/produce/material-category/index', + 'icon' => 'ant-design:tags-outlined', ], [ 'name' => '物料库', @@ -26,6 +27,7 @@ return [ 'app' => 'produce', 'path' => '/produce/material', 'component' => '/produce/material/index', + 'icon' => 'ant-design:database-outlined', ], [ 'name' => '生产配置', @@ -33,6 +35,7 @@ return [ 'app' => 'produce', 'path' => '/produce/config', 'component' => '/produce/config/index', + 'icon' => 'ant-design:setting-outlined', ], [ 'name' => '工序管理', @@ -40,6 +43,7 @@ return [ 'app' => 'produce', 'path' => '/produce/process', 'component' => '/produce/process/index', + 'icon' => 'ant-design:apartment-outlined', ], [ 'name' => '工序步骤', @@ -47,6 +51,7 @@ return [ 'app' => 'produce', 'path' => '/produce/process-step', 'component' => '/produce/process-step/index', + 'icon' => 'ant-design:ordered-list-outlined', ], [ 'name' => '步骤状态', @@ -54,6 +59,7 @@ return [ 'app' => 'produce', 'path' => '/produce/step-status', 'component' => '/produce/step-status/index', + 'icon' => 'ant-design:flag-outlined', ], [ 'name' => '步骤关系', @@ -61,6 +67,7 @@ return [ 'app' => 'produce', 'path' => '/produce/step-relation', 'component' => '/produce/step-relation/index', + 'icon' => 'ant-design:share-alt-outlined', ], [ 'name' => '状态转换', @@ -68,6 +75,7 @@ return [ 'app' => 'produce', 'path' => '/produce/status-transition', 'component' => '/produce/status-transition/index', + 'icon' => 'ant-design:swap-outlined', ], [ 'name' => '整机数据', @@ -75,6 +83,7 @@ return [ 'app' => 'produce', 'path' => '/produce/product-record', 'component' => '/produce/product-record/index', + 'icon' => 'ant-design:desktop-outlined', ], [ 'name' => '扫码数据', @@ -82,6 +91,7 @@ return [ 'app' => 'produce', 'path' => '/produce/scan-data', 'component' => '/produce/scan-data/index', + 'icon' => 'ant-design:qrcode-outlined', ], [ 'name' => '转换日志', @@ -89,13 +99,14 @@ return [ 'app' => 'produce', 'path' => '/produce/transition-log', 'component' => '/produce/transition-log/index', + 'icon' => 'ant-design:swap-right-outlined', ], [ 'name' => '异常管理', 'code' => 'produce:exception:index', 'app' => 'produce', 'path' => '/produce/exception', - 'icon' => 'warning', + 'icon' => 'ant-design:warning-outlined', 'children' => [ [ 'name' => '异常数据', @@ -103,6 +114,7 @@ return [ 'app' => 'produce', 'path' => '/produce/exception-data', 'component' => '/produce/exception/data/index', + 'icon' => 'ant-design:exception-outlined', ], [ 'name' => '异常设置', @@ -110,6 +122,7 @@ return [ 'app' => 'produce', 'path' => '/produce/exception-setting', 'component' => '/produce/exception/setting/index', + 'icon' => 'ant-design:setting-outlined', ], [ 'name' => '数据分析', @@ -117,6 +130,7 @@ return [ 'app' => 'produce', 'path' => '/produce/exception-analysis', 'component' => '/produce/exception/analysis/index', + 'icon' => 'ant-design:pie-chart-outlined', ], ], ], @@ -125,7 +139,7 @@ return [ 'code' => 'produce:repair:index', 'app' => 'produce', 'path' => '/produce/repair', - 'icon' => 'tools', + 'icon' => 'ant-design:tool-outlined', 'children' => [ [ 'name' => '维修数据', @@ -133,6 +147,7 @@ return [ 'app' => 'produce', 'path' => '/produce/repair/repair-data', 'component' => '/produce/repair/repair-data/index', + 'icon' => 'ant-design:tool-outlined', ], [ 'name' => '维修设置', @@ -140,6 +155,7 @@ return [ 'app' => 'produce', 'path' => '/produce/repair/repair-setting', 'component' => '/produce/repair/repair-setting/index', + 'icon' => 'ant-design:setting-outlined', ], [ 'name' => '硬件故障描述', @@ -147,6 +163,7 @@ return [ 'app' => 'produce', 'path' => '/produce/repair/hardware-fault-description', 'component' => '/produce/repair/hardware-fault-description/index', + 'icon' => 'ant-design:bug-outlined', ], ], ], @@ -155,7 +172,7 @@ return [ 'code' => 'produce:statistics:index', 'app' => 'produce', 'path' => '/produce/statistics', - 'icon' => 'bar-chart-2', + 'icon' => 'ant-design:bar-chart-outlined', 'children' => [ [ 'name' => '月工作统计', @@ -163,6 +180,7 @@ return [ 'app' => 'produce', 'path' => '/produce/statistics/monthly', 'component' => '/produce/statistics/monthly/index', + 'icon' => 'ant-design:calendar-outlined', ], [ 'name' => '日工作统计', @@ -170,6 +188,7 @@ return [ 'app' => 'produce', 'path' => '/produce/statistics/daily', 'component' => '/produce/statistics/daily/index', + 'icon' => 'ant-design:clock-circle-outlined', ], ], ], diff --git a/backend/plugin/produce/resource/template/admin/views/produce/scan-data/index.vue b/backend/plugin/produce/resource/template/admin/views/produce/scan-data/index.vue index 082d7b1..a9b8d2c 100644 --- a/backend/plugin/produce/resource/template/admin/views/produce/scan-data/index.vue +++ b/backend/plugin/produce/resource/template/admin/views/produce/scan-data/index.vue @@ -18,5 +18,52 @@ const [BasicCrud] = useCrud({ diff --git a/backend/plugin/produce/resource/template/admin/views/produce/scan-data/schemas/index.tsx b/backend/plugin/produce/resource/template/admin/views/produce/scan-data/schemas/index.tsx index 045b17b..79c6d05 100644 --- a/backend/plugin/produce/resource/template/admin/views/produce/scan-data/schemas/index.tsx +++ b/backend/plugin/produce/resource/template/admin/views/produce/scan-data/schemas/index.tsx @@ -22,21 +22,49 @@ export const crudSchema = (): CrudSchema => { viewAuth: 'produce:scan-data:read', rowKey: 'id', searchFormSchema: { - labelWidth: '100px', + labelWidth: 0, + gutter: 0, + span: 6, + isExpand: true, + showExpandButton: false, schema: [ { - prop: 'keyword', - label: '关键字', + prop: 'LIKE_order_no', + label: '', + searchWidth: '170px', component: 'Input', componentProps: { clearable: true, - placeholder: '请输入订单号/用户编码/操作人员/备注', + placeholder: '请输入订单号', + }, + colSpan: 6, + }, + { + prop: 'LIKE_user_code', + label: '', + searchWidth: '160px', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入用户编码', + }, + colSpan: 6, + }, + { + prop: 'LIKE_operator', + label: '', + searchWidth: '180px', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入操作人员', }, colSpan: 6, }, { prop: 'process_id', - label: '工序名称', + label: '', + searchWidth: '160px', component: 'ApiSelect', componentProps: { api: '/produce/process', @@ -49,7 +77,8 @@ export const crudSchema = (): CrudSchema => { }, { prop: 'step_id', - label: '步骤名称', + label: '', + searchWidth: '160px', component: 'ApiSelect', componentProps: { api: '/produce/process-step', @@ -62,7 +91,8 @@ export const crudSchema = (): CrudSchema => { }, { prop: 'status_id', - label: '步骤状态', + label: '', + searchWidth: '160px', component: 'ApiSelect', componentProps: { api: '/produce/step-status', @@ -74,18 +104,20 @@ export const crudSchema = (): CrudSchema => { colSpan: 6, }, { - prop: 'LIKE_operator', - label: '操作人员', + prop: 'LIKE_remark', + label: '', + searchWidth: '160px', component: 'Input', componentProps: { clearable: true, - placeholder: '请输入操作人员', + placeholder: '请输入备注', }, colSpan: 6, }, { prop: 'scan_result', - label: '扫码结果', + label: '', + searchWidth: '170px', component: 'Select', componentProps: { clearable: true, @@ -99,7 +131,8 @@ export const crudSchema = (): CrudSchema => { }, { prop: 'scan_time_range', - label: '扫码时间', + label: '', + searchWidth: '280px', component: 'DatePicker', componentProps: { type: 'daterange', @@ -108,7 +141,7 @@ export const crudSchema = (): CrudSchema => { startPlaceholder: '开始日期', endPlaceholder: '结束日期', }, - colSpan: 12, + colSpan: 6, }, ], }, diff --git a/backend/plugin/produce/resource/template/admin/views/produce/statistics/daily/index.vue b/backend/plugin/produce/resource/template/admin/views/produce/statistics/daily/index.vue index 405009a..fd37abe 100644 --- a/backend/plugin/produce/resource/template/admin/views/produce/statistics/daily/index.vue +++ b/backend/plugin/produce/resource/template/admin/views/produce/statistics/daily/index.vue @@ -12,6 +12,8 @@ + + + + .produce-scan-data-page { height: 100%; + padding: 16px; + box-sizing: border-box; + background: var(--el-bg-color-page); +} + +.produce-scan-data-page :deep(.art-search-bar) { + padding: 14px 16px; + background: var(--el-bg-color); + border: 1px solid var(--el-border-color-light); + box-shadow: none; +} + +.produce-scan-data-page :deep(.art-search-bar .el-form-item) { + margin-bottom: 0; +} + +.produce-scan-data-page :deep(.art-search-bar .el-row) { + gap: 12px; +} + +.produce-scan-data-page :deep(.art-search-bar .el-col:not(.action-column)) { + flex: 0 0 var(--search-item-width); + min-width: 0; + max-width: var(--search-item-width); +} + +.produce-scan-data-page :deep(.art-search-bar .action-column) { + flex: 0 0 auto; + max-width: none; +} + +.produce-scan-data-page :deep(.art-search-bar .el-input), +.produce-scan-data-page :deep(.art-search-bar .el-select), +.produce-scan-data-page :deep(.art-search-bar .el-date-editor) { + width: 100%; +} + +.produce-scan-data-page :deep(.art-table-card) { + margin-top: 12px; +} + +@media (max-width: 640px) { + .produce-scan-data-page :deep(.art-search-bar .el-col:not(.action-column)) { + flex-basis: 100%; + min-width: 0; + max-width: 100%; + } } diff --git a/frontend/admin/src/apps/produce/views/produce/scan-data/schemas/index.tsx b/frontend/admin/src/apps/produce/views/produce/scan-data/schemas/index.tsx index 045b17b..79c6d05 100644 --- a/frontend/admin/src/apps/produce/views/produce/scan-data/schemas/index.tsx +++ b/frontend/admin/src/apps/produce/views/produce/scan-data/schemas/index.tsx @@ -22,21 +22,49 @@ export const crudSchema = (): CrudSchema => { viewAuth: 'produce:scan-data:read', rowKey: 'id', searchFormSchema: { - labelWidth: '100px', + labelWidth: 0, + gutter: 0, + span: 6, + isExpand: true, + showExpandButton: false, schema: [ { - prop: 'keyword', - label: '关键字', + prop: 'LIKE_order_no', + label: '', + searchWidth: '170px', component: 'Input', componentProps: { clearable: true, - placeholder: '请输入订单号/用户编码/操作人员/备注', + placeholder: '请输入订单号', + }, + colSpan: 6, + }, + { + prop: 'LIKE_user_code', + label: '', + searchWidth: '160px', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入用户编码', + }, + colSpan: 6, + }, + { + prop: 'LIKE_operator', + label: '', + searchWidth: '180px', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入操作人员', }, colSpan: 6, }, { prop: 'process_id', - label: '工序名称', + label: '', + searchWidth: '160px', component: 'ApiSelect', componentProps: { api: '/produce/process', @@ -49,7 +77,8 @@ export const crudSchema = (): CrudSchema => { }, { prop: 'step_id', - label: '步骤名称', + label: '', + searchWidth: '160px', component: 'ApiSelect', componentProps: { api: '/produce/process-step', @@ -62,7 +91,8 @@ export const crudSchema = (): CrudSchema => { }, { prop: 'status_id', - label: '步骤状态', + label: '', + searchWidth: '160px', component: 'ApiSelect', componentProps: { api: '/produce/step-status', @@ -74,18 +104,20 @@ export const crudSchema = (): CrudSchema => { colSpan: 6, }, { - prop: 'LIKE_operator', - label: '操作人员', + prop: 'LIKE_remark', + label: '', + searchWidth: '160px', component: 'Input', componentProps: { clearable: true, - placeholder: '请输入操作人员', + placeholder: '请输入备注', }, colSpan: 6, }, { prop: 'scan_result', - label: '扫码结果', + label: '', + searchWidth: '170px', component: 'Select', componentProps: { clearable: true, @@ -99,7 +131,8 @@ export const crudSchema = (): CrudSchema => { }, { prop: 'scan_time_range', - label: '扫码时间', + label: '', + searchWidth: '280px', component: 'DatePicker', componentProps: { type: 'daterange', @@ -108,7 +141,7 @@ export const crudSchema = (): CrudSchema => { startPlaceholder: '开始日期', endPlaceholder: '结束日期', }, - colSpan: 12, + colSpan: 6, }, ], }, diff --git a/frontend/admin/src/apps/produce/views/produce/statistics/daily/index.vue b/frontend/admin/src/apps/produce/views/produce/statistics/daily/index.vue index 405009a..fd37abe 100644 --- a/frontend/admin/src/apps/produce/views/produce/statistics/daily/index.vue +++ b/frontend/admin/src/apps/produce/views/produce/statistics/daily/index.vue @@ -12,6 +12,8 @@ + + + + { if (item.props) return item.props @@ -248,6 +261,12 @@ return props } + const getItemStyle = (item: SearchFormItem) => { + if (!item.width) return undefined + + return { '--search-item-width': item.width } + } + // 获取插槽 const getSlots = (item: SearchFormItem) => { if (!item.slots) return {} diff --git a/frontend/admin/src/components/form/types.d.ts b/frontend/admin/src/components/form/types.d.ts index 0f405ba..6688f34 100644 --- a/frontend/admin/src/components/form/types.d.ts +++ b/frontend/admin/src/components/form/types.d.ts @@ -4,6 +4,10 @@ export interface FormSchema { labelPosition?: 'left' | 'right' | 'top' gutter?: number // 栅格间隔 labelWidth?: string | number + // 每列的栅格宽度 + span?: number + // 是否始终展开所有搜索条件 + isExpand?: boolean schema?: FormItemSchema[] // 显示默认操作按钮 showDefaultActions?: boolean @@ -24,6 +28,8 @@ export interface FormSchema { } export interface FormItemSchema { labelWidth?: string | number + // 搜索栏中按内容设置的控件宽度 + searchWidth?: string // 表单项标签 label: string // 表单项属性名 diff --git a/frontend/admin/src/components/search-bar/search-bar.vue b/frontend/admin/src/components/search-bar/search-bar.vue index 7f4dabe..46ac044 100644 --- a/frontend/admin/src/components/search-bar/search-bar.vue +++ b/frontend/admin/src/components/search-bar/search-bar.vue @@ -4,6 +4,11 @@ :show-reset="formSchemaRef.showResetButton" :show-search="formSchemaRef.showSubmitButton" :show-expand="formSchemaRef.showExpandButton" + :label-position="formSchemaRef.labelPosition" + :label-width="formSchemaRef.labelWidth" + :gutter="formSchemaRef.gutter" + :span="formSchemaRef.span" + :is-expand="formSchemaRef.isExpand" :items="cItems" v-model="searchFormState" @search="handleSearch" @@ -63,6 +68,7 @@ key: item.prop, type: item.component, span: item.colSpan, + width: item.searchWidth, props: item.componentProps } }) || []