属地修改、登录增加按钮

dev
dengjia 2025-08-25 15:21:34 +08:00
parent e7cc293caf
commit 1503c3218a
5 changed files with 99 additions and 85 deletions

View File

@ -1,6 +1,5 @@
<template> <template>
<el-dialog v-model="visible" :title="title" :before-close="fnClose"> <el-dialog v-model="visible" :title="title" :before-close="fnClose">
{{ form }}
<el-form <el-form
ref="formRef" ref="formRef"
:rules="rules" :rules="rules"
@ -12,7 +11,11 @@
<el-row :gutter="24"> <el-row :gutter="24">
<form-items-renderer v-model="form" :options="baseInfoOptions"> <form-items-renderer v-model="form" :options="baseInfoOptions">
<template #area> <template #area>
<app-area-cascader v-model="form.area" check-strictly /> <app-area-cascader
ref="areaRef"
v-model="form.area"
check-strictly
/>
</template> </template>
<template #sectorId> <template #sectorId>
<app-cascader <app-cascader
@ -25,14 +28,7 @@
</template> </template>
<template #address> <template #address>
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<el-input v-model="form.address" disabled> <el-input v-model="form.address" disabled> </el-input>
<!-- <template #append
>
<el-button type="primary" @click="handleMap"
>定位</el-button
></template
> -->
</el-input>
<el-button class="ml-10" type="primary" @click="handleMap" <el-button class="ml-10" type="primary" @click="handleMap"
>定位</el-button >定位</el-button
> >
@ -91,53 +87,57 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="重大危险源编码"> <el-form-item label="重大危险源编码">
<el-dropdown <el-popover placement="bottom" :width="300" trigger="click">
:hide-on-click="false" <template #reference>
trigger="click" <div class="code_container">
style="width: 100%" <div
style="
flex: 1;
border: 1px solid #dcdfe6;
height: 32px;
cursor: pointer;
border-radius: 4px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 200px;
"
class="plr-10"
> >
<!-- <div {{
class="code_container" item.majorHazardCode.length > 0
style="flex: 1; justify-content: end; border: 1px solid #dcdfe6" ? item.majorHazardCode
> .map((item) => item.code)
<div style=""> .join(",")
{{ item.majorHazardCode.map((item) => item.code).join(",") }} : ""
}}
</div> </div>
<el-icon class="el-icon--right"><arrow-down /></el-icon> <el-button type="primary" class="ml-10">添加编码</el-button>
</div> --> </div>
<el-input v-model="item.majorHazardCodeFirst.code"> </template>
<template #append <div>
><el-icon class="el-icon--right"><arrow-down /></el-icon
></template>
</el-input>
<!-- <el-button style="flex: 1; justify-content: end">
{{ item.majorHazardCode.map((item) => item.code).join(",") }}
<el-icon class="el-icon--right"><arrow-down /></el-icon>
</el-button> -->
<template #dropdown>
<el-dropdown-menu style="width: 240px">
<el-button <el-button
class="ml-16" class="ml-16 mb-10"
type="primary" type="primary"
size="small" size="small"
@click="fnMajorHazardCodeAdd(item)" @click="fnMajorHazardCodeAdd(item)"
>添加</el-button >添加</el-button
> >
<el-dropdown-item <div
v-for="(itemChild, indexChild) in item.majorHazardCode" v-for="(itemChild, indexChild) in item.majorHazardCode"
:key="indexChild" :key="indexChild"
><el-input v-model="itemChild.code" class="mb-10"
>
<el-input v-model="itemChild.code"
><template #append ><template #append
><span ><span @click="fnMajorHazardCodeReduce(item, indexChild)"
@click="fnMajorHazardCodeReduce(item, indexChild)"
>删除</span >删除</span
></template ></template
></el-input ></el-input
></el-dropdown-item
> >
</el-dropdown-menu> </div>
</template> </div>
</el-dropdown> </el-popover>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -208,7 +208,7 @@
<script setup> <script setup>
import useForm from "@/hooks/useForm.js"; import useForm from "@/hooks/useForm.js";
import { ref, watch } from "vue"; import { ref, watch, useTemplateRef } from "vue";
import { debounce } from "throttle-debounce"; import { debounce } from "throttle-debounce";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import FormItemsRenderer from "@/components/form_builder/form_items_renderer.vue"; import FormItemsRenderer from "@/components/form_builder/form_items_renderer.vue";
@ -222,7 +222,7 @@ import { STATUS_LIST, WHETHER_LIST } from "@/assets/js/constant.js";
import AppCascader from "@/components/cascader/index.vue"; import AppCascader from "@/components/cascader/index.vue";
import AppMap from "@/components/map/map.vue"; import AppMap from "@/components/map/map.vue";
import { UNIFIED_SOCIAL_CREDIT_CODE } from "@/assets/js/regular.js"; import { UNIFIED_SOCIAL_CREDIT_CODE } from "@/assets/js/regular.js";
import { ArrowDown } from "@element-plus/icons-vue"; // import { ArrowDown } from "@element-plus/icons-vue";
import AppAreaCascader from "@/components/area_cascader/index.vue"; import AppAreaCascader from "@/components/area_cascader/index.vue";
const visible = defineModel("visible", { type: Boolean, required: true }); const visible = defineModel("visible", { type: Boolean, required: true });
const props = defineProps({ const props = defineProps({
@ -411,7 +411,6 @@ const thirdList = ref([
{ {
thirdPlatformId: "", thirdPlatformId: "",
companyCode: "", companyCode: "",
majorHazardCodeFirst: { code: "" },
majorHazardCode: [], majorHazardCode: [],
accessKey: "", accessKey: "",
rsaPublicKey: "", rsaPublicKey: "",
@ -428,7 +427,6 @@ const fnAddThirdList = () => {
thirdList.value.push({ thirdList.value.push({
thirdPlatformId: "", thirdPlatformId: "",
companyCode: "", companyCode: "",
majorHazardCodeFirst: { code: "" },
majorHazardCode: [], majorHazardCode: [],
accessKey: "", accessKey: "",
rsaPublicKey: "", rsaPublicKey: "",
@ -488,20 +486,14 @@ const fnGetData = async () => {
thirdList.value = data.thirdList; thirdList.value = data.thirdList;
thirdList.value.forEach((item) => { thirdList.value.forEach((item) => {
if (item.majorHazardCode) { if (item.majorHazardCode) {
const codeArr = JSON.parse(item.majorHazardCode); item.majorHazardCode = JSON.parse(item.majorHazardCode);
if (codeArr.length === 0) {
item.majorHazardCodeFirst = { code: "" };
} else {
item.majorHazardCodeFirst = codeArr[0];
item.majorHazardCode = codeArr.slice(1);
}
} }
}); });
}; };
fnGetData(); fnGetData();
const sectorIdRef = ref(""); const sectorIdRef = ref("");
const appAreaRef = useTemplateRef("areaRef");
const fnSubmit = debounce( const fnSubmit = debounce(
1000, 1000,
async () => { async () => {
@ -514,10 +506,6 @@ const fnSubmit = debounce(
const sectorId = form.value.sectorId.join(","); const sectorId = form.value.sectorId.join(",");
thirdList.value.forEach((item) => { thirdList.value.forEach((item) => {
item.majorHazardCode = [
item.majorHazardCodeFirst,
...item.majorHazardCode,
];
item.majorHazardCode = item.majorHazardCode.filter( item.majorHazardCode = item.majorHazardCode.filter(
(item) => item.code !== "" (item) => item.code !== ""
); );
@ -531,6 +519,7 @@ const fnSubmit = debounce(
county, county,
village, village,
street, street,
areaName: appAreaRef.value.getCheckedNodes(),
sectorName, sectorName,
thirdList: thirdList.value, thirdList: thirdList.value,
}; };
@ -559,7 +548,7 @@ const fnSubmit = debounce(
} }
.code_container { .code_container {
display: flex; display: flex;
justify-content: end; flex: 1;
border: 1px solid #dcdfe6; align-items: center;
} }
</style> </style>

View File

@ -41,7 +41,7 @@ const target = ref({});
const options = [ const options = [
{ key: "companyName", label: "企业名称" }, { key: "companyName", label: "企业名称" },
{ key: "code", label: "统一社会信用代码" }, { key: "code", label: "统一社会信用代码" },
{ key: "area", label: "属地" }, { key: "areaName", label: "属地" },
{ key: "sectorName", label: "所属行业" }, { key: "sectorName", label: "所属行业" },
{ key: "address", label: "经营地址" }, { key: "address", label: "经营地址" },
{ key: "companyStatus", label: "企业状态" }, { key: "companyStatus", label: "企业状态" },
@ -104,9 +104,9 @@ const thirdListOptions = [
const fnGetData = async () => { const fnGetData = async () => {
const { data } = await getBusCompanyInfo({ id: id }); const { data } = await getBusCompanyInfo({ id: id });
info.value = data; info.value = data;
if (info.value.province) { // if (info.value.province) {
info.value.area = `${info.value.province},${info.value.city}, ${info.value.county}`; // info.value.area = `${info.value.province} ${info.value.city} ${info.value.county} ${info.value.village} ${info.value.street}`;
} // }
if (info.value.longitude) { if (info.value.longitude) {
info.value.address = `${info.value.longitude}-${info.value.latitude}`; info.value.address = `${info.value.longitude}-${info.value.latitude}`;
} }

View File

@ -8,7 +8,7 @@
label-width="160px" label-width="160px"
> >
<template #area> <template #area>
<app-area-cascader v-model="form.area" check-strictly /> <app-area-cascader ref="areaRef" v-model="form.area" check-strictly />
</template> </template>
</app-form-builder> </app-form-builder>
<template #footer> <template #footer>
@ -20,7 +20,7 @@
<script setup> <script setup>
import useForm from "@/hooks/useForm.js"; import useForm from "@/hooks/useForm.js";
import { ref } from "vue"; import { ref, useTemplateRef } from "vue";
import { debounce } from "throttle-debounce"; import { debounce } from "throttle-debounce";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import AppFormBuilder from "@/components/form_builder/index.vue"; import AppFormBuilder from "@/components/form_builder/index.vue";
@ -122,19 +122,31 @@ const fnGetData = async () => {
if (!props.corpInfoId) return; if (!props.corpInfoId) return;
const { data } = await getBusThirdPlatform({ id: props.corpInfoId }); const { data } = await getBusThirdPlatform({ id: props.corpInfoId });
form.value = data; form.value = data;
form.value.area = [form.value.province, form.value.city, form.value.county]; form.value.area = [
form.value.province,
form.value.city,
form.value.county,
form.value.village,
form.value.street,
];
}; };
fnGetData(); fnGetData();
const appAreaRef = useTemplateRef("areaRef");
const fnSubmit = debounce( const fnSubmit = debounce(
1000, 1000,
async () => { async () => {
await validate(); await validate();
const [province = "", city = "", county = ""] = form.value.area; const [province = "", city = "", county = "", village = "", street = ""] =
form.value.area;
const params = { const params = {
...form.value, ...form.value,
province, province,
city, city,
county, county,
village,
street,
areaName: appAreaRef.value.getCheckedNodes(),
}; };
!props.corpInfoId !props.corpInfoId
? await setBusThirdPlatformAdd(params) ? await setBusThirdPlatformAdd(params)

View File

@ -116,7 +116,13 @@ const fnGetData = async () => {
if (!props.corpInfoId) return; if (!props.corpInfoId) return;
const { data } = await getBusThirdPlatform({ id: props.corpInfoId }); const { data } = await getBusThirdPlatform({ id: props.corpInfoId });
form.value = data; form.value = data;
form.value.area = [form.value.province, form.value.city, form.value.county]; form.value.area = [
form.value.province,
form.value.city,
form.value.county,
form.value.village,
form.value.street,
];
}; };
fnGetData(); fnGetData();
const fnClose = () => { const fnClose = () => {

View File

@ -1,8 +1,12 @@
<template> <template>
<div class="login login-container"> <div class="login login-container">
<div class="logo"> <!-- <div class="logo"> -->
<!-- <img src="/src/assets/images/login/logo.png" alt="" width="500" /> --> <!-- <img src="/src/assets/images/login/logo.png" alt="" width="500" /> -->
<!-- </div> -->
<div class="btn">
<el-button class="mr-10 mt-5">跳转API</el-button>
</div> </div>
<div class="form"> <div class="form">
<div class="title mb-20">欢迎登录数据交换平台</div> <div class="title mb-20">欢迎登录数据交换平台</div>
<el-form <el-form
@ -146,7 +150,10 @@ const fnSubmitLogin = async () => {
width: 100%; width: 100%;
pointer-events: none; pointer-events: none;
} }
.btn {
display: flex;
justify-content: end;
}
.form { .form {
border-radius: 5px; border-radius: 5px;
box-shadow: 0 0 20px rgb(109 109 109 / 40%); box-shadow: 0 0 20px rgb(109 109 109 / 40%);