update:应用界面修改
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<Dialog
|
||||
v-model="visible"
|
||||
:diaTitle="`${currentRow?.id ? '编辑' : '新增'}应用`"
|
||||
:width="'25%'"
|
||||
:width="'50%'"
|
||||
:height="'70%'"
|
||||
@close="closeFun"
|
||||
show-footer
|
||||
@@ -24,6 +24,7 @@
|
||||
limit: 1,
|
||||
},
|
||||
}"
|
||||
@change="formChangeFun"
|
||||
>
|
||||
</TableForm>
|
||||
<!-- <el-form :model="appformData" labelWidth="80">
|
||||
@@ -31,7 +32,41 @@
|
||||
<UploadImg v-model="appformData.appImage" :limit-upload="true" :multiple="false" />
|
||||
</el-form-item>
|
||||
</el-form> -->
|
||||
|
||||
<el-form :model="appformData" labelWidth="80">
|
||||
<el-form-item label="命令参数">
|
||||
<BaseTable
|
||||
tableName="COMMAND_PARAM_TABLE"
|
||||
ref="baseTableRef"
|
||||
fullHeight
|
||||
:hide-pagination="true"
|
||||
>
|
||||
<template #keyCnName="{ row }">
|
||||
<el-input v-model="row.keyCnName"></el-input>
|
||||
</template>
|
||||
<template #defaultValue="{ row }">
|
||||
<el-input v-model="row.defaultValue"></el-input>
|
||||
</template>
|
||||
<template #isDisplay="{ row }">
|
||||
<el-switch
|
||||
v-model="row.isDisplay"
|
||||
inline-prompt
|
||||
active-value="Y"
|
||||
inactive-value="N"
|
||||
/>
|
||||
</template>
|
||||
<template #valueType="{ row }">
|
||||
<el-select v-model="row.valueType">
|
||||
<el-option
|
||||
v-for="item in valueTypeList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</BaseTable>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="pic-content" ref="appNameRef" v-show="appName">
|
||||
<appNameBg :app-name="appName"></appNameBg>
|
||||
</div>
|
||||
@@ -57,6 +92,7 @@ import { delayTime } from '@/utils/common';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import Dialog from '@/components/common/dialog/index.vue';
|
||||
// import UploadImg from '@/components/common/uploadImg/index.vue';
|
||||
import BaseTable from '@/components/common/table/baseTable.vue';
|
||||
|
||||
const props = defineProps(['currentAppInfo', 'tableName']);
|
||||
const emit = defineEmits(['cancel', 'submit']);
|
||||
@@ -69,9 +105,10 @@ const loading = ref(false);
|
||||
const closeFun = () => {
|
||||
emit('cancel');
|
||||
};
|
||||
|
||||
const baseTableRef = ref();
|
||||
const appformData = reactive<any>({
|
||||
appImage: '',
|
||||
commandConfigs: [],
|
||||
});
|
||||
|
||||
const submitFun = async () => {
|
||||
@@ -81,6 +118,7 @@ const submitFun = async () => {
|
||||
if (valid) {
|
||||
const fromData = tableFormRef.value.getFormDataFun();
|
||||
const appImage: any = fromData.appImage;
|
||||
fromData.commandConfigs = appformData.commandConfigs;
|
||||
// 判断是否上传了图片
|
||||
if (!appImage) {
|
||||
appName.value = fromData.appName;
|
||||
@@ -128,19 +166,75 @@ const updatePngFun = async (name: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
const getUseformDataFun = () => {
|
||||
nextTick(() => {
|
||||
const fromData = tableFormRef.value.getFormDataFun();
|
||||
const appImage = fromData.extras.find((item: any) => {
|
||||
return item.propertyName === 'appImage';
|
||||
})?.propertyValue;
|
||||
// const getUseformDataFun = () => {
|
||||
// nextTick(() => {
|
||||
// const fromData = tableFormRef.value.getFormDataFun();
|
||||
// const appImage = fromData.extras.find((item: any) => {
|
||||
// return item.propertyName === 'appImage';
|
||||
// })?.propertyValue;
|
||||
|
||||
if (appImage?.length) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
// if (appImage?.length) {
|
||||
// return true;
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
|
||||
const valueTypeList = ref<any>([
|
||||
{
|
||||
label: '共享云盘文件',
|
||||
value: 'file',
|
||||
},
|
||||
{
|
||||
label: '用户自定义输入',
|
||||
value: 'input',
|
||||
},
|
||||
]);
|
||||
|
||||
const formChangeFun = (data: any) => {
|
||||
console.log(data, 'data');
|
||||
|
||||
if (data?.key === 'hpcCommand') {
|
||||
getCommandConfigsFun(data.val);
|
||||
}
|
||||
};
|
||||
|
||||
const getCommandConfigsFun = (str: any) => {
|
||||
const params = str
|
||||
? str.split(' ').filter((item: any) => {
|
||||
return item.startsWith('%');
|
||||
})
|
||||
: [];
|
||||
|
||||
const list = params.map((item: any) => {
|
||||
return item.replace('%', '');
|
||||
});
|
||||
appformData.commandConfigs = appformData.commandConfigs.filter((item: any) => {
|
||||
return list.includes(item.keyEnName);
|
||||
});
|
||||
|
||||
const appParams = appformData.commandConfigs.map((item: any) => {
|
||||
return item.keyEnName;
|
||||
});
|
||||
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (!appParams.includes(list[i])) {
|
||||
appformData.commandConfigs.push({
|
||||
defaultValue: 'default',
|
||||
featchType: 'param',
|
||||
fileRegular: '',
|
||||
keyCnName: '',
|
||||
keyEnName: list[i],
|
||||
valueType: 'input',
|
||||
isDisplay: 'Y',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
console.log(list);
|
||||
console.log(appformData.commandConfigs);
|
||||
baseTableRef.value.setDataFun(appformData.commandConfigs);
|
||||
};
|
||||
|
||||
watch(
|
||||
@@ -149,12 +243,14 @@ watch(
|
||||
if (newVal) {
|
||||
currentRow.value = cloneDeep(newVal);
|
||||
appformData.appImage = currentRow.value?.appImage;
|
||||
appformData.commandConfigs = currentRow.value?.commandConfigs || [];
|
||||
setTimeout(() => {
|
||||
if (currentRow.value?.id) {
|
||||
tableFormRef.value.setFormDataFun(currentRow.value);
|
||||
} else {
|
||||
tableFormRef.value.resetFun();
|
||||
}
|
||||
baseTableRef.value.setDataFun(appformData.commandConfigs);
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
>
|
||||
<template #leftOptions>
|
||||
<div>
|
||||
<el-button type="primary" @click="editAppInfoFun">新增应用 </el-button>
|
||||
<el-button type="primary" @click="editAppInfoFun">新增应用</el-button>
|
||||
<el-button type="" @click="showAppUseFun">应用统计 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -283,6 +283,9 @@ const updateAppInfoFun = async (data: any) => {
|
||||
machineCode: data.machineCode,
|
||||
comment: data.comment,
|
||||
uuid: data.uuid,
|
||||
commandConfigs: data.commandConfigs,
|
||||
hpcCommand: data.hpcCommand,
|
||||
hpcGroup: 'HPC_PACK',
|
||||
// creator: 'vu0151d',
|
||||
});
|
||||
if (res && res.code === 200) {
|
||||
@@ -304,6 +307,9 @@ const updateAppInfoFun = async (data: any) => {
|
||||
comment: data.comment || '',
|
||||
creator: getUserId() || '',
|
||||
creatorName: getUserData()?.nickname || '',
|
||||
commandConfigs: data.commandConfigs,
|
||||
hpcCommand: data.hpcCommand,
|
||||
hpcGroup: 'HPC_PACK',
|
||||
};
|
||||
|
||||
const res: any = await addApplicationApi(param);
|
||||
@@ -357,7 +363,7 @@ const timer: any = ref(null);
|
||||
const startAppFun = async (data: any) => {
|
||||
await getdeviceuuidFun();
|
||||
|
||||
const uuid = localStorage.getItem('USER_UUID') ;
|
||||
const uuid = localStorage.getItem('USER_UUID');
|
||||
if (uuid) {
|
||||
const res: any = await execApi({
|
||||
path: data.appPath,
|
||||
|
||||
@@ -498,7 +498,7 @@ const submitFun = async () => {
|
||||
});
|
||||
}
|
||||
|
||||
if (props.taskInfo.exeStatus != 8) {
|
||||
if (props.taskInfo.exeStatus != TASK_PROCESS_STATUS.CLOSED_LOOP) {
|
||||
if (enableConfigByTenant([TENANT_ENUM.LYRIC])) {
|
||||
await updateTaskExeStatusFun();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user