飞地调整接口对接。

dianlixunjian
刘妍 2024-07-03 17:03:53 +08:00
parent 06b5575de3
commit 442862040a
8 changed files with 170 additions and 102 deletions

View File

@ -1,6 +1,13 @@
// WFProcess 流程模版基本信息
import { defHttp } from '@/utils/http/axios';
import { taskCountParams, caseInfoParams, countModel, taskInfoParams, addCaseFavoriteParams } from './model/index';
import {
taskCountParams,
caseInfoParams,
countModel,
taskInfoParams,
addCaseFavoriteParams,
updateCaseInfoParams,
} from './model/index';
enum Api {
// 获取待办任务统计数据
@ -16,6 +23,10 @@ enum Api {
// 获取收藏案件列表
FavoriteCaseList = '/api/DroneCaseinfo/FavoriteCaseList',
DeleteFavoriteCase = '/api/DroneCaseinfo/DeleteFavoriteCase',
// 获取案件详情
GetCaseInfoById = '/api/DroneCaseInfoSingle/GetCaseInfoById',
// 更新案件行政区划
UpdateDroneCaseInfo = '/api/DroneCaseInfoSingle/UpdateDroneCaseInfo',
}
/**
@ -48,10 +59,15 @@ export function getLoadTaskDetailList(params?: taskInfoParams) {
export function addCaseFavorite(params?: addCaseFavoriteParams) {
return defHttp.post({ url: Api.AddCaseFavorite, params });
}
export function deleteFavoriteCase(params: string){
return defHttp.post({ url: Api.DeleteFavoriteCase, data:params });
export function deleteFavoriteCase(params: string) {
return defHttp.post({ url: Api.DeleteFavoriteCase, data: params });
}
export function getFavoriteCaseList(params?: {uid:string}) {
export function getFavoriteCaseList(params?: { uid: string }) {
return defHttp.get({ url: Api.FavoriteCaseList, params });
}
}
export function getCaseInfoById(params?: { id: string }) {
return defHttp.get({ url: Api.GetCaseInfoById, params });
}
export const updateDroneCaseInfo = (params: updateCaseInfoParams) =>
defHttp.post({ url: Api.UpdateDroneCaseInfo, params });

View File

@ -13,9 +13,9 @@ export interface taskInfoParams {
}
export interface addCaseFavoriteParams {
id: string,
caseNo: string,
favoriteUserId: string,
id: string;
caseNo: string;
favoriteUserId: string;
}
export interface caseInfoParams {
@ -42,3 +42,13 @@ export interface countItem {
count: number;
}
export type countModel = countItem[];
export interface updateCaseInfoParams {
id?: string;
countyid?: string;
countyname?: string;
streetid?: string;
streetname?: string;
communityid?: string;
communityname?: string;
}

View File

@ -33,7 +33,7 @@
<MenuItem
key="logout"
:text="t('layout.header.dropdownItemLoginOut')"
icon="ion:power-outline"
icon="ant-design:retweet-outlined"
/>
</Menu>
</template>

View File

@ -6,7 +6,7 @@
"header": {
"dropdownChangeApi": "Change Api",
"dropdownItemDoc": "Document",
"dropdownItemLoginOut": "Log Out",
"dropdownItemLoginOut": "Switched Systems",
"tooltipErrorLog": "Error log",
"tooltipLock": "Lock screen",
"tooltipNotify": "Notification",

View File

@ -6,7 +6,7 @@
"header": {
"dropdownChangeApi": "切换API",
"dropdownItemDoc": "文档",
"dropdownItemLoginOut": "退出系统",
"dropdownItemLoginOut": "切换系统",
"tooltipErrorLog": "错误日志",
"tooltipLock": "锁定屏幕",
"tooltipNotify": "消息通知",

View File

@ -1,117 +1,163 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" title="飞地调整" @ok="handleSubmit">
<BasicForm @register="registerForm" />
<a-form
ref="formRef"
:model="formState"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-item ref="name" label="案件编号">
<a-input v-model:value="formState.case_no" disabled />
</a-form-item>
<a-form-item ref="name" label="案件描述">
<a-input v-model:value="formState.case_description" disabled />
</a-form-item>
<a-form-item label="县区" name="countyid">
<a-select
v-model:value="formState.countyid"
placeholder="请选择"
:options="data.countyOptions"
@change="handleCountyChange"
:field-names="{ label: 'name', value: 'id' }"
/>
</a-form-item>
<a-form-item label="乡镇" name="streetid">
<a-select
v-model:value="formState.streetid"
:options="data.streetOptions"
:field-names="{ label: 'name', value: 'id' }"
@change="handleStreetChange"
/>
</a-form-item>
<a-form-item label="村/社区" name="communityid">
<a-select
v-model:value="formState.communityid"
:options="data.communityOptions"
:field-names="{ label: 'name', value: 'id' }"
@change="handleCommunityChange"
/>
</a-form-item>
</a-form>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref } from 'vue';
import { ref, reactive, onMounted } from 'vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { accountFormSchema } from './account.data';
import { addAccount } from '@/api/demo/system';
import { useMessage } from '@/hooks/web/useMessage';
import md5 from 'js-md5';
import { fun_getCaseInfo } from '@/api/demo/query';
import { updateDroneCaseInfo, getCaseInfoById } from '@/api/bootstraps/index.ts';
import { getChildrenTree } from '@/api/demo/system.ts';
const { createMessage } = useMessage();
defineOptions({ name: 'AccountModal' });
const formRef = ref();
const emit = defineEmits(['success', 'register']);
const isUpdate = ref(true);
const rowId = ref('');
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
labelWidth: 100,
baseColProps: { span: 24 },
schemas: [
{
field: 'id',
label: '县区',
component: 'Input',
required: true,
},
{
field: 'account',
label: '乡镇',
component: 'Input',
// helpMessage: ['', 'admin'],
rules: [
{
required: true,
message: '请输入账号',
},
// {
// trigger: 'blur',
// validator(_, value) {
// return new Promise((resolve, reject) => {
// if (!value) return resolve();
// isAccountExist(value)
// .then(resolve)
// .catch((err) => {
// reject(err.message || '');
// });
// });
// },
// },
],
},
{
field: 'name',
label: '村/社区',
component: 'Input',
required: true,
},
],
showActionButtonGroup: false,
actionColOptions: {
span: 23,
},
});
const labelCol = { span: 4 };
const wrapperCol = { span: 14 };
const formState: any = ref({});
const case_no = ref();
const rules = ref({
countyid: [{ required: true, message: '县区不能为空', trigger: 'blur' }],
streetid: [{ required: true, message: '乡镇不能为空', trigger: 'blur' }],
communityid: [{ required: true, message: '村/社区不能为空', trigger: 'blur' }],
});
const data = reactive({
countyOptions: [],
streetOptions: [],
communityOptions: [],
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields();
setModalProps({ confirmLoading: false });
console.log(data);
isUpdate.value = !!data?.isUpdate;
case_no.value = data.record.id;
getDetail();
if (unref(isUpdate)) {
rowId.value = data.record.id;
setFieldsValue({
...data.record,
});
}
getParent();
});
async function getDetail() {
const data = await fun_getCaseInfo({
const data = await getCaseInfoById({
id: case_no.value,
});
console.log(data);
setFieldsValue({
...data,
formState.value = data;
}
async function handleCountyChange(value, option) {
formState.value.countyid = value;
formState.value.countyname = option.name;
getOptions(value).then((res) => {
data.streetOptions = res;
});
formState.value.streetid = '';
formState.value.communityid = '';
}
async function handleStreetChange(value, option) {
formState.value.streetid = value;
formState.value.streetname = option.name;
getOptions(value).then((res) => {
data.communityOptions = res;
});
}
async function handleCommunityChange(value, option) {
formState.value.communityid = value;
formState.value.communityname = option.name;
}
async function getOptions(value) {
const data = await getChildrenTree({
parentId: value,
});
data.forEach((item) => {
item.id = item.id.toString();
});
return data;
}
async function getParent() {
const list = await getChildrenTree({
parentId: 0,
});
//
getOptions(list[0].id).then((res) => {
data.countyOptions = res;
});
//
getOptions(formState.value.countyid).then((res) => {
data.streetOptions = res;
});
// /
getOptions(formState.value.streetid).then((res) => {
data.communityOptions = res;
});
}
async function handleSubmit() {
try {
const values = await validate();
setModalProps({ confirmLoading: true });
if (values.password) {
values.password = md5(values.password);
}
const data = await addAccount(values);
console.log(data);
if (data) {
// TODO custom api
closeModal();
emit('success', { isUpdate: unref(isUpdate), values: { ...values, id: rowId.value } });
return createMessage.success('成功');
} else {
return createMessage.error('失败');
}
formRef.value
.validate()
.then(async () => {
var querys = {
id: formState.value.id,
countyid: formState.value.countyid,
countyname: formState.value.countyname,
streetid: formState.value.streetid,
streetname: formState.value.streetname,
communityid: formState.value.communityid,
communityname: formState.value.communityname,
};
console.log(querys);
const data = await updateDroneCaseInfo(querys);
console.log(data);
if (data) {
closeModal();
return createMessage.success(data);
} else {
return createMessage.error(data);
}
})
.catch((error: ValidateErrorEntity<FormState>) => {
console.log('error', error);
});
} finally {
setModalProps({ confirmLoading: false });
}
}
onMounted(() => {
getParent();
});
</script>

View File

@ -506,7 +506,6 @@
}
}
.pagination-div {
height: 30px;
display: flex;
align-items: center;
background: @component-background;

View File

@ -147,7 +147,6 @@
infoScreenData.value.countyId = item.areaid;
municipalAreaOptions.value = [{ label: item.areaname, value: item.areaid }];
getChildrenTree({ parentId: item.areaid }).then((res) => {
console.log(res);
res.forEach((cityItem) => {
countiesAreaOptions.value.push({
label: cityItem.name,
@ -159,7 +158,6 @@
} else {
cityType.value = null;
}
console.log(item);
};
const getParams = () => {
let result = {};
@ -247,7 +245,6 @@
};
function changeTask(val) {
console.log(val);
let getGeomPrams = {
TableName: 'drone_shp_data ',
FieldName: 'gid',