Browse Source

维修工单,设备报修功能

master
zhang_li 10 months ago
parent
commit
57c5fcfd0a
  1. 6
      App.vue
  2. 42
      api/device.js
  3. 23
      api/dict.js
  4. 9
      api/index.js
  5. 16
      api/login.js
  6. 36
      api/repairOrder.js
  7. 9
      components/form/index.vue
  8. 2
      config.js
  9. 23
      manifest.json
  10. 93
      pages.json
  11. 226
      pages/deviceReport/addForm.vue
  12. 242
      pages/deviceReport/index.vue
  13. 230
      pages/deviceReport/myDeviceReport.vue
  14. 60
      pages/index.vue
  15. 31
      pages/login.vue
  16. 72
      pages/mine/index.vue
  17. 349
      pages/repairOrder/addForm.vue
  18. 363
      pages/repairOrder/detail.vue
  19. 256
      pages/repairOrder/index.vue
  20. 230
      pages/repairOrder/myDeviceReport.vue
  21. 261
      pages/repairOrder/screen.vue
  22. 107
      pages/workOrderList/addForm.vue
  23. 4
      pages/workOrderList/index.vue
  24. 46
      permission.js
  25. 3
      plugins/index.js
  26. 1
      plugins/modal.js
  27. 19
      plugins/time.js
  28. 2
      static/scss/colorui.css
  29. 2
      store/getters.js
  30. 16
      store/modules/user.js
  31. 2
      utils/constant.js
  32. 2
      utils/storage.js

6
App.vue

@ -21,9 +21,9 @@
this.globalData.config = config
},
checkLogin() {
if (!getAccessToken()) {
this.$tab.reLaunch('/pages/login')
}
// if (!getAccessToken()) {
// this.$tab.reLaunch('/pages/login')
// }
}
}
}

42
api/device.js

@ -0,0 +1,42 @@
import request from '@/utils/request'
// 根据设备/模具号查询信息
export function getDetailsByNumber(params) {
return request({
url: '/eam/device-accounts/getDetailsByNumber',
'method': 'GET',
params
})
}
// 添加报修
export function deviceRepairCreate(data) {
return request({
url: '/eam/device-repair/create',
'method': 'POST',
data
})
}
// 报修列表
export function deviceRepairPage(params) {
return request({
url: '/eam/device-repair/getAppPage',
'method': 'GET',
params
})
}
// 报修列表
export function rejected(id) {
return request({
url: '/eam/device-repair/rejected?id='+id,
'method': 'DELETE',
})
}
// 设备列表
export function deviceList(params) {
return request({
url: '/eam/device-accounts/selectData',
'method': 'GET',
params
})
}

23
api/dict.js

@ -0,0 +1,23 @@
import request from '@/utils/request'
// 获取字典
function getDictList(type) {
return request({
url: '/eam/device-maintenance-main/getDictList?type=' + type,
'method': 'GET',
})
}
export async function getDict(type) {
let data =[]
await getDictList(type).then((res) => {
if (res.code == 0) {
data = res.data.map(item=>{
return {
label:item.label,
value:item.code,
}
})
} else {}
}).catch((err) => {})
return data
}

9
api/index.js

@ -0,0 +1,9 @@
import request from '@/utils/request'
// 获取首页数量信息
export function getCounts() {
return request({
url: '/eam/device-accounts/getCounts',
'method': 'GET'
})
}

16
api/login.js

@ -1,11 +1,15 @@
import request from '@/utils/request'
// 登录方法
export function login(username, password, captchaVerification) {
export function login(username, password, captchaVerification,tenantName,rememberMe,code,uuid) {
const data = {
username,
password,
captchaVerification
captchaVerification,
tenantName,
rememberMe,
code,
uuid,
}
return request({
url: '/system/auth/login',
@ -19,12 +23,18 @@ export function login(username, password, captchaVerification) {
// 获取用户详细信息
export function getInfo() {
return request({
url: '/system/user/profile/get',
'method': 'GET'
})
}
// 获取权限
export function getPermissionInfo() {
return request({
url: '/system/auth/get-permission-info',
'method': 'GET'
})
}
// 退出方法
export function logout() {
return request({

36
api/repairOrder.js

@ -0,0 +1,36 @@
import request from '@/utils/request'
// 添加工单
export function repairOrderCreate(data) {
return request({
url: '/eam/device-maintenance-main/create',
'method': 'POST',
data
})
}
// 编辑工单
export function repairOrderUpdate(data) {
return request({
url: '/eam/device-maintenance-main/update',
'method': 'PUT',
data
})
}
// 报修列表
export function repairOrderPage(params) {
return request({
url: '/eam/device-maintenance-main/getAppPage',
'method': 'GET',
params
})
}
// 操作工单
export function orderClick(params) {
return request({
url: '/eam/device-maintenance-main/orderClick',
'method': 'GET',
params
})
}

9
components/form/index.vue

@ -53,6 +53,7 @@
:trim='item.trim'
:show-confirmbar='item.showConfirmbar'
:adjust-position='item.adjustPosition'
@blur="blur($event,item.field)"
v-if="item.type == 'text'||item.type == 'number'||item.type == 'idcard'||item.type == 'digit'||item.type == 'tel'||item.type == 'safePassword'||item.type == 'nickname'"
/>
<view class="range" v-if="item.type == 'range'">
@ -249,7 +250,7 @@
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
<template v-slot:right v-if="item.isRightButton || item.isRightText ">
<view class="right-button" v-if="item.isRightButton">
<view class="right-button" v-if="item.isRightButton" @click="chickRightButton(item.field)">
{{item.isRightButton}}
</view>
<view class="right-text" v-if="item.isRightText">
@ -418,6 +419,12 @@
switchChange(e,field) {
this.$emit('switchChange',e,field)
},
chickRightButton(field) {
this.$emit('chickRightButton',field)
},
blur(e,field) {
this.$emit('blur',e,field)
},
},
mounted() {
this.$refs.form.setRules(this.form.rules)

2
config.js

@ -1,6 +1,6 @@
// 应用全局配置
module.exports = {
baseUrl: process.env.NODE_ENV === 'development' ? 'http://localhost:12080' : 'http://api-dashboard.yudao.iocoder.cn',
baseUrl: process.env.NODE_ENV === 'development' ? 'http://192.168.0.165:12080' : 'http://api-dashboard.yudao.iocoder.cn',
baseApi:process.env.NODE_ENV === 'development' ? '/admin-api' : '/api/admin-api',
// 应用信息
appInfo: {

23
manifest.json

@ -1,6 +1,7 @@
{
"name" : "芋道移动端",
"appid" : "__UNI__EA67EB3",
"name" : "ema",
"appid" : "__UNI__89250D0",
"package" : "com.eam.uniapp",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
@ -14,7 +15,9 @@
"autoclose" : true,
"delay" : 0
},
"modules" : {},
"modules" : {
"Push" : {}
},
"distribute" : {
"android" : {
"permissions" : [
@ -39,7 +42,19 @@
"dSYMs" : false
},
"sdkConfigs" : {
"ad" : {}
"ad" : {},
"push" : {
"unipush" : {
"version" : "2",
"offline" : true,
"hms" : {},
"oppo" : {},
"vivo" : {},
"mi" : {},
"meizu" : {},
"fcm" : {}
}
}
}
}
},

93
pages.json

@ -1,10 +1,5 @@
{
"pages": [{
"path": "pages/login",
"style": {
"navigationStyle": "custom"
}
}, {
"path": "pages/index",
"style": {
"navigationBarTitleText": "首页",
@ -17,13 +12,6 @@
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/device/screen",
"style": {
"navigationBarTitleText": "筛选",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/mold/index",
"style": {
@ -42,97 +30,61 @@
"navigationStyle": "custom"
}
},{
"path": "pages/spareParts/screen",
"style": {
"navigationBarTitleText": "筛选",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/sparePartsApplication/index",
"style": {
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/sparePartsApplication/screen",
"style": {
"navigationBarTitleText": "筛选",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/sparePartsApplication/addForm",
"style": {
"navigationBarTitleText": "添加申请",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/sparePartsServiceWorkOrderList/index",
"path": "pages/login",
"style": {
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
"navigationStyle": "custom"
}
},{
"path": "pages/sparePartsServiceWorkOrderList/screen",
"path": "pages/deviceReport/index",
"style": {
"navigationBarTitleText": "筛选",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
"navigationBarTitleText": "设备报修",
"navigationStyle": "custom"
}
},{
"path": "pages/sparePartsServiceWorkOrderList/addForm",
"path": "pages/deviceReport/addForm",
"style": {
"navigationBarTitleText": "添加申请",
"navigationBarTitleText": "添加报修",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/notaic/index",
"style": {
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/workOrderList/index",
"path": "pages/deviceReport/myDeviceReport",
"style": {
"navigationBarTitleText": "我的报修",
"navigationStyle": "custom"
}
},{
"path": "pages/workOrderList/screen",
"path": "pages/repairOrder/index",
"style": {
"navigationBarTitleText": "筛选",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
"navigationBarTitleText": "维修工单",
"navigationStyle": "custom"
}
},{
"path": "pages/workOrderList/addForm",
"path": "pages/repairOrder/addForm",
"style": {
"navigationBarTitleText": "添加报修",
"navigationBarTitleText": "添加维修工单",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/workOrderList/detail",
"path": "pages/repairOrder/screen",
"style": {
"navigationBarTitleText": "工单详情",
"navigationBarTitleText": "筛选",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/mine/aboutUs",
"path": "pages/repairOrder/detail",
"style": {
"navigationBarTitleText": "关于我们",
"navigationBarTitleText": "维修工单详情",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/mine/changePassword",
"path": "pages/repairOrder/myDeviceReport",
"style": {
"navigationBarTitleText": "修改密码",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
"navigationBarTitleText": "维修工单",
"navigationStyle": "custom"
}
}],
"tabBar": {
@ -170,6 +122,7 @@
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "RuoYi",
"navigationBarBackgroundColor": "#FFFFFF"
"navigationBarBackgroundColor": "#FFFFFF",
"backgroundColorBottom": "#f5f5f5"
}
}

226
pages/deviceReport/addForm.vue

@ -0,0 +1,226 @@
<template>
<!-- 添加设备报修 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" label-width="160rpx">
<u-form-item label="故障描述" prop="describes" required>
<u-input v-model="form.describes" placeholder="请输入故障描述" />
</u-form-item>
<u-form-item :label="`${type=='DEVICE'?'设备' : '模具'}编码`" prop="deviceNumber" required>
<u-input v-model="form.deviceNumber" @blur="blur()"
:placeholder="`请输入${type=='DEVICE'?'设备' : '模具'}编码`" />
<view class="right-button" @click="chickRightButton">
扫描
</view>
</u-form-item>
<u-form-item :label="`${type=='DEVICE'?'设备' : '模具'}名称`" prop="deviceName" required>
<u-input v-model="form.deviceName" :placeholder="`请输入${type=='DEVICE'?'设备' : '模具'}名称`" disabled />
</u-form-item>
<u-form-item label="所属厂区" prop="factoryAreaName" required>
<u-input v-model="form.factoryAreaName" placeholder="请输入所属厂区" disabled />
</u-form-item>
</u-form>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</view>
</template>
<script>
import * as deviceApi from "@/api/device.js"
export default {
data() {
return {
loading: false,
type: "",
form: {
describes: "",
deviceNumber: '',
deviceName: '',
factoryAreaName: '',
factoryAreaNumber: '',
}
}
},
methods: {
//
chickRightButton(field) {
uni.scanCode({
success: function(res) {
this.form.deviceNumber = res.result
this.getDetailsByNumber()
}
});
},
blur() {
if (this.form.deviceNumber) {
this.getDetailsByNumber()
}
},
// /
getDetailsByNumber() {
const data = {
number: this.form.deviceNumber,
type: this.type,
id: ''
}
deviceApi.getDetailsByNumber(data).then((res) => {
if (res.data) {
this.form.deviceName = res.data.name
this.form.factoryAreaName = res.data.factoryAreaName
this.form.factoryAreaNumber = res.data.factoryAreaNumber
} else {
this.$modal.showToast(`找不到该${this.type=='DEVICE'?'设备' : '模具'}`)
}
})
},
//
submit() {
//
if (!this.form.describes) {
this.$modal.showToast('请输入故障描述')
return;
}
if (!this.form.deviceNumber) {
this.$modal.showToast(`请输入${this.type=='DEVICE'?'设备' : '模具'}编码`)
return;
}
if (!this.form.deviceName) {
this.$modal.showToast(`请输入${this.type=='DEVICE'?'设备' : '模具'}名称`)
return;
}
if (!this.form.factoryAreaName) {
this.$modal.showToast('请输入所属厂区')
return;
}
const data = {
describes: this.form.describes,
deviceNumber: this.form.deviceNumber,
factoryAreaNumber: this.form.factoryAreaNumber,
type: this.type
}
this.$modal.confirm('是否添加报修').then(() => {
this.$modal.loading('加载中')
this.loading = true
deviceApi.deviceRepairCreate(data).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('添加成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('添加失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
},
//
reset() {
console.log('表单数据信息1:', this.data);
this.form = {}
},
},
onLoad(option) {
if (option.type) this.type = option.type;
}
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 30rpx 140rpx;
}
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
image {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
}
.dec1 {
font-size: 28rpx;
margin-top: 16rpx;
color: #acacac;
}
.dec2 {
font-size: 28rpx;
margin-top: 6rpx;
color: #acacac;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
</style>

242
pages/deviceReport/index.vue

@ -0,0 +1,242 @@
<template>
<!-- 设备报修 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="设备报修">
<template v-slot:right>
<u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm"></u-icon>
</template>
</u-navbar>
<!-- <Search @search='search' @screen='screen' :isShowScreen='false'/> -->
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="itemClick(item,index)">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<view class="time">
<!-- 2023-12-12 08:00:00 -->
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
报修单号:<span>{{item.number}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="已报修" v-if="item.result=='已报修'" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="primary" shape='circle' />
</view>
<view class="button">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;"
v-if="item.isCancel == 0" @click="cancle(item)">撤销</u-button>
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script>
import workOrderList from '@/components/workOrderList/index.vue'
import * as deviceApi from "@/api/device.js"
export default {
components: {
workOrderList
},
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
type: ''
},
status: 'loadmore', //
list: [],
}
},
methods: {
//
screen() {
this.$tab.navigateTo(`/pages/deviceReport/screen?type=${this.type}`)
},
itemClick(item, index) {
this.$tab.navigateTo(`/pages/workOrderList/detail?type=${this.type}`)
},
addForm() {
this.$tab.navigateTo(`/pages/deviceReport/addForm?type=${this.params.type}`)
},
//
getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
deviceApi.deviceRepairPage(this.params).then((res) => {
this.$modal.closeLoading()
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
//
cancle(item) {
this.$modal.confirm('确定撤销报修吗?').then(() => {
this.$modal.loading('加载中')
deviceApi.rejected(item.id).then((res) => {
this.$modal.closeLoading()
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
})
})
}
},
onLoad(option) {
if (option.type) this.params.type = option.type;
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.status {
flex: 1;
}
.button {
position: absolute;
right: 0rpx;
}
}
}
}
</style>

230
pages/deviceReport/myDeviceReport.vue

@ -0,0 +1,230 @@
<template>
<!-- 设备报修 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="我的报修">
</u-navbar>
<Search @search='search' @screen='screen'/>
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="itemClick(item,index)">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<view class="time">
2023-12-12 08:00:00
</view>
</view>
<view class="dec">
报修单号:<span>{{item.number}}</span>
</view>
<view class="dec">
设备编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
设备名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="已报修" v-if="item.result=='已报修'" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="primary" shape='circle' />
</view>
<view class="button">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;"
v-if="item.isCancel == 0" @click="cancle(item)">撤销</u-button>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script>
import workOrderList from '@/components/workOrderList/index.vue'
import * as deviceApi from "@/api/device.js"
export default {
components: {
workOrderList
},
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
type: 'DEVICE',
flag:1
},
status: 'loadmore', //
list: [],
}
},
methods: {
//
screen() {
this.$tab.navigateTo(`/pages/deviceReport/screen?type=${this.type}`)
},
itemClick(item, index) {
this.$tab.navigateTo(`/pages/workOrderList/detail?type=${this.type}`)
},
addForm() {
this.$tab.navigateTo(`/pages/deviceReport/addForm?type=${this.params.type}`)
},
//
getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
deviceApi.deviceRepairPage(this.params).then((res) => {
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
//
cancle(item){
this.$modal.confirm('确定撤销报修吗?').then(()=>{
deviceApi.rejected(item.id).then((res) => {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
})
})
}
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.list {
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.status {
flex: 1;
}
.button{
position: absolute;
right: 0rpx;
}
}
}
}
</style>

60
pages/index.vue

@ -1,10 +1,12 @@
<template>
<view class="index-content">
<u-navbar back-icon-color='#fff' back-icon-name='' :background="{ background: 'rgba(64, 158,255,'+bgOpacity+')'}" back-text=""
title-color='#fff' :immersive='true' :border-bottom='false' title="首页">
<template v-slot:right>
<u-icon name="bell" color="#fff" size="36" style="padding-right: 30rpx;" @click="open('/pages/notaic/index')"></u-icon>
</template>
<u-navbar back-icon-color='#fff' back-icon-name=''
:background="{ background: 'rgba(64, 158,255,'+bgOpacity+')'}" back-text="" title-color='#fff'
:immersive='true' :border-bottom='false' title="首页">
<!-- <template v-slot:right>
<u-icon name="bell" color="#fff" size="36" style="padding-right: 30rpx;"
@click="open('/pages/notaic/index')"></u-icon>
</template> -->
</u-navbar>
<view class="top">
<image src="../static/images/mobile_bg.png" class="bg" mode=""></image>
@ -43,13 +45,13 @@
<view class="title">设备维护</view>
<u-row gutter="16" style="padding:0px 20rpx ;">
<u-col span="3">
<view class="icon-item" @click="open('/pages/workOrderList/index?type=1')">
<view class="icon-item" @click="open('/pages/deviceReport/index?type=DEVICE')">
<image src="../static/images/icon4.svg" mode=""></image>
<view>设备报修</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/workOrderList/index?type=2')">
<view class="icon-item" @click="open('/pages/repairOrder/index?type=DEVICE')">
<image src="../static/images/icon5.svg" mode=""></image>
<view>维修工单</view>
</view>
@ -76,7 +78,7 @@
<view class="title">模具维护</view>
<u-row gutter="16">
<u-col span="3">
<view class="icon-item" @click="open('/pages/device/deviceRepair/index')">
<view class="icon-item" @click="open('/pages/deviceReport/index?type=MOLD')">
<image src="../static/images/icon4.svg" mode=""></image>
<view>设备报修</view>
</view>
@ -121,9 +123,19 @@
</template>
<script>
export default { data() {
import {
getInfo
} from '@/api/login'
import {
getCounts
} from '@/api/index'
import { getAccessToken } from '@/utils/auth'
export default {
data() {
return {
bgOpacity: 0,
}
},
@ -131,8 +143,30 @@
open(url) {
this.$tab.navigateTo(url)
},
getInfo() {
getInfo().then(res => {
console.log((res))
})
},
getPermissionInfo() {
this.$store.dispatch('GetPermissionInfo').then(res => {
})
},
getCounts() {
getCounts().then(res => {
console.log((res))
})
},
},
onLoad: function() {
if (getAccessToken()) {
this.getInfo()
this.getPermissionInfo()
this.getCounts()
}
},
onLoad: function() {},
onPageScroll(e) {
if (e.scrollTop > 0) {
this.bgOpacity = e.scrollTop / 200;
@ -157,7 +191,7 @@
position: relative;
image {
height: 410rpx;
height: calc(var(--status-bar-height) + 410rpx);
}
}
@ -236,22 +270,26 @@
}
}
}
.box {
.title {
font-size: 32rpx;
font-weight: bold;
padding: 50rpx 50rpx 30rpx;
}
.icon-item {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin: 20rpx 0px;
image {
width: 80rpx;
height: 80rpx;
}
view {
margin-top: 20rpx;
color: #999999;

31
pages/login.vue

@ -1,7 +1,7 @@
<template>
<view class="normal-login-container">
<view class="logo-img">
<u-icon name="close" size="40" class="icon" @click="$tab.reLaunch('/pages/index')"></u-icon>
<view class="logo-title">
<view>智慧设备管理综合系统</view>
<view>让设备管理更智能更高效</view>
@ -24,8 +24,6 @@
<view class="input-item flex align-center">
<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
</view>
<Verify @success="pwdLogin" :mode="'pop'" :captchaType="'blockPuzzle'"
:imgSize="{ width: '330px', height: '155px' }" ref="verify"></Verify>
<view class="action-btn">
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg ">登录</button>
</view>
@ -42,21 +40,22 @@
</template>
<script>
import Verify from "@/components/verifition/Verify"
import * as loginApi from "@/api/login"
export default {
name: 'Login',
components: {
Verify
},
data() {
return {
captchaEnabled: true, // TODO
globalConfig: getApp().globalData.config,
loginForm: {
tenantName:"闻荫源码",
username: "admin",
password: "admin123",
captchaVerification: ""
password: "123456",
captchaVerification: "",
rememberMe:false,
code:'1',
uuid:"APP"
}
}
},
@ -78,7 +77,7 @@
} else if (this.loginForm.password === "") {
this.$modal.msgError("请输入您的密码")
} else {
this.$tab.reLaunch('/pages/index')
await this.pwdLogin({})
//
// if (this.captchaEnabled) {
// this.$refs.verify.show()
@ -91,10 +90,9 @@
async pwdLogin(captchaParams) {
this.$modal.loading("登录中,请耐心等待...")
//
this.loginForm.captchaVerification = captchaParams.captchaVerification
this.$store.dispatch('Login', this.loginForm).then(() => {
this.$modal.closeLoading()
this.loginSuccess()
this.$tab.reLaunch('/pages/index')
})
},
//
@ -140,12 +138,17 @@
.logo-img {
background-color: #fafcff;
height: 400rpx;
height: calc(var(--status-bar-height) + 400rpx);
position: relative;
.icon{
position: absolute;
top: calc(var(--status-bar-height) + 20rpx);
left: 40rpx;
}
.logo-title{
position: absolute;
left: 50rpx;
top: 50rpx;
top: calc(var(--status-bar-height) + 80rpx);
z-index: 11;
view{
&:nth-child(1){

72
pages/mine/index.vue

@ -6,17 +6,23 @@
</u-navbar>
<view class="header-section">
<image src="../../static/images/bg.jpg" class="bg" mode=""></image>
<view class="info">
<view class="info" v-if="user">
<image :src="user.avatar" class="cu-avatar" mode=""></image>
<view class="user-info">
<view class="name">{{user.nickname}} <span v-if="user&&user.posts&&user.posts[0]">{{user.posts[0].name}}</span></view>
<view class="tips">{{user.dept.name}}</view>
</view>
</view>
<view class="info" v-else>
<image :src="avatar" class="cu-avatar" mode=""></image>
<view class="user-info">
<view class="name">用户名称 <span>部门主任</span></view>
<view class="tips">生产部门一</view>
<view class="name">点击登录</view>
</view>
</view>
</view>
<view class="content-section">
<view class="mine-actions grid col-3 text-center">
<view class="action-item" @click="handleJiaoLiuQun">
<view class="action-item" @click="handleDeviceReport">
<image src="../../static/images/banner/icon1.png" mode="widthFix"></image>
<text class="text">我的报修</text>
</view>
@ -64,19 +70,23 @@
</view>
</view>
<view class="btn" @click="handleLogout">退出登录</view>
</view>
</view>
</template>
<script>
import storage from '@/utils/storage'
import {
getInfo
} from '@/api/login'
export default {
data() {
return {
name: this.$store.state.user.name,
version: getApp().globalData.config.appInfo.version,
bgOpacity: 0,
user:''
}
},
computed: {
@ -88,41 +98,27 @@
}
},
methods: {
getInfo() {
getInfo().then(res => {
this.user = res.data
})
},
handleToInfo() {
this.$tab.navigateTo('/pages/mine/info/index')
},
handleToEditInfo() {
this.$tab.navigateTo('/pages/mine/changePassword')
},
handleToSetting() {
this.$tab.navigateTo('/pages/mine/setting/index')
},
handleToLogin() {
this.$tab.reLaunch('/pages/login')
},
handleToAvatar() {
this.$tab.navigateTo('/pages/mine/avatar/index')
handleDeviceReport() {
this.$tab.navigateTo('/pages/deviceReport/myDeviceReport')
},
handleLogout() {
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
this.$store.dispatch('LogOut').then(() => {
this.$tab.reLaunch('/pages/index')
this.$tab.reLaunch('/pages/login')
})
})
},
handleHelp() {
this.$tab.navigateTo('/pages/mine/help/index')
},
handleAbout() {
this.$tab.navigateTo('/pages/mine/aboutUs')
},
handleJiaoLiuQun() {
this.$modal.showToast('微信搜索 naidaguo 后,添加好友后拉你进技术交流群')
},
handleBuilding() {
this.$modal.showToast('模块建设中~')
}
onShow() {
this.getInfo()
},
onPageScroll(e) {
if (e.scrollTop > 0) {
@ -150,12 +146,12 @@
image {
width: 100%;
height:370rpx
height: calc(var(--status-bar-height) + 370rpx);
}
.info {
position: absolute;
top: 110rpx;
top: calc(var(--status-bar-height) + 110rpx);
left: 80rpx;
right: 80rpx;
display: flex;
@ -182,12 +178,14 @@
font-weight: bold;
line-height: 60rpx;
margin-right: 20rpx;
span {
font-weight: normal;
font-size: 28rpx;
padding-left: 20rpx;
}
}
.tips {
padding: 10rpx 20rpx;
background: #3952ae;
@ -220,10 +218,22 @@
font-size: 26rpx;
}
}
.action-item1 {
margin-top: 26rpx;
}
}
}
}
.btn {
width: calc(100vw - 60rpx);
margin: 0 auto;
background-color: rgb(64, 158, 255);
color: #FFFFFF;
height: 90rpx;
line-height: 90rpx;
text-align: center;
border-radius: 10rpx;
font-size: 32rpx;
}
</style>

349
pages/repairOrder/addForm.vue

@ -0,0 +1,349 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" label-width="160rpx">
<u-form-item label="故障描述" prop="describes" required>
<u-input v-model="form.describes" placeholder="请输入故障描述" :disabled="form&&form.id" />
</u-form-item>
<u-form-item :label="`${type=='DEVICE'?'设备' : '模具'}名称`" prop="deviceNumber" required>
<view class="select" @click="openSingleColumn('deviceNumber',form.deviceNumber,deviceList)">
<view class="input" v-if='form.deviceNumber'>
{{selectFormat(form.deviceNumber,deviceList)}}
</view>
<view class="placeholder" v-else>
{{`请输入${type=='DEVICE'?'设备' : '模具'}名称`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon>
</view>
</u-form-item>
<u-form-item label="所属厂区" prop="factoryAreaName" required>
<u-input v-model="form.factoryAreaName" placeholder="请输入所属厂区" disabled />
</u-form-item>
<u-form-item label="班次" prop="classes" required>
<view class="select" @click="openSingleColumn('classes',form.classes,maintenanceShift)">
<view class="input" v-if='form.classes'>
{{selectFormat(form.classes,maintenanceShift)}}
</view>
<view class="placeholder" v-else>
{{`请选择班次`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="故障类型" prop="classes" required>
<view class="select" @click="openSingleColumn('faultType',form.faultType,faultType)">
<view class="input" v-if='form.faultType'>
{{selectFormat(form.faultType,faultType)}}
</view>
<view class="placeholder" v-else>
{{`请选择故障类型`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn"></u-select>
</view>
</template>
<script>
import * as deviceApi from "@/api/device.js"
import * as dictApi from "@/api/dict.js"
import * as repairOrderApi from "@/api/repairOrder.js"
export default {
data() {
return {
loading: false,
type: "",
form: {
id: '',
describes: "",
deviceNumber: '',
deviceName: '',
factoryAreaName: '',
factoryAreaNumber: '',
classes: '',
faultType: ''
},
deviceList: [], //
singleColumnShow: false,
singleColumnDefaultValue: [],
singleColumnList: [],
field: '',
maintenanceShift: [], //
faultType: [], //
}
},
methods: {
//
submit() {
//
if (!this.form.describes) {
this.$modal.showToast('请输入故障描述')
return;
}
if (!this.form.deviceName) {
this.$modal.showToast(`请选择${this.type=='DEVICE'?'设备' : '模具'}名称`)
return;
}
if (!this.form.factoryAreaName) {
this.$modal.showToast('请输入区域')
return;
}
if (!this.form.classes) {
this.$modal.showToast('请选择班次')
return;
}
if (!this.form.classes) {
this.$modal.showToast('请选择班次')
return;
}
const data = {
id: this.form && this.form.id ? this.form.id : '',
describes: this.form.describes,
deviceNumber: this.form.deviceNumber,
factoryAreaNumber: this.form.factoryAreaNumber,
classes: this.form.classes,
faultType: this.form.faultType,
type: this.type
}
if (this.form.id) {
this.$modal.confirm('是否修改维修工单').then(() => {
this.$modal.loading('加载中')
this.loading = true
repairOrderApi.repairOrderUpdate(data).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('修改成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('添加失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
} else {
this.$modal.confirm('是否添加维修工单').then(() => {
this.$modal.loading('加载中')
this.loading = true
repairOrderApi.repairOrderCreate(data).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('添加成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('添加失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
}
},
//
reset() {
if (this.form.id) {
this.form.classes = '';
this.form.faultType = ''
} else {
this.form = {}
}
},
//
selectFormat(val, array) {
let str = array.filter(item => item.value == val)[0].label
return str
},
//
openSingleColumn(field, val, list) {
if (field == 'deviceNumber' && this.form.id) return;
this.singleColumnList = list
this.field = field
if (val) {
this.singleColumnDefaultValue = [list.findIndex(item => item.value == val)]
} else {
this.singleColumnDefaultValue = []
}
this.singleColumnShow = true
},
//
chooseSingleColumn(e) {
console.log(e[0])
this.form[this.field] = e[0].value
if (this.field == 'deviceNumber') {
this.choosesingleColumnItem = this.singleColumnList.filter(item => item.number == e[0].value)
this.form.factoryAreaName = this.choosesingleColumnItem[0].factoryAreaName
this.form.factoryAreaNumber = this.choosesingleColumnItem[0].factoryAreaNumber
// this.form.deviceNumber = e[0].value
}
this.singleColumnShow = false
this.$emit('singleColumn', this.field, this.form[this.field])
this.$forceUpdate()
},
//
async getDeviceList() {
await deviceApi.deviceList({
type: this.type,
id: ''
}).then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
this.deviceList = res.data
})
},
},
async onLoad(option) {
if (option.type) this.type = option.type;
if (option.data) {
let data = JSON.parse(decodeURIComponent(option.data))
this.form = {
id: data.id,
describes: data.describes,
deviceNumber: data.deviceNumber,
deviceName: data.name,
factoryAreaName: data.factoryAreaName,
factoryAreaNumber: data.factoryAreaNumber,
classes: data.classes ? data.classes : '0',
faultType: data.faultType,
// faultTypeName:data.faultTypeName,
}
};
await this.getDeviceList()
this.maintenanceShift = await dictApi.getDict('maintenance_shift')
this.faultType = await dictApi.getDict('fault_type')
}
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 30rpx 140rpx;
}
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
image {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
}
.dec1 {
font-size: 28rpx;
margin-top: 16rpx;
color: #acacac;
}
.dec2 {
font-size: 28rpx;
margin-top: 6rpx;
color: #acacac;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
</style>

363
pages/repairOrder/detail.vue

@ -0,0 +1,363 @@
<template>
<!-- 详情 -->
<view class="detail-container">
<view class="info">
<view class="title">
<view>维修工单</view>
<view>转办</view>
</view>
<view class="dec">
<view class="dec-item">
<view>工单单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>报修描述</view>
<view>{{data.describes}}</view>
</view>
<view class="dec-item">
<view>班次</view>
<view>{{data.classesName}}</view>
</view>
<view class="dec-item">
<view>故障类型</view>
<view>{{data.faultTypeName}}</view>
</view>
<view class="dec-item">
<view>维修工</view>
<view>{{data.maintenance}}</view>
</view>
</view>
</view>
<view class="info" style="padding-bottom: 130rpx;">
<view class="tab">
<u-tabs :list="list" :is-scroll="false" bar-height="2" bar-width="250" v-model="current"
@change="change"></u-tabs>
</view>
<view>
<view class="title">
<view>{{changeItem.name}}</view>
</view>
<view class="dec" v-if="current == 0">
<view class="dec-item">
<view>设备编号</view>
<view>{{deviceInfo.number}}</view>
</view>
<view class="dec-item">
<view>设备名称</view>
<view>{{deviceInfo.name}}</view>
</view>
<view class="dec-item">
<view>所属厂区</view>
<view>{{deviceInfo.factoryAreaName}}</view>
</view>
<view class="dec-item">
<view>设备类型</view>
<view>{{deviceInfo.typeName}}</view>
</view>
</view>
<view class="dec" v-if="current == 1">
<view class="dec-item">
<view>工单单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>报修描述</view>
<view>{{data.describes}}</view>
</view>
<view class="dec-item">
<view>维修工</view>
<view>{{data.maintenance}}</view>
</view>
</view>
<view class="dec" v-if="current == 2">
<SparePartsCard :subForm='subForm' :data='data' @addSubForm='addSubForm'
@delSubFormItem='delSubFormItem'>
</SparePartsCard>
</view>
</view>
</view>
<view class="footer">
<view class="btns">
<u-button type="primary" v-if="data.status == 'PENDING'" @click="orderClick()" :loading='loading' :disabled='loading'>接单</u-button>
<u-button type="primary" v-if="data.status == 'PECEIVED'" @click="orderClick()" :loading='loading' :disabled='loading'>完成</u-button>
<u-button type="primary" v-if="data.status == 'COMPLETED'" @click="orderClick()" :loading='loading' :disabled='loading'>验证完结</u-button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加记录</view>
<view class="popup">
<Form :form='subForm' :data='data' ref="form2"></Form>
</view>
<view class="popup-footer">
<view @click="cancle">取消</view>
<view class="sure" @click="addSpare">确认</view>
</view>
</u-popup>
</view>
</template>
<script>
import Form from '@/components/form/index.vue'
import SparePartsCard from '@/components/sparePartsCard/index.vue'
import * as deviceApi from "@/api/device.js"
import * as repairOrderApi from "@/api/repairOrder.js"
export default {
components: {
Form,
SparePartsCard
},
data() {
return {
list: [{
name: '设备信息'
}, {
name: '报修信息'
}, {
name: '维修记录'
}],
current: 0,
changeItem: '',
data: '', //
loading: false,
type: "",
deviceInfo: '', //
isPopupShow: false,
subForm: {
formLabel: '',
formField: 'subList',
required: true,
isShowButton: true,
disabled: false,
visible: true,
loading: false,
labelWidth: '180rpx',
border: true,
errorType: ['toast'],
formData: [{
type: 'singleColumn',
field: 'name',
label: '模具',
disabled: false,
required: true,
span: 12,
list: [{
label: '类型1',
value: 1
}, {
label: '类型2',
value: 2
}, {
label: '类型3',
value: 3
}]
}, {
type: 'text',
field: 'stork',
label: '库存',
disabled: false,
required: true,
isList: true,
span: 6
}, {
type: 'text',
field: 'number',
label: '数量',
disabled: false,
required: true,
isList: true,
span: 6
}],
},
}
},
methods: {
change(index) {
console.log("index", index);
this.current = index
this.changeItem = this.list[this.current]
},
//
addSubForm() {
console.log(5)
this.isPopupShow = true
},
//
addSpare() {
},
//
cancle() {
this.isPopupShow = false
},
// /
getDetailsByNumber() {
const data = {
number: this.data.deviceNumber,
type: this.type,
id: ''
}
deviceApi.getDetailsByNumber(data).then((res) => {
if (res.data) {
this.deviceInfo = res.data
} else {
this.$modal.showToast(`找不到该${this.type=='DEVICE'?'设备' : '模具'}`)
}
})
},
// APP
orderClick() {
const data = {
number: this.data.number,
status: this.data.status,
id: this.data.id,
requestNumber: ''
}
let tips = this.data.status == 'PENDING' ? '是否接单?' : this.data.status == 'PECEIVED'?'是否完成?' : this.data.status == 'COMPLETED'?'是否验证完结?':''
this.$modal.confirm(tips).then(() => {
this.$modal.loading('加载中')
this.loading = true
repairOrderApi.orderClick(data).then((res) => {
if (res.data) {
this.$modal.showToast('操作成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('操作失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
}
},
onLoad(option) {
if (option.type) this.type = option.type;
if (option.data) {
this.data = JSON.parse(decodeURIComponent(option.data))
}
this.changeItem = this.list[this.current]
this.getDetailsByNumber()
}
}
</script>
<style lang="scss" scoped>
.info {
background: white;
margin-bottom: 20rpx;
}
.tab {
border-bottom: 1px solid #e4e4e4;
}
.title {
display: flex;
align-items: center;
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
view {
&:nth-child(1) {
flex: 1;
border-left: 10rpx solid #409eff;
padding-left: 20rpx;
font-weight: bold;
}
}
}
.dec {
padding: 30rpx;
.dec-item {
padding-bottom: 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 160rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
}
}
}
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx
}
.popup {
width: 600rpx;
padding: 0rpx 60rpx 0rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
background: white;
z-index: 22;
}
.btns {
display: flex;
padding: 20rpx;
box-shadow: 0px -2rpx 20rpx rgba(0, 0, 0, 0.1);
button {
flex: 1;
margin: 0px 10rpx;
}
.sure {
background: #409eff;
color: white;
border-radius: 8rpx;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
}
</style>

256
pages/repairOrder/index.vue

@ -0,0 +1,256 @@
<template>
<!-- 维修工单 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="维修工单">
<template v-slot:right>
<u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm"></u-icon>
</template>
</u-navbar>
<!-- <Search @search='search' @screen='screen'/> -->
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" >
<view class="" @click="itemClick(item,index)">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<u-tag text="待接单" v-if="item.status == 'PENDING'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/>
<u-tag text="已撤回" v-else-if="item.status=='REJECTED'" bg-color='rgba(255,255,255,0)' color='#d7d7d7' border-color='#d7d7d7 ' type="warning" shape='circle'/>
<u-tag text="已转办" v-else-if="item.status=='TRANSFERRED'" bg-color='rgba(255,255,255,0)' color='#e01f54' border-color='#e01f54' type="success" shape='circle'/>
<u-tag text="已接单" v-else-if="item.status=='PECEIVED'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="error" shape='circle'/>
<u-tag text="已验证" v-else-if="item.status=='VERIFIED'" bg-color='rgba(255,255,255,0)' color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle'/>
<u-tag text="已完成" v-else-if="item.status=='COMPLETED'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
</view>
<view class="dec">
报修单号:<span>{{item.number}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="dec">
班次:<span>{{item.classesName}}</span>
</view>
<view class="dec">
故障类型:<span>{{item.faultTypeName}}</span>
</view>
</view>
<view class="bottom">
<view class="time" style="flex: 1;">
{{`${$time.formatDate(item.createTime)}`}}
</view>
<view class="status">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;" @click="addForm(item)">编辑</u-button>
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script>
import workOrderList from '@/components/workOrderList/index.vue'
import * as repairOrderApi from "@/api/repairOrder.js"
export default {
components: {
workOrderList
},
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
type: ''
},
status: 'loadmore', //
list: [],
}
},
methods: {
//
screen() {
this.$tab.navigateTo(`/pages/repairOrder/screen?type=${this.params.type}`)
},
itemClick(item, index) {
this.$tab.navigateTo(`/pages/repairOrder/detail?type=${this.params.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
},
addForm(item) {
this.$tab.navigateTo(`/pages/repairOrder/addForm?type=${this.params.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
},
//
getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
repairOrderApi.repairOrderPage(this.params).then((res) => {
this.$modal.closeLoading()
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
//
cancle(item) {
this.$modal.confirm('确定撤销报修吗?').then(() => {
this.$modal.loading('加载中')
deviceApi.rejected(item.id).then((res) => {
this.$modal.closeLoading()
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
})
})
}
},
onLoad(option) {
if (option.type) this.params.type = option.type;
},
onShow() {
uni.$on('screen',(data)=>{
console.log(data)
this.params = {...this.params,...data}
})
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onUnload() {
uni.$off('screen')
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.button {
position: absolute;
right: 0rpx;
}
}
}
}
</style>

230
pages/repairOrder/myDeviceReport.vue

@ -0,0 +1,230 @@
<template>
<!-- 我的维修工单 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="我的报修">
</u-navbar>
<Search @search='search' @screen='screen'/>
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="itemClick(item,index)">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<view class="time">
2023-12-12 08:00:00
</view>
</view>
<view class="dec">
报修单号:<span>{{item.number}}</span>
</view>
<view class="dec">
设备编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
设备名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="已报修" v-if="item.result=='已报修'" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="primary" shape='circle' />
</view>
<view class="button">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;"
v-if="item.isCancel == 0" @click="cancle(item)">撤销</u-button>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script>
import workOrderList from '@/components/workOrderList/index.vue'
import * as deviceApi from "@/api/device.js"
export default {
components: {
workOrderList
},
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
type: 'DEVICE',
flag:1
},
status: 'loadmore', //
list: [],
}
},
methods: {
//
screen() {
this.$tab.navigateTo(`/pages/deviceReport/screen?type=${this.type}`)
},
itemClick(item, index) {
this.$tab.navigateTo(`/pages/workOrderList/detail?type=${this.type}`)
},
addForm() {
this.$tab.navigateTo(`/pages/deviceReport/addForm?type=${this.params.type}`)
},
//
getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
deviceApi.deviceRepairPage(this.params).then((res) => {
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
//
cancle(item){
this.$modal.confirm('确定撤销报修吗?').then(()=>{
deviceApi.rejected(item.id).then((res) => {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
})
})
}
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.list {
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.status {
flex: 1;
}
.button{
position: absolute;
right: 0rpx;
}
}
}
}
</style>

261
pages/repairOrder/screen.vue

@ -0,0 +1,261 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" label-width="160rpx">
<u-form-item label="故障描述" prop="describes">
<u-input v-model="form.describes" placeholder="请输入故障描述" />
</u-form-item>
<u-form-item :label="`${type=='DEVICE'?'设备' : '模具'}名称`" prop="deviceName">
<view class="select" @click="openSingleColumn('deviceName',form.deviceName,deviceList)">
<view class="input" v-if='form.deviceName'>
{{selectFormat(form.deviceName,deviceList)}}
</view>
<view class="placeholder" v-else>
{{`请输入${type=='DEVICE'?'设备' : '模具'}名称`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="所属厂区" prop="factoryAreaName">
<u-input v-model="form.factoryAreaName" placeholder="请输入所属厂区" disabled />
</u-form-item>
<u-form-item label="班次" prop="classes">
<view class="select" @click="openSingleColumn('classes',form.classes,maintenanceShift)">
<view class="input" v-if='form.classes'>
{{selectFormat(form.classes,maintenanceShift)}}
</view>
<view class="placeholder" v-else>
{{`请选择班次`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="故障类型" prop="classes" >
<view class="select" @click="openSingleColumn('faultType',form.faultType,faultType)">
<view class="input" v-if='form.faultType'>
{{selectFormat(form.faultType,faultType)}}
</view>
<view class="placeholder" v-else>
{{`请选择故障类型`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue' :list="singleColumnList" @confirm="chooseSingleColumn"></u-select>
</view>
</template>
<script>
import * as deviceApi from "@/api/device.js"
import * as dictApi from "@/api/dict.js"
import * as repairOrderApi from "@/api/repairOrder.js"
export default {
data() {
return {
loading:false,
type:"",
form: {
describes: "",
deviceNumber: '',
deviceName: '',
factoryAreaName: '',
factoryAreaNumber: '',
classes:'',
faultType:''
},
deviceList:[],//
singleColumnShow:false,
singleColumnDefaultValue:[],
singleColumnList:[],
field:'',
maintenanceShift:[],//
faultType:[],//
}
},
methods: {
//
submit() {
const data = {
describes: this.form.describes,
deviceNumber: this.form.deviceNumber,
factoryAreaNumber: this.form.factoryAreaNumber,
classes:this.form.classes,
faultType:this.form.faultType,
type: this.type
}
uni.$emit('screen',data)
this.$tab.navigateBack()
},
//
reset() {
console.log('表单数据信息1:', this.data);
this.form = {}
},
//
selectFormat(val,array){
let str = array.filter(item=>item.value == val)[0].label
return str
},
//
openSingleColumn(field,val,list){
this.singleColumnList = list
this.field = field
if(val){
this.singleColumnDefaultValue = [list.findIndex(item=>item.value==val)]
}else{
this.singleColumnDefaultValue = []
}
this.singleColumnShow = true
},
//
chooseSingleColumn(e){
console.log( e[0])
this.form[this.field] = e[0].value
if(this.field == 'deviceName'){
this.choosesingleColumnItem = this.singleColumnList.filter(item=>item.number == e[0].value)
this.form.factoryAreaName = this.choosesingleColumnItem[0].factoryAreaName
this.form.factoryAreaNumber = this.choosesingleColumnItem[0].factoryAreaNumber
this.form.deviceNumber = e[0].value
}
this.singleColumnShow = false
this.$emit('singleColumn',this.field,this.form[this.field])
this.$forceUpdate()
},
//
getDeviceList(){
deviceApi.deviceList({
type:this.type,
id:''
}).then(res=>{
res.data.map(item=>{
item.value = item.number
item.label = item.name
})
this.deviceList = res.data
})
},
},
async onLoad(option) {
if (option.type) this.type = option.type;
this.getDeviceList()
this.maintenanceShift = await dictApi.getDict('maintenance_shift')
this.faultType = await dictApi.getDict('fault_type')
}
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 30rpx 140rpx;
}
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
image {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
}
.dec1 {
font-size: 28rpx;
margin-top: 16rpx;
color: #acacac;
}
.dec2 {
font-size: 28rpx;
margin-top: 6rpx;
color: #acacac;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select{
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input{
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder{
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
</style>

107
pages/workOrderList/addForm.vue

@ -1,7 +1,7 @@
<template>
<!-- 设备 -->
<view class="add-form-container">
<Form :form='form' :data='data' ref="form1"></Form>
<Form :form='form' :data='data' ref="form1" @chickRightButton='chickRightButton' @blur='blur'></Form>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
@ -14,12 +14,14 @@
<script>
import Form from '@/components/form/index.vue'
import * as deviceApi from "@/api/device.js"
export default {
components: {
Form
},
data() {
return {
type:'',
form: {
disabled: false,
visible: true,
@ -70,31 +72,67 @@
data: {
name: '',
sex: 2,
hobby: [1, 2],
open: true,
duoxuan: 3,
deviceNumber:'',
deviceName: '',
factoryName: '',
time: '2023-12-12 08:00:00'
}
}
},
methods: {
//
submit() {
//
for (let i = 0; i < this.form.formData.length; i++) {
if (this.form.formData[i].required === true) {
if (!this.data[this.form.formData[i].field]) {
let placeholder = '请输入'
if (this.form.formData[i].type == 'text' || this.form.formData[i].type == 'textarea') {
placeholder = '请输入'
} else {
placeholder = '请选择'
//
chickRightButton(field) {
//
if(field == 'deviceNumber'){
uni.scanCode({
success: function (res) {
this.data.deviceNumber = res.result
this.getDetailsByNumber()
}
this.$modal.showToast(placeholder + this.form.formData[i].label)
return;
});
}
},
blur(val,field){
console.log(field)
this.data.deviceNumber = val
if(field == 'deviceNumber'){
this.getDetailsByNumber()
}
},
// /
getDetailsByNumber(){
const data = {
number :this.data.deviceNumber,
type:this.type,
id:''
}
console.log(data)
deviceApi.getDetailsByNumber(data).then((res)=>{
this.data.deviceName = res.data.name
this.data.factoryName = res.data.factoryName
this.$forceUpdate()
})
},
//
submit() {
//
if(this.type == 1){
}
// for (let i = 0; i < this.form.formData.length; i++) {
// if (this.form.formData[i].required === true) {
// if (!this.data[this.form.formData[i].field]) {
// let placeholder = ''
// if (this.form.formData[i].type == 'text' || this.form.formData[i].type == 'textarea') {
// placeholder = ''
// } else {
// placeholder = ''
// }
// this.$modal.showToast(placeholder + this.form.formData[i].label)
// return;
// }
// }
// }
console.log('表单数据信息1:', this.data);
},
//
@ -110,6 +148,41 @@
uni.setNavigationBarTitle({
title:'添加报修'
})
this.type = 'DEVICE'
this.form= {
disabled: false,
visible: true,
loading: false,
labelWidth: '180rpx',
border: true,
errorType: ['toast'],
formData: [{
type: 'text',
field: 'describes',
label: '故障描述',
disabled: false,
required: true,
value: ''
}, {
type: 'text',
field: 'deviceNumber',
label: '设备编码',
disabled: false,
required: true,
value: '',
isRightButton: '扫描'
}, {
type: 'text',
field: 'deviceName',
label: '设备名称',
required: true,
}, {
type: 'text',
field: 'factoryName',
label: '所属厂区',
required: true,
}],
}
}else if(option.type == 2){
uni.setNavigationBarTitle({
title:'添加维修工单'

4
pages/workOrderList/index.vue

@ -92,7 +92,9 @@
},
addForm(){
this.$tab.navigateTo(`/pages/workOrderList/addForm?type=${this.type}`)
}
},
//
},
onLoad(option) {
this.type = option.type

46
permission.js

@ -5,7 +5,7 @@ const loginPage = "/pages/login"
// 页面白名单
const whiteList = [
'/pages/login', '/pages/common/webview/index'
'/pages/login', '/pages/index'
]
// 检查地址白名单
@ -15,25 +15,25 @@ function checkWhite(url) {
}
// 页面跳转验证拦截器
// let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"]
// list.forEach(item => {
// uni.addInterceptor(item, {
// invoke(to) {
// if (getAccessToken()) {
// if (to.path === loginPage) {
// uni.reLaunch({ url: "/" })
// }
// return true
// } else {
// if (checkWhite(to.url)) {
// return true
// }
// uni.reLaunch({ url: loginPage })
// return false
// }
// },
// fail(err) {
// console.log(err)
// }
// })
// })
let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"]
list.forEach(item => {
uni.addInterceptor(item, {
invoke(to) {
if (getAccessToken()) {
if (to.path === loginPage) {
uni.reLaunch({ url: "/" })
}
return true
} else {
if (checkWhite(to.url)) {
return true
}
uni.reLaunch({ url: loginPage })
return false
}
},
fail(err) {
console.log(err)
}
})
})

3
plugins/index.js

@ -1,6 +1,7 @@
import tab from './tab'
import auth from './auth'
import modal from './modal'
import time from './time'
export default {
install(Vue) {
@ -10,5 +11,7 @@ export default {
Vue.prototype.$auth = auth
// 模态框对象
Vue.prototype.$modal = modal
// 时间对象
Vue.prototype.$time = time
}
}

1
plugins/modal.js

@ -64,7 +64,6 @@ export default {
loading(content) {
uni.showLoading({
title: content,
icon: 'none'
})
},
// 关闭遮罩层

19
plugins/time.js

@ -0,0 +1,19 @@
export default {
formatDate(timestamp){
// 获取当前时间戳(单位:毫秒)
// var timestamp = Date.now(); // 或者传入特定的时间戳值
// 创建Date对象并设置时间戳
var dateObj = new Date(timestamp);
// 提取年份、月份、日期等信息
var year = dateObj.getFullYear();
var month = (dateObj.getMonth() + 1).toString().padStart(2, '0'); // 注意月份从0开始计数,所以需要加1
var day = dateObj.getDate().toString().padStart(2, '0');
var hour = dateObj.getHours().toString().padStart(2, '0');
var minutes = dateObj.getMinutes().toString().padStart(2, '0');
var seconds = dateObj.getSeconds().toString().padStart(2, '0');
return `${year}-${month}-${day} ${hour}:${minutes}:${seconds}`
}
}

2
static/scss/colorui.css

@ -11,7 +11,7 @@
初始化
==================== */
body {
background-color: #f1f1f1;
background-color: #f5f5f5;
font-size: 28upx;
color: #333333;
font-family: Helvetica Neue, Helvetica, sans-serif;

2
store/getters.js

@ -3,6 +3,6 @@ const getters = {
avatar: state => state.user.avatar,
name: state => state.user.name,
roles: state => state.user.roles,
permissions: state => state.user.permissions
permissions: state => state.user.permissions,
}
export default getters

16
store/modules/user.js

@ -1,7 +1,7 @@
import config from '@/config'
import storage from '@/utils/storage'
import constant from '@/utils/constant'
import { login, logout, getInfo } from '@/api/login'
import { login, logout, getInfo,getPermissionInfo } from '@/api/login'
import { setToken, removeToken } from '@/utils/auth'
const baseUrl = config.baseUrl
@ -43,8 +43,12 @@ const user = {
const username = userInfo.username.trim()
const password = userInfo.password
const captchaVerification = userInfo.captchaVerification
const tenantName = userInfo.tenantName
const rememberMe = userInfo.rememberMe
const code = userInfo.code
const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
login(username, password, captchaVerification).then(res => {
login(username, password, captchaVerification,tenantName,rememberMe,code,uuid).then(res => {
res = res.data;
// 设置 token
setToken(res)
@ -55,12 +59,12 @@ const user = {
})
},
// 获取用户信息
GetInfo({ commit, state }) {
// 获取权限
GetPermissionInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
getPermissionInfo().then(res => {
res = res.data; // 读取 data 数据
const user = res.user
// const user = res.user
const avatar = (user == null || user.avatar === "" || user.avatar == null) ? require("@/static/images/profile.jpg") : user.avatar
const nickname = (user == null || user.nickname === "" || user.nickname == null) ? "" : user.nickname
if (res.roles && res.roles.length > 0) {

2
utils/constant.js

@ -2,7 +2,7 @@ const constant = {
avatar: 'vuex_avatar',
name: 'vuex_name',
roles: 'vuex_roles',
permissions: 'vuex_permissions'
permissions: 'vuex_permissions',
}
export default constant

2
utils/storage.js

@ -4,7 +4,7 @@ import constant from './constant'
let storageKey = 'storage_data'
// 存储节点变量名
let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions]
let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions,constant.user]
// 存储的数据
let storageData = uni.getStorageSync(storageKey) || {}

Loading…
Cancel
Save