yuhdemo/cms-app/pages/yys/eqmt/index.vue
2026-01-30 16:22:13 +08:00

224 lines
5.9 KiB
Vue

<template>
<view class="viewport">
<CustomNavbar />
<u-tabs :list="tabsList" :is-scroll="false" :current="tabsCurrent" @change="fnTabsChg"></u-tabs>
<view style="padding:0px 20px; 0px 20px">
<u-form ref="dataForm" label-width="120">
<u-form-item label="车间名称" prop="leaveReason">
<jnpf-select v-model="workVal" placeholder="请选择车间名称" :options="workshopList" @change="fnGetList"></jnpf-select>
</u-form-item>
</u-form>
</view>
<u-card v-for="orderItem in orderList">
<view class="" slot="head">
<text>{{ orderItem.eqmtSimpleName }}</text>
</view>
<view class="" slot="body">
<u-row gutter="16">
<u-col span="12">
<text>设备编号:</text><text>{{ orderItem.eqmtNo }}</text>
</u-col>
<u-col span="12">
<text>设备名称:</text><text>{{ orderItem.eqmtName }}</text>
</u-col>
<u-col span="12">
<text>品牌型号:</text><text>{{ orderItem.specName }}</text>
</u-col>
</u-row>
</view>
<view :style="{ textAlign: 'center' }" slot="foot">
<u-button
v-if="fnTabsNow(tabsCurrent)['flag'] == '1'"
size="mini"
:custom-style="{
color: 'white',
margin: '5px',
backgroundColor: '#2A4BB4',
}"
:plain="true"
shape="circle"
@click="fnPopSure(orderItem)"
>
<text :style="{ padding: '20px' }">报修</text>
</u-button>
<u-button
v-else-if="fnTabsNow(tabsCurrent)['flag'] == '2'"
size="mini"
:custom-style="{
color: 'white',
margin: '5px',
backgroundColor: '#2A4BB4',
}"
:plain="true"
shape="circle"
@click="fnPopSureInfo(orderItem)"
>
<text :style="{ padding: '20px' }">查看详情</text>
</u-button>
</view>
</u-card>
<template v-if="orderList.length == 0">
<u-empty mode="data"></u-empty>
</template>
<PopSure ref="refPopSure" @evtRefresh="fnRefreshA"></PopSure>
<PopSureInfo ref="refPopSureInfo" @evtRefresh="fnRefreshB"></PopSureInfo>
<u-top-tips ref="uTips"></u-top-tips>
</view>
</template>
<script>
import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'
import { mapGetters } from 'vuex'
import dayjs from 'dayjs'
import {
getOrderList,
takeOrder,
finish } from '@/api/yys/materialProcurementOrder.js'
import {
workshop,
getList,
listReport,
fix } from '@/api/yys/eqmt.js'
import CustomNavbar from './components/CustomNavbar'
import PopSure from './components/PopSure'
import PopSureInfo from './components/PopSureInfo'
export default {
components: { CustomNavbar, PopSure, PopSureInfo },
mixins: [],
data() {
return {
workVal: '',
workshopList: [],
isLoading: false,
tabsList: [
{ name: '设备列表', flag: '1' },
{ name: '待维修', flag: '2' },
],
tabsCurrent: 0,
// 设备列表
orderList: [],
// 待维修列表
listReport:[],
}
},
watch: {},
computed: {},
onLoad(params) {
this.getWorkshop()
this.fnGetList()
// this.fnGetListReport()
},
onUnload() {},
methods: {
fnTabsChg(index) {
this.tabsCurrent = index;
console.log("index >>>>>>>>> " + index)
this.orderList=[]
if( index === 0 ){
this.fnGetList()
} else if (index === 1) {
this.fnGetListReport()
}
},
fnTabsNow(tabsCurrent) {
let tabsNow = this.tabsList[this.tabsCurrent]
return tabsNow
},
getWorkshop() {
workshop()
.then(res => {
if (res.code == 200) {
res.data.forEach((item, i) => {
console.log('item', item)
this.workshopList.push({ id: item, fullName: item })
})
}
console.log(' >>>>>>>>>>>> ' + this.workshopList)
})
.catch(err => {
console.log(err)
})
},
fnGetList() {
let tabsNow = this.tabsList[this.tabsCurrent]
let params = {
flag: tabsNow.flag,
workshopName:this.workVal
}
console.log('################# ',params)
if (params.flag === '1') {
getList(params)
.then(res => {
if (res.code == 200) {
this.orderList = res.data
}
console.log(res)
})
.catch(err => {
console.log(err)
})
} else {
listReport(params)
.then(res => {
if (res.code == 200) {
this.orderList = res.data
}
console.log(res)
})
.catch(err => {
console.log(err)
})
}
},
fnGetListReport() {
let tabsNow = this.tabsList[this.tabsCurrent]
let params = {
flag: tabsNow.flag,
workshopName:this.workVal
}
console.log('################# ')
listReport(params)
.then(res => {
if (res.code == 200) {
this.orderList = res.data
}
console.log(res)
})
.catch(err => {
console.log(err)
})
},
fnPopSure(orderItem) {
this.$refs.refPopSure.init(orderItem)
},
fnPopSureInfo(orderItem) {
this.$refs.refPopSureInfo.init(orderItem)
},
fnRefreshA() {
this.$refs.uTips.show({
title: '提交成功',
type: 'success',
duration: '2300',
})
this.fnGetList()
},
fnRefreshB() {
this.$refs.uTips.show({
title: '提交成功',
type: 'success',
duration: '2300',
})
this.fnGetListReport()
},
fnFormat(time, fmtStr = 'YYYY-MM-DD') {
return dayjs(time).format(fmtStr)
},
},
}
</script>
<style lang="scss"></style>