1安灯报警功能

This commit is contained in:
赵正易 2025-02-22 14:30:17 +08:00
parent 65461ced79
commit f92ae74788
12 changed files with 607 additions and 31 deletions

65
api/andon/index.js Normal file
View File

@ -0,0 +1,65 @@
import request from '@/utils/request'
// 获取全部工艺路线(线别)
export function getAllRoute(params) {
return request({
url: '/mes/Mobile/ReportWork/get_all_route',
method: 'get',
params
})
}
/**
* 获取故障类型
* @param {*} query
* @returns
*/
export function GetAndonAlarmTypeDict() {
return request({
url: '/mes/andonManagement/dataAnalysis/getAndonAlarmTypeDict',
method: 'get'
})
}
/**
* 呼叫请求
*/
export function CallHandle(data) {
return request({
url: '/mes/andonManagement/interaction/Call',
method: 'post',
data: data
})
}
/**
* 获取待响应的 记录
*/
export function WaitingResponse() {
return request({
url: '/mes/andonManagement/interaction/waitingResponse',
method: 'get'
})
}
/**
* 签到
*/
export function SignIn(query) {
return request({
url: '/mes/andonManagement/interaction/signin',
method: 'post',
data: query
})
}
/**
* 获取故障记录表分页查询
* @param {查询条件} data
*/
export function listAndonFaultRecord(data) {
return request({
url: '/mes/andonManagement/AndonFaultRecord/list',
method: 'post',
data: data
})
}

View File

@ -1,5 +1,5 @@
import request from '@/utils/request' import request from '@/utils/request'
// 获取全部工艺路线 // 获取全部工艺路线(线别)
export function getAllRoute(params) { export function getAllRoute(params) {
return request({ return request({
url: '/mes/Mobile/ReportWork/get_all_route', url: '/mes/Mobile/ReportWork/get_all_route',
@ -8,7 +8,7 @@ export function getAllRoute(params) {
}) })
} }
// 获取全部工艺路线 // 获取全部组别
export function getAllGroup(params) { export function getAllGroup(params) {
return request({ return request({
url: '/mes/Mobile/ReportWork/get_groups', url: '/mes/Mobile/ReportWork/get_groups',

View File

@ -7,7 +7,7 @@ module.exports = {
// 应用名称 // 应用名称
name: "DOAN-PDA", name: "DOAN-PDA",
// 应用版本 // 应用版本
version: "1.2.0", version: "1.4.0",
// 应用logo // 应用logo
logo: "/static/logo.png", logo: "/static/logo.png",
// 官方网站 // 官方网站

View File

@ -2,8 +2,8 @@
"name" : "DOAN总装车间PDA", "name" : "DOAN总装车间PDA",
"appid" : "__UNI__EFA389B", "appid" : "__UNI__EFA389B",
"description" : "DOAN总装车间PDA", "description" : "DOAN总装车间PDA",
"versionName" : "1.2.0", "versionName" : "1.4.0",
"versionCode" : 120, "versionCode" : 140,
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {
"usingComponents" : true, "usingComponents" : true,

View File

@ -140,6 +140,27 @@
{ {
"navigationBarTitleText" : "扫码报工" "navigationBarTitleText" : "扫码报工"
} }
},
{
"path" : "pages/produceManagement/andon/alarm",
"style" :
{
"navigationBarTitleText" : "安灯报警"
}
},
{
"path" : "pages/produceManagement/andon/respond",
"style" :
{
"navigationBarTitleText" : "故障响应"
}
},
{
"path" : "pages/produceManagement/andon/record",
"style" :
{
"navigationBarTitleText" : "响应记录"
}
} }
], ],
"tabBar": { "tabBar": {
@ -156,7 +177,7 @@
"pagePath": "pages/work/index", "pagePath": "pages/work/index",
"iconPath": "static/images/tabbar/work.png", "iconPath": "static/images/tabbar/work.png",
"selectedIconPath": "static/images/tabbar/work_.png", "selectedIconPath": "static/images/tabbar/work_.png",
"text": "工具箱" "text": "管理"
}, { }, {
"pagePath": "pages/mine/index", "pagePath": "pages/mine/index",
"iconPath": "static/images/tabbar/mine.png", "iconPath": "static/images/tabbar/mine.png",

View File

@ -64,7 +64,12 @@ export default {
name: '产线报工', name: '产线报工',
icon: 'folder-add-filled', icon: 'folder-add-filled',
url: '/pages/produceManagement/workorder/workorder' url: '/pages/produceManagement/workorder/workorder'
} },
{
name: '安灯报警',
icon: 'notification-filled',
url: '/pages/produceManagement/andon/alarm'
},
], ],
// //
materialOptions: [ materialOptions: [
@ -171,7 +176,10 @@ view {
height: 300rpx; height: 300rpx;
line-height: 300rpx; line-height: 300rpx;
} }
.card-box{
padding-bottom: 60px;
margin-bottom: 60px;
}
@media screen and (min-width: 500px) { @media screen and (min-width: 500px) {
.uni-swiper-dot-box { .uni-swiper-dot-box {
width: 400px; width: 400px;

View File

@ -0,0 +1,155 @@
<template>
<view>
<!-- 安灯报警 -->
<uni-card class="card-box">
<uni-forms ref="formRef" :rules="rules" :modelValue="formData" label-width="80px">
<uni-forms-item label="线别" name="lineCode">
<uni-data-select v-model="formData.lineCode" placeholder="请选择线别" :localdata="lineCodeOptions"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="故障类型" name="faultDict">
<uni-data-select v-model="formData.faultDict" placeholder="请选择故障类型" :localdata="andonTypeOptions"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="故障内容" name="faultContext">
<uni-easyinput trim="all" type="textarea" autoHeight v-model="formData.faultContext" placeholder="请输入故障内容"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="报警人" name="askPerson">
<uni-easyinput trim="all" v-model="formData.askPerson" placeholder="请输入报警人"></uni-easyinput>
</uni-forms-item>
</uni-forms>
</uni-card>
<view class="bottom-box">
<button :disabled="loading" type="primary" @click="submit">提交安灯报警信息</button>
</view>
<!-- 消息 -->
<view>
<uni-popup ref="dialogRef" type="dialog">
<uni-popup-dialog :title="dialogData.title" :content="dialogData.content" :type="dialogData.type" cancelText="关闭"></uni-popup-dialog>
</uni-popup>
</view>
</view>
</template>
<script>
import * as AndonApi from '@/api/andon/index.js';
export default {
data() {
return {
loading: false,
dialogRef: null,
dialogData: {
title: '提示',
content: '',
type: 'error'
},
formRef: null,
clearForm:{},
formData: {
// 线
lineCode: '1',
//
askPerson: '',
//
faultDict: '物料异常',
//
faultContext: ''
},
rules: {
lineCode: {
rules: [
{
required: true,
errorMessage: '请选择线别'
}
]
},
faultDict: {
rules: [
{
required: true,
errorMessage: '请选择故障类型'
}
]
}
},
lineCodeOptions: [
{ value: '1', text: '1号线' },
{ value: '2', text: '2号线' },
{ value: '3', text: '3号线' },
{ value: '4', text: '4号线' }
],
andonTypeOptions: [
{ value: '人员异常', text: '人员异常' },
{ value: '设备异常', text: '设备异常' },
{ value: '物料异常', text: '物料异常' }
]
};
},
onLoad() {
this.init();
},
methods: {
init() {
this.clearForm = JSON.parse(JSON.stringify(this.formData));
this.getLineCodeOptions();
this.getAndonTypeOptions();
},
clear(){
this.formData = JSON.parse(JSON.stringify(this.clearForm));
},
getLineCodeOptions() {
AndonApi.getAllRoute().then((res) => {
const { code, data } = res;
if (code === 200) {
this.lineCodeOptions = data.map((item) => {
return {
text: item.name,
value: item.code
};
});
}
});
},
getAndonTypeOptions() {
AndonApi.GetAndonAlarmTypeDict().then((res) => {
const { code, data } = res;
if (code === 200) {
this.andonTypeOptions = data.map((item) => {
return {
text: item.name,
value: item.name
};
});
}
});
},
submit() {
this.$refs.formRef
.validate()
.then((formData) => {
AndonApi.CallHandle(formData).then((res) => {
const { code, data } = res;
if (code === 200) {
if (data > 0) {
this.dialogData.type = 'success';
this.dialogData.title = '提交成功';
this.dialogData.content = '安灯报警信息提交成功';
this.$refs.dialogRef.open();
this.clear()
} else {
this.dialogData.type = 'error';
this.dialogData.title = '提交失败';
this.dialogData.content = '安灯报警信息提交失败';
this.$refs.dialogRef.open();
}
}
});
})
.catch((err) => {});
}
}
};
</script>
<style>
</style>

View File

@ -0,0 +1,191 @@
<template>
<!-- 响应记录 -->
<view>
<uni-card class="card-box">
<uni-forms ref="formRef" :modelValue="formData" label-width="80px">
<uni-forms-item label="线别" name="lineCode">
<uni-data-select v-model="formData.lineCode" placeholder="请选择线别" :localdata="lineCodeOptions"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="故障类型" name="faultDict">
<uni-data-select v-model="formData.faultDict" placeholder="请选择故障类型" :localdata="andonTypeOptions"></uni-data-select>
</uni-forms-item>
<uni-forms-item label-width="0">
<uni-datetime-picker :clear-icon="false" v-model="formData.dateTimeRange" type="daterange" />
</uni-forms-item>
<uni-forms-item label-width="0">
<button type="primary" :disabled="loading" :loading="loading" plain="true" @click="getList">搜索</button>
</uni-forms-item>
</uni-forms>
</uni-card>
<scroll-view scroll-y="true" class="scroll-Y">
<uni-list>
<uni-list-item v-for="(item, index) in list" :key="index" :title="item.title" :note="item.note">
<template v-slot:footer>
<div v-if="item.status === 2" class="right-box bg-green">已响应</div>
<div v-if="item.status === 1" class="right-box bg-red">未响应</div>
</template>
</uni-list-item>
</uni-list>
</scroll-view>
<uni-pagination :current="formData.pageNum" :pageSize="formData.pageSize" :total="total" @change="pageChange"></uni-pagination>
<!-- 消息 -->
<view>
<uni-popup ref="dialogRef" type="dialog">
<uni-popup-dialog :title="dialogData.title" :content="dialogData.content" :type="dialogData.type" cancelText="关闭"></uni-popup-dialog>
</uni-popup>
</view>
</view>
</template>
<script>
import * as AndonApi from '@/api/andon/index.js';
export default {
data() {
return {
loading: false,
formData: {
pageNum: 1,
pageSize: 10,
// 线
lineCode: '',
//
askPerson: '',
//
faultDict: '',
//
dateTimeRange: [],
status: -1,
sort: 'startTime',
sortType: 'desc'
},
dialogRef: null,
dialogData: {
data: {},
title: '提示',
content: '',
type: 'error'
},
list: [],
total: 0,
lineCodeOptions: [
{ value: '1', text: '1号线' },
{ value: '2', text: '2号线' },
{ value: '3', text: '3号线' },
{ value: '4', text: '4号线' }
],
andonTypeOptions: [
{ value: '人员异常', text: '人员异常' },
{ value: '设备异常', text: '设备异常' },
{ value: '物料异常', text: '物料异常' }
]
};
},
onLoad() {
this.init();
},
methods: {
init() {
this.formData.dateTimeRange = [this.$dayjs().startOf('week').toDate(), this.$dayjs().endOf('week').toDate()];
this.handleQuery();
this.getLineCodeOptions();
this.getAndonTypeOptions();
},
getLineCodeOptions() {
AndonApi.getAllRoute().then((res) => {
const { code, data } = res;
if (code === 200) {
this.lineCodeOptions = data.map((item) => {
return {
text: item.name,
value: item.code
};
});
}
});
},
getAndonTypeOptions() {
AndonApi.GetAndonAlarmTypeDict().then((res) => {
const { code, data } = res;
if (code === 200) {
this.andonTypeOptions = data.map((item) => {
return {
text: item.name,
value: item.name
};
});
}
});
},
handleQuery() {
this.formData.pageNum = 1;
this.getList();
},
pageChange(e) {
this.formData.pageNum = e.current;
this.getList();
},
getList() {
this.loading = true;
let startDate = this.$dayjs(this.formData.dateTimeRange[0]).startOf('week').toDate()
let endDate = this.$dayjs(this.formData.dateTimeRange[0]).endOf('week').toDate()
this.formData.dateTimeRange = [startDate, endDate];
AndonApi.listAndonFaultRecord(this.formData)
.then((res) => {
if (res.code === 200) {
this.total = res.data.totalNum;
this.list = res.data.result.map((item) => {
return {
id: item.id,
status: item.status,
title: `问题类别: ${item.faultDict}`,
note: `线别: ${item.lineCode}
问题描述: ${item.faultContext}
报警人: ${item.askPerson}
报警时间: ${item.startTime ?? ''}
响应人: ${item.responsePerson ?? ''}
响应时间: ${item.endTime ?? ''}
响应时长: ${item.duration ?? ''}`
};
});
this.loading = false;
}
})
.catch((err) => {
console.log(err);
});
}
}
};
</script>
<style scoped>
.scroll-Y {
height: 600rpx;
}
.refresh-box {
margin: 10px;
}
.button-inner {
display: flex;
align-items: center;
justify-content: center;
}
.right-box {
/* width: 100%; */
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
font-weight: 600;
}
.bg-green {
background-color: green;
color: white;
}
.bg-red {
background-color: red;
color: white;
}
</style>

View File

@ -0,0 +1,126 @@
<template>
<!-- 故障响应 -->
<view>
<view class="refresh-box">
<button :disabled="loading" :loading="loading" type="primary" plain="true" @click="getList">刷新</button>
</view>
<uni-list>
<uni-list-item v-for="(item, index) in list" :key="index" :title="item.title" :note="item.note">
<template v-slot:footer>
<button class="button-inner" type="primary" @click="clickButton(item)">签到</button>
</template>
</uni-list-item>
</uni-list>
<!-- 消息 -->
<view>
<uni-popup ref="dialogRef" type="dialog">
<uni-popup-dialog :title="dialogData.title" :content="dialogData.content" :type="dialogData.type" cancelText="关闭"></uni-popup-dialog>
</uni-popup>
</view>
<!-- 签到确认 -->
<view>
<uni-popup ref="dialogRef2" type="dialog">
<uni-popup-dialog
before-close
:title="dialogData.title"
placeholder="请输入响应人"
mode="input"
:content="dialogData.content"
:type="dialogData.type"
cancelText="关闭"
@close="dialog2Close()"
@confirm="confirm"
></uni-popup-dialog>
</uni-popup>
</view>
</view>
</template>
<script>
import * as AndonApi from '@/api/andon/index.js';
export default {
data() {
return {
loading: false,
dialogRef: null,
dialogRef2: null,
dialogData: {
data: {},
title: '提示',
content: '',
type: 'error'
},
list: []
};
},
onLoad() {
this.init();
},
methods: {
init() {
this.getList();
},
getList() {
this.loading = true;
AndonApi.WaitingResponse().then((res) => {
if (res.code === 200) {
this.list = res.data.map((item) => {
return {
id: item.id,
title: `问题类别: ${item.faultDict}`,
note: `线别: ${item.lineCode}\n问题描述: ${item.faultContext}\n报警人: ${item.askPerson}\n报警时间: ${item.startTime}`
};
});
this.loading = false;
}
});
},
clickButton(item) {
this.dialogData.title = '签到确认';
this.dialogData.data = JSON.parse(JSON.stringify(item));
this.$refs.dialogRef2.open();
},
dialog2Close() {
this.$refs.dialogRef2.close();
},
//
confirm(val) {
if (val === '' || val === null) {
this.$modal.showToast('请输入响应人');
return;
}
const params = {
id: this.dialogData.data.id,
responsePerson: val
};
AndonApi.SignIn(params).then((res) => {
if (res.code === 200) {
this.dialog2Close();
this.dialogData.type = 'success';
this.dialogData.title = '签到结果';
this.dialogData.content = '签到成功';
this.$refs.dialogRef.open();
} else {
this.dialogData.type = 'error';
this.dialogData.title = '签到结果';
this.dialogData.content = '签到失败';
this.$refs.dialogRef.open();
}
this.getList();
});
}
}
};
</script>
<style scoped>
.refresh-box {
margin: 10px;
}
.button-inner {
display: flex;
align-items: center;
justify-content: center;
}
</style>

View File

@ -1,10 +1,10 @@
<template> <template>
<view class="work-container"> <view class="work-container">
<!-- 宫格组件 --> <!-- 宫格组件 -->
<uni-section title="便捷工具" type="line"></uni-section> <uni-section title="管理工具" type="line"></uni-section>
<view class="grid-body"> <view class="grid-body">
<uni-grid :column="4" :showBorder="false" @change="changeGrid"> <uni-grid :column="4" :showBorder="false" @change="changeGrid">
<uni-grid-item v-for="(item, index) in materialOptions" :key="index" :index="index"> <uni-grid-item v-for="(item, index) in workOptions" :key="index" :index="index">
<view class="grid-item-box"> <view class="grid-item-box">
<uni-icons :type="item.icon" size="30"></uni-icons> <uni-icons :type="item.icon" size="30"></uni-icons>
<text class="text">{{ item.name }}</text> <text class="text">{{ item.name }}</text>
@ -20,28 +20,38 @@ import { fail } from 'assert';
export default { export default {
data() { data() {
return { return {
// //
materialOptions: [ workOptions: [
// {
// name: '',
// icon: 'scan',
// url: '/pages/tool/scan'
// },
// {
// name: '',
// icon: 'gear-filled',
// url: ''
// },
// {
// name: '',
// icon: 'chat-filled',
// url: ''
// },
// {
// name: '',
// icon: 'wallet-filled',
// url: ''
// },
{ {
name: '标签扫码', name: '故障响应',
icon: 'scan', icon: 'calendar-filled',
url: '/pages/tool/scan' url: '/pages/produceManagement/andon/respond'
}, },
{ {
name: '参数设置', name: '响应记录',
icon: 'gear-filled',
url: ''
},
{
name: '通知公告',
icon: 'chat-filled',
url: ''
},
{
name: '操作日志',
icon: 'wallet-filled', icon: 'wallet-filled',
url: '' url: '/pages/produceManagement/andon/record'
} },
] ]
}; };
}, },
@ -53,7 +63,7 @@ export default {
this.current = e.detail.current; this.current = e.detail.current;
}, },
changeGrid(e) { changeGrid(e) {
const _url = this.materialOptions[e.detail.index].url; const _url = this.workOptions[e.detail.index].url;
uni.navigateTo({ uni.navigateTo({
url: _url, url: _url,
fail: () => { fail: () => {

View File

@ -85,7 +85,7 @@ const user = {
} else { } else {
commit('SET_ROLES', ['ROLE_DEFAULT']) commit('SET_ROLES', ['ROLE_DEFAULT'])
} }
console.log(username,avatar,res.data.roles); // console.log(username,avatar,res.data.roles);
commit('SET_NAME', username) commit('SET_NAME', username)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
resolve(res) resolve(res)

View File

@ -47,7 +47,7 @@ const request = config => {
let [error, res] = response let [error, res] = response
if (error) { if (error) {
toast('后端接口连接异常') toast('后端接口连接异常')
reject('后端接口连接异常') reject(error)
return return
} }
// console.log('response',response,error,res); // console.log('response',response,error,res);