禁止变量修改上级变量和所属服务

main
expressgy 3 months ago
parent d8783898f4
commit ead6a92bd9
  1. 2
      src/main.js
  2. 21
      src/views/Auth/Env/EnvForm.vue
  3. 16
      src/views/Auth/Env/EnvPage.vue

@ -6,7 +6,7 @@ window.pino = Pino({
deb: 20,
},
browser: {
asObject: true,
asObject: false,
serialize: true
},
});

@ -3,6 +3,7 @@ import { EnvFormRulesType, EnvFormType } from '@/views/Auth/Env/DataModal.js';
import { h, onMounted, ref, watch } from 'vue';
import { ReloadOutlined, SettingOutlined } from '@ant-design/icons-vue';
import { useBaseDataStore } from '@/stores';
import AntdModalTemplate from '@/components/AntDesignVue/CustomAntDesignVue/AntdModalTemplate/index.vue';
const baseDataStore = useBaseDataStore();
defineOptions({
@ -44,29 +45,16 @@ const handleAck = () => {
if (Array.isArray(value.envVal) && value.envVal.length > 0) {
data.envVal = value.envVal.slice(-1)[0];
}
props.data.handleAck(data).then(() => {
clearInput();
}).catch(e => e);
props.data.handleAck(data).catch(e => e);
})
.catch((err) => {
formRef.value.scrollToField(err?.errorFields[0]?.name);
});
};
// !
const handleCancel = () => {
props.data.handleCancel();
clearInput();
};
// !
function clearValidate() {
formRef.value?.clearValidate();
}
// !
function clearInput() {
formRef.value.resetFields();
clearValidate();
}
// ! pid
watch(props.data.formData, (newVal, oldVal) => {
if (newVal.pid != '') {
@ -106,6 +94,7 @@ onMounted(() => {
<AFlex gap="small">
<ACascader
flex="1"
:disabled="props.data.isUpdate"
allowClear
showSearch
v-model:value="props.data.formData.pid"
@ -123,7 +112,7 @@ onMounted(() => {
<ASelect
placeholder="请选择所属服务"
ref="serviceKey"
:disabled="serviceKeyDisabled"
:disabled="serviceKeyDisabled || props.data.isUpdate"
v-model:value="props.data.formData.serviceKey"
:options="baseDataStore.state.serviceList"
:field-names="{ label: 'serviceName', value: 'serviceKey', options: 'children' }"
@ -182,7 +171,7 @@ onMounted(() => {
</AFormItem>
</AForm>
<template #footer>
<AButton type="dashed" @click="handleCancel">取消</AButton>
<AButton type="dashed" @click="props.data.handleCancel">取消</AButton>
<AckCreateAntdButton @click="handleAck" />
</template>
</AntdModalTemplate>

@ -15,14 +15,7 @@ defineOptions({
});
onMounted(() => {
window.pino.info('@1 EnvPage Mounted!');
window.pino.deb('debug@1 EnvPage Mounted!');
window.pino.error('error@1 EnvPage Mounted!');
window.pino.fatal('fatal@1 EnvPage Mounted!');
window.pino.info('info@1 EnvPage Mounted!');
window.pino.warn('warn@1 EnvPage Mounted!');
window.pino.trace('trace@1 EnvPage Mounted!');
console.log(window.pino);
window.pino.deb('@1 EnvPage Mounted!');
getPage();
if(baseDataStore.state.serviceList.length == 0){
baseDataStore.getServiceList();
@ -47,7 +40,7 @@ const formData = reactive({
//
handleAck: handleCreateAck,
//
handleCancel: clearFormData,
handleCancel: () => clearFormData(),
});
//
const tableData = reactive({
@ -93,6 +86,9 @@ async function handleUpdate(data) {
}
// @4 todo
async function handleUpdateAck(data) {
if(!data.pid){
data.pid = 0;
}
await CoreEnv.updateEnv(formData.envId, data);
Message.success('更新变量成功!');
clearFormData();
@ -114,7 +110,7 @@ watch(tableData.pageInfo, () => {
// @6
async function getPage() {
const pageInfo = {...tableData.pageInfo};
pageInfo.hierarchy = pageInfo.hierarchy.length > 0 ? pageInfo.hierarchy[0] : undefined
pageInfo.hierarchy = pageInfo.hierarchy.length > 0 ? pageInfo.hierarchy[0] : undefined;
const resd = await CoreEnv.getEnv(pageInfo);
tableData.dataSource = resd.rowData;
tableData.total = Number(resd.total);

Loading…
Cancel
Save