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