修改表单构建
parent
d8d1dff112
commit
4873c537ce
@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div class="hw-input" @click.stop="inputClick"
|
||||
:style="`background-color: ${(selectUuid === options.uuid) ? '#0001':'#0000'};border-color: ${(selectUuid === options.uuid) ? '#00afff':'#0000'}`">
|
||||
<tool v-if="selectUuid === options.uuid" :options="options" />
|
||||
<el-form-item :label="options.name" :required="options.required">
|
||||
<el-input-number v-model="formData[options.key || ('input-'+options.uuid)]" :disabled="options.disabled"
|
||||
:step="options.step" :min="options.min || -Infinity" :max="options.max || Infinity"
|
||||
:controls-position="options.controlsPosition?'right':'' "
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import tool from './tool.vue';
|
||||
import { inject } from 'vue';
|
||||
|
||||
defineOptions({
|
||||
name: 'hw-input-number'
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
options: Object,
|
||||
formData: Object
|
||||
});
|
||||
const { options, formData } = toRefs(props);
|
||||
const getOptions = inject('getOptions');
|
||||
|
||||
const selectUuid = inject('selectUuid');
|
||||
const getSelectUuid = inject('getSelectUuid');
|
||||
const inputClick = () => {
|
||||
getOptions(options.value);
|
||||
getSelectUuid(options.value.uuid);
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
.hw-input {
|
||||
margin: 2px;
|
||||
border: 1px solid #0000;
|
||||
position: relative;
|
||||
padding: 12px 2px 2px;
|
||||
|
||||
&:hover {
|
||||
background-color: #0001;
|
||||
border: 1px solid #00afff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<el-form-item :label="itemName">
|
||||
<el-input-number v-model="formData[keyValue]" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
|
||||
const props = defineProps({
|
||||
formData: String,
|
||||
keyValue: String,
|
||||
itemName: String
|
||||
});
|
||||
|
||||
const { formData, keyValue, itemName } = toRefs(props);
|
||||
|
||||
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
</style>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue