YNUtdPlatform/pages/workPlan/monthPlan/index.vue

535 lines
15 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="month-container">
<u-navbar
class="u-navbar"
:title="monthPlanTitle"
placeholder
@leftClick="leftClick"
leftIconColor="#fff"
bgColor="#00337A"
:titleStyle="{ color: '#FFF', fontSize: '32rpx' }"
/>
<view class="month-content">
<view class="btn-header" id="btnHeaderRef">
<button
:key="index"
@tap="onTapCheck(index)"
v-for="(item, index) in btnList"
:class="{ active: index === activeIndex }"
>
{{ item.btn_title }}
</button>
</view>
<!-- 内容区域 -->
<view class="content-2" v-show="activeIndex === 1">
<view class="pages-add" id="pagesAddRef">
<view style="text-align: right; width: 30%">
<image
style="width: 50rpx; height: 50rpx; margin: 13rpx 20rpx 13rpx 0"
src="../../../static/images/workPlan/delete.png"
@tap="onReducePages"
></image>
</view>
<view class="num-content">
<uni-pagination :show-icon="true" :total="pagesTotal" :pageSize="1" v-model="currentPage" />
<!-- <scroll-view scroll-x="true" class="scroll-x" scroll-with-animation="true">
<view v-for="item in pagesNum" :key="item" @tap="onChangePages(item)">{{ item }}</view>
</scroll-view> -->
</view>
<view style="text-align: left; width: 30%">
<image
style="width: 50rpx; height: 50rpx; margin: 13rpx 0 13rpx 20rpx"
src="../../../static/images/workPlan/add.png"
@tap="onAddPages"
></image>
</view>
</view>
<view>
<uni-forms
class="form-container"
ref="form"
:modelValue="formData"
:rules="rules"
label-position="top"
label-width="200"
>
<uni-forms-item label="工程名称" require style="margin-bottom: 2rpx">
<view class="time-container" @tap="onSelectProject">
<view>请选择</view>
<text>&gt;</text>
</view>
</uni-forms-item>
<uni-forms-item label="选择时间" required style="margin-bottom: 2rpx">
<view>
<TimeSelect />
</view>
</uni-forms-item>
</uni-forms>
</view>
<!-- <scroll-view :scroll-y="true" style="height: 340px">
</scroll-view> -->
<view style="background-color: #fff">
<swiper circular :autoplay="false" :current="currentSwiper" style="height: 700rpx" @change="onSwiperChange">
<swiper-item v-for="item in pagesTotal" :key="item">
<scroll-view scroll-y="true" class="scroll-Y" style="height: 100%">
<uni-forms
class="form-container"
ref="form"
:modelValue="formData"
:rules="rules"
label-position="top"
label-width="200"
>
<uni-forms-item
v-for="(item, index) in monthPlanTitle === '基建月计划'
? infrastructureFormLabel
: productionFormLabel"
:key="index"
:label="item.form_label"
name="name"
required
>
<uni-easyinput
v-if="item.items_type === 'ipt'"
type="text"
v-model="formData.name"
placeholder="请填写"
/>
<uni-data-select
v-model="formData.nr"
:localdata="item.options"
v-if="item.items_type === 'sel'"
></uni-data-select>
</uni-forms-item>
</uni-forms>
</scroll-view>
</swiper-item>
</swiper>
<view class="submit-btn">
<button>导入计划</button>
<button @tap="onSaveSubmit">保存提交</button>
</view>
</view>
</view>
</view>
<!-- 弹框 -->
<uni-popup ref="popup" background-color="#fff">
<view class="popup-content" v-if="popupType === 'center'">
<view class="flex-style" style="justify-content: space-between">
<text>选择工程</text>
<text>X</text>
</view>
<view>2024-10-16</view>
<view class="search">
<view class="select">
<uni-data-select v-model="value" @change="onProjectChange" :localdata="range"></uni-data-select>
</view>
<button>搜索</button>
</view>
<view class="project-content">暂无数据</view>
</view>
<view v-else class="popup-bottom-content">
<view class="bottom-title">
<text>请选择</text>
<text>请选择</text>
<uni-icons type="closeempty" size="20" @tap="onClosePopup"></uni-icons>
</view>
<view v-if="isType">
<view class="select-item" v-for="item in isAUditingList" :key="item.title" @tap="onCheckAuditing(item.value)">
{{ item.title }}
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import TimeSelect from './components/time-select'
export default {
components: {
TimeSelect
},
data() {
return {
monthPlanTitle: '基建月计划',
activeIndex: 0,
pagesTotal: 1,
currentPage: 0,
popupType: '',
scrollHeight: 500,
formData: {},
btnList: [
{ btn_title: '工作待办' },
{ btn_title: '发起提交' },
{ btn_title: '查看报表' },
{ btn_title: '查看数据' }
],
rules: {
name: {
rules: [{ required: true, errorMessage: '请填写' }]
},
gk: {
rules: [{ required: true, errorMessage: '请填写' }]
},
jd: {
rules: [{ required: true, errorMessage: '请填写' }]
},
nr: {
rules: [{ required: true, errorMessage: '请填写' }]
},
dj: {
rules: [{ required: true, errorMessage: '请填写' }]
}
},
infrastructureFormLabel: [
{ form_label: '作业内容', items_type: 'ipt' },
{ form_label: '作业条件(人员、机具、图纸、物资等、气候条件对作业的影响)', items_type: 'ipt' },
{ form_label: '风险类别', items_type: 'ipt' },
{ form_label: '管控措施', items_type: 'ipt' },
{
form_label: '风险等级',
items_type: 'sel',
options: [
{ value: 0, text: '可接受风险' },
{ value: 1, text: '低风险' },
{ value: 2, text: '中风险' },
{ value: 2, text: '高风险' },
{ value: 2, text: '特高风险' }
]
},
{
form_label: '管控级别',
items_type: 'sel',
options: [
{ value: 0, text: '项目部' },
{ value: 1, text: '分公司' },
{ value: 2, text: '公司职能部门' },
{ value: 2, text: '公司领导' },
{ value: 2, text: '运检站' },
{ value: 2, text: '各单位级' }
]
},
{
form_label: '是否有危大/易造成人员较大伤亡作业',
items_type: 'sel',
options: [
{ value: 0, text: '是' },
{ value: 1, text: '否' }
]
},
{
form_label: '方案是否报审',
items_type: 'sel',
options: [
{ value: 0, text: '是' },
{ value: 1, text: '否' }
]
},
{
form_label: '是否有涉网作业',
items_type: 'sel',
options: [
{ value: 0, text: '是' },
{ value: 1, text: '否' }
]
},
{
form_label: '线路/设备停电计划是否上报',
items_type: 'sel',
options: [
{ value: 0, text: '是' },
{ value: 1, text: '否' }
]
},
{ form_label: '项目负责人/联系电话', items_type: 'ipt' },
{ form_label: '单位负责人/联系电话', items_type: 'ipt' },
{ form_label: '计划数量', items_type: 'ipt' }
],
productionFormLabel: [
{ form_label: '作业内容', items_type: 'ipt' },
{ form_label: '实施单位', items_type: 'ipt' },
{ form_label: '实施部门', items_type: 'ipt' },
{ form_label: '任务来源', items_type: 'ipt' },
{
form_label: '作业类型',
items_type: 'sel',
options: [
{ value: 0, text: '检修' },
{ value: 1, text: '维护' }
]
},
{ form_label: '计划开始时间', items_type: 'sel' },
{ form_label: '计划结束时间', items_type: 'sel' },
{
form_label: '是否停电',
items_type: 'sel',
options: [
{ value: 0, text: '是' },
{ value: 1, text: '否' }
]
},
{ form_label: '停电设备(作业场所)', items_type: 'ipt' },
{ form_label: '作业监督人/联系电话', items_type: 'ipt' },
{ form_label: '作业负责人/联系电话', items_type: 'ipt' },
{
form_label: '管控级别',
items_type: 'sel',
options: [
{ value: 0, text: '项目部' },
{ value: 1, text: '分公司' },
{ value: 2, text: '公司职能部门' },
{ value: 2, text: '公司领导' },
{ value: 2, text: '运检站' },
{ value: 2, text: '各单位级' }
]
},
{
form_label: '风险等级',
items_type: 'sel',
options: [
{ value: 0, text: '可接受风险' },
{ value: 1, text: '低风险' },
{ value: 2, text: '中风险' },
{ value: 2, text: '高风险' },
{ value: 2, text: '特高风险' }
]
},
{
form_label: '管控方式(根据作业内容在作业文件栏中选择"是"、"否"',
items_type: 'sel',
options: [
{ value: 0, text: '过程管控' },
{ value: 1, text: '巡视管控' },
{ value: 2, text: '驻点管控' },
{ value: 2, text: '节点管控' }
]
},
{
form_label: '施工方案',
items_type: 'sel',
options: [
{ value: 0, text: '是' },
{ value: 1, text: '否' }
]
},
{
form_label: '作业指导书',
items_type: 'sel',
options: [
{ value: 0, text: '是' },
{ value: 1, text: '否' }
]
},
{
form_label: '作业表单',
items_type: 'sel',
options: [
{ value: 0, text: '是' },
{ value: 1, text: '否' }
]
},
{
form_label: '工作票',
items_type: 'sel',
options: [
{ value: 0, text: '是' },
{ value: 1, text: '否' }
]
},
{ form_label: '备注', items_type: 'ipt' },
{ form_label: '计划数量', items_type: 'ipt' }
],
currentSwiper: 0
}
},
mounted() {
// console.log('this.$refs.btnHeaderRef', this.$refs.btnHeaderRef, this.$refs.pagesAddRef)
const query = uni.createSelectorQuery()
query
.select('#btnHeaderRef')
.boundingClientRect(data => {
this.scrollHeight += data.height
})
.exec()
query
.select('#pagesAddRef')
.boundingClientRect(data => {
this.scrollHeight += data.height
})
.exec()
console.log('this.scrollHeight', this.scrollHeight)
},
methods: {
leftClick() {
uni.navigateBack()
},
onTapCheck(i) {
this.activeIndex = i
},
onReducePages() {
if (this.pagesTotal > 1) {
this.pagesTotal -= 1
}
},
onAddPages() {
this.pagesTotal += 1
},
onSelectProject() {
this.$refs.popup.open('center')
this.popupType = 'center'
},
onClosePopup() {
this.$refs.popup.close()
if (this.isType) {
this.isType = !this.isType
}
},
onSwiperChange(e) {
this.currentPage = e.detail.current + 1
},
onCheckAuditing(val) {
console.log(val, '----')
}
// onChangePages(num) {
// if (num > 1) {
// console.log('居中')
// }
// }
},
onLoad(options) {
if (options.type == 1) {
this.monthPlanTitle = '基建月计划'
} else {
this.monthPlanTitle = '生产月计划'
}
}
}
</script>
<style lang="scss" scoped>
.month-container {
height: 100vh;
.month-content {
.btn-header {
display: flex;
width: 100%;
button {
flex: 1;
height: 120rpx;
color: #2c2b2b;
font-size: 26rpx;
line-height: 120rpx;
text-align: center;
border-radius: 0;
background-color: #fff;
}
button::after {
border: none;
}
.active {
border-bottom: 2px solid #00337a;
}
}
.content-2 {
width: 100%;
.pages-add {
width: 100%;
height: 76rpx;
display: flex;
align-items: center;
background-color: #ccc;
view {
height: 76rpx;
}
.num-content {
flex: 1;
background-color: #fff;
.scroll-x {
width: 100%;
white-space: nowrap;
view {
width: 50%;
display: inline-block;
height: 76rpx;
text-align: center;
line-height: 76rpx;
color: #003778;
}
}
}
}
.time-container {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 38rpx;
}
.form-container {
padding: 10rpx 20rpx;
}
.submit-btn {
margin: 15rpx 0;
}
}
}
// 弹框样式
.popup-content {
width: 90vw;
padding: 20rpx;
background-color: #eeeeee;
.search {
width: 100%;
height: 70rpx;
display: flex;
align-items: center;
justify-content: space-between;
background-color: #eeeeee;
.select {
height: 68rpx;
width: 65%;
margin: 0;
}
button {
height: 68rpx;
width: 30%;
line-height: 68rpx;
font-size: 32rpx;
background-color: #003777;
color: #fff;
border-radius: 12rpx;
}
}
.project-content {
height: 460rpx;
width: 97%;
margin: 0 auto;
background-color: #fff;
text-align: center;
}
}
}
</style>