巴林闲侠 2 years ago
parent
commit
ed504ea081
  1. 3
      api/Dockerfilenew
  2. 4
      api/app/lib/controllers/auth/index.js
  3. 122
      api/app/lib/controllers/organization/authority.js
  4. 11
      api/app/lib/controllers/organization/department.js
  5. 12
      api/app/lib/index.js
  6. 11
      api/app/lib/models/department.js
  7. 43
      api/app/lib/models/resource.js
  8. 60
      api/app/lib/models/user_resource.js
  9. 34
      api/app/lib/routes/organization/index.js
  10. 5
      jenkinsfilenew_api
  11. 8
      jenkinsfilenew_web
  12. 4
      scripts/1.2.2/schema/1.alter_department.sql
  13. 8
      scripts/1.2.2/schema/2.create_resource.sql
  14. 13
      scripts/1.2.2/schema/3.create_user_resource.sql
  15. 15
      scripts/1.2.2/schema/4.insert_resource.sql
  16. 26
      web/Dockerfilenew
  17. 19
      web/client/src/sections/fillion/components/bridgeTable.js
  18. 24
      web/client/src/sections/fillion/components/fileTable.js
  19. 3
      web/client/src/sections/fillion/components/highwaysTable.js
  20. 15
      web/client/src/sections/fillion/components/infor/videoUpload.js
  21. 16
      web/client/src/sections/fillion/components/inforTable.js
  22. 14
      web/client/src/sections/fillion/components/maintenanceTable.js
  23. 52
      web/client/src/sections/fillion/components/operationalTable.js
  24. 20
      web/client/src/sections/fillion/components/patrolTable.js
  25. 10
      web/client/src/sections/fillion/components/promotionalTable.js
  26. 16
      web/client/src/sections/fillion/components/publicTable.js
  27. 65
      web/client/src/sections/fillion/components/transportationTable.js
  28. 4
      web/client/src/sections/fillion/containers/patrol.js
  29. 115
      web/client/src/sections/fillion/nav-item.js
  30. 14
      web/client/src/sections/organization/actions/authority.js
  31. 48
      web/client/src/sections/organization/components/depModal.js
  32. 156
      web/client/src/sections/organization/containers/authority.js
  33. 38
      web/client/src/sections/organization/containers/user.js
  34. 29
      web/client/src/sections/organization/nav-item.js
  35. 15
      web/client/src/sections/organization/routes.js
  36. 4
      web/client/src/sections/quanju/containers/heand/index.js
  37. 0
      web/client/src/sections/quanju/containers/noContent/index.js
  38. 4
      web/client/src/utils/webapi.js

3
api/Dockerfilenew

@ -1,5 +1,5 @@
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder
COPY . /var/app
COPY ./api/ /var/app
WORKDIR /var/app
EXPOSE 8080
RUN npm config set registry=https://nexus.ngaiot.com/repository/fs-npm/
@ -7,6 +7,7 @@ RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision
RUN npm cache clean -f
RUN rm -rf package-lock.json
RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12
COPY --from=builder --chown=node /var/app /home/node/app
WORKDIR /home/node/app

4
api/app/lib/controllers/auth/index.js

@ -20,6 +20,10 @@ async function login(ctx, next) {
delete: false,
},
attributes: { exclude: ['password', 'delete'] },
include: [{
attributes: ["resourceId", "isshow"],
model: models.UserResource
}]
});
console.log('userRes', userRes)
if (!userRes.isAdmin) {

122
api/app/lib/controllers/organization/authority.js

@ -0,0 +1,122 @@
async function getResource(ctx, next) {
try {
const models = ctx.fs.dc.models;
console.log('models.Resource', models.Resource)
const res = await models.Resource.findAll({
where: { parentResource: null },
include: [{
model: models.Resource,
}],
})
ctx.body = res;
ctx.status = 200;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
"message": "查询所有权限数据失败"
}
}
}
async function getUserResource(ctx, next) {
try {
const models = ctx.fs.dc.models;
const { userId } = ctx.query;
const res = await models.UserResource.findAll({
where: { userId: userId },
include: [{
model: models.Resource,
}]
})
ctx.body = res;
ctx.status = 200;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
"message": "查询用户权限数据失败"
}
}
}
async function updateUserRes(ctx, next) {
const transaction = await ctx.fs.dc.orm.transaction();
try {
const models = ctx.fs.dc.models;
const { userId, resCode, isShow } = ctx.request.body;
console.log('isShow1', ctx.request.body)
const res = await models.UserResource.findAll({
attributes: ["resourceId"],
raw: true,
where: { userId: userId }
})
const addRes = resCode.filter(r => !res.some(rr => rr.resourceId == r)).map(r => { return { userId: userId, resourceId: r, isShow: isShow } });
const delRes = res.filter(r => !resCode.includes(r.resourceId)).map(r => r.resourceId);
addRes.length && await models.UserResource.bulkCreate(addRes, { transaction: transaction });
delRes.length && await models.UserResource.destroy({
where: {
resourceId: { $in: delRes },
userId: userId
},
transaction: transaction
})
// await models.UserResource.update({
// isShow: isShow
// }, {
// where: {
// userId: userId
// }
// })
ctx.status = 204;
await transaction.commit();
} catch (error) {
await transaction.rollback();
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
"message": "更新用户权限数据失败"
}
}
}
async function editeUserRes(ctx, next) {
const transaction = await ctx.fs.dc.orm.transaction()
await transaction.commit()
try {
const models = ctx.fs.dc.models;
const { userId, isShow } = ctx.request.body
console.log('ctx.request.body1', ctx.request.body)
await models.UserResource.update({
isshow: isShow
}, {
where: {
userId: userId
}
})
ctx.status = 204;
} catch (error) {
await transaction.rollback()
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
"message": "更新用户权限数据失败"
}
}
}
module.exports = {
getResource,
getUserResource,
updateUserRes,
editeUserRes
};

11
api/app/lib/controllers/organization/department.js

@ -1,6 +1,6 @@
'use strict';
async function getdep (ctx) {
async function getdep(ctx) {
try {
const { fs: { api: { userInfo } } } = ctx
const models = ctx.fs.dc.models;
@ -49,10 +49,11 @@ async function getdep (ctx) {
}
}
async function editDep (ctx) {
async function editDep(ctx) {
try {
const models = ctx.fs.dc.models;
const { depId, name, dependence } = ctx.request.body;
const { depId, name, dependence, areaCode, area } = ctx.request.body
//console.log(ctx.request.body, '111111wed')
if (dependence) {
let dep = await models.Department.findOne({
where: {
@ -79,6 +80,7 @@ async function editDep (ctx) {
await models.Department.update({
name: name,
dependence: dependence || null,
areaCode: areaCode || null
}, {
where: {
id: depId
@ -99,6 +101,7 @@ async function editDep (ctx) {
name: name,
delete: false,
dependence: dependence || null,
areaCode: area || null
})
}
ctx.status = 204;
@ -111,7 +114,7 @@ async function editDep (ctx) {
}
}
async function delDep (ctx) {
async function delDep(ctx) {
const transaction = await ctx.fs.dc.orm.transaction();
try {
const models = ctx.fs.dc.models;

12
api/app/lib/index.js

@ -26,7 +26,7 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq
require(`./models/${filename}`)(dc)
});
const { User, Department, Report, FileType, Road, Files, FileRoad, TaskManage } = dc.models;
const { User, Department, Report, FileType, Road, Files, FileRoad, TaskManage, UserResource, Resource } = dc.models;
// 定义外键
User.belongsTo(Department, { foreignKey: 'departmentId', targetKey: 'id' });
Department.hasMany(User, { foreignKey: 'departmentId', sourceKey: 'id' });
@ -46,4 +46,14 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq
//
TaskManage.belongsTo(Road, { foreignKey: 'roadid', targetKey: 'id' })
Road.hasMany(TaskManage, { foreignKey: 'roadid', targetKey: 'id' })
UserResource.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' });
User.hasMany(UserResource, { foreignKey: 'userId', sourceKey: 'id' });
UserResource.belongsTo(Resource, { foreignKey: 'resourceId', targetKey: 'code' });
Resource.hasMany(UserResource, { foreignKey: 'resourceId', sourceKey: 'code' });
Resource.hasMany(Resource, { foreignKey: 'parentResource', sourceKey: 'code' });
};

11
api/app/lib/models/department.js

@ -41,7 +41,16 @@ module.exports = dc => {
primaryKey: false,
field: "delete",
autoIncrement: false
}
},
areaCode: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '所属区域代码',
primaryKey: false,
field: "area_code",
autoIncrement: false
},
}, {
tableName: "department",
comment: "",

43
api/app/lib/models/resource.js

@ -0,0 +1,43 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Resource = sequelize.define("resource", {
code: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: "NULL",
comment: null,
primaryKey: true,
field: "code",
autoIncrement: false
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: "NULL",
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
parentResource: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: "NULL",
comment: null,
primaryKey: false,
field: "parent_resource",
autoIncrement: false
}
}, {
tableName: "resource",
comment: "",
indexes: []
});
dc.models.Resource = Resource;
return Resource;
};

60
api/app/lib/models/user_resource.js

@ -0,0 +1,60 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const UserResource = sequelize.define("userResource", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true
},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "user_id",
autoIncrement: false,
references: {
key: "id",
model: "user"
}
},
resourceId: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: "NULL",
comment: null,
primaryKey: false,
field: "resource_id",
autoIncrement: false,
references: {
key: "code",
model: "resource"
}
},
isshow: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "isshow",
autoIncrement: false
}
}, {
tableName: "user_resource",
comment: "",
indexes: []
});
dc.models.UserResource = UserResource;
return UserResource;
};

34
api/app/lib/routes/organization/index.js

@ -1,7 +1,8 @@
'use strict';
const Department = require('../../controllers/organization/department')
const user = require('../../controllers/organization/user');
const user = require('../../controllers/organization/user')
const Authority = require('../../controllers/organization/authority')
module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/department'] = { content: '获取部门列表', visible: false };
@ -32,5 +33,34 @@ module.exports = function (app, router, opts) {
// router.put('/department/user/:userId/resetPwd', user.resetPwd);
app.fs.api.logAttr['PUT/department/user/:userId/password'] = { content: '修改用户密码', visible: false };
router.put('/department/user/:userId/password', user.setPassword);
router.put('/department/user/:userId/password', user.setPassword)
/**
* @api {GET} resource 查询所有权限码.
* @apiVersion 1.0.0
* @apiGroup Org
*/
app.fs.api.logAttr['GET/resource'] = { content: '查询所有权限码', visible: true };
router.get('resource', Authority.getResource);
/**
* @api {GET} user/resource 查询用户权限.
* @apiVersion 1.0.0
* @apiGroup Org
*/
app.fs.api.logAttr['GET/user/resource'] = { content: '查询用户权限', visible: true };
router.get('user/resource', Authority.getUserResource);
/**
* @api {POST} user/resource 更新用户权限.
* @apiVersion 1.0.0
* @apiGroup Org
*/
app.fs.api.logAttr['POST/user/resource'] = { content: '更新用户权限', visible: true };
router.post('user/resource', Authority.updateUserRes);
app.fs.api.logAttr['POST/user/resources'] = { content: '更新用户权限', visible: true };
router.post('user/resources', Authority.editeUserRes);
};

5
jenkinsfilenew_api

@ -1,8 +1,8 @@
podTemplate {
node('pod-templ-jenkins-slave-common') {
env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${IOT}/${JOB_NAME}"
env.IMAGE_NAME_SHORT = "${IOT}/${JOB_NAME}"
env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${SMARTCITY}/${JOB_NAME}"
env.IMAGE_NAME_SHORT = "${SMARTCITY}/${JOB_NAME}"
env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/Highways4Good.git"
stage('Run shell') {
@ -10,7 +10,6 @@ podTemplate {
container('image-builder') {
sh'''
find . -depth -name '.svn' -type d -exec rm -rf {} +
/kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./api/Dockerfilenew --destination=${IMAGE_NAME}:${IMAGE_VERSION} --cache=false --cleanup
'''
}

8
jenkinsfilenew_web

@ -1,13 +1,13 @@
podTemplate {
node('pod-templ-jenkins-slave-common') {
env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${IOT}/${JOB_NAME}"
env.IMAGE_NAME_SHORT = "${IOT}/${JOB_NAME}"
env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${SMARTCITY}/${JOB_NAME}"
env.IMAGE_NAME_SHORT = "${SMARTCITY}/${JOB_NAME}"
env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/Highways4Good.git"
stage('Run shell') {
git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}"
container('image-builder') {
sh'''
pwd

4
scripts/1.2.2/schema/1.alter_department.sql

@ -0,0 +1,4 @@
alter table department
add area_code varchar(100);
comment on column department.area_code is '所属区域代码';

8
scripts/1.2.2/schema/2.create_resource.sql

@ -0,0 +1,8 @@
create table resource
(
code varchar(128) default NULL::character varying not null
constraint resource_pk
primary key,
name varchar(128) default NULL::character varying not null,
parent_resource varchar(128) default NULL::character varying
)

13
scripts/1.2.2/schema/3.create_user_resource.sql

@ -0,0 +1,13 @@
create table user_resource
(
id integer default nextval('user_resource_id_seq'::regclass) not null
constraint user_resource_pk
primary key,
user_id integer not null
constraint fk_emp_dept2
references "user",
resource_id varchar(128) default NULL::character varying not null
constraint user_resource_resource_code_fk
references resource,
isshow boolean
)

15
scripts/1.2.2/schema/4.insert_resource.sql

@ -0,0 +1,15 @@
INSERT INTO resource (code, name, parent_resource) VALUES ('ALLSELECT', '全选', null);
INSERT INTO resource (code, name, parent_resource) VALUES ('USERMANAGE', '用户管理', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('AUTHORIMANAGE', '权限管理', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('OVERLOADMANAGE', '治超管理', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('ROADMANAGE', '道路管理', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('BRIDGEMANAGE', '桥梁管理', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('MAINTENANCEMANAGE', '管养管理', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('TRANSPORTATIONMANAGE', '运政管理', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('CONSERVATIONMANAGE', '养护管理', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('PATROLMANAGE', '巡查管理', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('PUBLICTRANSPORTMANAGE', '公交管理', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('FILEMANAGE', '档案管理', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('PUBLICITYVIDEO', '宣传视频', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('FEEDBACKMANAGE', '异常反馈', 'ALLSELECT');
INSERT INTO resource (code, name, parent_resource) VALUES ('REPORTMANAGE', '建设上报', 'ALLSELECT');

26
web/Dockerfilenew

@ -1,17 +1,31 @@
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder
COPY . /var/app
COPY ./web/ /var/app
WORKDIR /var/app
EXPOSE 8080
RUN npm config set registry=https://nexus.ngaiot.com/repository/fs-npm/
RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json
RUN npm cache clean -f
RUN rm -rf package-lock.json
RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/
RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/
RUN npm run build
RUN rm -rf client/src
RUN rm -rf node_modules
RUN npm install --production --force --registry https://nexus.ngaiot.com/repository/fs-npm/
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node-16:7.22-06-20
COPY --from=builder --chown=node /var/app /home/node/app
RUN npm install --production --registry https://nexus.ngaiot.com/repository/fs-npm/
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12
COPY --from=builder --chown=node /var/app /home/node/app
WORKDIR /home/node/app
CMD ["node", "server.js"]
CMD [ "node", "server.js" ]

19
web/client/src/sections/fillion/components/bridgeTable.js

@ -25,7 +25,7 @@ const BrideTable = (props) => {
const [whichofits, setWhichofits] = useState('qiaoliang')
const [delet, setDelet] = useState()
const [differentiate, setDifferentiate] = useState('bridge')
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'BRIDGEMANAGE')[0].isshow === "true" ? true : '')
const ref = useRef()
useEffect(() => { ref.current.reload() }, [whichofits, delet])
const deldata = (id) => { // 桥梁
@ -1510,9 +1510,10 @@ const BrideTable = (props) => {
setTypecard('compile')
setRecortd(record)
}}
disabled={editAble}
>编辑</Button>
<Popconfirm title='是否确认删除' onConfirm={() => { deldata(record.id) }}>
<Button type="link">删除</Button>
<Popconfirm title='是否确认删除' onConfirm={() => { deldata(record.id) }} disabled={editAble}>
<Button type="link" disabled={editAble}>删除</Button>
</Popconfirm></div>
}
@ -1531,6 +1532,7 @@ const BrideTable = (props) => {
openModal('edit', record)
setTypecard('')
}}
disabled={editAble}
>
新增
</Button>
@ -1694,8 +1696,9 @@ const BrideTable = (props) => {
setTypecard('compile')
setRecortd(record)
}}
>编辑</Button><Popconfirm title='' onConfirm={() => { deldatas(record.id) }}>
<Button type="link">删除</Button>
disabled={editAble}
>编辑</Button><Popconfirm title='' onConfirm={() => { deldatas(record.id) }} disabled={editAble}>
<Button type="link" disabled={editAble}>删除</Button>
</Popconfirm></div>
}
@ -1714,6 +1717,7 @@ const BrideTable = (props) => {
yilanModal('edit', record)
setTypecard('')
}}
disabled={editAble}
>
新增
</Button>
@ -1815,7 +1819,7 @@ const BrideTable = (props) => {
} if (whichofits == 'gongcheng') {
const query = {
type: 'bridge',
entryName:sitename
entryName: sitename
}
setRowSelected([]);
const res = await dispatch(getProject(query));
@ -1830,8 +1834,9 @@ const BrideTable = (props) => {
defaultCollapsed: false,
optionRender: (searchConfig, formProps, dom) => [
...dom.reverse(),
<Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected,differentiate) }}>
<Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, differentiate) }} disabled={editAble}>
<Button
disabled={editAble}
>
导出
</Button>

24
web/client/src/sections/fillion/components/fileTable.js

@ -18,7 +18,7 @@ import UploadModal from './file/uploadModal';
// var pdfh5 = null;
const DetailList = (props) => {
const { fileList, loading, dispatch, handelRefresh, onPageChange } = props;
const { fileList, loading, dispatch, handelRefresh, onPageChange, user } = props;
const [imgSrc, setImgSrc] = useState({ imageView: false, imgSrc: '' })
const [pdfView, setPdfView] = useState({ showPDF: false, pdfName: '', pdfurl: '' })
var tyApiRoot = localStorage.getItem('tyApiRoot')
@ -137,7 +137,9 @@ const DetailList = (props) => {
window.open(filePath_);
}} >下载</a>}
<span className="ant-divider" />
<a style={{ color: '#333398' }} onClick={() => { showDeleteConfirm(record, filePath) }}>删除</a>
<a style={{ color: '#333398' }} onClick={() => { showDeleteConfirm(record, filePath) }}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FILEMANAGE')[0].isshow === "true" ? true : ''}
>删除</a>
{
['.png', '.jpg'].some(item => item == record.fileExt) ?
[<span className="ant-divider" />,
@ -206,7 +208,8 @@ const RoadNameList = (props) => {
const [filterRoad, setFilterRoad] = useState([]);
const [addVisible, setAddVisible] = useState(false);
const [selectRoad, setSelectRoad] = useState();
const { onChange, roads, loading, queryData, dispatch } = props;
const { onChange, roads, loading, queryData, dispatch, user } = props
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FILEMANAGE')[0].isshow === "true" ? true : '')
const columns = [
{
title: '道路名称',
@ -270,7 +273,9 @@ const RoadNameList = (props) => {
}}
toolBarRender={() => [
<div>
<Button onClick={() => setAddVisible(true)} type="primary" style={{ width: '100%', marginBottom: 8 }} >新增</Button>
<Button onClick={() => setAddVisible(true)} type="primary" style={{ width: '100%', marginBottom: 8 }}
disabled={editAble}
>新增</Button>
<Input placeholder='输入道路名称' onChange={doRoadNameSearch} ></Input>
</div>
]}
@ -281,8 +286,8 @@ const RoadNameList = (props) => {
return {
onClick: () => {
if (record) {
let id = record.rId
if(selectRoad == record.rId){
let id = record.rId
if (selectRoad == record.rId) {
id = null
}
setSelectRoad(id);
@ -401,6 +406,7 @@ const FileTable = (props) => {
<div className='card-protable'>
<Card >
<RoadNameList
user={user}
dispatch={dispatch}
queryData={queryData}
onChange={(record) => handleChangeRecord(record)}
@ -417,10 +423,12 @@ const FileTable = (props) => {
}}
>
<Row>
<Button onClick={() => { setUploadVisible(true) }} type="primary" style={{ width: 160, marginBottom: 8, visibility: record ? 'visible': "hidden" }} >上传</Button>
<Button onClick={() => { setUploadVisible(true) }} type="primary" style={{ width: 160, marginBottom: 8, visibility: record ? 'visible' : "hidden" }}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FILEMANAGE')[0].isshow === "true" ? true : ''}
>上传</Button>
</Row>
<Card style={{ flex: 1 }}>
<DetailList fileList={fileList} record={record} loading={fileListLoading} dispatch={dispatch} handelRefresh={handelRefresh} onPageChange={onPageChange} />
<DetailList user={user} fileList={fileList} record={record} loading={fileListLoading} dispatch={dispatch} handelRefresh={handelRefresh} onPageChange={onPageChange} />
</Card>
</Card>
<UploadModal

3
web/client/src/sections/fillion/components/highwaysTable.js

@ -25,6 +25,7 @@ const TransporTationTable = (props) => {
const [delet, setDelet] = useState()
const [differentiate, setDifferentiate] = useState('road')
const [grade, setGrade] = useState('县')
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'MAINTENANCEMANAGE')[0].isshow === "true" ? true : '')
const ref = useRef()
useEffect(() => { ref.current.reload() }, [whichofits, delet])
//打开弹窗
@ -95,6 +96,7 @@ const TransporTationTable = (props) => {
setTypecard('compile')
setRecortd(record)
}}
disabled={editAble}
>编辑</Button></div>
}
@ -250,6 +252,7 @@ const TransporTationTable = (props) => {
setTypecard('compile')
setRecortd(record)
}}
disabled={editAble}
>编辑</Button></div>
}

15
web/client/src/sections/fillion/components/infor/videoUpload.js

@ -9,12 +9,12 @@ import { getPropagata } from '../../actions/infor';
const VideoUpload = (props) => {
// const [counts, setCounts] = useState()//shuju
const { dispatch, record, counts, setCounts } = props
const { dispatch, record, counts, setCounts, user } = props
const [success, setSuccess] = useState() //状态
const [form] = Form.useForm();
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'PUBLICITYVIDEO')[0].isshow === "true" ? true : '')
//console.log('editAble', props)
let edit = editAble
//弹窗
const [isModalVisible, setIsModalVisible] = useState(false);
const showModal = () => {
@ -84,7 +84,7 @@ const VideoUpload = (props) => {
return (
<div >
{
props.type_ys ? <div><Button type='primary' onClick={showModal}>新增</Button>
props.type_ys ? <div><Button type='primary' disabled={editAble} >新增</Button>
<Modal visible={isModalVisible} onOk={handleOkAdd} onCancel={handleCancelEdit} >
<Form
form={form}
@ -143,7 +143,7 @@ const VideoUpload = (props) => {
</Modal>
</div>
:
<div><Button type='link' onClick={showModalEdit} style={{ Position: "absolute", left: "-50px", top: "32px" }}>编辑</Button>
<div><Button disabled={editAble} type='link' onClick={showModalEdit} style={{ Position: "absolute", left: "-50px", top: "32px" }}>编辑</Button>
<Modal visible={isModalVisible} onOk={() => handleOkEdit(record)} onCancel={handleCancel}>
<Form
form={form}
@ -207,7 +207,7 @@ const VideoUpload = (props) => {
function mapStateToProps(state) {
const { depMessage } = state;
const { depMessage, auth } = state;
const pakData = (dep) => {
return dep.map((d) => {
return {
@ -219,6 +219,7 @@ function mapStateToProps(state) {
}
let depData = pakData(depMessage.data || [])
return {
user: auth.user,
loading: depMessage.isRequesting,
depData,
};

16
web/client/src/sections/fillion/components/inforTable.js

@ -357,10 +357,16 @@ const InForTable = (props) => {
setTypecard('compile')
setRecortd(record)
}}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''}
>编辑</Button>
<Popconfirm title='是否确认删除' onConfirm={() => { deldata(record.id) }}>
<Button type="link">删除</Button>
<Popconfirm title='是否确认删除' onConfirm={() => { deldata(record.id) }}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''}
>
<Button type="link"
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''}
>删除</Button>
</Popconfirm></div>
}
@ -379,6 +385,7 @@ const InForTable = (props) => {
openModal('edit', record)
setTypecard('')
}}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''}
>
新增
</Button>
@ -461,8 +468,11 @@ const InForTable = (props) => {
// console.log(rowSelected)
rowSelected.length === 0 ? null : props.exports(rowSelected, counts)
}}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''}
>
<Button
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')[0].isshow === "true" ? true : ''}
>
导出
</Button>
@ -518,7 +528,7 @@ const data = {
"fine": "罚款",
"remarks": "备注"
}
function mapStateToProps (state) {
function mapStateToProps(state) {
const { auth, depMessage } = state;
const pakData = (dep) => {
return dep.map((d) => {

14
web/client/src/sections/fillion/components/maintenanceTable.js

@ -67,9 +67,10 @@ const DetailForm = (props) => {
}
const DetailList = (props) => {
const { reportList, loading, dispatch, handleOpen, handelRefresh } = props;
const { reportList, loading, dispatch, handleOpen, handelRefresh, user } = props;
const [visible, setVisible] = useState(false)
const [selectRecord, setSelectRecord] = useState();
const [selectRecord, setSelectRecord] = useState()
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'CONSERVATIONMANAGE')[0].isshow === "true" ? true : '')
const checkDetail = (record) => {
dispatch(getReportDetail(record.id))
}
@ -182,11 +183,11 @@ const DetailList = (props) => {
]}
visible={selectRecord == record.id && visible}
trigger="click"
onClick={() => setSelectRecord(record.id)}
onClick={() => user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'CONSERVATIONMANAGE')[0].isshow === "true" ? '' : setSelectRecord(record.id)}
title="是否删除该记录?"
onVisibleChange={(newVisible) => setVisible(newVisible)}
>
<Button>删除</Button>
<Button disabled={editAble}>删除</Button>
</Popover>
]
}
@ -290,7 +291,7 @@ const PatrolNameList = (props) => {
const MaintenanceTable = (props) => {
const { userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports } = props;
const { userList, user, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports } = props;
const [record, setRecord] = useState();
const [dateRange, setDateRange] = useState();
const [detailVisible, setDetailVisible] = useState(false)
@ -363,6 +364,7 @@ const MaintenanceTable = (props) => {
</div>
<Card style={{ flex: 1 }}>
<DetailList
user={user}
reportList={reportList} record={record} loading={reportListLoading} dispatch={dispatch} handleOpen={handleOpen}
handelRefresh={handelRefresh}
/>
@ -378,7 +380,7 @@ const MaintenanceTable = (props) => {
);
};
function mapStateToProps (state) {
function mapStateToProps(state) {
const { auth, depMessage, userList, reportList, reportDetail } = state;
const pakData = (dep) => {
return dep.map((d) => {

52
web/client/src/sections/fillion/components/operationalTable.js

@ -22,8 +22,9 @@ const OperaTionalTable = (props) => {
const [recortd, setRecortd] = useState()
const [rewkeys, setRewkeys] = useState('keyun')
const [delet, setDelet] = useState()
const [differentiate,setDifferentiate]=useState()
const [genre,setGenre]=useState()
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'TRANSPORTATIONMANAGE')[0].isshow === "true" ? true : '')
const [differentiate, setDifferentiate] = useState()
const [genre, setGenre] = useState()
const ref = useRef()
useEffect(() => { ref.current.reload() }, [rewkeys, activeKey, delet])
//打开弹窗
@ -111,6 +112,7 @@ const [genre,setGenre]=useState()
setTypecard('compile')
setRecortd(record)
}}
disabled={editAble}
>编辑</Button></div>
}
@ -164,6 +166,7 @@ const [genre,setGenre]=useState()
setTypecard('compile')
setRecortd(record)
}}
disabled={editAble}
>编辑</Button></div>
}
@ -752,8 +755,9 @@ const [genre,setGenre]=useState()
setTypecard('compile')
setRecortd(record)
}}
>编辑</Button> <Popconfirm title='' onConfirm={() => { deldata(record.id) }}>
<Button type="link">删除</Button>
disabled={editAble}
>编辑</Button> <Popconfirm title='' onConfirm={() => { deldata(record.id) }} disabled={editAble}>
<Button type="link" disabled={editAble}>删除</Button>
</Popconfirm></div>
}
@ -772,6 +776,7 @@ const [genre,setGenre]=useState()
openModal('edit', record)
setTypecard('')
}}
disabled={editAble}
>
新增
</Button>
@ -1385,8 +1390,9 @@ const [genre,setGenre]=useState()
setTypecard('compile')
setRecortd(record)
}}
>编辑</Button> <Popconfirm title='' onConfirm={() => { deldata(record.id) }}>
<Button type="link">删除</Button>
disabled={editAble}
>编辑</Button> <Popconfirm title='' onConfirm={() => { deldata(record.id) }} disabled={editAble}>
<Button type="link" disabled={editAble}>删除</Button>
</Popconfirm></div>
}
@ -1405,6 +1411,7 @@ const [genre,setGenre]=useState()
openModal('edit', record)
setTypecard('')
}}
disabled={editAble}
>
新增
</Button>
@ -1850,13 +1857,14 @@ const [genre,setGenre]=useState()
fixed: 'right',
render: (dom, record) => {
return <div><Button type="link"
onClick={() => {
openModal('edit', record)
setTypecard('compile')
setRecortd(record)
}}
>编辑</Button><Popconfirm title='' onConfirm={() => { deldatas(record.id) }}>
<Button type="link">删除</Button>
onClick={() => {
openModal('edit', record)
setTypecard('compile')
setRecortd(record)
}}
disabled={editAble}
>编辑</Button><Popconfirm title='' onConfirm={() => { deldatas(record.id) }} disabled={editAble}>
<Button type="link" disabled={editAble}>删除</Button>
</Popconfirm></div>
}
@ -1875,6 +1883,7 @@ const [genre,setGenre]=useState()
openModal('edit', record)
setTypecard('')
}}
disabled={editAble}
>
新增
</Button>
@ -1927,9 +1936,9 @@ const [genre,setGenre]=useState()
key: 'tab3',
label: <span onClick={() => {
{
setDifferentiate('vehicle')
setRewkeys('chuzu')
setGenre('出租车')
setDifferentiate('vehicle')
setRewkeys('chuzu')
setGenre('出租车')
}
}}>出租车{activeKey === 'tab3'}</span>,
@ -1938,9 +1947,9 @@ const [genre,setGenre]=useState()
key: 'tab4',
label: <span onClick={() => {
{
setDifferentiate('vehicle')
setGenre('危货')
setRewkeys('weihuo')
setDifferentiate('vehicle')
setGenre('危货')
setRewkeys('weihuo')
}
}}>危险货运{activeKey === 'tab4'}</span>,
@ -2037,8 +2046,9 @@ const [genre,setGenre]=useState()
defaultCollapsed: false,
optionRender: (searchConfig, formProps, dom) => [
...dom.reverse(),
['tab3', 'tab4', 'tab5'].includes(activeKey) ? <Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, differentiate, genre) }}>
['tab3', 'tab4', 'tab5'].includes(activeKey) ? <Popconfirm disabled={editAble} title="确认导出?" onConfirm={() => { props.exports(rowSelected, differentiate, genre) }}>
<Button
disabled={editAble}
>
导出
</Button>
@ -2066,7 +2076,7 @@ const [genre,setGenre]=useState()
onVisibleChange={setModalVisibleyilan}
modalRecord={modalRecord}
typecard={typecard}
rewkeys={rewkeys=='keyun'?'passenger':'freight'}
rewkeys={rewkeys == 'keyun' ? 'passenger' : 'freight'}
recortd={recortd}
setDelet={setDelet}
setRecortd={setRecortd}

20
web/client/src/sections/fillion/components/patrolTable.js

@ -79,13 +79,11 @@ const DetailForm = (props) => {
}
const DetailList = (props) => {
const { reportList, loading, dispatch, handleOpen, handelRefresh, isAnomaly, isRoad, isPatrol, queryData } = props;
const { reportList, loading, dispatch, handleOpen, handelRefresh, isAnomaly, isRoad, isPatrol, queryData, user } = props;
const [visible, setVisible] = useState(false)
const [selectRecord, setSelectRecord] = useState();
const [noProcessingPopVisible, setNoProcessingPopVisible] = useState(false);
const [noProcessingSelectRecord, setNoProcessingSelectRecord] = useState();
const checkDetail = (record) => {
dispatch(getReportDetail(record.id))
}
@ -210,7 +208,7 @@ const DetailList = (props) => {
<Button
onClick={() => { checkDetail(record); handleOpen(); }}
style={{ marginRight: 10 }}>查看</Button>,
isAnomaly && record.handleState != '已处理' ? <Button>指派</Button> : null,
isAnomaly && record.handleState != '已处理' ? <Button disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FEEDBACKMANAGE' || 'FEEDBACKMANAGE')[0].isshow === "true" ? true : ''}>指派</Button> : null,
isAnomaly && record.handleState != '已处理' ?
<Popover
content={[
@ -227,11 +225,11 @@ const DetailList = (props) => {
]}
visible={noProcessingSelectRecord == record.id && noProcessingPopVisible}
trigger="click"
onClick={() => setNoProcessingSelectRecord(record.id)}
onClick={() => user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FEEDBACKMANAGE' || 'FEEDBACKMANAGE')[0].isshow === "true" ? '' : setNoProcessingSelectRecord(record.id)}
title="是否不处理该记录?"
onVisibleChange={(newVisible) => setNoProcessingPopVisible(newVisible)}
>
<Button>不处理</Button>
<Button disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FEEDBACKMANAGE' || 'FEEDBACKMANAGE')[0].isshow === "true" ? true : ''}>不处理</Button>
</Popover> : null,
<Popover
content={[
@ -242,11 +240,11 @@ const DetailList = (props) => {
]}
visible={selectRecord == record.id && visible}
trigger="click"
onClick={() => setSelectRecord(record.id)}
onClick={() => user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FEEDBACKMANAGE' || 'FEEDBACKMANAGE')[0].isshow === "true" ? '' : setSelectRecord(record.id)}
title="是否删除该记录?"
onVisibleChange={(newVisible) => setVisible(newVisible)}
>
<Button>删除</Button>
<Button disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'FEEDBACKMANAGE' || 'FEEDBACKMANAGE')[0].isshow === "true" ? true : ''}>删除</Button>
</Popover>
]
}
@ -355,13 +353,12 @@ const PatrolNameList = (props) => {
const PatrolTable = (props) => {
const { userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname } = props;
const { user, userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname } = props;
const [record, setRecord] = useState();
const [dateRange, setDateRange] = useState();
const [selectProjectType, setSelectProjectType] = useState('');
const [detailVisible, setDetailVisible] = useState(false)
const [activeTabKey1, setActiveTabKey1] = useState('tab1');
const { RangePicker } = DatePicker;
const isRoad = pathname.includes('road')
@ -426,6 +423,7 @@ const PatrolTable = (props) => {
<div>
<Card style={{ flex: 1 }}>
<DetailList
user={user}
reportList={reportList} record={record} loading={reportListLoading} dispatch={dispatch} handleOpen={handleOpen} handelRefresh={handelRefresh}
isPatrol={isPatrol} isRoad={isRoad} isAnomaly={isAnomaly} queryData={queryData}
/>
@ -512,7 +510,7 @@ const PatrolTable = (props) => {
);
};
function mapStateToProps (state) {
function mapStateToProps(state) {
const { auth, depMessage, userList, reportList, reportDetail } = state;
const pakData = (dep) => {
return dep.map((d) => {

10
web/client/src/sections/fillion/components/promotionalTable.js

@ -9,9 +9,10 @@ import { putEditPropagata } from '../actions/infor';
import { delPropagata } from '../actions/infor';
const promotionalTable = (props) => {
const { dispatch, } = props
const { dispatch, user } = props
const [rowSelected, setRowSelected] = useState([])
const [counts, setCounts] = useState()//shuju
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'PUBLICITYVIDEO')[0].isshow === "true" ? true : '')
const onClickEnable = (record) => {
const id = record.id
@ -61,7 +62,7 @@ const promotionalTable = (props) => {
fixed: 'right',
render: (dom, record) => {
return <div >
<Switch checkedChildren="展示" unCheckedChildren="关闭" onClick={() => onClickEnable(record)} defaultChecked={true ? record.enable == true : false} />
<Switch checkedChildren="展示" unCheckedChildren="关闭" onClick={() => onClickEnable(record)} defaultChecked={true ? record.enable == true : false} disabled={editAble} />
</div>
}
},
@ -74,8 +75,9 @@ const promotionalTable = (props) => {
fixed: 'right',
render: (dom, record) => {
return <div style={{ position: 'relative', marginTop: '-30px' }}>
<VideoUpload record={record} counts={counts} setCounts={setCounts} />
<VideoUpload record={record} counts={counts} setCounts={setCounts} user={user} />
<Popconfirm
disabled={editAble}
title="是否确定删除?"
arrowPointAtCenter={true}
showArrow={true}
@ -94,7 +96,7 @@ const promotionalTable = (props) => {
}
>
<Button type="link" float="right"
<Button type="link" float="right" disabled={editAble}
>删除</Button>
</Popconfirm>
</div>

16
web/client/src/sections/fillion/components/publicTable.js

@ -22,6 +22,7 @@ const PublicTable = (props) => {
const [recortd, setRecortd] = useState()
const [rewkeys, setRewkeys] = useState('xianlu')
const [delet, setDelet] = useState()
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'PUBLICTRANSPORTMANAGE')[0].isshow === "true" ? true : '')
const ref = useRef()
useEffect(() => { ref.current.reload() }, [delet, rewkeys])
@ -411,8 +412,9 @@ const PublicTable = (props) => {
setTypecard('compile')
setRecortd(record)
}}
>编辑</Button><Popconfirm title='' onConfirm={() => { deldata(record.id) }}>
<Button type="link">删除</Button>
disabled={editAble}
>编辑</Button><Popconfirm title='' onConfirm={() => { deldata(record.id) }} disabled={editAble}>
<Button type="link" disabled={editAble}>删除</Button>
</Popconfirm></div>
}
@ -431,6 +433,7 @@ const PublicTable = (props) => {
openModal('edit', record)
setTypecard('')
}}
disabled={editAble}
>
新增
</Button>
@ -1106,8 +1109,9 @@ const PublicTable = (props) => {
setTypecard('compile')
setRecortd(record)
}}
>编辑</Button><Popconfirm title='' onConfirm={() => { deldatas(record.id) }}>
<Button type="link">删除</Button>
disabled={editAble}
>编辑</Button><Popconfirm title='' onConfirm={() => { deldatas(record.id) }} disabled={editAble}>
<Button type="link" disabled={editAble}>删除</Button>
</Popconfirm></div>
}
@ -1126,6 +1130,7 @@ const PublicTable = (props) => {
openModal('edit', record)
setTypecard('')
}}
disabled={editAble}
>
新增
</Button>
@ -1231,8 +1236,9 @@ const PublicTable = (props) => {
defaultCollapsed: false,
optionRender: (searchConfig, formProps, dom) => [
...dom.reverse(),
<Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected,rewkeys ) }}>
<Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, rewkeys) }} disabled={editAble}>
<Button
disabled={editAble}
>
导出
</Button>

65
web/client/src/sections/fillion/components/transportationTable.js

@ -23,6 +23,8 @@ const TransporTationTable = (props) => {
const [delet, setDelet] = useState()
const [differentiate, setDifferentiate] = useState('road')
const [grade, setGrade] = useState('县')
const [departmentInfo, setDepartment] = useState('')
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')[0].isshow === "true" ? true : '')
const ref = useRef()
useEffect(() => { ref.current.reload() }, [whichofits, delet])
//打开弹窗
@ -35,6 +37,17 @@ const TransporTationTable = (props) => {
setModalRecord(null);
}
}
useEffect(() => {
const { departmentId } = user
const departmentInfo = depMessage.find((item) => {
return item.id === departmentId
})
setDepartment(departmentInfo)
}, [user, depMessage])
console.log('sad', departmentInfo)
// useEffect(() => {
// console.log('11111', depMessage)
// }, [depMessage])
const yilanModal = (type, record) => {
setModalVisibleyilan(true);
// setModalType(type);
@ -1180,11 +1193,12 @@ const TransporTationTable = (props) => {
openModal('edit', record)
setTypecard('compile')
}}
disabled={editAble}
>编辑</Button>
<Popconfirm title='是否确认删除' onConfirm={() => { deldata(record.id) }}><Button type="link"
// onClick={() => {
// }}
<Popconfirm title='是否确认删除' onConfirm={() => { deldata(record.id) }}
disabled={editAble}
><Button type="link"
disabled={editAble}
>删除</Button></Popconfirm>
</div>
@ -1205,6 +1219,7 @@ const TransporTationTable = (props) => {
// sessionStorage.setItem('newly', JSON.stringify(data))
setTypecard('')
}}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')[0].isshow === "true" ? true : ''}
>
新增
</Button>
@ -2338,9 +2353,11 @@ const TransporTationTable = (props) => {
setRecortd(record)
}}
disabled={editAble}
>编辑</Button>
<Popconfirm title='是否确认删除' onConfirm={() => { deldata(record.id) }}>
<Button type="link">删除</Button>
<Popconfirm title='是否确认删除' onConfirm={() => { deldata(record.id) }} disabled={editAble}
>
<Button type="link" disabled={editAble}>删除</Button>
</Popconfirm>
</div>
@ -3495,9 +3512,14 @@ const TransporTationTable = (props) => {
setRecortd(record)
}}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')[0].isshow === "true" ? true : ''}
>编辑</Button>
<Popconfirm title='是否确认删除' onConfirm={() => { deldata(record.id) }}>
<Button type="link">删除</Button>
<Popconfirm title='是否确认删除' onConfirm={() => { deldata(record.id) }}
disabled={editAble}
>
<Button type="link"
disabled={editAble}
>删除</Button>
</Popconfirm></div>
}
@ -3681,9 +3703,10 @@ const TransporTationTable = (props) => {
setTypecard('compile')
setRecortd(record)
}}
disabled={editAble}
>编辑</Button>
<Popconfirm title='是否确认删除' onConfirm={() => { deldatas(record.id) }}>
<Button type="link">删除</Button>
<Popconfirm title='是否确认删除' onConfirm={() => { deldatas(record.id) }} disabled={editAble}>
<Button type="link" disabled={editAble}>删除</Button>
</Popconfirm>
</div>
@ -3787,7 +3810,7 @@ const TransporTationTable = (props) => {
request={async (params) => {
console.log(whichofits)
if (whichofits == '县') {
console.log('differentiate','我我我我吧')
console.log('differentiate', '我我我我吧')
const query = {
level: '县',
@ -3797,7 +3820,10 @@ const TransporTationTable = (props) => {
const res = await dispatch(getRoadway(query));
// console.log(res)
setCounts(res.payload.data)
setCounts(departmentInfo ? res.payload.data.filter((item) => {
return item.townshipCode === departmentInfo.areaCode
}) : res.payload.data)
//setCounts(res.payload.data)
return {
...res,
total: res.payload.data ? res.payload.data.count : 0
@ -3809,7 +3835,9 @@ const TransporTationTable = (props) => {
}
setRowSelected([]);
const res = await dispatch(getRoadway(query));
setCounts(res.payload.data)
setCounts(departmentInfo ? res.payload.data.filter((item) => {
return item.townshipCode === departmentInfo.areaCode
}) : res.payload.data)
return {
...res,
total: res.payload.data ? res.payload.data.count : 0
@ -3821,7 +3849,9 @@ const TransporTationTable = (props) => {
}
setRowSelected([]);
const res = await dispatch(getRoadway(query));
setCounts(res.payload.data)
setCounts(departmentInfo ? res.payload.data.filter((item) => {
return item.townshipCode === departmentInfo.areaCode
}) : res.payload.data)
return {
...res,
total: res.payload.data ? res.payload.data.count : 0
@ -3830,7 +3860,7 @@ const TransporTationTable = (props) => {
if (whichofits == 'gongcheng') {
const query = {
type: 'road',
entryName:sitename
entryName: sitename
}
setRowSelected([]);
const res = await dispatch(getProject(query));
@ -3845,8 +3875,11 @@ const TransporTationTable = (props) => {
defaultCollapsed: false,
optionRender: (searchConfig, formProps, dom) => [
...dom.reverse(),
<Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected,grade,differentiate) }}>
<Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, grade, differentiate) }}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')[0].isshow === "true" ? true : ''}
>
<Button
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')[0].isshow === "true" ? true : ''}
>
导出
</Button>

4
web/client/src/sections/fillion/containers/patrol.js

@ -25,12 +25,12 @@ const patrol = (props) => {
}
return (
<>
<PatrolTable data={data} exports={exports} pathname={pathname} />
<PatrolTable data={data} exports={exports} pathname={pathname} user={user} />
</>
)
}
function mapStateToProps (state) {
function mapStateToProps(state) {
const { auth } = state
return {
user: auth.user,

115
web/client/src/sections/fillion/nav-item.js

@ -3,56 +3,87 @@ import { Link } from 'react-router-dom';
import { Menu } from 'antd';
import { ReadOutlined } from '@ant-design/icons';
const SubMenu = Menu.SubMenu;
export function getNavItem (user, dispatch) {
export function getNavItem(user, dispatch) {
const isshow = user?.userResources?.
filter(i => i.resourceId === 'OVERLOADMANAGE' ||
i.resourceId === 'ROADMANAGE' ||
i.resourceId === 'BRIDGEMANAGE' ||
i.resourceId === 'MAINTENANCEMANAGE' ||
i.resourceId === 'TRANSPORTATIONMANAGE' ||
i.resourceId === 'CONSERVATIONMANAGE' ||
i.resourceId === 'PUBLICTRANSPORTMANAGE' ||
i.resourceId === 'FILEMANAGE' ||
i.resourceId === 'PUBLICITYVIDEO' ||
i.resourceId === 'FEEDBACKMANAGE' ||
i.resourceId === 'REPORTMANAGE' ||
i.resourceId === 'PATROLMANAGE')?.length !== 0
return (
<SubMenu key="fillion" icon={<ReadOutlined />} title={'数据管理'}>
<Menu.Item key="fillioninfor">
<Link to="/fillion/infor">治超管理</Link>
</Menu.Item>
{/* <Menu.Item key="filliontask">
user?.username == 'SuperAdmin' || isshow ?
<SubMenu key="fillion" icon={<ReadOutlined />} title={'数据管理'}>
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'OVERLOADMANAGE')?.length !== 0 ?
<Menu.Item key="fillioninfor">
<Link to="/fillion/infor">治超管理</Link>
</Menu.Item> : ''}
{/* <Menu.Item key="filliontask">
<Link to="/fillion/task">任务管理</Link>
</Menu.Item> */}
<Menu.Item key="filliontransportation">
<Link to="/fillion/transportation">道路管理</Link>
</Menu.Item><Menu.Item key="fillionbridge">
<Link to="/fillion/bridge">桥梁管理</Link>
</Menu.Item>
<Menu.Item key="fillionhighways">
<Link to="/fillion/highways">管养管理</Link>
</Menu.Item>
<Menu.Item key="fillionoperational">
<Link to="/fillion/operational">运政管理</Link>
</Menu.Item>
{/* <Menu.Item key="fillionenforce">
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')?.length !== 0 ?
<Menu.Item key="filliontransportation">
<Link to="/fillion/transportation">道路管理</Link>
</Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'BRIDGEMANAGE')?.length !== 0 ?
<Menu.Item key="fillionbridge">
<Link to="/fillion/bridge">桥梁管理</Link>
</Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'MAINTENANCEMANAGE')?.length !== 0 ?
<Menu.Item key="fillionhighways">
<Link to="/fillion/highways">管养管理</Link>
</Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'TRANSPORTATIONMANAGE')?.length !== 0 ?
<Menu.Item key="fillionoperational">
<Link to="/fillion/operational">运政管理</Link>
</Menu.Item> : ''}
{/* <Menu.Item key="fillionenforce">
<Link to="/fillion/enforce">执法管理</Link>
</Menu.Item> */}
<Menu.Item key="fillionmaintenance">
<Link to="/fillion/maintenance">养护管理</Link>
</Menu.Item>
<Menu.Item key="fillionpatrol">
<Link to="/fillion/patrol">巡查管理</Link>
</Menu.Item>
<Menu.Item key="fillionpublic">
<Link to="/fillion/public">公交管理</Link>
</Menu.Item>
<Menu.Item key="fileCont">
<Link to="/fillion/file">档案管理</Link>
</Menu.Item>
{/* <Menu.Item key="fillionvideois">
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'CONSERVATIONMANAGE')?.length !== 0 ?
<Menu.Item key="fillionmaintenance">
<Link to="/fillion/maintenance">养护管理</Link>
</Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'PATROLMANAGE')?.length !== 0 ?
<Menu.Item key="fillionpatrol">
<Link to="/fillion/patrol">巡查管理</Link>
</Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'PUBLICTRANSPORTMANAGE')?.length !== 0 ?
<Menu.Item key="fillionpublic">
<Link to="/fillion/public">公交管理</Link>
</Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'FILEMANAGE')?.length !== 0 ?
<Menu.Item key="fileCont">
<Link to="/fillion/file">档案管理</Link>
</Menu.Item> : ''}
{/* <Menu.Item key="fillionvideois">
<Link to="/fillion/videois">视频管理</Link>
</Menu.Item> */}
{/* <Menu.Item key="jiekouguanli">
{/* <Menu.Item key="jiekouguanli">
<Link to="/fillion/jiekouguanli">接口管理</Link>
</Menu.Item> */}
<Menu.Item key="fillionpromotional">
<Link to="/fillion/promotional">宣传视频</Link>
</Menu.Item>
<Menu.Item key="fillionpatrolanomaly">
<Link to="/fillion/patrol_anomaly">异常反馈</Link>
</Menu.Item>
<Menu.Item key="fillionpatrolroad">
<Link to="/fillion/patrol_road">建设上报</Link>
</Menu.Item>
</SubMenu>
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'PUBLICITYVIDEO')?.length !== 0 ?
<Menu.Item key="fillionpromotional">
<Link to="/fillion/promotional">宣传视频</Link>
</Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'FEEDBACKMANAGE')?.length !== 0 ?
<Menu.Item key="fillionpatrolanomaly">
<Link to="/fillion/patrol_anomaly">异常反馈</Link>
</Menu.Item> : ''}
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'REPORTMANAGE')?.length !== 0 ?
<Menu.Item key="fillionpatrolroad">
<Link to="/fillion/patrol_road">建设上报</Link>
</Menu.Item> : ''}
</SubMenu> : null
);
}

14
web/client/src/sections/organization/actions/authority.js

@ -43,9 +43,21 @@ export function postUserRes(body) {
msg: { success: '更新用户权限' }
});
}
export function postUserReso(body) {
return dispatch => basicAction({
type: 'post',
dispatch: dispatch,
actionType: 'UPDATE_USER_RESOURCE',
url: `${ApiTable.postUserReso}`,
data: body,
msg: { success: '更新用户权限' }
});
}
export default {
getAuthority,
getResource,
getUserResource,
postUserRes
postUserRes,
postUserReso
}

48
web/client/src/sections/organization/components/depModal.js

@ -1,4 +1,4 @@
import React, { useRef, useState } from 'react';
import React, { useRef, useState, useEffect } from 'react';
import { connect } from 'react-redux';
import { Spin, Card, Modal, TreeSelect } from 'antd';
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form';
@ -6,13 +6,42 @@ import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } fro
const DepModal = (props) => {
const { visible, onVisibleChange, onConfirm, depModalType, depData, data } = props;
const formRef = useRef();
const roadCode = [
{ title: "莲塘镇", value: "360121100000" },
{ title: "向塘镇", value: "360121101000" },
{ title: "三江镇", value: "360121102000" },
{ title: "塘南镇", value: "360121103000" },
{ title: "幽兰镇", value: "360121104000" },
{ title: "蒋巷镇", value: "360121105000" },
{ title: "武阳镇", value: "360121106000" },
{ title: "冈上镇", value: "360121107000" },
{ title: "广福镇", value: "360121108000" },
{ title: "昌东镇", value: "360121191000" },
{ title: "麻丘镇", value: "360121192000" },
{ title: "泾口乡", value: "360121200000" },
{ title: "南新乡", value: "360121201000" },
{ title: "塔城乡", value: "360121202000" },
{ title: "黄马乡", value: "360121203000" },
{ title: "富山乡", value: "360121204000" },
{ title: "东新乡", value: "360121205000" },
{ title: "八一乡", value: "360121206000" },
{ title: "小蓝经济开发区", value: "360121403000" },
{ title: "银三角管理委员会", value: "360121501000" },
{ title: "五星垦殖场", value: "360121501000" },
{ title: "良种繁殖场", value: "360121572000" },
]
useEffect(() => {
console.log('depData', depData)
}, [])
const onFinish = (values) => {
if (onConfirm) {
if (depModalType === 'edit') {
let value = {
name: values.name,
depId: data.id,
dependence:values.dependence
dependence: values.dependence,
areaCode: values.area
}
onConfirm(value)
} else {
@ -62,6 +91,21 @@ const DepModal = (props) => {
return depData
}}
/>
<ProFormTreeSelect
name={['area']}
width="md"
label="所属区域"
autocomplete='off'
placeholder="选择所属区域"
fieldNames={{
title: 'name',
key: 'id',
//children: 'subordinate'
}}
request={async () => {
return roadCode
}}
/>
</ModalForm>
</Spin>
)

156
web/client/src/sections/organization/containers/authority.js

@ -1,33 +1,91 @@
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { Spin, Row, Col, Card, Button, Tree, Empty } from 'antd';
import { Spin, Row, Col, Card, Button, Tree, Empty, Checkbox } from 'antd';
import { getDepMessage, getDepUser } from '../actions/user';
import { getResource, getUserResource, postUserRes } from '../actions/authority';
import { getResource, getUserResource, postUserRes, postUserReso } from '../actions/authority';
import Resource from '../components/resource';
import user from './user';
const Authority = (props) => {
const { dispatch, loading, depMessage, depUser, resource, userResource, clientHeight } = props
const CheckboxGroup = Checkbox.Group;
const { dispatch, loading, depMessage, depUser, resource, userResource, clientHeight, user } = props
const r1 = ['USERMANAGE', 'AUTHORIMANAGE', 'OVERLOADMANAGE', 'ROADMANAGE', 'BRIDGEMANAGE', 'MAINTENANCEMANAGE', 'TRANSPORTATIONMANAGE',
'CONSERVATIONMANAGE', 'PATROLMANAGE', 'PUBLICTRANSPORTMANAGE', 'FILEMANAGE', 'PUBLICITYVIDEO', 'FEEDBACKMANAGE', 'REPORTMANAGE']
const [depSelectedKeys, setDepSelectedKeys] = useState([])
const [userSelectedKeys, setUserSelectedKeys] = useState([])
const [depSelected, setDepSelected] = useState()
const [userSelected, setUserSelected] = useState()
const [resCode, setResCode] = useState({})
const [resCode, setResCode] = useState(userResource.map(i => i.resourceId))
const [useName, setUseName] = useState()// 选中名字
const [userType,setUserType]=useState()
const [userType, setUserType] = useState()
const [depMessagedata, setdepMessagedata] = useState(depMessage)
const rescodeall = resource[0]?.resources?.map(i => ({ label: i.name, value: i.code }))
//console.log(resource[0]?.resources?.map(i => ({ label: i.name, value: i.code })), '这个是总的骂')
const [indeterminate, setIndeterminate] = useState(false);
const [checkAll, setCheckAll] = useState(true);
const [rescheckAll, setrescheckAll] = useState(false)
const [isshow, setisshow] = useState(false);
let plainOptions = depUser.map(i => ({ label: i.name, value: i.id }));
const [checkedList, setCheckedList] = useState(depUser.map(i => i.id));
const onChange = (list) => {
// console.log(list,'选择的')
setCheckedList(list);
setIndeterminate(!!list.length && list.length < plainOptions.length);
// setResCode(userResource.map(i=>i.resourceId))
setCheckAll(list.length === plainOptions.length);
dispatch(getUserResource(list))
// if(list.length === plainOptions.length){
// setUseName('全部用户')
// }
};
// console.log(userSelectedKeys,'当前1')
const onresChange = (d) => {
setResCode(d)
setrescheckAll(d.length === r1.length)
}
const onresCheckAllChange = (d) => {
setrescheckAll(d.target.checked)
setResCode(d.target.checked ? r1 : [])
}
const onCheckAllChange = (e) => {
setCheckedList(e.target.checked ? plainOptions.map(i => i.value) : []);
setIndeterminate(false);
// if(e.target.checked){
// setUseName('全部用户')
// }
setCheckAll(e.target.checked);
// setResCode(userResource.map(i=>i.resourceId))
};
const onshowchange = (e) => {
setisshow(e.target.checked)
}
useEffect(() => {
dispatch(getResource())
if (!(depMessage && depMessage.length)) {
dispatch(getDepMessage())
}
setResCode(userResource.map(i => i.resourceId))
setisshow(userResource.some(i => i.isshow === "true"))
setrescheckAll(userResource.map(i => i.resourceId).length === 14)
}, [])
useEffect(() => {
setResCode(userResource.map(i => i.resourceId))
setisshow(userResource.some(i => i.isshow === "true"))
setrescheckAll(userResource.map(i => i.resourceId).length === 14)
}, [userResource])
useEffect(() => {
if (depMessage.length) {
setDepSelectedKeys([depMessage[0].id])
setDepSelected([depMessage[0].name])
dispatch(getDepUser(depMessage[0].id))
console.log('depMessage', depMessage)
setdepMessagedata(depMessage)
setDepSelectedKeys([depMessage[0]?.id])
setDepSelected([depMessage[0]?.name])
dispatch(getDepUser(depMessage[0]?.id))
}
}, [depMessage])
useEffect(() => {
if (depUser.length) {
@ -36,36 +94,59 @@ const Authority = (props) => {
dispatch(getUserResource(depUser[0].id))
setUseName(depUser[0].name)
}
}, [depUser])
setCheckedList(depUser.map(i => i.id))
}, [depUser])
// console.log(depUser,'用户信息')
const handleSave = () => {
dispatch(postUserRes({ userId: userSelectedKeys[0], resCode: resCode })).then(res => {
// console.log( userSelectedKeys[0],'当前选中的id')
// checkedList.map(i=>{
// dispatch(postUserRes({ userId: i, resCode: resCode,isShow:isshow })).then(res => {
// if (res.success) {
// dispatch(getUserResource(i))
// }
// })
// dispatch(postUserReso({ userId: i, resCode: resCode,isShow:isshow }))
// })
dispatch(postUserRes({ userId: userSelectedKeys[0], resCode: resCode, isShow: isshow })).then(res => {
if (res.success) {
dispatch(getUserResource(userSelectedKeys[0]))
}
})
dispatch(postUserReso({ userId: userSelectedKeys[0], resCode: resCode, isShow: isshow }))
}
return (
<Spin spinning={loading}>
<Row gutter={16}>
<Col span={4} style={{ height: '100%' }}>
<Card title="部门" bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}>
{
depMessage.length ?
depMessagedata.length ?
<Tree
height={clientHeight - 100}
defaultExpandedKeys={[depMessage[0].id]}
defaultExpandedKeys={[depMessagedata[0].id]}
selectedKeys={depSelectedKeys}
onSelect={(selectedKeys, { selected, selectedNodes, node }) => {
setUserType(selectedNodes[0].type)
setCheckedList(depUser.map(i => i.id))
// setResCode(userResource.map(i=>i.resourceId))
if (selected) {
setCheckedList(depUser.map(i => i.id))
setDepSelectedKeys(selectedKeys)
setDepSelected(selectedNodes[0].name || "")
dispatch(getDepUser(selectedKeys[0]))
// setResCode(userResource.map(i=>i.resourceId))
}
}}
treeData={depMessage}
treeData={depMessagedata}
fieldNames={{
title: 'name',
key: 'id',
@ -76,7 +157,7 @@ const Authority = (props) => {
</Card>
</Col>
<Col span={4} style={{ height: '100%', }}>
<Card title={`[${depSelected}] 用户列表`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}>
<Card title={` 用户列表`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}>
{
depUser.length ?
<Tree
@ -88,6 +169,9 @@ const Authority = (props) => {
setUseName(name)
if (selected) {
// console.log(selectedKeys,'选中的selectedKeys')
// console.log(selectedNodes[0].username || '','node')
// console.log(selectedKeys[0],'请求的值')
setUserSelectedKeys(selectedKeys)
setUserSelected(selectedNodes[0].username || '')
dispatch(getUserResource(selectedKeys[0]))
@ -100,23 +184,50 @@ const Authority = (props) => {
key: 'id'
}}
/> : <Empty />
// <div>
// <Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll} disabled={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}>
// 全选
// </Checkbox>
// <CheckboxGroup options={plainOptions} value={checkedList} onChange={onChange} disabled={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?true:''}/>
// </div> : <Empty />
}
</Card>
</Col>
<Col span={16} style={{ height: '100%', }}>
<Checkbox onChange={onshowchange} checked={isshow} disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0]?.isshow === "true" ? true : ''}>
不可编辑
</Checkbox>
{depUser.length ?
<Card title={`[${useName ? useName : '管理员'}] 功能范围`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}>
<Resource
<Card title={` 功能范围`} bordered={false} bodyStyle={{ padding: 8, paddingTop: 24 }}>
{/* <Resource
userSelected={userSelected}
roleData={resource}
userRole={userResource}
setResCode={setResCode}
userType={userType}
/>
userType={user?.department?.type==="qifu"&&user?.userResources?.filter(i=>i.resourceId==='AUTHORIMANAGE')[0].isShow==="true"?4:userType}
/> */}
<div>
<Checkbox
onChange={onresCheckAllChange}
checked={rescheckAll}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''}
>
全选
</Checkbox>
<CheckboxGroup
options={rescodeall}
value={resCode}
onChange={onresChange}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')[0].isshow === "true" ? true : ''}
/>
</div>
<Row type="flex" justify="center" style={{ marginBottom: 16, marginTop: 16, textAlign: 'center' }}>
<Col span="24">
<Button
disabled={userSelected === "SuperAdmin"||userType===4}
disabled={userSelected === "SuperAdmin" || userType === 4}
onClick={handleSave}
style={{ width: '60%' }}
type='primary'>保存修改</Button>
@ -133,14 +244,15 @@ const Authority = (props) => {
}
function mapStateToProps(state) {
const { userResource, resource, depMessage, depUser, global } = state;
const { userResource, resource, depMessage, depUser, global, auth } = state;
return {
clientHeight: global.clientHeight,
loading: depMessage.isRequesting || depUser.isRequesting || resource.isRequesting,
userResource: userResource.data || [],
resource: resource.data || [],
depMessage: depMessage.data || [],
depUser: depUser.data || []
depUser: depUser.data || [],
user: auth.user
};
}

38
web/client/src/sections/organization/containers/user.js

@ -3,7 +3,8 @@ import { connect } from 'react-redux';
import { DeleteOutlined, EllipsisOutlined, FormOutlined } from '@ant-design/icons';
import { Spin, Space, Button, Popconfirm, Row, Col, Tree, Table, Card, Switch, Tooltip, Breadcrumb } from 'antd';
import ProTable from '@ant-design/pro-table';
import { getDepMessage, getDepUser, createUser, updateUser, delUser, resetPwd, createDep, delDep, updateDep } from '../actions/user';
import { getDepMessage, getDepUser, createUser, updateUser, delUser, resetPwd, createDep, delDep, updateDep } from '../actions/user'
import { postUserRes } from '../actions/authority'
import UserModal from '../components/userModal';
import ResetPwd from '../components/resetPwd';
import DepModal from '../components/depModal';
@ -24,6 +25,19 @@ const UserManage = (props) => {
const [selectedTree, setSelectedTree] = useState();
const [depCrumbs, setDepCrumbs] = useState([]);
const [depUserCopy, setDepUserCopy] = useState([])//用于存放除了自己的管理的数组,即自己不能调整自己是否为管理员
const [uid, setuid] = useState()
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'USERMANAGE')[0].isshow === "true" ? true : '')//控制操作(新增删除等操作,对应权限的'不可编辑')是否可操作
useEffect(() => {
let code = ['USERMANAGE', 'AUTHORIMANAGE']
//console.log('你來u盧克嗎', depUser, uid)
// console.log(depUser.filter(i=>i.phone===uid)[0]?.id,'当前的用户user')
if (depUser?.filter(i => i.phone === uid)[0]?.id) {
//console.log('你來u盧克嗎', depUser, uid)
dispatch(postUserRes({ userId: depUser.filter(i => i.phone === uid)[0]?.id, resCode: code, isShow: false }))
}
}, [uid])
useEffect(() => {
dispatch(getDepMessage())
@ -96,14 +110,15 @@ const UserManage = (props) => {
// >重置密码</Button>
// ]
return [
<Button type="link" onClick={() => { openModal('edit', record) }}>编辑</Button>,
<Button type="link" onClick={() => { openModal('edit', record) }} disabled={editAble}>编辑</Button>,
<Popconfirm
title="确认删除?"
onConfirm={() => {
delUsers([record.id])
}}
disabled={editAble}
>
<Button type="link">删除</Button>
<Button type="link" disabled={editAble}>删除</Button>
</Popconfirm>,
<Button
type="link"
@ -111,6 +126,7 @@ const UserManage = (props) => {
setModalRecord(record);
setPwdModalVisible(true);
}}
disabled={editAble}
>重置密码</Button>
]
},
@ -119,6 +135,7 @@ const UserManage = (props) => {
//弹窗确认
const onConfirm = (values) => {
console.log('values.contract', values.contract)
if (modalType == 'edit') {
dispatch(updateUser(modalRecord.id, values.contract)).then(res => {
if (res.success) {
@ -130,7 +147,9 @@ const UserManage = (props) => {
dispatch(createUser(values.contract)).then(res => {
if (res.success) {
setModalVisible(false);
dispatch(getDepMessage());
dispatch(getDepMessage())
setuid(values.contract.phone)
}
});
}
@ -268,7 +287,9 @@ const UserManage = (props) => {
key="primary"
style={{ marginLeft: 10 }}
onClick={() => openDepModal('create')}
>新建部门</Button>
disabled={editAble}
>
新建部门</Button>
{
depMessage.length ?
@ -344,10 +365,11 @@ const UserManage = (props) => {
key="primary"
style={{ marginRight: 10 }}
onClick={() => openModal('create')}
disabled={editAble}
>新建用户</Button>
{/* <Button style={{ marginRight: 10 }} onClick={() => { dispatch(getDepUser(depSelectedKeys[0])); }}>刷新</Button> */}
<Popconfirm title="确认删除?" onConfirm={() => { delUsers(rowSelected, 'batch') }}>
<Button>批量删除</Button>
<Popconfirm title="确认删除?" onConfirm={() => { delUsers(rowSelected, 'batch') }} disabled={editAble}>
<Button disabled={editAble}>批量删除</Button>
</Popconfirm>
</span>
]}
@ -393,7 +415,7 @@ function mapStateToProps(state) {
loading: depMessage.isRequesting,
depMessage: depMessage.data || [],
depUser: depUser.data || [],
user: auth?.user?.name
user: auth.user
};
}

29
web/client/src/sections/organization/nav-item.js

@ -17,16 +17,23 @@ export function getNavItem(user, dispatch) {
// dispatch(push('/fillion/infor'));
// return null
// }
const isshow = user?.userResources?.filter(i => i.resourceId === 'USERMANAGE' || i.resourceId === 'AUTHORIMANAGE')?.length !== 0
return (
<SubMenu key="organization" icon={<SettingOutlined />} title={'授权管理'}>
{ <Menu.Item key="userManage">
<Link to="/organization/user">用户管理</Link>
</Menu.Item>
}
</SubMenu>
);
user?.username == 'SuperAdmin' || isshow ?
<SubMenu key="organization" icon={<SettingOutlined />} title={'授权管理'}>
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'USERMANAGE')?.length !== 0 ? < Menu.Item key="userManage">
<Link to="/organization/user">用户管理</Link>
</Menu.Item> : ''
}
{user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'AUTHORIMANAGE')?.length !== 0 ? <Menu.Item key="userAuthority">
<Link to="/organization/authority"> 权限管理</Link>
</Menu.Item> : ''}
</SubMenu > : null
)
}

15
web/client/src/sections/organization/routes.js

@ -1,6 +1,6 @@
'use strict';
import { UserManage, Authority,AdminiSter } from './containers';
import { UserManage, AdminiSter } from './containers';
import Authority from './containers/authority';
export default [{
type: 'inner',
route: {
@ -15,6 +15,15 @@ export default [{
menuSelectKeys: ['userManage'],
component: UserManage,
breadcrumb: '用户管理',
}]
},
{
path: '/authority',
key: 'userAuthority',
menuSelectKeys: ['userAuthority'],
component: Authority,
breadcrumb: '权限管理',
}
]
}
}];

4
web/client/src/sections/quanju/containers/heand/index.js

@ -6,14 +6,14 @@ import { Tabs } from 'antd';
const { TabPane } = Tabs;
const Header = (props) => {
const { dispatch, tabChange, tabKey } = props
const { dispatch, tabChange, tabKey, user } = props
// const [tab, setTad] = useState("base")
const onClick = (tab) => {
// setTad({ tab })
tabChange(tab)
}
const dianji = () => {
dispatch(push('/fillion/infor'))
dispatch(push('/noContent'))
}
return (
<div style={{ position: "relative" }}>

0
web/client/src/sections/quanju/containers/noContent/index.js

4
web/client/src/utils/webapi.js

@ -148,7 +148,7 @@ export const ApiTable = {
compileReportRectifyDetail: 'report/rectify/detail',
getReportList: 'report/list',
getReportDetail: 'report/{reportId}/detail',
handleReport:'report/{reportId}/handle',
handleReport: 'report/{reportId}/handle',
getUsers: 'user',
@ -220,6 +220,8 @@ export const ApiTable = {
getResource: 'resource',
getUserResource: 'user/resource',
postUserRes: 'user/resource',
postUserReso: 'user/resources',
//报表配置
allAreas: 'allAreas',

Loading…
Cancel
Save