|
- <template>
- <view id="notice" class="page">
- <!-- 顶部页签 -->
- <l-nav v-model="tab" :items="['表单信息', '流程信息']" type="flex" class="solid-bottom" />
- <view v-if="ready && tab == 0">
- <l-input v-model="formData.F_FullHead" title="公告标题" disabled></l-input>
- <l-select v-model="formData.IsSend" :range="[{value:'1',text:'是'},{value:'0',text:'否'}]" title="下发官网" disabled></l-select>
- <l-input v-model="formData.F_Category" title="公告类别" disabled></l-input>
- <l-input v-model="formData.F_ReleaseTime" title="发布时间" disabled></l-input>
- <l-input v-model="formData.F_SourceName" title="信息来源" disabled></l-input>
- <l-input v-model="formData.F_SourceAddress" title="来源地址" disabled></l-input>
- <l-input v-model="formData.F_SendDeptId" title="接收部门" disabled></l-input>
- <l-input v-model="formData.F_SendPostId" title="接受岗位" disabled></l-input>
- <l-select v-model="formData.F_IsSendFX" :range="[{value:true,text:'是'},{value:false,text:'否'}]" title="下发飞星" disabled></l-select>
- <l-upload-file
- :value="fileList"
- :readonly="true"
- title="标题图片"
- />
- <!-- :number="9" -->
- <!-- @input="setValue('MeetingManagement.Files', $event)" -->
- <l-input title="公告内容" disabled style="border-bottom: none;"></l-input>
- <view class="padding text-lg" style="background-color: #fff;">
- <!-- <u-parse v-if="ready" :imageProp="{ domain: apiRoot }" :content="content"></u-parse> -->
- <iframe v-if="ready" style="width: 100%;height: 50vh;" :src="CONFIG('webHost')+'/Utility/ListContentView?keyValue='+formData.F_NewsId" frameborder="0"></iframe>
- </view>
- <l-workflow-action
- @audit="audit"
- @action="action"
- :type="type"
- :currentNode="currentNode"
- :currentTask="currentTask"
- />
- </view>
- <view v-if="ready && tab == 1" class="progress"><l-workflow-timeline :processList="processList" /></view>
- <!-- <view class="padding-sm text-grey notice-info">
- <view class="text-right">本页内容发布于 {{ time }}</view>
- <view class="text-right">{{ date }}</view>
- </view> -->
- </view>
- </template>
-
- <script>
- import moment from 'moment'
- import workflowFormMixins from '@/pages/nworkflow/workflow.js'
-
- export default {
- mixins: [workflowFormMixins],
- data() {
- return {
- tab:0,
- type:'view',
- currentNode:null,
- currentTask:null,
- taskId:'',
- processId:'',
- processInfo:null,
- processList:[],
- formData:{},
- ready: false,
- content: '',
-
- time: '',
- date: '',
- fileList:[],
- }
- },
-
- async onLoad({type}) {
- await this.init(type)
- },
-
- methods: {
- async init(type) {
- if(type){this.type = type}
- this.LOADING('加载中…')
- const noticeItem = this.GET_PARAM()
- this.processList = noticeItem.logList
- this.currentNode = noticeItem.currentNode
- this.currentTask = noticeItem.currentTask
- this.processInfo = noticeItem.processInfo
- this.taskId = this.currentTask.F_TaskId
- this.processId = this.currentTask.F_Id
- this.formValue = noticeItem.formValue
- this.scheme = noticeItem.scheme
- await this.getFormData(this.processList[0].F_ProcessId)
- this.HIDE_LOADING();
-
- // this.content = this.CONVERT_HTML(noticeItem.f_content)
-
- // this.time = moment(noticeItem.f_time).format('HH : mm')
- // this.date = moment(noticeItem.f_time).format('YYYY年 M月 D日')
- // this.SET_TITLE(noticeItem.f_title)
- // this.HIDE_LOADING()
- },
- // 获取表单数据
- getFormData(ProgressId){
- return this.HTTP_GET("learun/news/shList",{ProgressId},"加载数据时出错").then(async res=>{
- if(res){
- res.F_SourceName = res.F_SourceName&&this.GET_GLOBAL('department')[res.F_SourceName]? this.GET_GLOBAL('department')[res.F_SourceName].name : res.F_SourceName
- this.formData = res
- let fileList = await this.getFileListById(res.F_NewsImage)
- if(fileList&&fileList.length){
- this.fileList = [fileList[0]]
- }
- this.content = res.F_NewsContent
- this.ready = true
- }
- })
- },
-
- // 点击审批相关按钮
- async audit(action) {
- this.LOADING('加载中…')
- const currentTask = this.processInfo.task.find(t => t.F_NodeId === this.currentNode.id)
- const postData = await this.getPostData(this.formValue, this.scheme)
- const pageParam = {
- type: 'sign',
- processId: currentTask.F_ProcessId,
- taskId: currentTask.F_Id,
- formreq: postData.formreq,
- taskName: this.currentTask.F_Title,
- currentNode:this.currentNode,
- code:this.code||''
- }
- // 不是加签
- if (action.code !== '__sign__') {
- Object.assign(pageParam, action)
- pageParam.type = 'verify'
- pageParam.auditors = JSON.stringify({})
- pageParam.isFromSignAudit = Number(this.currentTask.F_TaskType) === 3
- }
- this.HIDE_LOADING()
- this.NAV_TO('/pages/nworkflow/myflow/sign', pageParam, true)
- },
- // 点击操作按钮(非审批类按钮)
- async action(taskType) {
- switch (taskType) {
- // 点击「催办」/「撤销流程」/「标记已阅」按钮
- case 'urge':
- case 'revoke':
- case 'refer':
- const actionText = { urge: '催办', revoke: '撤销', refer: '已阅' }[taskType]
- const actionUrl = { urge: '/urge', revoke: '/revoke', refer: '/refer' }[taskType]
-
- let actionData = this.processId
- if (taskType === 'refer') {
- actionData = { processId: this.processId, taskId: this.taskId }
- }
-
- if (!(await this.CONFIRM(`${actionText}确认`, `确定要提交${actionText}吗?`, true))) {
- return
- }
- this.LOADING(`提交${actionText}中…`)
- this.HTTP_POST(`/newwf${actionUrl}`, actionData, `提交${actionText}失败`).then(success => {
- this.HIDE_LOADING()
- if (success) {
- this.EMIT('task-list-change')
- this.TOAST(`成功提交${actionText}`, 'success')
- if (taskType === 'revoke') {
- this.NAV_BACK()
- }
- }
- })
- break
- // 点击「提交草稿」按钮
- case 'draft':
- this.CONFIRM('不支持此操作')
- return
- if (!(await this.CONFIRM('提交确认', '确定要提交草稿吗?', true))) {
- return
- }
- this.LOADING('正在提交…')
- const draftFormValue = this.$refs.form.getFormValue()
- const draftPostData = await this.getPostData(draftFormValue, this.scheme)
- this.HTTP_POST('/newwf/draft', draftPostData, '提交草稿失败').then(success => {
- this.HIDE_LOADING()
- if (success) {
- this.EMIT('task-list-change')
- this.NAV_BACK()
- this.TOAST('草稿已保存', 'success')
- }
- })
- break
- // 点击「发起流程」按钮
- case 'submit':
- this.CONFIRM('不支持此操作')
- return
- const verifyResult = this.$refs.form.verifyValue()
- if (verifyResult.length > 0) {
- this.CONFIRM('表单验证失败', verifyResult.join('\n'))
- return
- }
- if (!(await this.CONFIRM('提交确认', '确定要发起流程吗?', true))) {
- return
- }
- this.LOADING('正在提交…')
- const formValue = this.$refs.form.getFormValue()
- const postData = await this.getPostData(formValue, this.scheme)
- postData.auditors = JSON.stringify({})
-
- if (this.type === 'child') {
- postData.parentProcessId = this.processId
- postData.parentTaskId = this.taskId
- }
- const errorTips = '流程发起失败'
- this.HTTP_POST('/newwf/createchildflow', postData, errorTips).then(success => {
- this.HIDE_LOADING()
- if (success) {
- this.EMIT('task-list-change')
- this.NAV_BACK()
- this.TOAST('流程发起成功', 'success')
- }
- })
- break
- default:
- break
- }
- },
- }
- }
- </script>
|