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

10
src/components/ServiceConfigurationActions.vue

@ -12,23 +12,23 @@
<td> <td>
<div class="inline-block ml-2 relative" v-for="actionParam in action.params" :key="actionParam.key"> <div class="inline-block ml-2 relative" v-for="actionParam in action.params" :key="actionParam.key">
<div class="action-param-label">{{ actionParam.name }}</div> <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"> :dropdownMatchSelectWidth="false">
<a-select-option :value="true">TRUE</a-select-option> <a-select-option :value="true">TRUE</a-select-option>
<a-select-option :value="false">FALSE</a-select-option> <a-select-option :value="false">FALSE</a-select-option>
</a-select> </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" /> 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" /> 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" /> v-model:value="actionParam.value" :placeholder="actionParam.name" :step="0.01" />
<a-select v-else-if="'Enum' === actionParam.type" v-model:value="actionParam.value" <a-select v-else-if="'Enum' === actionParam.type" v-model:value="actionParam.value"
:dropdownMatchSelectWidth="false"> :dropdownMatchSelectWidth="false">
<a-select-option v-for="(enumItem, enumIndex) in actionParam.options" :key="enumIndex" <a-select-option v-for="(enumItem, enumIndex) in actionParam.options" :key="enumIndex"
:value="enumItem.value">{{ enumItem.name }}</a-select-option> :value="enumItem.value">{{ enumItem.name }}</a-select-option>
</a-select> </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" /> v-model:value="actionParam.value" />
<span v-else>{{ actionParam }}</span> <span v-else>{{ actionParam }}</span>
</div> </div>

2
src/components/ServiceConfigurationParamValueEdit.vue

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

6
src/components/ServiceConfigurationParamValueObjectEdit.vue

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

2
src/utils/ApiClient.js

@ -21,7 +21,7 @@ export default class ApiClient {
// url: `/api/${name}`, // url: `/api/${name}`,
// url: `http://localhost:80/api/${name}`, // url: `http://localhost:80/api/${name}`,
//根据不同的环境配置不同的url,生产环境下使用/api/${name},开发环境下使用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 data: params
}); });
if ( !response.data.success ) { if ( !response.data.success ) {

Loading…
Cancel
Save