Showing
14 changed files
with
134 additions
and
41 deletions
| ... | ... | @@ -42,12 +42,12 @@ async function genreateIcon() { | 
| 42 | 42 | |
| 43 | 43 | const iconNameList = Array.from(string.matchAll(groupReg)).map(([string]) => { | 
| 44 | 44 | const [, , name] = string.match(getIdReg) || []; | 
| 45 | - return name; | |
| 45 | + return name.replace('iconfont-', ''); | |
| 46 | 46 | }); | 
| 47 | 47 | |
| 48 | 48 | await fs.writeFileSync( | 
| 49 | 49 | join(output, outputFileName), | 
| 50 | - `export default ${JSON.stringify({ icons: iconNameList }, null, 2)}` | |
| 50 | + `export default ${JSON.stringify({ prefix: 'iconfont', icons: iconNameList }, null, 2)}` | |
| 51 | 51 | ); | 
| 52 | 52 | |
| 53 | 53 | global.console.log( | ... | ... | 
| ... | ... | @@ -32,6 +32,7 @@ import ApiRadioGroup from './components/ApiRadioGroup.vue'; | 
| 32 | 32 | import JAddInput from './externalCompns/components/JAddInput.vue'; | 
| 33 | 33 | import { JEasyCron } from './externalCompns/components/JEasyCron'; | 
| 34 | 34 | import ColorPicker from './components/ColorPicker.vue'; | 
| 35 | +import IconDrawer from './components/IconDrawer.vue'; | |
| 35 | 36 | |
| 36 | 37 | const componentMap = new Map<ComponentType, Component>(); | 
| 37 | 38 | |
| ... | ... | @@ -71,6 +72,7 @@ componentMap.set('Upload', BasicUpload); | 
| 71 | 72 | componentMap.set('JAddInput', JAddInput); | 
| 72 | 73 | componentMap.set('JEasyCron', JEasyCron); | 
| 73 | 74 | componentMap.set('ColorPicker', ColorPicker); | 
| 75 | +componentMap.set('IconDrawer', IconDrawer); | |
| 74 | 76 | |
| 75 | 77 | export function add(compName: ComponentType, component: Component) { | 
| 76 | 78 | componentMap.set(compName, component); | ... | ... | 
| 1 | +<script lang="ts" setup> | |
| 2 | + import { BasicDrawer, useDrawer, useDrawerInner } from '/@/components/Drawer'; | |
| 3 | + import IconData from '/@/components/Icon/data/iconfont.data'; | |
| 4 | + import { SvgIcon } from '/@/components/Icon'; | |
| 5 | + import { computed } from '@vue/reactivity'; | |
| 6 | + import { onMounted, unref } from 'vue'; | |
| 7 | + | |
| 8 | + const props = defineProps<{ | |
| 9 | + value?: string; | |
| 10 | + color?: string; | |
| 11 | + }>(); | |
| 12 | + const emit = defineEmits(['update:value']); | |
| 13 | + const iconList = IconData.icons; | |
| 14 | + const [register, { openDrawer, closeDrawer }] = useDrawer(); | |
| 15 | + const getIcon = computed(() => { | |
| 16 | + return props.value || 'temperature'; | |
| 17 | + }); | |
| 18 | + | |
| 19 | + const getColor = computed(() => { | |
| 20 | + return props.color || '#377DFF'; | |
| 21 | + }); | |
| 22 | + | |
| 23 | + const handleOpenDrawer = () => { | |
| 24 | + openDrawer(); | |
| 25 | + }; | |
| 26 | + | |
| 27 | + const handleClick = (icon: string) => { | |
| 28 | + emit('update:value', icon); | |
| 29 | + closeDrawer(); | |
| 30 | + }; | |
| 31 | + | |
| 32 | + onMounted(() => { | |
| 33 | + emit('update:value', unref(getIcon)); | |
| 34 | + }); | |
| 35 | +</script> | |
| 36 | + | |
| 37 | +<template> | |
| 38 | + <SvgIcon | |
| 39 | + :name="getIcon" | |
| 40 | + :icon="getIcon" | |
| 41 | + prefix="iconfont" | |
| 42 | + class="cursor-pointer !w-6 !h-6" | |
| 43 | + :style="{ color: getColor }" | |
| 44 | + @click="handleOpenDrawer" | |
| 45 | + /> | |
| 46 | + <BasicDrawer @register="register" v-bind="$attrs" title="选择图标" width="300px"> | |
| 47 | + <section class="flex flex-wrap justify-start"> | |
| 48 | + <SvgIcon | |
| 49 | + class="!h-6 cursor-pointer mb-3" | |
| 50 | + style="flex: 0 0 25%" | |
| 51 | + v-for="item in iconList" | |
| 52 | + :key="item" | |
| 53 | + :icon="item" | |
| 54 | + :name="item" | |
| 55 | + prefix="iconfont" | |
| 56 | + @click="handleClick(item)" | |
| 57 | + /> | |
| 58 | + </section> | |
| 59 | + </BasicDrawer> | |
| 60 | +</template> | |
| 61 | + | |
| 62 | +<style scoped></style> | ... | ... | 
| 1 | 1 | export default { | 
| 2 | - icons: [ | |
| 3 | - 'iconfont-offline', | |
| 4 | - 'iconfont-online', | |
| 5 | - 'iconfont-wind-speed', | |
| 6 | - 'iconfont-temperature', | |
| 7 | - 'iconfont-CO2', | |
| 8 | - 'iconfont-wind-speed-1', | |
| 9 | - ], | |
| 2 | + prefix: 'iconfont', | |
| 3 | + icons: ['offline', 'online', 'wind-speed', 'temperature', 'CO2', 'wind-speed-1'], | |
| 10 | 4 | }; | ... | ... | 
| ... | ... | @@ -7,8 +7,11 @@ | 
| 7 | 7 | import { ref, unref } from 'vue'; | 
| 8 | 8 | import VisualOptionsModal from './VisualOptionsModal.vue'; | 
| 9 | 9 | import { useModal } from '/@/components/Modal'; | 
| 10 | + import { buildUUID } from '/@/utils/uuid'; | |
| 10 | 11 | |
| 11 | - const dataSource = ref([{ id: 1 }]); | |
| 12 | + const props = defineProps(); | |
| 13 | + | |
| 14 | + const dataSource = ref([{ id: 'string' }]); | |
| 12 | 15 | |
| 13 | 16 | const [basicRegister, basicMethod] = useForm({ | 
| 14 | 17 | schemas: basicSchema, | 
| ... | ... | @@ -48,7 +51,7 @@ | 
| 48 | 51 | |
| 49 | 52 | const handleAdd = () => { | 
| 50 | 53 | unref(dataSource).push({ | 
| 51 | - id: Math.random(), | |
| 54 | + id: buildUUID(), | |
| 52 | 55 | }); | 
| 53 | 56 | }; | 
| 54 | 57 | </script> | 
| ... | ... | @@ -70,7 +73,7 @@ | 
| 70 | 73 | <CopyOutlined @click="handleCopy(item)" class="cursor-pointer text-lg" /> | 
| 71 | 74 | </Tooltip> | 
| 72 | 75 | <Tooltip title="设置"> | 
| 73 | - <SettingOutlined @click="handleSetting(item)" class="cursor-pointer text-lg" /> | |
| 76 | + <SettingOutlined @click="handleSetting()" class="cursor-pointer text-lg" /> | |
| 74 | 77 | </Tooltip> | 
| 75 | 78 | <Tooltip title="删除"> | 
| 76 | 79 | <DeleteOutlined @click="handleDelete(item)" class="cursor-pointer text-lg" /> | ... | ... | 
| 1 | 1 | <script lang="ts" setup> | 
| 2 | 2 | import { Tabs } from 'ant-design-vue'; | 
| 3 | - import { ref } from 'vue'; | |
| 4 | 3 | import BasicModal from '/@/components/Modal/src/BasicModal.vue'; | 
| 5 | 4 | import BasicConfiguration from './BasicConfiguration.vue'; | 
| 6 | 5 | import VisualConfiguration from './VisualConfiguration.vue'; | 
| 7 | - import VisualOptionsModal from './VisualOptionsModal.vue'; | |
| 8 | - const activeKey = ref('1'); | |
| 6 | + import { ref } from 'vue'; | |
| 7 | + | |
| 8 | + const componentId = ref(''); | |
| 9 | + | |
| 10 | + interface SettingOption { | |
| 11 | + color?: string; | |
| 12 | + } | |
| 13 | + | |
| 14 | + const handleSettingUpdate = (value: SettingOption) => {}; | |
| 9 | 15 | </script> | 
| 10 | 16 | |
| 11 | 17 | <template> | 
| 12 | 18 | <BasicModal v-bind="$attrs" title="自定义组件" width="70%"> | 
| 13 | 19 | <section> | 
| 14 | - <Tabs type="card" v-model:activeKey="activeKey"> | |
| 20 | + <Tabs type="card"> | |
| 15 | 21 | <Tabs.TabPane key="1" tab="基础配置"> | 
| 16 | - <BasicConfiguration /> | |
| 22 | + <BasicConfiguration @change="handleSettingUpdate" /> | |
| 17 | 23 | </Tabs.TabPane> | 
| 18 | 24 | <Tabs.TabPane key="2" tab="可视化配置"> | 
| 19 | - <VisualConfiguration /> | |
| 20 | - </Tabs.TabPane> | |
| 21 | - <Tabs.TabPane key="3" tab="可视化选项"> | |
| 22 | - <VisualOptionsModal /> | |
| 25 | + <VisualConfiguration v-model:value="componentId" /> | |
| 23 | 26 | </Tabs.TabPane> | 
| 24 | 27 | </Tabs> | 
| 25 | 28 | </section> | ... | ... | 
| 1 | 1 | <script lang="ts" setup> | 
| 2 | 2 | import { Tabs, List } from 'ant-design-vue'; | 
| 3 | - import { ref } from 'vue'; | |
| 4 | 3 | import VisualWidgetSelect from './VisualWidgetSelect.vue'; | 
| 5 | 4 | import TextComponent from '../../components/TextComponent/TextComponent.vue'; | 
| 6 | 5 | import { textComponentConfig } from '../../components/TextComponent/config'; | 
| 7 | - const checkedId = ref('1'); | |
| 6 | + const props = defineProps<{ | |
| 7 | + value: string; | |
| 8 | + }>(); | |
| 9 | + const emit = defineEmits(['update:value']); | |
| 8 | 10 | |
| 9 | 11 | const handleCheck = (checked: string) => { | 
| 10 | - checkedId.value = checked; | |
| 12 | + emit('update:value', checked); | |
| 11 | 13 | }; | 
| 12 | 14 | </script> | 
| 13 | 15 | |
| ... | ... | @@ -15,11 +17,14 @@ | 
| 15 | 17 | <section> | 
| 16 | 18 | <Tabs> | 
| 17 | 19 | <Tabs.TabPane key="1" tab="文本组件"> | 
| 18 | - <List :grid="{ gutter: 10, column: 3 }" :data-source="textComponentConfig"> | |
| 20 | + <List | |
| 21 | + :grid="{ gutter: 10, column: 3, xs: 3, sm: 3, md: 3, lg: 3, xl: 3, xxl: 3 }" | |
| 22 | + :data-source="textComponentConfig" | |
| 23 | + > | |
| 19 | 24 | <template #renderItem="{ item }"> | 
| 20 | 25 | <List.Item> | 
| 21 | 26 | <VisualWidgetSelect | 
| 22 | - :checked-id="checkedId" | |
| 27 | + :checked-id="props.value" | |
| 23 | 28 | :control-id="item.id" | 
| 24 | 29 | @change="handleCheck" | 
| 25 | 30 | > | ... | ... | 
| 1 | 1 | <script lang="ts" setup> | 
| 2 | - import { modeOne } from '../config/visualOptions'; | |
| 2 | + import { modeOne, modeTwo, modeThree, modeFour } from '../config/visualOptions'; | |
| 3 | 3 | import { useForm, BasicForm } from '/@/components/Form'; | 
| 4 | 4 | import { BasicModal, useModalInner } from '/@/components/Modal'; | 
| 5 | + | |
| 5 | 6 | const [registerForm, method] = useForm({ | 
| 6 | - schemas: modeOne, | |
| 7 | + schemas: modeTwo, | |
| 7 | 8 | showActionButtonGroup: false, | 
| 8 | 9 | labelWidth: 120, | 
| 9 | 10 | baseColProps: { | 
| ... | ... | @@ -11,17 +12,21 @@ | 
| 11 | 12 | }, | 
| 12 | 13 | }); | 
| 13 | 14 | |
| 14 | - const [registerModal, { closeModal }] = useModalInner(); | |
| 15 | + const [register, { closeModal }] = useModalInner(); | |
| 15 | 16 | |
| 16 | 17 | const handleGetValue = () => { | 
| 17 | 18 | const value = method.getFieldsValue(); | 
| 18 | 19 | console.log(value); | 
| 19 | 20 | }; | 
| 21 | + | |
| 22 | + const handleClose = () => { | |
| 23 | + handleGetValue(); | |
| 24 | + closeModal(); | |
| 25 | + }; | |
| 20 | 26 | </script> | 
| 21 | 27 | |
| 22 | 28 | <template> | 
| 23 | - <BasicModal v-bind="$attrs" @register="registerModal" title="" width="60%"> | |
| 29 | + <BasicModal v-bind="$attrs" @register="register" @ok="handleClose" title="选项" width="60%"> | |
| 24 | 30 | <BasicForm @register="registerForm" /> | 
| 25 | - <button @click="handleGetValue">啊按钮</button> | |
| 26 | 31 | </BasicModal> | 
| 27 | 32 | </template> | ... | ... | 
| 1 | +import { getOrganizationList } from '/@/api/system/system'; | |
| 1 | 2 | import { FormSchema } from '/@/components/Form'; | 
| 2 | 3 | |
| 3 | 4 | export const basicSchema: FormSchema[] = [ | 
| ... | ... | @@ -16,11 +17,19 @@ export const basicSchema: FormSchema[] = [ | 
| 16 | 17 | export const dataSourceSchema: FormSchema[] = [ | 
| 17 | 18 | { | 
| 18 | 19 | field: 'org', | 
| 19 | - component: 'TreeSelect', | |
| 20 | + component: 'ApiTreeSelect', | |
| 20 | 21 | label: '组织', | 
| 21 | 22 | colProps: { span: 6 }, | 
| 22 | - componentProps: { | |
| 23 | - placeholder: '请选择组织', | |
| 23 | + componentProps() { | |
| 24 | + return { | |
| 25 | + placeholder: '请选择组织', | |
| 26 | + api: async () => { | |
| 27 | + const data = await getOrganizationList(); | |
| 28 | + return data; | |
| 29 | + }, | |
| 30 | + | |
| 31 | + onChange() {}, | |
| 32 | + }; | |
| 24 | 33 | }, | 
| 25 | 34 | }, | 
| 26 | 35 | { | ... | ... | 
| ... | ... | @@ -29,7 +29,7 @@ export const modeOne: FormSchema[] = [ | 
| 29 | 29 | |
| 30 | 30 | export const modeTwo: FormSchema[] = [ | 
| 31 | 31 | { | 
| 32 | - field: visualOptionField.UNIT, | |
| 32 | + field: visualOptionField.FONT_COLOR, | |
| 33 | 33 | label: '数值字体颜色', | 
| 34 | 34 | component: 'ColorPicker', | 
| 35 | 35 | changeEvent: 'update:value', | 
| ... | ... | @@ -51,7 +51,14 @@ export const modeTwo: FormSchema[] = [ | 
| 51 | 51 | { | 
| 52 | 52 | field: visualOptionField.ICON, | 
| 53 | 53 | label: '图标', | 
| 54 | - component: 'Input', | |
| 54 | + component: 'IconDrawer', | |
| 55 | + changeEvent: 'update:value', | |
| 56 | + componentProps({ formModel }) { | |
| 57 | + const color = formModel[visualOptionField.ICON_COLOR]; | |
| 58 | + return { | |
| 59 | + color, | |
| 60 | + }; | |
| 61 | + }, | |
| 55 | 62 | }, | 
| 56 | 63 | ]; | 
| 57 | 64 | ... | ... | 
| ... | ... | @@ -180,7 +180,7 @@ | 
| 180 | 180 | :w="item.w" | 
| 181 | 181 | :h="item.h" | 
| 182 | 182 | :i="item.i" | 
| 183 | - style="display: flex; flex-wrap: wrap" | |
| 183 | + :style="{ display: 'flex', flexWrap: 'wrap' }" | |
| 184 | 184 | class="grid-item-layout" | 
| 185 | 185 | @resized="itemResized" | 
| 186 | 186 | @resize="itemResized" | 
| ... | ... | @@ -189,7 +189,7 @@ | 
| 189 | 189 | > | 
| 190 | 190 | <WidgetWrapper | 
| 191 | 191 | :key="item.i" | 
| 192 | - :ref="(el) => setComponentRef(el, item)" | |
| 192 | + :ref="(el: Element) => setComponentRef(el, item)" | |
| 193 | 193 | :data-source="item.chart" | 
| 194 | 194 | > | 
| 195 | 195 | <template #header> | ... | ... |