属地修改、登录增加按钮

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

View File

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

View File

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

View File

@ -116,7 +116,13 @@ const fnGetData = async () => {
if (!props.corpInfoId) return;
const { data } = await getBusThirdPlatform({ id: props.corpInfoId });
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();
const fnClose = () => {

View File

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