提交修改

This commit is contained in:
quyixiao 2020-08-21 11:42:40 +08:00
parent cf8d225ffd
commit c9c8bc8fc0
2 changed files with 126 additions and 23 deletions

View File

@ -0,0 +1,87 @@
<template>
<el-dialog
:title="'' "
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px">
<el-form-item label="意见" prop="resultComment">
<div id="resultCommentEditorElem" class="editor"></div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="commitRecord(2)">通过</el-button>
<el-button type="primary" @click="commitRecord(3)">侍提交</el-button>
</span>
</el-dialog>
</template>
<script>
import E from 'wangeditor'
import {commitApproval} from '@/api/api_result'
var Base64 = require('js-base64').Base64
export default {
data () {
return {
visible: false,
resultCommentEditor: null,
recordResultId: 0,
auth: null,
dataForm: {
resultComment: ''
},
dataRule: {
}
}
},
mounted () {
},
computed: {},
methods: {
async init (recordResultId, auth) {
this.recordResultId = recordResultId
this.auth = auth
this.visible = true
this.$nextTick(async () => {
this.$refs['dataForm'].resetFields()
if (this.resultCommentEditor === null) {
this.resultCommentEditor = new E('#resultCommentEditorElem')
this.resultCommentEditor.customConfig.uploadImgServer = '/uploadPicture'
this.resultCommentEditor.customConfig.uploadFileName = 'file'
this.resultCommentEditor.customConfig.uploadImgParams = ''
this.resultCommentEditor.customConfig.debug = true
this.resultCommentEditor.create()
}
})
},
alertInfo (msg) {
this.$message({
message: msg,
type: 'success',
duration: 1500,
onClose: () => {
}
})
},
commitRecord (status) {
commitApproval({
'recordResultId': this.recordResultId,
'resultComment': Base64.encode(this.resultCommentEditor.txt.html()),
'status': status
}).then(data => {
if (data && data.code === 0) {
this.$emit('refreshDataList', this.recordResultId)
} else {
this.alertInfo(data.msg)
}
})
},
stringIsNull (str) {
if (typeof str === 'undefined' || str === null || str === '') {
return true
}
return false
}
}
}
</script>

View File

@ -26,20 +26,21 @@
<div class="titleBottom"> <div class="titleBottom">
<div class="bottom" v-show="this.auth.commit == 1" > <div class="bottom" v-show="this.auth.commit == 1" >
<p> <span style="cursor: pointer" @click="commitApproval">提交审批</span></p> <p><span style="cursor: pointer" @click="commitApprovalYes('你确认要提交审批吗?')">提交审批</span></p>
</div> </div>
<div class="bottom" v-show="this.auth.approvel == 1" > <div class="bottom" v-show="this.auth.approvel == 1">
<p> <span style="cursor: pointer" @click="commitApproval('你确定要审批通过吗?')" >审批通过</span></p> <p><span style="cursor: pointer" @click="commitApprovalAddOrUpdate">审批</span></p>
</div> </div>
<div class="bottom" v-show="this.auth.confirmCommit == 1" > <div class="bottom" v-show="this.auth.confirmCommit == 1">
<p> <span style="cursor: pointer" @click="commitApproval('你要确认得分吗?')" >确认得分</span></p> <p><span style="cursor: pointer" @click="commitApprovalYes('你要确认得分吗?')">确认得分</span></p>
</div> </div>
<div class="bottom" v-show="this.auth.reject == 1" > <div class="bottom" v-show="this.auth.reject == 1">
<p> <span style="cursor: pointer;color: red">驳回</span></p> <p><span style="cursor: pointer">驳回</span></p>
</div> </div>
</div> </div>
</div> </div>
@ -91,25 +92,24 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column width="80" label="操作" v-if="(auth.add === 1 || auth.edit == 1) && hasOperator" align="center" fixed="right">
<el-table-column width="80" label="操作" align="center" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="primary" style="margin-left:0px;" @click="handleAddOrUpdate(0,scope.row.type )" v-if="scope.row.isAdd===1 && auth.add == 1 ">添加</el-button> <el-button size="mini" type="primary" style="margin-left:0px;" @click="handleAddOrUpdate(0,scope.row.type )" v-if="scope.row.isAdd===1 && auth.add == 1 ">添加</el-button>
<el-button size="mini" style="margin-left:0px;" @click="handleAddOrUpdate(scope.row.id,scope.row.type)" v-if="scope.row.isEdit > 0 && auth.edit == 1" >编辑</el-button> <el-button size="mini" style="margin-left:0px;" @click="handleAddOrUpdate(scope.row.id,scope.row.type)" v-if="scope.row.isEdit > 0 && auth.edit == 1">编辑</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 弹窗, 新增 / 修改 --> <!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<approval-add-or-update v-if="approvalVisible" ref="approvalAddOrUpdate" @refreshDataList="getDataList"></approval-add-or-update>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import {getStaffResultDetail, commitApproval} from '@/api/api_result' import {getStaffResultDetail, commitApproval} from '@/api/api_result'
import AddOrUpdate from './recorddetail-add-or-update' import AddOrUpdate from './recorddetail-add-or-update'
import ApprovalAddOrUpdate from './approval-add-or-update.vue'
export default { export default {
created () { created () {
@ -137,6 +137,7 @@ export default {
return { return {
active: 3, active: 3,
type: 1, type: 1,
hasOperator: false,
recordResultId: 0, recordResultId: 0,
tableData: [], tableData: [],
firstRowspan: 5, firstRowspan: 5,
@ -151,13 +152,15 @@ export default {
department3: '技术部门', department3: '技术部门',
superStaff: '吴林', superStaff: '吴林',
addOrUpdateVisible: false, addOrUpdateVisible: false,
approvalVisible: false,
loading: false, loading: false,
auth: [], auth: [],
recordType: 0 recordType: 0
} }
}, },
components: { components: {
AddOrUpdate AddOrUpdate,
ApprovalAddOrUpdate
}, },
activated () { activated () {
this.recordResultId = this.$route.query.id this.recordResultId = this.$route.query.id
@ -187,11 +190,15 @@ export default {
this.auth = data.auth this.auth = data.auth
this.recordType = data.recordType this.recordType = data.recordType
this.recordResultId = data.recordResultId this.recordResultId = data.recordResultId
if (this.tableData.find(item => item.isAdd === 1 || item.isEdit === 1)) {
this.hasOperator = true
}
} else { } else {
this.tableData = [] this.tableData = []
} }
this.dataListLoading = false this.dataListLoading = false
this.addOrUpdateVisible = false this.addOrUpdateVisible = false
this.approvalVisible = false
}) })
}, },
// / // /
@ -203,21 +210,23 @@ export default {
}, 500) }, 500)
}) })
}, },
cellStyle ({row, column, rowIndex, columnIndex}) { commitApprovalAddOrUpdate () {
if (rowIndex === this.firstRowspan || rowIndex === this.threeRowspan) { this.approvalVisible = true
return 'background:#FFC400;font-weight:bolder!important;' this.$nextTick(() => {
} else { setTimeout(() => {
return '' this.$refs.approvalAddOrUpdate.init(this.recordResultId, this.auth)
} }, 500)
})
}, },
commitApproval (msg = '确定要提交审批吗?') { commitApprovalYes (msg = '确定要提交审批吗?') {
this.$confirm(msg, '提示', { this.$confirm(msg, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
commitApproval({ commitApproval({
'recordResultId': this.recordResultId 'recordResultId': this.recordResultId,
'status': 2
}).then(data => { }).then(data => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.getDataList() this.getDataList()
@ -233,6 +242,13 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
cellStyle ({row, column, rowIndex, columnIndex}) {
if (rowIndex === this.firstRowspan || rowIndex === this.threeRowspan) {
return 'background:#FFC400;font-weight:bolder!important;'
} else {
return ''
}
},
objectSpanMethod ({row, column, rowIndex, columnIndex}) { objectSpanMethod ({row, column, rowIndex, columnIndex}) {
if (columnIndex === 0) { if (columnIndex === 0) {
if (rowIndex === 0) { if (rowIndex === 0) {
@ -381,7 +397,7 @@ export default {
.bottom{ .bottom{
float: right; float: right;
color: blue; color: blue;
width: 100px; width: 80px;
height: 30px; height: 30px;
text-align: left; text-align: left;
.des{ .des{