peng.peng 2 years ago
parent
commit
5c9a3ef2da
  1. 20
      api/app/lib/models/user.js
  2. 2
      script/1.0.3/schema/7.update_user.sql
  3. 3
      weapp/app.json
  4. 28
      weapp/package/troubleshooting/index.js
  5. 16
      weapp/package/troubleshooting/index.wxml
  6. 4
      weapp/package/troubleshooting/index.wxss
  7. 109
      weapp/package/troubleshooting/shootingForm/index.js
  8. 12
      weapp/package/troubleshooting/shootingForm/index.json
  9. 78
      weapp/package/troubleshooting/shootingForm/index.wxml
  10. 26
      weapp/package/troubleshooting/shootingForm/index.wxss
  11. 7
      weapp/project.private.config.json
  12. 25
      web/client/src/sections/organization/components/userModal.js
  13. 2
      web/client/src/sections/organization/containers/user.js
  14. 12
      web/client/src/sections/organization/nav-item.js
  15. 20
      web/client/src/sections/patrolManage/nav-item.js
  16. 12
      web/client/src/sections/projectRegime/nav-item.js
  17. 4
      web/client/src/utils/func.js

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

@ -96,21 +96,21 @@ module.exports = dc => {
field: "post",
autoIncrement: false
},
// structure: {
// type: DataTypes.STRING,
// allowNull: true,
// defaultValue: null,
// comment: "结构物",
// primaryKey: false,
// field: "structure",
// autoIncrement: false
// }
structure: {
type: DataTypes.JSON,
allowNull: true,
defaultValue: null,
comment: "结构物",
primaryKey: false,
field: "structure",
autoIncrement: false
}
}, {
tableName: "user",
comment: "",
indexes: []
});
dc.models.User = User;
return User;
};

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

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

3
weapp/app.json

@ -14,7 +14,8 @@
"basic/basic",
"startInspection/startInspection",
"inspectionInput/inspectionInput",
"troubleshooting/index"
"troubleshooting/index",
"troubleshooting/shootingForm/index"
]
}
],

28
weapp/package/troubleshooting/index.js

@ -12,7 +12,9 @@ Page({
structResult: ['a', 'b'],
pointList: ['a', 'b', 'c'],
pointResult: ['a', 'b'],
// 时间筛选
startTime: '',
endTime: ''
},
// 顶部tab切换
@ -58,6 +60,30 @@ Page({
},
noop () { },
// 时间选择
onStartTimeChange (event) {
this.setData({
startTime: event.detail,
});
},
onEndTimeChange (event) {
this.setData({
endTime: event.detail,
});
},
search () {
console.log(this.data);
},
// 页面跳转
toShootingForm (e) {
console.log(e);
const { shootingid } = e.currentTarget.dataset
wx.navigateTo({
url: '/package/troubleshooting/shootingForm/index?shootingid=' + shootingid,
})
},
/**
* 生命周期函数--监听页面加载

16
weapp/package/troubleshooting/index.wxml

@ -11,7 +11,7 @@
</view>
<view>
<van-dropdown-menu>
<van-dropdown-item title="{{ '结构物' }}">
<van-dropdown-item title="{{ '结构物' }}" bind:close="search">
<view style="max-height:60%">
<van-checkbox-group value="{{ structResult }}" bind:change="onStructChange">
<van-cell-group>
@ -22,7 +22,7 @@
</van-checkbox-group>
</view>
</van-dropdown-item>
<van-dropdown-item title="{{ '点位' }}">
<van-dropdown-item title="{{ '点位' }}" bind:close="search">
<view style="max-height:60%">
<van-checkbox-group value="{{ pointResult }}" bind:change="onPointChange">
<van-cell-group>
@ -33,9 +33,11 @@
</van-checkbox-group>
</view>
</van-dropdown-item>
<van-dropdown-item title="{{ '时间' }}">
<view style="max-height:60%">
<van-datetime-picker type="datetime" show-toolbar="{{false}}" type="date" value="{{ currentDate }}" bind:input="onInput"/>
<van-dropdown-item title="{{ '时间' }}" bind:close="search">
<view style="max-height:60%; display:flex" class="time-option">
<van-datetime-picker type="datetime" show-toolbar="{{false}}" type="date" value="{{ startTime }}" bind:input="onStartTimeChange" />
<view style="display:flex; align-items:center">至</view>
<van-datetime-picker type="datetime" show-toolbar="{{false}}" type="date" value="{{ endTime }}" bind:input="onEndTimeChange" />
</view>
</van-dropdown-item>
</van-dropdown-menu>
@ -44,7 +46,9 @@
<van-cell-group inset class="mission-card">
<view class="mission-card-title">
<span>asd</span>
<van-button type="info" round bind:tap="pickerShow">按钮</van-button>
<van-button type="info" round bind:tap="toShootingForm" data-shootingid="{{5}}">
按钮
</van-button>
</view>
<van-field value="输入框已禁用" label="点位名称" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="异常等级" readonly border="{{ false }}" />

4
weapp/package/troubleshooting/index.wxss

@ -54,4 +54,8 @@
.value-class {
flex: none !important;
}
.time-option .van-picker{
width: 45vw;
}

109
weapp/package/troubleshooting/shootingForm/index.js

@ -0,0 +1,109 @@
// package/troubleshooting/shootingForm/index.js
Page({
/**
* 页面的初始数据
*/
data: {
shootingid: '',
maintenancePersonId: null,
maintenanceRequirement: '',
planStartTimePopupShow: false,
planStartTime: '',
planEndTimePopupShow: false,
planEndTime: '',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
const { shootingid } = options
if (shootingid) {
this.setData({
shootingid
})
} else {
}
},
onMaintenancePersonPopupChange (e) {
this.setData({
multiIndex: e.detail.value
})
},
showPlanStartTimePopup () {
this.setData({ planStartTimePopupShow: true })
},
closePlanStartTimePopup () {
this.setData({ planStartTimePopupShow: false })
},
onPlanStartTimeChange (event) {
this.setData({ planStartTime: event.detail, })
},
showPlanEndTimePopup () {
this.setData({ planEndTimePopupShow: true })
},
closePlanEndTimePopup () {
this.setData({ planEndTimePopupShow: false })
},
onPlanEndTimeChange (event) {
this.setData({ planEndTime: event.detail, })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage () {
}
})

12
weapp/package/troubleshooting/shootingForm/index.json

@ -0,0 +1,12 @@
{
"usingComponents": {
"van-button": "@vant/weapp/button/index",
"van-field": "@vant/weapp/field/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index",
"van-picker": "@vant/weapp/picker/index",
"van-popup": "@vant/weapp/popup/index",
"van-icon": "@vant/weapp/icon/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index"
}
}

78
weapp/package/troubleshooting/shootingForm/index.wxml

@ -0,0 +1,78 @@
<view style="background:#F7F7FA; min-height:calc(100vh - 48rpx); padding:24rpx 0">
<van-cell-group inset class="mission-card">
<view class="mission-card-title">
<span>巡检信息</span>
</view>
<van-field value="输入框已禁用" label="结构物名称" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="巡检人" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="巡检单位" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="巡检时间" readonly border="{{ false }}" />
<view class="mission-card-title mission-center-card-title">
<span>问题详情</span>
</view>
<van-field value="输入框已禁用" label="点位名称" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="检查项" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="异常等级" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="问题描述" readonly border="{{ false }}" />
<van-cell border="{{false}}">
<view style="display:flex">
<view class="fs-cell-title" style="">现场照片</view>
<view class="fs-cell-content" style="">
123
<!-- <image class='weui-uploader__img showImg' src="{{imgUrl + item}}" data-img="{{imgUrl + item}}" data-index="{{index}}" data-key="{{key}}" mode="aspectFill" bindtap="previewImg"></image> -->
</view>
</view>
</van-cell>
<view class="mission-card-title mission-center-card-title">
<span>维修计划信息</span>
</view>
<van-cell>
<view style="display:flex">
<view class="fs-cell-title" style="">维修人</view>
<picker style="width:100%;text-align:left" bindchange="onMaintenancePersonPopupChange" value="{{0}}" range="{{['array']}}">
<view class="fs-cell-content" style="width:100%">
当前选择
<van-icon name="arrow" style="float:right;position:relative; top:4px" />
</view>
</picker>
</view>
</van-cell>
<van-field value="xxxx" label="维修单位" placeholder="请填写" readonly="{{0}}" border="{{ true }}" />
<van-cell>
<view style="display:flex">
<view class="fs-cell-title" style="">质检人</view>
<picker style="width:100%;text-align:left" bindchange="onMaintenancePersonPopupChange" value="{{0}}" range="{{['array']}}">
<view class="fs-cell-content" style="width:100%">
当前选择
<van-icon name="arrow" style="float:right;position:relative; top:4px" />
</view>
</picker>
</view>
</van-cell>
<van-cell>
<view style="display:flex">
<view class="fs-cell-title" style="">计划开始时间</view>
<view class="fs-cell-content" style="width:100%;text-align:left" bindtap="showPlanStartTimePopup">
当前选择
<van-icon name="arrow" style="float:right;position:relative; top:4px" />
</view>
<van-popup show="{{ planStartTimePopupShow }}" position="bottom" custom-style="height: 50%;" bind:close="closePlanStartTimePopup">
<van-datetime-picker value="{{ planStartTime }}" bind:input="onInput" show-toolbar="{{false}}" />
</van-popup>
</view>
</van-cell>
<van-cell>
<view style="display:flex">
<view class="fs-cell-title" style="">计划结束时间</view>
<view class="fs-cell-content" style="width:100%;text-align:left" bindtap="showPlanStartTimePopup">
当前选择
<van-icon name="arrow" style="float:right;position:relative; top:4px" />
</view>
<van-popup show="{{ planStartTimePopupShow }}" position="bottom" custom-style="height: 50%;" bind:close="closePlanStartTimePopup">
<van-datetime-picker value="{{ planStartTime }}" bind:input="onInput" show-toolbar="{{false}}" />
</van-popup>
</view>
</van-cell>
<van-field value="{{ maintenanceRequirement }}" label="维修要求" type="textarea" placeholder="请输入" autosize border="{{ true }}" />
</van-cell-group>
</view>

26
weapp/package/troubleshooting/shootingForm/index.wxss

@ -0,0 +1,26 @@
/* package/troubleshooting/shootingForm/index.wxss */
.mission-card-title {
background-color: #fff;
overflow: auto;
padding: 24rpx 16px;
display: flex;
justify-content: space-between;
align-items: center
}
.mission-center-card-title {
padding-top: 64rpx;
}
.fs-cell-title {
max-width: 6.2em;
min-width: 6.2em;
margin-right: 12px;
text-align: left;
color: var(--field-label-color, #646566)
}
.fs-cell-content {
color: var(--field-input-text-color, #323233)
}

7
weapp/project.private.config.json

@ -14,6 +14,13 @@
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "事件处理详情",
"pathName": "package/troubleshooting/shootingForm/index",
"query": "shootingid=5",
"launchMode": "default",
"scene": null
}
]
}

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

@ -1,7 +1,7 @@
import React from 'react';
import { connect } from 'react-redux';
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 ,ProFormSelect} from '@ant-design/pro-form';
const UserModal = (props) => {
const { visible, modalType, depData, onVisibleChange, onConfirm, editData ,tableList} = props
@ -105,10 +105,11 @@ const UserModal = (props) => {
/>
</ProForm.Group>
<ProForm.Group>
<ProFormTreeSelect
{/* <ProFormTreeSelect
name={['contract', 'structure']}
placeholder="请选择结构物"
width="md"
mode="multiple"
label="关注结构物"
required
// fieldNames={{
@ -120,6 +121,7 @@ const UserModal = (props) => {
}}
fieldProps={{
mode: 'multiple',
fieldNames: {
label: 'title',
},
@ -132,7 +134,24 @@ const UserModal = (props) => {
return opts
}}
expandedKeys={["title"]}
/>
/> */}
<ProFormSelect
width="md"
label="关注结构物"
name={['contract', 'structure']}
mode="multiple"
// fieldProps={{//这里使用了select的onChange方法,必须使用这样的写法来进行调用onChange方法
// onChange:(val) => handleChange(val),
// }}
request={async () => {
console.log(tableList);
const opts = tableList?.map(i=>({label:i.name,value:i.id}))
return opts
}}
placeholder="请选择结构物"
rules={[{ required: true, message: '结构物不能为空' }]}
/>
<ProFormText
name={['contract', 'email']}
width="md"

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

@ -315,7 +315,7 @@ console.log(tableList,'tableList')
onVisibleChange={setModalVisible}
modalType={modalType}
onConfirm={onConfirm}
editData={modalRecord}
editData={{...modalRecord,structure:modalRecord?.structure||[]}}
tableList={tableList}
/>
: ''

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

@ -2,7 +2,7 @@ import React from 'react';
import { Link } from 'react-router-dom';
import { Menu } from 'antd';
import { SettingOutlined } from '@ant-design/icons';
import { Func } from '$utils';
const SubMenu = Menu.SubMenu;
export function getNavItem(user, dispatch) {
@ -10,13 +10,13 @@ export function getNavItem(user, dispatch) {
// return null
// }
return (
<SubMenu key="organization" icon={<SettingOutlined />} title={'组织管理'}>
<Menu.Item key="userManage">
Func.isAuthorized('ORG_MANAGE') && <SubMenu key="organization" icon={<SettingOutlined />} title={'组织管理'}>
{Func.isAuthorized('USER_CONFIG') && <Menu.Item key="userManage">
<Link to="/organization/user">部门成员</Link>
</Menu.Item>
<Menu.Item key="authority">
</Menu.Item>}
{Func.isAuthorized('AUTH_CONFIG') && <Menu.Item key="authority">
<Link to="/organization/authority">权限配置</Link>
</Menu.Item>
</Menu.Item>}
</SubMenu>
);
}

20
web/client/src/sections/patrolManage/nav-item.js

@ -2,7 +2,7 @@ import React from 'react';
import { Link } from 'react-router-dom';
import { Menu } from 'antd';
import { SettingOutlined } from '@ant-design/icons';
import { Func } from '$utils';
const SubMenu = Menu.SubMenu;
export function getNavItem (user, dispatch) {
@ -10,19 +10,19 @@ export function getNavItem (user, dispatch) {
// return null
// }
return (
<SubMenu key="patrolManage" icon={<SettingOutlined />} title={'巡检管理'}>
<Menu.Item key="patrolPlan">
Func.isAuthorized('PATROL_MANAGE') && <SubMenu key="patrolManage" icon={<SettingOutlined />} title={'巡检管理'}>
{Func.isAuthorized('PATROL_PLAN_CONFIG') && <Menu.Item key="patrolPlan">
<Link to="/patrolManage/patrolPlan">巡检计划制定</Link>
</Menu.Item>
<Menu.Item key="patrolRecord">
</Menu.Item>}
{Func.isAuthorized('PATROL_RECORD_VIEW') && <Menu.Item key="patrolRecord">
<Link to="/patrolManage/patrolRecord">巡检记录</Link>
</Menu.Item>
<Menu.Item key="checkItems">
</Menu.Item>}
{Func.isAuthorized('CHECKITEMSET') && <Menu.Item key="checkItems">
<Link to="/patrolManage/checkItems">检查项设定</Link>
</Menu.Item>
<Menu.Item key="patrolTemplate">
</Menu.Item>}
{Func.isAuthorized('CHECKMOULD') && <Menu.Item key="patrolTemplate">
<Link to="/patrolManage/patrolTemplate">巡检模板</Link>
</Menu.Item>
</Menu.Item>}
</SubMenu>
);
}

12
web/client/src/sections/projectRegime/nav-item.js

@ -2,17 +2,17 @@ import React from 'react';
import { Link } from 'react-router-dom';
import { Menu } from 'antd';
import { SettingOutlined } from '@ant-design/icons';
import { Func } from '$utils';
const SubMenu = Menu.SubMenu;
export function getNavItem (user, dispatch) {
return <SubMenu key="projectRegime" icon={<SettingOutlined />} title={'结构物管理'}>
<Menu.Item key="information">
return Func.isAuthorized('STRUCTURE_MANAGE') && <SubMenu key="projectRegime" icon={<SettingOutlined />} title={'结构物管理'}>
{Func.isAuthorized('STRU_INFO_CONFIG') &&<Menu.Item key="information">
<Link to="/projectRegime/information">结构物基础信息管理</Link>
</Menu.Item>
<Menu.Item key="qrCode">
</Menu.Item>}
{Func.isAuthorized('QR_CODE_CONFIG') &&<Menu.Item key="qrCode">
<Link to="/projectRegime/qrCode">二维码管理</Link>
</Menu.Item>
</Menu.Item>}
</SubMenu>
}

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

@ -3,8 +3,8 @@
export default class Func {
static isAuthorized(authcode) {
if (JSON.parse(sessionStorage.getItem('user'))) {
const { resources } = JSON.parse(sessionStorage.getItem('user'));
return resources.includes(authcode);
const { userResources } = JSON.parse(sessionStorage.getItem('user'));
return userResources.includes(authcode);
}else{
return false;
}

Loading…
Cancel
Save