This commit is contained in:
easy 2023-01-10 14:37:25 +08:00
parent d38fe9e5b8
commit d1eb8165c0
10 changed files with 468 additions and 439 deletions

7
components.d.ts vendored
View File

@ -7,23 +7,16 @@ export {}
declare module '@vue/runtime-core' { declare module '@vue/runtime-core' {
export interface GlobalComponents { export interface GlobalComponents {
ABadge: typeof import('ant-design-vue/es')['Badge']
AButton: typeof import('ant-design-vue/es')['Button'] AButton: typeof import('ant-design-vue/es')['Button']
ACard: typeof import('ant-design-vue/es')['Card'] ACard: typeof import('ant-design-vue/es')['Card']
ACol: typeof import('ant-design-vue/es')['Col'] ACol: typeof import('ant-design-vue/es')['Col']
ADatePicker: typeof import('ant-design-vue/es')['DatePicker']
AForm: typeof import('ant-design-vue/es')['Form'] AForm: typeof import('ant-design-vue/es')['Form']
AFormItem: typeof import('ant-design-vue/es')['FormItem'] AFormItem: typeof import('ant-design-vue/es')['FormItem']
AInput: typeof import('ant-design-vue/es')['Input']
AInputGroup: typeof import('ant-design-vue/es')['InputGroup']
AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
AModal: typeof import('ant-design-vue/es')['Modal'] AModal: typeof import('ant-design-vue/es')['Modal']
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm'] APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
ARow: typeof import('ant-design-vue/es')['Row'] ARow: typeof import('ant-design-vue/es')['Row']
ASelect: typeof import('ant-design-vue/es')['Select'] ASelect: typeof import('ant-design-vue/es')['Select']
ATooltip: typeof import('ant-design-vue/es')['Tooltip'] ATooltip: typeof import('ant-design-vue/es')['Tooltip']
AUpload: typeof import('ant-design-vue/es')['Upload']
BadgeStatus: typeof import('./src/components/BadgeStatus/index.vue')['default'] BadgeStatus: typeof import('./src/components/BadgeStatus/index.vue')['default']
CardBox: typeof import('./src/components/CardBox/index.vue')['default'] CardBox: typeof import('./src/components/CardBox/index.vue')['default']
GeoComponent: typeof import('./src/components/GeoComponent/index.vue')['default'] GeoComponent: typeof import('./src/components/GeoComponent/index.vue')['default']

View File

@ -186,5 +186,5 @@ const opsStepDetails = [
linkUrl: '/a', linkUrl: '/a',
auth: false, auth: false,
}, },
]; ] as recommendList[];
</script> </script>

View File

@ -27,6 +27,7 @@ import BasicCountCard from '../BasicCountCard.vue';
import PlatformPicCard from '../PlatformPicCard.vue'; import PlatformPicCard from '../PlatformPicCard.vue';
import StepCard from '../StepCard.vue'; import StepCard from '../StepCard.vue';
import {recommendList} from '../../index'
// import {getImage} from '@/utils/comm' // import {getImage} from '@/utils/comm'
// - // -
@ -93,7 +94,7 @@ const stepDetails = [
linkUrl: '/a', linkUrl: '/a',
auth: false, auth: false,
}, },
]; ] as recommendList[];
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -26,6 +26,9 @@ import BootCard from '../BootCard.vue';
import DeviceCountCard from '../DeviceCountCard.vue'; import DeviceCountCard from '../DeviceCountCard.vue';
import PlatformPicCard from '../PlatformPicCard.vue'; import PlatformPicCard from '../PlatformPicCard.vue';
import StepCard from '../StepCard.vue'; import StepCard from '../StepCard.vue';
import {recommendList} from '../../index'
// import {getImage} from '@/utils/comm' // import {getImage} from '@/utils/comm'
// - // -
@ -90,7 +93,7 @@ const stepDetails = [
linkUrl: '/a', linkUrl: '/a',
auth: false, auth: false,
}, },
]; ] as recommendList[];
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -4,8 +4,9 @@
<script setup lang="ts"> <script setup lang="ts">
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import { ComponentInternalInstance } from 'vue';
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps({ const props = defineProps({
chartRef: String, chartRef: String,
@ -50,7 +51,7 @@ watch(options, () => {
}); });
const initChart = () => { const initChart = () => {
nextTick(() => { nextTick(() => {
const myChart = echarts.init(proxy.$refs[props.chartRef]); const myChart = echarts.init(proxy?.$refs[props.chartRef as string] as HTMLElement);
myChart.clear(); myChart.clear();
myChart.setOption(options.value); myChart.setOption(options.value);

View File

@ -11,12 +11,8 @@
</h5> </h5>
<div class="box-list"> <div class="box-list">
<div <div class="list-item" v-for="item in dataList">
class="list-item" <div class="box-top" @click="jumpPage(item)">
v-for="item in dataList"
@click="jumpPage(item)"
>
<div class="box-top">
<span class="top-title">{{ item.title }}</span> <span class="top-title">{{ item.title }}</span>
<img :src="item.iconUrl" alt="" /> <img :src="item.iconUrl" alt="" />
</div> </div>
@ -25,7 +21,10 @@
</div> </div>
<div class="dialogs"> <div class="dialogs">
<AccessMethodDialog :open-number="openAccess" /> <AccessMethodDialog
:open-number="openAccess"
@confirm="againJumpPage"
/>
</div> </div>
</a-card> </a-card>
</template> </template>
@ -39,6 +38,11 @@ import AccessMethodDialog from './dialogs/AccessMethodDialog.vue';
import { recommendList } from '../index'; import { recommendList } from '../index';
type rowType = {
params: object;
linkUrl: string;
};
const props = defineProps({ const props = defineProps({
cardTitle: String, cardTitle: String,
tooltip: String, tooltip: String,
@ -49,15 +53,25 @@ const router = useRouter();
const { cardTitle, tooltip, dataList } = toRefs(props); const { cardTitle, tooltip, dataList } = toRefs(props);
const openAccess = ref<number>(0); const openAccess = ref<number>(0);
const openFunc = ref<number>(0); const openFunc = ref<number>(0);
let selectRow: recommendList | rowType = {
params: {},
linkUrl: '',
};
//
const jumpPage = (row: recommendList) => { const jumpPage = (row: recommendList) => {
if (!row.auth) return message.warning('暂无权限,请联系管理员'); if (!row.auth) return message.warning('暂无权限,请联系管理员');
else if (row.dialogTag == 'accessMethod') return (openAccess.value += 1); selectRow = row; // 使
if (row.dialogTag == 'accessMethod') return (openAccess.value += 1);
else if (row.dialogTag === 'funcTest') return (openFunc.value += 1); else if (row.dialogTag === 'funcTest') return (openFunc.value += 1);
else if (row.linkUrl) { else if (row.linkUrl) {
router.push(`${row.linkUrl}${objToParams(row.params || {})}`); router.push(`${row.linkUrl}${objToParams(row.params || {})}`);
} }
}; };
//
const againJumpPage = (paramsSource: object) => {
const params = { ...(selectRow.params || {}), ...paramsSource };
router.push(`${selectRow.linkUrl}${objToParams(params || {})}`);
};
const objToParams = (source: object): string => { const objToParams = (source: object): string => {
if (Object.prototype.toString.call(source) === '[object Object]') { if (Object.prototype.toString.call(source) === '[object Object]') {

View File

@ -1,18 +1,30 @@
<template> <template>
<div ref="modal" class="access-method-dialog-container"></div>
<a-modal <a-modal
v-model:visible="visible" v-model:visible="visible"
title="选择产品" title="选择产品"
style="width: 500px" style="width: 700px"
@ok="handleOk" @ok="handleOk"
show-search show-search
:filter-option="filterOption" :filter-option="filterOption"
:getContainer="getContainer"
:maskClosable="false"
> >
<a-select <a-form :model="form" name="basic" autocomplete="off" layout="vertical">
v-model:value="productId" <a-form-item
style="width: 100%" label="产品"
:options="productList" name="productId"
> :rules="[{ required: true, message: '该字段是必填字段' }]"
</a-select> >
<a-select
v-model:value="form.productId"
style="width: 100%"
:options="productList"
>
</a-select>
</a-form-item>
</a-form>
<template #footer> <template #footer>
<a-button key="back" @click="visible = false">取消</a-button> <a-button key="back" @click="visible = false">取消</a-button>
<a-button key="submit" type="primary" @click="handleOk" <a-button key="submit" type="primary" @click="handleOk"
@ -23,33 +35,55 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ComponentInternalInstance } from 'vue';
import { productItem } from '../../index'; import { productItem } from '../../index';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps({ const props = defineProps({
openNumber: Number, openNumber: Number,
}); });
const emits = defineEmits(['confirm']); const emits = defineEmits(['confirm']);
const { openNumber } = toRefs(props);
const visible = ref<boolean>(false); const visible = ref<boolean>(false);
const form = ref({
productId: '',
});
const productId = ref<string>('');
const productList = ref<[productItem] | []>([]); const productList = ref<[productItem] | []>([]);
const getContainer = () => proxy?.$refs.modal as HTMLElement;
const getOptions = () => { const getOptions = () => {
productList.value = []; productList.value = [];
}; };
const handleOk = () => { const handleOk = () => {
emits('confirm', productId.value); emits('confirm', form.value);
visible.value = false; visible.value = false;
}; };
const filterOption = (input: string, option: any) => { const filterOption = (input: string, option: any) => {
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0; return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
}; };
watch(openNumber, () => { watch(
visible.value = true; () => props.openNumber,
productId.value = ''; () => {
getOptions(); visible.value = true;
}); form.value.productId = '';
getOptions();
},
);
</script> </script>
<style scoped></style> <style lang="less" scoped>
.access-method-dialog-container {
:deep(.ant-modal-body) {
.ant-form {
.ant-form-item-label {
color: green;
.ant-form-item-required {
&::before {
position: absolute;
left: 30px;
}
}
}
}
}
}
</style>

View File

@ -0,0 +1,135 @@
<template>
<div ref="modal" class="func-test-dialog-container"></div>
<a-modal
v-model:visible="visible"
title="选择产品"
style="width: 700px"
@ok="handleOk"
:getContainer="getContainer"
:maskClosable="false"
>
<div class="search">
<a-select
v-model:value="form.key"
style="width: 100%"
:options="productList"
/>
<a-select
v-model:value="form.relation"
style="width: 100%"
:options="productList"
/>
<a-input v-model:value="form.keyValue" allow-clear />
<a-button type="primary" @click="clickSearch">
<template #icon><SearchOutlined /></template>
搜索
</a-button>
<a-button type="primary" @click="clickReset">
<template #icon><reload-outlined /></template>
重置
</a-button>
</div>
<a-table
:columns="columns"
:data-source="tableData"
:row-selection="{
onChange: (selectedRowKeys, selectedRows) =>
(selectItem = selectedRows),
type: 'radio',
}"
>
</a-table>
<template #footer>
<a-button key="back" @click="visible = false">取消</a-button>
<a-button key="submit" type="primary" @click="handleOk"
>确认</a-button
>
</template>
</a-modal>
</template>
<script setup lang="ts">
import { ComponentInternalInstance } from 'vue';
import { SearchOutlined, ReloadOutlined } from '@ant-design/icons-vue';
import { productItem, deviceInfo } from '../../index';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const emits = defineEmits(['confirm']);
const props = defineProps({
openNumber: Number,
});
//
const visible = ref<boolean>(false);
const getContainer = () => proxy?.$refs.modal as HTMLElement;
const handleOk = () => {
emits('confirm', form.value);
visible.value = false;
};
watch(
() => props.openNumber,
() => {
clickReset();
getOptions();
clickSearch();
visible.value = true;
},
);
//
const form = ref({
key: '',
relation: '',
keyValue: '',
});
const productList = ref<[productItem] | []>([]);
const getOptions = () => {
productList.value = [];
};
const clickSearch = ()=>{
}
const clickReset = () => {
Object.entries(form.value).forEach(([prop]) => {
form.value[prop] = '';
});
};
//
const columns = [
{
name: 'deviceId',
dataIndex: 'deviceId',
key: 'deviceId',
},
{
name: 'deviceName',
dataIndex: 'deviceName',
key: 'deviceName',
},
{
name: 'productName',
dataIndex: 'productName',
key: 'productName',
},
{
name: 'createTime',
dataIndex: 'createTime',
key: 'createTime',
},
{
name: 'status',
dataIndex: 'status',
key: 'status',
},
];
const tableData = ref<deviceInfo[]>([]);
const selectItem: deviceInfo | {} = {};
const getList = () => {};
</script>
<style lang="scss" scoped></style>

View File

@ -12,4 +12,12 @@ export interface recommendList {
export interface productItem { export interface productItem {
label: string; label: string;
value: string value: string
}
export interface deviceInfo {
deviceId: string,
deviceName: string,
productName: string,
createTime: string,
status: boolean
} }

642
yarn.lock

File diff suppressed because it is too large Load Diff