月计划接口等调试
This commit is contained in:
parent
2f79c2fd54
commit
9a0cc29095
|
|
@ -48,3 +48,43 @@ export function getViewDataListApi(data) {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
// 月计划-查看数据-详情
|
||||
export function getPlanDetailApi(data) {
|
||||
return request_yn({
|
||||
url: '/ynPlanApp/infMonth/getPlanDetail',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 月计划-查看数据-详情-计划撤回
|
||||
export function revokePlanApi(data) {
|
||||
return request_yn({
|
||||
url: '/ynPlanApp/infMonth/backPlan',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 月计划-查看数据-详情-计划删除
|
||||
export function deletePlanApi(data) {
|
||||
return request_yn({
|
||||
url: '/ynPlanApp/infMonth/deletePlan',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 月计划-查看数据-详情-计划修改
|
||||
export function updateInfPlanContentApi(data) {
|
||||
return request_yn({
|
||||
url: '/ynPlanApp/infMonth/updateInfPlanContent',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 月计划-查看数据-详情-计划提交
|
||||
export function submitPlanApi(data) {
|
||||
return request_yn({
|
||||
url: '/ynPlanApp/infMonth/submitPlan',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -785,6 +785,12 @@
|
|||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/workPlan/monthPlanDetails/index",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/workPlan/networkPlan/index",
|
||||
"style": {
|
||||
|
|
|
|||
|
|
@ -36,14 +36,21 @@
|
|||
<view class="num-content">
|
||||
<!-- <uni-pagination :show-icon="true" :total="pagesTotal" :pageSize="1" /> -->
|
||||
|
||||
<scroll-view scroll-x="true" class="scroll-x" scroll-with-animation="true">
|
||||
<scroll-view
|
||||
scroll-x="true"
|
||||
class="scroll-x head__scroll"
|
||||
scroll-with-animation="true"
|
||||
:scroll-left="scrollLeft"
|
||||
>
|
||||
<view
|
||||
:class="{ 'active-page': item == currentSwiper + 1 }"
|
||||
v-for="item in pagesTotal"
|
||||
:key="item"
|
||||
@tap="onChangePages(item)"
|
||||
:class="{ 'active-page': index == currentSwiper }"
|
||||
v-for="(item, index) in monthParams"
|
||||
:key="index"
|
||||
class="item head__scroll_item"
|
||||
:ref="'item' + index"
|
||||
@tap="onChangePages(item, index)"
|
||||
>
|
||||
{{ item }}
|
||||
{{ index + 1 }}
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
|
@ -64,7 +71,7 @@
|
|||
label-position="top"
|
||||
label-width="200"
|
||||
>
|
||||
<uni-forms-item label="工程名称" style="margin-bottom: 2rpx" require>
|
||||
<uni-forms-item label="工程名称" style="margin-bottom: 2rpx" required>
|
||||
<view class="time-container" @tap="onSelectProject">
|
||||
<view>{{ projectName ? projectName : '请选择' }}</view>
|
||||
<text v-if="!projectName">></text>
|
||||
|
|
@ -88,11 +95,18 @@
|
|||
|
||||
</scroll-view> -->
|
||||
|
||||
<view style="background-color: #fff">
|
||||
<view style="background-color: #fff" class="scroll-content-1">
|
||||
<swiper circular :autoplay="false" :current="currentSwiper" style="height: 700rpx" @change="onSwiperChange">
|
||||
<swiper-item v-for="(item, index) in monthParams" :key="index">
|
||||
<scroll-view scroll-y="true" class="scroll-Y" style="height: 100%">
|
||||
<uni-forms class="form-container" ref="form" :modelValue="item" label-position="top" label-width="200">
|
||||
<uni-forms
|
||||
class="form-container"
|
||||
:ref="`monthPlanFormRef_${index}`"
|
||||
:rules="monthPlanFormRules"
|
||||
:model="item"
|
||||
label-position="top"
|
||||
label-width="200"
|
||||
>
|
||||
<uni-forms-item
|
||||
v-for="(f, i) in monthPlanTitle === '基建月计划' ? infrastructureFormLabel : productionFormLabel"
|
||||
:key="i"
|
||||
|
|
@ -134,6 +148,29 @@
|
|||
|
||||
<!-- 查看报表 -->
|
||||
<view v-show="activeIndex === '查看报表'" class="common-style">
|
||||
<view class="report-form-header" v-if="monthDataList.length > 0">
|
||||
<view>
|
||||
<scroll-view scroll-x class="header-left">
|
||||
<text
|
||||
:class="{ 'active-form-page': activeFormPages === index }"
|
||||
v-for="(item, index) in monthDataList"
|
||||
:key="index"
|
||||
@tap="onChangeFormPages(index)"
|
||||
>
|
||||
{{ index + 1 }}
|
||||
</text>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="header-right">
|
||||
<scroll-view scroll-x style="width: 100%; white-space: nowrap">
|
||||
<text v-if="kjsAmount > 0">可接受风险:{{ kjsAmount }}</text>
|
||||
<text v-if="gfxAmount > 0">高风险:{{ gfxAmount }}</text>
|
||||
<text v-if="zfxAmount > 0">中风险:{{ zfxAmount }}</text>
|
||||
<text v-if="dfxAmount > 0">低风险:{{ dfxAmount }}</text>
|
||||
<text v-if="tfxAmount > 0">特高风险:{{ tfxAmount }}</text>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-forms ref="form-b" label-position="top" label-width="200">
|
||||
<uni-forms-item label="工程名称" required>
|
||||
<!-- <view class="time-container" @tap="onSelectProject">
|
||||
|
|
@ -167,8 +204,15 @@
|
|||
|
||||
<view class="pages">
|
||||
<!-- <uni-pagination :show-icon="true" :total="1" /> -->
|
||||
<swiper circular :autoplay="false" :current="0" style="height: 700rpx" v-if="monthDataList.length > 0">
|
||||
<swiper-item v-for="item in monthDataList" :key="item.id">
|
||||
<swiper
|
||||
circular
|
||||
:autoplay="false"
|
||||
:current="activeFormPages"
|
||||
style="height: 700rpx"
|
||||
@change="onSwiperChangeForms"
|
||||
v-if="monthDataList.length > 0"
|
||||
>
|
||||
<swiper-item v-for="(item, index) in monthDataList" :key="index">
|
||||
<scroll-view scroll-y="true" class="scroll-Y" style="height: 100%">
|
||||
<uni-forms class="form-container" label-position="top" label-width="200">
|
||||
<uni-forms-item
|
||||
|
|
@ -224,11 +268,16 @@
|
|||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
|
||||
<scroll-view scroll-y>
|
||||
<view class="month-list" v-for="item in viewMonthPlanList" :key="item.id">
|
||||
<scroll-view scroll-y style="height: 600rpx">
|
||||
<view class="month-list" v-for="item in viewMonthPlanList" :key="item.id" @tap="onViewDetails(item)">
|
||||
<view class="item-header">
|
||||
<text>可接受风险:1</text>
|
||||
<text>2024-4</text>
|
||||
<text v-if="item.kjsfx > 0">可接受风险:{{ item.kjsfx }}</text>
|
||||
<text v-if="item.dfx > 0">低风险:{{ item.dfx }}</text>
|
||||
<text v-if="item.zfx > 0">中风险:{{ item.zfx }}</text>
|
||||
<text v-if="item.gfx > 0">高风险:{{ item.gfx }}</text>
|
||||
<text v-if="item.tgfx > 0">特高风险:{{ item.tgfx }}</text>
|
||||
|
||||
<text>{{ item.planTime }}</text>
|
||||
</view>
|
||||
|
||||
<view class="item-num">
|
||||
|
|
@ -239,7 +288,7 @@
|
|||
<view class="item-time">
|
||||
<text>提交人/提交时间</text>
|
||||
<text>{{ item.upUser }}/{{ item.planTime }}</text>
|
||||
<text>{{ item.state }}</text>
|
||||
<text>{{ onTypeChange(item.state) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
|
@ -351,6 +400,47 @@ export default {
|
|||
rules: [{ required: true, errorMessage: '请填写' }]
|
||||
}
|
||||
},
|
||||
monthPlanFormRules: {
|
||||
zynr: {
|
||||
rules: [{ required: true, errorMessage: '请填写作业内容' }]
|
||||
},
|
||||
zytj: {
|
||||
rules: [{ required: true, errorMessage: '请填写作业条件' }]
|
||||
},
|
||||
fxlb: {
|
||||
rules: [{ required: true, errorMessage: '请填写风险类型' }]
|
||||
},
|
||||
gkcs: {
|
||||
rules: [{ required: true, errorMessage: '请填写管控措施' }]
|
||||
},
|
||||
fxdj: {
|
||||
rules: [{ required: true, errorMessage: '请选择风险等级' }]
|
||||
},
|
||||
gkcj: {
|
||||
rules: [{ required: true, errorMessage: '请选择管控级别' }]
|
||||
},
|
||||
wdgc: {
|
||||
rules: [{ required: true, errorMessage: '请选择是否有危大/易造成较大伤亡作业' }]
|
||||
},
|
||||
fasp: {
|
||||
rules: [{ required: true, errorMessage: '请选择方案是否报审' }]
|
||||
},
|
||||
swzy: {
|
||||
rules: [{ required: true, errorMessage: '请选择是否有涉网作业' }]
|
||||
},
|
||||
sbtd: {
|
||||
rules: [{ required: true, errorMessage: '请选择线路/设备停电计划是否上报 ' }]
|
||||
},
|
||||
xmfzr: {
|
||||
rules: [{ required: true, errorMessage: '请填写项目负责人/联系电话' }]
|
||||
},
|
||||
dwfzr: {
|
||||
rules: [{ required: true, errorMessage: '请填写单位负责人/联系电话' }]
|
||||
},
|
||||
planCount: {
|
||||
rules: [{ required: true, errorMessage: '请填写计划数量' }]
|
||||
}
|
||||
},
|
||||
infrastructureFormLabel: [
|
||||
{ form_label: '作业内容', items_type: 'ipt', name: 'zynr' },
|
||||
{ form_label: '作业条件(人员、机具、图纸、物资等、气候条件对作业的影响)', items_type: 'ipt', name: 'zytj' },
|
||||
|
|
@ -565,7 +655,14 @@ export default {
|
|||
state: '',
|
||||
keyword: ''
|
||||
},
|
||||
viewMonthPlanList: []
|
||||
viewMonthPlanList: [],
|
||||
scrollLeft: 0,
|
||||
activeFormPages: 0,
|
||||
kjsAmount: 0,
|
||||
dfxAmount: 0,
|
||||
zfxAmount: 0,
|
||||
gfxAmount: 0,
|
||||
tfxAmount: 0
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
@ -594,6 +691,15 @@ export default {
|
|||
this.getRiskLevelListData()
|
||||
// 获取管控层级
|
||||
this.getControlLevelListData()
|
||||
|
||||
const this_ = this
|
||||
uni.$on('update', function () {
|
||||
this_.getViewDataList()
|
||||
})
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
uni.$off('update')
|
||||
},
|
||||
methods: {
|
||||
leftClick() {
|
||||
|
|
@ -603,14 +709,30 @@ export default {
|
|||
onTapCheck(i) {
|
||||
this.activeIndex = i
|
||||
},
|
||||
/* 减少页数 */
|
||||
onReducePages() {
|
||||
if (this.pagesTotal > 1) {
|
||||
if (this.currentSwiper + 1 === this.pagesTotal) {
|
||||
this.currentSwiper -= 1
|
||||
}
|
||||
this.pagesTotal -= 1
|
||||
this.monthParams.splice(this.monthParams.length - 1, 1)
|
||||
}
|
||||
},
|
||||
/* 增加页数 */
|
||||
onAddPages() {
|
||||
this.pagesTotal += 1
|
||||
// this.monthParams.push(this.paramsItem)
|
||||
// this.monthParams.splice(this.pagesTotal - 1, 0, this.paramsItem)
|
||||
this.monthParams.push({ ...this.paramsItem })
|
||||
},
|
||||
/* 页码数字点击 */
|
||||
// onChangePages(num) {
|
||||
// this.currentSwiper = num - 1
|
||||
// // if (num > 1) {
|
||||
// // console.log('居中')
|
||||
// // }
|
||||
// },
|
||||
onSelectProject() {
|
||||
this.$refs.popup.open('center')
|
||||
this.popupType = 'center'
|
||||
|
|
@ -635,32 +757,54 @@ export default {
|
|||
},
|
||||
/* 保存提交 */
|
||||
async onSaveSubmit() {
|
||||
console.log('保存提交')
|
||||
console.log('this.monthParams--', this.monthParams)
|
||||
|
||||
this.monthParams.forEach(e => {
|
||||
e.proName = this.projectId
|
||||
e.month = this.DateValue
|
||||
})
|
||||
|
||||
const saveParams = {
|
||||
id: JSON.stringify(this.monthParams),
|
||||
user: '',
|
||||
state: '1'
|
||||
// 表单校验
|
||||
if (!this.projectId) {
|
||||
uni.showToast({ icon: 'none', title: '请选择工程!' })
|
||||
return
|
||||
}
|
||||
try {
|
||||
const validateForms = async () => {
|
||||
for (let index = 0; index < this.monthParams.length; index++) {
|
||||
const valid = await new Promise(resolve => {
|
||||
this.$refs[`monthPlanFormRef_${index}`][0].validate(resolve)
|
||||
})
|
||||
|
||||
console.log('saveParams保存参数', saveParams)
|
||||
if (valid) {
|
||||
uni.showToast({ title: `第${index + 1}页有数据未完!`, icon: 'none' })
|
||||
this.currentSwiper = index
|
||||
throw new Error()
|
||||
}
|
||||
}
|
||||
}
|
||||
validateForms()
|
||||
.then(async res => {
|
||||
this.monthParams.forEach(e => {
|
||||
e.proName = this.projectId
|
||||
e.month = this.DateValue
|
||||
})
|
||||
|
||||
const res = await setMonthPlanApi(saveParams)
|
||||
|
||||
if (res.resMsg === '') console.log('res提交结果', res)
|
||||
},
|
||||
onChangePages(num) {
|
||||
this.currentSwiper = num - 1
|
||||
// if (num > 1) {
|
||||
// console.log('居中')
|
||||
// }
|
||||
const saveParams = {
|
||||
id: JSON.stringify(this.monthParams),
|
||||
user: '',
|
||||
state: '1'
|
||||
}
|
||||
console.log('saveParams保存参数', saveParams)
|
||||
const result = await setMonthPlanApi(saveParams)
|
||||
if (result.res == 1) {
|
||||
uni.showToast({ icon: 'none', title: '保存成功!' })
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
} else {
|
||||
uni.showToast({ icon: 'none', title: `保存失败,${result.resMsg}` })
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('校验未通过!')
|
||||
})
|
||||
} catch (error) {}
|
||||
},
|
||||
|
||||
onReduceMonth() {
|
||||
this.currentTime = this.$moment(this.currentTime).subtract(1, 'year').format('YYYY-MM')
|
||||
this.getMonthPlanData()
|
||||
|
|
@ -751,6 +895,10 @@ export default {
|
|||
/* 查看报表数据 */
|
||||
async getMonthPlanData() {
|
||||
this.queryDataParams.month = this.currentTime
|
||||
if (this.queryDataParams.proId == '') {
|
||||
uni.showToast({ icon: 'none', title: '请选择工程!' })
|
||||
return
|
||||
}
|
||||
console.log('this.queryDataParams查询报表的参数', this.queryDataParams)
|
||||
const res = await getMonthPlanDataApi(this.queryDataParams)
|
||||
console.log('res---查看的报表数据', res)
|
||||
|
|
@ -759,6 +907,22 @@ export default {
|
|||
uni.showToast({ icon: 'none', title: '暂无月计划数据!' })
|
||||
}
|
||||
this.monthDataList = res.obj
|
||||
this.activeFormPages = 0
|
||||
|
||||
if (this.monthDataList.length > 0) {
|
||||
this.kjsAmount = 0
|
||||
this.dfxAmount = 0
|
||||
this.zfxAmount = 0
|
||||
this.gfxAmount = 0
|
||||
this.tfxAmount = 0
|
||||
this.monthDataList.forEach(e => {
|
||||
this.kjsAmount = this.kjsAmount + e.kjsfx * 1
|
||||
this.dfxAmount = this.dfxAmount + e.dfx * 1
|
||||
this.zfxAmount = this.zfxAmount + e.zfx * 1
|
||||
this.gfxAmount = this.gfxAmount + e.gfx * 1
|
||||
this.tfxAmount = this.tfxAmount + e.tgfx * 1
|
||||
})
|
||||
}
|
||||
},
|
||||
/* 查看报表页面工程选择事件 */
|
||||
onChangeProjectSel(value) {
|
||||
|
|
@ -787,10 +951,126 @@ export default {
|
|||
},
|
||||
/* 获取查看数据中的数据 */
|
||||
async getViewDataList() {
|
||||
console.log('搜索参数', this.queryDataParamsNew)
|
||||
// console.log('搜索参数', this.queryDataParamsNew)
|
||||
const res = await getViewDataListApi(this.queryDataParamsNew)
|
||||
// console.log('res查看数据中的数据', res)
|
||||
console.log('res查看数据中的数据', res)
|
||||
this.viewMonthPlanList = res.obj
|
||||
},
|
||||
/* 处理枚举状态 */
|
||||
onTypeChange(type) {
|
||||
let typeString = ''
|
||||
switch (type) {
|
||||
case '0':
|
||||
typeString = '填报待提交'
|
||||
break
|
||||
case '1':
|
||||
typeString = '填报已撤回'
|
||||
break
|
||||
case '2':
|
||||
typeString = '填报已提交'
|
||||
break
|
||||
case '3':
|
||||
typeString = '项目部已撤回'
|
||||
break
|
||||
case '4':
|
||||
typeString = '分公司审核中'
|
||||
break
|
||||
case '5':
|
||||
typeString = '分公司未通过'
|
||||
break
|
||||
case '6':
|
||||
typeString = '分公司通过'
|
||||
break
|
||||
case '7':
|
||||
typeString = '总公司审核中'
|
||||
break
|
||||
case '8':
|
||||
typeString = '总公司未通过'
|
||||
break
|
||||
case '9':
|
||||
typeString = '总公司通过'
|
||||
break
|
||||
case '10':
|
||||
typeString = '总公司全部通过'
|
||||
break
|
||||
}
|
||||
|
||||
return typeString
|
||||
},
|
||||
/* 查看数据点击进入详情 */
|
||||
onViewDetails(item) {
|
||||
console.log('点击跳转', item)
|
||||
uni.navigateTo({
|
||||
url: `/pages/workPlan/monthPlanDetails/index?id=${item.id}&state=${item.state}&month=${item.planTime}`
|
||||
})
|
||||
},
|
||||
/* 元素居中 */
|
||||
onChangePages(value, ind) {
|
||||
this.currentSwiper = ind
|
||||
// this.currentSwiper = num - 1
|
||||
// 获取当前选中元素的位置
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
query
|
||||
.select(`.item:nth-child(${ind + 1})`)
|
||||
.boundingClientRect(rect => {
|
||||
const viewWidth = uni.getSystemInfoSync().windowWidth // 获取视图宽度
|
||||
const itemWidth = rect.width // 选中元素的宽度
|
||||
const itemLeft = rect.left // 选中元素的左边距
|
||||
|
||||
// 计算滚动位置,使选中元素居中
|
||||
const targetScrollLeft = itemLeft - viewWidth / 2 + itemWidth / 2
|
||||
this.scrollLeft = targetScrollLeft < 0 ? 0 : targetScrollLeft // 防止超出边界
|
||||
})
|
||||
.exec()
|
||||
},
|
||||
onChangeFormPages(index) {
|
||||
this.activeFormPages = index
|
||||
},
|
||||
onSwiperChangeForms(e) {
|
||||
this.activeFormPages = e.detail.current
|
||||
},
|
||||
/* 计算高度 */
|
||||
async calcScrollHeight(dom, bottom) {
|
||||
let that = this
|
||||
let scrollHeight = 0
|
||||
|
||||
new Promise((resolve, reject) => {
|
||||
uni.getSystemInfo({
|
||||
//调用uni-app接口获取屏幕高度
|
||||
success(res) {
|
||||
//成功回调函数
|
||||
that._data.pH = res.windowHeight
|
||||
let titleH = uni.createSelectorQuery().select(dom)
|
||||
|
||||
if (bottom) {
|
||||
let bottomDom = uni.createSelectorQuery().select(bottom)
|
||||
bottomDom
|
||||
.boundingClientRect(res => {
|
||||
const bottomHeight = res.height
|
||||
|
||||
titleH
|
||||
.boundingClientRect(data => {
|
||||
let pH = that._data.pH
|
||||
scrollHeight = pH - data.top - bottomHeight
|
||||
resolve(scrollHeight)
|
||||
})
|
||||
.exec()
|
||||
})
|
||||
.exec()
|
||||
} else {
|
||||
titleH
|
||||
.boundingClientRect(data => {
|
||||
let pH = that._data.pH
|
||||
scrollHeight = pH - data.top
|
||||
resolve(scrollHeight)
|
||||
})
|
||||
.exec()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// return scrollHeight
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
|
|
@ -799,6 +1079,12 @@ export default {
|
|||
} else {
|
||||
this.monthPlanTitle = '生产月计划'
|
||||
}
|
||||
},
|
||||
onReady() {
|
||||
this.calcScrollHeight('.scroll-content-1', '.bottom-btn').then(res => {
|
||||
console.log('res---', res)
|
||||
})
|
||||
// console.log('content_1content_1', content_1)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -814,7 +1100,7 @@ export default {
|
|||
width: 100%;
|
||||
height: 80rpx;
|
||||
position: fixed;
|
||||
bottom: 12rpx;
|
||||
bottom: 6px;
|
||||
left: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
@ -1076,6 +1362,7 @@ export default {
|
|||
|
||||
.month-list {
|
||||
width: 100%;
|
||||
margin-top: 16rpx;
|
||||
background-color: #fff;
|
||||
.item-header {
|
||||
width: 96%;
|
||||
|
|
@ -1115,4 +1402,49 @@ export default {
|
|||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.report-form-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
view {
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
text-align: right;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
|
||||
text {
|
||||
margin-left: 16rpx;
|
||||
padding: 12rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.report-form-header view:first-child {
|
||||
width: 30%;
|
||||
background-color: #fff;
|
||||
|
||||
.header-left {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
white-space: nowrap;
|
||||
|
||||
text {
|
||||
width: 50%;
|
||||
padding: 12rpx 0;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
|
||||
.active-form-page {
|
||||
border-bottom: 1px solid #003778;
|
||||
color: #003778 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,476 @@
|
|||
<template>
|
||||
<view style="padding: 15rpx">
|
||||
<u-navbar
|
||||
class="u-navbar"
|
||||
title="详情"
|
||||
placeholder
|
||||
@leftClick="leftClick"
|
||||
leftIconColor="#fff"
|
||||
bgColor="#00337A"
|
||||
:titleStyle="{ color: '#FFF', fontSize: '32rpx' }"
|
||||
/>
|
||||
|
||||
<view>
|
||||
<view class="item-header">
|
||||
<text>{{ month }}</text>
|
||||
<text v-if="kjsAmount > 0">可接受风险:{{ kjsAmount }}</text>
|
||||
<text v-if="gfxAmount > 0">高风险:{{ gfxAmount }}</text>
|
||||
<text v-if="zfxAmount > 0">中风险:{{ zfxAmount }}</text>
|
||||
<text v-if="dfxAmount > 0">低风险:{{ dfxAmount }}</text>
|
||||
<text v-if="tfxAmount > 0">特高风险:{{ tfxAmount }}</text>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<scroll-view scroll-x class="header-left">
|
||||
<text
|
||||
:class="{ 'active-form-page': activeFormPages === index }"
|
||||
v-for="(item, index) in monthDetailsList"
|
||||
:key="index"
|
||||
@tap="onChangeFormPages(index)"
|
||||
>
|
||||
{{ index + 1 }}
|
||||
</text>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<swiper
|
||||
circular
|
||||
:autoplay="false"
|
||||
:current="activeFormPages"
|
||||
class="scroll-content"
|
||||
:style="{ height: navHeight + 'px' }"
|
||||
@change="onSwiperChangeForms"
|
||||
>
|
||||
<swiper-item v-for="(item, index) in monthDetailsList" :key="index" :style="{ height: navHeight + 'px' }">
|
||||
<scroll-view scroll-y="true" class="scroll-Y" :style="{ height: navHeight + 'px' }">
|
||||
<uni-forms class="form-container" label-position="top" label-width="200">
|
||||
<uni-forms-item
|
||||
v-for="(f, i) in monthPlanTitle === '基建月计划' ? infrastructureFormLabel : productionFormLabel"
|
||||
:key="i"
|
||||
:label="f.form_label"
|
||||
:name="f.name"
|
||||
required
|
||||
>
|
||||
<uni-easyinput
|
||||
v-if="f.items_type === 'ipt'"
|
||||
:clear="false"
|
||||
type="text"
|
||||
v-model="item[f.name]"
|
||||
:disabled="editDisabled"
|
||||
/>
|
||||
<uni-data-select
|
||||
v-model="item[f.name]"
|
||||
:localdata="f.options"
|
||||
:disabled="editDisabled"
|
||||
:clear="false"
|
||||
v-if="f.items_type === 'sel'"
|
||||
></uni-data-select>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
<view class="revoke">
|
||||
<view @tap="showModalFun(item.id)" v-for="item in btnList" :key="item.id" v-show="item.isShow.includes(state)">
|
||||
<uni-icons :type="item.type" size="20" style="color: #00337a"></uni-icons>
|
||||
<text style="margin-top: 8rpx">{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
submitPlanApi,
|
||||
deletePlanApi,
|
||||
revokePlanApi,
|
||||
getPlanDetailApi,
|
||||
getRiskLevelListApi,
|
||||
getControlLevelListApi,
|
||||
updateInfPlanContentApi
|
||||
} from '../../../api/workPlan/monthPlan'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
monthDetailsList: [],
|
||||
monthPlanTitle: '基建月计划',
|
||||
editDisabled: false,
|
||||
state: '',
|
||||
month: '',
|
||||
activeFormPages: 0,
|
||||
params: {
|
||||
id: ''
|
||||
},
|
||||
btnList: [
|
||||
{ title: '修改', id: 1, type: 'compose', isShow: ['1', '3'] },
|
||||
{ title: '删除', id: 2, type: 'trash', isShow: ['1', '3'] },
|
||||
{ title: '撤回', id: 3, type: 'redo-filled', isShow: ['2', '4', '5', '6', '7', '8', '9'] },
|
||||
{ title: '提交', id: 4, type: 'upload', isShow: ['1', '3'] }
|
||||
],
|
||||
infrastructureFormLabel: [
|
||||
{ form_label: '作业内容', items_type: 'ipt', name: 'zynr' },
|
||||
{ form_label: '作业条件(人员、机具、图纸、物资等、气候条件对作业的影响)', items_type: 'ipt', name: 'zytj' },
|
||||
{ form_label: '风险类别', items_type: 'ipt', name: 'fxlb' },
|
||||
{ form_label: '管控措施', items_type: 'ipt', name: 'gkcs' },
|
||||
{
|
||||
form_label: '风险等级',
|
||||
items_type: 'sel',
|
||||
name: 'fxdj',
|
||||
options: []
|
||||
},
|
||||
{
|
||||
form_label: '管控级别',
|
||||
items_type: 'sel',
|
||||
name: 'gkcj',
|
||||
options: []
|
||||
},
|
||||
{
|
||||
form_label: '是否有危大/易造成人员较大伤亡作业',
|
||||
items_type: 'sel',
|
||||
name: 'wdgc',
|
||||
options: [
|
||||
{ value: '1', text: '是' },
|
||||
{ value: '0', text: '否' }
|
||||
]
|
||||
},
|
||||
{
|
||||
form_label: '方案是否报审',
|
||||
items_type: 'sel',
|
||||
name: 'fasp',
|
||||
options: [
|
||||
{ value: '1', text: '是' },
|
||||
{ value: '0', text: '否' }
|
||||
]
|
||||
},
|
||||
{
|
||||
form_label: '是否有涉网作业',
|
||||
items_type: 'sel',
|
||||
name: 'swzy',
|
||||
options: [
|
||||
{ value: '1', text: '是' },
|
||||
{ value: '0', text: '否' }
|
||||
]
|
||||
},
|
||||
{
|
||||
form_label: '线路/设备停电计划是否上报',
|
||||
items_type: 'sel',
|
||||
name: 'sbtd',
|
||||
options: [
|
||||
{ value: '1', text: '是' },
|
||||
{ value: '0', text: '否' }
|
||||
]
|
||||
},
|
||||
{ form_label: '项目负责人/联系电话', items_type: 'ipt', name: 'xmfzr' },
|
||||
{ form_label: '单位负责人/联系电话', items_type: 'ipt', name: 'dwfzr' },
|
||||
{ form_label: '计划数量', items_type: 'ipt', name: 'planCount' }
|
||||
],
|
||||
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: 1, text: '是' },
|
||||
{ value: 0, text: '否' }
|
||||
]
|
||||
},
|
||||
{ form_label: '停电设备(作业场所)', items_type: 'ipt' },
|
||||
{ form_label: '作业监督人/联系电话', items_type: 'ipt' },
|
||||
{ form_label: '作业负责人/联系电话', items_type: 'ipt' },
|
||||
{
|
||||
form_label: '管控级别',
|
||||
items_type: 'sel',
|
||||
options: []
|
||||
},
|
||||
{
|
||||
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: 1, text: '是' },
|
||||
{ value: 0, 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' }
|
||||
],
|
||||
kjsAmount: 0,
|
||||
dfxAmount: 0,
|
||||
zfxAmount: 0,
|
||||
gfxAmount: 0,
|
||||
tfxAmount: 0,
|
||||
navHeight: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
leftClick() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
async getRiskLevelListData() {
|
||||
const res = await getRiskLevelListApi()
|
||||
|
||||
try {
|
||||
this.infrastructureFormLabel.forEach(e => {
|
||||
if (e.form_label === '风险等级') {
|
||||
e.options = res.map(e => {
|
||||
return {
|
||||
value: e.id,
|
||||
text: e.name
|
||||
}
|
||||
})
|
||||
|
||||
throw new Error()
|
||||
}
|
||||
})
|
||||
} catch (error) {}
|
||||
},
|
||||
async getControlLevelListData() {
|
||||
const res = await getControlLevelListApi()
|
||||
// console.log('管控层级', res)
|
||||
try {
|
||||
this.infrastructureFormLabel.forEach(e => {
|
||||
if (e.form_label === '管控级别') {
|
||||
e.options = res.map(e => {
|
||||
return {
|
||||
value: e.id,
|
||||
text: e.name
|
||||
}
|
||||
})
|
||||
|
||||
throw new Error()
|
||||
}
|
||||
})
|
||||
} catch (error) {}
|
||||
},
|
||||
/* 获取详情 */
|
||||
async getPlanDetailData() {
|
||||
const res = await getPlanDetailApi(this.params)
|
||||
console.log('详情数据res', res)
|
||||
|
||||
this.monthDetailsList = res.obj
|
||||
|
||||
if (this.monthDetailsList.length > 0) {
|
||||
this.kjsAmount = 0
|
||||
this.dfxAmount = 0
|
||||
this.zfxAmount = 0
|
||||
this.gfxAmount = 0
|
||||
this.tfxAmount = 0
|
||||
this.monthDetailsList.forEach(e => {
|
||||
this.kjsAmount = this.kjsAmount + e.kjsfx * 1
|
||||
this.dfxAmount = this.dfxAmount + e.dfx * 1
|
||||
this.zfxAmount = this.zfxAmount + e.zfx * 1
|
||||
this.gfxAmount = this.gfxAmount + e.gfx * 1
|
||||
this.tfxAmount = this.tfxAmount + e.tgfx * 1
|
||||
})
|
||||
}
|
||||
},
|
||||
showModalFun(type) {
|
||||
let tipTitle = ''
|
||||
let API = null
|
||||
switch (type) {
|
||||
case 1:
|
||||
tipTitle = '修改'
|
||||
API = updateInfPlanContentApi
|
||||
break
|
||||
case 2:
|
||||
tipTitle = '删除'
|
||||
API = deletePlanApi
|
||||
break
|
||||
case 3:
|
||||
tipTitle = '撤销'
|
||||
API = revokePlanApi
|
||||
break
|
||||
case 4:
|
||||
tipTitle = '提交'
|
||||
API = submitPlanApi
|
||||
break
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `确定要${tipTitle}吗?`,
|
||||
showCancel: true,
|
||||
cancelText: '取消',
|
||||
confirmText: '确定',
|
||||
confirmColor: '#00337a',
|
||||
cancelColor: '#00337a',
|
||||
success: async res => {
|
||||
if (res.confirm) {
|
||||
const params = {
|
||||
id: JSON.stringify(this.monthDetailsList)
|
||||
}
|
||||
const result = await API(type === 1 ? params : this.params)
|
||||
|
||||
if (result.res == 1) {
|
||||
uni.showToast({ title: `${tipTitle}成功!`, icon: 'none' })
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
success() {
|
||||
uni.$emit('update')
|
||||
}
|
||||
})
|
||||
}, 500)
|
||||
} else {
|
||||
uni.showToast({ title: `${tipTitle}失败!`, icon: 'none' })
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
onChangeFormPages(index) {
|
||||
this.activeFormPages = index
|
||||
},
|
||||
onSwiperChangeForms(e) {
|
||||
this.activeFormPages = e.detail.current
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.state = options.state
|
||||
this.month = options.month
|
||||
console.log('options.state', options.state, options.month)
|
||||
Promise.all([this.getRiskLevelListData(), this.getControlLevelListData()]).then(res => {
|
||||
this.params.id = options.id
|
||||
this.getPlanDetailData()
|
||||
})
|
||||
},
|
||||
onReady() {
|
||||
let that = this
|
||||
uni.getSystemInfo({
|
||||
//调用uni-app接口获取屏幕高度
|
||||
success(res) {
|
||||
//成功回调函数
|
||||
that._data.pH = res.windowHeight
|
||||
let titleH = uni.createSelectorQuery().select('.scroll-content')
|
||||
let bottom = uni.createSelectorQuery().select('.revoke')
|
||||
bottom
|
||||
.boundingClientRect(res => {
|
||||
const bottomHeight = res.height
|
||||
|
||||
titleH
|
||||
.boundingClientRect(data => {
|
||||
let pH = that._data.pH
|
||||
that._data.navHeight = pH - data.top - bottomHeight
|
||||
})
|
||||
.exec()
|
||||
})
|
||||
.exec()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10rpx 0;
|
||||
font-size: 22rpx;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
::v-deep .uni-input-input:disabled {
|
||||
-webkit-text-fill-color: #333;
|
||||
}
|
||||
|
||||
.revoke {
|
||||
width: 100%;
|
||||
padding: 30rpx 0;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
|
||||
view {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.header-left {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
white-space: nowrap;
|
||||
|
||||
text {
|
||||
width: 16.66%;
|
||||
padding: 12rpx 0;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
|
||||
.active-form-page {
|
||||
border-bottom: 1px solid #003778;
|
||||
color: #003778 !important;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue