ah-jjzhgd-web/src/views/basic/progressCorrection/index.vue

353 lines
11 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>
<div class="app-container">
<div class="filter-container">
<el-input
v-model="listQuery.keyWord"
placeholder="关键字"
style="width: 200px"
class="filter-item"
:maxlength="30"
@keyup.enter.native="handleFilter"
/>
<el-button
v-waves
style="margin-left: 40px"
class="filter-item"
type="primary"
@click="handleFilter"
>
查询
</el-button>
</div>
<el-table
:key="tableKey"
v-loading="listLoading"
:data="list"
border
fit
highlight-current-row
style="width: 100%"
:max-height="tableHeight"
>
<el-table-column label="序号" align="center" width="80" type="index">
<template scope="scope">
<span>{{ (listQuery.pageNum - 1) * 10 + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="工序名称" align="center" prop="gxName" />
<el-table-column label="工程名称" align="center" prop="proName" />
<el-table-column label="计划开始时间" align="center" prop="planStartTime" />
<el-table-column label="计划结束时间" align="center" prop="planEndTime" />
<el-table-column label="实际开始时间" align="center" prop="startTime" />
<el-table-column label="实际结束时间" align="center" prop="endTime" />
<el-table-column label="进度占比" align="center" prop="gxWeight" />
<el-table-column label="延迟原因" align="center" prop="delaReason" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
<template slot-scope="scope">
<el-button v-waves type="text" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<!-- <el-button v-waves type="text" size="mini" @click="handleDelete(row, $index)">删除</el-button> -->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.pageNum"
:limit.sync="listQuery.pageSize"
@pagination="getList"
/>
<el-dialog append-to-body :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="630px" @closed="handleClosedModal">
<div ref="content">
<el-form
ref="dataForm"
:rules="rules"
:model="temp"
label-position="right"
label-width="120px"
>
<el-form-item :label="this.titleTwo" prop="gxId">
<el-select v-model="temp.gxId" placeholder="请选择" style="width: 100%" clearable>
<el-option v-for="item in typeList" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
<el-form-item label="计划开始时间:" prop="planStartTime">
<el-date-picker
v-model="temp.planStartTime"
style="width: 100%"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
/>
</el-form-item>
<el-form-item label="计划结束时间:" prop="planEndTime">
<el-date-picker
v-model="temp.planEndTime"
style="width: 100%"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
/>
</el-form-item>
<el-form-item label="作业权重(%)" prop="gxWeight">
<el-input v-model="temp.gxWeight" placeholder="进度占比" :maxlength="50" />
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button v-waves @click="closeDialog"> 关闭 </el-button>
<el-button v-waves v-throttle-click="dialogStatus === 'create' ? createData : updateData" type="primary">
提交
</el-button>
</div>
</el-dialog>
<modul-dialog ref="pwdVerifiersDialog" :title="componentDialog.title" :width="componentDialog.width"
v-model="componentDialog.openFalg">
<component :is="componentDialog.modulName" />
</modul-dialog>
</div>
</template>
<script>
import waves from '@/directive/waves'
import Pagination from '@/components/Pagination'
import _ from 'lodash/fp'
import {
addQualityItem,
deleteQualityItem,
updateQualityItem
} from '@/api/basic/quality'
import {
getTowerList,
} from '@/api/basic/project'
import { getProgressCorrection,getProcessItemDetail,updateProcessItem } from '@/api/basic/progressCorrection'
import { verifyPwd } from '@/api/verifyPwd'
import modulDialog from '@/components/pwdVerifiers/pwdVerifiers.vue'
import { removeWatermark, setWaterMark } from "@/utils/waterMark";
import {decryptData} from '@/utils/test';
export default {
components: { Pagination,modulDialog },
directives: { waves },
data() {
return {
checkRow:{},
componentDialog: {
modulName: '', //组件名称
title: '',
width: '',
openFalg: false
},
tableKey: 0,
list: [],
total: 0,
titleTwo: '',
typeList: [],
listLoading: false,
listQuery: {
pageNum: 1,
pageSize: 10,
keyword: ''
},
tableHeight: 650,
showReviewer: false,
temp: {
gxId: '',
planStartTime: '',
planEndTime: '',
gxWeight: '',
bidCode: '',
planId: ''
},
textMap: {
update: '编辑',
create: '新增'
},
dialogFormVisible: false,
processModalVisible: false,
processType: '',
bidCode: '',
rules: {
gxId: [{ required: true, message: '请选择', trigger: 'change' }],
planStartTime: [{ required: true, message: '不能为空', trigger: 'blur' }],
planEndTime: [{ required: true, message: '不能为空', trigger: 'blur' }],
gxWeight: [{ required: true, message: '不能为空', trigger: 'blur' }]
}
}
},
created() {
this.getList()
// this.getTowerList()
},
mounted() {
window.onresize = () => {
removeWatermark(this.$refs.content);
this.loadWaterMark();
}
},
methods: {
closeDialog(){
removeWatermark(this.$refs.content);
this.dialogFormVisible = false
},
loadWaterMark() {
//设置水印内容,这段代码实现的是两行文本内容的水印。
const nickName = sessionStorage.getItem('nickName');
const roleName = sessionStorage.getItem('roleName');
let str1 = nickName ? decryptData(nickName) : '';
let str2 = roleName ? decryptData(roleName) : '';
let str3 = '建设部';
if (nickName || roleName) {
setWaterMark(str1, str2, str3,this.$refs.content);
}
},
openModulDialog(title, modulName, width, openFalg) {
this.componentDialog.title = title
this.componentDialog.modulName = modulName
this.componentDialog.width = width
this.componentDialog.openFalg = openFalg
},
verifiersPwd(data) {
verifyPwd(data).then((response) => {
this.$message({
showClose: true,
message: response.msg,
type: 'success',
duration: 500
})
// 关闭验证密码页面
this.componentDialog.openFalg = false;
if (this.$refs.pwdVerifiersDialog) {
this.$refs.pwdVerifiersDialog.resetForm();
}
this.isOpenEditDialog();
})
},
async getTowerList() {
getTowerList({ param: this.processType === '线路' ? this.bidCode : '400', proType: this.processType === '线路' ? 2 : 1 }).then(res => {
this.typeList = res.data
console.log(this.typeList)
})
},
getList() {
this.listLoading = true
getProgressCorrection(this.listQuery).then((response) => {
this.list = response.rows
this.total = response.total
}).finally(() => {
})
setTimeout(()=>{
this.listLoading = false
},500)
},
// 查询
handleFilter() {
this.listQuery.pageNum = 1
this.getList()
},
async handleUpdate(row) {
this.checkRow = _.cloneDeep(row);
this.isOpenEditDialog();
// this.openModulDialog('验证密码', 'pwdVerifiers', '600px', true)
},
async isOpenEditDialog(){
let row = this.checkRow;
await getProcessItemDetail({ planId: row.planId, bidCode: row.bidCode }).then((res) => {
// this.$set(this.processType,res.data.proType)
// this.$set(this.bidCode,res.data.bidCode)
// this.$set(this.titleTwo,this.processType === '线路' ? '杆塔' : '工序计划')
// this.temp = Object.assign({}, res.data)
this.processType = res.data.proType
this.titleTwo = this.processType === '线路' ? '杆塔' : '工序计划'
this.bidCode = res.data.bidCode
console.log(this.processType)
this.$set(this.temp,'gxId',res.data.gxId)
this.$set(this.temp,'planStartTime',res.data.planStartTime)
this.$set(this.temp,'planEndTime',res.data.planEndTime)
this.$set(this.temp,'gxWeight',res.data.gxWeight)
this.$set(this.temp,'planId',res.data.planId)
this.$set(this.temp,'bidCode',res.data.bidCode)
// this.dialogStatus = 'update'
// this.dialogFormVisible = true
// this.temp = Object.assign({}, res.data)
})
await this.getTowerList();
setTimeout(()=>{
this.dialogStatus = 'update';
this.dialogFormVisible = true;
this.$nextTick(() => {
this.loadWaterMark();
})
},300)
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.commitUpdateData();
}
})
},
commitUpdateData() {
updateProcessItem(this.temp).then((response) => {
this.$message({
showClose: true,
message: response.msg,
type: 'success',
duration: 2000
})
this.checkRow = {};
this.getList()
this.dialogFormVisible = false
}).finally(() => {
})
},
// 删除数据
handleDelete(row, index) {
this.$confirm(`确定要删除该数据吗?`, {
type: 'warning',
title: '操作提示',
beforeClose: async(action, instance, done) => {
if (action === 'confirm') {
deleteQualityItem({ evalId: row.evalId }).then((response) => {
done()
this.$message({
showClose: true,
message: response.msg,
type: 'success',
duration: 2000
})
this.getList()
})
} else {
done()
}
}
})
},
handleClosedModal() {
this.dialogFormVisible = false
this.$refs['dataForm'].resetFields()
this.temp = {}
removeWatermark(this.$refs.content);
},
handleProcess(row) {
this.processType = row.proType
this.bidCode = row.bidCode
this.processModalVisible = true
}
}
}
</script>