From 9a0cc29095672fb8a7d595b9d6a76981abbbb9df Mon Sep 17 00:00:00 2001
From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com>
Date: Sat, 26 Oct 2024 18:17:57 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9C=88=E8=AE=A1=E5=88=92=E6=8E=A5=E5=8F=A3?=
=?UTF-8?q?=E7=AD=89=E8=B0=83=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/workPlan/monthPlan.js | 40 ++
pages.json | 6 +
pages/workPlan/monthPlan/index.vue | 416 +++++++++++++++++--
pages/workPlan/monthPlanDetails/index.vue | 476 ++++++++++++++++++++++
4 files changed, 896 insertions(+), 42 deletions(-)
create mode 100644 pages/workPlan/monthPlanDetails/index.vue
diff --git a/api/workPlan/monthPlan.js b/api/workPlan/monthPlan.js
index 9ad736e..19bd1f2 100644
--- a/api/workPlan/monthPlan.js
+++ b/api/workPlan/monthPlan.js
@@ -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
+ })
+}
diff --git a/pages.json b/pages.json
index bcbd0d8..0e51571 100644
--- a/pages.json
+++ b/pages.json
@@ -785,6 +785,12 @@
"navigationStyle": "custom"
}
},
+ {
+ "path": "pages/workPlan/monthPlanDetails/index",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
{
"path": "pages/workPlan/networkPlan/index",
"style": {
diff --git a/pages/workPlan/monthPlan/index.vue b/pages/workPlan/monthPlan/index.vue
index 66e1913..dc0118e 100644
--- a/pages/workPlan/monthPlan/index.vue
+++ b/pages/workPlan/monthPlan/index.vue
@@ -36,14 +36,21 @@
-
+
- {{ item }}
+ {{ index + 1 }}
@@ -64,7 +71,7 @@
label-position="top"
label-width="200"
>
-
+
{{ projectName ? projectName : '请选择' }}
>
@@ -88,11 +95,18 @@
-->
-
+
-
+
+
-
-
+
+
-
-
+
+
@@ -239,7 +288,7 @@
提交人/提交时间
{{ item.upUser }}/{{ item.planTime }}
- {{ item.state }}
+ {{ onTypeChange(item.state) }}
@@ -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)
}
}
@@ -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;
+ }
+}
diff --git a/pages/workPlan/monthPlanDetails/index.vue b/pages/workPlan/monthPlanDetails/index.vue
new file mode 100644
index 0000000..957e4ad
--- /dev/null
+++ b/pages/workPlan/monthPlanDetails/index.vue
@@ -0,0 +1,476 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.title }}
+
+
+
+
+
+
+
+