index.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007
  1. <template>
  2. <page-meta root-font-size="system" />
  3. <view class="process_detail_container">
  4. <uni-card>
  5. <view class="main_container">
  6. <uni-section titleFontSize="1.3rem" title="申请内容" type="line"></uni-section>
  7. <uni-forms ref="$mainForm" :rules="$mainFormRules" :modelValue="mainFormValue" label-position="left"
  8. :label-width="125" :border="true">
  9. <view v-for="(elem, index) in formElements" :key="index">
  10. <uni-forms-item
  11. v-if="!(elem.elementName.endsWith('审批') && '' == elem.defaultValue && ['0', undefined].includes(elem.canEdit)) && ('' != elem.defaultValue || 1 == elem.canEdit)" :label="elem.elementName" :name="elem.elementId">
  12. <view class="element_value_container">
  13. <view v-if="'1' == elem.canEdit && '8' != elem.type" class="element_value">
  14. <!-- 富文本框 -->
  15. <uni-easyinput v-if="'1' == elem.type" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))" placeholder="请输入内容"
  16. v-model="elem.defaultValue" type="textarea"></uni-easyinput>
  17. <!-- 文本框 -->
  18. <uni-easyinput v-else-if="'0' == elem.type" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))" placeholder="请输入内容"
  19. v-model="elem.defaultValue" type="text"></uni-easyinput>
  20. <!-- 下拉框 -->
  21. <picker class="picker_container" v-else-if="'2' == elem.type"
  22. @change="bindPickerChange($event, elem)" :value="elem.defaultValue"
  23. :range="formatDict(elem.typeDetail.enum)">
  24. <view class="uni-input input_text">
  25. <!-- 设置默认值为第一个选项 -->
  26. {{ elem.defaultValue ? elem.defaultValue : elem.defaultValue =
  27. elem.typeDetail.enum[0].enumVname }}
  28. </view>
  29. </picker>
  30. <!-- 年月日 时分秒 -->
  31. <uni-datetime-picker v-else-if="'9' == elem.type" v-model="elem.defaultValue"
  32. type="datetime" />
  33. <!-- 年月日 -->
  34. <uni-datetime-picker v-else-if="'3' == elem.type" v-model="elem.defaultValue"
  35. type="date" />
  36. <!-- 审批签字板 -->
  37. <view v-else-if="'13' == elem.type">
  38. <button v-if="elem.defaultValue == ''" type="primary"
  39. @click="handleSignature(index)">签名</button>
  40. <view v-else class="signature_img">
  41. <img style="width: 100%;" mode="widthFix" @click="handleSignature(index)"
  42. :src="config.baseUrlPre + elem.sealImgPath"
  43. :alt="elem.elementName + '签名'" />
  44. </view>
  45. </view>
  46. </view>
  47. <view v-else-if="typeof elem.sealImgPath === 'string' && elem.sealImgPath.startsWith('/shares')" class="signature_img">
  48. <img style="width: 100%;" mode="widthFix"
  49. :src="config.baseUrlPre + elem.sealImgPath" />
  50. </view>
  51. <view v-else-if="typeof elem.defaultValue === 'string' && elem.defaultValue.startsWith('/shares')" class="signature_img">
  52. <img style="width: 100%;" mode="widthFix"
  53. :src="config.baseUrlPre + elem.defaultValue" />
  54. </view>
  55. <text class="element_value" v-else>{{ elem.defaultValue }}</text>
  56. </view>
  57. </uni-forms-item>
  58. </view>
  59. </uni-forms>
  60. </view>
  61. </uni-card>
  62. <view class="repeating_table">
  63. <!-- 重复表 -->
  64. <uni-card v-if="flowInfo.seModel == '0' && repeatingFormNotEmpty" spacing="0" padding="0">
  65. <button @click="handleRepeatingForm" type="primary">查看明细</button>
  66. </uni-card>
  67. <uni-card v-else v-for="(table, tableIndex) in repeatingForm.elements" spacing="0" :key="tableIndex">
  68. <uni-forms label-position="left" :label-width="125" :border="true">
  69. <uni-forms-item :name="elem.tableField" v-for="(elem, itemIndex) in table"
  70. :label="repeatingForm.elementItem[itemIndex].elementName.slice(3)" :key="itemIndex">
  71. <uni-easyinput placeholder="请输入内容" v-model="elem.defaultValue"
  72. :type="fieldTypeDict[repeatingForm.elementItem[itemIndex].fieldType.value] || 'text'" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))"></uni-easyinput>
  73. </uni-forms-item>
  74. </uni-forms>
  75. <!-- <view class="repeating_table_button_container">
  76. <uni-row>
  77. <uni-col :span="10" :offset="1">
  78. <button @click="addrepeatingFormItem(tableIndex)" type="primary">新增</button>
  79. </uni-col>
  80. <uni-col :span="10" :offset="2">
  81. <button @click="delrepeatingFormItem(tableIndex)"
  82. :disabled="repeatingForm.elements.length <= 1" type="warn">删除</button>
  83. </uni-col>
  84. </uni-row>
  85. </view> -->
  86. </uni-card>
  87. <uni-popup v-if="flowInfo.seModel == '0' && repeatingFormNotEmpty" ref="repeatingFormPopup">
  88. <uni-card margin="0px" spacing="0px" padding="0px">
  89. <view class="repeating_table_container">
  90. <uni-table :border="true" stripe>
  91. <uni-tr>
  92. <uni-th align="center" v-for="(item, index) in repeatingForm.elementItem" :key="index">
  93. {{ item.elementName.slice(3, 5) }}
  94. </uni-th>
  95. </uni-tr>
  96. <uni-tr v-for="(table, tableIndex) in repeatingForm.elements" :key="tableIndex">
  97. <uni-td align="center" v-for="(elem, itemIndex) in table" :key="itemIndex">
  98. {{ elem.defaultValue }}
  99. </uni-td>
  100. </uni-tr>
  101. </uni-table>
  102. </view>
  103. </uni-card>
  104. </uni-popup>
  105. </view>
  106. <!-- 附件 -->
  107. <view v-for="(item, index) in fileList" :key="index">
  108. <uni-card v-if="item.files.length != undefined && item.files.length > 0">
  109. <uni-section titleFontSize="1.3rem" title="附件" type="line"></uni-section>
  110. <attachment-list @clickDelete="deleteFile" :canEdit="flowInfo.seModel == '1'" :attachments="item.files"></attachment-list>
  111. </uni-card>
  112. </view>
  113. <!-- 上传附件 -->
  114. <view v-if="processInfo.tinsId || flowInfo.seModel == '1'" class="file_picker_container">
  115. <uni-card title="上传附件" :extra="`${subFileList.length}/50`" spacing="0">
  116. <uni-file-picker ref="filePicker" v-model="subFileList" :auto-upload="true" mode="list" :limit="50"
  117. file-mediatype="all" @select="handleFileSelect" @progress="handleFileProgress"
  118. @success="handleFileSuccess" @fail="handleFileFail" @delete="handleFileDelete" />
  119. </uni-card>
  120. </view>
  121. <!-- 流转过程 -->
  122. <view>
  123. <uni-card>
  124. <view class="flow_step_container">
  125. <uni-section titleFontSize="1.3rem" title="流转过程" type="line"></uni-section>
  126. <up-steps :current="stepActive" activeColor="#18bc37" inactiveColor="#2979ff" direction="column">
  127. <view v-for="(step, index) in options">
  128. <up-steps-item :contentClass="'redcontent'" v-if="step.state == 3"
  129. :title="step.title + ' 退回'" :desc="step.desc" :key="index" error></up-steps-item>
  130. <up-steps-item :contentClass="'redcontent'" v-else-if="step.state == 0"
  131. :title="step.title + ' 撤销'" :desc="step.desc" :key="index" error></up-steps-item>
  132. <up-steps-item v-else-if="index == stepActive" :title="step.title" :desc="step.desc"
  133. :key="index">
  134. <template #icon>
  135. <view class="active_step_circle">
  136. <text class="active_step_text">{{ index + 1 }}</text>
  137. </view>
  138. </template>
  139. </up-steps-item>
  140. <up-steps-item v-else :title="step.title" :desc="step.desc" :key="index"></up-steps-item>
  141. </view>
  142. </up-steps>
  143. </view>
  144. </uni-card>
  145. </view>
  146. <view v-if="processInfo.tinsId">
  147. <view class="remark_container">
  148. <uni-card>
  149. <uni-section titleFontSize="1.3rem" title="环节备注" type="line"></uni-section>
  150. <view class="remark_content">
  151. <uni-easyinput type="textarea" autoHeight v-model="remark" placeholder="请输入" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))"></uni-easyinput>
  152. </view>
  153. </uni-card>
  154. </view>
  155. </view>
  156. <view v-if="processInfo.tinsId" class="approve_button">
  157. <uni-card spacing="0" padding="0">
  158. <button :disabled="!button_state" :loading="!button_state" type="primary"
  159. @click="handleSubmitProcess('1')">
  160. {{ flowInfo.seModel == '0' ? '通过' : '提交' }}
  161. </button>
  162. </uni-card>
  163. </view>
  164. </view>
  165. <view v-if="processInfo.tinsId && flowInfo.seModel == '0'">
  166. <view class="reject_button">
  167. <uni-card spacing="0" padding="0" :is-shadow="false" :border="false">
  168. <uni-row>
  169. <uni-col :span="11">
  170. <button :disabled="!button_state" :loading="!button_state" type="warn"
  171. @click="handleSubmitProcess('0')">退回上一级</button>
  172. </uni-col>
  173. <uni-col :span="11" :offset="2">
  174. <button :disabled="!button_state" :loading="!button_state" type="warn"
  175. @click="handleSubmitProcess('2')">退回发起人</button>
  176. </uni-col>
  177. </uni-row>
  178. </uni-card>
  179. </view>
  180. </view>
  181. <view v-else-if="isCancel">
  182. <view class="remark_container">
  183. <uni-card>
  184. <uni-section titleFontSize="1.3rem" title="撤销备注" type="line"></uni-section>
  185. <view class="remark_content">
  186. <uni-easyinput type="textarea" autoHeight v-model="remark" placeholder="请输入" placeholderStyle="font-size: calc(14px + 1.2*(1rem - 16px))"></uni-easyinput>
  187. </view>
  188. </uni-card>
  189. </view>
  190. <view class="cancel_button_container">
  191. <uni-card spacing="0" padding="0">
  192. <button :disabled="!button_state" :loading="!button_state" type="warn"
  193. @click="handleCancelProcess">撤销</button>
  194. </uni-card>
  195. </view>
  196. </view>
  197. <view style="height: 5px; margin-top: 20px;"></view>
  198. <!-- 签字版弹出层 -->
  199. <uni-popup ref="signaturePopup" @maskClick="closeSignaturePopup">
  200. <view class="signature_container" :class="{ 'signature_container_landscape': isLandscape }">
  201. <view class="signature_content">
  202. <l-signature ref="signatureRef" v-if="signaturePopupShow" :landscape="isLandscape" :penSize="8"
  203. :minLineWidth="4" :maxLineWidth="12" :openSmooth="true" :preferToDataURL="true"
  204. backgroundColor="#ffffff" penColor="black"></l-signature>
  205. </view>
  206. <view class="signature_button_container">
  207. <uni-row :gutter="10">
  208. <uni-col :span="6">
  209. <button type="warn" @click="onclickSignatureButton('undo')">撤销</button>
  210. </uni-col>
  211. <uni-col :span="6">
  212. <button type="warn" @click="onclickSignatureButton('clear')">清空</button>
  213. </uni-col>
  214. <uni-col :span="6">
  215. <button type="primary" @click="onclickSignatureButton('save')">保存</button>
  216. </uni-col>
  217. <uni-col :span="6">
  218. <button @click="onclickSignatureButton('landscape')">全屏</button>
  219. </uni-col>
  220. </uni-row>
  221. </view>
  222. </view>
  223. </uni-popup>
  224. </template>
  225. <script setup lang="ts">
  226. import { computed, onMounted, reactive, ref } from 'vue'
  227. import { onLoad, onShow } from '@dcloudio/uni-app'
  228. import { LSignatureToTempFilePathOptions, LSignatureToFileSuccess } from '@/uni_modules/lime-signature'
  229. import attachmentList from '@/components/ygoa/attachmentList.vue'
  230. import config from '@/config.js'
  231. import $tab from '@/plugins/tab.js'
  232. import $modal from '@/plugins/modal.js'
  233. import { getProcessFlowInfo, getProcessFormInfo, getProcessFormInfoInFlow, getProcessFlow, submitProcessFlow, cancelProcessFlow, uploadSignatureImg, uploadSignatureBoardImg, uploadFile } from '@/api/process.js'
  234. import { useUserStore } from '@/store/user.js'
  235. import {getLoginInfo,getSession,setSession} from '@/utils/auth.js'
  236. import {reLogin} from '@/api/login.js'
  237. const fieldTypeDict = {
  238. '0': 'text',
  239. '1': 'digit'
  240. }
  241. const userStore = useUserStore()
  242. const processInfo = reactive({
  243. insId: '',
  244. insName: '',
  245. control: 1,
  246. username: '',
  247. reqOffice: 0,
  248. reqRemark: 0,
  249. tinsId: undefined
  250. })
  251. onLoad(({ insId, tinsId, insName, control }) => {
  252. // 获取传入的标题参数
  253. const title = insName || '流程信息';
  254. processInfo.insId = insId
  255. processInfo.insName = insName
  256. processInfo.control = control
  257. if (tinsId) {
  258. processInfo['tinsId'] = tinsId
  259. }
  260. // 设置导航栏标题
  261. uni.setNavigationBarTitle({
  262. title: title
  263. });
  264. })
  265. onShow(()=>{
  266. const loginInfo = getLoginInfo()
  267. //如果有登录信息,就自动登录刷session
  268. if(Object.keys(loginInfo).length !== 0){
  269. reLogin(loginInfo.username, loginInfo.password).then((res) => {
  270. if ("ok" === res.data) {
  271. setSession(res.cookies[0].split("=")[1].split(";")[0]);
  272. }
  273. }).catch(res=>{
  274. console.log(res);
  275. })
  276. }
  277. })
  278. onMounted(() => {
  279. initProcessForm() // 获取表单数据
  280. initProcessInfo() // 获取流程数据
  281. })
  282. const repeatingForm = ref({
  283. elements: [],
  284. elementItem: [],
  285. })
  286. const repeatingFormNotEmpty = ref(false)
  287. function repeatingFormHasValue() {
  288. if (repeatingForm.value === undefined) return
  289. if (repeatingForm.value.elementItem.length <= 0) return
  290. repeatingForm.value.elements.forEach(({ defaultValue }) => {
  291. if (defaultValue != "") {
  292. repeatingFormNotEmpty.value = true
  293. return new Promise((resolve, reject) => {
  294. resolve(repeatingFormNotEmpty)
  295. })
  296. }
  297. })
  298. }
  299. // 新增重复表表单
  300. function addrepeatingFormItem(index) {
  301. // parseCalculation(repeatingForm.value.elementItem)
  302. const table = repeatingForm.value.elementItem.map(({ tableField, bddzText }) => {
  303. const item = {
  304. name: tableField,
  305. defaultValue: ""
  306. }
  307. if (bddzText != '') {
  308. const mulItem = bddzText.split('*')
  309. // 保存关联数据索引
  310. item['bddzText'] = mulItem.map(item => {
  311. // item['operation '].operands = mulItem.map(item => {
  312. return repeatingForm.value.elementItem.findIndex(({ elementName }) => item == elementName)
  313. })
  314. }
  315. return item
  316. })
  317. repeatingForm.value.elements.splice(index + 1, 0, table)
  318. }
  319. // 删除重复表表单
  320. function delrepeatingFormItem(index) {
  321. $modal.confirm('', '确认删除该重复表数据')
  322. .then(() => {
  323. repeatingForm.value.elements.splice(index, 1)
  324. // $repeatingForms.value.splice(index, 1)
  325. }).catch(() => { })
  326. }
  327. const formElements = ref([])
  328. const formInfo = ref({
  329. formElements: [],
  330. formId: '',
  331. formInsId: ''
  332. })
  333. const fileList = ref([])
  334. const isCancel = ref(false)
  335. function initProcessForm() {
  336. if (processInfo.tinsId) {
  337. // 待办审批流程表单数据
  338. getProcessFormInfoInFlow(userStore.user.useId, processInfo).then(({ returnParams }) => {
  339. formElements.value = returnParams.formElements
  340. formInfo.value = returnParams.formInfo[0]
  341. repeatingForm.value = returnParams.repeatingForm
  342. getMainFormRule()
  343. if (returnParams.isCancel == 1) {
  344. isCancel.value = true
  345. }
  346. repeatingFormHasValue()
  347. remark.value = flowInfo.value.seModel == '0' ? '同意' : '重新提交'
  348. })
  349. } else {
  350. // 我的 在办 办结流程表单数据
  351. getProcessFormInfo(userStore.user.useId, processInfo.insId).then(({ returnParams }) => {
  352. formElements.value = returnParams.formElements
  353. repeatingForm.value = returnParams.repeatingForm
  354. fileList.value = returnParams.fileList
  355. if (returnParams.isCancel == 1) {
  356. isCancel.value = true
  357. }
  358. repeatingFormHasValue()
  359. })
  360. }
  361. }
  362. const options = ref([])
  363. const stepActive = ref(-1)
  364. const flowInfo = ref({
  365. seModel: '0'
  366. })
  367. function initProcessInfo() {
  368. getProcessFlow(userStore.user.useId, processInfo).then(({ returnParams }) => {
  369. options.value = returnParams.list.map((item, index) => {
  370. const { tmodelName, name, createdate, finishdate, remark, state } = item
  371. if (state == 1) {
  372. stepActive.value = index
  373. }
  374. const title = tmodelName + (name == '' ? '' : ' ( ' + name + ' )')
  375. const desc = '创建时间: ' + createdate
  376. + (finishdate == '' ? '\n' : '\n办理时间: ' + finishdate)
  377. + (remark == '' ? '\n' : '\n环节意见: ' + remark)
  378. return {
  379. title,
  380. desc,
  381. state
  382. }
  383. })
  384. if (stepActive.value === -1) stepActive.value = returnParams.list.length
  385. // 获取未完成过程
  386. if (processInfo.tinsId) {
  387. getProcessFlowInfo(userStore.user.useId, processInfo).then(({ returnParams }) => {
  388. options.value.push({ title: returnParams.nextTmodels[0].nextTmodelName })
  389. flowInfo.value = returnParams.flow[0]
  390. fileList.value = [
  391. { files: returnParams.flow[0].files }
  392. ]
  393. processInfo.reqOffice = returnParams.tmodel.reqOffice
  394. processInfo.reqRemark = returnParams.tmodel.reqRemark
  395. })
  396. }
  397. })
  398. }
  399. // 下拉框
  400. function bindPickerChange(e, item) {
  401. const index = e.detail.value;
  402. item.defaultValue = item.typeDetail.enum[index].enumVname
  403. }
  404. function formatDict(dict) {
  405. return dict.map(({ enumVname }) => enumVname)
  406. }
  407. const signaturePopup = ref(null)
  408. const signatureRef = ref(null)
  409. const signaturePopupShow = ref(false)
  410. const isLandscape = ref(false)
  411. const signatureItemIndex = ref(-1)
  412. function handleSignature(index) {
  413. signatureItemIndex.value = index
  414. signaturePopup.value.open()
  415. initSignature()
  416. }
  417. function initSignature() {
  418. signaturePopupShow.value = false
  419. setTimeout(() => {
  420. signaturePopupShow.value = true
  421. }, 100)
  422. }
  423. function onclickSignatureButton(event) {
  424. // console.log('onclickSignatureButton: ', event);
  425. switch (event) {
  426. case 'undo':
  427. signatureRef.value.undo()
  428. break;
  429. case 'clear':
  430. signatureRef.value.clear()
  431. break;
  432. case 'save':
  433. signatureRef.value.canvasToTempFilePath({
  434. success: (res: LSignatureToFileSuccess) => {
  435. if (res.isEmpty) {
  436. $modal.msgError('签名不能为空!')
  437. return
  438. }
  439. // 判断上传文件是否是base64
  440. if (res.tempFilePath.substring(0, 'data:image/png;base64,'.length) == 'data:image/png;base64,') {
  441. const _fileData = res.tempFilePath
  442. uploadSignatureBoardImg(userStore.user.useId, _fileData, formElements.value[signatureItemIndex.value].tableField)
  443. .then(({ returnParams }) => {
  444. formElements.value[signatureItemIndex.value].defaultValue = returnParams.sealInsID
  445. formElements.value[signatureItemIndex.value].sealImgPath = returnParams.path
  446. signatureItemIndex.value = -1
  447. signaturePopupShow.value = false
  448. signaturePopup.value.close()
  449. })
  450. } else {
  451. // 转 base64
  452. wx.getFileSystemManager().readFile({
  453. filePath: res.tempFilePath,
  454. encoding: 'base64',
  455. success: fileData => {
  456. const _fileData = 'data:image/png;base64,' + fileData.data
  457. uploadSignatureBoardImg(userStore.user.useId, _fileData, formElements.value[signatureItemIndex.value].tableField)
  458. .then(({ returnParams }) => {
  459. formElements.value[signatureItemIndex.value].defaultValue = returnParams.sealInsID
  460. formElements.value[signatureItemIndex.value].sealImgPath = returnParams.path
  461. signatureItemIndex.value = -1
  462. signaturePopupShow.value = false
  463. signaturePopup.value.close()
  464. })
  465. }
  466. })
  467. }
  468. }
  469. } as LSignatureToTempFilePathOptions)
  470. break;
  471. case 'landscape':
  472. isLandscape.value = !isLandscape.value
  473. initSignature()
  474. break;
  475. }
  476. }
  477. function closeSignaturePopup() {
  478. signatureItemIndex.value = -1
  479. signaturePopupShow.value = false
  480. }
  481. const repeatingFormPopup = ref(null)
  482. // 查看重复表
  483. function handleRepeatingForm() {
  484. repeatingFormPopup.value.open()
  485. }
  486. // 附件管理
  487. function deleteFile(file) {
  488. // console.log('deleteFile: ',file);
  489. fileList.value[0].files = fileList.value[0].files.filter(({fileId}) => !(fileId == file.fileId))
  490. }
  491. // 上传附件
  492. const subFileList = ref([]) // 文件列表
  493. const subFileSeqs = ref([])
  494. async function handleFileSelect(files) { // 新增文件
  495. // console.log('handleFileSelect', files.tempFiles)
  496. files.tempFiles.forEach(file => {
  497. const data = {
  498. name: file.name,
  499. filePath: file.path,
  500. }
  501. uploadFile(data)
  502. .then(res => {
  503. file.seq = res.returnParams
  504. subFileSeqs.value.push({ 'seq': res.returnParams, 'path': file.path })
  505. subFileList.value.push(file)
  506. $modal.msgSuccess('文件' + data.name + '上传成功')
  507. })
  508. .catch(err => {
  509. $modal.msgError('文件' + data.name + '上传失败,请删除重新上传')
  510. switch (err) {
  511. case -201:
  512. console.log('文件上传失败 未找到该文件');
  513. break;
  514. case -20201:
  515. console.log('文件上传失败 返回值不是JSON字符串');
  516. break;
  517. }
  518. })
  519. })
  520. // console.log('UploadFiles', files.tempFiles);
  521. }
  522. function handleFileProgress(file, progress) {
  523. // console.log('handleFileProgress', file, progress);
  524. }
  525. function handleFileSuccess(file, res) {
  526. // console.log('handleFileSuccess', file, res);
  527. }
  528. function handleFileFail(file, err) {
  529. // console.log('handleFileFail', file, err);
  530. }
  531. function handleFileDelete(file) { // 移除文件
  532. // console.log('handleDelete', file)
  533. subFileSeqs.value.splice(subFileSeqs.value.findIndex(({ path }) => path == file.tempFilePath))
  534. }
  535. const $mainForm = ref(null)
  536. const $mainFormRules = ref({})
  537. const mainFormValue = ref({})
  538. const formatTypeDict = {
  539. '0': 'string',
  540. '1': 'number'
  541. }
  542. function validateMainForm() {
  543. }
  544. // 获取主表校验规则
  545. function getMainFormRule() {
  546. $mainFormRules.value = computed(() => {
  547. const obj = {};
  548. formElements.value.forEach(elem => {
  549. if (!('0' != elem.canEdit && '8' != elem.type)) return
  550. let labelName = elem.elementName
  551. let errorMessage = ''
  552. if ('13' == elem.type) errorMessage = '请完成签名'
  553. obj[elem.elementId] = {
  554. rules: [
  555. {
  556. required: '1' == elem.noNull,
  557. errorMessage,
  558. },
  559. // {
  560. // format: formatTypeDict[elem.fieldType] || 'string',
  561. // }
  562. ],
  563. label: labelName
  564. };
  565. });
  566. return obj;
  567. }).value
  568. }
  569. const button_state = ref(true)
  570. const remark = ref('')
  571. function handleSubmitProcess(result) {
  572. let content = '确认退回'
  573. if (result == "1") {
  574. content = '确认通过'
  575. }
  576. $modal.confirm(content).then(() => {
  577. button_state.value = false
  578. if (result == "1") {
  579. mainFormValue.value = computed(() => {
  580. const obj = {};
  581. formElements.value.forEach(elem => {
  582. if (!('0' != elem.canEdit && '8' != elem.type)) return
  583. obj[elem.elementId] = elem.defaultValue;
  584. });
  585. return obj;
  586. }).value
  587. $mainForm.value.validate().then(res => {
  588. submitProcess(result)
  589. })
  590. .catch(err => {
  591. button_state.value = true
  592. $modal.msgError('表单填写错误')
  593. })
  594. } else {
  595. submitProcess(result)
  596. }
  597. }).catch(() => { })
  598. }
  599. function submitProcess(result) {
  600. formInfo.value.formElements = formElements.value
  601. // 过滤不可编辑的表单项
  602. .filter(({canEdit}) => canEdit == '1')
  603. .map(({ tableField, defaultValue }) => {
  604. return {
  605. name: tableField,
  606. value: defaultValue
  607. }
  608. })
  609. repeatingForm.value.elements.forEach((table, index) => {
  610. const newItem = table.map((item) => {
  611. item['value'] = item.defaultValue
  612. return item
  613. })
  614. formInfo.value.formElements.push(...newItem)
  615. })
  616. let flow = Object.assign({}, flowInfo.value)
  617. flow['staffId'] = userStore.user.useId
  618. flow['gxId'] = userStore.user.gxId
  619. flow['groupId'] = flowInfo.value.groupid
  620. const seqs = subFileSeqs.value.map(({ seq }) => seq)
  621. if (processInfo.reqOffice == 1 && seqs.length == 0) {
  622. button_state.value = true
  623. $modal.msgError('请上传附件')
  624. return
  625. } else {
  626. flow['fileIds'] = seqs
  627. }
  628. if (processInfo.reqRemark == 1 && remark.value == '') {
  629. button_state.value = true
  630. $modal.msgError('请填写备注')
  631. return
  632. } else {
  633. flow['remark'] = remark.value
  634. }
  635. // result: 1通过 2退回发起人 0退回上一级
  636. flow['result'] = result
  637. flow['nextTmodelId'] = 'undefined'
  638. submitProcessFlow(flow, formInfo.value, processInfo.control).then(({ returnMsg }) => {
  639. if (returnMsg.includes('提交失败')) {
  640. // 启用提交按钮
  641. button_state.value = true
  642. $modal.msgError(returnMsg)
  643. } else {
  644. $modal.msgSuccess(returnMsg)
  645. // 通知列表刷新数据
  646. uni.$emit('ReloadProcessData');
  647. setTimeout(() => {
  648. $tab.navigateBack();
  649. }, 1000)
  650. }
  651. })
  652. }
  653. // 取消流程
  654. function handleCancelProcess() {
  655. if (remark.value.trim() == '') {
  656. $modal.msgError('备注不能为空!')
  657. return
  658. }
  659. $modal.confirm('确认撤销').then(() => {
  660. cancelProcess()
  661. }).catch(() => { })
  662. }
  663. function cancelProcess() {
  664. cancelProcessFlow(userStore.user.useId, remark.value, processInfo).then(({ returnMsg }) => {
  665. if (returnMsg.includes('success')) {
  666. $modal.msgSuccess('撤销成功')
  667. // 通知列表刷新数据
  668. uni.$emit('ReloadProcessData');
  669. setTimeout(() => {
  670. $tab.navigateBack();
  671. }, 1000)
  672. } else {
  673. // 启用按钮
  674. button_state.value = true
  675. $modal.msgError(returnMsg)
  676. }
  677. })
  678. }
  679. </script>
  680. <style lang="scss" scoped>
  681. ::v-deep .uni-section {
  682. margin-left: -15px;
  683. margin-bottom: 10px;
  684. }
  685. .signature_container {
  686. background-color: #f5f5f5;
  687. height: 40vh;
  688. width: 90vw;
  689. .signature_content {
  690. height: 80%;
  691. width: 100%;
  692. }
  693. .signature_button_container {
  694. height: 20%;
  695. width: 100%;
  696. button {
  697. height: 100%;
  698. }
  699. }
  700. }
  701. .signature_container_landscape {
  702. height: 100vh;
  703. width: 100vw;
  704. .signature_content {
  705. height: 85%;
  706. width: 100%;
  707. }
  708. .signature_button_container {
  709. margin-top: 10%;
  710. height: 15%;
  711. width: 100%;
  712. button {
  713. height: 100%;
  714. width: 100%;
  715. transform: rotate(90deg);
  716. }
  717. }
  718. }
  719. .process_detail_container {
  720. position: relative;
  721. .repeating_table {
  722. ::v-deep .uni-forms {
  723. .uni-forms-item__label {
  724. font-size: calc(1rem + 0px) !important;
  725. line-height: calc(1rem + 0px) !important;
  726. font-weight: 700;
  727. }
  728. .uni-forms-item__content {
  729. font-size: calc(14px + (1rem - 16px)) !important;
  730. font-weight: 500;
  731. .uni-easyinput__content-input {
  732. height: calc(35px + .5*(1rem - 16px)) !important;
  733. font-size: calc(14px + (1rem - 16px)) !important;
  734. font-weight: 500;
  735. }
  736. }
  737. }
  738. ::v-deep .uni-forms-item--border {
  739. padding: 5px 0 !important;
  740. }
  741. .repeating_table_button_container {
  742. margin-top: 5px;
  743. button {
  744. height: 36px;
  745. line-height: 36px;
  746. color: #fff;
  747. }
  748. .add {
  749. background-color: #1ca035;
  750. }
  751. .del {
  752. background-color: #e64340;
  753. }
  754. }
  755. }
  756. .main_container {
  757. min-height: 40vh;
  758. ::v-deep .uni-forms {
  759. .uni-forms-item__label {
  760. font-size: calc(1rem + 0px) !important;
  761. line-height: calc(1rem + 0px) !important;
  762. font-weight: 700;
  763. }
  764. .uni-forms-item__content {
  765. font-size: calc(14px + (1rem - 16px)) !important;
  766. font-weight: 500;
  767. .uni-easyinput__content-textarea {
  768. font-size: calc(14px + (1rem - 16px)) !important;
  769. font-weight: 500;
  770. }
  771. .uni-easyinput__content-input {
  772. height: calc(35px + .5*(1rem - 16px)) !important;
  773. font-size: calc(14px + (1rem - 16px)) !important;
  774. font-weight: 500;
  775. color: #333;
  776. }
  777. .uni-date {
  778. .uni-icons {
  779. font-size: calc(22px + 1.2*(1rem - 16px)) !important;
  780. font-weight: 500;
  781. }
  782. .uni-date__x-input {
  783. height: auto;
  784. font-size: calc(14px + 1.2*(1rem - 16px)) !important;
  785. font-weight: 500;
  786. }
  787. }
  788. }
  789. }
  790. .element_value_container {
  791. .signature_img {
  792. width: 180px;
  793. }
  794. .element_value {
  795. line-height: 36px;
  796. }
  797. }
  798. }
  799. ::v-deep .repeating_table_container {
  800. width: 98vw;
  801. .uni-table-scroll {
  802. max-height: 80vh;
  803. .uni-table {
  804. min-width: 100% !important;
  805. .uni-table-th {
  806. font-size: calc(14px + 1.2*(1rem - 16px)) !important;
  807. min-width: calc(50px + 2.5*(1rem - 16px));
  808. background-color: #2979ff;
  809. font-weight: bold;
  810. color: #fcfcfc;
  811. }
  812. .uni-table-td {
  813. font-size: calc(14px + 1.2*(1rem - 16px)) !important;
  814. }
  815. }
  816. }
  817. }
  818. ::v-deep .file_picker_container {
  819. .uni-card {
  820. .uni-card__header-content-title {
  821. font-size: calc(15px + .5*(1rem - 16px));
  822. }
  823. .uni-card__header-extra-text {
  824. font-size: calc(15px + .5*(1rem - 16px));
  825. }
  826. }
  827. }
  828. ::v-deep .flow_step_container {
  829. min-height: 200px;
  830. .u-steps {
  831. .u-steps-item {
  832. padding-bottom: 11px;
  833. .u-text__value--tips {
  834. font-size: calc(12px + .5*(1rem - 16px)) !important;
  835. }
  836. .redcontent {
  837. .u-text__value--content {
  838. color: #ff4500;
  839. }
  840. }
  841. .active_step_circle {
  842. width: 20px;
  843. height: 20px;
  844. box-sizing: border-box;
  845. flex-shrink: 0;
  846. border-radius: 100px;
  847. border-width: 1px;
  848. border-color: #A78BFA;
  849. background-color: #A78BFA;
  850. border-style: solid;
  851. display: flex;
  852. flex-direction: row;
  853. align-items: center;
  854. justify-content: center;
  855. transition: background-color .3s;
  856. .active_step_text {
  857. color: #fff;
  858. font-size: 11px;
  859. display: flex;
  860. flex-direction: row;
  861. align-items: center;
  862. justify-content: center;
  863. text-align: center;
  864. line-height: 11px;
  865. }
  866. }
  867. }
  868. .u-steps-item view:last-of-type {
  869. margin-top: 0 !important;
  870. .u-text__value--content {
  871. font-size: calc(16px + .5*(1rem - 16px)) !important;
  872. }
  873. .u-text__value--main {
  874. font-size: calc(16px + .5*(1rem - 16px)) !important;
  875. font-weight: 500;
  876. }
  877. }
  878. }
  879. }
  880. .approve_button {
  881. position: sticky;
  882. z-index: 10;
  883. width: 100%;
  884. bottom: 10px;
  885. }
  886. }
  887. ::v-deep button {
  888. font-size: calc(18px + .5*(1rem - 16px));
  889. }
  890. .reject_button {
  891. ::v-deep .uni-card {
  892. background-color: #f5f5f5;
  893. }
  894. }
  895. .remark_container {
  896. .remark_content {
  897. margin-bottom: 10px;
  898. ::v-deep .uni-easyinput {
  899. .uni-easyinput__content-textarea {
  900. font-size: calc(14px + .5*(1rem - 16px)) !important;
  901. }
  902. }
  903. }
  904. }
  905. ::v-deep .uni-calendar__content {
  906. margin: -20px;
  907. margin-top: 20px;
  908. .uni-calendar__header {
  909. .uni-calendar__header-text {
  910. font-size: calc(14px + .5*(1rem - 16px)) !important;
  911. }
  912. .uni-calendar__backtoday {
  913. padding: 2px 8px 2px 10px !important;
  914. font-size: calc(0.75rem + 0px) !important;
  915. }
  916. }
  917. .uni-calendar__box {
  918. .uni-calendar__weeks {
  919. .uni-calendar__weeks-day {
  920. .uni-calendar__weeks-day-text {
  921. font-size: calc(14px + .5*(1rem - 16px)) !important;
  922. }
  923. }
  924. .uni-calendar__weeks-item {
  925. .uni-calendar-item__weeks-box-item {
  926. .uni-calendar-item__weeks-box-circle {
  927. width: calc(8px + .5*(1rem - 16px)) !important;
  928. height: calc(8px + .5*(1rem - 16px)) !important;
  929. top: calc(5px - .25*(1rem - 16px)) !important;
  930. right: calc(5px - .25*(1rem - 16px)) !important;
  931. }
  932. .uni-calendar-item__weeks-box-text {
  933. font-size: calc(14px + .5*(1rem - 16px)) !important;
  934. }
  935. .uni-calendar-item__weeks-lunar-text {
  936. font-size: calc(12px + .5*(1rem - 16px)) !important;
  937. }
  938. }
  939. }
  940. }
  941. }
  942. .uni-date-changed {
  943. .uni-date-changed--time-date {
  944. font-size: calc(14px + 1*(1rem - 16px)) !important;
  945. }
  946. .uni-datetime-picker-text {
  947. font-size: calc(14px + 1*(1rem - 16px)) !important;
  948. }
  949. }
  950. }
  951. </style>