new-map
parent
b028d43582
commit
1936ac4f9d
|
|
@ -13,6 +13,7 @@ export function getDevices(params, mode: ErrorMessageMode = 'modal') {
|
|||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
isTransformResponse: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,22 @@ export function getPermCode() {
|
|||
export function doLogout() {
|
||||
return defHttp.delete({ url: Api.Logout })
|
||||
}
|
||||
|
||||
/**
|
||||
* @description:修改密码
|
||||
*/
|
||||
export function ResetPassword(data, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.put(
|
||||
{
|
||||
url: `/api/users/reset-password`,
|
||||
data,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description:权限数据
|
||||
*/
|
||||
|
|
@ -63,6 +79,7 @@ export function getRoles(params, mode: ErrorMessageMode = 'modal') {
|
|||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
isTransformResponse: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -131,6 +148,7 @@ export function getUsers(params, mode: ErrorMessageMode = 'modal') {
|
|||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
isTransformResponse: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -146,6 +164,7 @@ export function getAgriculturalBasic(mode: ErrorMessageMode = 'modal') {
|
|||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
isTransformResponse: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -160,6 +179,7 @@ export function getTownAgriculturalBasic(params, mode: ErrorMessageMode = 'modal
|
|||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
isTransformResponse: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -322,6 +342,21 @@ export function getcrops(params, mode: ErrorMessageMode = 'modal') {
|
|||
url: `/api/crops`,
|
||||
params,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
isTransformResponse: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description:农作物详情
|
||||
*/
|
||||
export function agriculturalBasicInfo(id: string, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get(
|
||||
{
|
||||
url: `/api/crops/${id}`,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
|
|
@ -381,18 +416,11 @@ export function getShrimpPrices(params, mode: ErrorMessageMode = 'modal') {
|
|||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
isTransformResponse: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @description:getCropYields
|
||||
*/
|
||||
export function getCropYields(params, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get(
|
||||
{
|
||||
url: `/api/rice-shrimp-prices`,
|
||||
=======
|
||||
* @description:稻虾价格 - 添加
|
||||
*/
|
||||
export function addShrimpPrices(data, mode: ErrorMessageMode = 'modal') {
|
||||
|
|
@ -440,16 +468,14 @@ export function getShrimpIndustries(params, mode: ErrorMessageMode = 'modal') {
|
|||
return defHttp.get(
|
||||
{
|
||||
url: `/api/rice-shrimp-industries`,
|
||||
>>>>>>> 3938cb121abb57822ba7daa68754d32be79f7dce
|
||||
params,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
isTransformResponse: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
/**
|
||||
* @description:稻虾产业 - 添加
|
||||
*/
|
||||
|
|
@ -503,6 +529,7 @@ export function getShrimpFlows(params, mode: ErrorMessageMode = 'modal') {
|
|||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
isTransformResponse: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -559,6 +586,7 @@ export function getMateriels(params, mode: ErrorMessageMode = 'modal') {
|
|||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
isTransformResponse: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -608,7 +636,6 @@ export function deleteMateriels(id: string, mode: ErrorMessageMode = 'modal') {
|
|||
* @description:查看农作物产量
|
||||
*/
|
||||
export function getCropYields(params, mode: ErrorMessageMode = 'modal') {
|
||||
params.isReturnNativeResponse = false
|
||||
return defHttp.get(
|
||||
{
|
||||
url: `/api/crop-yields`,
|
||||
|
|
@ -616,6 +643,7 @@ export function getCropYields(params, mode: ErrorMessageMode = 'modal') {
|
|||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
isTransformResponse: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -663,4 +691,32 @@ export function deleteCropYields(id: string, mode: ErrorMessageMode = 'modal') {
|
|||
},
|
||||
)
|
||||
}
|
||||
>>>>>>> 3938cb121abb57822ba7daa68754d32be79f7dce
|
||||
|
||||
/**
|
||||
* @description:获取指定设备下面的基地
|
||||
*/
|
||||
export function getGriculturalDeviceBasic(params, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get(
|
||||
{
|
||||
url: `/api/agricultural-device-basic`,
|
||||
params,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
)
|
||||
}
|
||||
/**
|
||||
* @description:查询设备监控点
|
||||
*/
|
||||
export function getaGriculturalDevicePoint(params, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get(
|
||||
{
|
||||
url: `/api/agricultural-device-point/${params.agricultural_basic}`,
|
||||
params,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
const userStore = useUserStore()
|
||||
const lockStore = useLockStore()
|
||||
|
||||
const getRealName = computed(() => userStore.getUserInfo?.realName)
|
||||
const getRealName = computed(() => userStore.getUserInfo?.username)
|
||||
const [register, { closeModal }] = useModalInner()
|
||||
|
||||
const [registerForm, { validateFields, resetFields }] = useForm({
|
||||
|
|
|
|||
|
|
@ -4,13 +4,17 @@
|
|||
<img :class="`${prefixCls}__header`" :src="getUserInfo.avatar" />
|
||||
<span :class="`${prefixCls}__info hidden md:block`">
|
||||
<span :class="`${prefixCls}__name `" class="truncate">
|
||||
{{ getUserInfo.realName }}
|
||||
{{ getUserInfo.name }}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<template #overlay>
|
||||
<Menu @click="handleMenuClick">
|
||||
<!-- 修改密码 开始 -->
|
||||
<MenuItem key="setPassword" text="修改密码" icon="ion:settings-outline" />
|
||||
<MenuDivider />
|
||||
<!-- 修改密码 结束 -->
|
||||
<MenuItem
|
||||
key="doc"
|
||||
:text="t('layout.header.dropdownItemDoc')"
|
||||
|
|
@ -32,7 +36,9 @@
|
|||
</Menu>
|
||||
</template>
|
||||
</Dropdown>
|
||||
<LockAction @register="register" />
|
||||
<!-- <LockAction @register="register" /> -->
|
||||
<!-- 修改密码弹窗 -->
|
||||
<PasswordModel @register="register" @success="handleSuccessModel" />
|
||||
</template>
|
||||
<script lang="ts">
|
||||
// components
|
||||
|
|
@ -54,8 +60,9 @@
|
|||
import { openWindow } from '/@/utils'
|
||||
|
||||
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'
|
||||
|
||||
type MenuEvent = 'logout' | 'doc' | 'lock'
|
||||
import PasswordModel from './passwordModel.vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
type MenuEvent = 'logout' | 'setPassword' | 'lock'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'UserDropdown',
|
||||
|
|
@ -65,6 +72,7 @@
|
|||
MenuItem: createAsyncComponent(() => import('./DropMenuItem.vue')),
|
||||
MenuDivider: Menu.Divider,
|
||||
LockAction: createAsyncComponent(() => import('../lock/LockModal.vue')),
|
||||
PasswordModel,
|
||||
},
|
||||
props: {
|
||||
theme: propTypes.oneOf(['dark', 'light']),
|
||||
|
|
@ -76,8 +84,8 @@
|
|||
const userStore = useUserStore()
|
||||
|
||||
const getUserInfo = computed(() => {
|
||||
const { realName = '', avatar, desc } = userStore.getUserInfo || {}
|
||||
return { realName, avatar: avatar || headerImg, desc }
|
||||
const { name = '', avatar } = userStore.getUserInfo || {}
|
||||
return { name, avatar: avatar || headerImg }
|
||||
})
|
||||
|
||||
const [register, { openModal }] = useModal()
|
||||
|
|
@ -96,13 +104,16 @@
|
|||
openWindow(DOC_URL)
|
||||
}
|
||||
|
||||
function handleSuccessModel() {
|
||||
message.success('操作成功')
|
||||
}
|
||||
function handleMenuClick(e: MenuInfo) {
|
||||
switch (e.key as MenuEvent) {
|
||||
case 'logout':
|
||||
handleLoginOut()
|
||||
break
|
||||
case 'doc':
|
||||
openDoc()
|
||||
case 'setPassword':
|
||||
openModal(true)
|
||||
break
|
||||
case 'lock':
|
||||
handleLock()
|
||||
|
|
@ -118,6 +129,7 @@
|
|||
getShowDoc,
|
||||
register,
|
||||
getUseLockPage,
|
||||
handleSuccessModel,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" title="修改密码" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { FormSchema } from '/@/components/Table'
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal'
|
||||
import { BasicForm, useForm } from '/@/components/Form/index'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { ResetPassword } from '/@/api/sys/user'
|
||||
const passwordFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'password',
|
||||
label: '密码',
|
||||
required: true,
|
||||
component: 'InputPassword',
|
||||
},
|
||||
{
|
||||
field: 'password_confirmation',
|
||||
label: '确认密码',
|
||||
required: true,
|
||||
component: 'InputPassword',
|
||||
},
|
||||
]
|
||||
const emits = defineEmits(['success', 'register'])
|
||||
|
||||
const [registerForm, { resetFields, validate }] = useForm({
|
||||
labelWidth: 80,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: passwordFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23,
|
||||
},
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async () => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
})
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
if (values.password_confirmation !== values.password) return message.error('两次密码不一致')
|
||||
setModalProps({ confirmLoading: true })
|
||||
await ResetPassword(values)
|
||||
closeModal()
|
||||
emits('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -55,31 +55,31 @@
|
|||
</Header>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, unref, computed } from 'vue';
|
||||
import { defineComponent, unref, computed } from 'vue'
|
||||
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
import { propTypes } from '/@/utils/propTypes'
|
||||
|
||||
import { Layout } from 'ant-design-vue';
|
||||
import { AppLogo } from '/@/components/Application';
|
||||
import LayoutMenu from '../menu/index.vue';
|
||||
import LayoutTrigger from '../trigger/index.vue';
|
||||
import { Layout } from 'ant-design-vue'
|
||||
import { AppLogo } from '/@/components/Application'
|
||||
import LayoutMenu from '../menu/index.vue'
|
||||
import LayoutTrigger from '../trigger/index.vue'
|
||||
|
||||
import { AppSearch } from '/@/components/Application';
|
||||
import { AppSearch } from '/@/components/Application'
|
||||
|
||||
import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting';
|
||||
import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
|
||||
import { useRootSetting } from '/@/hooks/setting/useRootSetting';
|
||||
import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting'
|
||||
import { useMenuSetting } from '/@/hooks/setting/useMenuSetting'
|
||||
import { useRootSetting } from '/@/hooks/setting/useRootSetting'
|
||||
|
||||
import { MenuModeEnum, MenuSplitTyeEnum } from '/@/enums/menuEnum';
|
||||
import { SettingButtonPositionEnum } from '/@/enums/appEnum';
|
||||
import { AppLocalePicker } from '/@/components/Application';
|
||||
import { MenuModeEnum, MenuSplitTyeEnum } from '/@/enums/menuEnum'
|
||||
import { SettingButtonPositionEnum } from '/@/enums/appEnum'
|
||||
import { AppLocalePicker } from '/@/components/Application'
|
||||
|
||||
import { UserDropDown, LayoutBreadcrumb, FullScreen, Notify, ErrorAction } from './components';
|
||||
import { useAppInject } from '/@/hooks/web/useAppInject';
|
||||
import { useDesign } from '/@/hooks/web/useDesign';
|
||||
import { UserDropDown, LayoutBreadcrumb, FullScreen, Notify, ErrorAction } from './components'
|
||||
import { useAppInject } from '/@/hooks/web/useAppInject'
|
||||
import { useDesign } from '/@/hooks/web/useDesign'
|
||||
|
||||
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
|
||||
import { useLocale } from '/@/locales/useLocale';
|
||||
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'
|
||||
import { useLocale } from '/@/locales/useLocale'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'LayoutHeader',
|
||||
|
|
@ -103,7 +103,7 @@
|
|||
fixed: propTypes.bool,
|
||||
},
|
||||
setup(props) {
|
||||
const { prefixCls } = useDesign('layout-header');
|
||||
const { prefixCls } = useDesign('layout-header')
|
||||
const {
|
||||
getShowTopMenu,
|
||||
getShowHeaderTrigger,
|
||||
|
|
@ -111,9 +111,8 @@
|
|||
getIsMixMode,
|
||||
getMenuWidth,
|
||||
getIsMixSidebar,
|
||||
} = useMenuSetting();
|
||||
const { getUseErrorHandle, getShowSettingButton, getSettingButtonPosition } =
|
||||
useRootSetting();
|
||||
} = useMenuSetting()
|
||||
const { getUseErrorHandle, getShowSettingButton, getSettingButtonPosition } = useRootSetting()
|
||||
|
||||
const {
|
||||
getHeaderTheme,
|
||||
|
|
@ -124,14 +123,14 @@
|
|||
getShowHeaderLogo,
|
||||
getShowHeader,
|
||||
getShowSearch,
|
||||
} = useHeaderSetting();
|
||||
} = useHeaderSetting()
|
||||
|
||||
const { getShowLocalePicker } = useLocale();
|
||||
const { getShowLocalePicker } = useLocale()
|
||||
|
||||
const { getIsMobile } = useAppInject();
|
||||
const { getIsMobile } = useAppInject()
|
||||
|
||||
const getHeaderClass = computed(() => {
|
||||
const theme = unref(getHeaderTheme);
|
||||
const theme = unref(getHeaderTheme)
|
||||
return [
|
||||
prefixCls,
|
||||
{
|
||||
|
|
@ -139,36 +138,36 @@
|
|||
[`${prefixCls}--mobile`]: unref(getIsMobile),
|
||||
[`${prefixCls}--${theme}`]: theme,
|
||||
},
|
||||
];
|
||||
});
|
||||
]
|
||||
})
|
||||
|
||||
const getShowSetting = computed(() => {
|
||||
if (!unref(getShowSettingButton)) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
const settingButtonPosition = unref(getSettingButtonPosition);
|
||||
const settingButtonPosition = unref(getSettingButtonPosition)
|
||||
|
||||
if (settingButtonPosition === SettingButtonPositionEnum.AUTO) {
|
||||
return unref(getShowHeader);
|
||||
return unref(getShowHeader)
|
||||
}
|
||||
return settingButtonPosition === SettingButtonPositionEnum.HEADER;
|
||||
});
|
||||
return settingButtonPosition === SettingButtonPositionEnum.HEADER
|
||||
})
|
||||
|
||||
const getLogoWidth = computed(() => {
|
||||
if (!unref(getIsMixMode) || unref(getIsMobile)) {
|
||||
return {};
|
||||
return {}
|
||||
}
|
||||
const width = unref(getMenuWidth) < 180 ? 180 : unref(getMenuWidth);
|
||||
return { width: `${width}px` };
|
||||
});
|
||||
const width = unref(getMenuWidth) < 180 ? 180 : unref(getMenuWidth)
|
||||
return { width: `${width}px` }
|
||||
})
|
||||
|
||||
const getSplitType = computed(() => {
|
||||
return unref(getSplit) ? MenuSplitTyeEnum.TOP : MenuSplitTyeEnum.NONE;
|
||||
});
|
||||
return unref(getSplit) ? MenuSplitTyeEnum.TOP : MenuSplitTyeEnum.NONE
|
||||
})
|
||||
|
||||
const getMenuMode = computed(() => {
|
||||
return unref(getSplit) ? MenuModeEnum.HORIZONTAL : null;
|
||||
});
|
||||
return unref(getSplit) ? MenuModeEnum.HORIZONTAL : null
|
||||
})
|
||||
|
||||
return {
|
||||
prefixCls,
|
||||
|
|
@ -192,9 +191,9 @@
|
|||
getShowSettingButton,
|
||||
getShowSetting,
|
||||
getShowSearch,
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<style lang="less">
|
||||
@import './index.less';
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
import type { AppRouteModule } from '/@/router/types'
|
||||
|
||||
import { LAYOUT } from '/@/router/constant'
|
||||
import { t } from '/@/hooks/web/useI18n'
|
||||
|
||||
const about: AppRouteModule = {
|
||||
path: '/about',
|
||||
name: 'About',
|
||||
component: LAYOUT,
|
||||
redirect: '/about/index',
|
||||
meta: {
|
||||
hideChildrenInMenu: true,
|
||||
icon: 'simple-icons:about-dot-me',
|
||||
title: t('routes.dashboard.about'),
|
||||
orderNo: 100000,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'AboutPage',
|
||||
component: () => import('/@/views/sys/about/index.vue'),
|
||||
meta: {
|
||||
title: t('routes.dashboard.about'),
|
||||
icon: 'simple-icons:about-dot-me',
|
||||
hideMenu: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
export default about
|
||||
|
|
@ -139,30 +139,30 @@ const main: AppRouteModule = {
|
|||
// title: '农业产业结构',
|
||||
// },
|
||||
// },
|
||||
{
|
||||
path: 'ranking-list',
|
||||
name: 'BaseRankingList',
|
||||
component: () => import('/@/views/base/ranking-list/index.vue'),
|
||||
meta: {
|
||||
title: '产量排行榜', //
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'flow-to',
|
||||
name: 'BaseFlowTo',
|
||||
component: () => import('/@/views/base/flow-to/index.vue'),
|
||||
meta: {
|
||||
title: '农产品流向',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'trend',
|
||||
name: 'BaseTrend',
|
||||
component: () => import('/@/views/base/trend/index.vue'),
|
||||
meta: {
|
||||
title: '农产品价格走势',
|
||||
},
|
||||
},
|
||||
// {
|
||||
// path: 'ranking-list',
|
||||
// name: 'BaseRankingList',
|
||||
// component: () => import('/@/views/base/ranking-list/index.vue'),
|
||||
// meta: {
|
||||
// title: '产量排行榜', //
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: 'flow-to',
|
||||
// name: 'BaseFlowTo',
|
||||
// component: () => import('/@/views/base/flow-to/index.vue'),
|
||||
// meta: {
|
||||
// title: '农产品流向',
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: 'trend',
|
||||
// name: 'BaseTrend',
|
||||
// component: () => import('/@/views/base/trend/index.vue'),
|
||||
// meta: {
|
||||
// title: '农产品价格走势',
|
||||
// },
|
||||
// },
|
||||
],
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,22 +7,22 @@ const dashboard: AppRouteModule = {
|
|||
path: '/dashboard',
|
||||
name: 'Dashboard',
|
||||
component: LAYOUT,
|
||||
redirect: '/dashboard/analysis',
|
||||
redirect: '/dashboard/workbench',
|
||||
meta: {
|
||||
orderNo: 10,
|
||||
icon: 'ion:grid-outline',
|
||||
title: t('routes.dashboard.dashboard'),
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'analysis',
|
||||
name: 'Analysis',
|
||||
component: () => import('/@/views/dashboard/analysis/index.vue'),
|
||||
meta: {
|
||||
// affix: true,
|
||||
title: t('routes.dashboard.analysis'),
|
||||
},
|
||||
},
|
||||
// {
|
||||
// path: 'analysis',
|
||||
// name: 'Analysis',
|
||||
// component: () => import('/@/views/dashboard/analysis/index.vue'),
|
||||
// meta: {
|
||||
// // affix: true,
|
||||
// title: t('routes.dashboard.analysis'),
|
||||
// },
|
||||
// },
|
||||
{
|
||||
path: 'workbench',
|
||||
name: 'Workbench',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export const LOCALE: { [key: string]: LocaleType } = {
|
|||
}
|
||||
|
||||
export const localeSetting: LocaleSetting = {
|
||||
showPicker: true,
|
||||
showPicker: false,
|
||||
// Locale
|
||||
locale: LOCALE.ZH_CN,
|
||||
// Default locale
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@ const setting: ProjectConfig = {
|
|||
// Whether to show the full screen button
|
||||
showFullScreen: true,
|
||||
// Whether to show the document button
|
||||
showDoc: true,
|
||||
showDoc: false,
|
||||
// Whether to show the notification button
|
||||
showNotice: true,
|
||||
showNotice: false,
|
||||
// Whether to display the menu search
|
||||
showSearch: true,
|
||||
showSearch: false,
|
||||
},
|
||||
|
||||
// Menu configuration
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ export const useUserStore = defineStore({
|
|||
const { t } = useI18n()
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: () => h('span', t('sys.app.logoutTip')),
|
||||
title: () => h('span', t('sys.app.Tip')),
|
||||
content: () => h('span', t('sys.app.logoutMessage')),
|
||||
onOk: async () => {
|
||||
await this.logout(true)
|
||||
|
|
|
|||
|
|
@ -49,15 +49,12 @@ const transform: AxiosTransform = {
|
|||
throw new Error(t('sys.api.apiRequestFailed'))
|
||||
}
|
||||
// 这里 code,result,message为 后台统一的字段,需要在 types.ts内修改为项目自己的接口返回格式
|
||||
const { code, data: result, message, meta } = data
|
||||
const resDate = {
|
||||
items: result,
|
||||
total: meta?.total ?? null,
|
||||
}
|
||||
const { code, data: result, message } = data
|
||||
|
||||
// 这里逻辑可以根据项目进行修改
|
||||
const hasSuccess = data && Reflect.has(data, 'code') && code === ResultEnum.SUCCESS
|
||||
if (hasSuccess) {
|
||||
return resDate
|
||||
return result
|
||||
}
|
||||
|
||||
// 在此处根据自己项目的实际情况对不同的code执行不同的操作
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export const accountFormSchema: FormSchema[] = [
|
|||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getTownAgriculturalBasic({ type: 2 })
|
||||
return res.items
|
||||
return res.data
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
|
|
@ -107,7 +107,7 @@ export const accountFormSchema: FormSchema[] = [
|
|||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getcrops({ type: 'all', crop_type: 1 })
|
||||
return res.items.map((e) => {
|
||||
return res.data.map((e) => {
|
||||
return {
|
||||
...e,
|
||||
disabled: e.is_end === 0,
|
||||
|
|
|
|||
|
|
@ -48,8 +48,11 @@
|
|||
const [registerTable, { reload }] = useTable({
|
||||
title: '基地列表',
|
||||
api: async (e) => {
|
||||
const res = await getTownAgriculturalBasic({ type: 1, ...e })
|
||||
return res
|
||||
const { data, meta } = await getTownAgriculturalBasic({ type: 1, ...e })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
|
|
|
|||
|
|
@ -70,8 +70,11 @@
|
|||
const [registerDrawer, { openDrawer }] = useDrawer()
|
||||
const [registerTable, { reload }] = useTable({
|
||||
api: async () => {
|
||||
const res = await getTownAgriculturalBasic({ type: 2 })
|
||||
return res
|
||||
const { data, meta } = await getTownAgriculturalBasic({ type: 2 })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
columns,
|
||||
useSearchForm: false,
|
||||
|
|
@ -101,7 +104,7 @@
|
|||
}
|
||||
onMounted(async () => {
|
||||
let res = await getCitydataStatistics()
|
||||
CityDate.value = res.items
|
||||
CityDate.value = res
|
||||
})
|
||||
return {
|
||||
CityDate,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
setDrawerProps({ confirmLoading: false })
|
||||
if (unref(treeData).length === 0) {
|
||||
const res = await getcrops({ type: 'all', crop_type: 1 })
|
||||
treeData.value = getTreeData(res.items, 0, 'parent_id', 'id', 'children', 'key')
|
||||
treeData.value = getTreeData(res.data, 0, 'parent_id', 'id', 'children', 'key')
|
||||
}
|
||||
isUpdate.value = data?.isUpdate
|
||||
if (unref(isUpdate)) {
|
||||
|
|
|
|||
|
|
@ -126,8 +126,8 @@ export const accountFormSchema: FormSchema[] = [
|
|||
required: true,
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getTownAgriculturalBasic({ type: 1, page: 1, per_page: 99999 })
|
||||
return res.items
|
||||
const { data } = await getTownAgriculturalBasic({ type: 1, page: 1, per_page: 99999 })
|
||||
return data
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
|
|
|
|||
|
|
@ -40,8 +40,11 @@
|
|||
const [registerTable, { reload }] = useTable({
|
||||
api: async (e) => {
|
||||
if (e.year) e.year = dayjs(e.year).format('YYYY')
|
||||
const res = await getCropYields({ ...e, type: 1 })
|
||||
return res
|
||||
const { data, meta } = await getCropYields({ ...e, type: 1 })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
setDrawerProps({ confirmLoading: false })
|
||||
if (unref(treeData).length === 0) {
|
||||
const res = await getcrops({ type: 'all', crop_type: 2 })
|
||||
treeData.value = getTreeData(res.items, 0, 'parent_id', 'id', 'children', 'key')
|
||||
treeData.value = getTreeData(res.data, 0, 'parent_id', 'id', 'children', 'key')
|
||||
}
|
||||
isUpdate.value = data?.isUpdate
|
||||
if (unref(isUpdate)) {
|
||||
|
|
|
|||
|
|
@ -40,8 +40,11 @@
|
|||
const [registerTable, { reload }] = useTable({
|
||||
api: async (e) => {
|
||||
if (e.year) e.year = dayjs(e.year).format('YYYY')
|
||||
const res = await getCropYields({ ...e, type: 2 })
|
||||
return res
|
||||
const { data, meta } = await getCropYields({ ...e, type: 2 })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ export const accountFormSchema: FormSchema[] = [
|
|||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getTownAgriculturalBasic({ type: 2, page: 1, per_page: 99999 })
|
||||
return res.items
|
||||
return res.data
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
|
|
|
|||
|
|
@ -7,74 +7,20 @@
|
|||
width="500px"
|
||||
@ok="handleSubmit"
|
||||
>
|
||||
<!-- <BasicForm @register="registerForm"> </BasicForm> -->
|
||||
<Form class="w-full" :label-col="{ span: 4 }" ref="formRef" :model="modelRef">
|
||||
<FormItem
|
||||
label="产业"
|
||||
name="category_id"
|
||||
:rules="{
|
||||
required: true,
|
||||
message: '请选择产业',
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<Select
|
||||
v-model:value="modelRef.category_id"
|
||||
placeholder="请选择产业"
|
||||
class="w-full"
|
||||
:options="categoryDate"
|
||||
:fieldNames="{ label: 'name', value: 'id' }"
|
||||
></Select>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="名称"
|
||||
name="name"
|
||||
:rules="{
|
||||
required: true,
|
||||
message: '请输入名称',
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<Input v-model:value="modelRef.name" placeholder="请输入" class="w-full"></Input>
|
||||
</FormItem>
|
||||
<FormItem label="上级">
|
||||
<Select
|
||||
:options="parentDate"
|
||||
:fieldNames="{ label: 'name', value: 'id' }"
|
||||
v-model:value="modelRef.parent_id"
|
||||
<BasicForm @register="registerForm">
|
||||
<template #parent="{ model, field }">
|
||||
<TreeSelect
|
||||
v-model:value="model[field]"
|
||||
:tree-data="treeData"
|
||||
placeholder="请选择"
|
||||
class="w-full"
|
||||
></Select>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="单位"
|
||||
name="unit"
|
||||
:rules="{
|
||||
required: true,
|
||||
message: '请输入单位',
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<Input v-model:value="modelRef.unit" placeholder="请输入" class="w-full"></Input>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="排序"
|
||||
name="sort"
|
||||
:rules="{
|
||||
required: true,
|
||||
message: '请输入排序',
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<Input v-model:value="modelRef.sort" placeholder="请输入" class="w-full"></Input>
|
||||
</FormItem>
|
||||
<FormItem label="是否是结点" name="is_end">
|
||||
<Switch v-model:checked="modelRef.is_end" placeholder="请选择"></Switch>
|
||||
</FormItem>
|
||||
allowClear
|
||||
:fieldNames="{ children: 'children', label: 'name', value: 'id' }"
|
||||
></TreeSelect>
|
||||
</template>
|
||||
<!-- -->
|
||||
<template v-if="modelRef.is_end">
|
||||
<template #extends="{ model, field }">
|
||||
<Space
|
||||
v-for="(sight, index) in modelRef.extends"
|
||||
v-for="(sight, index) in model[field]"
|
||||
:key="index"
|
||||
style="display: flex; margin-bottom: 8px"
|
||||
align="baseline"
|
||||
|
|
@ -87,7 +33,7 @@
|
|||
message: '请输入名称',
|
||||
trigger: 'change',
|
||||
}"
|
||||
:label-col="{ span: 8 }"
|
||||
:label-col="{ span: 10 }"
|
||||
>
|
||||
<Input v-model:value="sight.name" placeholder="请输入" class="w-full"></Input>
|
||||
</FormItem>
|
||||
|
|
@ -99,113 +45,81 @@
|
|||
message: '请输入单位',
|
||||
trigger: 'change',
|
||||
}"
|
||||
:label-col="{ span: 8 }"
|
||||
:label-col="{ span: 10 }"
|
||||
>
|
||||
<Input v-model:value="sight.unit" placeholder="请输入" class="w-full"></Input>
|
||||
</FormItem>
|
||||
<MinusCircleOutlined
|
||||
@click="removeSight(sight)"
|
||||
v-if="modelRef.extends.length > 1"
|
||||
:disabled="modelRef.extends.length === 1"
|
||||
@click="removeSight(sight, model[field])"
|
||||
v-if="model[field].length > 1"
|
||||
:disabled="model[field].length === 1"
|
||||
/>
|
||||
</Space>
|
||||
<FormItem>
|
||||
<div class="flex items-center justify-center w-full px-80px">
|
||||
<Button type="dashed" block @click="addSight">
|
||||
<Button type="dashed" block @click="addSight(model[field])">
|
||||
<PlusOutlined />
|
||||
添加
|
||||
</Button>
|
||||
</div>
|
||||
</FormItem>
|
||||
</template>
|
||||
</Form>
|
||||
</BasicForm>
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { getTreeData } from '/@/utils/index'
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicForm, useForm } from '/@/components/Form/index'
|
||||
import { accountFormSchema } from './base.data'
|
||||
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'
|
||||
import { Form, Select, FormItem, Input, Switch, Button, Space } from 'ant-design-vue'
|
||||
import { TreeSelect, Space, FormItem, Input, Button } from 'ant-design-vue'
|
||||
import { addcrops, editcrops, getcrops, agriculturalBasicInfo } from '/@/api/sys/user'
|
||||
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons-vue'
|
||||
import { getCropCate, addcrops, getcrops, editcrops } from '/@/api/sys/user'
|
||||
import type { FormInstance } from 'ant-design-vue'
|
||||
const formRef = ref<FormInstance>()
|
||||
const categoryDate = ref([])
|
||||
const parentDate = ref([])
|
||||
const modelRef = ref({
|
||||
id: null,
|
||||
category_id: undefined, //产业ID
|
||||
name: '', //名称
|
||||
parent_id: undefined, //上级
|
||||
unit: '', //单位
|
||||
is_end: false, //是否是结点
|
||||
extends: [{ name: '', unit: '' }],
|
||||
sort: '', //排序
|
||||
})
|
||||
|
||||
const addSight = () => {
|
||||
modelRef?.value.extends.push({
|
||||
name: '',
|
||||
unit: '',
|
||||
})
|
||||
}
|
||||
const removeSight = (item: any) => {
|
||||
let index = modelRef.value.extends.indexOf(item)
|
||||
if (index !== -1) {
|
||||
modelRef.value.extends.splice(index, 1)
|
||||
}
|
||||
}
|
||||
const emits = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(false)
|
||||
const treeData = ref([])
|
||||
const getTitle = computed(() => (!isUpdate.value ? '新增农作物' : '编辑农作物'))
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: accountFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
})
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
formRef.value?.resetFields()
|
||||
// 获取产业
|
||||
const res = await getCropCate()
|
||||
categoryDate.value = res
|
||||
//获取上级数据
|
||||
const resDate = await getcrops({ page: 1, per_page: 99999, crop_type: 1, type: 'all' })
|
||||
parentDate.value = resDate.filter((e) => !e.is_end)
|
||||
resetFields()
|
||||
setDrawerProps({ confirmLoading: false })
|
||||
if (unref(treeData).length === 0) {
|
||||
const res = await getcrops({ type: 'all', crop_type: 1 })
|
||||
treeData.value = getTreeData(res.data, 0, 'parent_id', 'id', 'children', 'key')
|
||||
}
|
||||
isUpdate.value = data?.isUpdate
|
||||
if (unref(isUpdate)) {
|
||||
modelRef.value = {
|
||||
category_id: data.category_id,
|
||||
name: data.name,
|
||||
parent_id: data.parent_id == 0 ? undefined : data.parent_id,
|
||||
unit: data.unit,
|
||||
is_end: data.is_end == 1 ? true : false,
|
||||
extends: data.extends.length ? JSON.parse(data.extends) : [],
|
||||
sort: data.sort,
|
||||
id: data.id,
|
||||
}
|
||||
const res = await agriculturalBasicInfo(data.id)
|
||||
await setFieldsValue({
|
||||
...res,
|
||||
is_end: res.is_end === 1 ? true : false,
|
||||
extends: res.extends.length ? res.extends : [{ name: '', unit: '' }],
|
||||
category_id: res?.category?.id,
|
||||
parent_id: res.parent_id > 0 ? res.parent_id : undefined,
|
||||
})
|
||||
} else {
|
||||
modelRef.value = {
|
||||
id: null,
|
||||
category_id: undefined, //产业ID
|
||||
name: '', //名称
|
||||
parent_id: undefined, //上级
|
||||
unit: '', //单位
|
||||
is_end: false, //是否是结点
|
||||
setFieldsValue({
|
||||
extends: [{ name: '', unit: '' }],
|
||||
sort: '', //排序
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
const values = await formRef.value?.validate()
|
||||
const params = {
|
||||
crop_type: 1,
|
||||
...values,
|
||||
}
|
||||
setDrawerProps({ confirmLoading: true })
|
||||
if (modelRef.value.id) {
|
||||
const values = await validate()
|
||||
values.crop_type = 1
|
||||
values.is_end = values.is_end ? true : false
|
||||
if (values.id) {
|
||||
// 修改
|
||||
await editcrops(modelRef.value.id, params)
|
||||
await editcrops(values.id, values)
|
||||
} else {
|
||||
// 新增
|
||||
await addcrops(params)
|
||||
await addcrops(values)
|
||||
}
|
||||
closeDrawer()
|
||||
emits('success')
|
||||
|
|
@ -213,4 +127,18 @@
|
|||
setDrawerProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
//添加
|
||||
const addSight = (e: any) => {
|
||||
e.push({
|
||||
name: '',
|
||||
unit: '',
|
||||
})
|
||||
}
|
||||
// 删除
|
||||
const removeSight = (item: any, e: any) => {
|
||||
let index = e.indexOf(item)
|
||||
if (index !== -1) {
|
||||
e.splice(index, 1)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { BasicColumn } from '/@/components/Table'
|
||||
import { FormSchema } from '/@/components/Table'
|
||||
import { getCropCate } from '/@/api/sys/user'
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '名称',
|
||||
|
|
@ -27,4 +28,69 @@ export const columns: BasicColumn[] = [
|
|||
|
||||
export const searchFormSchema: FormSchema[] = []
|
||||
|
||||
export const accountFormSchema: FormSchema[] = []
|
||||
export const accountFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'id',
|
||||
label: 'ID',
|
||||
required: false,
|
||||
dynamicDisabled: true,
|
||||
component: 'Input',
|
||||
ifShow: ({ values }) => {
|
||||
return !!values.id
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'category_id',
|
||||
label: '产业',
|
||||
required: true,
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getCropCate()
|
||||
return res
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
label: '名称',
|
||||
required: true,
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'parent_id',
|
||||
label: '上级',
|
||||
component: 'TreeSelect',
|
||||
slot: 'parent',
|
||||
},
|
||||
{
|
||||
field: 'unit',
|
||||
label: '单位',
|
||||
required: true,
|
||||
component: 'Input',
|
||||
},
|
||||
// {
|
||||
// field: 'sort',
|
||||
// label: '排序',
|
||||
// required: true,
|
||||
// component: 'Input',
|
||||
// },
|
||||
{
|
||||
field: 'is_end',
|
||||
label: '是否是结点',
|
||||
required: false,
|
||||
component: 'Switch',
|
||||
},
|
||||
{
|
||||
field: 'extends',
|
||||
label: '',
|
||||
required: false,
|
||||
component: 'Input',
|
||||
slot: 'extends',
|
||||
ifShow: ({ values }) => {
|
||||
return values.is_end === true
|
||||
},
|
||||
},
|
||||
]
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<TownDrawer @register="registerDrawer" @success="handleSuccess" />
|
||||
<BaseDrawer @register="registerDrawer" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
|
|
@ -41,15 +41,18 @@
|
|||
import { deleteCrops, getcrops } from '/@/api/sys/user'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useDrawer } from '/@/components/Drawer'
|
||||
import TownDrawer from './BaseDrawer.vue'
|
||||
import BaseDrawer from './BaseDrawer.vue'
|
||||
import { Button } from 'ant-design-vue'
|
||||
import { columns, searchFormSchema } from './base.data'
|
||||
const [registerDrawer, { openDrawer }] = useDrawer()
|
||||
const [registerTable, { reload }] = useTable({
|
||||
title: '基地农作物列表',
|
||||
api: async (e) => {
|
||||
const res = await getcrops({ type: 'all', ...e, crop_type: 1 })
|
||||
return res
|
||||
const { data, meta } = await getcrops({ type: 'all', ...e, crop_type: 1 })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
|
|
|
|||
|
|
@ -7,74 +7,19 @@
|
|||
width="500px"
|
||||
@ok="handleSubmit"
|
||||
>
|
||||
<!-- <BasicForm @register="registerForm"> </BasicForm> -->
|
||||
<Form class="w-full" :label-col="{ span: 4 }" ref="formRef" :model="modelRef">
|
||||
<FormItem
|
||||
label="产业"
|
||||
name="category_id"
|
||||
:rules="{
|
||||
required: true,
|
||||
message: '请选择产业',
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<Select
|
||||
v-model:value="modelRef.category_id"
|
||||
placeholder="请选择产业"
|
||||
class="w-full"
|
||||
:options="categoryDate"
|
||||
:fieldNames="{ label: 'name', value: 'id' }"
|
||||
></Select>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="名称"
|
||||
name="name"
|
||||
:rules="{
|
||||
required: true,
|
||||
message: '请输入名称',
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<Input v-model:value="modelRef.name" placeholder="请输入" class="w-full"></Input>
|
||||
</FormItem>
|
||||
<FormItem label="上级">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #parent="{ model, field }">
|
||||
<TreeSelect
|
||||
:tree-data="parentDate"
|
||||
:fieldNames="{ children: 'children', label: 'name', value: 'id' }"
|
||||
v-model:value="modelRef.parent_id"
|
||||
v-model:value="model[field]"
|
||||
:tree-data="treeData"
|
||||
placeholder="请选择"
|
||||
class="w-full"
|
||||
:fieldNames="{ children: 'children', label: 'name', value: 'id' }"
|
||||
></TreeSelect>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="单位"
|
||||
name="unit"
|
||||
:rules="{
|
||||
required: true,
|
||||
message: '请输入单位',
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<Input v-model:value="modelRef.unit" placeholder="请输入" class="w-full"></Input>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="排序"
|
||||
name="sort"
|
||||
:rules="{
|
||||
required: true,
|
||||
message: '请输入排序',
|
||||
trigger: 'change',
|
||||
}"
|
||||
>
|
||||
<Input v-model:value="modelRef.sort" placeholder="请输入" class="w-full"></Input>
|
||||
</FormItem>
|
||||
<FormItem label="是否是结点" name="is_end">
|
||||
<Switch v-model:checked="modelRef.is_end" placeholder="请选择"></Switch>
|
||||
</FormItem>
|
||||
</template>
|
||||
<!-- -->
|
||||
<template v-if="modelRef.is_end">
|
||||
<template #extends="{ model, field }">
|
||||
<Space
|
||||
v-for="(sight, index) in modelRef.extends"
|
||||
v-for="(sight, index) in model[field]"
|
||||
:key="index"
|
||||
style="display: flex; margin-bottom: 8px"
|
||||
align="baseline"
|
||||
|
|
@ -87,7 +32,7 @@
|
|||
message: '请输入名称',
|
||||
trigger: 'change',
|
||||
}"
|
||||
:label-col="{ span: 8 }"
|
||||
:label-col="{ span: 10 }"
|
||||
>
|
||||
<Input v-model:value="sight.name" placeholder="请输入" class="w-full"></Input>
|
||||
</FormItem>
|
||||
|
|
@ -99,120 +44,81 @@
|
|||
message: '请输入单位',
|
||||
trigger: 'change',
|
||||
}"
|
||||
:label-col="{ span: 8 }"
|
||||
:label-col="{ span: 10 }"
|
||||
>
|
||||
<Input v-model:value="sight.unit" placeholder="请输入" class="w-full"></Input>
|
||||
</FormItem>
|
||||
<MinusCircleOutlined
|
||||
@click="removeSight(sight)"
|
||||
v-if="modelRef.extends.length > 1"
|
||||
:disabled="modelRef.extends.length === 1"
|
||||
@click="removeSight(sight, model[field])"
|
||||
v-if="model[field].length > 1"
|
||||
:disabled="model[field].length === 1"
|
||||
/>
|
||||
</Space>
|
||||
<FormItem>
|
||||
<div class="flex items-center justify-center w-full px-80px">
|
||||
<Button type="dashed" block @click="addSight">
|
||||
<Button type="dashed" block @click="addSight(model[field])">
|
||||
<PlusOutlined />
|
||||
添加
|
||||
</Button>
|
||||
</div>
|
||||
</FormItem>
|
||||
</template>
|
||||
</Form>
|
||||
</BasicForm>
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { getTreeData } from '/@/utils/index'
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicForm, useForm } from '/@/components/Form/index'
|
||||
import { accountFormSchema } from './town.data'
|
||||
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'
|
||||
import { Form, Select, FormItem, Input, Switch, Button, Space, TreeSelect } from 'ant-design-vue'
|
||||
import { TreeSelect, Space, FormItem, Input, Button } from 'ant-design-vue'
|
||||
import { addcrops, editcrops, getcrops, agriculturalBasicInfo } from '/@/api/sys/user'
|
||||
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons-vue'
|
||||
import { getCropCate, addcrops, getcrops, editcrops } from '/@/api/sys/user'
|
||||
import type { FormInstance } from 'ant-design-vue'
|
||||
const formRef = ref<FormInstance>()
|
||||
const categoryDate = ref([])
|
||||
const parentDate = ref([])
|
||||
const modelRef = ref({
|
||||
id: null,
|
||||
category_id: undefined, //产业ID
|
||||
name: '', //名称
|
||||
parent_id: undefined, //上级
|
||||
unit: '', //单位
|
||||
is_end: false, //是否是结点
|
||||
extends: [{ name: '', unit: '' }],
|
||||
sort: '', //排序
|
||||
})
|
||||
|
||||
const addSight = () => {
|
||||
modelRef?.value.extends.push({
|
||||
name: '',
|
||||
unit: '',
|
||||
})
|
||||
}
|
||||
const removeSight = (item: any) => {
|
||||
let index = modelRef.value.extends.indexOf(item)
|
||||
if (index !== -1) {
|
||||
modelRef.value.extends.splice(index, 1)
|
||||
}
|
||||
}
|
||||
const emits = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(false)
|
||||
const treeData = ref([])
|
||||
const getTitle = computed(() => (!isUpdate.value ? '新增农作物' : '编辑农作物'))
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: accountFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
})
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
formRef.value?.resetFields()
|
||||
// 获取产业
|
||||
if (unref(categoryDate).length === 0) {
|
||||
const res = await getCropCate()
|
||||
categoryDate.value = res.items
|
||||
}
|
||||
|
||||
//获取上级数据
|
||||
if (unref(parentDate).length === 0) {
|
||||
const resDate = await getcrops({ page: 1, per_page: 99999, crop_type: 2, type: 'all' })
|
||||
parentDate.value = getTreeData(resDate.items, 0, 'parent_id', 'id', 'children', 'key')
|
||||
}
|
||||
|
||||
resetFields()
|
||||
setDrawerProps({ confirmLoading: false })
|
||||
if (unref(treeData).length === 0) {
|
||||
const res = await getcrops({ type: 'all', crop_type: 2 })
|
||||
treeData.value = getTreeData(res.data, 0, 'parent_id', 'id', 'children', 'key')
|
||||
}
|
||||
isUpdate.value = data?.isUpdate
|
||||
if (unref(isUpdate)) {
|
||||
modelRef.value = {
|
||||
category_id: data.category_id,
|
||||
name: data.name,
|
||||
parent_id: data.parent_id == 0 ? undefined : data.parent_id,
|
||||
unit: data.unit,
|
||||
is_end: data.is_end ? true : false,
|
||||
extends: data.extends.length ? JSON.parse(data.extends) : [],
|
||||
sort: data.sort,
|
||||
id: data.id,
|
||||
}
|
||||
const res = await agriculturalBasicInfo(data.id)
|
||||
await setFieldsValue({
|
||||
...res,
|
||||
is_end: res.is_end === 1 ? true : false,
|
||||
extends: res.extends.length ? res.extends : [{ name: '', unit: '' }],
|
||||
category_id: res?.category?.id,
|
||||
parent_id: res.parent_id > 0 ? res.parent_id : undefined,
|
||||
})
|
||||
} else {
|
||||
modelRef.value = {
|
||||
id: null,
|
||||
category_id: undefined, //产业ID
|
||||
name: '', //名称
|
||||
parent_id: undefined, //上级
|
||||
unit: '', //单位
|
||||
is_end: false, //是否是结点
|
||||
setFieldsValue({
|
||||
extends: [{ name: '', unit: '' }],
|
||||
sort: '', //排序
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
const values = await formRef.value?.validate()
|
||||
const params = {
|
||||
crop_type: 2,
|
||||
...values,
|
||||
}
|
||||
setDrawerProps({ confirmLoading: true })
|
||||
if (modelRef.value.id) {
|
||||
const values = await validate()
|
||||
values.crop_type = 2
|
||||
values.is_end = values.is_end ? true : false
|
||||
if (values.id) {
|
||||
// 修改
|
||||
await editcrops(modelRef.value.id, params)
|
||||
await editcrops(values.id, values)
|
||||
} else {
|
||||
// 新增
|
||||
await addcrops(params)
|
||||
await addcrops(values)
|
||||
}
|
||||
closeDrawer()
|
||||
emits('success')
|
||||
|
|
@ -220,4 +126,18 @@
|
|||
setDrawerProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
//添加
|
||||
const addSight = (e: any) => {
|
||||
e.push({
|
||||
name: '',
|
||||
unit: '',
|
||||
})
|
||||
}
|
||||
// 删除
|
||||
const removeSight = (item: any, e: any) => {
|
||||
let index = e.indexOf(item)
|
||||
if (index !== -1) {
|
||||
e.splice(index, 1)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -48,8 +48,11 @@
|
|||
const [registerTable, { reload }] = useTable({
|
||||
title: '城镇农作物列表',
|
||||
api: async (e) => {
|
||||
const res = await getcrops({ type: 'all', ...e, crop_type: 2 })
|
||||
return res
|
||||
const { data, meta } = await getcrops({ type: 'all', ...e, crop_type: 2 })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { BasicColumn } from '/@/components/Table'
|
||||
import { FormSchema } from '/@/components/Table'
|
||||
import { getCropCate } from '/@/api/sys/user'
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '名称',
|
||||
|
|
@ -27,4 +28,69 @@ export const columns: BasicColumn[] = [
|
|||
|
||||
export const searchFormSchema: FormSchema[] = []
|
||||
|
||||
export const accountFormSchema: FormSchema[] = []
|
||||
export const accountFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'id',
|
||||
label: 'ID',
|
||||
required: false,
|
||||
dynamicDisabled: true,
|
||||
component: 'Input',
|
||||
ifShow: ({ values }) => {
|
||||
return !!values.id
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'category_id',
|
||||
label: '产业',
|
||||
required: true,
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getCropCate()
|
||||
return res
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
label: '名称',
|
||||
required: true,
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'parent_id',
|
||||
label: '上级',
|
||||
component: 'TreeSelect',
|
||||
slot: 'parent',
|
||||
},
|
||||
{
|
||||
field: 'unit',
|
||||
label: '单位',
|
||||
required: true,
|
||||
component: 'Input',
|
||||
},
|
||||
// {
|
||||
// field: 'sort',
|
||||
// label: '排序',
|
||||
// required: true,
|
||||
// component: 'Input',
|
||||
// },
|
||||
{
|
||||
field: 'is_end',
|
||||
label: '是否是结点',
|
||||
required: false,
|
||||
component: 'Switch',
|
||||
},
|
||||
{
|
||||
field: 'extends',
|
||||
label: '',
|
||||
required: false,
|
||||
component: 'Input',
|
||||
slot: 'extends',
|
||||
ifShow: ({ values }) => {
|
||||
return values.is_end === true
|
||||
},
|
||||
},
|
||||
]
|
||||
|
|
|
|||
|
|
@ -40,9 +40,11 @@
|
|||
title: '大宗物资 - 列表',
|
||||
api: async (e) => {
|
||||
if (e.year) e.year = dayjs(e.year).format('YYYY')
|
||||
const res = await getMateriels({ ...e })
|
||||
console.log(res)
|
||||
return res
|
||||
const { data, meta } = await getMateriels({ ...e })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
|
|
|
|||
|
|
@ -40,8 +40,11 @@
|
|||
title: '稻虾价格 - 列表',
|
||||
api: async (e) => {
|
||||
if (e.year) e.year = dayjs(e.year).format('YYYY')
|
||||
const res = await getShrimpPrices({ ...e })
|
||||
return res
|
||||
const { data, meta } = await getShrimpPrices({ ...e })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
|
|
|
|||
|
|
@ -40,8 +40,11 @@
|
|||
title: '稻虾流向 - 列表',
|
||||
api: async (e) => {
|
||||
if (e.year) e.year = dayjs(e.year).format('YYYY')
|
||||
const res = await getShrimpFlows({ ...e })
|
||||
return res
|
||||
const { data, meta } = await getShrimpFlows({ ...e })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
|
|
|
|||
|
|
@ -40,8 +40,11 @@
|
|||
title: '稻虾产业 - 列表',
|
||||
api: async (e) => {
|
||||
if (e.year) e.year = dayjs(e.year).format('YYYY')
|
||||
const res = await getShrimpIndustries({ ...e })
|
||||
return res
|
||||
const { data, meta } = await getShrimpIndustries({ ...e })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
<div class="lg:flex">
|
||||
<Avatar :src="userinfo.avatar || headerImg" :size="72" class="!mx-auto !block" />
|
||||
<div class="md:ml-6 flex flex-col justify-center md:mt-0 mt-2">
|
||||
<h1 class="md:text-lg text-md">早安, {{ userinfo.realName }}, 开始您一天的工作吧!</h1>
|
||||
<span class="text-secondary"> 今日晴,20℃ - 32℃! </span>
|
||||
<h1 class="md:text-lg text-md"> {{ userinfo.name }}, 开始您一天的工作吧!</h1>
|
||||
<span class="text-secondary"> </span>
|
||||
</div>
|
||||
<div class="flex flex-1 justify-end md:mt-0 mt-4">
|
||||
<div class="flex flex-col justify-center text-right">
|
||||
<!-- <div class="flex flex-col justify-center text-right">
|
||||
<span class="text-secondary"> 待办 </span>
|
||||
<span class="text-2xl">2/10</span>
|
||||
</div>
|
||||
|
|
@ -18,16 +18,16 @@
|
|||
<div class="flex flex-col justify-center text-right md:mr-10 mr-4">
|
||||
<span class="text-secondary"> 团队 </span>
|
||||
<span class="text-2xl">300</span>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
import { Avatar } from 'ant-design-vue';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import headerImg from '/@/assets/images/header.jpg';
|
||||
import { computed } from 'vue'
|
||||
import { Avatar } from 'ant-design-vue'
|
||||
import { useUserStore } from '/@/store/modules/user'
|
||||
import headerImg from '/@/assets/images/header.jpg'
|
||||
|
||||
const userStore = useUserStore();
|
||||
const userinfo = computed(() => userStore.getUserInfo);
|
||||
const userStore = useUserStore()
|
||||
const userinfo = computed(() => userStore.getUserInfo)
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<PageWrapper>
|
||||
<template #headerContent> <WorkbenchHeader /> </template>
|
||||
<div class="lg:flex">
|
||||
<!-- <div class="lg:flex">
|
||||
<div class="lg:w-7/10 w-full !mr-4 enter-y">
|
||||
<ProjectCard :loading="loading" class="enter-y" />
|
||||
<DynamicInfo :loading="loading" class="!my-4 enter-y" />
|
||||
|
|
@ -15,22 +15,22 @@
|
|||
|
||||
<SaleRadar :loading="loading" class="enter-y" />
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</PageWrapper>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Card } from 'ant-design-vue';
|
||||
import { PageWrapper } from '/@/components/Page';
|
||||
import WorkbenchHeader from './components/WorkbenchHeader.vue';
|
||||
import ProjectCard from './components/ProjectCard.vue';
|
||||
import QuickNav from './components/QuickNav.vue';
|
||||
import DynamicInfo from './components/DynamicInfo.vue';
|
||||
import SaleRadar from './components/SaleRadar.vue';
|
||||
import { ref } from 'vue'
|
||||
// import { Card } from 'ant-design-vue'
|
||||
import { PageWrapper } from '/@/components/Page'
|
||||
import WorkbenchHeader from './components/WorkbenchHeader.vue'
|
||||
// import ProjectCard from './components/ProjectCard.vue'
|
||||
// import QuickNav from './components/QuickNav.vue'
|
||||
// import DynamicInfo from './components/DynamicInfo.vue'
|
||||
// import SaleRadar from './components/SaleRadar.vue'
|
||||
|
||||
const loading = ref(true);
|
||||
const loading = ref(true)
|
||||
|
||||
setTimeout(() => {
|
||||
loading.value = false;
|
||||
}, 1500);
|
||||
loading.value = false
|
||||
}, 1500)
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,13 @@
|
|||
const [registerDrawer, { openDrawer }] = useDrawer()
|
||||
const [registerTable, { reload }] = useTable({
|
||||
title: '设备列表',
|
||||
api: getDevices,
|
||||
api: async (e) => {
|
||||
const { data, meta } = await getDevices({ ...e })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
formConfig: {
|
||||
|
|
|
|||
|
|
@ -81,9 +81,8 @@ export const searchFormSchema: FormSchema[] = [
|
|||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getAgriculturalBasic()
|
||||
console.log(res)
|
||||
return res.items
|
||||
const { data } = await getAgriculturalBasic()
|
||||
return data
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
|
|
@ -97,7 +96,7 @@ export const searchFormSchema: FormSchema[] = [
|
|||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getDeviceTypes()
|
||||
return formatDataByObject(res.items)
|
||||
return formatDataByObject(res)
|
||||
},
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
|
|
@ -143,7 +142,7 @@ export const accountFormSchema: FormSchema[] = [
|
|||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getDeviceTypes()
|
||||
return formatDataByObject(res.items)
|
||||
return formatDataByObject(res)
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -154,9 +153,8 @@ export const accountFormSchema: FormSchema[] = [
|
|||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getAgriculturalBasic()
|
||||
console.log(res)
|
||||
return res.items
|
||||
const { data } = await getAgriculturalBasic()
|
||||
return data
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
|
|
|
|||
|
|
@ -1,13 +1,74 @@
|
|||
<template>
|
||||
<PageWrapper>
|
||||
<a-card>
|
||||
<BasicForm
|
||||
<Card>
|
||||
<Form ref="formRef" :model="formState">
|
||||
<Row :gutter="[16, 16]">
|
||||
<Col
|
||||
:xs="{ span: 24 }"
|
||||
:sm="{ span: 12 }"
|
||||
:md="{ span: 8 }"
|
||||
:lg="{ span: 6 }"
|
||||
:xl="{ span: 6 }"
|
||||
:xxl="{ span: 4 }"
|
||||
>
|
||||
<FormItem label="基地">
|
||||
<Select
|
||||
:fieldNames="{ label: 'name', value: 'id' }"
|
||||
:options="baseDate"
|
||||
v-model:value="formState.base_id"
|
||||
placeholder="请选择基地"
|
||||
></Select>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col
|
||||
:xs="{ span: 24 }"
|
||||
:sm="{ span: 12 }"
|
||||
:md="{ span: 8 }"
|
||||
:lg="{ span: 6 }"
|
||||
:xl="{ span: 6 }"
|
||||
:xxl="{ span: 4 }"
|
||||
>
|
||||
<FormItem label="检测点">
|
||||
<Select v-model:value="formState.device_id"></Select>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col
|
||||
:xs="{ span: 24 }"
|
||||
:sm="{ span: 12 }"
|
||||
:md="{ span: 8 }"
|
||||
:lg="{ span: 6 }"
|
||||
:xl="{ span: 6 }"
|
||||
:xxl="{ span: 4 }"
|
||||
>
|
||||
<FormItem label="日期">
|
||||
<RangePicker v-model:value="formState.time"></RangePicker>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col
|
||||
:xs="{ span: 24 }"
|
||||
:sm="{ span: 12 }"
|
||||
:md="{ span: 8 }"
|
||||
:lg="{ span: 6 }"
|
||||
:xl="{ span: 6 }"
|
||||
:xxl="{ span: 4 }"
|
||||
>
|
||||
<FormItem>
|
||||
<RadioGroup button-style="solid" v-model:value="formState.time_interval">
|
||||
<RadioButton value="a">今天</RadioButton>
|
||||
<RadioButton value="B">近一周</RadioButton>
|
||||
<RadioButton value="C">近一个月</RadioButton>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
</Form>
|
||||
<!-- <BasicForm
|
||||
autoFocusFirstItem
|
||||
:labelWidth="0"
|
||||
:schemas="schemas"
|
||||
:rowProps="{ gutter: [16, 0] }"
|
||||
:showActionButtonGroup="false"
|
||||
/>
|
||||
/> -->
|
||||
<div class="md:flex enter-y flex-wrap -mr-4">
|
||||
<AirTemperature class="md:w-386px w-full !mr-4 !mb-4" :loading="false" />
|
||||
<AirHumidity class="md:w-386px w-full !mr-4 !mb-4" :loading="false" />
|
||||
|
|
@ -20,130 +81,61 @@
|
|||
<PM10 class="md:w-386px w-full !mr-4 !mb-4" :loading="false" />
|
||||
<PM25 class="md:w-386px w-full !mr-4 !mb-4" :loading="false" />
|
||||
</div>
|
||||
</a-card>
|
||||
</Card>
|
||||
</PageWrapper>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { PageWrapper } from '/@/components/Page';
|
||||
import { Card, Row, Col, Select } from 'ant-design-vue';
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { BasicForm, FormSchema } from '/@/components/Form/index';
|
||||
import { ColEx } from '/@/components/Form/src/types';
|
||||
import AirTemperature from './components/AirTemperature.vue';
|
||||
import AirHumidity from './components/AirHumidity.vue';
|
||||
import LightIntensity from './components/LightIntensity.vue';
|
||||
import Rainfall from './components/Rainfall.vue';
|
||||
import WindSpeed from './components/WindSpeed.vue';
|
||||
import Pressure from './components/Pressure.vue';
|
||||
import WindDirection from './components/WindDirection.vue';
|
||||
import Noise from './components/Noise.vue';
|
||||
import PM10 from './components/Noise.vue';
|
||||
import PM25 from './components/PM25.vue';
|
||||
const valueSelectA = ref<string[]>([]);
|
||||
const colProps: Partial<ColEx> = {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
md: 8,
|
||||
lg: 6,
|
||||
xl: 6,
|
||||
xxl: 4,
|
||||
};
|
||||
const schemas: FormSchema[] = [
|
||||
{
|
||||
field: 'field1',
|
||||
component: 'Select',
|
||||
label: '',
|
||||
colProps,
|
||||
componentProps: {
|
||||
placeholder: '基地',
|
||||
options: [
|
||||
{
|
||||
label: '选项2',
|
||||
value: '1',
|
||||
key: '1',
|
||||
},
|
||||
],
|
||||
onChange: (e: any) => {
|
||||
console.log(e);
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'field1',
|
||||
component: 'Select',
|
||||
label: '',
|
||||
colProps,
|
||||
componentProps: {
|
||||
placeholder: '检测点',
|
||||
options: [
|
||||
{
|
||||
label: '选项2',
|
||||
value: '1',
|
||||
key: '1',
|
||||
},
|
||||
],
|
||||
onChange: (e: any) => {
|
||||
console.log(e);
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'time',
|
||||
component: 'RangePicker',
|
||||
label: '',
|
||||
colProps,
|
||||
componentProps: {
|
||||
placeholder: ['开始日期', '结束日期'],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'disclosure',
|
||||
component: 'RadioButtonGroup',
|
||||
label: '',
|
||||
colProps: colProps,
|
||||
componentProps: {
|
||||
options: [
|
||||
{
|
||||
label: '今天',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '近一周',
|
||||
value: '2',
|
||||
},
|
||||
{
|
||||
label: '近一个月',
|
||||
value: '3',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
export default defineComponent({
|
||||
components: {
|
||||
[Card.name]: Card,
|
||||
[Row.name]: Row,
|
||||
[Col.name]: Col,
|
||||
[Select.name]: Select,
|
||||
BasicForm,
|
||||
PageWrapper,
|
||||
AirTemperature,
|
||||
AirHumidity,
|
||||
LightIntensity,
|
||||
Rainfall,
|
||||
WindSpeed,
|
||||
Pressure,
|
||||
WindDirection,
|
||||
Noise,
|
||||
PM10,
|
||||
PM25,
|
||||
},
|
||||
setup() {
|
||||
return {
|
||||
valueSelectA,
|
||||
schemas,
|
||||
};
|
||||
},
|
||||
});
|
||||
<script lang="ts" setup>
|
||||
import { PageWrapper } from '/@/components/Page'
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import {
|
||||
Card,
|
||||
Form,
|
||||
FormItem,
|
||||
Select,
|
||||
Row,
|
||||
Col,
|
||||
RadioGroup,
|
||||
RadioButton,
|
||||
RangePicker,
|
||||
} from 'ant-design-vue'
|
||||
import type { FormInstance } from 'ant-design-vue'
|
||||
import AirTemperature from './components/AirTemperature.vue'
|
||||
import AirHumidity from './components/AirHumidity.vue'
|
||||
import LightIntensity from './components/LightIntensity.vue'
|
||||
import Rainfall from './components/Rainfall.vue'
|
||||
import WindSpeed from './components/WindSpeed.vue'
|
||||
import Pressure from './components/Pressure.vue'
|
||||
import WindDirection from './components/WindDirection.vue'
|
||||
import Noise from './components/Noise.vue'
|
||||
import PM10 from './components/Noise.vue'
|
||||
import PM25 from './components/PM25.vue'
|
||||
import { getGriculturalDeviceBasic, getaGriculturalDevicePoint } from '/@/api/sys/user'
|
||||
const formRef = ref<FormInstance>()
|
||||
const formState = reactive({
|
||||
base_id: undefined, //基地
|
||||
device_id: undefined, //监控点
|
||||
checkNick: false,
|
||||
time: undefined, //时间
|
||||
time_interval: '',
|
||||
})
|
||||
const baseDate = ref([])
|
||||
// 获取基地数据
|
||||
const getBase = async () => {
|
||||
const res = await getGriculturalDeviceBasic({ device_type: 4 })
|
||||
baseDate.value = res
|
||||
formState.base_id = res?.[0]?.id ?? undefined
|
||||
getPoint()
|
||||
}
|
||||
// 获取监控到数据
|
||||
const getPoint = async () => {
|
||||
const res = await getaGriculturalDevicePoint({
|
||||
device_type: 4,
|
||||
agricultural_basic: formState.base_id,
|
||||
})
|
||||
console.log(res)
|
||||
}
|
||||
onMounted(() => {
|
||||
getBase()
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -142,8 +142,8 @@ export const accountFormSchema: FormSchema[] = [
|
|||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getRoles({})
|
||||
return res.items
|
||||
const { data } = await getRoles({})
|
||||
return data
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
|
|
@ -209,8 +209,8 @@ export const accountFormSchema: FormSchema[] = [
|
|||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await getAgriculturalBasic()
|
||||
return res.items
|
||||
const { data } = await getAgriculturalBasic()
|
||||
return data
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
|
|
|
|||
|
|
@ -43,7 +43,13 @@
|
|||
const [registerDrawer, { openDrawer }] = useDrawer()
|
||||
const [registerTable, { reload }] = useTable({
|
||||
title: '账号列表',
|
||||
api: getUsers,
|
||||
api: async (e) => {
|
||||
const { data, meta } = await getUsers({ ...e })
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
formConfig: {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
if (unref(treeData).length === 0) {
|
||||
// treeData.value = (await getPermissions()) as any as TreeItem[]
|
||||
const res = await getPermissions()
|
||||
treeData.value = res.items
|
||||
treeData.value = res
|
||||
}
|
||||
isUpdate.value = data?.isUpdate
|
||||
if (unref(isUpdate)) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,14 @@
|
|||
const [registerDrawer, { openDrawer }] = useDrawer()
|
||||
const [registerTable, { reload }] = useTable({
|
||||
title: '角色列表',
|
||||
api: getRoles,
|
||||
api: async () => {
|
||||
const { data, meta } = await getRoles({})
|
||||
return {
|
||||
items: data,
|
||||
total: meta?.total,
|
||||
}
|
||||
},
|
||||
|
||||
columns,
|
||||
formConfig: {
|
||||
labelWidth: 120,
|
||||
|
|
|
|||
Loading…
Reference in New Issue