Browse Source

模具,设备列表

master
zhang_li 10 months ago
parent
commit
7dfc1fdd4c
  1. 14
      api/device.js
  2. 25
      api/mold.js
  3. 15
      components/search/index.vue
  4. 6
      pages.json
  5. 66
      pages/device/index.vue
  6. 242
      pages/device/screen.vue
  7. 32
      pages/deviceReport/addForm.vue
  8. 4
      pages/deviceReport/index.vue
  9. 2
      pages/index.vue
  10. 27
      pages/mine/index.vue
  11. 138
      pages/mold/index.vue
  12. 29
      pages/repairOrder/addForm.vue
  13. 10
      pages/repairOrder/myRepairOrder.vue
  14. 2
      permission.js

14
api/device.js

@ -1,7 +1,7 @@
import request from '@/utils/request' import request from '@/utils/request'
// 根据设备/模具号查询信息 // 根据设备号查询信息
export function getDetailsByNumber(params) { export function getDeviceDetailsByNumber(params) {
return request({ return request({
url: '/eam/device-accounts/getDetailsByNumber', url: '/eam/device-accounts/getDetailsByNumber',
'method': 'GET', 'method': 'GET',
@ -25,7 +25,7 @@ export function deviceRepairPage(params) {
}) })
} }
// 报修列表 // 撤销
export function rejected(id) { export function rejected(id) {
return request({ return request({
url: '/eam/device-repair/rejected?id='+id, url: '/eam/device-repair/rejected?id='+id,
@ -40,3 +40,11 @@ export function deviceList(params) {
params params
}) })
} }
// 设备分页列表
export function devicePage(params) {
return request({
url: '/eam/device-accounts/getAppPage',
'method': 'GET',
params
})
}

25
api/mold.js

@ -0,0 +1,25 @@
import request from '@/utils/request'
// 根据模具号查询信息
export function getMoldDetailsByNumber(params) {
return request({
url: '/eam/mold-accounts/getDetailsByNumber',
'method': 'GET',
params
})
}
// 模具分页列表
export function moldPage(params) {
return request({
url: '/eam/mold-accounts/getAppPage',
'method': 'GET',
params
})
}
// 模具列表
export function moldList(params) {
return request({
url: '/eam/mold-accounts/selectData',
'method': 'GET',
params
})
}

15
components/search/index.vue

@ -2,13 +2,16 @@
<view class="content"> <view class="content">
<view class="screen-input"> <view class="screen-input">
<u-search <u-search
v-model='keyWord'
:show-action='false' :show-action='false'
:bg-color="search.bgBolor ||'white'" :bg-color="searchData.bgBolor ||'white'"
:border-color="search.borderColor ||'#E4E4E4'" :border-color="searchData.borderColor ||'#E4E4E4'"
:shape="search.shape ||'square'" :shape="searchData.shape ||'square'"
:height="search.height || 80" :height="searchData.height || 80"
:placeholder="search.placeholder ||'请输入设备编码或设备名称'" :placeholder="searchData.placeholder ||'请输入设备名称'"
:clearabled="true"> :clearabled="true"
@search='search'
>
</u-search> </u-search>
</view> </view>
<view class="screen-btn" @click="screen" v-if="isShowScreen"> <view class="screen-btn" @click="screen" v-if="isShowScreen">

6
pages.json

@ -15,7 +15,9 @@
}, { }, {
"path": "pages/mold/index", "path": "pages/mold/index",
"style": { "style": {
"navigationBarTitleText": "模具" "navigationBarTitleText": "模具",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
} }
}, { }, {
"path": "pages/spareParts/index", "path": "pages/spareParts/index",
@ -81,7 +83,7 @@
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
} }
},{ },{
"path": "pages/repairOrder/myDeviceReport", "path": "pages/repairOrder/myRepairOrder",
"style": { "style": {
"navigationBarTitleText": "维修工单", "navigationBarTitleText": "维修工单",
"navigationStyle": "custom" "navigationStyle": "custom"

66
pages/device/index.vue

@ -1,10 +1,11 @@
<template> <template>
<!-- 设备 --> <!-- 设备 -->
<view class="work-container"> <view class="work-container">
<Search @search='search' @screen='screen'/> <Search @search='search' @screen='screen' :isShowScreen='false' />
<view class="list"> <view class="list">
<view class="item" v-for="index in 6" :key='index'> <view class="item" v-for="(item,index) in list" :key='index'>
<u-image src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png" width='160' height="160"> <u-image :src="item.images" width='160'
height="160">
<template v-slot:error> <template v-slot:error>
<view class="image-error"> <view class="image-error">
<u-icon name="photo" color="#c7c7c7" size="38"></u-icon> <u-icon name="photo" color="#c7c7c7" size="38"></u-icon>
@ -14,38 +15,77 @@
</u-image> </u-image>
<view class="text"> <view class="text">
<view class="title"> <view class="title">
电梯设备 {{item.name}}
</view> </view>
<view class="dec1"> <view class="dec1">
SB52225456 {{item.number}}
</view> </view>
<view class="dec2"> <view class="dec2">
四厂区二楼三车间 {{item.factoryAreaName}}
</view> </view>
</view> </view>
</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 style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view> </view>
</template> </template>
<script> <script>
import * as deviceApi from "@/api/device.js"
export default { export default {
data() { data() {
return { return {
params: {
pageNo: 1,
pageSize: 10,
type: '',
name:''
},
status: 'loadmore', //
list: [],
} }
}, },
methods: { methods: {
// //
search(keyWord) { search(keyWord) {
console.log(keyWord) this.params.name = keyWord
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
}, },
// //
screen() { screen() {
console.log(222)
this.$tab.navigateTo(`/pages/device/screen`) this.$tab.navigateTo(`/pages/device/screen`)
} },
//
getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
deviceApi.devicePage(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'
}
})
},
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.getList()
} }
} }
</script> </script>
@ -61,8 +101,9 @@
display: flex; display: flex;
align-items: center; align-items: center;
.text{ .text {
margin-left: 20rpx; margin-left: 20rpx;
.title { .title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
@ -82,7 +123,8 @@
} }
} }
} }
.image-error{
.image-error {
text-align: center; text-align: center;
} }
</style> </style>

242
pages/device/screen.vue

@ -1,242 +0,0 @@
<template>
<!-- 设备 -->
<view class="add-form-container">
<Form :form='form' :data='data' ref="form1"></Form>
<view class="footer">
<view class="btns">
<button class="reset">重置</button>
<button class="sure" @click="submit">确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</view>
</template>
<script>
import Form from '@/components/form/index.vue'
export default {
components: {
Form
},
data() {
return {
form: {
disabled: false,
visible: true,
loading: false,
labelWidth: '180rpx',
border: true,
errorType: ['toast'],
formData: [{
type: 'text',
field: 'code',
label: '设备编号',
disabled: false,
required: true,
value: ''
}, {
type: 'text',
field: 'name',
label: '设备名称',
disabled: false,
required: true,
value: ''
}, {
type: 'singleColumn',
field: 'location',
label: '存放位置',
list: [{
label: '位置1',
value: 1
}, {
label: '位置2',
value: 2
}, {
label: '位置3',
value: 3
}]
}, {
type: 'singleColumn',
field: 'type',
label: '设备类型',
list: [{
label: '类型1',
value: 1
}, {
label: '类型2',
value: 2
}, {
label: '类型3',
value: 3
}]
}, {
type: 'singleColumn',
field: 'dept',
label: '所在部门',
list: [{
label: '部门1',
value: 1
}, {
label: '部门2',
value: 2
}, {
label: '部门3',
value: 3
}]
}, {
type: 'singleColumn',
field: 'fuzeren',
label: '负责人',
list: [{
label: '负责人1',
value: 1
}, {
label: '负责人2',
value: 2
}, {
label: '负责人3',
value: 3
}]
}, {
type: 'singleColumn',
field: 'status',
label: '当前状态',
list: [{
label: '全部',
value: 1
}, {
label: '报废',
value: 2
}, {
label: '停用',
value: 3
}, {
label: '故障',
value: 4
}, {
label: '正常运行',
value: 5
}]
}],
rules: {
// name
name: [
{
min: 5,
message: '简介不能少于5个字',
trigger: 'change'
},
// name
{
required: true,
message: '请填写姓名',
trigger: ['change', 'blur']
},
]
}
},
data: {
name: '',
sex: 2,
hobby: [1, 2],
open: true,
duoxuan: 3,
time: '2023-12-12 08:00:00'
}
}
},
methods: {
//
submit() {
console.log('表单数据信息1:', this.data);
this.$refs.form1.$refs.form.validate().then(res => {
console.log('表单数据信息:', res);
}).catch(err => {
console.log('表单错误信息:', err);
})
},
//
reset() {
console.log('表单数据信息1:', this.data);
this.data={}
},
}
}
</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;
}
}
}
</style>

32
pages/deviceReport/addForm.vue

@ -31,6 +31,7 @@
<script> <script>
import * as deviceApi from "@/api/device.js" import * as deviceApi from "@/api/device.js"
import * as moldApi from "@/api/mold.js"
export default { export default {
data() { data() {
return { return {
@ -64,18 +65,29 @@
getDetailsByNumber() { getDetailsByNumber() {
const data = { const data = {
number: this.form.deviceNumber, number: this.form.deviceNumber,
type: this.type,
id: '' id: ''
} }
deviceApi.getDetailsByNumber(data).then((res) => { if(this.type == 'DEVICE'){
if (res.data) { deviceApi.getDeviceDetailsByNumber(data).then((res) => {
this.form.deviceName = res.data.name if (res.data) {
this.form.factoryAreaName = res.data.factoryAreaName this.form.deviceName = res.data.name
this.form.factoryAreaNumber = res.data.factoryAreaNumber this.form.factoryAreaName = res.data.factoryAreaName
} else { this.form.factoryAreaNumber = res.data.factoryAreaNumber
this.$modal.showToast(`找不到该${this.type=='DEVICE'?'设备' : '模具'}`) } else {
} this.$modal.showToast(`找不到该${this.type=='DEVICE'?'设备' : '模具'}`)
}) }
})
}else if(this.type == 'MOLD'){
moldApi.getMoldDetailsByNumber(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() { submit() {

4
pages/deviceReport/index.vue

@ -52,12 +52,8 @@
</template> </template>
<script> <script>
import workOrderList from '@/components/workOrderList/index.vue'
import * as deviceApi from "@/api/device.js" import * as deviceApi from "@/api/device.js"
export default { export default {
components: {
workOrderList
},
data() { data() {
return { return {
params: { params: {

2
pages/index.vue

@ -84,7 +84,7 @@
</view> </view>
</u-col> </u-col>
<u-col span="3"> <u-col span="3">
<view class="icon-item" @click="open('/pages/serviceWorkOrderList/index')"> <view class="icon-item" @click="open('/pages/repairOrder/index?type=MOLD')">
<image src="../static/images/icon5.svg" mode=""></image> <image src="../static/images/icon5.svg" mode=""></image>
<view>维修工单</view> <view>维修工单</view>
</view> </view>

27
pages/mine/index.vue

@ -7,15 +7,21 @@
<view class="header-section"> <view class="header-section">
<image src="../../static/images/bg.jpg" class="bg" mode=""></image> <image src="../../static/images/bg.jpg" class="bg" mode=""></image>
<view class="info" v-if="user"> <view class="info" v-if="user">
<image :src="user.avatar" class="cu-avatar" mode=""></image> <image :src="user.avatar" class="cu-avatar" mode="" v-if="user&&user.avatar"></image>
<view class="cu-avatar" v-else>
<u-icon name="account-fill" color="#ababab" size="100"></u-icon>
</view>
<view class="user-info"> <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="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 class="tips">{{user.dept.name}}</view>
</view> </view>
</view> </view>
<view class="info" v-else> <view class="info" v-else>
<image :src="avatar" class="cu-avatar" mode=""></image> <view class="cu-avatar">
<view class="user-info"> <u-icon name="account-fill" color="#ababab" size="100"></u-icon>
</view>
<view class="user-info" @click="handleLogin">
<view class="name">点击登录</view> <view class="name">点击登录</view>
</view> </view>
</view> </view>
@ -26,7 +32,7 @@
<image src="../../static/images/banner/icon1.png" mode="widthFix"></image> <image src="../../static/images/banner/icon1.png" mode="widthFix"></image>
<text class="text">我的报修</text> <text class="text">我的报修</text>
</view> </view>
<view class="action-item" @click="handleBuilding"> <view class="action-item" @click="handleRepairOrder">
<image src="../../static/images/banner/icon2.png" mode="widthFix"></image> <image src="../../static/images/banner/icon2.png" mode="widthFix"></image>
<text class="text">我的维修</text> <text class="text">我的维修</text>
</view> </view>
@ -70,7 +76,7 @@
</view> </view>
</view> </view>
<view class="btn" @click="handleLogout">退出登录</view> <view class="btn" @click="handleLogout" v-if="user">退出登录</view>
</view> </view>
</view> </view>
</template> </template>
@ -80,6 +86,7 @@
import { import {
getInfo getInfo
} from '@/api/login' } from '@/api/login'
import { getAccessToken } from '@/utils/auth'
export default { export default {
data() { data() {
return { return {
@ -109,6 +116,9 @@
handleDeviceReport() { handleDeviceReport() {
this.$tab.navigateTo('/pages/deviceReport/myDeviceReport') this.$tab.navigateTo('/pages/deviceReport/myDeviceReport')
}, },
handleRepairOrder() {
this.$tab.navigateTo('/pages/repairOrder/myRepairOrder')
},
handleLogout() { handleLogout() {
this.$modal.confirm('确定注销并退出系统吗?').then(() => { this.$modal.confirm('确定注销并退出系统吗?').then(() => {
this.$store.dispatch('LogOut').then(() => { this.$store.dispatch('LogOut').then(() => {
@ -116,9 +126,14 @@
}) })
}) })
}, },
handleLogin() {
this.$tab.navigateTo('/pages/login/index')
},
}, },
onShow() { onShow() {
this.getInfo() if (getAccessToken()) {
this.getInfo()
}
}, },
onPageScroll(e) { onPageScroll(e) {
if (e.scrollTop > 0) { if (e.scrollTop > 0) {

138
pages/mold/index.vue

@ -1,22 +1,134 @@
<template> <template>
<view class="work-container"> <!-- 设备 -->
1 <view class="work-container">
</view> <Search :searchData='searchData' @search='search' @screen='screen' :isShowScreen='false'/>
<view class="list">
<view class="item" v-for="(item,index) in list" :key='index'>
<u-image :src="item.images" width='160'
height="160">
<template v-slot:error>
<view class="image-error">
<u-icon name="photo" color="#c7c7c7" size="38"></u-icon>
<view style="font-size: 24rpx;">暂无图片</view>
</view>
</template>
</u-image>
<view class="text">
<view class="title">
{{item.name}}
</view>
<view class="dec1">
{{item.number}}
</view>
<view class="dec2">
{{item.factoryAreaName}}
</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> </template>
<script> <script>
export default { import * as moldApi from "@/api/mold.js"
data() { export default {
return { data() {
} return {
}, searchData:{
methods: { placeholder:'请输入模具名称'
},
} params: {
} pageNo: 1,
pageSize: 10,
type: '',
name:''
},
status: 'loadmore', //
list: [],
}
},
methods: {
//
search(keyWord) {
this.params.name = keyWord
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
//
screen() {
this.$tab.navigateTo(`/pages/device/screen`)
},
//
getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
moldApi.moldPage(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'
}
})
},
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.getList()
}
}
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
.text {
margin-left: 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;
}
}
}
}
.image-error {
text-align: center;
}
</style> </style>

29
pages/repairOrder/addForm.vue

@ -56,6 +56,7 @@
<script> <script>
import * as deviceApi from "@/api/device.js" import * as deviceApi from "@/api/device.js"
import * as moldApi from "@/api/mold.js"
import * as dictApi from "@/api/dict.js" import * as dictApi from "@/api/dict.js"
import * as repairOrderApi from "@/api/repairOrder.js" import * as repairOrderApi from "@/api/repairOrder.js"
@ -203,18 +204,26 @@
this.$emit('singleColumn', this.field, this.form[this.field]) this.$emit('singleColumn', this.field, this.form[this.field])
this.$forceUpdate() this.$forceUpdate()
}, },
// // /
async getDeviceList() { async getDeviceList() {
await deviceApi.deviceList({ if(this.type == 'DEVICE'){
type: this.type, await deviceApi.deviceList().then(res => {
id: '' res.data.map(item => {
}).then(res => { item.value = item.number
res.data.map(item => { item.label = item.name
item.value = item.number })
item.label = item.name this.deviceList = res.data
})
}else if(this.type == 'MOLD'){
await moldApi.moldList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
this.deviceList = res.data
}) })
this.deviceList = res.data }
})
}, },
}, },
async onLoad(option) { async onLoad(option) {

10
pages/repairOrder/myDeviceReport.vue → pages/repairOrder/myRepairOrder.vue

@ -2,7 +2,7 @@
<!-- 我的维修工单 --> <!-- 我的维修工单 -->
<view class="container"> <view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff' <u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="我的修"> title="我的修">
</u-navbar> </u-navbar>
<Search @search='search' @screen='screen'/> <Search @search='search' @screen='screen'/>
<view class="list"> <view class="list">
@ -48,12 +48,8 @@
</template> </template>
<script> <script>
import workOrderList from '@/components/workOrderList/index.vue' import * as repairOrderApi from "@/api/repairOrder.js"
import * as deviceApi from "@/api/device.js"
export default { export default {
components: {
workOrderList
},
data() { data() {
return { return {
params: { params: {
@ -82,7 +78,7 @@
getList() { getList() {
if (this.status == 'nomore') return; if (this.status == 'nomore') return;
this.status = 'loading'; this.status = 'loading';
deviceApi.deviceRepairPage(this.params).then((res) => { repairOrderApi.repairOrderPage(this.params).then((res) => {
if (res.data.list.length > 0) { if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list); this.list = this.list.concat(res.data.list);
this.params.pageNo++; this.params.pageNo++;

2
permission.js

@ -5,7 +5,7 @@ const loginPage = "/pages/login"
// 页面白名单 // 页面白名单
const whiteList = [ const whiteList = [
'/pages/login', '/pages/index' '/pages/login', '/pages/index', '/pages/mold/index', '/pages/device/index', '/pages/spareParts/index', '/pages/mine/index'
] ]
// 检查地址白名单 // 检查地址白名单

Loading…
Cancel
Save