|
|
@@ -283,7 +283,7 @@ export default {
|
|
|
toolbars: [
|
|
|
{ key: 'refresh', label: '刷新', hidden: () => { return !this.isZuZhang || !this.isEdit || this.isFinished } },
|
|
|
{ key: 'save', label: '保存', hidden: () => { return !this.isZuZhang || this.isFinished } },
|
|
|
- { key: 'sendMsg', label: '提醒评估人', icon: 'el-icon-bell', hidden: () => { return !this.isZuZhang || !this.isEdit || this.isFinished } },
|
|
|
+ // { key: 'sendMsg', label: '提醒评估人', icon: 'el-icon-bell', hidden: () => { return !this.isZuZhang || !this.isEdit || this.isFinished } },
|
|
|
{ key: 'peizhifengxian', label: '更新风险库', type: 'info', icon: 'el-icon-setting', hidden: () => { return !this.isZuZhang || !this.isEdit } },
|
|
|
{ key: 'submit', label: '提交', icon: 'el-icon-finished', type: 'success', hidden: () => { return !this.isZuZhang || !this.isEdit || this.isFinished } },
|
|
|
{ key: 'cancel', label: '退出' }
|
|
|
@@ -375,6 +375,19 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 获取最新数据
|
|
|
+ async getNewData () {
|
|
|
+ const sql = `select * from t_fxpgjlb2 where id_='${this.params.id_}'`
|
|
|
+ const { variables: { data }} = await this.$common.request('sql', sql)
|
|
|
+ return data
|
|
|
+ },
|
|
|
+ // 判断是否已完成
|
|
|
+ async getIsFinish () {
|
|
|
+ const data = await this.getNewData()
|
|
|
+ if (data.length > 0 && data[0].shi_fou_guo_shen_ === '已完成') {
|
|
|
+ throw new Error('已结束,不可操作!')
|
|
|
+ }
|
|
|
+ },
|
|
|
// 快照URL
|
|
|
getReportParams (path, selection, data) {
|
|
|
const { level } = this.$store.getters
|
|
|
@@ -390,138 +403,147 @@ export default {
|
|
|
},
|
|
|
// 提交
|
|
|
async goSubmit () {
|
|
|
- if (!this.checkRequired(true)) {
|
|
|
- return this.$message.warning('请先保存后再提交!')
|
|
|
- }
|
|
|
- // 先检查状态
|
|
|
- const sql2 = `select * from t_fxpgjlb2 where id_='${this.params.id_}'`
|
|
|
- const { variables: { data: data2 }} = await this.$common.request('sql', sql2)
|
|
|
- if (data2.length > 0 && data2[0].shi_fou_guo_shen_ === '已完成') {
|
|
|
- return this.$message.warning('已结束,不可再次提交!')
|
|
|
- }
|
|
|
- if (!data2[0].ping_gu_ren_yuan_) {
|
|
|
- return this.$message.warning('请先指定评估人!')
|
|
|
- }
|
|
|
- const pinGuRenNum = data2[0].ping_gu_ren_yuan_.split(',').length
|
|
|
- const sql = `select * from t_fxsbpgb2 where parent_id_='${this.params.id_}'`
|
|
|
- const { variables: { data }} = await this.$common.request('sql', sql)
|
|
|
- const submitNum = new Set(data.map(item => item.bian_zhi_ren_)).size
|
|
|
- if (submitNum === pinGuRenNum && data.every(item => item.shi_fou_guo_shen_ === '已完成')) {
|
|
|
- this.$confirm('请仔细检查并保存后再提交,一旦提交不可再更改,是否继续?', '提示', {
|
|
|
+ try {
|
|
|
+ this.$confirm('提交后不可修改,是否确认保存并提交?', '提示', {
|
|
|
confirmButtonText: '继续',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
}).then(async () => {
|
|
|
- // 0.生成快照
|
|
|
- const formName = '风险管理/风险识别评估表V2.rpx'
|
|
|
- const res = await this.$common.snapshoot({
|
|
|
- url: this.$getReportFile(formName, this.getReportParams(formName, this.params.id_, {
|
|
|
- ...this.preParams,
|
|
|
- shi_fou_guo_shen_: '已完成'
|
|
|
- })),
|
|
|
- name: this.params.id_,
|
|
|
- type: 'pdf'
|
|
|
- })
|
|
|
- console.log(res)
|
|
|
- if (!res.data || !res.data.id) {
|
|
|
- console.log('快照生成失败')
|
|
|
- } else {
|
|
|
- console.log('快照生成成功')
|
|
|
- }
|
|
|
- // 1.修改状态为已完成 并保存快照
|
|
|
- const updateParamsRecord = {
|
|
|
- tableName: 't_fxpgjlb2',
|
|
|
- updList: [{
|
|
|
- where: {
|
|
|
- id_: this.params.id_
|
|
|
- },
|
|
|
- param: {
|
|
|
- shi_fou_guo_shen_: '已完成',
|
|
|
- kuai_zhao_: res.data.id
|
|
|
- }
|
|
|
- }]
|
|
|
- }
|
|
|
- await this.$common.request('update', updateParamsRecord)
|
|
|
- // console.log(data)
|
|
|
- // 2.推送给措施制定人下一个流程
|
|
|
- let count = 0
|
|
|
- const addParams = {
|
|
|
- tableName: 't_fxkzcsb2',
|
|
|
- paramWhere: data.map(item => {
|
|
|
- if (item.feng_xian_ying_du !== '风险接受' && item.zhi_ding_ren_) {
|
|
|
- count++
|
|
|
- return {
|
|
|
+ // 提交前自动保存
|
|
|
+ await this.goSave()
|
|
|
+ // 判断每个评估人是否已完成识别项
|
|
|
+ const pinGuRenNum = this.Ids.length
|
|
|
+ const sql = `select * from t_fxsbpgb2 where parent_id_='${this.params.id_}'`
|
|
|
+ const { variables: { data }} = await this.$common.request('sql', sql)
|
|
|
+ const submitNum = new Set(data.map(item => item.bian_zhi_ren_)).size
|
|
|
+ if (submitNum === pinGuRenNum && data.every(item => item.shi_fou_guo_shen_ === '已完成')) {
|
|
|
+ // 0.生成快照
|
|
|
+ const formName = '风险管理/风险识别评估表V2.rpx'
|
|
|
+ const res = await this.$common.snapshoot({
|
|
|
+ url: this.$getReportFile(formName, this.getReportParams(formName, this.params.id_, {
|
|
|
+ ...this.preParams,
|
|
|
+ shi_fou_guo_shen_: '已完成'
|
|
|
+ })),
|
|
|
+ name: this.params.id_,
|
|
|
+ type: 'pdf'
|
|
|
+ })
|
|
|
+ console.log(res)
|
|
|
+ if (!res.data || !res.data.id) {
|
|
|
+ console.log('快照生成失败')
|
|
|
+ } else {
|
|
|
+ console.log('快照生成成功')
|
|
|
+ }
|
|
|
+ // 1.修改状态为已完成 并保存快照
|
|
|
+ const updateParamsRecord = {
|
|
|
+ tableName: 't_fxpgjlb2',
|
|
|
+ updList: [{
|
|
|
+ where: {
|
|
|
+ id_: this.params.id_
|
|
|
+ },
|
|
|
+ param: {
|
|
|
+ shi_fou_guo_shen_: '已完成',
|
|
|
+ kuai_zhao_: res.data.id
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ await this.$common.request('update', updateParamsRecord)
|
|
|
+ // console.log(data)
|
|
|
+ // 2.推送给措施制定人下一个流程
|
|
|
+ let count = 0
|
|
|
+ const addParams = {
|
|
|
+ tableName: 't_fxkzcsb2',
|
|
|
+ paramWhere: data.map(item => {
|
|
|
+ if (item.feng_xian_ying_du !== '风险接受' && item.zhi_ding_ren_) {
|
|
|
+ count++
|
|
|
+ return {
|
|
|
+ di_dian_: this.level,
|
|
|
+ shi_fou_guo_shen_: '已编制',
|
|
|
+ bian_zhi_ren_: item.zhi_ding_ren_,
|
|
|
+ bian_zhi_bu_men_: this.getPersonPosition(item.zhi_ding_ren_),
|
|
|
+ bian_zhi_shi_jian: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ gai_jin_bian_hao_: ('FXGJ-' + dayjs().format('YYYYMMDDHHmmss')) + count,
|
|
|
+ yao_su_tiao_kuan_: item.yao_su_tiao_kuan_,
|
|
|
+ gong_zuo_huan_jie: item.gong_zuo_huan_jie,
|
|
|
+ gong_zuo_miao_shu: item.gong_zuo_miao_shu,
|
|
|
+ feng_xian_miao_sh: item.feng_xian_miao_sh,
|
|
|
+ zu_chang_: this.infoFxssbData.zu_chang_,
|
|
|
+ zu_chang_id_: this.infoFxssbData.zu_chang_id_,
|
|
|
+ shi_wu_shuo_ming_: this.infoFxssbData.shi_wu_shuo_ming_,
|
|
|
+ yuan_zhi_shu_: item.feng_xian_zhi_shu,
|
|
|
+ kong_zhi_fang_fa_: item.xian_xing_kong_zh,
|
|
|
+ feng_xian_lei_xin: this.infoFxssbData.feng_xian_lei_xin,
|
|
|
+ qian_fu_jian_: this.infoFxssbData.yi_ju_wen_jian_id,
|
|
|
+ ji_hua_bian_hao_: this.infoFxssbData.ji_hua_bian_hao_,
|
|
|
+ ni_cai_qu_kong_zh: item.ni_cai_qu_cuo_shi
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).filter(i => i !== undefined),
|
|
|
+ formKey: 'fxcscsbV2',
|
|
|
+ defKey: 'Process_1li9h0n'
|
|
|
+ }
|
|
|
+ console.log(addParams)
|
|
|
+ if (addParams.paramWhere.length) {
|
|
|
+ await this.$common.request('add', addParams)
|
|
|
+ // 3.推送给组长 评估报告流程
|
|
|
+ const addParams2 = {
|
|
|
+ tableName: 't_fxkzbg',
|
|
|
+ paramWhere: [{
|
|
|
di_dian_: this.level,
|
|
|
shi_fou_guo_shen_: '已编制',
|
|
|
- bian_zhi_ren_: item.zhi_ding_ren_,
|
|
|
- bian_zhi_bu_men_: this.getPersonPosition(item.zhi_ding_ren_),
|
|
|
- bian_zhi_shi_jian: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- gai_jin_bian_hao_: ('FXGJ-' + dayjs().format('YYYYMMDDHHmmss')) + count,
|
|
|
- yao_su_tiao_kuan_: item.yao_su_tiao_kuan_,
|
|
|
- gong_zuo_huan_jie: item.gong_zuo_huan_jie,
|
|
|
- gong_zuo_miao_shu: item.gong_zuo_miao_shu,
|
|
|
- feng_xian_miao_sh: item.feng_xian_miao_sh,
|
|
|
+ bian_zhi_ren_: this.infoFxssbData.zu_chang_id_,
|
|
|
+ bian_zhi_bu_men_: this.getPersonPosition(this.infoFxssbData.zu_chang_id_),
|
|
|
+ bian_zhi_shi_jian: dayjs().format('YYYY-MM-DD HH:mm'),
|
|
|
zu_chang_: this.infoFxssbData.zu_chang_,
|
|
|
zu_chang_id_: this.infoFxssbData.zu_chang_id_,
|
|
|
- shi_wu_shuo_ming_: this.infoFxssbData.shi_wu_shuo_ming_,
|
|
|
- yuan_zhi_shu_: item.feng_xian_zhi_shu,
|
|
|
- kong_zhi_fang_fa_: item.xian_xing_kong_zh,
|
|
|
feng_xian_lei_xin: this.infoFxssbData.feng_xian_lei_xin,
|
|
|
- qian_fu_jian_: this.infoFxssbData.yi_ju_wen_jian_id,
|
|
|
+ kai_shi_ri_qi_: this.infoFxssbData.kai_shi_ri_qi_,
|
|
|
+ jie_shu_ri_qi_: this.infoFxssbData.jie_shu_ri_qi_,
|
|
|
+ wan_cheng_ri_qi_: this.infoFxssbData.bao_gao_shi_jian_,
|
|
|
+ shi_wu_shuo_ming_: this.infoFxssbData.shi_wu_shuo_ming_,
|
|
|
ji_hua_bian_hao_: this.infoFxssbData.ji_hua_bian_hao_,
|
|
|
- ni_cai_qu_kong_zh: item.ni_cai_qu_cuo_shi
|
|
|
- }
|
|
|
+ hui_yi_wen_jian_: this.infoFxssbData.hui_yi_fu_jian_
|
|
|
+ }],
|
|
|
+ formKey: 'fxbg',
|
|
|
+ defKey: 'Process_0mrlsj7'
|
|
|
}
|
|
|
- }).filter(i => i !== undefined),
|
|
|
- formKey: 'fxcscsbV2',
|
|
|
- defKey: 'Process_1li9h0n'
|
|
|
- }
|
|
|
- console.log(addParams)
|
|
|
- if (addParams.paramWhere.length) {
|
|
|
- await this.$common.request('add', addParams)
|
|
|
- // 3.推送给组长 评估报告流程
|
|
|
- const addParams2 = {
|
|
|
- tableName: 't_fxkzbg',
|
|
|
- paramWhere: [{
|
|
|
- di_dian_: this.level,
|
|
|
- shi_fou_guo_shen_: '已编制',
|
|
|
- bian_zhi_ren_: this.infoFxssbData.zu_chang_id_,
|
|
|
- bian_zhi_bu_men_: this.getPersonPosition(this.infoFxssbData.zu_chang_id_),
|
|
|
- bian_zhi_shi_jian: dayjs().format('YYYY-MM-DD HH:mm'),
|
|
|
- zu_chang_: this.infoFxssbData.zu_chang_,
|
|
|
- zu_chang_id_: this.infoFxssbData.zu_chang_id_,
|
|
|
- feng_xian_lei_xin: this.infoFxssbData.feng_xian_lei_xin,
|
|
|
- kai_shi_ri_qi_: this.infoFxssbData.kai_shi_ri_qi_,
|
|
|
- jie_shu_ri_qi_: this.infoFxssbData.jie_shu_ri_qi_,
|
|
|
- wan_cheng_ri_qi_: this.infoFxssbData.bao_gao_shi_jian_,
|
|
|
- shi_wu_shuo_ming_: this.infoFxssbData.shi_wu_shuo_ming_,
|
|
|
- ji_hua_bian_hao_: this.infoFxssbData.ji_hua_bian_hao_,
|
|
|
- hui_yi_wen_jian_: this.infoFxssbData.hui_yi_fu_jian_
|
|
|
- }],
|
|
|
- formKey: 'fxbg',
|
|
|
- defKey: 'Process_0mrlsj7'
|
|
|
+ console.log(addParams2)
|
|
|
+ await this.$common.request('add', addParams2)
|
|
|
+ console.log('流程推送成功')
|
|
|
+ } else {
|
|
|
+ console.log('无需推送')
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$message.success('提交成功')
|
|
|
+ // 提醒用户推送信息
|
|
|
+ if (addParams.paramWhere.length) {
|
|
|
+ const ids = addParams.paramWhere.map(item => this.switchIdtoUserName(item.bian_zhi_ren_))
|
|
|
+ this.$alert(`已向 ${ids.join(',')} ${ids.length}位措施制定人推送风险改进流程,同时向组长 ${this.infoFxssbData.zu_chang_} 推送风险报告流程!`, '提交成功', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: action => {
|
|
|
+ this.closeDialog(true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.closeDialog(true)
|
|
|
}
|
|
|
- console.log(addParams2)
|
|
|
- await this.$common.request('add', addParams2)
|
|
|
- console.log('流程推送成功')
|
|
|
} else {
|
|
|
- console.log('无需推送')
|
|
|
+ this.$message.warning('存在未完成风险识别项的评估人员,无法提交!')
|
|
|
+ return
|
|
|
}
|
|
|
-
|
|
|
- // 4.主动生成快照 todo
|
|
|
- // let formName='风险管理/风险控制与评价表V2.rpx'
|
|
|
-
|
|
|
- this.$message.success('提交成功')
|
|
|
- this.closeDialog(true)
|
|
|
})
|
|
|
.catch(() => {
|
|
|
|
|
|
})
|
|
|
- } else {
|
|
|
- this.$message.warning('存在未提交风险识别项的在评估人员,请提醒提交后再进行操作!')
|
|
|
- return
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.warning(error.message)
|
|
|
}
|
|
|
},
|
|
|
+ // id 转 姓名
|
|
|
+ switchIdtoUserName (id) {
|
|
|
+ const { userList } = this.$store.getters
|
|
|
+ const user = userList.find(item => item.userId === id)
|
|
|
+ return user ? user.userName : ''
|
|
|
+ },
|
|
|
goPeizhifengxian () {
|
|
|
const buttons = document.querySelector('button[name="peizhifengxian"]')
|
|
|
if (buttons) {
|
|
|
@@ -609,11 +631,27 @@ export default {
|
|
|
return bianzhiUserid.positionId
|
|
|
}
|
|
|
},
|
|
|
- checkRequired (flag) {
|
|
|
- if (flag) {
|
|
|
- return this.preParams.nian_du_ && this.preParams.kai_shi_ri_qi_ && this.preParams.jie_shu_ri_qi_ && this.preParams.bao_gao_shi_jian_ && this.preParams.hui_yi_shi_jian_ && this.preParams.can_hui_ren_yuan_ && this.preParams.ping_gu_ren_yuan_
|
|
|
- } else {
|
|
|
- return this.infoFxssbData.nian_du_ && this.infoFxssbData.kai_shi_ri_qi_ && this.infoFxssbData.jie_shu_ri_qi_ && this.infoFxssbData.bao_gao_shi_jian_ && this.infoFxssbData.hui_yi_shi_jian_ && this.infoFxssbData.can_hui_ren_yuan_ && this.infoFxssbData.ping_gu_ren_yuan_
|
|
|
+ checkRequired () {
|
|
|
+ if (!this.infoFxssbData.nian_du_) {
|
|
|
+ throw new Error('请填写年度!')
|
|
|
+ }
|
|
|
+ if (!this.infoFxssbData.kai_shi_ri_qi_) {
|
|
|
+ throw new Error('请填写评估开始日期!')
|
|
|
+ }
|
|
|
+ if (!this.infoFxssbData.jie_shu_ri_qi_) {
|
|
|
+ throw new Error('请填写评估结束日期!')
|
|
|
+ }
|
|
|
+ if (!this.infoFxssbData.bao_gao_shi_jian_) {
|
|
|
+ throw new Error('请填写报告完成时间!')
|
|
|
+ }
|
|
|
+ if (!this.infoFxssbData.hui_yi_shi_jian_) {
|
|
|
+ throw new Error('请填写首次会议时间!')
|
|
|
+ }
|
|
|
+ if (!this.infoFxssbData.can_hui_ren_yuan_) {
|
|
|
+ throw new Error('请填写参会人员!')
|
|
|
+ }
|
|
|
+ if (!this.infoFxssbData.ping_gu_ren_yuan_) {
|
|
|
+ throw new Error('请填写评估人员!')
|
|
|
}
|
|
|
},
|
|
|
async goAdd () {
|
|
|
@@ -635,12 +673,8 @@ export default {
|
|
|
async goEdit () {
|
|
|
try {
|
|
|
// 先检查状态
|
|
|
- const sql2 = `select * from t_fxpgjlb2 where id_='${this.params.id_}'`
|
|
|
- const { variables: { data: data2 }} = await this.$common.request('sql', sql2)
|
|
|
- if (data2.length > 0 && data2[0].shi_fou_guo_shen_ === '已完成') {
|
|
|
- return this.$message('已结束,不可再次编辑!')
|
|
|
- }
|
|
|
-
|
|
|
+ await this.getIsFinish()
|
|
|
+ // 更新主表
|
|
|
const updateParamsRecord = {
|
|
|
tableName: 't_fxpgjlb2',
|
|
|
updList: [{
|
|
|
@@ -651,8 +685,6 @@ export default {
|
|
|
}]
|
|
|
}
|
|
|
await this.$common.request('update', updateParamsRecord)
|
|
|
- this.$message.success('修改成功')
|
|
|
- this.closeDialog(true)
|
|
|
|
|
|
// 当前人员数组
|
|
|
const curIds = this.infoFxssbData.ping_gu_ren_yuan_.split(',')
|
|
|
@@ -681,20 +713,24 @@ export default {
|
|
|
console.log('删除成功')
|
|
|
}
|
|
|
}
|
|
|
+ await this.goRefresh() // 修改之后刷新
|
|
|
+ this.$message.success('修改成功')
|
|
|
} catch (error) {
|
|
|
- console.log(error)
|
|
|
- this.$message.warning('修改失败')
|
|
|
+ this.$message.warning(error.message)
|
|
|
+ throw new Error(error.message)
|
|
|
}
|
|
|
},
|
|
|
- goSave () {
|
|
|
- // console.log(this.infoFxssbData)
|
|
|
- if (!this.checkRequired()) {
|
|
|
- return this.$message.warning('请检查必填项是否填写完整!')
|
|
|
- }
|
|
|
- if (this.isEdit) {
|
|
|
- this.goEdit()
|
|
|
- } else {
|
|
|
- this.goAdd()
|
|
|
+ async goSave () {
|
|
|
+ try {
|
|
|
+ this.checkRequired()
|
|
|
+ if (this.isEdit) {
|
|
|
+ await this.goEdit()
|
|
|
+ } else {
|
|
|
+ await this.goAdd()
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.warning(error.message)
|
|
|
+ throw new Error(error.message)
|
|
|
}
|
|
|
},
|
|
|
// 刷新
|
|
|
@@ -748,7 +784,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
async init () {
|
|
|
- this.isEdit = this.params && this.params.id_
|
|
|
+ this.isEdit = !!(this.params && this.params.id_)
|
|
|
if (this.isEdit) {
|
|
|
this.infoFxssbData = this.params
|
|
|
this.preParams = JSON.parse(JSON.stringify(this.params))
|