Browse Source

EAM ——> PDA 点检工单

master
gaojs 5 months ago
parent
commit
c2765a85e1
  1. 52
      src/api/eam/spotcheck.js
  2. 31
      src/pages.json
  3. 3
      src/pages/eam/inspectionOrder/index.vue
  4. 741
      src/pages/eam/spotcheckOrder/detail.vue
  5. 30
      src/pages/eam/spotcheckOrder/index.vue
  6. 517
      src/pages/eam/spotcheckOrder/item.vue

52
src/api/eam/spotcheck.js

@ -0,0 +1,52 @@
import http from '../http'
// 获取点检工单
export function spotcheckOrderPage(params) {
return http.get('/eam/equipment-spot-check-main/page',{params})
}
// 获取点检工单
export function spotcheckOrder(number) {
return http.get('/eam/equipment-spot-check-main/get?id=' + number)
}
//接单
export function spotcheckUpdateOrder(params) {
return http.post('/eam/equipment-spot-check-main/updateOrder',params)
}
//完成
export function spotcheckExecuteOrder(params) {
return http.post('/eam/equipment-spot-check-main/execute',params)
}
// 获取点检工单
export function spotcheckOrderDetail(params) {
return http.get('/eam/equipment-spot-check-detail/getList',{params})
}
//更新点检项
export function spotcheckOrderItemUpdate(params) {
return http.put('/eam/equipment-spot-check-detail/update',params)
}
//新增非必选点检项
export function spotcheckOrderItemCreate(params) {
return http.post('/eam/equipment-spot-check-detail/create',params)
}
//获取非必选的点检项
export function spotcheckPlanItemList(params) {
return http.post('/eam/relation-spot-check-plan-item/getList',params)
}
//验证驳回
export function spotcheckOrderRejected(params) {
return http.post('/eam/equipment-spot-check-main/fallback',params)
}
//验证通过
export function spotcheckOrderPassed(params) {
return http.put('/eam/equipment-spot-check-main/update',params)
}

31
src/pages.json

@ -2142,12 +2142,41 @@
"navigationBarTitleText": "巡检工单详情",
"enablePullDownRefresh": true
}
},{
},
{
"path": "pages/eam/inspectionOrder/item",
"style": {
"navigationBarTitleText": "巡检项",
"enablePullDownRefresh": true
}
},
{
"path": "pages/eam/spotcheckOrder/spotcheckRequest",
"style": {
"navigationBarTitleText": "点检",
"enablePullDownRefresh": true
}
},
{
"path": "pages/eam/spotcheckOrder/index",
"style": {
"navigationBarTitleText": "点检工单",
"enablePullDownRefresh": true
}
},
{
"path": "pages/eam/spotcheckOrder/detail",
"style": {
"navigationBarTitleText": "点检工单详情",
"enablePullDownRefresh": true
}
},
{
"path": "pages/eam/spotcheckOrder/item",
"style": {
"navigationBarTitleText": "点检项",
"enablePullDownRefresh": true
}
}

3
src/pages/eam/inspectionOrder/index.vue

@ -88,9 +88,6 @@
function itemClick(item, index) {
proxy.$tab.navigateTo(`/pages/eam/inspectionOrder/detail?type=${params.value.type}&id=${encodeURIComponent(JSON.stringify(item.id))}`)
}
// function addForm(item) {
// proxy.$tab.navigateTo(`/pages/spotCheckOrder/addForm?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
// }
async function getList() {
if (status.value == 'nomore') return;

741
src/pages/eam/spotcheckOrder/detail.vue

@ -0,0 +1,741 @@
<template>
<!-- 详情 -->
<view class="detail-container">
<view class="info">
<view class="title">
<view>点检工单</view>
</view>
<view class="dec">
<view class="dec-item">
<view>工单单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>工单状态</view>
<u-tag text="待派工" v-if="data.status == '0'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="info" shape='circle'/>
<u-tag text="已逾期" v-else-if="data.status=='1'" bg-color='rgba(255,255,255,0)' color='#d7d7d7' border-color='#d7d7d7 ' type="info" shape='circle'/>
<u-tag text="已退单" v-else-if="data.status=='2'" bg-color='rgba(255,255,255,0)' color='#e01f54' border-color='#e01f54' type="info" shape='circle'/>
<u-tag text="待接单" v-else-if="data.status=='3'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="info" shape='circle'/>
<u-tag text="待执行" v-else-if="data.status=='4'" bg-color='rgba(255,255,255,0)' color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle'/>
<u-tag text="执行中" v-else-if="data.status=='5'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
<u-tag text="待验证" v-else-if="data.status=='6'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
<u-tag text="已完成" v-else-if="data.status=='7'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
<u-tag text="已作废" v-else-if="data.status=='8'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
</view>
<view class="dec-item">
<view>点检描述</view>
<view>{{data.describes}}</view>
</view>
<view class="dec-item">
<view>班组</view>
<view>{{data.classType}}</view>
</view>
<view class="dec-item">
<view>点检人</view>
<view>{{data.maintenancer}}</view>
</view>
<view class="dec-item">
<view>点检人电话</view>
<view>{{data.maintenancePhone}}</view>
</view>
<view class="dec-item">
<view>点检开始时间</view>
<view>{{data.endTime == null ? '':$time.formatDate(data.startTime)}}</view>
</view>
<view class="dec-item">
<view>点检结束时间</view>
<view>{{data.endTime == null ? '':$time.formatDate(data.endTime)}}</view>
</view>
<view class="dec-item">
<view>完成时间</view>
<view>{{data.completionTime == null ? '':$time.formatDate(data.completionTime)}}</view>
</view>
</view>
</view>
<div class="line"></div>
<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="dec" v-if="current == 0 ">
<view class="dec-item">
<view>编号</view>
<view>{{data.equipmentCode}}</view>
</view>
<view class="dec-item">
<view>所属车间</view>
<view>{{data.workshopCode}}</view>
</view>
<view class="dec-item">
<view>类型</view>
<view>{{data.type == 'DEVICE'?'设备':data.type == 'EQUIPMENT'?'工装':''}}</view>
</view>
</view>
<view class="list" v-if="current == 1 ">
<view class="item " v-for="(item,index) in subList" :key="index" @click="upSubForm('update',item)">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.name}}
</view>
</view>
<u-row gutter="16">
<u-col :span="12">
<view class="dec">
<view class="">
点检内容: {{item.content}}
</view>
</view>
<view class="dec">
<view class="">
结果: {{item.result == '0'?'完成':item.result == '1'?'未完成':''}}
</view>
</view>
<view class="dec">
<view class="">
未完成原因: {{item.uncompletedCause==null?'':item.uncompletedCause}}
</view>
</view>
<view class="dec">
<view class="">
完成时间: {{item.completionTime == null ? '':$time.formatDate(item.completionTime)}}
</view>
</view>
</u-col>
</u-row>
</view>
</view>
<view class="add-btn">
<u-button type="primary" @click="upSubForm('create','')" v-if="data.status=='5'"><u-icon name="plus-circle" color="#ffffff" size="36"></u-icon>点检</u-button>
</view>
</view>
</view>
</view>
<view class="footer">
<view class="btns" v-if="data.status == '3'">
<u-button type="primary" @click="handleReceive()" :loading='loading' :disabled='loading'>接单</u-button>
</view>
<view class="btns" v-if="data.status == '4'">
<u-button type="primary" @click="handleExecute()" :loading='loading' :disabled='loading'>执行</u-button>
</view>
<view class="btns" v-if="data.status == '5'">
<u-button type="primary" @click="handleFinish()" :loading='loading' :disabled='loading'>完成</u-button>
</view>
<view class="btns" v-if="data.status == '6'">
<u-button type="primary" @click="handleValidate()" :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="formPopupVisible" @close="formPopupVisible = false" mode="bottom">
<view class="add-form-container">
<u-form :model="form" ref="formRef2" label-width="160rpx">
<u-form-item label="点检开始时间:" prop="startTime" required >
<view class="select" @click="openDatetime('startTime',formatDate,params,formatValue)">
<view class="input" v-if='formatStartDate'>
{{formatStartDate}}
</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="endTime" required>
<view class="select" @click="openDatetime('endTime',formatDate,params,formatValue)">
<view class="input" v-if='formatEndDate'>
{{formatEndDate}}
</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="popup-footer">
<u-button @click="formPopupVisible = false">取消</u-button>
<u-button type="primary" @click="confirmKeepOrderForm">确认</u-button>
</view>
</view>
</u-popup>
<u-picker mode="time" v-model="datetimeShow" :default-time='datetimeDefaultValue' :params="params" @confirm='chooseDatetime' @cancle='datetimeShow = false'></u-picker>
<!-- 验证完结-->
<u-popup v-model="formPopupValidate" mode="center" border-radius="14">
<view class="popup-title">验证内容</view>
<view class="popup">
<textarea v-model="verifyContentStr" placeholder="请输入内容"></textarea>
</view>
<view class="popup-footer">
<view class="sure" @click="apply('PASSED')">通过</view>
<view class="reject" @click="apply('REJECTED')" style="color: red;">驳回</view>
</view>
</u-popup>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as inspectionOrderApi from "@/api/eam/spotcheck"
const { proxy } = getCurrentInstance()
const subList = ref([])
const data = ref({})
const loading = ref(false)
const number = ref('')
const current = ref(0)
const id = ref('')
const type = ref('')// /
const list = ref([{
name: '',
value: 1
}, {
name: '',
value: 2
}])
//
const formPopupVisible = ref(false)
const form2 = ref({
startTime: '',
endTime: ''
})
const params = ref({
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true,
timestamp: true,
})
const datetimeDefaultValue = ref('')
const formatValue = ref('YYYY-MM-DD hh:mm:ss')
const field = ref('')
const datetimeShow = ref(false)
const formatStartDate = ref('')//
const formatEndDate = ref('')//
//
function chooseDatetime(e) {
let array1 = []
let array2 = []
if (formatValue.value.indexOf('YYYY') > -1) {
array1.push(e.year)
}
if (formatValue.value.indexOf('MM') > -1) {
array1.push(e.month)
}
if (formatValue.value.indexOf('DD') > -1) {
array1.push(e.day)
}
if (formatValue.value.indexOf('hh') > -1) {
array2.push(e.hour)
}
if (formatValue.value.indexOf('mm') > -1) {
array2.push(e.minute)
}
if (formatValue.value.indexOf('ss') > -1) {
array2.push(e.second)
}
let str = array1.join('-') + ' ' + array2.join(':')
if(field.value == 'startTime'){
formatStartDate.value = str
}else if(field.value == 'endTime'){
formatEndDate.value = str
}
form2.value[field.value] = e.timestamp*1000
}
//
function confirmKeepOrderForm(){
if (!(formatStartDate.value && formatStartDate.value.trim() != '')) {
proxy.$modal.showToast('请选择创建时间')
return
}else if (!(formatEndDate.value && formatStartDate.value.trim() != '')) {
proxy.$modal.showToast('请选择结束时间')
return
}else if(form2.value.startTime >= form2.value.endTime){
proxy.$modal.showToast('创建时间要小于结束时间')
return
}else{
formPopupVisible.value = false
}
const paramsData = {
id: id.value,
startTime: form2.value.startTime,
endTime: form2.value.endTime,
status:'5'
}
proxy.$modal.confirm('是否完成?').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
inspectionOrderApi.spotcheckExecuteOrder(paramsData).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
selectDetail()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast(res.msg)
loading.value = false
}
}).catch((e) => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
//
function openDatetime(fieldName, val, params, format) {
params.value = params
formatValue.value = format
field.value = fieldName
datetimeDefaultValue.value = val ? val : proxy.$time.formatDate()
datetimeShow.value = true
}
//
function handleReceive(){
const datas = {
id: id.value,
status: '4'
}
proxy.$modal.confirm("是否确认接单").then(()=>{
inspectionOrderApi.spotcheckUpdateOrder(datas).then((res) => {
if (res.data) {
proxy.$modal.showToast('接单成功')
setTimeout(() => {
selectDetail()
loading.value = false
proxy.$modal.closeLoading()
}, 1000)
}else{
proxy.$modal.showToast('接单失败')
setTimeout(() => {
selectDetail()
loading.value = false
proxy.$modal.closeLoading()
}, 1000)
}
})
})
}
//
function handleExecute(){
const datas = {
id: id.value,
status: '5'
}
proxy.$modal.confirm("是否确认执行").then(()=>{
inspectionOrderApi.spotcheckUpdateOrder(datas).then((res) => {
if (res.data) {
proxy.$modal.showToast('执行成功')
setTimeout(() => {
selectDetail()
loading.value = false
proxy.$modal.closeLoading()
}, 1000)
}else{
proxy.$modal.showToast('执行失败')
setTimeout(() => {
selectDetail()
loading.value = false
proxy.$modal.closeLoading()
}, 1000)
}
})
})
}
//
function handleFinish(){
proxy.$modal.confirm("是否完成").then(()=>{
formPopupVisible.value = true
})
}
//
const formPopupValidate = ref(false)
//
function handleValidate(){
formPopupValidate.value = true
}
//
const verifyContentStr = ref('');
function apply(fieldName){
if(fieldName == 'PASSED'){
const paramsData = {
id: id.value,
status:'7',
verifyContent:verifyContentStr.value
}
formPopupValidate.value = false
proxy.$modal.confirm("是否确认执行").then(()=>{
inspectionOrderApi.spotcheckOrderPassed(paramsData).then((res) => {
console.log(res);
proxy.$modal.showToast('执行成功')
setTimeout(() => {
selectDetail()
loading.value = false
proxy.$modal.closeLoading()
}, 1000)
})
})
}else if(fieldName == 'REJECTED'){
const paramsData = {
id: id.value,
status:'5',
}
formPopupValidate.value = false
proxy.$modal.confirm("是否确认执行").then(()=>{
inspectionOrderApi.spotcheckOrderRejected(paramsData).then((res) => {
console.log(res);
proxy.$modal.showToast('执行成功')
setTimeout(() => {
selectDetail()
loading.value = false
proxy.$modal.closeLoading()
}, 1000)
})
})
}
}
//
function openInspectionItem(){
if (data.value.status == '3') {
proxy.$modal.showToast('请先接单')
return
}
}
//Tab
function change(index) {
current.value = index
}
//
function upSubForm(clickType,item) {
if (data.value.status == '3') {
proxy.$modal.showToast('请先接单')
return
}
if (data.value.status == '4'|| data.value.status == '6' || data.value.status == '7'|| data.value.status == '8'){
proxy.$modal.showToast('当前工单状态不允许修改点检项')
return
}
if (clickType == 'update') {
proxy.$tab.navigateTo(
`/pages/eam/spotcheckOrder/item?type=${clickType}&data=${encodeURIComponent(JSON.stringify(item))}`
)
}else{
proxy.$tab.navigateTo(
`/pages/eam/spotcheckOrder/item?type=${clickType}&data=${encodeURIComponent(JSON.stringify(data.value))}`
)
}
}
onLoad(async (option) => {
if (option.id) {
id.value = option.id
}
if (option.type) type.value = option.type;
})
onShow(async () => {
list.value = [{
name: type.value == 'DEVICE' ? '设备信息' : '工装信息',
value: 1
}, {
name: '点检项内容',
value: 2
}]
selectDetail()
selectListByNumber()
})
function selectDetail() {
inspectionOrderApi.spotcheckOrder(id.value).then((res) => {
if (res.data) {
data.value = res.data
}
})
}
function selectListByNumber() {
const data = {
masterId: id.value
}
inspectionOrderApi.spotcheckOrderDetail(data).then((res) => {
if (res.data) {
subList.value = res.data
}
})
}
</script>
<style lang="scss" scoped>
.detail-container {
min-height: 100vh;
background: white;
}
.line {
background: #f5f5f5;
height: 20rpx;
}
.info {
background: white;
}
.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;
width: 0px;
word-wrap: break-word;
}
}
}
}
.dec2 {
padding: 10rpx 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 160rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
.items {
margin: 20rpx 30rpx;
border-radius: 12rpx;
background: #F5F5F5;
padding-bottom: 20rpx;
.items-name {
padding: 20rpx;
border-bottom: 1px solid #dedede;
}
.items-dec {
padding: 0px 20rpx;
margin-top: 20rpx;
}
}
.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;
}
}
}
.list {
padding: 20rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
border-radius: 12rpx;
border: 1px solid #dedede;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
display: flex;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
flex: 1;
}
}
.dec {
color: #9c9c9c;
padding: 0rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
::v-deep .u-radio-group {
display: grid !important;
padding-bottom: 20rpx;
}
.images {
display: flex;
width: 100%;
image {
width: 30%;
margin-right: 20rpx;
height: 200rpx;
border-radius: 10rpx;
}
}
.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>

30
src/pages/eam/spotcheckOrder/index.vue

@ -1,8 +1,8 @@
<template>
<!-- 检工单 -->
<!-- 检工单 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="检工单">
title="检工单">
<template v-slot:right>
<u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm" ></u-icon>
</template>
@ -14,10 +14,10 @@
<view class="title-txt">
{{item.number}}
</view>
<u-tag text="待派工" v-if="item.status == '0'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/>
<u-tag text="已逾期" v-else-if="item.status=='1'" bg-color='rgba(255,255,255,0)' color='#d7d7d7' border-color='#d7d7d7 ' type="warning" shape='circle'/>
<u-tag text="已退单" v-else-if="item.status=='2'" bg-color='rgba(255,255,255,0)' color='#e01f54' border-color='#e01f54' type="success" shape='circle'/>
<u-tag text="待接单" v-else-if="item.status=='3'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="error" shape='circle'/>
<u-tag text="待派工" v-if="item.status == '0'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="info" shape='circle'/>
<u-tag text="已逾期" v-else-if="item.status=='1'" bg-color='rgba(255,255,255,0)' color='#d7d7d7' border-color='#d7d7d7 ' type="info" shape='circle'/>
<u-tag text="已退单" v-else-if="item.status=='2'" bg-color='rgba(255,255,255,0)' color='#e01f54' border-color='#e01f54' type="info" shape='circle'/>
<u-tag text="待接单" v-else-if="item.status=='3'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="info" shape='circle'/>
<u-tag text="待执行" v-else-if="item.status=='4'" bg-color='rgba(255,255,255,0)' color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle'/>
<u-tag text="执行中" v-else-if="item.status=='5'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
<u-tag text="待验证" v-else-if="item.status=='6'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
@ -40,7 +40,7 @@
班组:<span>{{item.classType}}</span>
</view>
<view class="dec">
检人:<span>{{item.maintenancer}}</span>
检人:<span>{{item.maintenancer}}</span>
</view>
<view class="dec">
完成时间:<span>{{`${$time.formatDate(item.completionTime)}`}}</span>
@ -73,7 +73,7 @@
nextTick
} from 'vue'
import * as inspectionOrderApi from "@/api/eam/inspection"
import * as inspectionOrderApi from "@/api/eam/spotcheck"
const { proxy } = getCurrentInstance()
const params = ref({
@ -83,18 +83,17 @@
})
const status = ref('loadmore') //
const list = ref([])
// function itemClick(item, index) {
// proxy.$tab.navigateTo(`/pages/spotCheckOrder/detail?type=${params.value.type}&number=${item.number}&data=${encodeURIComponent(JSON.stringify(item))}`)
// }
// function addForm(item) {
// proxy.$tab.navigateTo(`/pages/spotCheckOrder/addForm?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
// }
//
function itemClick(item, index) {
proxy.$tab.navigateTo(`/pages/eam/spotcheckOrder/detail?type=${params.value.type}&id=${encodeURIComponent(JSON.stringify(item.id))}`)
}
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await inspectionOrderApi.inspectionOrderPage(params.value).then((res) => {
await inspectionOrderApi.spotcheckOrderPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
@ -106,7 +105,6 @@
}).catch(() => {
proxy.$modal.closeLoading()
})
console.log(list.value)
}
onLoad((option) => {
if (option.type) params.value.type = option.type;

517
src/pages/eam/spotcheckOrder/item.vue

@ -0,0 +1,517 @@
<template>
<!-- 详情 update用-->
<view class="detail-container" v-if="show1">
<view class="popup" >
<u-form :model="form1" label-width="160rpx">
<u-form-item label="工单编号" prop="number" required>
<u-input v-model="form1.number" :disabled=true/>
</u-form-item>
<u-form-item label="点检项名称" prop="name" required>
<u-input v-model="form1.name" :disabled=true/>
</u-form-item>
<u-form-item label="点检内容" prop="content" required>
<u-input v-model="form1.content" :disabled=true/>
</u-form-item>
<u-form-item label="结果" prop="resultStr" required>
<u-input v-model="form1.resultStr" placeholder="请选择" :disabled=true />
<u-select v-model="show" mode ='single-column' :list="list" @confirm="confirm"></u-select>
<u-button type="primary" @click="show = true">选择</u-button>
</u-form-item>
<u-form-item label="未完成原因" :required="causeFlag" >
<u-input v-model="form1.uncompletedCause" placeholder="请输入未完成原因" :disabled="causeDisabled" />
</u-form-item>
</u-form>
</view>
<div class="line"></div>
<view class="footer">
<view class="btns" >
<u-button type="primary" @click="submitForm1()" :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="isVerifyShowSuccess" mode="center" border-radius="14">
<view class="popup-title">意见</view>
<view class="popup">
<textarea v-model="data.applyContent" placeholder="请输入内容"></textarea>
</view>
<view class="popup-footer">
<view class="sure" @click="apply('APPROVEPASS')">通过</view>
<view class="reject" @click="apply('APPROVEREJECTED')" style="color: red;">驳回</view>
</view>
</u-popup>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 详情 create用-->
<view class="detail-container" v-if="show2">
<view class="popup" >
<!-- 表单 -->
<u-form :model="form2" label-width="160rpx">
<u-form-item label="工单编号" prop="number" required>
<u-input v-model="form2.number" :disabled=true/>
</u-form-item>
<u-form-item label="点检项" prop="chargePeoples" required>
<view class="select" @click="addItem()">
<view class="input" v-if='form2.name'>
{{form2.name}}
</view>
<view class="placeholder" v-else>
请选择非必选点检项
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form>
<!-- 弹出非必选点检项 -->
<u-popup v-model="isShowItem" mode="center" border-radius="14">
<view class="popup-title">非必选点检项</view>
<view class="popup">
<u-checkbox-group @change="checkboxItemChange">
<u-checkbox v-model="item.checked" v-for="(item, index) in itemList" :key="index"
:name="item.itemName">{{item.itemName}}</u-checkbox>
</u-checkbox-group>
</view>
<view class="popup-footer">
<view @click="isShowItem = false">取消</view>
<view class="sure" @click="chooseItem">确认</view>
</view>
</u-popup>
<view class="footer">
<view class="btns" >
<u-button type="primary" @click="submitForm2()" :loading='loading' :disabled='loading'>提交</u-button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as inspectionOrderApi from "@/api/eam/spotcheck"
const { proxy } = getCurrentInstance()
const subList = ref([])
const data = ref({})
const loading = ref(false)
const number = ref('')
const show = ref(false)
const show1 = ref(false)
const show2 = ref(false)
const isShowItem = ref(false)
const itemList = ref([])//List
const chooseItemList = ref([])//List
const current = ref(0)
const id = ref('')
const type = ref('')// /
const causeFlag = ref(false)
const causeDisabled = ref(false)
const list = ref([{
label: '完成',
value: '0'
}, {
label: '未完成',
value: '1'
}])
const form1 = ref({
id:"",
masterId:"",
number: "",
result:"",
resultStr:"",
uncompletedCause: "",
content:"",
})
const form2 = ref({
id:"",
masterId:"",
number: "",
name:"",
})
function addItem(){
isShowItem.value = true
}
function checkboxItemChange(e) {
chooseItemList.value = e
}
function chooseItem() {
form2.value.name = chooseItemList.value.join(',')
isShowItem.value = false
}
function submitForm1(){
//
if (form1.value.resultStr.length == 0) {
proxy.$modal.alert('请选择结果')
return;
}
if(form1.value.resultStr == '未完成' && form1.value.uncompletedCause.length == 0) {
proxy.$modal.alert('请输入未完成原因')
return;
}
proxy.$modal.confirm("是否确认提交").then(()=>{
proxy.$modal.loading('加载中')
inspectionOrderApi.spotcheckOrderItemUpdate(form1.value).then((res) => {
proxy.$modal.closeLoading()
if(res.data){
proxy.$modal.showToast('成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
proxy.$modal.closeLoading()
}, 1000)
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
function submitForm2(){
//
if (form2.value.name.length == 0) {
proxy.$modal.alert('请选择非必须点检项')
return;
}
proxy.$modal.confirm("是否确认提交").then(()=>{
proxy.$modal.loading('加载中')
inspectionOrderApi.spotcheckOrderItemCreate(form2.value).then((res) => {
proxy.$modal.closeLoading()
console.log(res)
if(res.code == 0){
proxy.$modal.showToast('成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
proxy.$modal.closeLoading()
}, 1000)
}else{
proxy.$modal.showToast(res.msg)
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
const confirm =(e)=>{
if(e[0].value == '0'){
form1.value.result = '0'
form1.value.resultStr = '完成'
form1.value.uncompletedCause = ''
causeFlag.value = false
causeDisabled.value = true
}
if(e[0].value == '1'){
form1.value.result = '1'
form1.value.resultStr = '未完成'
causeFlag.value = true
causeDisabled.value = false
}
}
onLoad(async (option) => {
if (option.data && option.type == 'update') {
show1.value = true
show2.value = false
data.value = JSON.parse(decodeURIComponent(option.data))
console.log(data.value)
form1.value.id = data.value.id
form1.value.masterId = data.value.masterId
form1.value.number = data.value.number
form1.value.name = data.value.name
form1.value.content = data.value.content
if(data.value.result == '0'){
form1.value.resultStr = '完成'
}else if(data.value.result == '1'){
form1.value.resultStr = '未完成'
}else{
form1.value.resultStr = ''
}
form1.value.uncompletedCause = data.value.uncompletedCause
}else if(option.data && option.type == 'create'){
show1.value = false
show2.value = true
data.value = JSON.parse(decodeURIComponent(option.data))
console.log(data.value)
form2.value.masterId = data.value.id
form2.value.number = data.value.number
//
const paras1 = {
planNumber: data.value.planNumber,
available: 'TRUE',
isSelectd: 'false'
}
inspectionOrderApi.spotcheckPlanItemList(paras1).then((res) => {
if (res.data) {
itemList.value = res.data
}
})
}
if (option.type) type.value = option.type;
})
</script>
<style lang="scss" scoped>
.detail-container {
min-height: 100vh;
background: white;
}
.line {
background: #f5f5f5;
height: 20rpx;
}
.info {
background: white;
}
.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;
width: 0px;
word-wrap: break-word;
}
}
}
}
.dec2 {
padding: 10rpx 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 160rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
.items {
margin: 20rpx 30rpx;
border-radius: 12rpx;
background: #F5F5F5;
padding-bottom: 20rpx;
.items-name {
padding: 20rpx;
border-bottom: 1px solid #dedede;
}
.items-dec {
padding: 0px 20rpx;
margin-top: 20rpx;
}
}
.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;
}
}
}
.list {
padding: 20rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
border-radius: 12rpx;
border: 1px solid #dedede;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
display: flex;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
flex: 1;
}
}
.dec {
color: #9c9c9c;
padding: 0rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
::v-deep .u-radio-group {
display: grid !important;
padding-bottom: 20rpx;
}
.images {
display: flex;
width: 100%;
image {
width: 30%;
margin-right: 20rpx;
height: 200rpx;
border-radius: 10rpx;
}
}
.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>
Loading…
Cancel
Save