Commit e2897c3f authored by 耿迪迪's avatar 耿迪迪

企业信息管理

parent db714c11
package com.zehong.web.controller.baseinfo;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.baseinfo.TEnterpriseInfo;
import com.zehong.system.service.baseinfo.ITEnterpriseInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 企业基础信息管理Controller
*
* @author zehong
* @date 2022-06-23
*/
@RestController
@RequestMapping("/baseInfo/enterpriseInfo")
public class TEnterpriseInfoController extends BaseController
{
@Autowired
private ITEnterpriseInfoService tEnterpriseInfoService;
/**
* 查询企业基础信息管理列表
*/
//@PreAuthorize("@ss.hasPermi('safetyManagement:enterpriseInfo:list')")
@GetMapping("/list")
public TableDataInfo list(TEnterpriseInfo tEnterpriseInfo)
{
startPage();
List<TEnterpriseInfo> list = tEnterpriseInfoService.selectTEnterpriseInfoList(tEnterpriseInfo);
return getDataTable(list);
}
/**
* 导出企业基础信息管理列表
*/
@Log(title = "企业基础信息管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TEnterpriseInfo tEnterpriseInfo)
{
List<TEnterpriseInfo> list = tEnterpriseInfoService.selectTEnterpriseInfoList(tEnterpriseInfo);
ExcelUtil<TEnterpriseInfo> util = new ExcelUtil<TEnterpriseInfo>(TEnterpriseInfo.class);
return util.exportExcel(list, "企业基础信息管理数据");
}
/**
* 获取企业基础信息管理详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tEnterpriseInfoService.selectTEnterpriseInfoById(id));
}
/**
* 新增企业基础信息管理
*/
@Log(title = "企业基础信息管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TEnterpriseInfo tEnterpriseInfo)
{
return toAjax(tEnterpriseInfoService.insertTEnterpriseInfo(tEnterpriseInfo));
}
/**
* 修改企业基础信息管理
*/
@Log(title = "企业基础信息管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TEnterpriseInfo tEnterpriseInfo)
{
return toAjax(tEnterpriseInfoService.updateTEnterpriseInfo(tEnterpriseInfo));
}
/**
* 删除企业基础信息管理
*/
@Log(title = "企业基础信息管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tEnterpriseInfoService.deleteTEnterpriseInfoByIds(ids));
}
}
package com.zehong.system.domain.baseinfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
* 企业基础信息管理对象 t_enterprise_info
*
* @author zehong
* @date 2022-06-23
*/
public class TEnterpriseInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 单位名称 */
@Excel(name = "单位名称")
private String unitName;
/** 社会统一信用代码 */
@Excel(name = "社会统一信用代码")
private String orgCode;
/** 生产经营地址 */
@Excel(name = "生产经营地址")
private String runAddress;
/** 注册地址 */
@Excel(name = "注册地址")
private String regAddress;
/** 安全监管分类 */
@Excel(name = "安全监管分类")
private String regulationType;
/** 成立日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "成立日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date regDate;
/** 营业期限 */
@Excel(name = "营业期限")
private String businessTerm;
/** 值班电话 */
@Excel(name = "值班电话")
private String dutyPhone;
/** 经度 */
@Excel(name = "经度")
private BigDecimal longitude;
/** 纬度 */
@Excel(name = "纬度")
private BigDecimal latitude;
/** 经营范围 */
@Excel(name = "经营范围")
private String businessScope;
/** 从业人员数量 */
@Excel(name = "从业人员数量")
private String employeeNum;
/** 法定代表人 */
@Excel(name = "法定代表人")
private String legalPerson;
/** 法定代表人手机 */
@Excel(name = "法定代表人手机")
private String legalPersonPhone;
/** 主要负责人 */
@Excel(name = "主要负责人")
private String keyPerson;
/** 主要负责人手机 */
@Excel(name = "主要负责人手机")
private String keyPersonPhone;
/** 安全负责人 */
@Excel(name = "安全负责人")
private String safetyPerson;
/** 安全负责人手机 */
@Excel(name = "安全负责人手机")
private String safetyPersonPhone;
/** 创建人id */
@Excel(name = "创建人id")
private String createUserId;
/** 更新人id */
@Excel(name = "更新人id")
private String updateUserId;
/** 备注 */
@Excel(name = "备注")
private String remarks;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUnitName(String unitName)
{
this.unitName = unitName;
}
public String getUnitName()
{
return unitName;
}
public void setOrgCode(String orgCode)
{
this.orgCode = orgCode;
}
public String getOrgCode()
{
return orgCode;
}
public void setRunAddress(String runAddress)
{
this.runAddress = runAddress;
}
public String getRunAddress()
{
return runAddress;
}
public void setRegAddress(String regAddress)
{
this.regAddress = regAddress;
}
public String getRegAddress()
{
return regAddress;
}
public void setRegulationType(String regulationType)
{
this.regulationType = regulationType;
}
public String getRegulationType()
{
return regulationType;
}
public void setRegDate(Date regDate)
{
this.regDate = regDate;
}
public Date getRegDate()
{
return regDate;
}
public void setBusinessTerm(String businessTerm)
{
this.businessTerm = businessTerm;
}
public String getBusinessTerm()
{
return businessTerm;
}
public void setLongitude(BigDecimal longitude)
{
this.longitude = longitude;
}
public BigDecimal getLongitude()
{
return longitude;
}
public void setLatitude(BigDecimal latitude)
{
this.latitude = latitude;
}
public BigDecimal getLatitude()
{
return latitude;
}
public void setBusinessScope(String businessScope)
{
this.businessScope = businessScope;
}
public String getBusinessScope()
{
return businessScope;
}
public void setEmployeeNum(String employeeNum)
{
this.employeeNum = employeeNum;
}
public String getEmployeeNum()
{
return employeeNum;
}
public void setLegalPerson(String legalPerson)
{
this.legalPerson = legalPerson;
}
public String getLegalPerson()
{
return legalPerson;
}
public void setLegalPersonPhone(String legalPersonPhone)
{
this.legalPersonPhone = legalPersonPhone;
}
public String getLegalPersonPhone()
{
return legalPersonPhone;
}
public void setKeyPerson(String keyPerson)
{
this.keyPerson = keyPerson;
}
public String getKeyPerson()
{
return keyPerson;
}
public void setKeyPersonPhone(String keyPersonPhone)
{
this.keyPersonPhone = keyPersonPhone;
}
public String getKeyPersonPhone()
{
return keyPersonPhone;
}
public void setSafetyPerson(String safetyPerson)
{
this.safetyPerson = safetyPerson;
}
public String getSafetyPerson()
{
return safetyPerson;
}
public void setSafetyPersonPhone(String safetyPersonPhone)
{
this.safetyPersonPhone = safetyPersonPhone;
}
public String getSafetyPersonPhone()
{
return safetyPersonPhone;
}
public void setCreateUserId(String createUserId)
{
this.createUserId = createUserId;
}
public String getCreateUserId()
{
return createUserId;
}
public void setUpdateUserId(String updateUserId)
{
this.updateUserId = updateUserId;
}
public String getUpdateUserId()
{
return updateUserId;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
public String getDutyPhone() {
return dutyPhone;
}
public void setDutyPhone(String dutyPhone) {
this.dutyPhone = dutyPhone;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("unitName", getUnitName())
.append("orgCode", getOrgCode())
.append("runAddress", getRunAddress())
.append("regAddress", getRegAddress())
.append("regulationType", getRegulationType())
.append("regDate", getRegDate())
.append("businessTerm", getBusinessTerm())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.append("businessScope", getBusinessScope())
.append("employeeNum", getEmployeeNum())
.append("legalPerson", getLegalPerson())
.append("legalPersonPhone", getLegalPersonPhone())
.append("keyPerson", getKeyPerson())
.append("keyPersonPhone", getKeyPersonPhone())
.append("safetyPerson", getSafetyPerson())
.append("safetyPersonPhone", getSafetyPersonPhone())
.append("createUserId", getCreateUserId())
.append("updateUserId", getUpdateUserId())
.append("updateTime", getUpdateTime())
.append("createTime", getCreateTime())
.append("remarks", getRemarks())
.toString();
}
}
package com.zehong.system.mapper.baseinfo;
import com.zehong.system.domain.baseinfo.TEnterpriseInfo;
import java.util.List;
/**
* 企业基础信息管理Mapper接口
*
* @author zehong
* @date 2022-06-23
*/
public interface TEnterpriseInfoMapper
{
/**
* 查询企业基础信息管理
*
* @param id 企业基础信息管理ID
* @return 企业基础信息管理
*/
public TEnterpriseInfo selectTEnterpriseInfoById(Long id);
/**
* 查询企业基础信息管理列表
*
* @param tEnterpriseInfo 企业基础信息管理
* @return 企业基础信息管理集合
*/
public List<TEnterpriseInfo> selectTEnterpriseInfoList(TEnterpriseInfo tEnterpriseInfo);
/**
* 新增企业基础信息管理
*
* @param tEnterpriseInfo 企业基础信息管理
* @return 结果
*/
public int insertTEnterpriseInfo(TEnterpriseInfo tEnterpriseInfo);
/**
* 修改企业基础信息管理
*
* @param tEnterpriseInfo 企业基础信息管理
* @return 结果
*/
public int updateTEnterpriseInfo(TEnterpriseInfo tEnterpriseInfo);
/**
* 删除企业基础信息管理
*
* @param id 企业基础信息管理ID
* @return 结果
*/
public int deleteTEnterpriseInfoById(Long id);
/**
* 批量删除企业基础信息管理
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTEnterpriseInfoByIds(Long[] ids);
}
package com.zehong.system.service.baseinfo;
import com.zehong.system.domain.baseinfo.TEnterpriseInfo;
import java.util.List;
/**
* 企业基础信息管理Service接口
*
* @author zehong
* @date 2022-06-23
*/
public interface ITEnterpriseInfoService
{
/**
* 查询企业基础信息管理
*
* @param id 企业基础信息管理ID
* @return 企业基础信息管理
*/
public TEnterpriseInfo selectTEnterpriseInfoById(Long id);
/**
* 查询企业基础信息管理列表
*
* @param tEnterpriseInfo 企业基础信息管理
* @return 企业基础信息管理集合
*/
public List<TEnterpriseInfo> selectTEnterpriseInfoList(TEnterpriseInfo tEnterpriseInfo);
/**
* 新增企业基础信息管理
*
* @param tEnterpriseInfo 企业基础信息管理
* @return 结果
*/
public int insertTEnterpriseInfo(TEnterpriseInfo tEnterpriseInfo);
/**
* 修改企业基础信息管理
*
* @param tEnterpriseInfo 企业基础信息管理
* @return 结果
*/
public int updateTEnterpriseInfo(TEnterpriseInfo tEnterpriseInfo);
/**
* 批量删除企业基础信息管理
*
* @param ids 需要删除的企业基础信息管理ID
* @return 结果
*/
public int deleteTEnterpriseInfoByIds(Long[] ids);
/**
* 删除企业基础信息管理信息
*
* @param id 企业基础信息管理ID
* @return 结果
*/
public int deleteTEnterpriseInfoById(Long id);
}
package com.zehong.system.service.impl.baseinfo;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.baseinfo.TEnterpriseInfo;
import com.zehong.system.mapper.baseinfo.TEnterpriseInfoMapper;
import com.zehong.system.service.baseinfo.ITEnterpriseInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 企业基础信息管理Service业务层处理
*
* @author zehong
* @date 2022-06-23
*/
@Service
public class TEnterpriseInfoServiceImpl implements ITEnterpriseInfoService
{
@Autowired
private TEnterpriseInfoMapper tEnterpriseInfoMapper;
/**
* 查询企业基础信息管理
*
* @param id 企业基础信息管理ID
* @return 企业基础信息管理
*/
@Override
public TEnterpriseInfo selectTEnterpriseInfoById(Long id)
{
return tEnterpriseInfoMapper.selectTEnterpriseInfoById(id);
}
/**
* 查询企业基础信息管理列表
*
* @param tEnterpriseInfo 企业基础信息管理
* @return 企业基础信息管理
*/
@Override
public List<TEnterpriseInfo> selectTEnterpriseInfoList(TEnterpriseInfo tEnterpriseInfo)
{
return tEnterpriseInfoMapper.selectTEnterpriseInfoList(tEnterpriseInfo);
}
/**
* 新增企业基础信息管理
*
* @param tEnterpriseInfo 企业基础信息管理
* @return 结果
*/
@Override
public int insertTEnterpriseInfo(TEnterpriseInfo tEnterpriseInfo)
{
tEnterpriseInfo.setCreateTime(DateUtils.getNowDate());
return tEnterpriseInfoMapper.insertTEnterpriseInfo(tEnterpriseInfo);
}
/**
* 修改企业基础信息管理
*
* @param tEnterpriseInfo 企业基础信息管理
* @return 结果
*/
@Override
public int updateTEnterpriseInfo(TEnterpriseInfo tEnterpriseInfo)
{
tEnterpriseInfo.setUpdateTime(DateUtils.getNowDate());
return tEnterpriseInfoMapper.updateTEnterpriseInfo(tEnterpriseInfo);
}
/**
* 批量删除企业基础信息管理
*
* @param ids 需要删除的企业基础信息管理ID
* @return 结果
*/
@Override
public int deleteTEnterpriseInfoByIds(Long[] ids)
{
return tEnterpriseInfoMapper.deleteTEnterpriseInfoByIds(ids);
}
/**
* 删除企业基础信息管理信息
*
* @param id 企业基础信息管理ID
* @return 结果
*/
@Override
public int deleteTEnterpriseInfoById(Long id)
{
return tEnterpriseInfoMapper.deleteTEnterpriseInfoById(id);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.baseinfo.TEnterpriseInfoMapper">
<resultMap type="TEnterpriseInfo" id="TEnterpriseInfoResult">
<result property="id" column="id" />
<result property="unitName" column="unit_name" />
<result property="orgCode" column="org_code" />
<result property="runAddress" column="run_address" />
<result property="regAddress" column="reg_address" />
<result property="regulationType" column="regulation_type" />
<result property="regDate" column="reg_date" />
<result property="businessTerm" column="business_term" />
<result property="dutyPhone" column="duty_phone" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="businessScope" column="business_scope" />
<result property="employeeNum" column="employee_num" />
<result property="legalPerson" column="legal_person" />
<result property="legalPersonPhone" column="legal_person_phone" />
<result property="keyPerson" column="key_person" />
<result property="keyPersonPhone" column="key_person_phone" />
<result property="safetyPerson" column="safety_person" />
<result property="safetyPersonPhone" column="safety_person_phone" />
<result property="createUserId" column="create_user_id" />
<result property="updateUserId" column="update_user_id" />
<result property="updateTime" column="update_time" />
<result property="createTime" column="create_time" />
<result property="remarks" column="remarks" />
</resultMap>
<sql id="selectTEnterpriseInfoVo">
select id, unit_name, org_code, run_address, reg_address, regulation_type, reg_date, business_term, duty_phone, longitude, latitude, business_scope, employee_num, legal_person, legal_person_phone, key_person, key_person_phone, safety_person, safety_person_phone, create_user_id, update_user_id, update_time, create_time, remarks from t_enterprise_info
</sql>
<select id="selectTEnterpriseInfoList" parameterType="TEnterpriseInfo" resultMap="TEnterpriseInfoResult">
<include refid="selectTEnterpriseInfoVo"/>
<where>
<if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
<if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if>
<if test="runAddress != null and runAddress != ''"> and run_address = #{runAddress}</if>
<if test="regAddress != null and regAddress != ''"> and reg_address = #{regAddress}</if>
<if test="regulationType != null and regulationType != ''"> and regulation_type = #{regulationType}</if>
<if test="regDate != null "> and reg_date = #{regDate}</if>
<if test="businessTerm != null and businessTerm != ''"> and business_term = #{businessTerm}</if>
<if test="longitude != null "> and longitude = #{longitude}</if>
<if test="latitude != null "> and latitude = #{latitude}</if>
<if test="businessScope != null and businessScope != ''"> and business_scope = #{businessScope}</if>
<if test="employeeNum != null and employeeNum != ''"> and employee_num = #{employeeNum}</if>
<if test="legalPerson != null and legalPerson != ''"> and legal_person = #{legalPerson}</if>
<if test="legalPersonPhone != null and legalPersonPhone != ''"> and legal_person_phone = #{legalPersonPhone}</if>
<if test="keyPerson != null and keyPerson != ''"> and key_person = #{keyPerson}</if>
<if test="keyPersonPhone != null and keyPersonPhone != ''"> and key_person_phone = #{keyPersonPhone}</if>
<if test="safetyPerson != null and safetyPerson != ''"> and safety_person = #{safetyPerson}</if>
<if test="safetyPersonPhone != null and safetyPersonPhone != ''"> and safety_person_phone = #{safetyPersonPhone}</if>
<if test="createUserId != null and createUserId != ''"> and create_user_id = #{createUserId}</if>
<if test="updateUserId != null and updateUserId != ''"> and update_user_id = #{updateUserId}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
</where>
</select>
<select id="selectTEnterpriseInfoById" parameterType="Long" resultMap="TEnterpriseInfoResult">
<include refid="selectTEnterpriseInfoVo"/>
where id = #{id}
</select>
<insert id="insertTEnterpriseInfo" parameterType="TEnterpriseInfo">
insert into t_enterprise_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="unitName != null">unit_name,</if>
<if test="orgCode != null">org_code,</if>
<if test="runAddress != null">run_address,</if>
<if test="regAddress != null">reg_address,</if>
<if test="regulationType != null">regulation_type,</if>
<if test="regDate != null">reg_date,</if>
<if test="businessTerm != null">business_term,</if>
<if test="dutyPhone != null">duty_phone,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
<if test="businessScope != null">business_scope,</if>
<if test="employeeNum != null">employee_num,</if>
<if test="legalPerson != null">legal_person,</if>
<if test="legalPersonPhone != null">legal_person_phone,</if>
<if test="keyPerson != null">key_person,</if>
<if test="keyPersonPhone != null">key_person_phone,</if>
<if test="safetyPerson != null">safety_person,</if>
<if test="safetyPersonPhone != null">safety_person_phone,</if>
<if test="createUserId != null">create_user_id,</if>
<if test="updateUserId != null">update_user_id,</if>
<if test="updateTime != null">update_time,</if>
<if test="createTime != null">create_time,</if>
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="unitName != null">#{unitName},</if>
<if test="orgCode != null">#{orgCode},</if>
<if test="runAddress != null">#{runAddress},</if>
<if test="regAddress != null">#{regAddress},</if>
<if test="regulationType != null">#{regulationType},</if>
<if test="regDate != null">#{regDate},</if>
<if test="businessTerm != null">#{businessTerm},</if>
<if test="dutyPhone != null">#{dutyPhone},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
<if test="businessScope != null">#{businessScope},</if>
<if test="employeeNum != null">#{employeeNum},</if>
<if test="legalPerson != null">#{legalPerson},</if>
<if test="legalPersonPhone != null">#{legalPersonPhone},</if>
<if test="keyPerson != null">#{keyPerson},</if>
<if test="keyPersonPhone != null">#{keyPersonPhone},</if>
<if test="safetyPerson != null">#{safetyPerson},</if>
<if test="safetyPersonPhone != null">#{safetyPersonPhone},</if>
<if test="createUserId != null">#{createUserId},</if>
<if test="updateUserId != null">#{updateUserId},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="remarks != null">#{remarks},</if>
</trim>
</insert>
<update id="updateTEnterpriseInfo" parameterType="TEnterpriseInfo">
update t_enterprise_info
<trim prefix="SET" suffixOverrides=",">
<if test="unitName != null">unit_name = #{unitName},</if>
<if test="orgCode != null">org_code = #{orgCode},</if>
<if test="runAddress != null">run_address = #{runAddress},</if>
<if test="regAddress != null">reg_address = #{regAddress},</if>
<if test="regulationType != null">regulation_type = #{regulationType},</if>
<if test="regDate != null">reg_date = #{regDate},</if>
<if test="businessTerm != null">business_term = #{businessTerm},</if>
duty_phone = #{dutyPhone},
longitude = #{longitude},
latitude = #{latitude},
business_scope = #{businessScope},
employee_num = #{employeeNum},
legal_person = #{legalPerson},
legal_person_phone = #{legalPersonPhone},
key_person = #{keyPerson},
key_person_phone = #{keyPersonPhone},
safety_person = #{safetyPerson},
safety_person_phone = #{safetyPersonPhone},
<if test="createUserId != null">create_user_id = #{createUserId},</if>
<if test="updateUserId != null">update_user_id = #{updateUserId},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remarks != null">remarks = #{remarks},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTEnterpriseInfoById" parameterType="Long">
delete from t_enterprise_info where id = #{id}
</delete>
<delete id="deleteTEnterpriseInfoByIds" parameterType="String">
delete from t_enterprise_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -7,6 +7,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
<script src="https://webapi.amap.com/maps?v=2.0&key=49fcb156d466062435d7d33437099582&plugin=Map3D,AMap.DistrictSearch,AMap.Scale,AMap.OverView,AMap.ToolBar,AMap.MouseTool,AMap.ControlBar,AMap.CircleEditor,AMap.PolyEditor"></script>
<!-- 为了路径 -->
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
<style>
html,
......
import request from '@/utils/request'
// 查询企业基础信息管理列表
export function listEnterpriseInfo(query) {
return request({
url: '/baseInfo/enterpriseInfo/list',
method: 'get',
params: query
})
}
// 查询企业基础信息管理详细
export function getEnterpriseInfo(id) {
return request({
url: '/baseInfo/enterpriseInfo/' + id,
method: 'get'
})
}
// 新增企业基础信息管理
export function addEnterpriseInfo(data) {
return request({
url: '/baseInfo/enterpriseInfo',
method: 'post',
data: data
})
}
// 修改企业基础信息管理
export function updateEnterpriseInfo(data) {
return request({
url: '/baseInfo/enterpriseInfo',
method: 'put',
data: data
})
}
// 删除企业基础信息管理
export function delEnterpriseInfo(id) {
return request({
url: '/baseInfo/enterpriseInfo/' + id,
method: 'delete'
})
}
// 导出企业基础信息管理
export function exportEnterpriseInfo(query) {
return request({
url: '/baseInfo/enterpriseInfo/export',
method: 'get',
params: query
})
}
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1644901265903" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7343" width="32" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M527.053 96.924c-169.131 0.322-306.127 137.496-306.127 306.7 0 157.986 128.978 324.17 278.121 502.935 7.838 9.418 17.977 14.485 28.006 15.061 10.029-0.576 20.168-5.643 28.002-15.061 149.144-178.765 278.123-344.948 278.123-502.935 0-169.205-136.997-306.378-306.126-306.7zM527.053 500.967c-66.070-0.358-119.562-53.956-119.562-120.099s53.492-119.74 119.562-120.099c66.069 0.358 119.557 53.956 119.557 120.099s-53.487 119.74-119.557 120.099z" p-id="7344" fill="#1296db"></path></svg>
\ No newline at end of file
<!--
* @Author: your name
* @Date: 2022-02-12 11:07:10
* @LastEditTime: 2022-02-22 15:08:10
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /test/hello-world/src/components/GetPos.vue/index.vue
-->
<template>
<el-dialog
class="getpos"
title="定位"
:visible.sync="dialogVisible"
width="60%"
:before-close="handleClose"
append-to-body
>
<template v-if="inputVisible">
<div class="search-wrapper pos">
<el-input
v-model="searchinput"
class="searchinput"
placeholder="请输入内容"
size="mini"
style="width: 150px"
ref="input"
></el-input>
</div>
<div @click="pos" class="positionBtn pos">
<el-button type="primary" size="mini" icon="el-icon-position"
> 确定 </el-button
>
</div>
</template>
<div id="getposmap"></div>
</el-dialog>
</template>
<script>
import { EditorMap } from "@/utils/mapClass/getPath.js";
export default {
props: {
//管道路径,二维数组s
pipePath: {
type: Array,
default: () => [],
},
// marker位置,数组
devicePos: {
type: Array,
default: () => [],
},
// 设备类型,管道传pipe,marker就不用传值
device: {
type: String,
default: "",
},
// 显示隐藏
dialogVisible: {
type: Boolean,
default: false,
},
// input跟定位按钮是否展示
inputVisible: {
type: Boolean,
default: true,
},
},
data() {
return {
// dialogVisible: false,
map: null,
searchinput: "",
};
},
watch: {
dialogVisible(newValue) {
if (newValue) {
this.init();
} else {
this.map.destroy();
this.searchinput="";
}
this.$nextTick(() => {
const input = this.$refs.input.$refs.input;
this.map.positionSearch(input);
});
},
},
mounted() {},
methods: {
init() {
this.$nextTick(() => {
const path = eval(this.$store.state.user.systemSetting.map_center);
console.log("path",path);
this.map = new EditorMap("getposmap", {center:path}, this);
// 如果不传值就是设备,传pipe就是管道
if (this.device == "") {
// 如果传了路径就创建一个marker,如果没传就直接激活手动创建
if (this.devicePos.length > 0) {
this.map.addDevice({ path: this.devicePos });
} else {
this.map.mouseAddMarker();
}
} else {
//console.log(this.pipePath.length)
if (this.pipePath!=null && this.pipePath.length > 0) {
this.map.addPipeLine({ path: this.pipePath });
} else {
this.map.mouseAddPipeline();
}
}
});
},
handleClose() {
this.$emit("close");
},
open() {
this.dialogVisible = true;
},
// 返回坐标
pos() {
this.path = this.map.getPath();
this.$emit("getPath", this.path);
if (this.path?.length > 0) {
this.$emit("update:dialogVisible", false);
}
},
},
};
</script>
<style lang="scss" scoped>
.search-wrapper {
left: 30px;
}
.positionBtn {
right: 30px;
}
.pos {
position: absolute;
top: 90px;
z-index: 20;
}
#getposmap {
width: 100%;
height: 500px;
}
</style>
/*
* @Author: your name
* @Date: 2022-01-11 13:45:12
* @LastEditTime: 2022-06-09 11:20:32
* @LastEditors: 纪泽龙 jizelong@qq.com
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /test/hello-world/src/utils/mapClass.js
*/
// 编辑类
// 在地图上新增的设备可以直接编辑,
// 已经保存完成的设备需要点编辑才可以编辑
export class EditorMap {
// 地图的对象实例
map = null;
// 父vue的实例
vue = null;
// 操作 新建,编辑,删除,编辑跟删除只对已经在图上的设备有效 默认值:0, 新建:1,编辑:2, 删除: 3。
// 新建的时候会把未保存的线条清空
control = 0;
// 鼠标事件对象,用来将点跟线上图
mousetool = null;
// 当前正在手动绘制的对象
nowMouseTarget = null;
// 当线mousetool线被按下的时候的flag 当线被按下的时候为true,就不询问是否删除了
mosueToolPolineDownFlag = false;
// 绘制marer的时候的配置,在绘制完挂载事件的时候需要使用
mouseToolMarkerOptions = null;
// 绘制poline的时候的配置,在绘制完挂载事件的时候需要使用
mouseToolPolineOptions = null;
constructor(contaienr, config = {}, vue) {
this.map = new AMap.Map(contaienr, {
viewMode: "3D",
center: [116.397083, 39.874531],
layers: [AMap.createDefaultLayer()], // layers 字段为空或者不赋值将会自动创建默认底图。
zoom: 12,
...config,
});
this.vue = vue;
this.init();
}
init() {
// 地图事件
this.mapEvent();
// 手动点线上图准备,编辑模式
this.mouseAddDevice();
window.func = () => {
this.getPath();
};
// this.mouseAddMarker();
// this.mouseAddPipeline();
}
// map的事件监听
mapEvent() {
this.map.on("click", () => {
// mousetool对象画出的对象的操作
// 如果有手动绘制对象,要手动清楚一下,因为画线的时候不好清除旧线,这其实是用来清楚旧线的
// 当画出来的线被mousedown,不删除,但是mouseToolPipeLineFlag要归位,在移出线的时候统一归位
// 如果对象是marker,直接删除
if (this.nowMouseTarget?.type == "AMap.Marker") {
console.log("???");
this.mouseToolDrawClear();
} else {
// 当地图上已经画了线,并且没有点在线上,询问是否删除
if (this.nowMouseTarget && !this.mosueToolPolineDownFlag) {
this.confirm("是否重新绘制管道", { type: "warning" })
.then(() => {
// 删除原来的线
this.mouseToolDrawClear();
// 鼠标事件开启,并且赋值原来的属性,this.mouseToolMarkerOptions是开启绘制的时候记录的
this.mousetool.polyline(this.mouseToolPolineOptions);
})
.catch(() => {});
}
}
});
this.map.on("moveend", () => {
console.log("地图停止移动");
if (this.flag) {
console.log("弹框");
this.flag = false;
}
});
window.panTo = () => {
this.flag = true;
this.map.panTo([116.428285, 39.886129]);
};
}
// 弹框工具
confirm(message, obj) {
return this.vue.$confirm(message, obj);
}
// 改变操作状态
changeControl(num) {
this.control = num;
}
// 点线编辑上图准备
mouseAddDevice() {
this.map.plugin(["AMap.MouseTool"], () => {
this.mousetool = new AMap.MouseTool(this.map);
});
// 挂载绘制结束的事件
this.mouseDrawEvent();
}
// 点或者线上图结束后触发的事件
mouseDrawEvent() {
this.mousetool.on("draw", (e) => {
const target = e.obj;
// console.log([target._position.lng, target._position.lat]);
const { type: targetType } = target;
// 当这个点是marker的时候
if (targetType == "AMap.Marker") {
this.mouseToolMarkerEvent(target);
} else {
// 如果是线,挂上编辑
this.lineEditor(target);
this.mousetool.close();
this.mouseToolPolineEvent(target);
console.log(targetType, "当前对象是管道");
}
this.nowMouseTarget = target;
});
}
// 绘制marker结束后,在marker身上添加的事件
mouseToolMarkerEvent(target) {
// 由于画出来的marker点击会换位置,所以当移入的时候删除绘制事件,移出去在增加绘制事件
target.on("mouseover", (e) => {
// 鼠标事件关闭
this.mousetool.close(false);
});
target.on("mouseout", (e) => {
// 这里不方便获取原来的属性,因为position不好解决,还是设置一个值吧
// 鼠标事件开启,并且赋值原来的属性,this.mouseToolMarkerOptions是开启绘制的时候记录的
this.mousetool.marker(this.mouseToolMarkerOptions);
});
// 点
target.on("click", (e) => {
// 弹框
});
}
// 挂上线以及线的事件
lineEditor(line) {
// line.editor && line.editor.close();
// 当前点击次数,1次为编辑,2次为弹框
line.editorNum = 0;
line.editor = new AMap.PolyEditor(this.map, line);
}
// 绘制管道的时候,挂载的事件
mouseToolPolineEvent(target) {
// 线按下的时候会变成编辑,mousetool事件会清空 移出线的时候 在把polyline事件加上
target.on("mouseover", (e) => {
// 鼠标事件关闭
// this.mousetool.close(false);
});
target.on("mouseout", (e) => {
// 有时候按在线上移动地图,map点击事件中mosueToolPolineDownFlag无法归位,在这里归位
this.mosueToolPolineDownFlag = false;
// 鼠标事件开启,并且赋值原来的属性,this.mouseToolMarkerOptions是开启绘制的时候记录的
// this.mousetool.polyline(this.mouseToolPolineOptions);
});
// 线
target.on("mousedown", (e) => {
const line = e.target;
// mosueTool按下的flag,按在线上,不询问是否删除
this.mosueToolPolineDownFlag = true;
// 按下的时候要关闭事件
this.mousetool.close(false);
// 如果当前状态不是编辑,则进入编辑状态
if (line.editorNum < 1) {
// 打开并且++
line.editor.open();
line.editorNum++;
} else {
// 这里就要弹框了
console.log(line.getPath());
}
});
}
// 设备点击上图开启
mouseAddMarker(markerObj = {}) {
// 清空已经绘制完的对象
this.mousetoolClose(true);
// 记录一下配置项,在挂载点击的时候,需要使用
this.mouseToolMarkerOptions = {
draggable: true,
...markerObj,
};
this.mousetool.marker(this.mouseToolMarkerOptions);
}
// 管线点击上图开启
mouseAddPipeline(pipeObj = {}) {
this.mousetoolClose(true);
// 开始画线
this.mosuetoolPolineFlag = true;
this.mouseToolPolineOptions = {
strokeWeight: 5,
...pipeObj,
};
this.mousetool.polyline(this.mouseToolPolineOptions);
}
// 手动清除map上绘制的对象
mouseToolDrawClear() {
if (this.nowMouseTarget) {
this.map.remove(this.nowMouseTarget);
// 如果有editor,则关闭
this.nowMouseTarget.editor && this.nowMouseTarget.editor.close();
this.nowMouseTarget = null;
}
}
// 关闭点击上图事件 true清除之前绘制的图像,false 仅关闭上图事件
mousetoolClose(boolean) {
// 清空地图上的绘制对象的同时,也要清楚这个nowMouseTarget控制对象
if (this.nowMouseTarget) {
// 如果有editor,则关闭
this.nowMouseTarget.editor && this.nowMouseTarget.editor.close();
this.nowMouseTarget = null;
}
this.mousetool.close(boolean);
}
/**
*
*
*
*
*
*
* 地图上add设备
*
*
* @description:
* @param {*} deviceData marker的数据
* @param {*} compontent marker点击弹出的infowindow的组件
* @return {*}
*/
addDevice(deviceData) {
const { path } = deviceData;
let device = this.createMarker({
map: this.map,
anchor: "bottom-center",
icon: require("@/assets/mapImages/coordinate.svg"),
position: path,
extData: deviceData,
});
// 当前设备
this.mouseAddMarker();
this.nowMouseTarget = device;
this.setCenter(path);
// 设备的事件函数
// this.deviceEvent(device, compontent);
}
deviceEvent(device, compontent) {
device.on("click", (e) => {
const target = e.target;
// 如果control==0就是默认值,没有使用123功能,就显示infowindow
if (this.control == 0) {
// this.markerClick(target, compontent);
} else if (this.control == 2) {
// 2是已经上图的设备拥有的编辑功能
} else if (this.control == 3) {
// 3是删除操作
}
});
}
// 创建marker
createMarker(MarkerOptions) {
return new AMap.Marker(MarkerOptions);
}
// 地图上add管道
addPipeLine(objData) {
const { path } = objData;
const pipe = this.createPipeLine({
path,
strokeWeight: 4,
strokeColor: "#000",
extData: objData,
cursor: "pointer",
});
this.map.add(pipe);
this.setCenter(path[0]);
// 当前设备
this.nowMouseTarget = pipe;
}
createPipeLine(pipeLineOptions) {
return new AMap.Polyline(pipeLineOptions);
}
setCenter(path) {
this.map.setCenter(path, true);
}
// 获取路径
getPath() {
if(!this.nowMouseTarget) return;
if (this.nowMouseTarget.type == "AMap.Marker") {
const { lng, lat } = this.nowMouseTarget.getPosition();
return [lng, lat];
} else {
return this.nowMouseTarget?.getPath().map((item) => [item.lng, item.lat]);
}
}
// 搜索位置
positionSearch(id) {
// id 为搜索框id
var autoOptions = {
input: id,
};
AMap.plugin(["AMap.PlaceSearch", "AMap.AutoComplete"], ()=> {
var auto = new AMap.AutoComplete(autoOptions);
var placeSearch = new AMap.PlaceSearch({
map: this.map,
}); //构造地点查询类
auto.on("select", select); //注册监听,当选中某条记录时会触发
function select(e) {
console.log(e)
placeSearch.setCity(e.poi.adcode);
placeSearch.search(e.poi.name); //关键字查询查询
}
});
}
// 销毁map
destroy(){
this.map.destroy();
}
}
<template>
<div class="app-container">
<!-- 添加或修改企业基础信息管理对话框 -->
<el-row :gutter="10" class="mb8">
<el-col :span="14">
<el-form ref="form" :model="form" label-width="150px">
<table>
<tr>
<th>
企业名称
</th>
<td>
<span>{{form.unitName}}</span>
</td>
<th>
社会统一信用代码
</th>
<td>
{{form.orgCode}}
</td>
</tr>
<tr>
<th>
安全监管分类
</th>
<td>
<span v-if="form.regulationType == '1'">危险化学品</span>
<span v-if="form.regulationType == '2'">冶金</span>
<span v-if="form.regulationType == '3'">建材</span>
<span v-if="form.regulationType == '4'">有色</span>
<span v-if="form.regulationType == '5'">机械</span>
<span v-if="form.regulationType == '6'">其他</span>
</td>
<th>
成立日期
</th>
<td>
{{form.regDate}}
</td>
</tr>
<tr>
<th>
经营范围
</th>
<td colspan="3">
{{form.businessScope}}
</td>
</tr>
<tr>
<th>
营业期限
</th>
<td>
{{form.businessTerm}}
</td>
<th>
值班电话
</th>
<td>
{{form.dutyPhone}}
</td>
</tr>
<tr>
<th>
法定代表人
</th>
<td>
<span v-if="form.legalPerson != null && form.legalPerson != ''">{{form.legalPerson}}</span>
<span v-else>-</span>
</td>
<th>
法定代表人手机
</th>
<td>
<span v-if="form.legalPersonPhone != null && form.legalPersonPhone != ''">{{form.legalPersonPhone}}</span>
<span v-else>-</span>
</td>
</tr>
<tr>
<th>
主要负责人
</th>
<td>
<span v-if="form.keyPerson != null && form.keyPerson != ''">{{form.keyPerson}}</span>
<span v-else>-</span>
</td>
<th>
主要负责人手机
</th>
<td>
<span v-if="form.keyPersonPhone != null && form.keyPersonPhone != ''">{{form.keyPersonPhone}}</span>
<span v-else>-</span>
</td>
</tr>
<tr>
<th>
安全负责人
</th>
<td>
<span v-if="form.safetyPerson != null && form.safetyPerson != ''">{{form.safetyPerson}}</span>
<span v-else>-</span>
</td>
<th>
安全负责人手机
</th>
<td>
<span v-if="form.safetyPersonPhone != null && form.safetyPersonPhone != ''">{{form.safetyPersonPhone}}</span>
<span v-else>-</span>
</td>
</tr>
<tr>
<th>
经度
</th>
<td>
{{form.longitude}}
</td>
<th>
纬度
</th>
<td>
{{form.latitude}}
</td>
</tr>
<tr>
<th>
生产经营地址
</th>
<td colspan="3">
{{form.runAddress}}
</td>
</tr>
<tr>
<th>
注册地址
</th>
<td colspan="3">
{{form.regAddress}}
</td>
</tr>
<tr>
<th>
备注信息
</th>
<td colspan="3">
<span v-if="form.remarks != null && form.remarks != ''">{{form.remarks}}</span>
<span v-else>-</span>
</td>
</tr>
</table>
</el-form>
</el-col>
<el-col :span="9">
<div style="width: 100%;height: 480px; border: 1px solid rgb(218, 213, 213);margin-bottom: 10px;">
<div style="width: 100%;height: 100%" id="enterpriseContainer"></div>
</div>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5" style="margin-left: 50%">
<el-button
type="success"
plain
icon="el-icon-edit"
size="normal"
@click="handleUpdate(form)"
>编辑</el-button>
</el-col>
</el-row>
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-row>
<el-col :span="11">
<el-form-item label="企业名称" prop="unitName">
<el-input v-model="form.unitName" placeholder="请输入企业名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="社会统一信用代码" prop="orgCode">
<el-input v-model="form.orgCode" placeholder="请输入社会统一信用代码" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="安全监管分类" prop="regulationType">
<el-select v-model="form.regulationType" placeholder="请选择安全监管分类" style="width: 100%">
<el-option v-for="dict in regulationOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="成立日期" prop="regDate">
<el-date-picker clearable size="small"
v-model="form.regDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择成立日期"
style="width: 100%">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="23">
<el-form-item label="经营范围" prop="businessScope">
<el-input v-model="form.businessScope" placeholder="请输入经营范围" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="营业期限" prop="businessTerm">
<el-input v-model="form.businessTerm" placeholder="请输入营业期限" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="值班电话" prop="dutyPhone">
<el-input v-model="form.dutyPhone" placeholder="请输入值班电话" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="23">
<el-form-item label="生产经营地址" prop="runAddress">
<el-input v-model="form.runAddress" placeholder="请输入生产经营地址" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="23">
<el-form-item label="注册地址" prop="regAddress">
<el-input v-model="form.regAddress" placeholder="请输入注册地址" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="23">
<el-form-item label="经纬度坐标" prop="longitude">
<el-col :span="9">
<el-input v-model="form.longitude" placeholder="请输入经度" />
</el-col>
<el-col :span="9" style="margin-left: 15px">
<el-input v-model="form.latitude" placeholder="请输入纬度"/>
</el-col>
<el-col :span="3" style="margin-left: 30px">
<el-button type="primary" plain @click="MapdialogFun">选择经纬度</el-button>
</el-col>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="法定代表人" prop="legalPerson">
<el-input v-model="form.legalPerson" placeholder="请输入法定代表人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="法定代表人手机" prop="legalPersonPhone">
<el-input v-model="form.legalPersonPhone" placeholder="请输入法定代表人手机" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="主要负责人" prop="keyPerson">
<el-input v-model="form.keyPerson" placeholder="请输入主要负责人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主要负责人手机" prop="keyPersonPhone">
<el-input v-model="form.keyPersonPhone" placeholder="请输入主要负责人手机" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="安全负责人" prop="safetyPerson">
<el-input v-model="form.safetyPerson" placeholder="请输入安全负责人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="安全负责人手机" prop="safetyPersonPhone">
<el-input v-model="form.safetyPersonPhone" placeholder="请输入安全负责人手机" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="23">
<el-form-item label="备注信息" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<GetPos
:dialogVisible.sync="dialogTableVisible"
device=""
:devicePos="devicePos"
@close="dialogcancelFun"
@getPath="getPath"
/>
</div>
</template>
<script>
import { listEnterpriseInfo, getEnterpriseInfo, delEnterpriseInfo, addEnterpriseInfo, updateEnterpriseInfo, exportEnterpriseInfo } from "@/api/baseinfo/enterpriseInfo";
import GetPos from '@/components/GetPos';
import { EditorMap } from "@/utils/mapClass/getPath.js";
export default {
name: "EnterpriseInfo",
components: {
GetPos
},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 总条数
total: 0,
// 企业基础信息管理表格数据
enterpriseInfoList: [],
regulationOptions: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 地图
dialogTableVisible: false,
devicePos: [],
map: null,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
unitName: null,
orgCode: null,
runAddress: null,
regAddress: null,
regulationType: null,
regDate: null,
businessTerm: null,
longitude: null,
latitude: null,
businessScope: null,
employeeNum: null,
legalPerson: null,
legalPersonPhone: null,
keyPerson: null,
keyPersonPhone: null,
safetyPerson: null,
safetyPersonPhone: null,
createUserId: null,
updateUserId: null,
remarks: null
},
// 表单参数
form: {
},
// 表单校验
rules: {
unitName: [
{ required: true, message: "请输入企业名称", trigger: "blur" }
],
orgCode: [
{ required: true, message: "请输入社会统一信用代码", trigger: "blur" }
],
regulationType: [
{ required: true, message: "请选择安全监管分类", trigger: "blur" }
],
regDate: [
{ required: true, message: "请选择成立日期", trigger: "blur" }
],
businessScope: [
{ required: true, message: "请输入经营范围", trigger: "blur" }
],
businessTerm: [
{ required: true, message: "请输入营业期限", trigger: "blur" }
],
dutyPhone: [
{ required: true, message: "请输入值班电话", trigger: "blur" }
],
runAddress: [
{ required: true, message: "请输入生产经营地址", trigger: "blur" }
],
regAddress: [
{ required: true, message: "请输入注册地址", trigger: "blur" }
],
phonenumber: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
],
longitude: [
{ required: true, message: "请输入经纬度", trigger: "blur" }
],
}
};
},
created() {
this.getList();
this.getDicts("t_regulation_type").then(response => {
this.regulationOptions = response.data;
});
},
methods: {
/** 查询企业基础信息管理列表 */
getList() {
this.loading = true;
listEnterpriseInfo(this.queryParams).then(response => {
this.enterpriseInfoList = response.rows;
this.form = this.enterpriseInfoList[0];
console.log("this.form.longitude", this.form.longitude);
this.total = response.total;
this.loading = false;
this.$nextTick(() => {
const path = eval(this.$store.state.user.systemSetting.map_center);
this.map = new EditorMap("enterpriseContainer", {center: path}, this);
if(this.form.longitude != null){
this.devicePos = [this.form.longitude, this.form.latitude];
this.map.addDevice({ path: this.devicePos });
}
this.map.nowMouseTarget = null;
this.map.mousetoolClose(false);
});
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
this.getList();
},
// 表单重置
reset() {
this.form = {
id: null,
unitName: null,
orgCode: null,
runAddress: null,
regAddress: null,
regulationType: null,
regDate: null,
businessTerm: null,
longitude: null,
latitude: null,
businessScope: null,
employeeNum: null,
legalPerson: null,
legalPersonPhone: null,
keyPerson: null,
keyPersonPhone: null,
safetyPerson: null,
safetyPersonPhone: null,
createUserId: null,
updateUserId: null,
updateTime: null,
createTime: null,
remarks: null
};
this.resetForm("form");
this.devicePos = [];
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
if(row != null){
getEnterpriseInfo(row.id).then(response => {
this.form = response.data;
if(this.form.longitude != null){
this.devicePos = [this.form.longitude, this.form.latitude];
}
console.log("this.devicePos", this.devicePos)
});
}
this.open = true;
this.title = "编辑企业基础信息";
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
console.log("longitude",this.form.longitude)
updateEnterpriseInfo(this.form).then(response => {
this.msgSuccess("编辑成功");
this.open = false;
this.getList();
});
} else {
addEnterpriseInfo(this.form).then(response => {
this.msgSuccess("编辑成功");
this.open = false;
this.getList();
});
}
}
});
},
MapdialogFun() {
this.dialogTableVisible = true;
},
dialogcancelFun() {
this.dialogTableVisible = false;
},
getPath(res){
console.log("res", res);
console.log(this.form.longitude, this.form.latitude);
//确认选择经纬度
this.form.longitude = res[0];
this.form.latitude = res[1];
}
}
};
</script>
<style lang="scss" scoped>
table {
width: 100%;
line-height: 30px;
border-collapse: collapse;
}
table, table tr th, table tr td {
border: solid 1px rgb(218, 213, 213) !important;
}
th {
background-color: #e6ebf5;
color: #515a6e;
font-size: 15px;
width: 100px;
height: 50px;
text-align: left;
padding-left: 5px;
}
td {
color: #606266;
width: 200px;
height: 50px;
line-height: 50px;
text-align: left;
padding-left: 5px;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment