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. 60
      pages/device/index.vue
  6. 242
      pages/device/screen.vue
  7. 16
      pages/deviceReport/addForm.vue
  8. 4
      pages/deviceReport/index.vue
  9. 2
      pages/index.vue
  10. 25
      pages/mine/index.vue
  11. 120
      pages/mold/index.vue
  12. 19
      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'
// 根据设备/模具号查询信息
export function getDetailsByNumber(params) {
// 根据设备号查询信息
export function getDeviceDetailsByNumber(params) {
return request({
url: '/eam/device-accounts/getDetailsByNumber',
'method': 'GET',
@ -25,7 +25,7 @@ export function deviceRepairPage(params) {
})
}
// 报修列表
// 撤销
export function rejected(id) {
return request({
url: '/eam/device-repair/rejected?id='+id,
@ -40,3 +40,11 @@ export function deviceList(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="screen-input">
<u-search
v-model='keyWord'
:show-action='false'
:bg-color="search.bgBolor ||'white'"
:border-color="search.borderColor ||'#E4E4E4'"
:shape="search.shape ||'square'"
:height="search.height || 80"
:placeholder="search.placeholder ||'请输入设备编码或设备名称'"
:clearabled="true">
:bg-color="searchData.bgBolor ||'white'"
:border-color="searchData.borderColor ||'#E4E4E4'"
:shape="searchData.shape ||'square'"
:height="searchData.height || 80"
:placeholder="searchData.placeholder ||'请输入设备名称'"
:clearabled="true"
@search='search'
>
</u-search>
</view>
<view class="screen-btn" @click="screen" v-if="isShowScreen">

6
pages.json

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

60
pages/device/index.vue

@ -1,10 +1,11 @@
<template>
<!-- 设备 -->
<view class="work-container">
<Search @search='search' @screen='screen'/>
<Search @search='search' @screen='screen' :isShowScreen='false' />
<view class="list">
<view class="item" v-for="index in 6" :key='index'>
<u-image src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png" width='160' height="160">
<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>
@ -14,38 +15,77 @@
</u-image>
<view class="text">
<view class="title">
电梯设备
{{item.name}}
</view>
<view class="dec1">
SB52225456
{{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>
<script>
import * as deviceApi from "@/api/device.js"
export default {
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
type: '',
name:''
},
status: 'loadmore', //
list: [],
}
},
methods: {
//
search(keyWord) {
console.log(keyWord)
this.params.name = keyWord
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
//
screen() {
console.log(222)
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>
@ -63,6 +103,7 @@
.text {
margin-left: 20rpx;
.title {
font-size: 32rpx;
font-weight: bold;
@ -82,6 +123,7 @@
}
}
}
.image-error {
text-align: center;
}

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>

16
pages/deviceReport/addForm.vue

@ -31,6 +31,7 @@
<script>
import * as deviceApi from "@/api/device.js"
import * as moldApi from "@/api/mold.js"
export default {
data() {
return {
@ -64,10 +65,10 @@
getDetailsByNumber() {
const data = {
number: this.form.deviceNumber,
type: this.type,
id: ''
}
deviceApi.getDetailsByNumber(data).then((res) => {
if(this.type == 'DEVICE'){
deviceApi.getDeviceDetailsByNumber(data).then((res) => {
if (res.data) {
this.form.deviceName = res.data.name
this.form.factoryAreaName = res.data.factoryAreaName
@ -76,6 +77,17 @@
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() {

4
pages/deviceReport/index.vue

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

2
pages/index.vue

@ -84,7 +84,7 @@
</view>
</u-col>
<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>
<view>维修工单</view>
</view>

25
pages/mine/index.vue

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

120
pages/mold/index.vue

@ -1,22 +1,134 @@
<template>
<!-- 设备 -->
<view class="work-container">
1
<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>
<script>
import * as moldApi from "@/api/mold.js"
export default {
data() {
return {
return {
searchData:{
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>
<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>

19
pages/repairOrder/addForm.vue

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

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

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

2
permission.js

@ -5,7 +5,7 @@ const loginPage = "/pages/login"
// 页面白名单
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