peng.peng 2 years ago
parent
commit
d642fffa6d
  1. 2
      api/app/lib/controllers/organization/user.js
  2. 9
      api/app/lib/models/user.js
  3. 3
      script/1.0.3/schema/5.update_resource.sql
  4. 4
      script/1.0.3/schema/6.update_user_resource.sql
  5. 1
      script/1.0.3/schema/7.update_user.sql
  6. 72
      weapp/app.js
  7. 29
      weapp/app.json
  8. 66
      weapp/package/troubleshooting/index.js
  9. 3
      weapp/package/troubleshooting/index.json
  10. 2
      weapp/package/troubleshooting/index.wxml
  11. 1
      weapp/package/troubleshooting/index.wxss
  12. 6
      weapp/pages/overview/overview.js
  13. 32
      weapp/pages/overview/overview.wxml
  14. 2
      weapp/project.config.json
  15. 6
      weapp/project.private.config.json
  16. 36
      web/client/src/sections/organization/components/userModal.js
  17. 24
      web/client/src/sections/organization/containers/user.js

2
api/app/lib/controllers/organization/user.js

@ -235,6 +235,7 @@ async function creatUser(ctx, next) {
delete: false, delete: false,
phone: data.phone, phone: data.phone,
post: data.post, post: data.post,
structure:data.structure
}) })
ctx.status = 204; ctx.status = 204;
@ -275,6 +276,7 @@ async function updateUser(ctx, next) {
delete: false, delete: false,
phone: data.phone, phone: data.phone,
post: data.post, post: data.post,
structure:data.structure
}, { }, {
where: { where: {
id: id id: id

9
api/app/lib/models/user.js

@ -95,6 +95,15 @@ module.exports = dc => {
primaryKey: false, primaryKey: false,
field: "post", field: "post",
autoIncrement: false autoIncrement: false
},
structure: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "结构物",
primaryKey: false,
field: "structure",
autoIncrement: false
} }
}, { }, {
tableName: "user", tableName: "user",

3
script/1.0.3/schema/5.update_resource.sql

@ -0,0 +1,3 @@
UPDATE resource set name = '结构物基础信息管理' WHERE code = 'STRU_INFO_CONFIG';
INSERT INTO public.resource (code, name, parent_resource) VALUES ('CHECKITEMSET', '检查项设定', 'PATROL_MANAGE');
INSERT INTO public.resource (code, name, parent_resource) VALUES ('CHECKMOULD', '巡检模板', 'PATROL_MANAGE');

4
script/1.0.3/schema/6.update_user_resource.sql

@ -0,0 +1,4 @@
DELETE FROM public.user_resource WHERE id = 12;
DELETE FROM public.user_resource WHERE id = 13;
INSERT INTO public.user_resource (id,user_id,resource) VALUES (12, 1, 'CHECKITEMSET');
INSERT INTO public.user_resource (id,user_id,resource) VALUES (13, 1, 'CHECKMOULD');

1
script/1.0.3/schema/7.update_user.sql

@ -0,0 +1 @@
ALTER TABLE "user" ADD structure VARCHAR(40);

72
weapp/app.js

@ -1,40 +1,40 @@
// app.js // app.js
App({ App({
onLaunch() { }, onLaunch () { },
globalData: { globalData: {
userInfo: null, userInfo: null,
baseUrl: 'http://10.8.16.221:4900', //api 本地环境 baseUrl: 'http://10.8.30.112:4900', //api 本地环境
webUrl: "http://10.8.16.221:5900/", //web 本地环境 webUrl: "http://10.8.30.112:5900/", //web 本地环境
imgUrl: 'http://10.8.16.221:5900/_file-server/', //文件 本地环境 imgUrl: 'http://10.8.30.112:5900/_file-server/', //文件 本地环境
key: 'ODQBZ-3FZAU-6VIVL-2XXNM-F7CP7-WVFCY' //获取位置信息 key: 'ODQBZ-3FZAU-6VIVL-2XXNM-F7CP7-WVFCY' //获取位置信息
}, },
onShow(e) { onShow (e) {
// 检查是否有更新 // 检查是否有更新
const updateManager = wx.getUpdateManager(); const updateManager = wx.getUpdateManager();
updateManager.onCheckForUpdate(function (res) { updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调 // 请求完新版本信息的回调
console.log(res.hasUpdate); console.log(res.hasUpdate);
}); });
updateManager.onUpdateReady(function () { updateManager.onUpdateReady(function () {
wx.showModal({ wx.showModal({
title: "更新提示", title: "更新提示",
content: "新版本已经准备好,是否重启应用?", content: "新版本已经准备好,是否重启应用?",
success(res) { success (res) {
if (res.confirm) { if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate(); updateManager.applyUpdate();
} }
} }
}); });
}); });
updateManager.onUpdateFailed(function () { updateManager.onUpdateFailed(function () {
// 新版本下载失败 // 新版本下载失败
wx.showToast({ wx.showToast({
title: "新版本下载失败", title: "新版本下载失败",
icon: "none", icon: "none",
duration: 1000 duration: 1000
}); });
}); });
} }
}) })

29
weapp/app.json

@ -5,16 +5,19 @@
"pages/myInfo/myInfo", "pages/myInfo/myInfo",
"pages/overview/overview" "pages/overview/overview"
], ],
"subPackages": [{ "subPackages": [
"root": "package", {
"pages": [ "root": "package",
"polling/polling", "pages": [
"polling/inspectionRecordDetail/inspectionRecordDetail", "polling/polling",
"basic/basic", "polling/inspectionRecordDetail/inspectionRecordDetail",
"startInspection/startInspection", "basic/basic",
"inspectionInput/inspectionInput" "startInspection/startInspection",
] "inspectionInput/inspectionInput",
}], "troubleshooting/index"
]
}
],
"window": { "window": {
"backgroundTextStyle": "dark", "backgroundTextStyle": "dark",
"navigationBarBackgroundColor": "#1979ff", "navigationBarBackgroundColor": "#1979ff",
@ -25,12 +28,14 @@
"selectedColor": "#2F54FF", "selectedColor": "#2F54FF",
"borderStyle": "black", "borderStyle": "black",
"backgroundColor": "#ffffff", "backgroundColor": "#ffffff",
"list": [{ "list": [
{
"pagePath": "pages/index/index", "pagePath": "pages/index/index",
"iconPath": "images/tabBar/icon_polling.png", "iconPath": "images/tabBar/icon_polling.png",
"selectedIconPath": "images/tabBar/icon_polling_active.png", "selectedIconPath": "images/tabBar/icon_polling_active.png",
"text": "巡检总览" "text": "巡检总览"
}, { },
{
"pagePath": "pages/overview/overview", "pagePath": "pages/overview/overview",
"iconPath": "images/tabBar/icon_menu.png", "iconPath": "images/tabBar/icon_menu.png",
"selectedIconPath": "images/tabBar/icon_menu_active.png", "selectedIconPath": "images/tabBar/icon_menu_active.png",

66
weapp/package/troubleshooting/index.js

@ -0,0 +1,66 @@
// package/bindTroubleshooting/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

3
weapp/package/troubleshooting/index.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

2
weapp/package/troubleshooting/index.wxml

@ -0,0 +1,2 @@
<!--package/bindTroubleshooting/index.wxml-->
<text>package/bindTroubleshooting/index.wxml</text>

1
weapp/package/troubleshooting/index.wxss

@ -0,0 +1 @@
/* package/bindTroubleshooting/index.wxss */

6
weapp/pages/overview/overview.js

@ -15,6 +15,12 @@ Page({
}) })
}, },
bindTroubleshooting() {
wx.navigateTo({
url: '/package/troubleshooting/index',
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */

32
weapp/pages/overview/overview.wxml

@ -1,18 +1,18 @@
<!--pages/overview/overview.wxml--> <!-- pages/overview/overview.wxml -->
<view style="margin-top: 42rpx;"> <view style="margin-top: 42rpx;">
<view class="box" bindtap="bindPolling"> <view class="box" bindtap="bindPolling">
<image class="logo" src="/images/xunjian.svg"></image> <image class="logo" src="/images/xunjian.svg"></image>
<view class="txt">巡检</view> <view class="txt">巡检</view>
<image class="right" src="/images/right.svg"></image> <image class="right" src="/images/right.svg"></image>
</view> </view>
<!-- <view class="box"> <view class="box" bindtap="bindTroubleshooting">
<image class="logo" src="/images/tabBar/icon_menu.png"></image> <image class="logo" src="/images/tabBar/icon_menu.png"></image>
<view class="txt">问题处理</view> <view class="txt">问题处理</view>
<image class="right" src="/images/right.svg"></image> <image class="right" src="/images/right.svg"></image>
</view> </view>
<view class="box"> <!-- <view class="box">
<image class="logo" src="/images/tabBar/icon_menu.png"></image> <image class="logo" src="/images/tabBar/icon_menu.png"></image>
<view class="txt">巡检报告</view> <view class="txt">巡检报告</view>
<image class="right" src="/images/right.svg"></image> <image class="right" src="/images/right.svg"></image>
</view> --> </view> -->
</view> </view>

2
weapp/project.config.json

@ -41,7 +41,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.19.4", "libVersion": "2.19.4",
"appid": "wxdd82ae635b22ccdb", "appid": "wx79ff58f03d17f24d",
"projectname": "miniprogram-92", "projectname": "miniprogram-92",
"condition": {}, "condition": {},
"editorSetting": { "editorSetting": {

6
weapp/project.private.config.json

@ -1,6 +1,8 @@
{ {
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"setting": { "setting": {
"urlCheck": false "urlCheck": false,
} "compileHotReLoad": true
},
"projectname": "%E8%BF%90%E7%BB%B4%E5%B7%A1%E6%A3%80"
} }

36
web/client/src/sections/organization/components/userModal.js

@ -4,7 +4,7 @@ import { Spin, Card, Modal, TreeSelect, message } from 'antd';
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form'; import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form';
const UserModal = (props) => { const UserModal = (props) => {
const { visible, modalType, depData, onVisibleChange, onConfirm, editData } = props const { visible, modalType, depData, onVisibleChange, onConfirm, editData ,tableList} = props
const reg_tel = /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/; const reg_tel = /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/;
const onFinish = (values) => { const onFinish = (values) => {
if (onConfirm) { if (onConfirm) {
@ -105,7 +105,35 @@ const UserModal = (props) => {
/> />
</ProForm.Group> </ProForm.Group>
<ProForm.Group> <ProForm.Group>
<ProFormText <ProFormTreeSelect
name={['contract', 'structure']}
placeholder="请选择结构物"
width="md"
label="关注结构物"
required
// fieldNames={{
// title: 'name',
// key: 'id',
// children: 'subordinate'
// }}
onSelect={(selectedKeys, { selected, selectedNodes }) => {
}}
fieldProps={{
fieldNames: {
label: 'title',
},
treeDefaultExpandAll: false,
}}
rules={[{ required: true, message: '请选择结构物' }]}
request={async () => {
console.log(tableList);
const opts = tableList?.map(i=>({title:i.name,value:i.id}))
return opts
}}
expandedKeys={["title"]}
/>
<ProFormText
name={['contract', 'email']} name={['contract', 'email']}
width="md" width="md"
label="邮箱" label="邮箱"
@ -116,6 +144,9 @@ const UserModal = (props) => {
{ type: 'email', message: '请输入正确格式的邮箱' }, { type: 'email', message: '请输入正确格式的邮箱' },
]} ]}
/> />
</ProForm.Group>
<ProForm.Group>
{modalType == 'edit' ? null : <ProFormText.Password {modalType == 'edit' ? null : <ProFormText.Password
name={['contract', 'password']} name={['contract', 'password']}
width="md" width="md"
@ -131,6 +162,7 @@ const UserModal = (props) => {
]} ]}
/>} />}
</ProForm.Group> </ProForm.Group>
<ProForm.Group> <ProForm.Group>
<ProFormSwitch <ProFormSwitch
name={['contract', 'enable']} name={['contract', 'enable']}

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

@ -12,13 +12,13 @@ const TreeNode = Tree.TreeNode;
const UserManage = (props) => { const UserManage = (props) => {
const user = JSON.parse(sessionStorage.getItem('user')); const user = JSON.parse(sessionStorage.getItem('user'));
const [tableList, settableList] = useState([])
const { dispatch, loading, depMessage, depUser, clientHeight } = props; const { dispatch, loading, depMessage, depUser, clientHeight,actions } = props;
// 部门 // 部门
const [deptModalVisible, setDeptModalVisible] = useState(false); const [deptModalVisible, setDeptModalVisible] = useState(false);
const [deptModalType, setDeptModalType] = useState(); const [deptModalType, setDeptModalType] = useState();
const [deptModalRecord, setDeptModalRecord] = useState(); const [deptModalRecord, setDeptModalRecord] = useState();
const { projectRegime } = actions
// 成员 // 成员
const [modalVisible, setModalVisible] = useState(false); const [modalVisible, setModalVisible] = useState(false);
const [modalType, setModalType] = useState(); const [modalType, setModalType] = useState();
@ -29,8 +29,20 @@ const UserManage = (props) => {
useEffect(() => { useEffect(() => {
dispatch(getDepMessage()) dispatch(getDepMessage())
projectList()
}, []) }, [])
const projectList = (obj) => {
dispatch(projectRegime.getProjectList()).then(res => {
// console.log(res)
if (res.success) {
settableList(res.payload.data?.rows)
// setLimits(res.payload.data?.count)
}
})
}
useEffect(() => { useEffect(() => {
if (depMessage.length) { if (depMessage.length) {
setDepSelectedKeys([depMessage[0].id]) setDepSelectedKeys([depMessage[0].id])
@ -197,7 +209,7 @@ const UserManage = (props) => {
</div> </div>
</div> </div>
} }
console.log(tableList,'tableList')
return (<div > return (<div >
<Spin spinning={loading} /* style={{ height: "calc(100vh - 70px)" }} */> <Spin spinning={loading} /* style={{ height: "calc(100vh - 70px)" }} */>
<Row gutter={16} /* style={{ overflow: "scroll" }} */> <Row gutter={16} /* style={{ overflow: "scroll" }} */>
@ -304,6 +316,7 @@ const UserManage = (props) => {
modalType={modalType} modalType={modalType}
onConfirm={onConfirm} onConfirm={onConfirm}
editData={modalRecord} editData={modalRecord}
tableList={tableList}
/> />
: '' : ''
} }
@ -325,7 +338,8 @@ function mapStateToProps(state) {
clientHeight: global.clientHeight, clientHeight: global.clientHeight,
loading: depMessage.isRequesting, loading: depMessage.isRequesting,
depMessage: depMessage.data || [], depMessage: depMessage.data || [],
depUser: depUser.data || [] depUser: depUser.data || [],
actions: global.actions
}; };
} }

Loading…
Cancel
Save