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

main
15036302109 9 months ago
parent 3b8538cc96
commit 6e0e417c08

@ -83,6 +83,15 @@ public class SysDictDataController extends BaseController
return success(data); 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 * @return
*/ */
public boolean checkDictTypeUnique(SysDictType dictType); public boolean checkDictTypeUnique(SysDictType dictType);
/**
* ,,
*/
public List<SysDictData> getAdminArea();
} }

@ -1,26 +1,30 @@
package com.ruoyi.system.service.impl; 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.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysDictType; import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.SysDictDataMapper; import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.system.mapper.SysDictTypeMapper; import com.ruoyi.system.mapper.SysDictTypeMapper;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysDictTypeService; 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;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
@ -32,6 +36,9 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
@Autowired @Autowired
private SysDictDataMapper dictDataMapper; private SysDictDataMapper dictDataMapper;
@Autowired
private ISysDeptService deptService;
/** /**
* *
*/ */
@ -43,7 +50,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dictType * @param dictType
* @return * @return
*/ */
@ -55,7 +62,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @return * @return
*/ */
@Override @Override
@ -66,7 +73,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dictType * @param dictType
* @return * @return
*/ */
@ -89,7 +96,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* ID * ID
* *
* @param dictId ID * @param dictId ID
* @return * @return
*/ */
@ -101,7 +108,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dictType * @param dictType
* @return * @return
*/ */
@ -111,9 +118,31 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
return dictTypeMapper.selectDictTypeByType(dictType); 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;
}
/** /**
* *
* *
* @param dictIds ID * @param dictIds ID
*/ */
@Override @Override
@ -167,7 +196,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dict * @param dict
* @return * @return
*/ */
@ -184,7 +213,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dict * @param dict
* @return * @return
*/ */
@ -205,7 +234,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* *
* *
* @param dict * @param dict
* @return * @return
*/ */
@ -220,4 +249,5 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
} }
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
} }
} }

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

Loading…
Cancel
Save