|
|
@@ -57,7 +57,7 @@ import { computed, onMounted, reactive, ref, watch } 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 { useS0MfgOrgScope, getDefaultS0OrgScope } from '../composables/useS0MfgOrgScope';
|
|
|
import { s0MfgSopFileTypesApi } from '../api/s0ManufacturingApi';
|
|
|
|
|
|
const route = useRoute();
|
|
|
@@ -114,13 +114,23 @@ const rules: FormRules = {
|
|
|
descr: [{ required: true, message: '请填写描述', trigger: 'blur' }],
|
|
|
};
|
|
|
|
|
|
+// 列表按工厂域(domain)查询:接口必传 Domain。查询栏不暴露工厂选择,
|
|
|
+// 统一由系统按 S0 示范组织默认化(与新增/编辑归属同口径,复用 getDefaultS0OrgScope)。
|
|
|
+function applyDefaultQueryScope() {
|
|
|
+ const d = getDefaultS0OrgScope(companyOptions.value, factoryOptions.value);
|
|
|
+ query.companyRefId = d.companyRefId;
|
|
|
+ query.factoryRefId = d.factoryRefId;
|
|
|
+}
|
|
|
+
|
|
|
async function loadList() {
|
|
|
loading.value = true;
|
|
|
try {
|
|
|
const domain = resolveDomain(query.factoryRefId);
|
|
|
if (!domain) {
|
|
|
+ // 未解析出工厂域(默认组织缺失等):不静默失败,给出可见提示
|
|
|
rows.value = [];
|
|
|
total.value = 0;
|
|
|
+ ElMessage.warning('未解析到默认工厂域(S0 示范工厂),请检查 S0 组织配置');
|
|
|
return;
|
|
|
}
|
|
|
const data = await s0MfgSopFileTypesApi.list({
|
|
|
@@ -141,9 +151,9 @@ async function loadList() {
|
|
|
|
|
|
function resetQuery() {
|
|
|
query.keyword = '';
|
|
|
- query.companyRefId = undefined;
|
|
|
- query.factoryRefId = undefined;
|
|
|
query.page = 1;
|
|
|
+ // 重置后恢复默认工厂/域,避免清空导致列表不发请求
|
|
|
+ applyDefaultQueryScope();
|
|
|
void loadList();
|
|
|
}
|
|
|
|
|
|
@@ -205,6 +215,8 @@ function onDelete(row: Row) {
|
|
|
|
|
|
onMounted(async () => {
|
|
|
await loadOrgs();
|
|
|
+ // 组织加载完成后按 S0 示范组织默认化查询归属,确保首屏即发列表请求
|
|
|
+ applyDefaultQueryScope();
|
|
|
await loadList();
|
|
|
});
|
|
|
</script>
|