Browse Source

优化数据结构

master
zhaohe 8 months ago
parent
commit
543af22830
  1. 4
      src/components/ServiceConfigurationActionParamFile.vue
  2. 10
      src/components/ServiceConfigurationActions.vue
  3. 2
      src/components/ServiceConfigurationParamValueEdit.vue
  4. 6
      src/components/ServiceConfigurationParamValueObjectEdit.vue
  5. 2
      src/utils/ApiClient.js

4
src/components/ServiceConfigurationActionParamFile.vue

@ -1,5 +1,5 @@
<template>
<a-button @click="actionSelectFile">选择文件</a-button>
<a-button @click="actionSelectFile">{{ buttonText }}</a-button>
<input ref="file" type="file" class="hidden" @change="actionFileChange"/>
</template>
<script setup>
@ -12,6 +12,7 @@ const props = defineProps({
});
/** @var {Element} */
const file=ref(null);
const buttonText = ref('选择文件'); // Initialize button text
// select file
function actionSelectFile() {
@ -26,6 +27,7 @@ async function actionFileChange( event ) {
let content = await fileToBase64(event.target.files[0]);
emits('update:value', content);
emits('change');
buttonText.value = event.target.files[0].name; // Update button text
}
// convert file to base64

10
src/components/ServiceConfigurationActions.vue

@ -12,23 +12,23 @@
<td>
<div class="inline-block ml-2 relative" v-for="actionParam in action.params" :key="actionParam.key">
<div class="action-param-label">{{ actionParam.name }}</div>
<a-select v-if="'java.lang.Boolean' === actionParam.type" v-model:value="actionParam.value"
<a-select v-if="'Boolean' === actionParam.type" v-model:value="actionParam.value"
:dropdownMatchSelectWidth="false">
<a-select-option :value="true">TRUE</a-select-option>
<a-select-option :value="false">FALSE</a-select-option>
</a-select>
<a-input v-else-if="'java.lang.String' === actionParam.type" class="w-24"
<a-input v-else-if="'String' === actionParam.type" class="w-24"
v-model:value="actionParam.value" :placeholder="actionParam.name" />
<a-input-number v-else-if="'java.lang.Integer' === actionParam.type" class="w-24"
<a-input-number v-else-if="'Integer' === actionParam.type" class="w-24"
v-model:value="actionParam.value" :placeholder="actionParam.name" />
<a-input-number v-else-if="'java.lang.Double' === actionParam.type" class="w-24"
<a-input-number v-else-if="'Double' === actionParam.type" class="w-24"
v-model:value="actionParam.value" :placeholder="actionParam.name" :step="0.01" />
<a-select v-else-if="'Enum' === actionParam.type" v-model:value="actionParam.value"
:dropdownMatchSelectWidth="false">
<a-select-option v-for="(enumItem, enumIndex) in actionParam.options" :key="enumIndex"
:value="enumItem.value">{{ enumItem.name }}</a-select-option>
</a-select>
<service-configuration-action-param-file v-else-if="'a8k.utils.HardwareParamFile' === actionParam.type"
<service-configuration-action-param-file v-else-if="'ExtUIFile' === actionParam.type"
v-model:value="actionParam.value" />
<span v-else>{{ actionParam }}</span>
</div>

2
src/components/ServiceConfigurationParamValueEdit.vue

@ -1,7 +1,7 @@
<template>
<div>
<!-- integer -->
<a-input-number v-if="'java.lang.Integer' === props.param.type"
<a-input-number v-if="'Integer' === props.param.type"
class="!w-full"
v-model:value="value"
@change="actionValueUpdate"

6
src/components/ServiceConfigurationParamValueObjectEdit.vue

@ -11,13 +11,13 @@
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'value'">
<!-- Integer -->
<a-input-number v-if="'java.lang.Integer' === record.type"
<a-input-number v-if="'Integer' === record.type"
size="small" class="w-full !border-none"
v-model:value="record.value"
></a-input-number>
<!-- Double -->
<a-input-number v-if="'java.lang.Double' === record.type"
<a-input-number v-if="'Double' === record.type"
size="small" class="w-full !border-none" :step="0.01"
v-model:value="record.value"
></a-input-number>
@ -60,7 +60,7 @@ async function mounted() {
async function setupTableData(structClassName, path=[]) {
let classPath = `${0===path.length ? '' : path.join('.')+'.'}${structClassName}`;
console.log(`setup for : ${classPath}`);
let baseTypes = ['java.lang.Integer','java.lang.Double'];
let baseTypes = ['Integer','Double'];
let client = ApiClient.getClient();
try {

2
src/utils/ApiClient.js

@ -21,7 +21,7 @@ export default class ApiClient {
// url: `/api/${name}`,
// url: `http://localhost:80/api/${name}`,
//根据不同的环境配置不同的url,生产环境下使用/api/${name},开发环境下使用http://localhost:80/api/${name}
url: process.env.NODE_ENV === 'production' ? `/api/${name}` : `http://localhost:80/api/${name}`,
url: process.env.NODE_ENV === 'production' ? `/api/${name}` : `http://localhost:8080/api/${name}`,
data: params
});
if ( !response.data.success ) {

Loading…
Cancel
Save