|
|
@@ -4,16 +4,6 @@
|
|
|
<el-form-item label="关键字">
|
|
|
<el-input v-model="query.keyword" clearable placeholder="路线/物料/工序/工作中心" style="width: 200px" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="公司">
|
|
|
- <el-select v-model="query.companyRefId" clearable filterable placeholder="全部" style="width: 150px">
|
|
|
- <el-option v-for="item in companyOptions" :key="item.id" :label="item.name || item.code || `${item.id}`" :value="item.id" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="工厂">
|
|
|
- <el-select v-model="query.factoryRefId" clearable filterable placeholder="全部" style="width: 150px">
|
|
|
- <el-option v-for="item in queryFactories" :key="item.id" :label="item.name || item.code || `${item.id}`" :value="item.id" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="启用">
|
|
|
<el-select v-model="query.isEnabled" clearable placeholder="全部" style="width: 90px">
|
|
|
<el-option label="启用" :value="true" />
|
|
|
@@ -28,12 +18,6 @@
|
|
|
</el-form>
|
|
|
|
|
|
<el-table :data="rows" v-loading="loading" border stripe size="small" max-height="calc(100vh - 260px)">
|
|
|
- <el-table-column label="公司" width="110" show-overflow-tooltip>
|
|
|
- <template #default="{ row }">{{ companyName(row.companyRefId) }}</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="工厂" width="90" show-overflow-tooltip>
|
|
|
- <template #default="{ row }">{{ factoryName(row.factoryRefId) }}</template>
|
|
|
- </el-table-column>
|
|
|
<el-table-column prop="routeCode" label="工艺路线编码" width="110" show-overflow-tooltip />
|
|
|
<el-table-column prop="routeName" label="工艺路线名称" width="140" show-overflow-tooltip />
|
|
|
<el-table-column prop="materialCode" label="物料编码" width="110" show-overflow-tooltip />
|
|
|
@@ -91,20 +75,6 @@
|
|
|
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="920px" destroy-on-close @closed="resetForm">
|
|
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px" class="routing-form">
|
|
|
<el-row :gutter="12">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="公司" prop="companyRefId">
|
|
|
- <el-select v-model="form.companyRefId" filterable style="width: 100%" @change="onFormOrgChange">
|
|
|
- <el-option v-for="item in companyOptions" :key="item.id" :label="item.name || item.code || `${item.id}`" :value="item.id" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="工厂" prop="factoryRefId">
|
|
|
- <el-select v-model="form.factoryRefId" filterable style="width: 100%" @change="onFormOrgChange">
|
|
|
- <el-option v-for="item in formFactories" :key="item.id" :label="item.name || item.code || `${item.id}`" :value="item.id" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="排序" prop="sortNo">
|
|
|
<el-input-number v-model="form.sortNo" :min="0" :step="1" style="width: 100%" />
|
|
|
@@ -191,37 +161,21 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="aidopS0MfgRouting">
|
|
|
-import { computed, onMounted, reactive, ref, watch } from 'vue';
|
|
|
+import { computed, onMounted, reactive, ref } from 'vue';
|
|
|
import { useRoute } from 'vue-router';
|
|
|
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus';
|
|
|
import AidopDemoShell from '../../components/AidopDemoShell.vue';
|
|
|
-import { useS0MfgOrgScope } from '../composables/useS0MfgOrgScope';
|
|
|
import { s0MfgRoutingOpDetailsApi, type S0MfgRoutingOpDetailRow, type S0MfgRoutingOpDetailUpsert } from '../api/s0ManufacturingApi';
|
|
|
|
|
|
const route = useRoute();
|
|
|
const pageTitle = computed(() => (route.meta?.title as string) || '标准工艺路线列表');
|
|
|
type Row = Record<string, any>;
|
|
|
|
|
|
-const { companyOptions, factoryOptions, loadOrgs, factoriesForCompany } = useS0MfgOrgScope();
|
|
|
-
|
|
|
-function companyName(refId?: string | number | null): string {
|
|
|
- if (refId == null || refId === '') return '';
|
|
|
- const hit = companyOptions.value.find((o) => o.id === String(refId));
|
|
|
- return hit ? (hit.name || hit.code || String(hit.id)) : `未关联组织(历史值:${refId})`;
|
|
|
-}
|
|
|
-
|
|
|
-function factoryName(refId?: string | number | null): string {
|
|
|
- if (refId == null || refId === '') return '';
|
|
|
- const hit = factoryOptions.value.find((o) => o.id === String(refId));
|
|
|
- return hit ? (hit.name || hit.code || String(hit.id)) : `未关联组织(历史值:${refId})`;
|
|
|
-}
|
|
|
-const queryFactories = computed(() => factoriesForCompany(query.companyRefId));
|
|
|
-const formFactories = computed(() => factoriesForCompany(form.companyRefId));
|
|
|
+// 行级工艺路线(legacy RoutingOpDetail 复刻)不建模组织作用域:全表 company/factory 多为 0,
|
|
|
+// 故页面不展示公司/工厂筛选与列;company/factory 仅在写回 DTO 时原样透传,保留既有 scope。
|
|
|
|
|
|
const query = reactive({
|
|
|
keyword: '',
|
|
|
- companyRefId: undefined as string | undefined,
|
|
|
- factoryRefId: undefined as string | undefined,
|
|
|
isEnabled: undefined as boolean | undefined,
|
|
|
page: 1,
|
|
|
pageSize: 20,
|
|
|
@@ -274,32 +228,13 @@ function emptyForm() {
|
|
|
|
|
|
const form = reactive(emptyForm());
|
|
|
|
|
|
-watch(
|
|
|
- () => query.companyRefId,
|
|
|
- () => {
|
|
|
- if (!queryFactories.value.some((x) => x.id === query.factoryRefId)) query.factoryRefId = undefined;
|
|
|
- },
|
|
|
-);
|
|
|
-watch(
|
|
|
- () => form.companyRefId,
|
|
|
- () => {
|
|
|
- if (!formFactories.value.some((x) => x.id === form.factoryRefId)) form.factoryRefId = undefined;
|
|
|
- },
|
|
|
-);
|
|
|
-
|
|
|
const rules: FormRules = {
|
|
|
- companyRefId: [{ required: true, message: '请选择公司', trigger: 'change' }],
|
|
|
- factoryRefId: [{ required: true, message: '请选择工厂', trigger: 'change' }],
|
|
|
routeCode: [{ required: true, message: '请填写路线编码', trigger: 'blur' }],
|
|
|
routeName: [{ required: true, message: '请填写路线名称', trigger: 'blur' }],
|
|
|
materialCode: [{ required: true, message: '请填写物料编码', trigger: 'blur' }],
|
|
|
operationCode: [{ required: true, message: '请填写工序编码', trigger: 'blur' }],
|
|
|
};
|
|
|
|
|
|
-function onFormOrgChange() {
|
|
|
- /* 行级页无远程物料搜索 */
|
|
|
-}
|
|
|
-
|
|
|
async function loadList() {
|
|
|
loading.value = true;
|
|
|
try {
|
|
|
@@ -307,8 +242,6 @@ async function loadList() {
|
|
|
page: query.page,
|
|
|
pageSize: query.pageSize,
|
|
|
keyword: query.keyword || undefined,
|
|
|
- companyRefId: query.companyRefId,
|
|
|
- factoryRefId: query.factoryRefId,
|
|
|
isEnabled: query.isEnabled,
|
|
|
});
|
|
|
rows.value = data.list as Row[];
|
|
|
@@ -323,8 +256,6 @@ async function loadList() {
|
|
|
|
|
|
function resetQuery() {
|
|
|
query.keyword = '';
|
|
|
- query.companyRefId = undefined;
|
|
|
- query.factoryRefId = undefined;
|
|
|
query.isEnabled = undefined;
|
|
|
query.page = 1;
|
|
|
void loadList();
|
|
|
@@ -337,6 +268,7 @@ function resetForm() {
|
|
|
}
|
|
|
|
|
|
function rowToForm(row: S0MfgRoutingOpDetailRow) {
|
|
|
+ // company/factory 不在 UI 展示,仅原样回填以便写回时透传,保留既有 scope。
|
|
|
Object.assign(form, {
|
|
|
companyRefId: row.companyRefId,
|
|
|
factoryRefId: row.factoryRefId,
|
|
|
@@ -469,7 +401,6 @@ function toggleEnabled(row: Row) {
|
|
|
}
|
|
|
|
|
|
onMounted(async () => {
|
|
|
- await loadOrgs();
|
|
|
await loadList();
|
|
|
});
|
|
|
</script>
|