重大危险源编码更改

dev
dengjia 2025-07-23 12:02:15 +08:00
parent 509977dfa4
commit 747e282b86
2 changed files with 52 additions and 19 deletions

View File

@ -92,23 +92,38 @@
</el-col>
<el-col :span="12">
<el-form-item label="重大危险源编码">
<el-input v-model="item.majorHazardCode"> </el-input>
<!-- <el-popover placement="right" :width="400" trigger="click">
<template #reference>
<el-button style="margin-right: 16px"
>Click to activate</el-button
>
<el-dropdown
:hide-on-click="false"
trigger="click"
style="width: 100%"
>
<el-button style="flex: 1; justify-content: end">
<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-table :data="gridData">
<el-table-column width="150" property="date" label="date" />
<el-table-column width="100" property="name" label="name" />
<el-table-column
width="300"
property="address"
label="address"
/>
</el-table>
</el-popover> -->
</el-dropdown>
</el-form-item>
</el-col>
<el-col :span="12">
@ -184,6 +199,7 @@ import { getAreaListTree } from "@/request/data_dictionary.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";
const { dictionariesList } = await getAreaListTree();
const visible = defineModel("visible", { type: Boolean, required: true });
const props = defineProps({
@ -214,7 +230,6 @@ const form = ref({
isOpenSpecialInspection: 0, //
isDustExplosion: 0, //
});
const rules = {
companyName: [
{ required: true, message: "企业名称不能为空", trigger: "blur" },
@ -376,6 +391,9 @@ const fnGetData = async () => {
? `${form.value.longitude}-${form.value.latitude}`
: "";
thirdList.value = data.thirdList;
thirdList.value.forEach((item) => {
item.majorHazardCode = JSON.parse(item.majorHazardCode);
});
};
fnGetData();
@ -388,7 +406,7 @@ const thirdList = ref([
{
thirdPlatformId: "",
companyCode: "",
majorHazardCode: "",
majorHazardCode: [{ code: "" }],
accessKey: "",
rsaPublicKey: "",
url: "",
@ -402,7 +420,7 @@ const fnAddThirdList = () => {
thirdList.value.push({
thirdPlatformId: "",
companyCode: "",
majorHazardCode: "",
majorHazardCode: [{ code: "" }],
accessKey: "",
rsaPublicKey: "",
url: "",
@ -413,6 +431,7 @@ const fnAddThirdList = () => {
});
};
const fnReduceThirdList = (index) => {
if (thirdList.value.length <= 1) return;
thirdList.value.splice(index, 1);
};
const visibleMap = ref(false);
@ -432,6 +451,12 @@ const checkThirdListItem = () => {
}
return true;
};
const fnMajorHazardCodeAdd = (item) => {
item.majorHazardCode.push({ code: "" });
};
const fnMajorHazardCodeReduce = (item, index) => {
item.majorHazardCode.splice(index, 1);
};
const sectorIdRef = ref("");
const fnSubmit = debounce(
@ -444,6 +469,10 @@ const fnSubmit = debounce(
const [province = "", city = "", county = ""] = form.value.area;
const sectorId = form.value.sectorId.join(",");
thirdList.value.forEach((item) => {
if (item.majorHazardCode.length > 0)
item.majorHazardCode = JSON.stringify(item.majorHazardCode);
});
const params = {
...form.value,
sectorId,

View File

@ -109,6 +109,10 @@ const fnGetData = async () => {
info.value.address = `${info.value.longitude}-${info.value.latitude}`;
}
thirdList.value = info.value.thirdList;
thirdList.value.forEach((item) => {
const codeArr = JSON.parse(item.majorHazardCode);
item.majorHazardCode = codeArr.map((item) => item.code).join(",");
});
const { data: servicePlatformList } = await getBusServicePlatformListAll();
target.value = servicePlatformList.find(
(item) => item.id === info.value.servicePlatformId