| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007 |
- <template>
- <page-meta root-font-size="system" />
- <view class="process_detail_container">
- <uni-card>
- <view class="main_container">
- <uni-section titleFontSize="1.3rem" title="申请内容" type="line"></uni-section>
- <uni-forms ref="$mainForm" :rules="$mainFormRules" :modelValue="mainFormValue" label-position="left"
- :label-width="125" :border="true">
- <view v-for="(elem, index) in formElements" :key="index">
- <uni-forms-item
- v-if="!(elem.elementName.endsWith('审批') && '' == elem.defaultValue && ['0', undefined].includes(elem.canEdit)) && ('' != elem.defaultValue || 1 == elem.canEdit)" :label="elem.elementName" :name="elem.elementId">
- <view class="element_value_container">
- <view v-if="'1' == elem.canEdit && '8' != elem.type" class="element_value">
- <!-- 富文本框 -->
- <uni-easyinput v-if="'1' == elem.type" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))" placeholder="请输入内容"
- v-model="elem.defaultValue" type="textarea"></uni-easyinput>
- <!-- 文本框 -->
- <uni-easyinput v-else-if="'0' == elem.type" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))" placeholder="请输入内容"
- v-model="elem.defaultValue" type="text"></uni-easyinput>
- <!-- 下拉框 -->
- <picker class="picker_container" v-else-if="'2' == elem.type"
- @change="bindPickerChange($event, elem)" :value="elem.defaultValue"
- :range="formatDict(elem.typeDetail.enum)">
- <view class="uni-input input_text">
- <!-- 设置默认值为第一个选项 -->
- {{ elem.defaultValue ? elem.defaultValue : elem.defaultValue =
- elem.typeDetail.enum[0].enumVname }}
- </view>
- </picker>
- <!-- 年月日 时分秒 -->
- <uni-datetime-picker v-else-if="'9' == elem.type" v-model="elem.defaultValue"
- type="datetime" />
- <!-- 年月日 -->
- <uni-datetime-picker v-else-if="'3' == elem.type" v-model="elem.defaultValue"
- type="date" />
- <!-- 审批签字板 -->
- <view v-else-if="'13' == elem.type">
- <button v-if="elem.defaultValue == ''" type="primary"
- @click="handleSignature(index)">签名</button>
- <view v-else class="signature_img">
- <img style="width: 100%;" mode="widthFix" @click="handleSignature(index)"
- :src="config.baseUrlPre + elem.sealImgPath"
- :alt="elem.elementName + '签名'" />
- </view>
- </view>
- </view>
- <view v-else-if="typeof elem.sealImgPath === 'string' && elem.sealImgPath.startsWith('/shares')" class="signature_img">
- <img style="width: 100%;" mode="widthFix"
- :src="config.baseUrlPre + elem.sealImgPath" />
- </view>
- <view v-else-if="typeof elem.defaultValue === 'string' && elem.defaultValue.startsWith('/shares')" class="signature_img">
- <img style="width: 100%;" mode="widthFix"
- :src="config.baseUrlPre + elem.defaultValue" />
- </view>
- <text class="element_value" v-else>{{ elem.defaultValue }}</text>
- </view>
- </uni-forms-item>
- </view>
- </uni-forms>
- </view>
- </uni-card>
- <view class="repeating_table">
- <!-- 重复表 -->
- <uni-card v-if="flowInfo.seModel == '0' && repeatingFormNotEmpty" spacing="0" padding="0">
- <button @click="handleRepeatingForm" type="primary">查看明细</button>
- </uni-card>
- <uni-card v-else v-for="(table, tableIndex) in repeatingForm.elements" spacing="0" :key="tableIndex">
- <uni-forms label-position="left" :label-width="125" :border="true">
- <uni-forms-item :name="elem.tableField" v-for="(elem, itemIndex) in table"
- :label="repeatingForm.elementItem[itemIndex].elementName.slice(3)" :key="itemIndex">
- <uni-easyinput placeholder="请输入内容" v-model="elem.defaultValue"
- :type="fieldTypeDict[repeatingForm.elementItem[itemIndex].fieldType.value] || 'text'" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))"></uni-easyinput>
- </uni-forms-item>
- </uni-forms>
- <!-- <view class="repeating_table_button_container">
- <uni-row>
- <uni-col :span="10" :offset="1">
- <button @click="addrepeatingFormItem(tableIndex)" type="primary">新增</button>
- </uni-col>
- <uni-col :span="10" :offset="2">
- <button @click="delrepeatingFormItem(tableIndex)"
- :disabled="repeatingForm.elements.length <= 1" type="warn">删除</button>
- </uni-col>
- </uni-row>
- </view> -->
- </uni-card>
- <uni-popup v-if="flowInfo.seModel == '0' && repeatingFormNotEmpty" ref="repeatingFormPopup">
- <uni-card margin="0px" spacing="0px" padding="0px">
- <view class="repeating_table_container">
- <uni-table :border="true" stripe>
- <uni-tr>
- <uni-th align="center" v-for="(item, index) in repeatingForm.elementItem" :key="index">
- {{ item.elementName.slice(3, 5) }}
- </uni-th>
- </uni-tr>
- <uni-tr v-for="(table, tableIndex) in repeatingForm.elements" :key="tableIndex">
- <uni-td align="center" v-for="(elem, itemIndex) in table" :key="itemIndex">
- {{ elem.defaultValue }}
- </uni-td>
- </uni-tr>
- </uni-table>
- </view>
- </uni-card>
- </uni-popup>
- </view>
- <!-- 附件 -->
- <view v-for="(item, index) in fileList" :key="index">
- <uni-card v-if="item.files.length != undefined && item.files.length > 0">
- <uni-section titleFontSize="1.3rem" title="附件" type="line"></uni-section>
- <attachment-list @clickDelete="deleteFile" :canEdit="flowInfo.seModel == '1'" :attachments="item.files"></attachment-list>
- </uni-card>
- </view>
- <!-- 上传附件 -->
- <view v-if="processInfo.tinsId || flowInfo.seModel == '1'" class="file_picker_container">
- <uni-card title="上传附件" :extra="`${subFileList.length}/50`" spacing="0">
- <uni-file-picker ref="filePicker" v-model="subFileList" :auto-upload="true" mode="list" :limit="50"
- file-mediatype="all" @select="handleFileSelect" @progress="handleFileProgress"
- @success="handleFileSuccess" @fail="handleFileFail" @delete="handleFileDelete" />
- </uni-card>
- </view>
- <!-- 流转过程 -->
- <view>
- <uni-card>
- <view class="flow_step_container">
- <uni-section titleFontSize="1.3rem" title="流转过程" type="line"></uni-section>
- <up-steps :current="stepActive" activeColor="#18bc37" inactiveColor="#2979ff" direction="column">
- <view v-for="(step, index) in options">
- <up-steps-item :contentClass="'redcontent'" v-if="step.state == 3"
- :title="step.title + ' 退回'" :desc="step.desc" :key="index" error></up-steps-item>
- <up-steps-item :contentClass="'redcontent'" v-else-if="step.state == 0"
- :title="step.title + ' 撤销'" :desc="step.desc" :key="index" error></up-steps-item>
- <up-steps-item v-else-if="index == stepActive" :title="step.title" :desc="step.desc"
- :key="index">
- <template #icon>
- <view class="active_step_circle">
- <text class="active_step_text">{{ index + 1 }}</text>
- </view>
- </template>
- </up-steps-item>
- <up-steps-item v-else :title="step.title" :desc="step.desc" :key="index"></up-steps-item>
- </view>
- </up-steps>
- </view>
- </uni-card>
- </view>
- <view v-if="processInfo.tinsId">
- <view class="remark_container">
- <uni-card>
- <uni-section titleFontSize="1.3rem" title="环节备注" type="line"></uni-section>
- <view class="remark_content">
- <uni-easyinput type="textarea" autoHeight v-model="remark" placeholder="请输入" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))"></uni-easyinput>
- </view>
- </uni-card>
- </view>
- </view>
- <view v-if="processInfo.tinsId" class="approve_button">
- <uni-card spacing="0" padding="0">
- <button :disabled="!button_state" :loading="!button_state" type="primary"
- @click="handleSubmitProcess('1')">
- {{ flowInfo.seModel == '0' ? '通过' : '提交' }}
- </button>
- </uni-card>
- </view>
- </view>
- <view v-if="processInfo.tinsId && flowInfo.seModel == '0'">
- <view class="reject_button">
- <uni-card spacing="0" padding="0" :is-shadow="false" :border="false">
- <uni-row>
- <uni-col :span="11">
- <button :disabled="!button_state" :loading="!button_state" type="warn"
- @click="handleSubmitProcess('0')">退回上一级</button>
- </uni-col>
- <uni-col :span="11" :offset="2">
- <button :disabled="!button_state" :loading="!button_state" type="warn"
- @click="handleSubmitProcess('2')">退回发起人</button>
- </uni-col>
- </uni-row>
- </uni-card>
- </view>
- </view>
- <view v-else-if="isCancel">
- <view class="remark_container">
- <uni-card>
- <uni-section titleFontSize="1.3rem" title="撤销备注" type="line"></uni-section>
- <view class="remark_content">
- <uni-easyinput type="textarea" autoHeight v-model="remark" placeholder="请输入" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))"></uni-easyinput>
- </view>
- </uni-card>
- </view>
- <view class="cancel_button_container">
- <uni-card spacing="0" padding="0">
- <button :disabled="!button_state" :loading="!button_state" type="warn"
- @click="handleCancelProcess">撤销</button>
- </uni-card>
- </view>
- </view>
- <view style="height: 5px; margin-top: 20px;"></view>
- <!-- 签字版弹出层 -->
- <uni-popup ref="signaturePopup" @maskClick="closeSignaturePopup">
- <view class="signature_container" :class="{ 'signature_container_landscape': isLandscape }">
- <view class="signature_content">
- <l-signature ref="signatureRef" v-if="signaturePopupShow" :landscape="isLandscape" :penSize="8"
- :minLineWidth="4" :maxLineWidth="12" :openSmooth="true" :preferToDataURL="true"
- backgroundColor="#ffffff" penColor="black"></l-signature>
- </view>
- <view class="signature_button_container">
- <uni-row :gutter="10">
- <uni-col :span="6">
- <button type="warn" @click="onclickSignatureButton('undo')">撤销</button>
- </uni-col>
- <uni-col :span="6">
- <button type="warn" @click="onclickSignatureButton('clear')">清空</button>
- </uni-col>
- <uni-col :span="6">
- <button type="primary" @click="onclickSignatureButton('save')">保存</button>
- </uni-col>
- <uni-col :span="6">
- <button @click="onclickSignatureButton('landscape')">全屏</button>
- </uni-col>
- </uni-row>
- </view>
- </view>
- </uni-popup>
- </template>
- <script setup lang="ts">
- import { computed, onMounted, reactive, ref } from 'vue'
- import { onLoad, onShow } from '@dcloudio/uni-app'
- import { LSignatureToTempFilePathOptions, LSignatureToFileSuccess } from '@/uni_modules/lime-signature'
- import attachmentList from '@/components/ygoa/attachmentList.vue'
- import config from '@/config.js'
- import $tab from '@/plugins/tab.js'
- import $modal from '@/plugins/modal.js'
- import { getProcessFlowInfo, getProcessFormInfo, getProcessFormInfoInFlow, getProcessFlow, submitProcessFlow, cancelProcessFlow, uploadSignatureImg, uploadSignatureBoardImg, uploadFile } from '@/api/process.js'
- import { useUserStore } from '@/store/user.js'
- import {getLoginInfo,getSession,setSession} from '@/utils/auth.js'
- import {reLogin} from '@/api/login.js'
- const fieldTypeDict = {
- '0': 'text',
- '1': 'digit'
- }
- const userStore = useUserStore()
- const processInfo = reactive({
- insId: '',
- insName: '',
- control: 1,
- username: '',
- reqOffice: 0,
- reqRemark: 0,
- tinsId: undefined
- })
- onLoad(({ insId, tinsId, insName, control }) => {
- // 获取传入的标题参数
- const title = insName || '流程信息';
- processInfo.insId = insId
- processInfo.insName = insName
- processInfo.control = control
- if (tinsId) {
- processInfo['tinsId'] = tinsId
- }
- // 设置导航栏标题
- uni.setNavigationBarTitle({
- title: title
- });
- })
- onShow(()=>{
- const loginInfo = getLoginInfo()
- //如果有登录信息,就自动登录刷session
- if(Object.keys(loginInfo).length !== 0){
- reLogin(loginInfo.username, loginInfo.password).then((res) => {
- if ("ok" === res.data) {
- setSession(res.cookies[0].split("=")[1].split(";")[0]);
- }
- }).catch(res=>{
- console.log(res);
- })
- }
- })
- onMounted(() => {
- initProcessForm() // 获取表单数据
- initProcessInfo() // 获取流程数据
- })
- const repeatingForm = ref({
- elements: [],
- elementItem: [],
- })
- const repeatingFormNotEmpty = ref(false)
- function repeatingFormHasValue() {
- if (repeatingForm.value === undefined) return
- if (repeatingForm.value.elementItem.length <= 0) return
- repeatingForm.value.elements.forEach(({ defaultValue }) => {
- if (defaultValue != "") {
- repeatingFormNotEmpty.value = true
- return new Promise((resolve, reject) => {
- resolve(repeatingFormNotEmpty)
- })
- }
- })
- }
- // 新增重复表表单
- function addrepeatingFormItem(index) {
- // parseCalculation(repeatingForm.value.elementItem)
- const table = repeatingForm.value.elementItem.map(({ tableField, bddzText }) => {
- const item = {
- name: tableField,
- defaultValue: ""
- }
- if (bddzText != '') {
- const mulItem = bddzText.split('*')
- // 保存关联数据索引
- item['bddzText'] = mulItem.map(item => {
- // item['operation '].operands = mulItem.map(item => {
- return repeatingForm.value.elementItem.findIndex(({ elementName }) => item == elementName)
- })
- }
- return item
- })
- repeatingForm.value.elements.splice(index + 1, 0, table)
- }
- // 删除重复表表单
- function delrepeatingFormItem(index) {
- $modal.confirm('', '确认删除该重复表数据')
- .then(() => {
- repeatingForm.value.elements.splice(index, 1)
- // $repeatingForms.value.splice(index, 1)
- }).catch(() => { })
- }
- const formElements = ref([])
- const formInfo = ref({
- formElements: [],
- formId: '',
- formInsId: ''
- })
- const fileList = ref([])
- const isCancel = ref(false)
- function initProcessForm() {
- if (processInfo.tinsId) {
- // 待办审批流程表单数据
- getProcessFormInfoInFlow(userStore.user.useId, processInfo).then(({ returnParams }) => {
- formElements.value = returnParams.formElements
- formInfo.value = returnParams.formInfo[0]
- repeatingForm.value = returnParams.repeatingForm
- getMainFormRule()
- if (returnParams.isCancel == 1) {
- isCancel.value = true
- }
- repeatingFormHasValue()
- remark.value = flowInfo.value.seModel == '0' ? '同意' : '重新提交'
- })
- } else {
- // 我的 在办 办结流程表单数据
- getProcessFormInfo(userStore.user.useId, processInfo.insId).then(({ returnParams }) => {
- formElements.value = returnParams.formElements
- repeatingForm.value = returnParams.repeatingForm
- fileList.value = returnParams.fileList
- if (returnParams.isCancel == 1) {
- isCancel.value = true
- }
- repeatingFormHasValue()
- })
- }
- }
- const options = ref([])
- const stepActive = ref(-1)
- const flowInfo = ref({
- seModel: '0'
- })
- function initProcessInfo() {
- getProcessFlow(userStore.user.useId, processInfo).then(({ returnParams }) => {
- options.value = returnParams.list.map((item, index) => {
- const { tmodelName, name, createdate, finishdate, remark, state } = item
- if (state == 1) {
- stepActive.value = index
- }
- const title = tmodelName + (name == '' ? '' : ' ( ' + name + ' )')
- const desc = '创建时间: ' + createdate
- + (finishdate == '' ? '\n' : '\n办理时间: ' + finishdate)
- + (remark == '' ? '\n' : '\n环节意见: ' + remark)
- return {
- title,
- desc,
- state
- }
- })
- if (stepActive.value === -1) stepActive.value = returnParams.list.length
- // 获取未完成过程
- if (processInfo.tinsId) {
- getProcessFlowInfo(userStore.user.useId, processInfo).then(({ returnParams }) => {
- options.value.push({ title: returnParams.nextTmodels[0].nextTmodelName })
- flowInfo.value = returnParams.flow[0]
- fileList.value = [
- { files: returnParams.flow[0].files }
- ]
- processInfo.reqOffice = returnParams.tmodel.reqOffice
- processInfo.reqRemark = returnParams.tmodel.reqRemark
- })
- }
- })
- }
- // 下拉框
- function bindPickerChange(e, item) {
- const index = e.detail.value;
- item.defaultValue = item.typeDetail.enum[index].enumVname
- }
- function formatDict(dict) {
- return dict.map(({ enumVname }) => enumVname)
- }
- const signaturePopup = ref(null)
- const signatureRef = ref(null)
- const signaturePopupShow = ref(false)
- const isLandscape = ref(false)
- const signatureItemIndex = ref(-1)
- function handleSignature(index) {
- signatureItemIndex.value = index
- signaturePopup.value.open()
- initSignature()
- }
- function initSignature() {
- signaturePopupShow.value = false
- setTimeout(() => {
- signaturePopupShow.value = true
- }, 100)
- }
- function onclickSignatureButton(event) {
- // console.log('onclickSignatureButton: ', event);
- switch (event) {
- case 'undo':
- signatureRef.value.undo()
- break;
- case 'clear':
- signatureRef.value.clear()
- break;
- case 'save':
- signatureRef.value.canvasToTempFilePath({
- success: (res: LSignatureToFileSuccess) => {
- if (res.isEmpty) {
- $modal.msgError('签名不能为空!')
- return
- }
- // 判断上传文件是否是base64
- if (res.tempFilePath.substring(0, 'data:image/png;base64,'.length) == 'data:image/png;base64,') {
- const _fileData = res.tempFilePath
- uploadSignatureBoardImg(userStore.user.useId, _fileData, formElements.value[signatureItemIndex.value].tableField)
- .then(({ returnParams }) => {
- formElements.value[signatureItemIndex.value].defaultValue = returnParams.sealInsID
- formElements.value[signatureItemIndex.value].sealImgPath = returnParams.path
- signatureItemIndex.value = -1
- signaturePopupShow.value = false
- signaturePopup.value.close()
- })
- } else {
- // 转 base64
- wx.getFileSystemManager().readFile({
- filePath: res.tempFilePath,
- encoding: 'base64',
- success: fileData => {
- const _fileData = 'data:image/png;base64,' + fileData.data
- uploadSignatureBoardImg(userStore.user.useId, _fileData, formElements.value[signatureItemIndex.value].tableField)
- .then(({ returnParams }) => {
- formElements.value[signatureItemIndex.value].defaultValue = returnParams.sealInsID
- formElements.value[signatureItemIndex.value].sealImgPath = returnParams.path
- signatureItemIndex.value = -1
- signaturePopupShow.value = false
- signaturePopup.value.close()
- })
- }
- })
- }
- }
- } as LSignatureToTempFilePathOptions)
- break;
- case 'landscape':
- isLandscape.value = !isLandscape.value
- initSignature()
- break;
- }
- }
- function closeSignaturePopup() {
- signatureItemIndex.value = -1
- signaturePopupShow.value = false
- }
- const repeatingFormPopup = ref(null)
- // 查看重复表
- function handleRepeatingForm() {
- repeatingFormPopup.value.open()
- }
- // 附件管理
- function deleteFile(file) {
- // console.log('deleteFile: ',file);
- fileList.value[0].files = fileList.value[0].files.filter(({fileId}) => !(fileId == file.fileId))
- }
- // 上传附件
- const subFileList = ref([]) // 文件列表
- const subFileSeqs = ref([])
- async function handleFileSelect(files) { // 新增文件
- // console.log('handleFileSelect', files.tempFiles)
- files.tempFiles.forEach(file => {
- const data = {
- name: file.name,
- filePath: file.path,
- }
- uploadFile(data)
- .then(res => {
- file.seq = res.returnParams
- subFileSeqs.value.push({ 'seq': res.returnParams, 'path': file.path })
- subFileList.value.push(file)
- $modal.msgSuccess('文件' + data.name + '上传成功')
- })
- .catch(err => {
- $modal.msgError('文件' + data.name + '上传失败,请删除重新上传')
- switch (err) {
- case -201:
- console.log('文件上传失败 未找到该文件');
- break;
- case -20201:
- console.log('文件上传失败 返回值不是JSON字符串');
- break;
- }
- })
- })
- // console.log('UploadFiles', files.tempFiles);
- }
- function handleFileProgress(file, progress) {
- // console.log('handleFileProgress', file, progress);
- }
- function handleFileSuccess(file, res) {
- // console.log('handleFileSuccess', file, res);
- }
- function handleFileFail(file, err) {
- // console.log('handleFileFail', file, err);
- }
- function handleFileDelete(file) { // 移除文件
- // console.log('handleDelete', file)
- subFileSeqs.value.splice(subFileSeqs.value.findIndex(({ path }) => path == file.tempFilePath))
- }
- const $mainForm = ref(null)
- const $mainFormRules = ref({})
- const mainFormValue = ref({})
- const formatTypeDict = {
- '0': 'string',
- '1': 'number'
- }
- function validateMainForm() {
- }
- // 获取主表校验规则
- function getMainFormRule() {
- $mainFormRules.value = computed(() => {
- const obj = {};
- formElements.value.forEach(elem => {
- if (!('0' != elem.canEdit && '8' != elem.type)) return
- let labelName = elem.elementName
- let errorMessage = ''
- if ('13' == elem.type) errorMessage = '请完成签名'
- obj[elem.elementId] = {
- rules: [
- {
- required: '1' == elem.noNull,
- errorMessage,
- },
- // {
- // format: formatTypeDict[elem.fieldType] || 'string',
- // }
- ],
- label: labelName
- };
- });
- return obj;
- }).value
- }
- const button_state = ref(true)
- const remark = ref('')
- function handleSubmitProcess(result) {
- let content = '确认退回'
- if (result == "1") {
- content = '确认通过'
- }
- $modal.confirm(content).then(() => {
- button_state.value = false
- if (result == "1") {
- mainFormValue.value = computed(() => {
- const obj = {};
- formElements.value.forEach(elem => {
- if (!('0' != elem.canEdit && '8' != elem.type)) return
- obj[elem.elementId] = elem.defaultValue;
- });
- return obj;
- }).value
- $mainForm.value.validate().then(res => {
- submitProcess(result)
- })
- .catch(err => {
- button_state.value = true
- $modal.msgError('表单填写错误')
- })
- } else {
- submitProcess(result)
- }
- }).catch(() => { })
- }
- function submitProcess(result) {
- formInfo.value.formElements = formElements.value
- // 过滤不可编辑的表单项
- .filter(({canEdit}) => canEdit == '1')
- .map(({ tableField, defaultValue }) => {
- return {
- name: tableField,
- value: defaultValue
- }
- })
- repeatingForm.value.elements.forEach((table, index) => {
- const newItem = table.map((item) => {
- item['value'] = item.defaultValue
- return item
- })
- formInfo.value.formElements.push(...newItem)
- })
- let flow = Object.assign({}, flowInfo.value)
- flow['staffId'] = userStore.user.useId
- flow['gxId'] = userStore.user.gxId
- flow['groupId'] = flowInfo.value.groupid
- const seqs = subFileSeqs.value.map(({ seq }) => seq)
- if (processInfo.reqOffice == 1 && seqs.length == 0) {
- button_state.value = true
- $modal.msgError('请上传附件')
- return
- } else {
- flow['fileIds'] = seqs
- }
- if (processInfo.reqRemark == 1 && remark.value == '') {
- button_state.value = true
- $modal.msgError('请填写备注')
- return
- } else {
- flow['remark'] = remark.value
- }
- // result: 1通过 2退回发起人 0退回上一级
- flow['result'] = result
- flow['nextTmodelId'] = 'undefined'
- submitProcessFlow(flow, formInfo.value, processInfo.control).then(({ returnMsg }) => {
- if (returnMsg.includes('提交失败')) {
- // 启用提交按钮
- button_state.value = true
- $modal.msgError(returnMsg)
- } else {
- $modal.msgSuccess(returnMsg)
- // 通知列表刷新数据
- uni.$emit('ReloadProcessData');
- setTimeout(() => {
- $tab.navigateBack();
- }, 1000)
- }
- })
- }
- // 取消流程
- function handleCancelProcess() {
- if (remark.value.trim() == '') {
- $modal.msgError('备注不能为空!')
- return
- }
- $modal.confirm('确认撤销').then(() => {
- cancelProcess()
- }).catch(() => { })
- }
- function cancelProcess() {
- cancelProcessFlow(userStore.user.useId, remark.value, processInfo).then(({ returnMsg }) => {
- if (returnMsg.includes('success')) {
- $modal.msgSuccess('撤销成功')
- // 通知列表刷新数据
- uni.$emit('ReloadProcessData');
- setTimeout(() => {
- $tab.navigateBack();
- }, 1000)
- } else {
- // 启用按钮
- button_state.value = true
- $modal.msgError(returnMsg)
- }
- })
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .uni-section {
- margin-left: -15px;
- margin-bottom: 10px;
- }
- .signature_container {
- background-color: #f5f5f5;
- height: 40vh;
- width: 90vw;
- .signature_content {
- height: 80%;
- width: 100%;
- }
- .signature_button_container {
- height: 20%;
- width: 100%;
- button {
- height: 100%;
- }
- }
- }
- .signature_container_landscape {
- height: 100vh;
- width: 100vw;
- .signature_content {
- height: 85%;
- width: 100%;
- }
- .signature_button_container {
- margin-top: 10%;
- height: 15%;
- width: 100%;
- button {
- height: 100%;
- width: 100%;
- transform: rotate(90deg);
- }
- }
- }
- .process_detail_container {
- position: relative;
- .repeating_table {
- ::v-deep .uni-forms {
- .uni-forms-item__label {
- font-size: calc(1rem + 0px) !important;
- line-height: calc(1rem + 0px) !important;
- font-weight: 700;
- }
- .uni-forms-item__content {
- font-size: calc(14px + (1rem - 16px)) !important;
- font-weight: 500;
- .uni-easyinput__content-input {
- height: calc(35px + .5*(1rem - 16px)) !important;
- font-size: calc(14px + (1rem - 16px)) !important;
- font-weight: 500;
- }
- }
- }
- ::v-deep .uni-forms-item--border {
- padding: 5px 0 !important;
- }
- .repeating_table_button_container {
- margin-top: 5px;
- button {
- height: 36px;
- line-height: 36px;
- color: #fff;
- }
- .add {
- background-color: #1ca035;
- }
- .del {
- background-color: #e64340;
- }
- }
- }
- .main_container {
- min-height: 40vh;
- ::v-deep .uni-forms {
- .uni-forms-item__label {
- font-size: calc(1rem + 0px) !important;
- line-height: calc(1rem + 0px) !important;
- font-weight: 700;
- }
-
- .uni-forms-item__content {
- font-size: calc(14px + (1rem - 16px)) !important;
- font-weight: 500;
- .uni-easyinput__content-textarea {
- font-size: calc(14px + (1rem - 16px)) !important;
- font-weight: 500;
- }
-
- .uni-easyinput__content-input {
- height: calc(35px + .5*(1rem - 16px)) !important;
- font-size: calc(14px + (1rem - 16px)) !important;
- font-weight: 500;
- color: #333;
- }
-
- .uni-date {
- .uni-icons {
- font-size: calc(22px + 1.2*(1rem - 16px)) !important;
- font-weight: 500;
- }
-
- .uni-date__x-input {
- height: auto;
- font-size: calc(14px + 1.2*(1rem - 16px)) !important;
- font-weight: 500;
- }
- }
- }
- }
- .element_value_container {
-
- .signature_img {
- width: 180px;
- }
- .element_value {
- line-height: 36px;
- }
- }
- }
- ::v-deep .repeating_table_container {
- width: 98vw;
- .uni-table-scroll {
- max-height: 80vh;
- .uni-table {
- min-width: 100% !important;
- .uni-table-th {
- font-size: calc(14px + 1.2*(1rem - 16px)) !important;
- min-width: calc(50px + 2.5*(1rem - 16px));
- background-color: #2979ff;
- font-weight: bold;
- color: #fcfcfc;
- }
- .uni-table-td {
- font-size: calc(14px + 1.2*(1rem - 16px)) !important;
- }
- }
- }
- }
- ::v-deep .file_picker_container {
- .uni-card {
- .uni-card__header-content-title {
- font-size: calc(15px + .5*(1rem - 16px));
- }
- .uni-card__header-extra-text {
- font-size: calc(15px + .5*(1rem - 16px));
- }
- }
- }
- ::v-deep .flow_step_container {
- min-height: 200px;
- .u-steps {
- .u-steps-item {
- padding-bottom: 11px;
- .u-text__value--tips {
- font-size: calc(12px + .5*(1rem - 16px)) !important;
- }
- .redcontent {
- .u-text__value--content {
- color: #ff4500;
- }
- }
- .active_step_circle {
- width: 20px;
- height: 20px;
- box-sizing: border-box;
- flex-shrink: 0;
- border-radius: 100px;
- border-width: 1px;
- border-color: #A78BFA;
- background-color: #A78BFA;
- border-style: solid;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- transition: background-color .3s;
- .active_step_text {
- color: #fff;
- font-size: 11px;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- text-align: center;
- line-height: 11px;
- }
- }
- }
- .u-steps-item view:last-of-type {
- margin-top: 0 !important;
- .u-text__value--content {
- font-size: calc(16px + .5*(1rem - 16px)) !important;
- }
- .u-text__value--main {
- font-size: calc(16px + .5*(1rem - 16px)) !important;
- font-weight: 500;
- }
- }
- }
- }
- .approve_button {
- position: sticky;
- z-index: 10;
- width: 100%;
- bottom: 10px;
- }
- }
- ::v-deep button {
- font-size: calc(18px + .5*(1rem - 16px));
- }
- .reject_button {
- ::v-deep .uni-card {
- background-color: #f5f5f5;
- }
- }
- .remark_container {
- .remark_content {
- margin-bottom: 10px;
- ::v-deep .uni-easyinput {
- .uni-easyinput__content-textarea {
- font-size: calc(14px + .5*(1rem - 16px)) !important;
- }
- }
- }
- }
- ::v-deep .uni-calendar__content {
- margin: -20px;
- margin-top: 20px;
- .uni-calendar__header {
- .uni-calendar__header-text {
- font-size: calc(14px + .5*(1rem - 16px)) !important;
- }
- .uni-calendar__backtoday {
- padding: 2px 8px 2px 10px !important;
- font-size: calc(0.75rem + 0px) !important;
- }
- }
- .uni-calendar__box {
- .uni-calendar__weeks {
- .uni-calendar__weeks-day {
- .uni-calendar__weeks-day-text {
- font-size: calc(14px + .5*(1rem - 16px)) !important;
- }
- }
- .uni-calendar__weeks-item {
- .uni-calendar-item__weeks-box-item {
- .uni-calendar-item__weeks-box-circle {
- width: calc(8px + .5*(1rem - 16px)) !important;
- height: calc(8px + .5*(1rem - 16px)) !important;
- top: calc(5px - .25*(1rem - 16px)) !important;
- right: calc(5px - .25*(1rem - 16px)) !important;
- }
- .uni-calendar-item__weeks-box-text {
- font-size: calc(14px + .5*(1rem - 16px)) !important;
- }
- .uni-calendar-item__weeks-lunar-text {
- font-size: calc(12px + .5*(1rem - 16px)) !important;
- }
- }
- }
- }
- }
- .uni-date-changed {
- .uni-date-changed--time-date {
- font-size: calc(14px + 1*(1rem - 16px)) !important;
- }
- .uni-datetime-picker-text {
- font-size: calc(14px + 1*(1rem - 16px)) !important;
- }
- }
- }
- </style>
|