|
|
@@ -14,6 +14,7 @@
|
|
|
<el-button type="primary" @click="loadList">查询</el-button>
|
|
|
<el-button @click="resetQuery">重置</el-button>
|
|
|
<el-button type="success" @click="openCreate">新增</el-button>
|
|
|
+ <el-button @click="openDictConfig">配置字典</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
@@ -87,7 +88,17 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="物料属性" prop="ownerApplication">
|
|
|
- <el-input v-model="form.ownerApplication" />
|
|
|
+ <el-select
|
|
|
+ v-model="form.ownerApplication"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ allow-create
|
|
|
+ default-first-option
|
|
|
+ placeholder="字典选择或手工输入"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option v-for="opt in materialKindOptions" :key="opt.value" :label="opt.label" :value="opt.label" />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
@@ -117,6 +128,17 @@
|
|
|
<el-button type="primary" :loading="saving" @click="submitForm">保存</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog v-model="dictDialogVisible" title="配置物料属性字典" width="620px" destroy-on-close>
|
|
|
+ <DictDataMaintainPanel
|
|
|
+ :dict-code="MATERIAL_KIND_DICT_CODE"
|
|
|
+ title="物料属性选项(线材 / 钣金件 / 半导体 / 芯片,可自行增删)"
|
|
|
+ @changed="onDictChanged"
|
|
|
+ />
|
|
|
+ <template #footer>
|
|
|
+ <el-button type="primary" @click="dictDialogVisible = false">关闭</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</AidopDemoShell>
|
|
|
</template>
|
|
|
|
|
|
@@ -125,13 +147,19 @@ 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 DictDataMaintainPanel from '../sales/components/DictDataMaintainPanel.vue';
|
|
|
import {
|
|
|
+ loadDictOptions,
|
|
|
loadOrgList,
|
|
|
s0CategoryLeadTimesApi,
|
|
|
+ type OptionItem,
|
|
|
type OrgOption,
|
|
|
type S0CategoryLeadTimeRow,
|
|
|
type S0CategoryLeadTimeUpsert,
|
|
|
} from '../api/s0SupplyApi';
|
|
|
+
|
|
|
+// 物料属性字典编码(品类采购前置期专用,可后台维护,见 S0DictTypeSeedData)
|
|
|
+const MATERIAL_KIND_DICT_CODE = 's0_category_material_kind';
|
|
|
import { applyDefaultOrgScopeForCreate, normalizeOrgScopeForSubmit, preserveOrgScopeForEdit, shouldClearFactoryOnCompanyChange } from '../composables/useS0MfgOrgScope';
|
|
|
|
|
|
const route = useRoute();
|
|
|
@@ -158,6 +186,24 @@ const formRef = ref<FormInstance>();
|
|
|
const companyOptions = ref<OrgOption[]>([]);
|
|
|
const factoryOptions = ref<OrgOption[]>([]);
|
|
|
|
|
|
+// 物料属性下拉选项(来自可后台维护的字典 s0_category_material_kind)
|
|
|
+const materialKindOptions = ref<OptionItem[]>([]);
|
|
|
+// 配置字典弹窗
|
|
|
+const dictDialogVisible = ref(false);
|
|
|
+
|
|
|
+async function loadMaterialKindOptions() {
|
|
|
+ materialKindOptions.value = await loadDictOptions(MATERIAL_KIND_DICT_CODE);
|
|
|
+}
|
|
|
+
|
|
|
+function openDictConfig() {
|
|
|
+ dictDialogVisible.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+// 字典项在配置面板里增改停用后,重载下拉,保证选项即时同步
|
|
|
+function onDictChanged() {
|
|
|
+ void loadMaterialKindOptions();
|
|
|
+}
|
|
|
+
|
|
|
const form = reactive<S0CategoryLeadTimeUpsert>({
|
|
|
companyRefId: undefined,
|
|
|
factoryRefId: undefined,
|
|
|
@@ -340,7 +386,7 @@ function onDelete(row: S0CategoryLeadTimeRow) {
|
|
|
}
|
|
|
|
|
|
onMounted(async () => {
|
|
|
- await loadOptions();
|
|
|
+ await Promise.all([loadOptions(), loadMaterialKindOptions()]);
|
|
|
await loadList();
|
|
|
});
|
|
|
</script>
|