乡镇添加隐患时,地址默认本乡镇。

main
15036302109 9 months ago
parent 3b8538cc96
commit 6e0e417c08

@ -83,6 +83,15 @@ public class SysDictDataController extends BaseController
return success(data);
}
/**
* ,,
*/
@GetMapping(value = "/areaId")
public AjaxResult getAdminArea() {
List<SysDictData> data = dictTypeService.getAdminArea();
return success(data);
}
/**
*
*/

@ -95,4 +95,9 @@ public interface ISysDictTypeService
* @return
*/
public boolean checkDictTypeUnique(SysDictType dictType);
/**
* ,,
*/
public List<SysDictData> getAdminArea();
}

@ -1,22 +1,26 @@
package com.ruoyi.system.service.impl;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.system.mapper.SysDictTypeMapper;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
*
@ -32,6 +36,9 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
@Autowired
private SysDictDataMapper dictDataMapper;
@Autowired
private ISysDeptService deptService;
/**
*
*/
@ -111,6 +118,28 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
return dictTypeMapper.selectDictTypeByType(dictType);
}
/**
* ,,
*/
@Override
public List<SysDictData> getAdminArea() {
// 获取登录账号部门名称
Long deptId = SecurityUtils.getLoginUser().getDeptId();
String deptName = deptService.selectDeptById(deptId).getDeptName();
// 获取乡镇街道名称集合
String dictType = "area_id";
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType);
List<String> deptNameList = dictDatas.stream().map(SysDictData::getDictLabel).collect(Collectors.toList());
// 如果当前登录账号是乡镇街道的话
if (deptNameList.contains(deptName)) {
List<SysDictData> collect = dictDatas.stream()
.filter(item -> Objects.equals(item.getDictLabel(), deptName))
.collect(Collectors.toList());
return collect;
}
return dictDatas;
}
/**
*
*
@ -220,4 +249,5 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
}
return UserConstants.UNIQUE;
}
}

@ -66,3 +66,10 @@ export function getOverTimeId() {
method: 'get'
})
}
export function getAdminArea() {
return request({
url: '/system/dict/data/areaId',
method: 'get'
})
}

@ -477,10 +477,10 @@
<el-form-item label="企业地址" prop="areaId">
<el-select v-model="form.areaId" placeholder="请选择企业地址" :disabled="isReadOnly">
<el-option
v-for="dict in dict.type.area_id"
:key="dict.value"
:label="dict.label"
:value="dict.value"
v-for="(item, index) in areaInfo"
:key="index"
:label="item.dictLabel"
:value="item.dictValue"
></el-option>
</el-select>
</el-form-item>
@ -685,7 +685,7 @@
<script>
import { listEhsHiddenDanger, getEhsHiddenDanger, delEhsHiddenDanger, addEhsHiddenDanger, updateEhsHiddenDanger,
superviseEhsHiddenDanger,assistEhsHiddenDanger } from "@/api/ehs/ehsHiddenDanger";
superviseEhsHiddenDanger,assistEhsHiddenDanger, getAdminArea } from "@/api/ehs/ehsHiddenDanger";
import {listAllDept } from "@/api/system/dept";
import enterpriseSelect from "./enterpriseSelect"
import importUpload from "@/components/upload/upload";
@ -737,6 +737,7 @@ export default {
value: '1',
label: '正常经营',
}],
areaInfo: [],
enterpriseSelectOpen:false,//
//
queryParams: {
@ -850,6 +851,7 @@ export default {
this.deptShow = this.$store.state.user.parentId==0 ?true :false;
this.curDeptId = this.$store.state.user.deptId;
console.log(this.$route.query.overTime);
this.getAdminArea();
},
/* beforeDestroy() {
@ -883,6 +885,12 @@ export default {
this.loading = false;
});
},
/** 获取企业地址下拉列表 */
getAdminArea() {
getAdminArea().then((res) => {
this.areaInfo = res.data;
});
},
//
cancel() {
this.open = false;
@ -945,6 +953,9 @@ export default {
this.open = true;
this.isReadOnly = false;
this.title = "添加隐患信息";
if (this.areaInfo.length === 1) {
this.form.areaId = this.areaInfo[0].dictValue;
}
},
/** 修改按钮操作 */
handleUpdate(row,isReadOnly) {

Loading…
Cancel
Save