diff --git a/src/views/device/warning/index.vue b/src/views/device/warning/index.vue index a1841e73..3b4563ab 100644 --- a/src/views/device/warning/index.vue +++ b/src/views/device/warning/index.vue @@ -62,7 +62,7 @@ } const handleMark = async (record: Recordable) => { await markWarningLogs(record.id) - message.success('删除成功') + message.success('标记成功') reload() } diff --git a/src/views/device/warning/warning.data.ts b/src/views/device/warning/warning.data.ts index 508e204a..2b20478e 100644 --- a/src/views/device/warning/warning.data.ts +++ b/src/views/device/warning/warning.data.ts @@ -3,6 +3,8 @@ import dayjs from 'dayjs' import { h } from 'vue' import { Tag } from 'ant-design-vue' import { ColEx } from '/@/components/Form/src/types' +// import { formatDataByObject } from '/@/utils/index' +// import { getGriculturalDeviceBasic, getaGriculturalDevicePoint } from '/@/api/sys/user' const colProps: Partial = { xs: 24, @@ -12,6 +14,43 @@ const colProps: Partial = { xl: 6, xxl: 4, } +const diviceTypes = [ + { + label: '监控设备', + value: 1, + }, + { + label: '土壤设备', + value: 2, + }, + { + label: '水质设备', + value: 3, + }, + { + label: '气象设备', + value: 4, + }, +] + +const lvOptions = [ + { + label: 'Ⅰ级预警', + value: 1, + }, + { + label: 'Ⅱ级预警', + value: 2, + }, + { + label: 'Ⅲ级预警', + value: 3, + }, + { + label: 'Ⅳ级预警', + value: 4, + }, +] const statusOptions = [ { @@ -36,6 +75,23 @@ export const columns: BasicColumn[] = [ title: 'ID', dataIndex: 'id', }, + { + title: '基地', + dataIndex: 'base_name', + }, + { + title: '监控点', + dataIndex: 'point_name', + }, + { + title: '设备类型', + dataIndex: 'device_type', + customRender: ({ text }) => { + const item = diviceTypes.find(({ value }) => value == text) + + return item?.label ?? text + }, + }, { title: '内容', dataIndex: 'content', @@ -44,6 +100,10 @@ export const columns: BasicColumn[] = [ title: '等级', dataIndex: 'lv', width: 100, + customRender: ({ text }) => { + const item = lvOptions.find(({ value }) => value == text) + return item?.label ?? text + }, }, { title: '状态', @@ -78,6 +138,69 @@ export const columns: BasicColumn[] = [ ] export const searchFormSchema: FormSchema[] = [ + // { + // field: 'base', + // component: 'ApiSelect', + // label: '基地', + // colProps, + // componentProps: ({ formModel, formActionType }) => { + // return { + // placeholder: '基地', + // allowClear: true, + // api: getGriculturalDeviceBasic, + // labelField: 'name', + // valueField: 'id', + // onChange: (e: any) => { + // formModel.point = undefined + // if (!e) return + // const { updateSchema } = formActionType + // updateSchema({ + // field: 'point', + // componentProps: { + // api: async (e) => { + // const resData = await getaGriculturalDevicePoint(e) + // return formatDataByObject(resData) + // }, + // params: { + // device_type: 4, + // agricultural_basic: e, + // }, + // labelField: 'label', + // valueField: 'value', + // }, + // }) + // }, + // } + // }, + // }, + // { + // field: 'point', + // component: 'ApiSelect', + // label: '监控点', + // colProps, + // componentProps: { + // allowClear: true, + // placeholder: '监控点', + // }, + // }, + { + field: 'lv', + label: '等级', + component: 'Select', + componentProps: { + options: lvOptions, + }, + colProps, + }, + { + field: 'device', + label: '设备类型', + component: 'Select', + componentProps: { + options: diviceTypes, + }, + colProps, + }, { field: 'status', label: '状态', diff --git a/src/views/main/monitor/components/LiveBroadcast.vue b/src/views/main/monitor/components/LiveBroadcast.vue index 673a6d57..6ee4b78a 100644 --- a/src/views/main/monitor/components/LiveBroadcast.vue +++ b/src/views/main/monitor/components/LiveBroadcast.vue @@ -98,7 +98,7 @@ colProps, componentProps: { allowClear: true, - placeholder: '检测点', + placeholder: '监控点', }, }, ] diff --git a/src/views/main/soil-monitoring/index.vue b/src/views/main/soil-monitoring/index.vue index b7be0599..d0817e96 100644 --- a/src/views/main/soil-monitoring/index.vue +++ b/src/views/main/soil-monitoring/index.vue @@ -18,7 +18,7 @@ :options="baseDate" v-model:value="formState.base_id" placeholder="请选择基地" - > + /> + /> + /> @@ -89,7 +89,8 @@
+ @@ -126,7 +128,8 @@ import LineCharts from './components/LineCharts.vue' import FormDrawer from './components/FormDrawer.vue' import { useDrawer } from '/@/components/Drawer' - + import { useModal } from '/@/components/Modal' + import WarningModal from './warningModal.vue' import { getGriculturalDeviceBasic, getaGriculturalDevicePoint, @@ -150,6 +153,8 @@ const RadioButton = Radio.Button const RadioGroup = Radio.Group + const [registerModal, { openModal }] = useModal() + const [registerDrawer, { openDrawer }] = useDrawer() const formRef = ref() const formState = reactive({ @@ -167,25 +172,30 @@ icon: String title: String value: String | Number + lv: Number } const earlyWarningList = computed(() => { const arr: EarlyWarningItem[] = [ { + lv: 1, icon: 'yujing1', title: 'Ⅰ级预警', value: '', }, { + lv: 2, icon: 'yujing2', title: 'Ⅱ级预警', value: '', }, { + lv: 3, icon: 'yujing3', title: 'Ⅲ级预警', value: '', }, { + lv: 4, icon: 'yujing4', title: 'Ⅳ级预警', value: '', @@ -318,6 +328,14 @@ getPoint() } + const handleWarning = (e) => { + openModal(true, { + ...e, + base: formState.base_id, + device: formState.device_id, + }) + } + const handleSetting = () => { openDrawer(true, { isUpdate: false, diff --git a/src/views/main/soil-monitoring/warningModal.vue b/src/views/main/soil-monitoring/warningModal.vue new file mode 100644 index 00000000..3b4d4076 --- /dev/null +++ b/src/views/main/soil-monitoring/warningModal.vue @@ -0,0 +1,190 @@ + + diff --git a/src/views/main/water-quality/index.vue b/src/views/main/water-quality/index.vue index dee0fd7d..82dbb1ea 100644 --- a/src/views/main/water-quality/index.vue +++ b/src/views/main/water-quality/index.vue @@ -18,7 +18,7 @@ :options="baseDate" v-model:value="formState.base_id" placeholder="请选择基地" - > + /> + /> + /> @@ -89,7 +89,8 @@
+ @@ -126,7 +128,8 @@ import LineCharts from './components/LineCharts.vue' import FormDrawer from './components/FormDrawer.vue' import { useDrawer } from '/@/components/Drawer' - + import { useModal } from '/@/components/Modal' + import WarningModal from './warningModal.vue' import { getGriculturalDeviceBasic, getaGriculturalDevicePoint, @@ -149,6 +152,9 @@ import type { FormInstance } from 'ant-design-vue' const RadioButton = Radio.Button const RadioGroup = Radio.Group + + const [registerModal, { openModal }] = useModal() + const [registerDrawer, { openDrawer }] = useDrawer() const formRef = ref() const formState = reactive({ @@ -167,6 +173,7 @@ icon: String title: String value: String | Number + lv: Number } const earlyWarningList = computed(() => { const arr: EarlyWarningItem[] = [ @@ -174,21 +181,25 @@ icon: 'yujing1', title: 'Ⅰ级预警', value: '', + lv: 1, }, { icon: 'yujing2', title: 'Ⅱ级预警', value: '', + lv: 2, }, { icon: 'yujing3', title: 'Ⅲ级预警', value: '', + lv: 3, }, { icon: 'yujing4', title: 'Ⅳ级预警', value: '', + lv: 4, }, ] Object.values(earlyNums.value).forEach((v: number | string, index: number) => { @@ -318,6 +329,16 @@ getPoint() } + const handleWarning = (e) => { + console.log(e) + + openModal(true, { + ...e, + base: formState.base_id, + device: formState.device_id, + }) + } + const handleSetting = () => { openDrawer(true, { isUpdate: false, diff --git a/src/views/main/water-quality/warningModal.vue b/src/views/main/water-quality/warningModal.vue new file mode 100644 index 00000000..3b4d4076 --- /dev/null +++ b/src/views/main/water-quality/warningModal.vue @@ -0,0 +1,190 @@ + + diff --git a/src/views/system/links/links.data.ts b/src/views/system/links/links.data.ts index 3d5218d3..235432bf 100644 --- a/src/views/system/links/links.data.ts +++ b/src/views/system/links/links.data.ts @@ -150,7 +150,7 @@ export const columns: BasicColumn[] = [ export const searchFormSchema: FormSchema[] = [ { field: 'type', - label: '动作', + label: '类型', component: 'Select', componentProps: { options, @@ -193,6 +193,9 @@ export const accountFormSchema: FormSchema[] = [ required: true, defaultValue: 1, component: 'InputNumber', + componentProps: { + precision: 0, + }, }, { field: 'is_recommend',