|
- <template>
- <view class="page">
- <view v-if="ready">
- <l-input
- @input="setValue('MeetingManagement.MeetingTitle', $event)"
- :value="getValue('MeetingManagement.MeetingTitle')"
- :disabled="!edit"
- title="会议主题"
- />
- <l-select
- @input="setValue('MeetingManagement.MeetingPlace', $event)"
- :value="getValue('MeetingManagement.MeetingPlace')"
- :disabled="!edit"
- :range="dataSource.MeetingManagement.MeetingPlace"
- title="会议地点"
- />
- <l-datetime-picker
- @input="setValue('MeetingManagement.BeginTime', $event)"
- :value="getValue('MeetingManagement.BeginTime')"
- :disabled="!edit"
- title="开始时间"
- />
- <l-datetime-picker
- @input="setValue('MeetingManagement.EndTime', $event)"
- :value="getValue('MeetingManagement.EndTime')"
- :disabled="!edit"
- title="结束时间"
- />
- <!-- <l-organize-picker
- @input="setValue('MeetingManagement.CreateUser', $event)"
- :value="getValue('MeetingManagement.CreateUser')"
- :readonly="!edit"
- type="user"
- title="申请人"
- /> -->
- <l-input
- @input="setValue('MeetingManagement.Linkman', $event)"
- :value="getValue('MeetingManagement.Linkman')"
- :readonly="!edit"
- title="联系人"
- />
- <l-input
- @input="setValue('MeetingManagement.LinkPhone', $event)"
- :value="getValue('MeetingManagement.LinkPhone')"
- :readonly="!edit"
- title="联系方式"
- />
- <l-organize-picker
- @input="setValue('MeetingManagement.InternalParticipants', $event)"
- :value="getValue('MeetingManagement.InternalParticipants')"
- :readonly="!edit"
- type="user"
- title="参会人员"
- :multiple="true"
- />
- <l-organize-picker
- @input="setValue('MeetingManagement.RecordPerson', $event)"
- :value="getValue('MeetingManagement.RecordPerson')"
- :readonly="!edit"
- type="user"
- title="会议记录者"
- />
- <l-textarea
- @input="setValue('MeetingManagement.Content', $event)"
- :value="getValue('MeetingManagement.Content')"
- :readonly="!edit"
- title="会议内容"
- />
- <l-upload-file
- @input="setValue('MeetingManagement.Files', $event)"
- :value="getValue('MeetingManagement.Files')"
- :readonly="!edit"
- :number="9"
- title="附件上传"
- />
- </view>
- <!-- 指派审核人弹窗 -->
- <l-modal v-model="modal" @close="reviewer = ''" title="指派审核人">
- <l-checkbox-picker @input="(e)=>{reviewer = e}" :value="reviewer" :readonly="false" :range="reviewerList"
- required title="审核人" />
- <l-button @click="userAssign" color="blue" class="block" block>确定指派</l-button>
- <l-button @click="()=>{modal = false;reviewer = ''}" line="blue" class="block margin-top-sm" block>取消</l-button>
- </l-modal>
- <view v-if="ready && current.MeetingManagement && current.MeetingManagement.status != '1'" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
- <l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
- 保存
- </l-button>
- <l-button v-if="edit" @click="action('save',true)" size="lg" color="orange" class="block margin-top" block>
- 保存并提交
- </l-button>
- <!-- <l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block>
- 编辑本页
- </l-button>
- <l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block>
- 取消编辑
- </l-button>
- <l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block>
- 删除
- </l-button> -->
- </view>
- </view>
- </template>
-
-
- <script>
- /*
- * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
- * Copyright (c) 2013-2020 上海力软信息技术有限公司
- * 创建人:超级管理员
- * 日 期:2020-10-20 09:25
- * 描 述:活动安排
- */
-
- /**
- * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
- * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
- * { "path": "pages/PersonnelManagement/BookBorrow/single", "style": { "navigationBarTitleText": "表单详情页" } }
- *
- * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
- * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
- */
-
- import get from 'lodash/get'
- import set from 'lodash/set'
- import moment from 'moment'
- import customPageMixins from '@/common/custompage.js'
- import workflowFormMixins from '@/pages/nworkflow/workflow.js'
-
- export default {
- mixins: [workflowFormMixins,customPageMixins,],
-
- data() {
- return {
- // 页面相关参数
- id: null,
- mode: null,
- edit: null,
- ready: false,
-
- // 表单数据
- current: {},
- origin: {},
-
- // 表单项数据结构
- scheme: {
- MeetingManagement: {
- MeetingTitle: { type: 'text', title: '会议主题' ,verify:"NotNull"},
- MeetingPlace: { type: 'select', title: '会议地点', dataSource: '0',verify:"NotNull" },
- BeginTime: { type: 'datetime', title: '开始时间', dateformat: '1',verify:"NotNull" },
- EndTime: { type: 'datetime', title: '结束时间', dateformat: '1',verify:"NotNull" },
- InternalParticipants: { type: 'organize', title: '参会人员', dataType: 'user',verify:"NotNull" },
- RecordPerson: { type: 'organize', title: '会议记录者', dataType: 'user' },
- Content: { type: 'texteditor', title: '会议内容',verify:"NotNull" },
- Linkman: { type: 'text', title: '联系人',verify:"NotNull" },
- LinkPhone: { type: 'text', title: '联系方式',verify:"Mobile" },
- Files: { type: 'upload', title: '附件上传' },
- // CreateUser: { type: 'organize', title: '申请人', dataType: 'user',verify:"NotNull" },
- },
- },
- // 数据源
- dataSource: {
- MeetingManagement: {
- MeetingPlace: [],
- },
-
- },
-
- type:null,
- code:null,
- level: '1',
- processId:null,
- // 指派审核人数据
- modal: false,
- userAssignData:{},//收集数据用来判断是否需要审核人
- reviewerListId:'',
- reviewerList:[],
- submitPostData:{},
- reviewer: [],
- }
- },
-
- async onLoad({ type, id }) {
- await this.init(type, id)
- },
-
- methods: {
- // 页面初始化
- async init(type, id) {
- this.LOADING('加载数据中...')
-
- this.id = id
- this.mode = type
- this.edit = ['create', 'edit'].includes(this.mode)
-
- this.type = type
- this.code = 'MeetingManagementApply'
- const currentTask = this.GET_PARAM()
- // 新建表单则生成
- this.processId = this.GUID('-')
- const processInfo = await this.fetchProcessInfo({ code:this.code })
- const currentNode = this.getCurrentNode(processInfo)
- this.userAssignData.currentTask = currentTask
- this.userAssignData.currentNode = currentNode
- // wfForms 的数组成员 t,表示表单数据项(TAB页),t.type 表示类别,注意它是字符串型,用 Number(t.type) 转换
- // 为 1 则使用工作流表单,依据它的 .formId
- // 不为 1 则使用系统表单,依据它的 .appurl
- const { wfForms } = currentNode
- // 处理没有有效表单的情况,停止加载
- if (!wfForms || wfForms.length <= 0) {
- this.HIDE_LOADING()
- this.TOAST('移动表单数据(wfForms)中无有效表单')
- return
- }
-
- // 拉取表单数据,同时拉取所有来自数据源的选单数据
- await Promise.all([
- this.FETCH_DATASOURCE('ConferenceRoom').then(result => {
- this.dataSource.MeetingManagement.MeetingPlace = result.data.map(t => ({ text: t.name, value: t.id }))
- }),
- () => {}
- ])
- await this.fetchForm()
-
- this.ready = true
- this.HIDE_LOADING()
- },
-
- // 加载表单数据
- async fetchForm() {
- if (this.mode === 'create') {
- this.origin = await this.getDefaultForm()
- } else {
- const result = await this.HTTP_GET('learun/adms/PersonnelManagement/MeetingManagement/form', this.id)
- this.origin = await this.formatFormData(result)
- }
- this.current = this.COPY(this.origin)
- },
-
- // 指派审核人
- async userAssign() {
- this.modal = false
- if(!this.reviewer.length){
- this.TOAST('请选择审核人')
- return
- }
- this.LOADING('正在提交…')
- let postData = {
- auditors :JSON.stringify({[this.reviewerListId]:this.reviewer.toString()}),
- level : this.level,
- code: this.code,
- processId: this.processId,
- }
- const url = 'learun/adms/newwf/createnoform'
- const tips = `流程发起失败`
- this.HTTP_POST(url, postData, tips).then(success => {
- this.HIDE_LOADING()
- if (!success) {
- return
- }
- this.submit1()
- })
- },
-
- // 发起流程
- async submit() {
- // 判断是否指派审核人
- let isNext = this.userAssignData.currentNode.isNext
- Object.assign(this.userAssignData,{ code: 'agree' })
- if (this.userAssignData.next == '2') {
- isNext = '1';
- }
- if (isNext == '1') {
- let params = {
- code: this.code,
- processId: this.processId,
- taskId: '',
- nodeId: this.userAssignData.currentNode.id,
- operationCode: this.userAssignData.code,
- }
- this.LOADING('正在获取审核人…')
- const userList = await this.HTTP_GET('learun/adms/newwf/auditer', params, `获取审核人时发生错误`)
- this.HIDE_LOADING()
- if (!userList) {
- return
- }
- let arr = Object.entries(userList)
- this.reviewerListId = arr[0][0]
- this.reviewerList = arr[0][1].map(item => {
- return {
- text: item.Name,
- value: item.Id
- }
- })
- if(this.reviewerList.length>1){
- this.modal = true
- return
- }
- }
-
- this.LOADING('正在提交…')
- let postData = {
- auditors :JSON.stringify({}),
- level : this.level,
- code: this.code,
- processId: this.processId,
- }
- const url = 'learun/adms/newwf/createnoform'
- const tips = `流程发起失败`
- this.HTTP_POST(url, postData, tips).then(success => {
- this.HIDE_LOADING()
- if (!success) {
- return
- }
- this.submit1()
- })
- },
-
- // 提交
- async submit1(){
- // if (!(await this.CONFIRM('提交项目', '是否确认提交该项?', true))) {
- // return
- // }
- this.LOADING('正在提交...')
- this.HTTP_POST('/learun/adms/PersonnelManagement/MeetingManagement/submit', {Id:this.id, ProcessId:this.processId} , '提交失败').then(
- success => {
- this.HIDE_LOADING()
- if (!success) {
- return
- }
- this.TOAST('提交成功', 'success')
- this.EMIT('PersonnelManagementMeetingManagement-list-change')
- this.NAV_BACK()
- })
- return
- },
-
-
- // 点击 「编辑」、「重置」、「保存」、「删除」 按钮
- async action(type,isSubmit=false) {
- switch (type) {
- case 'edit':
- this.edit = true
- break
-
- case 'reset':
- this.current = this.COPY(this.origin)
- this.edit = false
- break
-
- case 'save':
- // if(!this.current.MeetingManagement.TotalAmount){
- // this.CONFIRM('表单验证失败', '[劳务维修详情]:价格为空或错误')
- // return
- // }
- const verifyResult = this.verifyForm()
- if (verifyResult.length > 0) {
- this.CONFIRM('表单验证失败', verifyResult.join('\n'))
- return
- }
-
- if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
- return
- }
-
- this.LOADING('正在提交...')
- const postData = await this.getPostData(this.id)
-
- this.HTTP_POST('learun/adms/PersonnelManagement/MeetingManagement/save', postData, '表单提交保存失败').then(success => {
- this.HIDE_LOADING()
- if (!success) {
- return
- }
-
- this.id = success.Id
- if(isSubmit){
- this.submit()
- return
- }
-
- this.EMIT('PersonnelManagementMeetingManagement-list-change')
- setTimeout(()=>this.NAV_BACK(),500)
- this.TOAST('提交保存成功')
- })
- break
-
- case 'delete':
- if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
- return
- }
-
- this.LOADING('提交删除中...')
- this.HTTP_POST('learun/adms/PersonnelManagement/MeetingManagement/delete', this.id, '删除失败').then(success => {
- this.HIDE_LOADING()
- if (!success) {
- return
- }
-
- this.EMIT('PersonnelManagementMeetingManagement-list-change')
- this.NAV_BACK()
- this.this.TOAST('删除成功', 'success')
- })
- break
-
- default: break
- }
- },
-
- // 获取表单值
- getValue(path) {
- return get(this.current, path)
- },
-
- // 设置表单值
- setValue(path, val) {
- set(this.current, path, val)
- },
- }
- }
- </script>
|