增加吉县页面
This commit is contained in:
parent
f5ad1abbd3
commit
4eb2be9791
|
|
@ -0,0 +1,72 @@
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from "/@/hooks/web/useMessage";
|
||||||
|
|
||||||
|
const { createConfirm } = useMessage();
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
list = '/appmana/survHisdataLivestockwater/list',
|
||||||
|
save='/appmana/survHisdataLivestockwater/add',
|
||||||
|
edit='/appmana/survHisdataLivestockwater/edit',
|
||||||
|
deleteOne = '/appmana/survHisdataLivestockwater/delete',
|
||||||
|
deleteBatch = '/appmana/survHisdataLivestockwater/deleteBatch',
|
||||||
|
importExcel = '/appmana/survHisdataLivestockwater/importExcel',
|
||||||
|
exportXls = '/appmana/survHisdataLivestockwater/exportXls',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出api
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const getExportUrl = Api.exportXls;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入api
|
||||||
|
*/
|
||||||
|
export const getImportUrl = Api.importExcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表接口
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个
|
||||||
|
* @param params
|
||||||
|
* @param handleSuccess
|
||||||
|
*/
|
||||||
|
export const deleteOne = (params,handleSuccess) => {
|
||||||
|
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param params
|
||||||
|
* @param handleSuccess
|
||||||
|
*/
|
||||||
|
export const batchDelete = (params, handleSuccess) => {
|
||||||
|
createConfirm({
|
||||||
|
iconType: 'warning',
|
||||||
|
title: '确认删除',
|
||||||
|
content: '是否删除选中数据',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存或者更新
|
||||||
|
* @param params
|
||||||
|
* @param isUpdate
|
||||||
|
*/
|
||||||
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
|
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,243 @@
|
||||||
|
import {BasicColumn} from '/@/components/Table';
|
||||||
|
import {FormSchema} from '/@/components/Table';
|
||||||
|
import { rules} from '/@/utils/helper/validator';
|
||||||
|
import { render } from '/@/utils/common/renderUtils';
|
||||||
|
import {getStationList} from "/@/views/appmana/station/SurvStationInfo.api";
|
||||||
|
//列表数据
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
{
|
||||||
|
title: '站点名称',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'stationName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备编号',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'deployCode',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数据更新时间',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dataDateTime',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '数据ID',
|
||||||
|
// align: "center",
|
||||||
|
// dataIndex: 'dataId'
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '总磷(mg/L)',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dataWaterTpSy',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '总氮(mg/L)',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dataWaterTnSy',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '氨氮(mg/L)',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'dataWaterNhSy'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '化学需氧量(mg/L)',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dataWaterCodSy',
|
||||||
|
},
|
||||||
|
|
||||||
|
// {
|
||||||
|
// title: '数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据',
|
||||||
|
// align: "center",
|
||||||
|
// dataIndex: 'dataGatherType'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '转储时间',
|
||||||
|
// align: "center",
|
||||||
|
// dataIndex: 'transDate',
|
||||||
|
// },
|
||||||
|
];
|
||||||
|
|
||||||
|
//查询数据
|
||||||
|
export const searchFormSchema: FormSchema[] = [
|
||||||
|
{
|
||||||
|
field: 'stationCode',
|
||||||
|
component: 'ApiSelect',
|
||||||
|
label: '监测站点',
|
||||||
|
componentProps: {
|
||||||
|
// more details see /src/components/Form/src/components/ApiSelect.vue
|
||||||
|
api: getStationList,
|
||||||
|
params: {
|
||||||
|
id: 1,
|
||||||
|
stationType: 'livestock'
|
||||||
|
},
|
||||||
|
resultField: 'list',
|
||||||
|
// use name as label
|
||||||
|
labelField: 'stationName',
|
||||||
|
// use id as value
|
||||||
|
valueField: 'stationCode',
|
||||||
|
// not request untill to select
|
||||||
|
immediate: false,
|
||||||
|
onChange: (e) => {
|
||||||
|
console.log('selected:', e);
|
||||||
|
},
|
||||||
|
// atfer request callback
|
||||||
|
onOptionsChange: (options) => {
|
||||||
|
console.log('get options', options.length, options);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
colProps: {
|
||||||
|
span: 8,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// field: 'deployId',
|
||||||
|
// component: 'ApiSelect',
|
||||||
|
// label: '选择设备',
|
||||||
|
// componentProps: {
|
||||||
|
// // more details see /src/components/Form/src/components/ApiSelect.vue
|
||||||
|
// api: getDeviceList,
|
||||||
|
// params: {
|
||||||
|
// id: 1,
|
||||||
|
// deployTypes: ["6_water"]
|
||||||
|
// },
|
||||||
|
// resultField: 'list',
|
||||||
|
// // use name as label
|
||||||
|
// labelField: 'deployDes',
|
||||||
|
// // use id as value
|
||||||
|
// valueField: 'id',
|
||||||
|
// // not request untill to select
|
||||||
|
// immediate: false,
|
||||||
|
// onChange: (e) => {
|
||||||
|
// console.log('selected:', e);
|
||||||
|
// },
|
||||||
|
// // atfer request callback
|
||||||
|
// onOptionsChange: (options) => {
|
||||||
|
// console.log('get options', options.length, options);
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// colProps: {
|
||||||
|
// span: 8,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
field: 'dataDateTime',
|
||||||
|
label: '监测时间',
|
||||||
|
component: 'RangePicker',
|
||||||
|
colProps: { span: 8 },
|
||||||
|
componentProps: {
|
||||||
|
picker: 'date',
|
||||||
|
valueFormat: 'YYYY-MM-DD',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'deployType',
|
||||||
|
label: '',
|
||||||
|
component: 'JInput',
|
||||||
|
colProps: { span: 8 },
|
||||||
|
show: false,
|
||||||
|
defaultValue: 'standard',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'column',
|
||||||
|
label: '',
|
||||||
|
component: 'JInput',
|
||||||
|
colProps: { span: 8 },
|
||||||
|
show: false,
|
||||||
|
defaultValue: 'dataDateTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'order',
|
||||||
|
label: '',
|
||||||
|
component: 'JInput',
|
||||||
|
colProps: { span: 8 },
|
||||||
|
show: false,
|
||||||
|
defaultValue: 'desc',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
//表单数据
|
||||||
|
export const formSchema: FormSchema[] = [
|
||||||
|
{
|
||||||
|
label: '租户号',
|
||||||
|
field: 'tenantId',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '乐观锁',
|
||||||
|
field: 'reVision',
|
||||||
|
component: 'InputNumber',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '创建人',
|
||||||
|
field: 'createdBy',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '创建时间',
|
||||||
|
field: 'createTime',
|
||||||
|
component: 'DatePicker',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '更新人',
|
||||||
|
field: 'updatedBy',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '逻辑删除',
|
||||||
|
field: 'isDel',
|
||||||
|
component: 'InputNumber',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '更新时间',
|
||||||
|
field: 'updatedTime',
|
||||||
|
component: 'DatePicker',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '数据ID',
|
||||||
|
field: 'dataId',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '总磷',
|
||||||
|
field: 'dataWaterTpSy',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '总氮',
|
||||||
|
field: 'dataWaterTnSy',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '化学需氧量',
|
||||||
|
field: 'dataWaterCodSy',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// label: '硝态氮',
|
||||||
|
// field: 'dataWaterNo',
|
||||||
|
// component: 'Input',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
label: '数据更新时间',
|
||||||
|
field: 'dataDateTime',
|
||||||
|
component: 'DatePicker',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据',
|
||||||
|
field: 'dataGatherType',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '转储时间',
|
||||||
|
field: 'transDate',
|
||||||
|
component: 'DatePicker',
|
||||||
|
},
|
||||||
|
// TODO 主键隐藏字段,目前写死为ID
|
||||||
|
{
|
||||||
|
label: '',
|
||||||
|
field: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,278 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<!--查询区域-->
|
||||||
|
<!-- <div class="jeecg-basic-table-form-container">-->
|
||||||
|
<!-- <a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">-->
|
||||||
|
<!-- <a-row :gutter="24">-->
|
||||||
|
<!-- <a-col :xs="24" :sm="8" :md="6" :lg="8" :xl="6" :xxl="6" style="margin-left: -10px; margin-top: 16px">-->
|
||||||
|
<!-- <a-form-item label="选择监测站" name="stationCode">-->
|
||||||
|
<!-- <ApiSelect-->
|
||||||
|
<!-- :api="getStationList"-->
|
||||||
|
<!-- :params="stationType"-->
|
||||||
|
<!-- showSearch-->
|
||||||
|
<!-- v-model:value="queryParam.stationCode"-->
|
||||||
|
<!-- optionFilterProp="label"-->
|
||||||
|
<!-- resultField="list"-->
|
||||||
|
<!-- labelField="stationName"-->
|
||||||
|
<!-- valueField="stationCode"-->
|
||||||
|
<!-- placeholder="请选择"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
|
||||||
|
<!-- <a-col :xs="24" :sm="8" :md="6" :lg="8" :xl="6" :xxl="6" style="margin-left: -10px; margin-top: 16px">-->
|
||||||
|
<!-- <a-form-item label="数据更新时间" name="dataDateTime">-->
|
||||||
|
<!-- <a-date-picker placeholder="" v-model:value="queryParam.dataDateTime" value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <template v-if="toggleSearchStatus">-->
|
||||||
|
<!-- <a-col :xs="24" :sm="8" :md="6" :lg="8" :xl="6" :xxl="6" style="margin-left: -10px; margin-top: 16px">-->
|
||||||
|
<!-- <a-form-item label="设备部署编号" name="deviceCode">-->
|
||||||
|
<!-- <a-input placeholder="请输入设备部署编号查询" v-model:value="queryParam.deviceCode"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <!– <a-col :xs="24" :sm="8" :md="6" :lg="8" :xl="6" :xxl="6" style="margin-left:-10px;margin-top: 16px;">-->
|
||||||
|
<!-- <a-form-item label="污染物类型" name="pollution">-->
|
||||||
|
<!-- <JDictSelectTag type="select" v-model:value="queryParam.pollution" dictCode="surv_livestock_pullution" placeholder="请选择污染物类型" />-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col> –>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">-->
|
||||||
|
<!-- <a-col :xs="24" :sm="8" :md="6" :lg="8" :xl="6" :xxl="6" style="margin-left: -10px; margin-top: 16px">-->
|
||||||
|
<!-- <a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>-->
|
||||||
|
<!-- <a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>-->
|
||||||
|
<!-- <a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">-->
|
||||||
|
<!-- {{ toggleSearchStatus ? '收起' : '展开' }}-->
|
||||||
|
<!-- <Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />-->
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- </span>-->
|
||||||
|
<!-- </a-row>-->
|
||||||
|
<!-- </a-form>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!--引用表格-->
|
||||||
|
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||||
|
<!--插槽:table标题-->
|
||||||
|
<template #tableTitle>
|
||||||
|
<!-- <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> -->
|
||||||
|
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||||
|
<!-- <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> -->
|
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu>
|
||||||
|
<a-menu-item key="1" @click="batchHandleDelete">
|
||||||
|
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||||
|
删除
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
<!-- <a-button>批量操作
|
||||||
|
<Icon icon="mdi:chevron-down"></Icon>
|
||||||
|
</a-button> -->
|
||||||
|
</a-dropdown>
|
||||||
|
</template>
|
||||||
|
<!--操作栏-->
|
||||||
|
<template #action="{ record }">
|
||||||
|
<!-- <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> -->
|
||||||
|
<TableAction :actions="getDetailAction(record)" />
|
||||||
|
</template>
|
||||||
|
<!--字段回显插槽-->
|
||||||
|
<template #htmlSlot="{ text }">
|
||||||
|
<div v-html="text"></div>
|
||||||
|
</template>
|
||||||
|
<!--省市区字段回显插槽-->
|
||||||
|
<template #pcaSlot="{ text }">
|
||||||
|
{{ getAreaTextByCode(text) }}
|
||||||
|
</template>
|
||||||
|
<template #fileSlot="{ text }">
|
||||||
|
<span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
|
||||||
|
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<SurvHisdataLivestockwaterModal ref="registerModal" @success="handleSuccess"></SurvHisdataLivestockwaterModal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" name="appmana-survHisdataLivestockwater" setup>
|
||||||
|
import { ref, reactive } from 'vue';
|
||||||
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||||
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
|
import { columns,searchFormSchema } from './SurvHisdataLivestockwater.data';
|
||||||
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './SurvHisdataLivestockwater.api';
|
||||||
|
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||||
|
import SurvHisdataLivestockwaterModal from './components/SurvHisdataLivestockwaterModal.vue'
|
||||||
|
import { ApiSelect} from '/@/components/Form/index';
|
||||||
|
import { getStationList } from '../../station/SurvStationInfo.api';
|
||||||
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
|
|
||||||
|
const formRef = ref();
|
||||||
|
const queryParam = reactive<any>({});
|
||||||
|
const toggleSearchStatus = ref<boolean>(false);
|
||||||
|
const registerModal = ref();
|
||||||
|
const stationType = { stationType: 'livestock'};
|
||||||
|
//注册table数据
|
||||||
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
|
tableProps: {
|
||||||
|
title: 'surv_hisdata_livestockwater',
|
||||||
|
api: list,
|
||||||
|
columns,
|
||||||
|
canResize:false,
|
||||||
|
useSearchForm: true,
|
||||||
|
actionColumn: {
|
||||||
|
width: 120,
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
beforeFetch: (params) => {
|
||||||
|
queryParam.dataType = 'standard';
|
||||||
|
return Object.assign(params, queryParam);
|
||||||
|
},
|
||||||
|
formConfig: {
|
||||||
|
schemas: searchFormSchema,
|
||||||
|
fieldMapToTime: [['dataDateTime', ['dataDateTime_begin', 'dataDateTime_end'], 'YYYY-MM-DD']],
|
||||||
|
showAdvancedButton: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exportConfig: {
|
||||||
|
name: "surv_hisdata_livestockwater",
|
||||||
|
url: getExportUrl,
|
||||||
|
params: queryParam,
|
||||||
|
},
|
||||||
|
importConfig: {
|
||||||
|
url: getImportUrl,
|
||||||
|
success: handleSuccess
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
const labelCol = reactive({
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 7 },
|
||||||
|
});
|
||||||
|
const wrapperCol = reactive({
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 16 },
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增事件
|
||||||
|
*/
|
||||||
|
function handleAdd() {
|
||||||
|
registerModal.value.disableSubmit = false;
|
||||||
|
registerModal.value.add();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑事件
|
||||||
|
*/
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
registerModal.value.disableSubmit = false;
|
||||||
|
registerModal.value.edit(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
function handleDetail(record: Recordable) {
|
||||||
|
registerModal.value.disableSubmit = true;
|
||||||
|
registerModal.value.edit(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除事件
|
||||||
|
*/
|
||||||
|
async function handleDelete(record) {
|
||||||
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除事件
|
||||||
|
*/
|
||||||
|
async function batchHandleDelete() {
|
||||||
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功回调
|
||||||
|
*/
|
||||||
|
function handleSuccess() {
|
||||||
|
(selectedRowKeys.value = []) && reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作栏
|
||||||
|
*/
|
||||||
|
function getTableAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '编辑',
|
||||||
|
onClick: handleEdit.bind(null, record),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作栏
|
||||||
|
*/
|
||||||
|
function getDetailAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '详情',
|
||||||
|
onClick: handleDetail.bind(null, record),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉操作栏
|
||||||
|
*/
|
||||||
|
function getDropDownAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '详情',
|
||||||
|
onClick: handleDetail.bind(null, record),
|
||||||
|
}, {
|
||||||
|
label: '删除',
|
||||||
|
popConfirm: {
|
||||||
|
title: '是否确认删除',
|
||||||
|
confirm: handleDelete.bind(null, record),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*/
|
||||||
|
function searchQuery() {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function searchReset() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
//刷新数据
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.jeecg-basic-table-form-container {
|
||||||
|
.table-page-search-submitButtons {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.query-group-cust {
|
||||||
|
width: calc(50% - 15px);
|
||||||
|
min-width: 100px !important;
|
||||||
|
}
|
||||||
|
.query-group-split-cust {
|
||||||
|
width: 30px;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,203 @@
|
||||||
|
<template>
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="站点名称" v-bind="validateInfos.stationName">
|
||||||
|
<a-input v-model:value="formData.stationName" placeholder="请输入站点名称" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="设备名称" v-bind="validateInfos.deviceName">
|
||||||
|
<a-input v-model:value="formData.deviceName" placeholder="请输入设备名称" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="设备编号" v-bind="validateInfos.deployCode">
|
||||||
|
<a-input v-model:value="formData.deployCode" placeholder="请输入设备编号" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="数据ID" v-bind="validateInfos.dataId">-->
|
||||||
|
<!-- <a-input v-model:value="formData.dataId" placeholder="请输入数据ID" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="总磷(mg/L)" v-bind="validateInfos.dataWaterTpSy">
|
||||||
|
<a-input v-model:value="formData.dataWaterTpSy" placeholder="请输入总磷" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="总氮(mg/L)" v-bind="validateInfos.dataWaterTnSy">
|
||||||
|
<a-input v-model:value="formData.dataWaterTnSy" placeholder="请输入总氮" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="氨氮(mg/L)" v-bind="validateInfos.dataWaterNhSy">
|
||||||
|
<a-input v-model:value="formData.dataWaterNhSy" placeholder="请输入氨氮" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="化学需氧量(mg/L)" v-bind="validateInfos.dataWaterCodSy">
|
||||||
|
<a-input v-model:value="formData.dataWaterCodSy" placeholder="请输入化学需氧量" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="数据更新时间" v-bind="validateInfos.dataDateTime">
|
||||||
|
<a-date-picker
|
||||||
|
placeholder=""
|
||||||
|
v-model:value="formData.dataDateTime"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
show-time="{ format: 'YYYY-MM-DD HH:mm:ss' }"
|
||||||
|
style="width: 100%"
|
||||||
|
:disabled="disabled"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<!-- <a-col :span="24">
|
||||||
|
<a-form-item label="数据类型" v-bind="validateInfos.dataGatherType">
|
||||||
|
<a-input v-model:value="formData.dataGatherType" placeholder="" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="转储时间" v-bind="validateInfos.transDate">
|
||||||
|
<a-date-picker placeholder="" v-model:value="formData.transDate" value-format="YYYY-MM-DD HH:mm:ss" show-time="{ format: 'YYYY-MM-DD HH:mm:ss' }" style="width: 100%" :disabled="disabled"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col> -->
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import { getValueType } from '/@/utils';
|
||||||
|
import { saveOrUpdate } from '../SurvHisdataLivestockwater.api';
|
||||||
|
import { Form } from 'ant-design-vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
formDisabled: { type: Boolean, default: false },
|
||||||
|
formData: { type: Object, default: () => {} },
|
||||||
|
formBpm: { type: Boolean, default: true },
|
||||||
|
});
|
||||||
|
const formRef = ref();
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
const emit = defineEmits(['register', 'ok']);
|
||||||
|
const formData = reactive<Record<string, any>>({
|
||||||
|
id: '',
|
||||||
|
tenantId: '',
|
||||||
|
reVision: undefined,
|
||||||
|
createdBy: '',
|
||||||
|
createTime: '',
|
||||||
|
updatedBy: '',
|
||||||
|
isDel: undefined,
|
||||||
|
updatedTime: '',
|
||||||
|
dataId: '',
|
||||||
|
dataWaterTp: '',
|
||||||
|
dataWaterTn: '',
|
||||||
|
dataWaterNh: '',
|
||||||
|
dataWaterCod: '',
|
||||||
|
dataWaterTpSy: '',
|
||||||
|
dataWaterTnSy: '',
|
||||||
|
dataWaterNhSy: '',
|
||||||
|
dataWaterCodSy: '',
|
||||||
|
dataDateTime: '',
|
||||||
|
dataGatherType: '',
|
||||||
|
transDate: '',
|
||||||
|
deviceName: '',
|
||||||
|
deviceCode: '',
|
||||||
|
stationName: '',
|
||||||
|
});
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||||
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||||
|
const confirmLoading = ref<boolean>(false);
|
||||||
|
//表单验证
|
||||||
|
const validatorRules = {};
|
||||||
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
|
||||||
|
|
||||||
|
// 表单禁用
|
||||||
|
const disabled = computed(() => {
|
||||||
|
if (props.formBpm === true) {
|
||||||
|
if (props.formData.disabled === false) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return props.formDisabled;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
function add() {
|
||||||
|
edit({});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
function edit(record) {
|
||||||
|
nextTick(() => {
|
||||||
|
resetFields();
|
||||||
|
//赋值
|
||||||
|
Object.assign(formData, record);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交数据
|
||||||
|
*/
|
||||||
|
async function submitForm() {
|
||||||
|
// 触发表单验证
|
||||||
|
await validate();
|
||||||
|
confirmLoading.value = true;
|
||||||
|
const isUpdate = ref<boolean>(false);
|
||||||
|
//时间格式化
|
||||||
|
let model = formData;
|
||||||
|
if (model.id) {
|
||||||
|
isUpdate.value = true;
|
||||||
|
}
|
||||||
|
//循环数据
|
||||||
|
for (let data in model) {
|
||||||
|
//如果该数据是数组并且是字符串类型
|
||||||
|
if (model[data] instanceof Array) {
|
||||||
|
let valueType = getValueType(formRef.value.getProps, data);
|
||||||
|
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||||
|
if (valueType === 'string') {
|
||||||
|
model[data] = model[data].join(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await saveOrUpdate(model, isUpdate.value)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
createMessage.success(res.message);
|
||||||
|
emit('ok');
|
||||||
|
} else {
|
||||||
|
createMessage.warning(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
confirmLoading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
submitForm,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.antd-modal-form {
|
||||||
|
min-height: 500px !important;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 24px 24px 24px 24px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
<template>
|
||||||
|
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||||
|
<SurvHisdataLivestockwaterForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></SurvHisdataLivestockwaterForm>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, nextTick, defineExpose } from 'vue';
|
||||||
|
import SurvHisdataLivestockwaterForm from './SurvHisdataLivestockwaterForm.vue'
|
||||||
|
|
||||||
|
const title = ref<string>('');
|
||||||
|
const width = ref<number>(800);
|
||||||
|
const visible = ref<boolean>(false);
|
||||||
|
const disableSubmit = ref<boolean>(false);
|
||||||
|
const registerForm = ref();
|
||||||
|
const emit = defineEmits(['register', 'success']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
function add() {
|
||||||
|
title.value = '新增';
|
||||||
|
visible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
registerForm.value.add();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param record
|
||||||
|
*/
|
||||||
|
function edit(record) {
|
||||||
|
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||||
|
visible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
registerForm.value.edit(record);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定按钮点击事件
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
registerForm.value.submitForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* form保存回调事件
|
||||||
|
*/
|
||||||
|
function submitCallback() {
|
||||||
|
handleCancel();
|
||||||
|
emit('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消按钮回调事件
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
visible.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
disableSubmit,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/**隐藏样式-modal确定按钮 */
|
||||||
|
.jee-hidden {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from "/@/hooks/web/useMessage";
|
||||||
|
|
||||||
|
const { createConfirm } = useMessage();
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
list = '/appmana/survHisdataOrientwater/list',
|
||||||
|
save='/appmana/survHisdataOrientwater/add',
|
||||||
|
edit='/appmana/survHisdataOrientwater/edit',
|
||||||
|
deleteOne = '/appmana/survHisdataOrientwater/delete',
|
||||||
|
deleteBatch = '/appmana/survHisdataOrientwater/deleteBatch',
|
||||||
|
importExcel = '/appmana/survHisdataOrientwater/importExcel',
|
||||||
|
exportXls = '/appmana/survHisdataOrientwater/exportXls',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出api
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const getExportUrl = Api.exportXls;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入api
|
||||||
|
*/
|
||||||
|
export const getImportUrl = Api.importExcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表接口
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个
|
||||||
|
* @param params
|
||||||
|
* @param handleSuccess
|
||||||
|
*/
|
||||||
|
export const deleteOne = (params,handleSuccess) => {
|
||||||
|
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param params
|
||||||
|
* @param handleSuccess
|
||||||
|
*/
|
||||||
|
export const batchDelete = (params, handleSuccess) => {
|
||||||
|
createConfirm({
|
||||||
|
iconType: 'warning',
|
||||||
|
title: '确认删除',
|
||||||
|
content: '是否删除选中数据',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存或者更新
|
||||||
|
* @param params
|
||||||
|
* @param isUpdate
|
||||||
|
*/
|
||||||
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
|
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,267 @@
|
||||||
|
import {BasicColumn} from '/@/components/Table';
|
||||||
|
import {FormSchema} from '/@/components/Table';
|
||||||
|
import { rules} from '/@/utils/helper/validator';
|
||||||
|
import { render } from '/@/utils/common/renderUtils';
|
||||||
|
import {getStationList} from "/@/views/appmana/station/SurvStationInfo.api";
|
||||||
|
//列表数据
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
{
|
||||||
|
title: '站点名称',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'stationName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备编号',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'deployCode',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数据更新时间',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dataDateTime',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '数据ID',
|
||||||
|
// align: "center",
|
||||||
|
// dataIndex: 'dataId'
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '总磷(mg/L)',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dataWaterTpSy',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '总氮(mg/L)',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dataWaterTnSy',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '化学需氧量(mg/L)',
|
||||||
|
// align: 'center',
|
||||||
|
// dataIndex: 'dataWaterCodSy',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '硝态氮(mg/L)',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'dataWaterNoSy'
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '1#球阀状态',
|
||||||
|
// align: "center",
|
||||||
|
// dataIndex: 'firstValveStatus',
|
||||||
|
// customRender: ({ text }) => {
|
||||||
|
// if (!text || text == '00') {
|
||||||
|
// return '开';
|
||||||
|
// } else if (text == '01') {
|
||||||
|
// return '关';
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '2#球阀状态',
|
||||||
|
// align: "center",
|
||||||
|
// dataIndex: 'secondValveStatus',
|
||||||
|
// customRender: ({ text }) => {
|
||||||
|
// if (!text || text == '00') {
|
||||||
|
// return '开';
|
||||||
|
// } else if (text == '01') {
|
||||||
|
// return '关';
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
|
||||||
|
// {
|
||||||
|
// title: '数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据',
|
||||||
|
// align: "center",
|
||||||
|
// dataIndex: 'dataGatherType'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '转储时间',
|
||||||
|
// align: "center",
|
||||||
|
// dataIndex: 'transDate',
|
||||||
|
// },
|
||||||
|
];
|
||||||
|
|
||||||
|
//查询数据
|
||||||
|
export const searchFormSchema: FormSchema[] = [
|
||||||
|
{
|
||||||
|
field: 'stationCode',
|
||||||
|
component: 'ApiSelect',
|
||||||
|
label: '监测站点',
|
||||||
|
componentProps: {
|
||||||
|
// more details see /src/components/Form/src/components/ApiSelect.vue
|
||||||
|
api: getStationList,
|
||||||
|
params: {
|
||||||
|
id: 1,
|
||||||
|
stationType: 'orient'
|
||||||
|
},
|
||||||
|
resultField: 'list',
|
||||||
|
// use name as label
|
||||||
|
labelField: 'stationName',
|
||||||
|
// use id as value
|
||||||
|
valueField: 'stationCode',
|
||||||
|
// not request untill to select
|
||||||
|
immediate: false,
|
||||||
|
onChange: (e) => {
|
||||||
|
console.log('selected:', e);
|
||||||
|
},
|
||||||
|
// atfer request callback
|
||||||
|
onOptionsChange: (options) => {
|
||||||
|
console.log('get options', options.length, options);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
colProps: {
|
||||||
|
span: 8,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// field: 'deployId',
|
||||||
|
// component: 'ApiSelect',
|
||||||
|
// label: '选择设备',
|
||||||
|
// componentProps: {
|
||||||
|
// // more details see /src/components/Form/src/components/ApiSelect.vue
|
||||||
|
// api: getDeviceList,
|
||||||
|
// params: {
|
||||||
|
// id: 1,
|
||||||
|
// deployTypes: ["6_water"]
|
||||||
|
// },
|
||||||
|
// resultField: 'list',
|
||||||
|
// // use name as label
|
||||||
|
// labelField: 'deployDes',
|
||||||
|
// // use id as value
|
||||||
|
// valueField: 'id',
|
||||||
|
// // not request untill to select
|
||||||
|
// immediate: false,
|
||||||
|
// onChange: (e) => {
|
||||||
|
// console.log('selected:', e);
|
||||||
|
// },
|
||||||
|
// // atfer request callback
|
||||||
|
// onOptionsChange: (options) => {
|
||||||
|
// console.log('get options', options.length, options);
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// colProps: {
|
||||||
|
// span: 8,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
field: 'dataDateTime',
|
||||||
|
label: '监测时间',
|
||||||
|
component: 'RangePicker',
|
||||||
|
colProps: { span: 8 },
|
||||||
|
componentProps: {
|
||||||
|
picker: 'date',
|
||||||
|
valueFormat: 'YYYY-MM-DD',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'deployType',
|
||||||
|
label: '',
|
||||||
|
component: 'JInput',
|
||||||
|
colProps: { span: 8 },
|
||||||
|
ifShow: false,
|
||||||
|
defaultValue: 'orient_no',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'column',
|
||||||
|
label: '',
|
||||||
|
component: 'JInput',
|
||||||
|
colProps: { span: 8 },
|
||||||
|
ifShow: false,
|
||||||
|
defaultValue: 'dataDateTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'order',
|
||||||
|
label: '',
|
||||||
|
component: 'JInput',
|
||||||
|
colProps: { span: 8 },
|
||||||
|
ifShow: false,
|
||||||
|
defaultValue: 'desc',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
//表单数据
|
||||||
|
export const formSchema: FormSchema[] = [
|
||||||
|
{
|
||||||
|
label: '租户号',
|
||||||
|
field: 'tenantId',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '乐观锁',
|
||||||
|
field: 'reVision',
|
||||||
|
component: 'InputNumber',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '创建人',
|
||||||
|
field: 'createdBy',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '创建时间',
|
||||||
|
field: 'createTime',
|
||||||
|
component: 'DatePicker',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '更新人',
|
||||||
|
field: 'updatedBy',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '逻辑删除',
|
||||||
|
field: 'isDel',
|
||||||
|
component: 'InputNumber',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '更新时间',
|
||||||
|
field: 'updatedTime',
|
||||||
|
component: 'DatePicker',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '数据ID',
|
||||||
|
field: 'dataId',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '总磷',
|
||||||
|
field: 'dataWaterTp',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '总氮',
|
||||||
|
field: 'dataWaterTn',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '氨氮',
|
||||||
|
field: 'dataWaterNh',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '化学需氧量',
|
||||||
|
field: 'dataWaterCod',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '数据更新时间',
|
||||||
|
field: 'dataDateTime',
|
||||||
|
component: 'DatePicker',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '数据类型;realTime=实时,dayTime=日数据,month=月数据,year=年数据',
|
||||||
|
field: 'dataGatherType',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '转储时间',
|
||||||
|
field: 'transDate',
|
||||||
|
component: 'DatePicker',
|
||||||
|
},
|
||||||
|
// TODO 主键隐藏字段,目前写死为ID
|
||||||
|
{
|
||||||
|
label: '',
|
||||||
|
field: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,280 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<!--查询区域-->
|
||||||
|
<!-- <div class="jeecg-basic-table-form-container">-->
|
||||||
|
<!-- <a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">-->
|
||||||
|
<!-- <a-row :gutter="24">-->
|
||||||
|
<!-- <a-col :xs="24" :sm="8" :md="6" :lg="8" :xl="6" :xxl="6" style="margin-left: -10px; margin-top: 16px">-->
|
||||||
|
<!-- <a-form-item label="选择监测站" name="stationCode">-->
|
||||||
|
<!-- <ApiSelect-->
|
||||||
|
<!-- :api="getStationList"-->
|
||||||
|
<!-- :params="stationType"-->
|
||||||
|
<!-- showSearch-->
|
||||||
|
<!-- v-model:value="queryParam.stationCode"-->
|
||||||
|
<!-- optionFilterProp="label"-->
|
||||||
|
<!-- resultField="list"-->
|
||||||
|
<!-- labelField="stationName"-->
|
||||||
|
<!-- valueField="stationCode"-->
|
||||||
|
<!-- placeholder="请选择"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
|
||||||
|
<!-- <a-col :xs="24" :sm="8" :md="6" :lg="8" :xl="6" :xxl="6" style="margin-left: -10px; margin-top: 16px">-->
|
||||||
|
<!-- <a-form-item label="数据更新时间" name="dataDateTime">-->
|
||||||
|
<!-- <a-date-picker placeholder="" v-model:value="queryParam.dataDateTime" value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <template v-if="toggleSearchStatus">-->
|
||||||
|
<!-- <a-col :xs="24" :sm="8" :md="6" :lg="8" :xl="6" :xxl="6" style="margin-left: -10px; margin-top: 16px">-->
|
||||||
|
<!-- <a-form-item label="设备部署编号" name="deviceCode">-->
|
||||||
|
<!-- <a-input placeholder="请输入设备部署编号查询" v-model:value="queryParam.deviceCode"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <!– <a-col :xs="24" :sm="8" :md="6" :lg="8" :xl="6" :xxl="6" style="margin-left:-10px;margin-top: 16px;">-->
|
||||||
|
<!-- <a-form-item label="污染物类型" name="pollution">-->
|
||||||
|
<!-- <JDictSelectTag type="select" v-model:value="queryParam.pollution" dictCode="surv_orient_pullution" placeholder="请选择污染物类型" />-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col> –>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">-->
|
||||||
|
<!-- <a-col :xs="24" :sm="8" :md="6" :lg="8" :xl="6" :xxl="6" style="margin-left: -10px; margin-top: 16px">-->
|
||||||
|
<!-- <a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>-->
|
||||||
|
<!-- <a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>-->
|
||||||
|
<!-- <a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">-->
|
||||||
|
<!-- {{ toggleSearchStatus ? '收起' : '展开' }}-->
|
||||||
|
<!-- <Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />-->
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- </span>-->
|
||||||
|
<!-- </a-row>-->
|
||||||
|
<!-- </a-form>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!--引用表格-->
|
||||||
|
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||||
|
<!--插槽:table标题-->
|
||||||
|
<template #tableTitle>
|
||||||
|
<!-- <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> -->
|
||||||
|
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||||
|
<!-- <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> -->
|
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu>
|
||||||
|
<a-menu-item key="1" @click="batchHandleDelete">
|
||||||
|
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||||
|
删除
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
<!-- <a-button>批量操作
|
||||||
|
<Icon icon="mdi:chevron-down"></Icon>
|
||||||
|
</a-button> -->
|
||||||
|
</a-dropdown>
|
||||||
|
</template>
|
||||||
|
<!--操作栏-->
|
||||||
|
<template #action="{ record }">
|
||||||
|
<!-- <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> -->
|
||||||
|
<TableAction :actions="getDetailAction(record)" />
|
||||||
|
</template>
|
||||||
|
<!--字段回显插槽-->
|
||||||
|
<template #htmlSlot="{ text }">
|
||||||
|
<div v-html="text"></div>
|
||||||
|
</template>
|
||||||
|
<!--省市区字段回显插槽-->
|
||||||
|
<template #pcaSlot="{ text }">
|
||||||
|
{{ getAreaTextByCode(text) }}
|
||||||
|
</template>
|
||||||
|
<template #fileSlot="{ text }">
|
||||||
|
<span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
|
||||||
|
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<SurvHisdataOrientwaterModal ref="registerModal" @success="handleSuccess"></SurvHisdataOrientwaterModal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" name="appmana-survHisdataOrientwater" setup>
|
||||||
|
import { ref, reactive } from 'vue';
|
||||||
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||||
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
|
import { columns,searchFormSchema } from './SurvHisdataOrientwater.data';
|
||||||
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './SurvHisdataOrientwater.api';
|
||||||
|
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||||
|
import SurvHisdataOrientwaterModal from './components/SurvHisdataOrientwaterModal.vue';
|
||||||
|
import { ApiSelect } from '/@/components/Form/index';
|
||||||
|
import { getStationList } from '../../station/SurvStationInfo.api';
|
||||||
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
|
|
||||||
|
const formRef = ref();
|
||||||
|
const queryParam = reactive<any>({});
|
||||||
|
const toggleSearchStatus = ref<boolean>(false);
|
||||||
|
const registerModal = ref();
|
||||||
|
const stationType = { stationType: 'orient'};
|
||||||
|
//注册table数据
|
||||||
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
|
tableProps: {
|
||||||
|
title: 'surv_hisdata_orientwater',
|
||||||
|
api: list,
|
||||||
|
columns,
|
||||||
|
canResize: false,
|
||||||
|
useSearchForm: true,
|
||||||
|
actionColumn: {
|
||||||
|
width: 120,
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
beforeFetch: (params) => {
|
||||||
|
// queryParam.dataType = 'orient_no';
|
||||||
|
return Object.assign(params, queryParam);
|
||||||
|
},
|
||||||
|
formConfig: {
|
||||||
|
schemas: searchFormSchema,
|
||||||
|
fieldMapToTime: [['dataDateTime', ['dataDateTime_begin', 'dataDateTime_end'], 'YYYY-MM-DD']],
|
||||||
|
showAdvancedButton: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exportConfig: {
|
||||||
|
name: 'surv_hisdata_orientwater',
|
||||||
|
url: getExportUrl,
|
||||||
|
params: queryParam,
|
||||||
|
},
|
||||||
|
importConfig: {
|
||||||
|
url: getImportUrl,
|
||||||
|
success: handleSuccess,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] =
|
||||||
|
tableContext;
|
||||||
|
const labelCol = reactive({
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 7 },
|
||||||
|
});
|
||||||
|
const wrapperCol = reactive({
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 16 },
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增事件
|
||||||
|
*/
|
||||||
|
function handleAdd() {
|
||||||
|
registerModal.value.disableSubmit = false;
|
||||||
|
registerModal.value.add();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑事件
|
||||||
|
*/
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
registerModal.value.disableSubmit = false;
|
||||||
|
registerModal.value.edit(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
function handleDetail(record: Recordable) {
|
||||||
|
registerModal.value.disableSubmit = true;
|
||||||
|
registerModal.value.edit(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除事件
|
||||||
|
*/
|
||||||
|
async function handleDelete(record) {
|
||||||
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除事件
|
||||||
|
*/
|
||||||
|
async function batchHandleDelete() {
|
||||||
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功回调
|
||||||
|
*/
|
||||||
|
function handleSuccess() {
|
||||||
|
(selectedRowKeys.value = []) && reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作栏
|
||||||
|
*/
|
||||||
|
function getTableAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '编辑',
|
||||||
|
onClick: handleEdit.bind(null, record),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作栏
|
||||||
|
*/
|
||||||
|
function getDetailAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '详情',
|
||||||
|
onClick: handleDetail.bind(null, record),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉操作栏
|
||||||
|
*/
|
||||||
|
function getDropDownAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '详情',
|
||||||
|
onClick: handleDetail.bind(null, record),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
popConfirm: {
|
||||||
|
title: '是否确认删除',
|
||||||
|
confirm: handleDelete.bind(null, record),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*/
|
||||||
|
function searchQuery() {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function searchReset() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
//刷新数据
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.jeecg-basic-table-form-container {
|
||||||
|
.table-page-search-submitButtons {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.query-group-cust {
|
||||||
|
width: calc(50% - 15px);
|
||||||
|
min-width: 100px !important;
|
||||||
|
}
|
||||||
|
.query-group-split-cust {
|
||||||
|
width: 30px;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,247 @@
|
||||||
|
<template>
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="站点名称" v-bind="validateInfos.stationName">
|
||||||
|
<a-input v-model:value="formData.stationName" placeholder="" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<!-- <a-col :span="24">
|
||||||
|
<a-form-item label="设备名称" v-bind="validateInfos.deviceName">
|
||||||
|
<a-input v-model:value="formData.deviceName" placeholder="" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col> -->
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="设备编号" v-bind="validateInfos.deployCode">
|
||||||
|
<a-input v-model:value="formData.deployCode" placeholder="" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<!-- <a-col :span="24">
|
||||||
|
<a-form-item label="数据ID" v-bind="validateInfos.dataId">
|
||||||
|
<a-input v-model:value="formData.dataId" placeholder="" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col> -->
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="总磷(mg/L)" v-bind="validateInfos.dataWaterTpSy">
|
||||||
|
<a-input v-model:value="formData.dataWaterTpSy" placeholder="" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="总氮(mg/L)" v-bind="validateInfos.dataWaterTnSy">
|
||||||
|
<a-input v-model:value="formData.dataWaterTnSy" placeholder="" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="硝态氮(mg/L)" v-bind="validateInfos.dataWaterNoSy">
|
||||||
|
<a-input v-model:value="formData.dataWaterNoSy" placeholder="" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="化学需氧量(mg/L)" v-bind="validateInfos.dataWaterCod">-->
|
||||||
|
<!-- <a-input v-model:value="formData.dataWaterCod" placeholder="请输入化学需氧量" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="总磷水样" v-bind="validateInfos.dataWaterTpSy">-->
|
||||||
|
<!-- <a-input v-model:value="formData.dataWaterTpSy" placeholder="" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="总磷零点" v-bind="validateInfos.dataWaterTpLd">-->
|
||||||
|
<!-- <a-input v-model:value="formData.dataWaterTpLd" placeholder="" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="总氮水样" v-bind="validateInfos.dataWaterTnSy">-->
|
||||||
|
<!-- <a-input v-model:value="formData.dataWaterTnSy" placeholder="" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="总氮零点" v-bind="validateInfos.dataWaterTnLd">-->
|
||||||
|
<!-- <a-input v-model:value="formData.dataWaterTnLd" placeholder="" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="总氮零点" v-bind="validateInfos.fluidLevel">-->
|
||||||
|
<!-- <a-input v-model:value="formData.fluidLevel" placeholder="" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="1#球阀状态" v-bind="validateInfos.firstValveStatus">-->
|
||||||
|
<!-- <a-input v-model:value="formData.firstValveStatus" placeholder="" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="2#球阀状态" v-bind="validateInfos.secondValveStatus">-->
|
||||||
|
<!-- <a-input v-model:value="formData.secondValveStatus" placeholder="" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="急停状态" v-bind="validateInfos.crashStopStatus">-->
|
||||||
|
<!-- <a-input v-model:value="formData.crashStopStatus" placeholder="" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="水泵状态" v-bind="validateInfos.waterPumpStatus">-->
|
||||||
|
<!-- <a-input v-model:value="formData.waterPumpStatus" placeholder="" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :span="24">-->
|
||||||
|
<!-- <a-form-item label="主副泵状态" v-bind="validateInfos.mainSideStatus">-->
|
||||||
|
<!-- <a-input v-model:value="formData.mainSideStatus" placeholder="" :disabled="disabled"></a-input>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="数据更新时间" v-bind="validateInfos.dataDateTime">
|
||||||
|
<a-date-picker
|
||||||
|
placeholder=""
|
||||||
|
v-model:value="formData.dataDateTime"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
show-time="{ format: 'YYYY-MM-DD HH:mm:ss' }"
|
||||||
|
style="width: 100%"
|
||||||
|
:disabled="disabled"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<!-- <a-col :span="24">
|
||||||
|
<a-form-item label="数据类型" v-bind="validateInfos.dataGatherType">
|
||||||
|
<a-input v-model:value="formData.dataGatherType" placeholder="请输入数据类型" :disabled="disabled"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col> -->
|
||||||
|
<!-- <a-col :span="24">
|
||||||
|
<a-form-item label="转储时间" v-bind="validateInfos.transDate">
|
||||||
|
<a-date-picker placeholder="" v-model:value="formData.transDate" value-format="YYYY-MM-DD HH:mm:ss" show-time="{ format: 'YYYY-MM-DD HH:mm:ss' }" style="width: 100%" :disabled="disabled"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col> -->
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import { getValueType } from '/@/utils';
|
||||||
|
import { saveOrUpdate } from '../SurvHisdataOrientwater.api';
|
||||||
|
import { Form } from 'ant-design-vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
formDisabled: { type: Boolean, default: false },
|
||||||
|
formData: { type: Object, default: () => {} },
|
||||||
|
formBpm: { type: Boolean, default: true },
|
||||||
|
});
|
||||||
|
const formRef = ref();
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
const emit = defineEmits(['register', 'ok']);
|
||||||
|
const formData = reactive<Record<string, any>>({
|
||||||
|
id: '',
|
||||||
|
tenantId: '',
|
||||||
|
reVision: undefined,
|
||||||
|
createdBy: '',
|
||||||
|
createTime: '',
|
||||||
|
updatedBy: '',
|
||||||
|
isDel: undefined,
|
||||||
|
updatedTime: '',
|
||||||
|
dataId: '',
|
||||||
|
dataWaterTp: '',
|
||||||
|
dataWaterTn: '',
|
||||||
|
dataWaterNo: '',
|
||||||
|
dataDateTime: '',
|
||||||
|
dataGatherType: '',
|
||||||
|
transDate: '',
|
||||||
|
deviceName: '',
|
||||||
|
deviceCode: '',
|
||||||
|
stationName: '',
|
||||||
|
});
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||||
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||||
|
const confirmLoading = ref<boolean>(false);
|
||||||
|
//表单验证
|
||||||
|
const validatorRules = {};
|
||||||
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
|
||||||
|
|
||||||
|
// 表单禁用
|
||||||
|
const disabled = computed(() => {
|
||||||
|
if (props.formBpm === true) {
|
||||||
|
if (props.formData.disabled === false) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return props.formDisabled;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
function add() {
|
||||||
|
edit({});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
function edit(record) {
|
||||||
|
nextTick(() => {
|
||||||
|
resetFields();
|
||||||
|
//赋值
|
||||||
|
Object.assign(formData, record);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交数据
|
||||||
|
*/
|
||||||
|
async function submitForm() {
|
||||||
|
// 触发表单验证
|
||||||
|
await validate();
|
||||||
|
confirmLoading.value = true;
|
||||||
|
const isUpdate = ref<boolean>(false);
|
||||||
|
//时间格式化
|
||||||
|
let model = formData;
|
||||||
|
if (model.id) {
|
||||||
|
isUpdate.value = true;
|
||||||
|
}
|
||||||
|
//循环数据
|
||||||
|
for (let data in model) {
|
||||||
|
//如果该数据是数组并且是字符串类型
|
||||||
|
if (model[data] instanceof Array) {
|
||||||
|
let valueType = getValueType(formRef.value.getProps, data);
|
||||||
|
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||||
|
if (valueType === 'string') {
|
||||||
|
model[data] = model[data].join(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await saveOrUpdate(model, isUpdate.value)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
createMessage.success(res.message);
|
||||||
|
emit('ok');
|
||||||
|
} else {
|
||||||
|
createMessage.warning(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
confirmLoading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
submitForm,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.antd-modal-form {
|
||||||
|
min-height: 500px !important;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 24px 24px 24px 24px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
<template>
|
||||||
|
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||||
|
<SurvHisdataOrientwaterForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></SurvHisdataOrientwaterForm>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, nextTick, defineExpose } from 'vue';
|
||||||
|
import SurvHisdataOrientwaterForm from './SurvHisdataOrientwaterForm.vue'
|
||||||
|
|
||||||
|
const title = ref<string>('');
|
||||||
|
const width = ref<number>(800);
|
||||||
|
const visible = ref<boolean>(false);
|
||||||
|
const disableSubmit = ref<boolean>(false);
|
||||||
|
const registerForm = ref();
|
||||||
|
const emit = defineEmits(['register', 'success']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
function add() {
|
||||||
|
title.value = '新增';
|
||||||
|
visible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
registerForm.value.add();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param record
|
||||||
|
*/
|
||||||
|
function edit(record) {
|
||||||
|
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||||
|
visible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
registerForm.value.edit(record);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定按钮点击事件
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
registerForm.value.submitForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* form保存回调事件
|
||||||
|
*/
|
||||||
|
function submitCallback() {
|
||||||
|
handleCancel();
|
||||||
|
emit('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消按钮回调事件
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
visible.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
disableSubmit,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/**隐藏样式-modal确定按钮 */
|
||||||
|
.jee-hidden {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue