| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230 |
- <template>
- <el-dialog
- v-loading="loading"
- :title="title"
- :visible.sync="dialogVisible"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- :show-close="false"
- append-to-body
- fullscreen
- class="dialog paper-detail-dialog"
- top="0"
- >
- <div slot="title" class="dialog-title">
- <span class="dialogtitle">{{ title }}</span>
- <div>
- <ibps-toolbar :actions="toolbars" @action-event="handleActionEvent" />
- </div>
- </div>
- <div class="container">
- <div class="left" :style="{ width: initWidth }">
- <el-descriptions
- title=""
- direction="vertical"
- :column="5"
- border
- size="mini"
- >
- <el-descriptions-item label="年度" class="aaaa">
- <span class="required-star">*</span>
- <el-date-picker
- v-model="infoFxssbData.nian_du_"
- type="year"
- placeholder="选择年"
- :disabled="readonly"
- value-format="yyyy"
- size="mini"
- />
- </el-descriptions-item>
- <el-descriptions-item label="编制部门">
- <div style="display: flex">
- <span class="required-star">*</span>
- <ibps-user-selector
- v-model="infoFxssbData.bian_zhi_bu_men_"
- type="position"
- readonly-text="text"
- :disabled="readonly"
- :multiple="false"
- size="mini"
- style="width: 100%"
- :filter="filter"
- filtrate
- />
- </div>
- </el-descriptions-item>
- <el-descriptions-item label="编制人">
- <ibps-user-selector
- type="user"
- :value="infoFxssbData.bian_zhi_ren_"
- readonly-text="text"
- :disabled="true"
- :multiple="true"
- size="mini"
- />
- </el-descriptions-item>
- <el-descriptions-item label="编制时间">
- <span class="required-star">*</span>
- <el-date-picker
- v-model="infoFxssbData.bian_zhi_shi_jian"
- type="datetime"
- placeholder="选择日期时间"
- :disabled="readonly"
- value-format="yyyy-MM-dd HH:mm:ss"
- size="mini"
- />
- </el-descriptions-item>
- <el-descriptions-item label="评估编号">
- {{ infoFxssbData.ji_hua_bian_hao_ }}
- </el-descriptions-item>
- <el-descriptions-item label="组长">
- <ibps-user-selector
- type="user"
- :value="infoFxssbData.zu_chang_id_"
- readonly-text="text"
- :disabled="true"
- :multiple="true"
- size="mini"
- :filter="filter"
- filtrate
- />
- </el-descriptions-item>
- <el-descriptions-item label="评估开始时间">
- <span class="required-star">*</span>
- <el-date-picker
- v-model="infoFxssbData.kai_shi_ri_qi_"
- type="date"
- placeholder="选择日期"
- :disabled="readonly"
- value-format="yyyy-MM-dd"
- size="mini"
- />
- </el-descriptions-item>
- <el-descriptions-item label="评估结束时间">
- <span class="required-star">*</span>
- <el-date-picker
- v-model="infoFxssbData.jie_shu_ri_qi_"
- type="date"
- placeholder="选择日期"
- :disabled="readonly"
- value-format="yyyy-MM-dd"
- size="mini"
- />
- </el-descriptions-item>
- <el-descriptions-item label="报告完成时间">
- <span class="required-star">*</span>
- <el-date-picker
- v-model="infoFxssbData.bao_gao_shi_jian_"
- type="date"
- placeholder="选择日期"
- :disabled="readonly"
- value-format="yyyy-MM-dd"
- size="mini"
- />
- </el-descriptions-item>
- <el-descriptions-item label="风险类型">
- <div>
- <el-radio
- v-model="infoFxssbData.feng_xian_lei_xin"
- label="质量"
- size="mini"
- :disabled="isEdit"
- >质量</el-radio
- >
- <el-radio
- v-model="infoFxssbData.feng_xian_lei_xin"
- label="安全"
- size="mini"
- :disabled="isEdit"
- >安全</el-radio
- >
- </div>
- </el-descriptions-item>
- <el-descriptions-item label="时机" :span="1">
- <el-select
- v-model="infoFxssbData.shi_ji_"
- :disabled="readonly"
- placeholder="请选择"
- size="mini"
- >
- <el-option
- v-for="item in [
- '定期评估',
- '新增活动',
- '不良事件',
- '程序变化',
- '业务变化'
- ]"
- :key="item"
- :label="item"
- :value="item"
- />
- </el-select>
- </el-descriptions-item>
- <el-descriptions-item label="范围" :span="onlyoneWay ? 2 : 1">
- <el-input
- v-model="infoFxssbData.fan_wei_"
- :disabled="readonly"
- size="mini"
- />
- </el-descriptions-item>
- <el-descriptions-item label="方法" :span="onlyoneWay ? 2 : 1">
- <el-select
- v-model="infoFxssbData.fang_fa_"
- size="mini"
- style="width: 100%"
- :disabled="readonly"
- filterable
- allow-create
- clearable
- placeholder="请选择方法"
- >
- <el-option
- v-for="item in fangFaOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-descriptions-item>
- <el-descriptions-item
- v-if="!onlyoneWay"
- label="风险系数计算方式"
- :span="2"
- >
- <span class="required-star">*</span>
- <el-radio
- v-for="(v, k) in culWays"
- :key="k"
- v-model="infoFxssbData.ji_suan_fang_shi_"
- :label="k"
- size="mini"
- :disabled="isEdit"
- >{{ v }}
- </el-radio>
- </el-descriptions-item>
- <el-descriptions-item label="目的" :span="5">
- <el-input
- v-model="infoFxssbData.mu_di_"
- :disabled="readonly"
- size="mini"
- />
- </el-descriptions-item>
- <el-descriptions-item label="依据文件" :span="5">
- <!-- 模版弹窗 -->
- <ibps-custom-dialog
- v-if="!readonly"
- v-model="infoFxssbData.yi_ju_wen_jian_id"
- template-key="nsyjwjxz"
- multiple
- type="dialog"
- class="custom-dialog"
- placeholder="请选择依据文件"
- size="mini"
- icon="el-icon-search"
- />
- <pre style="margin: 0">{{ infoFxssbData.yi_ju_wen_jian_ }}</pre>
- </el-descriptions-item>
- <el-descriptions-item label="首次会议时间" :span="1">
- <el-date-picker
- v-model="infoFxssbData.hui_yi_shi_jian_"
- type="datetime"
- placeholder="选择日期时间"
- default-time="12:00:00"
- :disabled="readonly"
- value-format="yyyy-MM-dd HH:mm"
- size="mini"
- />
- </el-descriptions-item>
- <el-descriptions-item label="参会人员" :span="4">
- <div style="display: flex">
- <ibps-user-selector
- v-model="infoFxssbData.can_hui_ren_yuan_"
- style="width: 100%"
- type="user"
- readonly-text="text"
- :disabled="readonly"
- :multiple="true"
- size="mini"
- :filter="filter"
- filtrate
- />
- </div>
- </el-descriptions-item>
- <el-descriptions-item label="会议附件" :span="5">
- <ibps-attachment
- v-model="infoFxssbData.hui_yi_fu_jian_"
- :download="true"
- multiple
- accept="*"
- :readonly="readonly"
- size="mini"
- />
- </el-descriptions-item>
- <el-descriptions-item label="事务说明 " :span="5">
- <el-input
- v-model="infoFxssbData.shi_wu_shuo_ming_"
- :disabled="readonly"
- size="mini"
- /></el-descriptions-item>
- <el-descriptions-item label="评估人员 " :span="5">
- <div style="display: flex">
- <span class="required-star">*</span>
- <ibps-user-selector
- v-model="infoFxssbData.ping_gu_ren_yuan_"
- type="user"
- style="width: 100%"
- readonly-text="text"
- :disabled="readonly"
- :multiple="true"
- size="mini"
- :filter="filter"
- filtrate
- />
- </div>
- </el-descriptions-item>
- </el-descriptions>
- <div style="margin-top: 20px">
- <el-alert
- title="根据评估人员选定的风险识别项给每个措施制定人推送风险改进流程"
- type="success"
- :closable="false"
- />
- <RiskPeopleTable
- ref="RiskPeopleTableRef"
- :params="params"
- :people-ids="infoFxssbData.ping_gu_ren_yuan_"
- :people-dept-info="infoFxssbData.ping_gu_bu_men_"
- :cul-ways="culWays"
- :bian-zhi-ren="infoFxssbData.bian_zhi_ren_"
- @goBack="goRefresh"
- @update-people-dept-info="handleUpdatePeopleDeptInfo"
- />
- </div>
- </div>
- </div>
- <RiskDetail ref="RiskDetailRef" :cul-ways="culWays" @close="goRefresh" />
- <el-image-viewer
- v-if="showViewer"
- :on-close="closeViewer"
- :url-list="[FlowPic]"
- />
- </el-dialog>
- </template>
- <script>
- import { getSetting } from '@/utils/query'
- import dayjs from 'dayjs'
- import RiskPeopleTable from './riskPeopleTableV3.vue'
- import ibpsUserSelector from '@/business/platform/org/selector'
- import RiskDetail from './riskDetail.vue'
- import IbpsAttachment from '@/business/platform/file/attachment/selector'
- import DataFormrender from '@/business/platform/data/templaterender/form'
- import DataTemplateFormrenderDialog from '@/business/platform/data/templaterender/form/dialog.vue'
- import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
- import FlowPic from '@/assets/images/risk/file-read-18951.png'
- export default {
- components: {
- ElImageViewer,
- RiskDetail,
- RiskPeopleTable,
- ibpsUserSelector,
- IbpsAttachment,
- DataFormrender,
- DataTemplateFormrenderDialog,
- IbpsCustomDialog: () =>
- import('@/business/platform/data/templaterender/custom-dialog')
- },
- props: {
- params: {
- type: Object,
- default: function () {
- return {}
- }
- }
- },
- data() {
- const { userId, position, level } = this.$store.getters
- return {
- FlowPic: FlowPic,
- showViewer: false,
- filter: [
- {
- descVal: '1',
- includeSub: true,
- old: 'position',
- partyId: this.$store.getters.userInfo.employee.positions,
- partyName: '',
- scriptContent: '',
- type: 'user',
- userType: 'position'
- }
- ],
- isFirst: true,
- userId: userId,
- position: position,
- level: level.second || level.first,
- pkValue: '',
- readonly: true,
- DialogVisible: false,
- loading: false,
- dialogVisible: true,
- title: '风险评估与措施',
- toolbars: [
- { key: 'openFlowPic', label: '流程图', icon: 'ibps-icon-image' },
- {
- 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: 'peizhifengxian', label: '更新风险库', type: 'info', icon: 'el-icon-setting', hidden: () => { return !this.isZuZhang || !this.isEdit } },
- {
- key: 'submit',
- label: '提交',
- icon: 'el-icon-finished',
- hidden: () => {
- return !this.isZuZhang || !this.isEdit || this.isFinished
- }
- },
- {
- key: 'cancel',
- label: '退出',
- type: 'danger',
- icon: 'ibps-icon-close'
- }
- ],
- infoFxssbData: {
- nian_du_: '',
- bian_zhi_bu_men_: '',
- bian_zhi_ren_: '',
- bian_zhi_shi_jian: '',
- zu_chang_: '',
- zu_chang_id_: '',
- kai_shi_ri_qi_: '',
- jie_shu_ri_qi_: '',
- bao_gao_shi_jian_: '',
- feng_xian_lei_xin: '',
- shi_ji_: '',
- fan_wei_: '',
- fang_fa_: '',
- mu_di_: '',
- yi_ju_wen_jian_id: '',
- yi_ju_wen_jian_: '',
- hui_yi_shi_jian_: '',
- can_hui_ren_yuan_: '',
- hui_yi_fu_jian_: '',
- shi_wu_shuo_ming_: '',
- ping_gu_ren_yuan_: '',
- ji_hua_bian_hao_: '',
- ji_suan_fang_shi_: '',
- ping_gu_bu_men_: [] // 新增字段,存储 [{uid: 'xxx', did: 'yyy'}, ...]
- },
- initWidth: '1280px',
- isEdit: false,
- isPingGuRen: false,
- isZuZhang: true,
- isFinished: false,
- preParams: {},
- Ids: [],
- culWays: { 1: '风险矩阵法', 2: 'FMEA法' },
- fangFaOptions: [
- { value: '定量风险评估法', label: '定量风险评估法' },
- { value: '风险矩阵', label: '风险矩阵' },
- {
- value: '头脑风暴法(集体讨论法)',
- label: '头脑风暴法(集体讨论法)'
- },
- { value: '德尔菲法(专家调查法)', label: '德尔菲法(专家调查法)' },
- { value: '情景分析', label: '情景分析' },
- { value: '检查表', label: '检查表' },
- { value: '故障树分析', label: '故障树分析' },
- { value: '蒙特卡罗模拟分析法', label: '蒙特卡罗模拟分析法' },
- { value: '贝叶斯统计及贝叶斯网络', label: '贝叶斯统计及贝叶斯网络' }
- ]
- }
- },
- computed: {
- onlyoneWay() {
- const keys = Object.keys(this.culWays)
- return keys.length === 1
- }
- },
- watch: {
- 'infoFxssbData.yi_ju_wen_jian_id': {
- handler(val) {
- this.$common
- .request('query', {
- key: 'getRiskFileInfo',
- params: [val]
- })
- .then((response) => {
- const conts = response.variables.data
- let fileName = ''
- let num = 1
- conts.forEach((item, index) => {
- fileName += `${num}、${item.name_}\n`
- num = num + 1
- })
- this.infoFxssbData.yi_ju_wen_jian_ = fileName
- })
- },
- immediate: true
- },
- 'infoFxssbData.zu_chang_id_': {
- handler(val) {
- if (val) {
- const userList = this.$store.getters.userList
- const bianzhiUserid = userList.find((i) => i.userId === val)
- if (bianzhiUserid) {
- this.infoFxssbData.zu_chang_ = bianzhiUserid.userName
- }
- }
- }
- },
- 'infoFxssbData.feng_xian_lei_xin': {
- handler(val) {
- if (val) {
- if (this.isFirst) {
- this.isFirst = false
- } else {
- this.infoFxssbData.fan_wei_ = `本实验室与${val}相关所有活动`
- this.infoFxssbData.mu_di_ = `通过对实验室(${val}活动)进行风险评估,识别实验室在(${val}活动)方面存在的潜在风险,评估风险影响程度,制定风险管理策略,减少不利后果发生的概率和影响程度。`
- this.infoFxssbData.shi_wu_shuo_ming_ = `年度:${this.infoFxssbData.nian_du_};组长:${this.infoFxssbData.zu_chang_};评估开始日期:${this.infoFxssbData.kai_shi_ri_qi_};风险类型:${val}`
- }
- }
- }
- },
- // 监听评估人员变化,同步更新部门映射(保留已有部门)
- 'infoFxssbData.ping_gu_ren_yuan_': {
- handler(newVal, oldVal) {
- if (!this.isEdit && newVal !== oldVal) {
- this.syncPeopleDeptInfo()
- }
- }
- }
- },
- async mounted() {
- const culWays = await getSetting('risk', 'culWays')
- if (this.$utils.isNotEmpty(culWays)) {
- this.culWays = culWays
- }
- this.init()
- },
- beforeDestroy() {
- if (this.msg) {
- this.msg.close()
- }
- },
- methods: {
- // 同步评估人员与部门映射(用于新增时)
- syncPeopleDeptInfo() {
- const userIds = this.infoFxssbData.ping_gu_ren_yuan_
- ? this.infoFxssbData.ping_gu_ren_yuan_.split(',').filter(id => id)
- : []
- const currentMap = this.infoFxssbData.ping_gu_bu_men_ || []
- const newMap = userIds.map(uid => {
- const existing = currentMap.find(item => item.uid === uid)
- if (existing) {
- return existing
- } else {
- return { uid, did: this.getPersonPosition(uid) || '' }
- }
- })
- this.infoFxssbData.ping_gu_bu_men_ = newMap
- },
- // 子组件部门更新事件
- handleUpdatePeopleDeptInfo(newDeptInfo) {
- this.infoFxssbData.ping_gu_bu_men_ = newDeptInfo
- },
- // 在保存前主动从子组件同步最新的部门映射,确保数据一致
- syncDeptInfoFromChild() {
- if (this.$refs.RiskPeopleTableRef) {
- const latestDeptInfo = this.$refs.RiskPeopleTableRef.getCurrentDeptInfo()
- if (latestDeptInfo) {
- this.infoFxssbData.ping_gu_bu_men_ = latestDeptInfo
- }
- }
- },
- // 获取最新数据
- async getNewData() {
- const {
- variables: { data }
- } = await this.$common.request('query', {
- key: 'getFxpgjlb2ById',
- params: [this.params.id_]
- })
- 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
- const str = `org_=${level.first}&second_=${level.second}&id_=`
- const arr = path.split('&')
- if (arr.length === 2) {
- const fieldArr = arr[1].split('=')
- return str + `${data[fieldArr[1]]}`
- } else {
- // 如果是没有传参,还是原报表路径
- return str + `${selection}`
- }
- },
- // 提交
- async goSubmit() {
- try {
- this.$confirm('提交后不可修改,是否确认保存并提交?', '提示', {
- confirmButtonText: '继续',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(async () => {
- // 提交前自动保存,并先同步部门映射
- await this.goSave()
- // 判断每个评估人是否已完成识别项
- const pinGuRenNum = this.Ids.length
- const {
- variables: { data }
- } = await this.$common.request('query', {
- key: 'getFxsbpgb2ByPid',
- params: [this.params.id_]
- })
- const submitNum = new Set(data.map((item) => item.bian_zhi_ren_))
- .size
- if (
- submitNum === pinGuRenNum &&
- data.every((item) => item.shi_fou_guo_shen_ === '已完成')
- ) {
- // 1.修改状态为已完成
- const updateParamsRecord = {
- tableName: 't_fxpgjlb2',
- updList: [
- {
- where: {
- id_: this.params.id_
- },
- param: {
- shi_fou_guo_shen_: '已完成'
- }
- }
- ]
- }
- await this.$common.request('update', updateParamsRecord)
- // 2.推送给措施制定人下一个流程
- const addParams = {
- tableName: 't_fxkzcsb2',
- paramWhere: data
- .map((item) => {
- if (
- item.feng_xian_ying_du !== '风险接受' &&
- item.zhi_ding_ren_
- ) {
- 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_.split(',')[0]
- ),
- bian_zhi_shi_jian: dayjs().format(
- 'YYYY-MM-DD HH:mm:ss'
- ),
- gai_jin_bian_hao_: '',
- 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,
- qian_zai_yuan_yin: item.qian_zai_yuan_yin,
- ji_suan_fang_shi_: this.infoFxssbData.ji_suan_fang_shi_,
- yuan_feng_xian_de: item.feng_xian_deng_ji,
- yuan_feng_xian_yi: item.feng_xian_ying_du,
- parent_id_: item.id_ || ''
- }
- }
- })
- .filter((i) => i !== undefined),
- formKey: 'fxcscsbV2',
- defKey: 'Process_1li9h0n'
- }
- this.loading = true
- for (let i = 0; i < addParams.paramWhere.length; i++) {
- const item = addParams.paramWhere[i]
- item.gai_jin_bian_hao_ = await this.getNextAlias('gjjllsh')
- }
- if (addParams.paramWhere.length) {
- // 预防推送流程数据过多,做切片处理
- await this.processInBatches(addParams.paramWhere)
- .then(() => {})
- .catch(() => {
- this.loading = false
- })
- console.log('改进流程推送成功')
- } else {
- console.log('无需推送')
- }
- // 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('报告流程推送成功')
- await this.$common.request('add', addParams2)
- this.$message.success('提交成功')
- // 提醒用户推送信息
- this.$alert(
- `需要改进项${addParams.paramWhere.length}条,已向其中的每位措施制定人推送风险改进流程,同时向组长 ${this.infoFxssbData.zu_chang_} 推送风险报告流程!`,
- '提交成功',
- {
- confirmButtonText: '确定',
- callback: (action) => {
- this.closeDialog(true)
- }
- }
- )
- } else {
- this.$message.warning(
- '存在未完成风险识别项的评估人员,无法提交!'
- )
- return
- }
- })
- .catch(() => {})
- } catch (error) {
- this.$message.warning(error.message)
- }
- },
- async processInBatches(array, batchSize = 20) {
- for (let i = 0; i < array.length; i += batchSize) {
- const batch = array.slice(i, i + batchSize)
- try {
- const addParams = {
- tableName: 't_fxkzcsb2',
- paramWhere: batch,
- formKey: 'fxcscsbV2',
- defKey: 'Process_1li9h0n'
- }
- await this.$common.request('add', addParams)
- } catch (error) {
- console.error('处理批次时出错:', error)
- // 可以添加重试逻辑或错误处理
- }
- }
- console.log('所有数据处理完成')
- },
- // 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) {
- buttons.click()
- }
- },
- handleActionEvent({ key }) {
- switch (key) {
- case 'cancel':
- this.closeDialog(true)
- break
- case 'record':
- this.goRecord()
- break
- case 'save':
- this.goSave('close')
- break
- case 'submit':
- this.goSubmit()
- break
- case 'refresh':
- this.goRefresh()
- break
- case 'sendMsg':
- this.goSendMsg()
- break
- case 'peizhifengxian':
- this.goPeizhifengxian()
- break
- case 'openFlowPic':
- this.showViewer = true
- break
- default:
- break
- }
- },
- // 关闭大图预览
- closeViewer() {
- this.showViewer = false
- },
- // 推送消息给评估人
- async goSendMsg() {
- const {
- variables: { data: data2 }
- } = await this.$common.request('query', {
- key: 'getFxpgjlb2ById',
- params: [this.params.id_]
- })
- if (data2.length > 0 && data2[0].shi_fou_guo_shen_ === '已完成') {
- return this.$message('已结束,不可推送消息!')
- }
- if (!data2[0].ping_gu_ren_yuan_) {
- return this.$message.warning('请先指定评估人!')
- }
- this.$confirm('此操作将通知所有评估人,是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- const allRequests = []
- this.Ids.forEach((item) => {
- allRequests.push(
- this.$common.sendMsg({
- subject: '风险识别项待填写提醒',
- content: `您有一份风险识别项待填写,请前往-风险控制-风险评估与措施页面填写,计划编号:${this.infoFxssbData.ji_hua_bian_hao_},组长:${this.infoFxssbData.zu_chang_}。如已提交请忽略。`,
- receiverId: item,
- canreplay: '0',
- skipTypeMsg: JSON.stringify({
- skipType: 3,
- pathInfo: '/tygl/fxkzV2/fxpgycslb' // 路由
- })
- })
- )
- })
- Promise.all(allRequests)
- .then(() => {
- this.$message({
- type: 'success',
- message: '推送成功!'
- })
- })
- .catch(() => {
- this.$message({
- type: 'warning',
- message: '推送失败!'
- })
- })
- })
- .catch(() => {})
- },
- // 获取人员部门
- getPersonPosition(id) {
- const userList = this.$store.getters.userList
- const bianzhiUserid = userList.find((i) => i.userId === id)
- if (bianzhiUserid) {
- return bianzhiUserid.positionId.split(',')[0]
- }
- },
- 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('请填写评估人员!')
- }
- if (!this.infoFxssbData.bian_zhi_shi_jian) {
- throw new Error('请选择编制时间!')
- }
- if (!this.infoFxssbData.bian_zhi_bu_men_) {
- throw new Error('请选择编制部门!')
- }
- if (!this.infoFxssbData.ji_suan_fang_shi_) {
- throw new Error('请选择风险系数计算方式!')
- }
- },
- async goAdd() {
- try {
- // 将部门映射数组转为 JSON 字符串
- const toSave = { ...this.infoFxssbData }
- if (toSave.ping_gu_bu_men_) {
- toSave.ping_gu_bu_men_ = JSON.stringify(toSave.ping_gu_bu_men_)
- }
- const addParamsRecord = {
- tableName: 't_fxpgjlb2',
- paramWhere: [toSave]
- }
- const {
- variables: { cont }
- } = await this.$common.request('add', addParamsRecord)
- if (cont.length) {
- this.$message.success('添加成功')
- this.closeDialog(true)
- }
- } catch (error) {
- console.log(error)
- this.$message.warning('添加失败')
- }
- },
- async goEdit(flag) {
- try {
- // 先检查状态
- await this.getIsFinish()
- // 更新主表,部门映射转为 JSON 字符串
- const toUpdate = { ...this.infoFxssbData }
- if (toUpdate.ping_gu_bu_men_) {
- toUpdate.ping_gu_bu_men_ = JSON.stringify(toUpdate.ping_gu_bu_men_)
- }
- const updateParamsRecord = {
- tableName: 't_fxpgjlb2',
- updList: [
- {
- where: {
- id_: this.params.id_
- },
- param: toUpdate
- }
- ]
- }
- updateParamsRecord.updList.forEach((item) => {
- Object.keys(item.param).forEach((key) => {
- if (key.endsWith('_label_value')) {
- delete item.param[key]
- }
- })
- })
- console.log('updateParamsRecord', updateParamsRecord)
- await this.$common.request('update', updateParamsRecord)
- // 当前人员数组
- const curIds = this.infoFxssbData.ping_gu_ren_yuan_.split(',')
- // 计算需要增加项
- const addedIds = curIds.filter((item) => !this.Ids.includes(item))
- // 计算需要更新项
- const updatedIds = curIds.filter((item) => this.Ids.includes(item))
- // 计算需要删除项
- const deletedIds = this.Ids.filter((id) => !curIds.includes(id))
- console.log(addedIds, updatedIds, deletedIds)
- // 删除
- if (deletedIds.length > 0) {
- const ids = deletedIds.map((id) => id).join(',')
- const {
- variables: { data: data3 }
- } = await this.$common.request('query', {
- key: 'getFxsbpgb2ByUid',
- params: [this.params.id_, ids]
- })
- if (data3.length > 0) {
- const params = {
- tableName: 't_fxsbpgb2',
- paramWhere: {
- id_: data3.map((item) => item.id_).join(',')
- }
- }
- console.log(params)
- await this.$common.request('delete', params)
- console.log('删除成功')
- }
- }
- if (flag === 'close') {
- this.closeDialog(true)
- this.$message.success('修改成功')
- } else {
- await this.goRefresh() // 修改之后刷新
- }
- } catch (error) {
- this.$message.warning(error.message)
- throw new Error(error.message)
- }
- },
- async goSave(flag) {
- try {
- // 保存前同步最新的部门映射
- this.syncDeptInfoFromChild()
- this.checkRequired()
- if (this.isEdit) {
- await this.goEdit(flag)
- } else {
- this.$confirm(
- `风险类型${
- this.onlyoneWay ? '' : '和风险系数计算公式'
- }保存后不可再修改,是否继续?`,
- '提示',
- {
- confirmButtonText: '继续',
- cancelButtonText: '取消',
- type: 'warning'
- }
- )
- .then(async () => {
- await this.goAdd()
- })
- .catch(() => {})
- }
- } catch (error) {
- this.$message.warning(error.message)
- throw new Error(error.message)
- }
- },
- // 刷新
- async goRefresh() {
- this.loading = true
- if (this.msg) {
- this.msg.close()
- }
- await this.init()
- if (this.$refs.RiskPeopleTableRef) {
- await this.$refs.RiskPeopleTableRef.refresh() // 改为调用 refresh 方法
- }
- this.loading = false
- },
- // 关闭当前窗口
- closeDialog(needRefresh) {
- this.dialogVisible = false
- if (needRefresh) {
- this.$emit('close')
- }
- if (this.msg) {
- this.msg.close()
- }
- },
- // 弹出提醒
- async showAlert() {
- if (!this.isPingGuRen || this.isFinished) return
- const {
- variables: { data }
- } = await this.$common.request('query', {
- key: 'getFxsbpgb2ByUid',
- params: [this.params.id_, this.userId]
- })
- let status = '填写'
- let type = 'warning'
- if (data.length > 0) {
- if (data.every((item) => item.shi_fou_guo_shen_ === '已完成')) {
- return
- } else {
- status = '提交'
- type = 'success'
- }
- }
- this.msg = this.$notify({
- offset: 50,
- type: type,
- title: `您有一份风险识别评估表待${status}!`,
- message: `点击前去${status}`,
- showClose: false,
- duration: 0,
- onClick: () => {
- this.$refs.RiskDetailRef.open(this.params)
- }
- })
- },
- getNextAlias(alias) {
- return new Promise((resolve, reject) => {
- this.$common
- .getNextIdByAlias({
- alias
- })
- .then((response) => {
- resolve(response.data)
- })
- .catch((error) => {
- reject(error)
- })
- })
- },
- async init() {
- this.isEdit = !!(this.params && this.params.id_)
- if (this.isEdit) {
- // 深拷贝 params,避免直接修改
- this.infoFxssbData = JSON.parse(JSON.stringify(this.params))
- // 从数据库获取最新的部门映射,避免外部传入旧数据
- const latestData = await this.getNewData()
- if (latestData.length && latestData[0].ping_gu_bu_men_) {
- // 用最新的部门映射覆盖
- this.infoFxssbData.ping_gu_bu_men_ = latestData[0].ping_gu_bu_men_
- }
- // 解析部门映射 JSON
- if (this.infoFxssbData.ping_gu_bu_men_ && typeof this.infoFxssbData.ping_gu_bu_men_ === 'string') {
- try {
- this.infoFxssbData.ping_gu_bu_men_ = JSON.parse(this.infoFxssbData.ping_gu_bu_men_)
- } catch (e) {
- this.infoFxssbData.ping_gu_bu_men_ = []
- }
- } else if (!this.infoFxssbData.ping_gu_bu_men_) {
- this.infoFxssbData.ping_gu_bu_men_ = []
- }
- console.log('infoFxssbData', this.infoFxssbData)
- this.preParams = JSON.parse(JSON.stringify(this.params))
- this.isPingGuRen = this.params.ping_gu_ren_yuan_.indexOf(this.userId) >= 0
- this.isZuZhang = this.userId === this.infoFxssbData.zu_chang_id_
- this.isFinished = this.params && this.params.shi_fou_guo_shen_ === '已完成'
- this.readonly = !!(!this.isZuZhang || this.isFinished)
- if (this.params.ping_gu_ren_yuan_) {
- this.Ids = this.params.ping_gu_ren_yuan_.split(',')
- } else {
- this.Ids = []
- }
- await this.showAlert()
- // 强制子组件使用最新的部门映射重新加载(关键修复)
- await this.$nextTick()
- if (this.$refs.RiskPeopleTableRef) {
- await this.$refs.RiskPeopleTableRef.refresh()
- }
- } else {
- const { positions } = this.$store.getters.userInfo
- // 默认编制部门是主部门,没有主部门默认第一个部门
- const mainPost =
- positions.find((item) => item.isMainPost === 'Y')?.id ||
- positions[0].id
- this.readonly = false
- this.infoFxssbData.di_dian_ = this.level
- this.infoFxssbData.ji_hua_bian_hao_ = await this.getNextAlias('fxjhlsh')
- this.infoFxssbData.nian_du_ = dayjs().format('YYYY')
- this.infoFxssbData.bian_zhi_bu_men_ = mainPost
- this.infoFxssbData.bian_zhi_ren_ = this.userId
- this.infoFxssbData.bian_zhi_shi_jian = dayjs().format(
- 'YYYY-MM-DD HH:mm:ss'
- )
- this.infoFxssbData.zu_chang_id_ = this.userId
- this.infoFxssbData.kai_shi_ri_qi_ = dayjs().format('YYYY-MM-DD')
- this.infoFxssbData.jie_shu_ri_qi_ = dayjs().format('YYYY-MM-DD')
- this.infoFxssbData.feng_xian_lei_xin = '质量'
- this.infoFxssbData.shi_ji_ = '定期评估'
- this.infoFxssbData.fan_wei_ = '本实验室与质量相关所有活动'
- this.infoFxssbData.fang_fa_ = '定量风险评估法'
- this.infoFxssbData.mu_di_ =
- '通过对实验室(质量活动)进行风险评估,识别实验室在(质量活动)方面存在的潜在风险,评估风险影响程度,制定风险管理策略,减少不利后果发生的概率和影响程度。'
- this.infoFxssbData.hui_yi_shi_jian_ = dayjs().format('YYYY-MM-DD HH:mm')
- this.$nextTick(() => {
- this.infoFxssbData.shi_wu_shuo_ming_ = `年度:${this.infoFxssbData.nian_du_};组长:${this.infoFxssbData.zu_chang_};评估开始日期:${this.infoFxssbData.kai_shi_ri_qi_};风险类型:${this.infoFxssbData.feng_xian_lei_xin}`
- })
- this.infoFxssbData.ji_suan_fang_shi_ = Object.keys(this.culWays)[0]
- // 新增模式默认部门映射为空数组,等评估人员选择后再同步
- this.infoFxssbData.ping_gu_bu_men_ = []
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .paper-detail-dialog {
- ::v-deep {
- .el-dialog__header {
- text-align: center;
- }
- }
- .container {
- display: flex;
- width: 100%;
- justify-content: center;
- .left {
- height: calc(100vh - 100px);
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
- padding: 10px;
- overflow-y: auto;
- }
- .right {
- height: calc(100vh - 100px);
- flex: 1;
- padding: 10px;
- .text {
- line-height: 1.5;
- }
- overflow-y: auto;
- }
- }
- }
- .required-star {
- color: red;
- margin-right: 4px;
- }
- .dialog-title {
- display: flex;
- align-items: center;
- justify-content: center;
- div {
- position: absolute;
- right: 8vw;
- }
- .dialogtitle {
- font-size: 22px;
- font-family: SimHei;
- font-weight: bold;
- color: #222;
- }
- }
- .el-image-viewer__wrapper {
- z-index: 9999 !important;
- }
- </style>
|