Commit 1a6ffe75 by huangqy

提交全部

parents
# dependencies
**/node_modules
.idea
.DS_Store
# misc
npm-debug.log*
yarn-error.log
yarn.lock
package-lock.json
*bak
# visual studio code
.vscode
.history
*.log
functions/*
.temp/**
.eslintcache
.page-container {
background-color: #f5f5f5;
}
.page-submit {
position: fixed;
bottom: 10rpx;
width: 100%;
}
.submit-btn {
width: 90%;
margin: auto;
border-radius: 20rpx;
}
App({
// 全局变量,获取方法getApp().globalData
globalData: {
// 域名,用于发送请求
host: 'http://122.112.148.157:5001',
service: 'http://122.112.148.157:5000',
userInfo : {}
},
onLaunch(options) {
},
onShow(options) {
},
});
{
"pages": [
"pages/index/index",
"pages/dashboard/dashboard",
"pages/my/my",
"pages/applyBorrowCar/applyBorrowCar",
"pages/orderList/orderList",
"pages/keyList/keyList",
"pages/orderDetail/orderDetail",
"pages/carUseLog/carUseLog",
"pages/sysUser/sysUser",
"pages/sysCar/sysCar",
"pages/addCar/addCar",
"pages/sysSetting/sysSetting",
"pages/carTj/carTj"
],
"window": {
"defaultTitle": "智能车辆钥匙管理小程序",
"titleBarColor": "#2074D4",
"allowsBounceVertical": "YES",
"pullRefresh": true
}
}
\ No newline at end of file
{
"component2": true
}
\ No newline at end of file
{
"dependencies": {
"antd-mini": "^0.0.8",
"gdt-jsapi": "^1.9.33",
"mini-ali-ui": "^1.4.1"
}
}
<view>
<form onSubmit="handleSubmit" onReset="onReset">
<input-item data-field="carType" placeholder="请输入" value="{{carType}}" layer="vertical" name="carType" clear="{{true}}" onClear="onClear">汽车品牌</input-item>
<input-item data-field="carNumber" placeholder="请输入" value="{{carNumber}}" layer="vertical" name="carNumber" clear="{{true}}" onClear="onClear">汽车车牌</input-item>
<view class="page-submit">
<button type="primary" formType="submit" class="submit-btn">提交</button>
</view>
</form>
</view>
import http from '../../src/http';
import util from '../../src/libs/util';
Page({
data: {
id: ''
},
onLoad(query) {
if (query.id) {
this.setData({
id: query.id,
carNumber: query.carNumber,
carType: query.carType
})
}
},
onClear(e) {
this.setData({
[e.target.dataset.field]: ''
});
},
handleSubmit(e) {
let formData = {}
formData = e.detail.value
formData.id = this.data.id
formData.tenant_id = getApp().globalData.tenantId
formData.create_by = getApp().globalData.userInfo.realname
http.post(getApp().globalData.service + '/api/T_Equipment/AddOrUpdateEquipment', formData).then(res => {
if(res.Success) {
dd.redirectTo({
url: '../sysCar/sysCar'
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
});
{
"defaultTitle": "车辆操作",
"usingComponents": {
"input-item": "mini-ali-ui/es/input-item/index",
"picker-item": "mini-ali-ui/es/picker-item/index",
"multi-liner": "mini-ali-ui/es/multi-liner/index"
},
"allowsBounceVertical": "NO"
}
<view>
<form onSubmit="handleSubmit" onReset="onReset">
<input-item data-field="borrow_code" value="{{borrow_code}}" layer="vertical" name="borrow_code" disabled='true'>用车单号</input-item>
<input-item data-field="name" value="{{name}}" layer="vertical" name="name" disabled='true'>申请人</input-item>
<input-item data-field="destination" placeholder="请输入" value="{{destination}}" layer="vertical" name="destination" clear="{{true}}" onClear="onClear">目的地</input-item>
<picker-item data-field="start_time" placeholder="请选择" value="{{start_time}}" layer="vertical" name="start_time" onPickerTap="dateStartPicker">开始用车时间</picker-item>
<picker-item
data-field="end_time"
placeholder="请选择"
value="{{end_time}}"
layer="vertical"
name="end_time"
onPickerTap="dateEndPicker">预计返回时间</picker-item>
<picker-item
data-field="reason"
placeholder="请选择"
value="{{reason}}"
layer="vertical"
name="reason"
onPickerTap="reasonPickerChange">工作内容</picker-item>
<picker-item
data-field="changeCar"
placeholder="请选择"
value="{{changeCar}}"
layer="vertical"
name="changeCar"
onPickerTap="carPickerChange">车辆</picker-item>
<multi-liner
data-field="bz"
placeholder="备注"
value="{{bz}}"
onInput="onBzInput"
name="bz"
controlled="{{true}}"
last="{{true}}"
auto-height="{{true}}"></multi-liner>
<view class="page-submit">
<button type="primary" formType="submit" class="submit-btn">提交</button>
</view>
</form>
</view>
import http from '../../src/http';
import util from '../../src/libs/util';
Page({
data: {
borrow_code : '',
name: '',
destination: '',
start_time : '',
end_time : '',
reason: '',
bz: '',
carList: [],
carNumberList: [],
equipment_id: '',
reasons: ['侦查、办案、警卫等执法执勤工作', '执法执纪检查和调研', '警务督察、警务工作明察暗访', '处置涉警信访、舆情', '大型活动安保、突发事件处置等工作', '其他']
},
onLoad() {
this.getBorrowCode()
},
getBorrowCode(){
http.get('/jeecg/sys/fillRule/testFillRule', {ruleCode: 'shop_order_num'}).then(res => {
if (res.success) {
this.setData({
borrow_code : res.result,
name : getApp().globalData.userInfo.realname,
});
this.getCarList()
} else {
util.ddToast({ type: 'fail', text: res.msg })
}
})
},
getCarList() {
const _this = this
http.post(getApp().globalData.service + "/api/T_Equipment/CarList", {tenant_id: getApp().globalData.tenantId}).then(res => {
if (res.Success) {
_this.setData({
carNumberList: res.result.filter(i => i.state === '正常').map(j => {return j.carNumber+"("+ j.carType +")"}),
carList: res.result.filter(i => i.state === '正常')
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
onClear(e) {
this.setData({
[e.target.dataset.field]: ''
});
},
dateStartPicker() {
my.datePicker({
format: 'yyyy-MM-dd HH:mm',
success: (res) => {
this.setData({
start_time: res.date
})
}
})
},
dateEndPicker() {
my.datePicker({
format: 'yyyy-MM-dd HH:mm',
success: (res) => {
this.setData({
end_time: res.date
})
}
})
},
reasonPickerChange() {
my.showActionSheet({
title: '选择工作内容',
items: this.data.reasons,
cancelButtonText: '取消',
success: (res) => {
this.setData({
reason: this.data.reasons[res.index]
});
},
});
},
carPickerChange() {
my.showActionSheet({
title: '选择车辆',
items: this.data.carNumberList,
cancelButtonText: '取消',
success: (res) => {
this.setData({
equipment_id: this.data.carList[res.index].carId,
changeCar: this.data.carNumberList[res.index]
});
},
});
},
onBzInput(e) {
this.setData({
bz: e.detail.value
});
},
handleSubmit(e) {
let formData = {}
formData = e.detail.value
formData.tenant_id = getApp().globalData.tenantId
formData.userid = getApp().globalData.userInfo.userId
formData.start_time = this.data.start_time
formData.end_time = this.data.end_time
formData.reason = this.data.reason
formData.equipment_id = this.data.equipment_id
if (!formData.destination) {
return util.ddToast({ type: 'fail', text: '请输入目的地' })
}
if (!formData.start_time) {
return util.ddToast({ type: 'fail', text: '请选择开始时间' })
}
if (!formData.end_time) {
return util.ddToast({ type: 'fail', text: '请选择结束时间' })
}
http.post(getApp().globalData.service + '/api/T_Borrow/AddBorrow', formData).then(res => {
if(res.Success) {
dd.redirectTo({
url: '../orderList/orderList'
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
});
{
"defaultTitle": "用车申请",
"usingComponents": {
"input-item": "mini-ali-ui/es/input-item/index",
"picker-item": "mini-ali-ui/es/picker-item/index",
"multi-liner": "mini-ali-ui/es/multi-liner/index"
},
"allowsBounceVertical": "NO"
}
.row {
display: flex;
align-items: center;
padding: 0 30rpx;
}
.row-title {
flex: 1;
padding-top: 28rpx;
padding-bottom: 28rpx;
font-size: 34rpx;
color: #000;
}
.row-extra {
flex-basis: initial;
font-size: 32rpx;
color: #888;
}
.row-arrow {
width: 32rpx;
height: 32rpx;
margin-left: 10rpx;
margin-top: 12rpx;
}
.container {
background: #eeeeee;
padding: 24rpx 0rpx 0rpx 0rpx;
height: 100%;
}
.container-item {
margin-bottom: 10rpx;
}
.item {
background: #fff;
height: 170rpx;
padding-top: 5rpx;
display: flex;
align-items: center;
justify-content: center;
}
.select {
display: flex;
height: 100rpx;
align-items: center;
justify-content: space-around;
}
.select .box {
display: flex;
align-items: center;
}
.select .box .name {
color: #999;
/* font-size: 26rpx; */
}
.select .box .active {
color: #212121;
/* font-size: 26rpx; */
}
.select .box image {
color: #999;
font-size: 35rpx;
position: relative;
top: -5rpx;
}
.filter-line {
border-bottom: 1px solid #f6f6f6;
}
.am-picker-content {
padding: 180rpx;
}
\ No newline at end of file
<scroll-view scroll-y="{{true}}" enable-back-to-top="{{true}}" style="height: 94vh;" onScrollToLower="onScrollToLower">
<popup show="{{showTop}}" position="top" zIndex="{{999}}" mask="{{true}}" onClose="onPopupClose">
<view>
<picker-item
data-field="start_time"
value="{{start_time}}"
name="start_time"
onPickerTap="dateStartPicker">开始时间</picker-item>
<picker-item
data-field="end_time"
value="{{end_time}}"
name="end_time"
onPickerTap="dateEndPicker">结束时间</picker-item>
<button size="default" type="primary" onTap="dateSearch">确定</button>
</view>
</popup>
<view class="select">
<view class="box" a:for="{{select}}" a:key="{{index}}" data-index="{{index}}" onTap="skipSelect">
<view class="name">{{item.title}}</view>
<image class="row-arrow" src="http://122.112.148.157:5000/updateImg/箭头下.png" mode="aspectFill"></image>
</view>
</view>
<view class="filter-line" />
<page-result
type="empty"
brief ="当前并无用车统计数据"
local="{{false}}" a:if='{{tjList.length === 0}}'/>
<view a:else>
<block a:for="{{tjList}}">
<list-item
index="{{index}}"
arrow="{{false}}"
last="{{index === (tjList.length - 1)}}">
{{item.realname}}
<list-secondary
title="{{item.sumCount}}次"
slot="extra" />
</list-item>
</block>
</view>
</scroll-view>
import http from '../../src/http'
import util from '../../src/libs/util';
Page({
data: {
pageNo: 1,
pageSize: 10,
carNumber: '',
carList: [],
showTop: false,
select: [
{
title: '选择时间',
open: false
}
]
},
onLoad() {
this.getTjList()
},
getTjList() {
let data = {
tenant_id: getApp().globalData.tenantId,
start_time: this.data.start_time,
end_time: this.data.end_time,
}
http.post(getApp().globalData.service + '/api/T_Tj/RenTj', data).then(res => {
if (res.Success) {
this.setData({
tjList:res.result
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
bindObjPickerChange(e) {
this.setData({
arrIndex: e.detail.value,
carNumber: this.data.carList[e.detail.value]
});
this.getTjList()
},
onPullDownRefresh() {
// 页面被下拉
this.getTjList();
setTimeout(() => {
dd.stopPullDownRefresh();
}, 100);
},
onScrollToLower(e) {
const _this = this
_this.setData({
pageSize: _this.data.pageSize + 8
})
this.getTjList();
},
skipSelect(e) {
if (e.target.dataset.index === 0) {
this.setData({
showTop: true
})
}
},
onPopupClose() {
this.setData({
showTop: false,
});
},
handleCallBack(data) {
this.setData({
carNumber: data[0].value,
show: false
})
this.getTjList()
},
dateStartPicker() {
my.datePicker({
format: 'yyyy-MM-dd HH:mm',
title: '选择始出车时间',
success: (res) => {
this.setData({
start_time: res.date,
});
},
});
},
dateEndPicker() {
my.datePicker({
format: 'yyyy-MM-dd HH:mm',
title: '选择始结束时间',
success: (res) => {
this.setData({
end_time: res.date,
});
},
});
},
dateSearch() {
this.setData({
showTop: false
});
this.getTjList()
}
});
{
"defaultTitle": "用车统计",
"usingComponents": {
"page-result": "mini-ali-ui/es/page-result/index",
"list": "mini-ali-ui/es/list/index",
"list-item": "mini-ali-ui/es/list/list-item/index",
"list-secondary": "mini-ali-ui/es/list/list-secondary/index",
"tag": "mini-ali-ui/es/tag/index",
"filter": "mini-ali-ui/es/filter/index",
"filter-item": "mini-ali-ui/es/filter/filter-item/index",
"popup": "mini-ali-ui/es/popup/index",
"picker-item": "mini-ali-ui/es/picker-item/index",
"flex": "mini-ali-ui/es/flex/index",
"flex-item": "mini-ali-ui/es/flex/flex-item/index"
}
}
.row {
display: flex;
align-items: center;
padding: 0 30rpx;
}
.row-title {
flex: 1;
padding-top: 28rpx;
padding-bottom: 28rpx;
font-size: 34rpx;
color: #000;
}
.row-extra {
flex-basis: initial;
font-size: 32rpx;
color: #888;
}
.row-arrow {
width: 32rpx;
height: 32rpx;
margin-left: 10rpx;
margin-top: 12rpx;
}
.container {
background: #eeeeee;
padding: 24rpx 0rpx 0rpx 0rpx;
height: 100%;
}
.container-item {
margin-bottom: 10rpx;
}
.item {
background: #fff;
height: 170rpx;
padding-top: 5rpx;
display: flex;
align-items: center;
justify-content: center;
}
.select {
display: flex;
height: 100rpx;
align-items: center;
justify-content: space-around;
}
.select .box {
display: flex;
align-items: center;
}
.select .box .name {
color: #999;
/* font-size: 26rpx; */
}
.select .box .active {
color: #212121;
/* font-size: 26rpx; */
}
.select .box image {
color: #999;
font-size: 35rpx;
position: relative;
top: -5rpx;
}
.filter-line {
border-bottom: 1px solid #f6f6f6;
}
.am-picker-content {
padding: 180rpx;
}
\ No newline at end of file
<scroll-view scroll-y="{{true}}" enable-back-to-top="{{true}}" style="height: 94vh;" onScrollToLower="onScrollToLower">
<filter show="{{show}}" max="{{1}}" equalRows="{{3}}">
<block a:for="{{car}}">
<filter-item value="{{item.carNumber}}" id="{{item.id}}" onChange="handleCallBack" selected="{{item.selected}}" key="filter-item-{{key}}" />
</block>
</filter>
<popup show="{{showTop}}" position="top" zIndex="{{999}}" mask="{{true}}" onClose="onPopupClose">
<view>
<picker-item
data-field="start_time"
value="{{start_time}}"
name="start_time"
onPickerTap="dateStartPicker">开始时间</picker-item>
<picker-item
data-field="end_time"
value="{{end_time}}"
name="end_time"
onPickerTap="dateEndPicker">结束时间</picker-item>
<button size="default" type="primary" onTap="dateSearch">确定</button>
</view>
</popup>
<view class="select">
<view class="box" a:for="{{select}}" a:key="{{index}}" data-index="{{index}}" onTap="skipSelect">
<view class="name">{{item.title}}</view>
<image class="row-arrow" src="http://122.112.148.157:5000/updateImg/箭头下.png" mode="aspectFill"></image>
</view>
</view>
<view class="filter-line" />
<page-result
type="empty"
brief ="当前并无用车数据"
local="{{false}}" a:if='{{logList.length === 0}}'/>
<view a:else>
<block a:for="{{logList}}">
<list-item
index="{{index}}"
arrow="{{false}}"
upperSubtitle="{{item.upTime}}"
last="{{index === (logList.length - 1)}}">
{{item.realname}}
<tag a:if="{{item.type === 0 }}" type="warning" size="sm" slot="afterTitle">取车</tag>
<tag a:if="{{item.type === 1 }}" type="success" size="sm" slot="afterTitle">还车</tag>
<list-secondary
title="{{item.carNumber}}"
subtitle="{{item.carType}}"
slot="extra" />
</list-item>
</block>
</view>
</scroll-view>
import http from '../../src/http'
import util from '../../src/libs/util';
Page({
data: {
pageNo: 1,
pageSize: 10,
carNumber: '',
carList: [],
showTop: false,
select: [
{
title: '选择车辆',
open: false
},
{
title: '选择时间',
open: false
}
]
},
onLoad() {
this.getLogList()
this.getCarList()
},
getCarList() {
http.post(getApp().globalData.service + '/api/T_Equipment/EquipmentPageList', {pageSize: 20, tenant_id: getApp().globalData.tenantId}).then(res => {
if (res.Success) {
this.setData({
car: res.result.records,
carList: res.result.records.map(i => i.carNumber)
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
getLogList() {
let data = {
tenant_id: getApp().globalData.tenantId,
pageNo: this.data.pageNo,
pageSize: this.data.pageSize,
userid: getApp().globalData.userInfo.roleCodeList.find(i => i === 'ld') ? '' : getApp().globalData.userInfo.userId,
carNumber: this.data.carNumber,
start_time: this.data.start_time,
end_time: this.data.end_time,
}
http.post(getApp().globalData.service + '/api/T_Equipment/HistoryEquPageList', data).then(res => {
if (res.Success) {
this.setData({
logList:res.result.records
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
bindObjPickerChange(e) {
this.setData({
arrIndex: e.detail.value,
carNumber: this.data.carList[e.detail.value]
});
this.getLogList()
},
onPullDownRefresh() {
// 页面被下拉
this.getLogList();
setTimeout(() => {
dd.stopPullDownRefresh();
}, 100);
},
onScrollToLower(e) {
const _this = this
_this.setData({
pageSize: _this.data.pageSize + 8
})
this.getLogList();
},
skipSelect(e) {
if (e.target.dataset.index === 0) {
this.setData({
show: true
})
}
if (e.target.dataset.index === 1) {
this.setData({
showTop: true
})
}
},
onPopupClose() {
this.setData({
showTop: false,
});
},
handleCallBack(data) {
this.setData({
carNumber: data[0].value,
show: false
})
this.getLogList()
},
dateStartPicker() {
my.datePicker({
format: 'yyyy-MM-dd HH:mm',
title: '选择始出车时间',
success: (res) => {
this.setData({
start_time: res.date,
});
},
});
},
dateEndPicker() {
my.datePicker({
format: 'yyyy-MM-dd HH:mm',
title: '选择始结束时间',
success: (res) => {
this.setData({
end_time: res.date,
});
},
});
},
dateSearch() {
this.setData({
showTop: false
});
this.getLogList()
}
});
{
"defaultTitle": "用车记录",
"usingComponents": {
"page-result": "mini-ali-ui/es/page-result/index",
"list": "mini-ali-ui/es/list/index",
"list-item": "mini-ali-ui/es/list/list-item/index",
"list-secondary": "mini-ali-ui/es/list/list-secondary/index",
"tag": "mini-ali-ui/es/tag/index",
"filter": "mini-ali-ui/es/filter/index",
"filter-item": "mini-ali-ui/es/filter/filter-item/index",
"popup": "mini-ali-ui/es/popup/index",
"picker-item": "mini-ali-ui/es/picker-item/index",
"flex": "mini-ali-ui/es/flex/index",
"flex-item": "mini-ali-ui/es/flex/flex-item/index"
}
}
.myList {
margin-top: 1px;
}
\ No newline at end of file
<view>
工作台
</view>
\ No newline at end of file
Page({
data: {
},
onLoad() {},
});
{
"usingComponents": {}
}
.page-center {
position:absolute;
left: 18%;
top: 18%;
}
/* .my-picker {
background: #EFEFF4;
} */
.submit-btn {
margin-top: 50rpx;
}
\ No newline at end of file
<view>
<view a:if="{{showLogo}}">
</view>
<view class="page-center" a:else>
<search-bar value="{{searchValue}}" focus="{{true}}" maxLength="{{20}}" showVoice="{{false}}" placeholder="搜索" onInput="handleInput"
onSubmit="searchSubmit"
onClear="handleClear"
showCancelButton="{{false}}" />
<picker-view value="{{value}}" onChange="onChange" class="my-picker">
<picker-view-column>
<block a:for="{{tenantList}}">
<view key="{{index}}">{{item.name}}</view>
</block>
</picker-view-column>
</picker-view>
<button type="primary" class="submit-btn" onTap="handleSubmit">加入单位</button>
</view>
</view>
import http from '../../src/http';
import login from '../../src/api/login';
import util, {fuzzyQuery} from '../../src/libs/util.js';
Page({
data: {
url: {
getTenantList: '/api/Sys_Tenant/GetTenantList'
},
tenantList: [],
value: [0],
searchValue: '',
showLogo: true
},
onLoad(query) {
// 页面加载
util.db.get('appInfo').then(res => {
if(res) {
if (query.borrowId) {
login(query.borrowId)
} else {
login()
}
} else {
this.setData({
showLogo: false
})
this.initTenantList()
}
})
},
initTenantList() {
const _this = this
http.post(getApp().globalData.service + _this.data.url.getTenantList, {}).then(res => {
if (res.Success) {
_this.setData({
tenantList: res.result
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
searchSubmit() {
let tenantName = fuzzyQuery(this.data.tenantList.map(i => i.name), this.data.searchValue)[0]
let index = this.data.tenantList.findIndex(i => i.name === tenantName)
this.setData({
value: [index]
})
},
handleInput(value) {
this.setData({
searchValue: value,
});
},
handleClear() {
this.setData({
searchValue: '',
});
},
onChange(e) {
this.setData({
value: e.detail.value
});
},
handleSubmit() {
const tenant = this.data.tenantList[this.data.value[0]]
util.db.set('appInfo', tenant).then(res => {
if (res.success) {
login()
}
})
},
onShareAppMessage() {
// 返回自定义分享信息
return {
title: 'My App',
desc: 'My App description',
path: 'pages/index/index',
};
},
});
{
"usingComponents": {
"search-bar": "mini-ali-ui/es/search-bar/index"
},
"allowsBounceVertical": "NO"
}
\ No newline at end of file
.row {
display: flex;
align-items: center;
padding: 0 30rpx;
}
.row-title {
flex: 1;
padding-top: 28rpx;
padding-bottom: 28rpx;
font-size: 34rpx;
color: #000;
}
.row-content .am-list-content{
flex: unset;
}
.row-extra {
flex-basis: initial;
font-size: 32rpx;
color: #888;
flex: 1;
text-align: right;
}
.row-arrow {
width: 32rpx;
height: 32rpx;
margin-left: 16rpx;
}
\ No newline at end of file
<view>
<list>
<view slot="header">
柜门钥匙列表
</view>
<block a:for="{{carList}}">
<list-item thumb={{item.carNumber? "../../src/assets/hasKey.png" : "../../src/assets/noKey.png"}}
index="{{index}}"
arrow="{{false}}"
last="{{index === (carList.length - 1)}}"
class="row-content"
key="{{index}}">
{{item.device_name}}-{{item.name}}
<view
slot="extra" class="row-extra">
<view>
{{item.carNumber}}
</view>
<tag a:if ={{item.state ==="订单中"}} size="sm" type="primary">{{item.state}}</tag>
<tag a:if ={{item.state ==="正常"}} size="sm" type="success">{{item.state}}</tag>
<tag a:if ={{item.state ==="空箱"}} size="sm" type="success">{{item.state}}</tag>
</view>
</list-item>
</block>
</list>
</view>
import dd from 'gdt-jsapi';
import http from '../../src/http/index'
import util from '../../src/libs/util'
Page({
data: {
carList: []
},
onLoad(query) {
this.getCarList()
},
getCarList () {
const _this = this
http.post(getApp().globalData.service + "/api/T_Equipment/CarList", {tenant_id: getApp().globalData.tenantId}).then(res => {
if (res.Success) {
_this.setData({
carList: res.result
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
onPullDownRefresh() {
// 页面被下拉
this.getCarList();
setTimeout(() => {
dd.stopPullDownRefresh();
}, 100);
},
});
{
"defaultTitle": "钥匙监控",
"usingComponents": {
"list": "mini-ali-ui/es/list/index",
"list-item": "mini-ali-ui/es/list/list-item/index",
"tag": "mini-ali-ui/es/tag/index"
}
}
.grid {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.grid-item {
width: 20%;
text-align: center;
padding-top: 28%;
margin-left: 4%;
position: relative;
border-radius: 10rpx;
background-color: white;
}
.grid-item-wrapper {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.grid-icon {
width: 64rpx;
height: 64rpx;
}
.grid-text {
color: #696969;
font-size: 28rpx;
line-height: 1;
margin-top: 28rpx;
}
.mgt15 {
margin-top: 15rpx;
}
\ No newline at end of file
<view class="page-container">
<!--顶部-->
<top personalGeneralInfo="{{personalGeneralInfo}}" insInfo='{{insInfo}}'/>
<!-- 订单 -->
<view class="mgt15">
<container title="我的订单" thumb="../../src/assets/order.png" icon="arrow" onActionTap="showOrder">
<view class="grid" key="grid">
<view a:for="{{list}}" key="{{item.entitle}}" class="grid-item" onTap="onItemTap" data-index="{{index}}">
<view class="grid-item-wrapper">
<image src="{{item.icon}}" class="grid-icon" mode="aspectFit" />
<text class="grid-text">{{item.title}}</text>
</view>
</view>
</view>
</container>
</view>
<!--列表-->
<view class="mgt15">
<list>
<block a:for="{{menuList}}">
<list-item key="{{index}}" thumb="{{item.thumb}}" arrow="right" onClick="handleMenuTap" data-info="{{item.page}}">{{ item.title }}</list-item>
</block>
</list>
</view>
</view>
\ No newline at end of file
import { JY_MENU_QUERY, SHY_MENU_QUERY, SYS_MENU_QUERY } from '../../src/common/constant';
Page({
data: {
radius: true,
personalGeneralInfo: {},
list: [
{
entitle: '待审批',
icon: '../../src/assets/wait.png',
page: '../orderList/orderList?arrIndex=0',
title: '待审批'
},
{
entitle: '待取车',
icon: '../../src/assets/disagree.png',
page: '../orderList/orderList?arrIndex=1',
title: '待取车'
},
{
entitle: '待还车',
icon: '../../src/assets/disagree.png',
page: '../orderList/orderList?arrIndex=2',
title: '待还车'
},
{
entitle: '已完成',
icon: '../../src/assets/finish.png',
page: '../orderList/orderList?arrIndex=3',
title: '已完成'
},
],
menuList: []
},
handleMenuTap(e) {
dd.navigateTo({
url: e.target.dataset.info
})
},
showOrder() {
dd.navigateTo({
url: '../orderList/orderList'
})
},
onItemTap(event) {
let index = event.target.dataset.index
dd.navigateTo({
url: this.data.list[index].page
})
},
onLoad() {
let myMenu = []
if (getApp().globalData.userInfo.roleCodeList.find(i => i ==='gly')) {
myMenu = myMenu.concat(SYS_MENU_QUERY)
}
if (getApp().globalData.userInfo.roleCodeList.find(i => i ==='jy')) {
myMenu = myMenu.concat(JY_MENU_QUERY)
}
if (getApp().globalData.userInfo.roleCodeList.find(i => i ==='ld')) {
myMenu = myMenu.concat(SHY_MENU_QUERY)
}
let obj = {}
let result = myMenu.reduce((item, next) => {
obj[next.thumb] ? '' : obj[next.thumb] = true && item.push(next)
return item
}, [])
this.setData({
personalGeneralInfo: {
userName: getApp().globalData.userInfo.realname,
company: getApp().globalData.company,
avatar: getApp().globalData.userInfo.avatar
},
menuList: result
});
},
});
{
"defaultTitle": "我的",
"component": false,
"usingComponents": {
"list": "mini-ali-ui/es/list/index",
"list-item": "mini-ali-ui/es/list/list-item/index",
"container": "mini-ali-ui/es/container/index",
"title": "mini-ali-ui/es/title/index",
"top": "../../src/components/top/top"
},
"allowsBounceVertical": "NO"
}
\ No newline at end of file
.am-title {
padding:var(--am-title-paddingLR,12px) var(--am-title-paddingB,12px)
}
.demo-steps-class {
margin-bottom: 20rpx;
}
.am-tabs-content-wrap {
background-color:#f1f1f1
}
.form-row {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
padding: 0 30rpx;
margin-top: 15rpx;
background-color:#fff
}
.form-row-label {
width: 45%;
font-size: 26rpx;
margin: 10rpx;
text-align: left;
color: #000;
}
.form-row-label-single {
width: 45%;
padding: 20rpx 10rpx;
font-size: 31rpx;
text-align: left;
color: #000;
}
.form-row-label-all {
width: wrap;
padding: 20rpx 10rpx;
font-size: 26rpx;
text-align: left;
color: #000;
}
.form-line {
height: 1px;
background-color: #ddd;
margin-left: 30rpx;
}
.row-arrow {
width: 25rpx;
height: 25rpx;
margin-left: 10rpx;
margin-top: 10rpx;
}
.txte-tip {
font-size: 31rpx;
color: #ff834c;
}
.submit-approve-btn {
width: 80%;
border-radius: 20rpx;
margin-left: 40rpx;
}
\ No newline at end of file
<view>
<title style="margin-top: 20rpx">基本信息</title>
<view class="form-row">
<view class="form-row-label-single">用车单号:</view>
<view class="form-row-label-single">{{orderInfo.borrow_code}}</view>
<view class="form-row-label-single">申请人:</view>
<view class="form-row-label-single">{{orderInfo.realname}}</view>
<view class="form-row-label-single">目的地:</view>
<view class="form-row-label-single">{{orderInfo.destination}}</view>
<view class="form-row-label-single">派车状态:</view>
<text class="form-row-label-single txte-tip" a:if="{{orderInfo.state === 0}}">待审批</text>
<text class="form-row-label-single txte-tip" a:if="{{orderInfo.state === 1}}">待取车</text>
<text class="form-row-label-single txte-tip" a:if="{{orderInfo.state === 2}}">待还车</text>
<text class="form-row-label-single txte-tip" a:if="{{orderInfo.state === 3}}">已完成</text>
<text class="form-row-label-single txte-tip" a:if="{{orderInfo.state === 4}}">驳回</text>
<view class="form-row-label-single">开始用车时间:</view>
<view class="form-row-label-single">{{orderInfo.start_time}}</view>
<view class="form-row-label-single">预计返回时间:</view>
<view class="form-row-label-single">{{orderInfo.end_time}}</view>
<view class="form-row-label-single">工作内容:</view>
<view class="form-row-label-single">{{orderInfo.reason}}</view>
<view class="form-row-label-single">备注:</view>
<view class="form-row-label-single">{{orderInfo.bz}}</view>
<block a:if="{{orderInfo.state !== 0}}">
<view class="form-row-label-single">车辆:</view>
<view class="form-row-label-single">{{orderInfo.carNumber}}</view>
</block>
</view>
<picker onChange="carPickerChange" value="{{index}}" range="{{carNumberList}}" a:if="{{orderInfo.state == 0}}">
<view class="form-row">
<view class="form-row-label-single">车辆:</view>
<view class="form-row-label-single">{{carNumberList[index] ? carNumberList[index] : '请选择车辆'}}
<image class="row-arrow" src="http://122.112.148.157:5000/updateImg/箭头下.png" mode="aspectFill"></image>
</view>
</view>
</picker>
<view a:if={{orderInfo.state !== 0}}>
<title style="margin-top: 20rpx">审批信息</title>
<view class="form-row">
<view class="form-row-label-single">审批人:</view>
<view class="form-row-label-single">{{orderInfo.sh_username}}</view>
<view class="form-row-label-single">审批意见:</view>
<view class="form-row-label-single">{{orderInfo.sh_idea}}</view>
<view class="form-row-label-single">审批时间:</view>
<view class="form-row-label-single">{{orderInfo.sh_time}}</view>
</view>
</view>
<view a:if={{orderInfo.state === 3 || orderInfo.state === 2}}>
<title style="margin-top: 20rpx">用车信息</title>
<view class="form-row">
<view class="form-row-label-single">取车时间:</view>
<view class="form-row-label-single">{{orderInfo.pickTime}}</view>
<view class="form-row-label-single">还车时间:</view>
<view class="form-row-label-single">{{orderInfo.returnTime}}</view>
</view>
</view>
<view a:if={{showSubmit}}>
<title style="margin-top: 20rpx">审核意见</title>
<multi-liner placeholder="请输入审核意见" value="{{shIdea}}" onInput="onInput" last="{{true}}" auto-height="{{true}}" controlled="{{true}}"/>
<view class="page-submit">
<flex>
<flex-item><button type="ghost" size="mini" class="submit-approve-btn" onTap="agree" data-result="no">拒绝</button></flex-item>
<flex-item><button type="primary" size="mini" class="submit-approve-btn" onTap="agree" data-result="yes">同意</button></flex-item>
</flex>
</view>
</view>
</view>
\ No newline at end of file
import http from '../../src/http'
import util from '../../src/libs/util';
Page({
data: {
orderInfo: {},
shIdea: '',
id: '',
carNumberList: [],
carList: [],
equipment_id: '',
showSubmit: false
},
onLoad(query) {
if (query.id) {
this.setData({
id: query.id
})
this.getCarList(query.id)
}
},
getById(id) {
const _this = this
http.post(getApp().globalData.service + '/api/T_Borrow/GetId', {id:id}).then(res => {
if (res.Success) {
let index = _this.data.carNumberList.findIndex(i => i === res.result.carNumber)
this.setData({
orderInfo: res.result,
index: index,
equipment_id: _this.data.carList[index] ? _this.data.carList[index].carId : '',
showSubmit: res.result.state === 0 && getApp().globalData.userInfo.roleCodeList.find(i => i === 'ld') ? true : false
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
onInput (e) {
this.setData({
shIdea: e.detail.value,
});
},
agree (event) {
const result = event.target.dataset.result
let formData = {
id: this.data.id,
sh_idea: this.data.shIdea ? this.data.shIdea : result === 'yes' ? '同意' : '驳回',
sh_userid: getApp().globalData.userInfo.userId,
type: result === 'yes' ? 0 : 1,
equipment_id: this.data.equipment_id
}
http.post(getApp().globalData.service + '/api/T_Borrow/Approve', formData).then(res => {
if (res.Success) {
dd.navigateTo({
url: '../orderList/orderList'
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
getCarList(id) {
const _this = this
http.post(getApp().globalData.service + "/api/T_Equipment/CarList", {tenant_id: getApp().globalData.tenantId}).then(res => {
if (res.Success) {
_this.setData({
carNumberList: res.result.filter(i => i.state === '正常').map(j => {return j.carNumber}),
carList: res.result.filter(i => i.state === '正常')
})
this.getById(id)
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
carPickerChange(e) {
this.setData({
index: e.detail.value,
equipment_id: this.data.carList[e.detail.value].carId
});
},
});
{
"usingComponents": {
"button": "mini-ali-ui/es/button/index",
"title": "mini-ali-ui/es/title/index",
"card": "mini-ali-ui/es/card/index",
"list": "mini-ali-ui/es/list/index",
"picker-item": "mini-ali-ui/es/picker-item/index",
"flex": "mini-ali-ui/es/flex/index",
"flex-item": "mini-ali-ui/es/flex/flex-item/index",
"multi-liner": "mini-ali-ui/es/multi-liner/index"
},
"allowsBounceVertical": "NO"
}
.row {
display: flex;
align-items: center;
padding: 0 30rpx;
}
.row-title {
flex: 1;
padding-top: 28rpx;
padding-bottom: 28rpx;
font-size: 34rpx;
color: #000;
}
.row-extra {
flex-basis: initial;
font-size: 32rpx;
color: #888;
}
.row-arrow {
width: 32rpx;
height: 32rpx;
margin-left: 16rpx;
}
.container {
background: #F5F5F5;
padding: 24rpx;
height: 100%;
}
.container-item {
margin-bottom: 10rpx;
}
.item {
background: #eeeeee;
text-align: left;
height: 220rpx;
padding-top: 5rpx;
}
.item-concent{
padding: 10rpx 10rpx;
font-size: 30rpx;
}
.txte-warn{
margin-left: 12rpx;
color: #FF8C00;
font-size: 30rpx;
}
.txte-success{
margin-left: 12rpx;
color: #67c23a;
font-size: 28rpx;
}
.txte-danger{
margin-left: 12rpx;
color: #f56c6c;
font-size: 28rpx;
}
\ No newline at end of file
<scroll-view scroll-y="{{true}}" enable-back-to-top="{{true}}" style="height: 100vh;" onScrollToLower="onScrollToLower">
<view>
<picker onChange="bindObjPickerChange" value="{{arrIndex}}" range="{{stateObjectArray}}" range-key="name">
<view class="row">
<view class="row-title">选择订单状态</view>
<view class="row-extra">当前选择:{{stateObjectArray[arrIndex].name}}</view>
<image class="row-arrow" src="https://img.alicdn.com/tfs/TB1oVprf4vbeK8jSZPfXXariXXa-48-48.png" mode="aspectFill" />
</view>
</picker>
</view>
<page-result
type="empty"
brief ="当前并无订单数据"
local="{{false}}" a:if='{{orderList.length === 0}}'/>
<view a:for="{{orderList}}" a:else>
<view className="container">
<container className="container-item" title = '{{item.realname}}发起的用车审批'
icon="arrow"
thumb="{{ item.returnTime ? (item.returnTime > item.end_time) ? '../../src/assets/overtime.png' : '../../src/assets/car.png' : '../../src/assets/car.png' }}"
onActionTap = "showPage" data-id="{{item.id}}">
<view class="item" onTap="showPage" data-id="{{item.id}}">
<view class="item-concent">订单编号: {{item.borrow_code}}</view>
<view class="item-concent">用车时间: {{item.start_time}}</view>
<view class="item-concent">车辆: {{item.carNumber}}</view>
<view class="item-concent">订单状态:
<text class="txte-warn" a:if="{{item.state === 0}}">待审批</text>
<text class="txte-warn" a:if="{{item.state === 1}}">待取车</text>
<text class="txte-warn" a:if="{{item.state === 2}}">待归还</text>
<text class="txte-success" a:if="{{item.state === 3}}">已完成</text>
<text class="txte-danger" a:if="{{item.state === 4}}">驳回</text>
</view>
</view>
</container>
</view>
</view>
</scroll-view>
import http from '../../src/http'
import util from '../../src/libs/util';
import login from '../../src/api/login';
Page({
data: {
stateObjectArray: [
{
id: 0,
name: '待审批'
},
{
id: 1,
name: '待取车'
},
{
id: 2,
name: '待归还'
},
{
id: 3,
name: '已完成'
},
{
id: 4,
name: '驳回'
},
{
id: 5,
name: '全部'
},
],
arrIndex: 5,
pageNo: 1,
pageSize: 10
},
onLoad(query) {
if (query.arrIndex) {
this.setData({
arrIndex: query.arrIndex
});
}
this.getOrderList()
},
getOrderList() {
let state = this.data.stateObjectArray[this.data.arrIndex].id
let data = {
tenant_id: getApp().globalData.tenantId,
pageNo: this.data.pageNo,
pageSize: this.data.pageSize,
state: state === 5 ? '' : state,
userid: getApp().globalData.userInfo.roleCodeList.find(i => i === 'ld') ? '' : getApp().globalData.userInfo.userId
}
http.post(getApp().globalData.service + '/api/T_Borrow/GetPageList', data).then(res => {
if (res.Success) {
this.setData({
orderList:res.result.records
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
bindObjPickerChange(e) {
this.setData({
arrIndex: e.detail.value,
pageSize: 10
});
this.getOrderList()
},
onPullDownRefresh() {
this.setData({
pageSize: 10
})
this.getOrderList()
setTimeout(() => {
dd.stopPullDownRefresh();
}, 100);
},
showPage(event) {
let _id = event.target.dataset.id
dd.navigateTo({
url: '../orderDetail/orderDetail?id=' + _id
})
},
onScrollToLower(e) {
const _this = this
_this.setData({
pageSize: _this.data.pageSize + 8
})
this.getOrderList();
},
});
{
"defaultTitle": "我的订单",
"usingComponents": {
"page-result": "mini-ali-ui/es/page-result/index",
"tabs": "mini-ali-ui/es/tabs/index",
"tab-content": "mini-ali-ui/es/tabs/tab-content/index",
"button": "mini-ali-ui/es/button/index",
"container": "mini-ali-ui/es/container/index",
"title": "mini-ali-ui/es/title/index",
"flex": "mini-ali-ui/es/flex/index",
"flex-item": "mini-ali-ui/es/flex/flex-item/index"
}
}
<scroll-view scroll-y="{{true}}" enable-back-to-top="{{true}}" style="height: 90vh;" onScrollToLower="onScrollToLower">
<search-bar value="{{searchValue}}" focus="{{true}}" maxLength="{{20}}" showVoice="{{false}}" placeholder="搜索" onInput="handleInput"
onSubmit="searchSubmit"
onClear="handleClear"
showCancelButton="{{false}}" />
<page-result
type="empty"
brief ="当前并无车辆数据"
local="{{false}}" a:if='{{carList.length === 0}}'/>
<view a:for="{{carList}}" a:else>
<list-item>
<view slot="extra">
<button size="mini" type="primary" onTap="editCar" data-info="{{item}}">编辑</button>
</view>
<avatar name="{{item.carNumber}}" desc="{{item.carType}}" src="http://122.112.148.157:5000/updateImg/汽车.png" />
</list-item>
</view>
<view class="page-submit">
<button type="primary" formType="submit" class="submit-btn" onTap="addCar">新增</button>
</view>
</scroll-view>
\ No newline at end of file
import http from '../../src/http/index'
import util from '../../src/libs/util'
Page({
data: {
pageNo: 1,
pageSize: 10,
searchValue: ''
},
onLoad() {
this.setData({
userId: getApp().globalData.userInfo.userId
})
this.getCarList()
},
handleInput(value) {
this.setData({
searchValue: value,
});
},
handleClear() {
this.setData({
searchValue: '',
});
this.getCarList()
},
searchSubmit() {
this.getCarList()
},
getCarList() {
let data = {
pageNo: this.data.pageNo,
pageSize: this.data.pageSize,
tenant_id: getApp().globalData.tenantId,
carNumber: this.data.searchValue
}
http.post(getApp().globalData.service + '/api/T_Equipment/EquipmentPageList', data).then(res => {
if (res.Success) {
this.setData({
carList: res.result.records
})
} else {
util.ddToast({ type: 'fail', text: res.Message })
}
})
},
onPullDownRefresh() {
this.setData({
pageSize: 10
})
this.getCarList()
setTimeout(() => {
dd.stopPullDownRefresh();
}, 100);
},
onScrollToLower(e) {
const _this = this
_this.setData({
pageSize: _this.data.pageSize + 8
})
this.getCarList();
},
addCar() {
dd.redirectTo({
url: '../addCar/addCar'
})
},
editCar(e) {
let car = e.target.targetDataset.info
dd.redirectTo({
url: '../addCar/addCar?id=' +car.id + '&carNumber=' + car.carNumber + '&carType=' + car.carType
})
}
});
{
"defaultTitle": "车辆管理",
"usingComponents": {
"page-result": "mini-ali-ui/es/page-result/index",
"search-bar": "mini-ali-ui/es/search-bar/index",
"avatar": "antd-mini/es/Avatar/index",
"list-item": "mini-ali-ui/es/list/list-item/index",
"modal": "mini-ali-ui/es/modal/index"
}
}
.rectangle {
//position: fixed;
//top: 100px;
padding: 0 14px;
margin-top: 20px;
}
.dialog {
position: fixed;
bottom: 18px;
}
.content {
color: #fff;
}
.opt-button {
width: 51px;
height: 27px;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
font-size: 12px;
border: #68BAF7 solid 1rpx;
}
.add-home {
width: 72px;
height: 27px;
display: flex;
justify-content: center;
align-items: center;
background-color: #56ADEB;
color: #fff;
font-size: 14px;
}
.am-tips-dialog .am-button {
border: none;
}
.row {
display: flex;
align-items: center;
padding: 0 30rpx;
background-color: white;
}
.row-title {
flex: 1;
padding-top: 28rpx;
padding-bottom: 28rpx;
font-size: 34rpx;
color: #000;
}
.row-extra {
flex-basis: initial;
font-size: 32rpx;
color: #888;
margin-right: 12px;
}
\ No newline at end of file
<view>
<tips-dialog iconUrl="{{useIcon ? 'https://gw.alipayobjects.com/zos/rmsportal/AzRAgQXlnNbEwQRvEwiu.png' : ''}}"
iconSize="36"
type="rectangle"
className="rectangle"
onCloseTap="onCloseTap"
show="{{showRectangle}}"
arrowPosition="{{arrowPositions[arrowPosIndex]}}">
<view class="content"
slot="content">
选错单位,是否重新选择?
</view>
<am-button a:if="{{useButton}}"
slot="operation"
shape="capsule"
capsuleSize="small"
onTap="onRectangleTap">立即选择</am-button>
<!-- <view slot="operation" class="add-home" onTap="onRectangleTap">立即添加</view> -->
</tips-dialog>
</view>
\ No newline at end of file
import util from '../../src/libs/util.js';
Page({
data: {
showRectangle: false,
showDialog: true,
arrowPositions: [
'bottom-left',
'bottom-center',
'bottom-right',
'top-left',
'top-center',
'top-right',
'left',
'right',
],
arrowPosIndex: 3,
useButton: true,
},
onLoad() {
if (getApp().globalData.userInfo.roleCodeList.find(i => i === 'jy')) {
this.setData({
showRectangle: true
})
}
},
onCloseTap() {
this.setData({
showRectangle: false,
});
},
onRectangleTap() {
util.db.remove('appInfo').then(res => {
dd.navigateTo({
url: '../index/index'
})
})
},
});
{
"defaultTitle": "设置",
"usingComponents": {
"tips-dialog": "mini-ali-ui/es/tips/tips-dialog/index",
"am-button": "mini-ali-ui/es/button/index",
"am-icon": "mini-ali-ui/es/am-icon/index",
"list-item": "mini-ali-ui/es/list/list-item/index",
"input-item": "mini-ali-ui/es/input-item/index"
}
}
<scroll-view scroll-y="{{true}}" enable-back-to-top="{{true}}" style="height: 100vh;" onScrollToLower="onScrollToLower">
<search-bar value="{{searchValue}}" focus="{{true}}" maxLength="{{20}}" showVoice="{{false}}" placeholder="搜索" onInput="handleInput"
onSubmit="searchSubmit"
onClear="handleClear"
showCancelButton="{{false}}" />
<page-result
type="empty"
brief ="当前并无用户数据"
local="{{false}}" a:if='{{userList.length === 0}}'/>
<view a:for="{{userList}}" a:else>
<list-item onClick="onItemClick" data-id="{{item.id}}">
<avatar name="{{item.realname + ' (' + (item.roleCodeTxt[0] == 'jy' ? '普通用户' : item.roleCodeTxt[0] == 'ld' ? '领导' : item.roleCodeTxt[0] === 'gly' ? '系统管理员' : '') + ')'}}" desc="{{item.phone}}" src="{{item.avatar}}" />
</list-item>
</view>
<modal
show="{{modalOpened}}"
showClose="{{false}}"
onButtonClick="onButtonClick"
buttons="{{buttons}}"
>
<view slot="header">温馨提示</view>
系统管理员无法变更, 是否交接?
</modal>
<modal
show="{{qrCodeModal}}"
onModalClick="onModalClick"
onModalClose="onModalClose"
>
<view style="margin: 20px 0 10px 0;">用钉钉扫一扫,交接为系统管理员</view>
<image mode="widthFix" style="width: 100%;" src="{{qrCode}}"/>
<view slot="footer" onTap="onChangeRole">我知道了</view>
</modal>
</scroll-view>
\ No newline at end of file
import http from '../../src/http/index'
import util from '../../src/libs/util'
Page({
data: {
pageNo: 1,
pageSize: 10,
searchValue: '',
roleList: [
{roleId: 'e51758fa916c881624b046d26bd09230', name: '领导'},
{roleId: '1429329085699571714', name: '普通用户'},
],
modalOpened: false,
buttons: [
{ text: '取消' },
{ text: '确定', extClass: 'buttonBold' },
],
},
onLoad() {
this.setData({
userId: getApp().globalData.userInfo.userId
})
this.getUserList()
},
handleInput(value) {
this.setData({
searchValue: value,
});
},
handleClear() {
this.setData({
searchValue: '',
});
this.getUserList()
},
searchSubmit() {
this.getUserList()
},
onModalClick() {
this.setData({
qrCodeModal: false,
});
},
onModalClose() {
this.setData({
qrCodeModal: false,
});
},
onChangeRole() {
dd.redirectTo({ url: '/pages/index/index' })
},
getUserList() {
let params = {
pageNo: this.data.pageNo,
pageSize: this.data.pageSize,
tenantId: getApp().globalData.tenantId,
realname: "*" + this.data.searchValue + "*"
}
http.get('/jeecg/sys/user/list', params).then(res => {
if (res.success) {
this.setData({
userList: res.result.records
})
} else {
util.ddToast({ type: 'fail', text: res.message })
}
})
},
onPullDownRefresh() {
this.setData({
pageSize: 10
})
this.getUserList()
setTimeout(() => {
dd.stopPullDownRefresh();
}, 100);
},
onScrollToLower(e) {
const _this = this
_this.setData({
pageSize: _this.data.pageSize + 8
})
this.getUserList();
},
onItemClick(e) {
if (e.target.dataset.id === getApp().globalData.userInfo.userId) {
this.setData({
modalOpened: true,
});
} else {
my.showActionSheet({
title: '选择角色',
items: this.data.roleList.map(i => i.name),
cancelButtonText: '取消',
success: (res) => {
http.get('/jeecg/dingTalk/scan',{type: 3, userId: e.target.dataset.id, roleId: this.data.roleList[res.index].roleId, time: new Date().getTime()}).then(res => {
if (res.success) {
this.getUserList();
} else {
util.ddToast({ type: 'fail', text: res.message })
}
})
},
})
}
},
onButtonClick(e) {
const { target: { dataset } } = e;
this.setData({
modalOpened: false,
});
if (dataset.index === 1) {
http.get('/jeecg/dingTalk/qrCode', {tenantId: getApp().globalData.tenantId, time: new Date().getTime()}).then(res => {
this.setData({
qrCodeModal: true,
qrCode: "data:image/jpg;base64," + res.result,
})
})
}
}
});
{
"defaultTitle": "用户管理",
"usingComponents": {
"page-result": "mini-ali-ui/es/page-result/index",
"search-bar": "mini-ali-ui/es/search-bar/index",
"avatar": "antd-mini/es/Avatar/index",
"list-item": "mini-ali-ui/es/list/list-item/index",
"modal": "mini-ali-ui/es/modal/index"
}
}
import dd from 'gdt-jsapi';
import http from '../http';
import util from '../libs/util';
function login(arg) {
// 获取免登授权码
my.getAuthCode({
success: (res) => {
util.db.get('appInfo').then(reg => {
http.get('/jeecg/dingTalk/getUserInfo', {code: res.authCode, tenantId: reg.id}).then(res => {
if(res.success){
getApp().globalData.userInfo = res.result.userInfo
getApp().globalData.tenantId = reg.id
getApp().globalData.company = reg.name
if (!arg) {
dd.redirectTo({ url: '/pages/my/my' })
} else {
dd.redirectTo({ url: '/pages/orderDetail/orderDetail?id=' + arg })
}
} else {
util.ddToast({ type: 'fail', text: res.message })
}
})
})
},
fail:function(err){
console.log(JSON.stringify(err))
}
})
}
export default login
// 首页底部文案
export const ABOUT_COPY = {
copy: '本服务由浙江钧普科技股份有限公司提供',
telTitle: '当前版本号:',
tel: 'V1.0.6',
};
export const JY_MENU_QUERY = [
{
thumb: '../../src/assets/carApply.png',
page: '../applyBorrowCar/applyBorrowCar',
title: '用车申请'
},
{
thumb: '../../src/assets/carUseLog.png',
page: '../carUseLog/carUseLog',
title: '用车记录'
},
{
thumb: '../../src/assets/setting.png',
page: '../sysSetting/sysSetting',
title: '单位切换'
}
]
export const SHY_MENU_QUERY = [
{
thumb: '../../src/assets/monitor.png',
page: '../keyList/keyList',
title: '钥匙监控'
},
{
thumb: '../../src/assets/carUseLog.png',
page: '../carUseLog/carUseLog',
title: '用车记录'
},
{
thumb: '../../src/assets/tj.png',
page: '../carTj/carTj',
title: '用车统计'
},
// {
// thumb: '../../src/assets/setting.png',
// page: '../sysSetting/sysSetting',
// title: '设置'
// }
]
export const SYS_MENU_QUERY = [
{
thumb: '../../src/assets/user.png',
page: '../sysUser/sysUser',
title: '用户管理'
},
{
thumb: '../../src/assets/car.png',
page: '../sysCar/sysCar',
title: '车辆管理'
},
{
thumb: '../../src/assets/carApply.png',
page: '../applyBorrowCar/applyBorrowCar',
title: '用车申请'
},
{
thumb: '../../src/assets/carUseLog.png',
page: '../carUseLog/carUseLog',
title: '用车记录'
},
{
thumb: '../../src/assets/monitor.png',
page: '../keyList/keyList',
title: '钥匙监控'
},
// {
// thumb: '../../src/assets/setting.png',
// page: '../sysSetting/sysSetting',
// title: '设置'
// }
]
\ No newline at end of file
@charset "utf-8";
.borderBottomDDD {
border-bottom: 1rpx solid #ddd;
}
.borderTopDDD {
border-top: 1rpx solid #ddd;
}
.top-wrapper {
background-color: #2074D4;
}
.top-wrapper .top-title {
padding: 10rpx 36rpx 40rpx 36rpx;
}
.top-wrapper .top-title .auth-btn {
text-align: center;
margin: auto 36rpx;
padding: 24rpx 32rpx;
border: 1rpx solid #fff;
border-radius: 4rpx;
}
.top-wrapper .top-title .auth-btn .auth-title {
color: #fff;
opacity: 1;
font-size: 32rpx;
}
.top-wrapper .top-title .auth-btn .auth-info {
margin-top: 7rpx;
font-size: 24rpx;
color: #F0F7FF;
opacity: 0.6;
}
.top-wrapper .top-title .top-content {
display: flex;
justify-content: space-between;
color: #fff;
}
.top-wrapper .top-title .top-content .left-content .name {
font-size: 40rpx;
}
.top-wrapper .top-title .top-content .left-content .company {
font-size: 30rpx;
opacity: 0.8;
}
.top-wrapper .top-title .top-content .right-content {
display: flex;
width: 0.5rem;
justify-content: flex-end;
align-items: center;
}
.top-wrapper .top-title .top-content .right-content image {
width: 16rpx;
height: 29rpx;
}
.top-wrapper .top-status {
display: flex;
justify-content: flex-start;
padding: 0 32rpx 66rpx 32rpx;
}
.am-list-extra {
flex: 1;
}
.top-icon {
width: 70rpx;
height: 70rpx;
margin: 10rpx 20rpx 0rpx 0rpx;
}
<!--顶部-->
<view class="top-wrapper" a:if="{{personalGeneralInfo}}">
<list-item>
<view slot="extra">
<image src="http://122.112.148.157:5000/updateImg/scan.png" class="top-icon" mode="aspectFit" onTap="onTap"/>
</view>
<avatar name="{{personalGeneralInfo.userName}}" desc="{{personalGeneralInfo.company}}" src="{{personalGeneralInfo.avatar}}" />
</list-item>
</view>
import http from '../../http'
import util from '../../libs/util'
Component({
mixins: [],
data: {
image: '../../assets/my.png',
},
props: {
personalGeneralInfo : {}
},
didMount() {},
didUpdate() {},
didUnmount() {},
methods: {
onHrefDetail() {
console.log('点击了用户信息')
},
onTap() {
my.scan({
scanType: ['qrCode','barCode'],
success: (res) => {
http.get('/jeecg/dingTalk/scan?userId='+ getApp().globalData.userInfo.userId + '&' + res.code).then(res => {
if (res.success) {
dd.redirectTo({ url: '/pages/index/index' })
} else {
util.ddToast({ type: 'fail', text: res.message })
}
})
},
});
}
},
});
{
"component": true,
"usingComponents": {
"topitem": "../topitem/topitem",
"avatar": "antd-mini/es/Avatar/index",
"list-item": "mini-ali-ui/es/list/list-item/index"
}
}
\ No newline at end of file
.top-item-wrapper {
width: 210rpx;
padding: 0 20rpx;
text-align: center;
}
.top-item-wrapper:not(:first-child) {
border-left: 1rpx solid rgba(255, 255, 255, 0.21);
}
.top-item-wrapper .title {
font-size: 28rpx;
color: #F0F7FF;
opacity: 0.6;
}
.top-item-wrapper .txt {
margin-top: 20rpx;
word-break: break-all;
font-size: 32rpx;
color: #fff;
}
<view class="top-item-wrapper">
<view class="title">{{title}}</view>
<view class="txt">{{txt}}</view>
</view>
\ No newline at end of file
Component({
mixins: [],
// 组件内部数据
data: {},
// 可给外部传入的属性添加默认值
props: {
title: '',
txt: '',
},
didMount() {},
didUpdate() {},
didUnmount() {},
// 自定义方法
methods: {},
});
{
"component": true
}
\ No newline at end of file
import dd from 'gdt-jsapi';
import util from '/src/libs/util.js'
// http对象
const http = {
// 通用get方法
get: function(url, data) {
dd.showLoading()
return new Promise((resolve, reject) => {
dd.httpRequest({
url: getApp().globalData.host + url,
method: 'GET',
data: data,
dataType: 'json',
complete: (res) => {
if (res.status === 200) {
resolve(res.data)
} else {
reject(res)
handleError(res)
}
dd.hideLoading()
}
})
})
},
// 通用post方法
post: function(url, data) {
dd.showLoading()
return new Promise((resolve, reject) => {
dd.httpRequest({
url: url,
method: 'POST',
data: JSON.stringify(data),
dataType: 'json',
headers: {
"Content-Type": "application/json"
},
complete: (res) => {
if (res.status === 200) {
resolve(res.data)
} else {
reject(res)
handleError(res)
}
dd.hideLoading()
}
})
})
}
}
// 错误处理方法
function handleError(err) {
let message = '请求错误'
if (err.error) {
// 判断错误码
switch (err.error) {
case 4: message = '设置错误'; break
case 11: message = '无权跨域'; break
case 12: message = '网络出错'; break
case 13: message = '超时'; break
case 14: message = '解码失败'; break
case 19: message = 'HTTP错误'; break
default: break
}
}
util.ddToast({ type: 'fail', text: message })
}
export default http
\ No newline at end of file
import dd from 'gdt-jsapi';
// 工具类对象
const util = {
// 合并url和query参数
formatUrl(url, params) {
if (!params) {
return url
}
let _url = url + '?'
for (let key in params) {
_url += `${key}=${params[key]}&`
}
return _url.substr(0, _url.length - 1)
},
// 格式化日期
formatDate(fmt, date) {
var o = {
"M+": date.getMonth() + 1,
"d+": date.getDate(),
"H+": date.getHours(),
"m+": date.getMinutes(),
"s+": date.getSeconds(),
"q+": Math.floor((date.getMonth() + 3) / 3),
"S": date.getMilliseconds()
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length))
}
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)))
}
return fmt
},
// 全局toast
ddToast({ type, text, interval }) {
dd.showToast({
type: type,
content: text,
duration: interval
})
},
// 暂停函数
sleep(duration) {
return new Promise(resolve => {
setTimeout(resolve, duration)
})
},
// 设置导航栏
setNavigationBar({ title, reset, backgroundColor }) {
dd.setNavigationBar({
title: title,
reset: reset,
backgroundColor: backgroundColor
})
},
// 深拷贝,不会拷贝函数
cloneDeep(obj) {
if (typeof obj !== 'object') {
return obj
}
let temp = {}
temp = JSON.parse(JSON.stringify(obj))
return temp
},
/**
* @desc 防抖函数
* @param {需要防抖的函数} func
* @param {延迟时间} wait
* @param {是否立即执行} immediate
*/
debounce(func, wait = 500, immediate = true) {
let timeout
return function(...args) {
let context = this
if (timeout) clearTimeout(timeout)
if (immediate) {
let callNow = !timeout
timeout = setTimeout(function() {
timeout = null
}, wait)
if (callNow) func.apply(context, args)
} else {
timeout = setTimeout(function() {
func.apply(context, args)
}, wait)
}
}
},
// debounce(func, delay) {
// let timer
// return function() {
// let args = arguments
// clearTimeout(timer)
// timer = setTimeout(() => {
// func.apply(this, args)
// }, delay || 1000)
// }
// },
// 判断a和b是否相等
equal(a, b) {
if (typeof a === 'function' || typeof b === 'function') {
return false
}
if (typeof a !== typeof b) {
return false
}
if (typeof a === 'object') {
return JSON.stringify(a) === JSON.stringify(b)
}
return a === b
},
/**
* 使用indexof方法实现模糊查询
* @param {Array} list 进行查询的数组
* @param {String} keyWord 查询的关键词
* @return {Array} 查询的结果
*/
fuzzyQuery(list, keyWord) {
var arr = [];
for (var i = 0; i < list.length; i++) {
if (list[i].indexOf(keyWord) >= 0) {
arr.push(list[i]);
}
}
return arr;
},
// 本地缓存,默认区分用户
db: {
// 写
set(path, data) {
return new Promise((resolve, reject) => {
dd.setStorage({
key: path,
data,
complete: (result) => {
resolve(result)
}
})
})
},
// 读
get(path) {
return new Promise((resolve, reject) => {
dd.getStorage({
key: path,
complete: (result) => {
resolve(result.data)
}
})
})
},
// 删除
remove(path) {
return new Promise((resolve, reject) => {
dd.removeStorage({
key: path,
complete: (result) => {
resolve(result)
}
})
})
}
},
// 根据当前页面路由获取菜单数据
getMenu(route) {
return new Promise((resolve, reject) => {
this.db.get({ dbName: 'menu', user: true }).then(data => {
for (let i = 0; i < data.length; i++) {
let arr = data[i].mobile_url.split(';')
if (arr.includes(`/${route}`)) {
resolve(this.cloneDeep(data[i]))
break
}
}
resolve(false)
})
})
},
// 根据id获取组件实例
getComponentById(componentId) {
if (!componentId) {
return false
}
let currentPage = getCurrentPages().slice(-1)[0]
let instances = function(id) {
return this.$getComponentBy((instance) => { return instance.props.id === id }, { returnOnFirstMatch: true })
}.apply(currentPage, [componentId])
return instances.length ? instances[0] : false
},
// 通用基础组件校验
baseValidate(componentArr) {
let key = ''
for (let i = 0; i < componentArr.length; i++) {
let c = componentArr[i]
key = c.label
if (c.component === 'e-subform') {
for (let j = 0; j < c.children.length; j++) {
let sf = c.children[j]
for (let k = 0; k < sf.length; k++) {
if (sf[k].status === 'error') {
key += `-${j + 1}`
util.ddToast({ type: 'fail', text: `${sf[k].label}${key}${sf[k].notice}` })
return false
}
}
}
} else {
if (c.status === 'error') {
util.ddToast({ type: 'fail', text: key + c.notice })
return false
}
}
}
return true
}
}
// 初始化缓存路径
function pathInit({ dbName = 'db', path = '', user = true, validator = () => true, defaultValue = '' }) {
const uuid = getApp().globalData.userInfo.userid || 'ghost-uuid'
const currentPath = `${dbName}.${user ? `user.${uuid}` : 'public'}${path ? `.${path}` : ''}`
const value = dd.getStorageSync({ key: currentPath }).data
if (!(value !== undefined && validator(value))) {
dd.setStorageSync({
key: currentPath,
data: defaultValue
})
}
return currentPath
}
export default util
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论