重大危险源编码更改

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

View File

@ -109,6 +109,10 @@ const fnGetData = async () => {
info.value.address = `${info.value.longitude}-${info.value.latitude}`; info.value.address = `${info.value.longitude}-${info.value.latitude}`;
} }
thirdList.value = info.value.thirdList; 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(); const { data: servicePlatformList } = await getBusServicePlatformListAll();
target.value = servicePlatformList.find( target.value = servicePlatformList.find(
(item) => item.id === info.value.servicePlatformId (item) => item.id === info.value.servicePlatformId