index.vue 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450
  1. <template>
  2. <home-container>
  3. <view class="report-container">
  4. <!-- 表单区域 -->
  5. <uni-forms ref="form" :rules="rules" :modelValue="formData" label-position="top" err-show-type="modal">
  6. <!-- <scroll-view class="form-scroll" scroll-y> -->
  7. <!-- 安检员信息分组 (默认折叠) -->
  8. <!-- <view class="card" style="overflow: visible;"> -->
  9. <uni-collapse class="collapse" :class="firstCollapsed.length > 0 ? 'collapse-card' : 'collapse-card-hidden'"
  10. :accordion="false" v-model="firstCollapsed" @change="changeCollapse">
  11. <uni-collapse-item class="collapse-item" title="安检员信息" name="group1" :show-animation="true">
  12. <template v-slot:title>
  13. <view class="header-section collapse-title userInfo">
  14. <view class="userName">{{ `${type !== 'add' ? '查获人:' : ''}` }}{{ type !==
  15. 'add' ? `${formData.inspectUserName}(${formData.createBy})` :
  16. `${userInfo.nickName}(${userInfo.userName})`
  17. }}
  18. </view>
  19. <view class="teamInfo" v-if="type !== 'add'">
  20. <view>{{ formData.inspectUserRoleName }}</view>
  21. <view class="team">
  22. <view v-if="formData.inspectStationName">
  23. {{ formData.inspectStationName }}
  24. </view>
  25. <view v-if="formData.inspectDepartmentName">
  26. /{{ formData.inspectDepartmentName }}
  27. </view>
  28. <view v-if="formData.inspectTeamName">
  29. /{{ formData.inspectTeamName }}
  30. </view>
  31. </view>
  32. </view>
  33. <view class="teamInfo" v-else>
  34. <view>安检员</view>
  35. <view class="team">
  36. <view v-if="userInfo.stationName">
  37. {{ userInfo.stationName }}
  38. </view>
  39. <view v-if="userInfo.departmentName">
  40. /{{ userInfo.departmentName }}
  41. </view>
  42. <view v-if="userInfo.teamsName">
  43. /{{ userInfo.teamsName }}
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <!-- kezhang角色显示查获人员选择 -->
  50. <uni-forms-item v-if="isKezhang && !isDetailMode" label="查获人员" name="inspectUserId" required>
  51. <uni-data-picker :readonly="isDetailMode" :localdata="departmentUserOptions" popup-title="请选择查获人员"
  52. v-model="formData.inspectUserId" @change="onInspectUserChange" />
  53. </uni-forms-item>
  54. <uni-forms-item v-else-if="isKezhang && isDetailMode" label="查获人员">
  55. <uni-easyinput :disabled="true" placeholder="查获人员" :value="formData.inspectUserName" />
  56. </uni-forms-item>
  57. <uni-forms-item label="查获时间" name="seizureTime" required>
  58. <uni-datetime-picker :disabled="isDetailMode" type="datetime" :start="startDate" :end="endDate"
  59. v-model="formData.seizureTime" />
  60. </uni-forms-item>
  61. <uni-forms-item label="安检岗位" name="checkMethodText" required>
  62. <uni-combox :disabled="isDetailMode" :candidates="checkMethodCandidates" placeholder="请选择安检岗位"
  63. v-model="formData.checkMethodText" @input="onCheckMethodComboxChange" />
  64. </uni-forms-item>
  65. <uni-forms-item label="查获位置" name="securityLocation" required>
  66. <uni-data-picker v-if="!isDetailMode" :readonly="isDetailMode" :localdata="position_options"
  67. popup-title="请选择查获位置" v-model="formData.securityLocation" @change="onLocationChange" />
  68. <uni-easyinput v-else :disabled="true" placeholder="请选择查获班组" :value="formData.securityLocationText" />
  69. </uni-forms-item>
  70. <uni-forms-item label="查获班组" name="reportTeam" required>
  71. <uni-data-picker v-if="!isDetailMode" :readonly="isDetailMode" :localdata="teams" popup-title="请选择查获班组"
  72. v-model="formData.reportTeam" @change="onReportTeamChange" />
  73. <uni-easyinput v-else :disabled="true" placeholder="请选择查获班组" :value="formData.attendanceTeamName" />
  74. </uni-forms-item>
  75. </uni-collapse-item>
  76. </uni-collapse>
  77. <!-- </view> -->
  78. <!-- 违禁品信息分组 -->
  79. <view class="card">
  80. <uni-collapse class="collapse" :accordion="false" :value="['group2']">
  81. <uni-collapse-item class="collapse-item" title="违禁品信息" name="group2" :show-animation="true">
  82. <uni-forms-item label="常用违禁品" v-if="type == 'add'">
  83. <view class="gridWrap">
  84. <uni-tag v-for="item of commonlyList.forbidden" :key="item.categoryId" @click="selectCategory(item)"
  85. :text="item.categoryName" type="primary"
  86. :inverted="formData.forbiddenCategory !== item.categoryId" />
  87. </view>
  88. </uni-forms-item>
  89. <uni-forms-item label="搜索违禁品" v-if="type == 'add'">
  90. <SearchView title="搜索违禁品" :load="searchLoadData" placeholder="请选择/输入违禁品名称"
  91. :map="{ text: 'name', value: 'id' }" @change="searchSelectChange" />
  92. </uni-forms-item>
  93. <uni-forms-item label="违禁品类别/类型" name="forbiddenType" required>
  94. <uni-data-picker v-if="!isDetailMode" :readonly="isDetailMode" :localdata="item_category_options"
  95. :map="dataTreeOptionMap" popup-title="请选择违禁品类别" v-model="formData.forbiddenType"
  96. @change="onCategoryChange" />
  97. <uni-easyinput v-else :disabled="true" placeholder="请选择违禁品类别/类型"
  98. :value="`${formData.forbiddenCategoryText} / ${formData.forbiddenTypeText}`" />
  99. </uni-forms-item>
  100. <uni-forms-item label="违禁品名称" name="forbiddenName">
  101. <uni-easyinput :disabled="isDetailMode" placeholder="请输入违禁品名称" v-model="formData.forbiddenName" />
  102. </uni-forms-item>
  103. <uni-forms-item label="数量" name="quantity" required>
  104. <view class="number-input">
  105. <uni-easyinput :disabled="isDetailMode" v-model="formData.quantity" type="number" placeholder="1"
  106. class="input-number" />
  107. <!-- <uni-data-picker :localdata="item_unit_options" :map="dataOptionMap" popup-title="请选择单位"
  108. v-model="formData.unit" @change="onUnitChange" name="unit" required /> -->
  109. </view>
  110. </uni-forms-item>
  111. </uni-collapse-item>
  112. </uni-collapse>
  113. </view>
  114. <!-- 查获部位分组 -->
  115. <view class="card">
  116. <uni-collapse class="collapse" :accordion="false" :value="['group3']">
  117. <uni-collapse-item class="collapse-item" title="查获部位" name="group3" :show-animation="true">
  118. <uni-forms-item label="常用查获部位" v-if="type == 'add'">
  119. <view class="gridWrap">
  120. <uni-tag v-for="item of commonlyList.part" :key="item.categoryId" @click="selectPart(item)"
  121. :text="item.categoryName" type="primary" :inverted="formData.partCategory !== item.categoryId" />
  122. </view>
  123. </uni-forms-item>
  124. <uni-forms-item label="部位类别/类型" name="partType" required>
  125. <uni-data-picker v-if="!isDetailMode" :readonly="isDetailMode" :localdata="check_point_options"
  126. :map="dataTreeOptionMap" popup-title="请选择部位类别" :value="formData.partType"
  127. @change="onPartCategoryChange" />
  128. <uni-easyinput v-else :disabled="true" placeholder="请选择部位类别"
  129. :value="`${formData.partCategoryText} / ${formData.partTypeText}`" />
  130. </uni-forms-item>
  131. <uni-forms-item label="具体位置" name="location">
  132. <uni-easyinput :disabled="isDetailMode" placeholder="请输入具体位置" v-model="formData.location" />
  133. </uni-forms-item>
  134. <uni-forms-item label="处理方式" name="handlingMethod" required>
  135. <uni-data-picker v-if="!isDetailMode" :readonly="isDetailMode" popup-title="请选择处理方式"
  136. :map="dataOptionMap" :localdata="item_handling_method_options" v-model="formData.handlingMethod"
  137. @change="onMethodChange" />
  138. <uni-easyinput v-else :disabled="true" placeholder="请选择处理方式" v-model="formData.handlingMethodDesc" />
  139. </uni-forms-item>
  140. <uni-forms-item label="是否隐匿夹带" name="isActiveConcealment" required>
  141. <radio-group @change="bindConcealChange" class="radio-group"
  142. :class="{ 'disabled-group': isDetailMode }">
  143. <label class="radio-item" v-for="(item, index) in concealOptions" :key="index">
  144. <radio :value="item.value" :checked="formData.isActiveConcealment === item.value" color="#409EFF" />
  145. <text>{{ item.name }}</text>
  146. </label>
  147. </radio-group>
  148. </uni-forms-item>
  149. </uni-collapse-item>
  150. </uni-collapse>
  151. </view>
  152. <!-- 违禁品照片分组 -->
  153. <view class="card" v-if="!isDetailMode || isDetailMode && formData.images.length > 0">
  154. <uni-collapse class="collapse" :accordion="false" :value="['group4']">
  155. <uni-collapse-item class="collapse-item" title="违禁品照片 (可选)" name="group4" :show-animation="true">
  156. <view style="padding: 0 15px 15px 15px;margin-bottom: 150rpx;">
  157. <uni-file-picker :disabled="isDetailMode" v-model="formData.images" limit="8" title="最多上传8张"
  158. :image-styles="imageStyles" fileMediatype="image" mode="grid" @select="onSelect" />
  159. </view>
  160. </uni-collapse-item>
  161. </uni-collapse>
  162. </view>
  163. <!-- 5. 审批历史分组 -->
  164. <view class="card" v-if="type !== 'add'">
  165. <uni-collapse class="collapse" :accordion="false" :value="['group5']">
  166. <h-collapse-item title="审批历史" name="group5" :show-animation="true"
  167. :iconUrl="'../../static/images/icon/lishi.png'">
  168. <approve-history :history-list="approvalHistory" />
  169. </h-collapse-item>
  170. </uni-collapse>
  171. </view>
  172. <!-- 旅客信息分组 -->
  173. <!-- <view :is-shadow="true" :shadow="shadow">
  174. <uni-collapse :accordion="false" :value="['group5']">
  175. <uni-collapse-item title="旅客信息" name="group5" :show-animation="true">
  176. <template v-slot:title>
  177. <view class="collapse-title">
  178. <text>旅客信息</text>
  179. <text class="collapse-summary" v-if="formData.passengerName">{{ formData.passengerName }} ·
  180. {{ formData.flightNumber || '无航班号' }}</text>
  181. </view>
  182. </template>
  183. <uni-forms-item label="姓名" name="passengerName">
  184. <uni-easyinput :disabled="isDetailMode" v-model="formData.passengerName" placeholder="请输入旅客姓名" />
  185. </uni-forms-item>
  186. <uni-forms-item label="证件号" name="passengerId">
  187. <uni-easyinput :disabled="isDetailMode" v-model="formData.passengerId" placeholder="请输入证件号 (可选)" />
  188. </uni-forms-item>
  189. <uni-forms-item label="航班号" name="flightNumber">
  190. <uni-easyinput :disabled="isDetailMode" v-model="formData.flightNumber" placeholder="例如:CA1234 (可选)" />
  191. </uni-forms-item>
  192. </uni-collapse-item>
  193. </uni-collapse>
  194. </view> -->
  195. <!-- 提交按钮 -->
  196. <view class="button-group" v-if="type === 'approve' || type === 'add'">
  197. <view v-if="!isDetailMode" class="custom-btn-normal" @click="submitForm">提交上报</view>
  198. <template v-else>
  199. <view v-if="nodeCode != 'START'" class="custom-btn-white" @click="handleApproveReject"
  200. style="margin-right: 10px;">审批驳回</view>
  201. <view class="custom-btn-normal" @click="handleApprovePass">{{
  202. nodeCode == 'START' ? '提交' : '审批通过' }}</view>
  203. </template>
  204. </view>
  205. <!-- </scroll-view> -->
  206. </uni-forms>
  207. </view>
  208. </home-container>
  209. </template>
  210. <script>
  211. import HomeContainer from "@/components/HomeContainer.vue";
  212. import SearchView from "@/pages/attendance/components/SearchView.vue"
  213. import { treeSelectByType } from "@/api/system/common"
  214. import useDictMixin from '@/utils/dict'
  215. import { addSeizureRecord, approvalStart, getInfo } from '@/api/seizure/seizureRecord.js'
  216. import { getLocationsbyTime, categoryInfo, categoryList } from '@/api/seizureRecord/seizureRecord.js'
  217. import config from '@/config'
  218. import { getToken } from '@/utils/auth'
  219. import { approvePass, approveReject, getApprovelHistory } from '@/api/approve/approve.js'
  220. import { getDeptList } from "@/api/system/dept/dept.js"
  221. import { formatTime } from '@/utils/formatUtils'
  222. import { getUserInfoById, getPostListsByUserId } from '@/api/system/user.js'
  223. import { getUserList } from '@/api/attendance/attendance'
  224. export default {
  225. components: { HomeContainer, SearchView },
  226. mixins: [useDictMixin],
  227. computed: {
  228. currentUser() {
  229. return this.$store.state.user;
  230. },
  231. userInfo() {
  232. return (this.$store.state.user && this.$store.state.user.userInfo) ? this.$store.state.user.userInfo : {}
  233. },
  234. // 判断是否为kezhang角色
  235. isKezhang() {
  236. return this.$store?.state?.user?.roles?.includes('kezhang')
  237. },
  238. // 将item_check_method_options转换为字符串数组供uni-combox使用
  239. checkMethodCandidates() {
  240. // console.log(this.item_check_method_options.map(item => item.postName || item.label || item.text || item.value),"this.item_check_method_options.map(item => item.postName || item.label || item.text || item.value)")
  241. return this.item_check_method_options.map(item => item.postName || item.label || item.text || item.value);
  242. },
  243. // // 判断是新增模式还是详情模式
  244. isDetailMode() {
  245. return !!this.businessId; // 如果有id则为详情模式,否则为新增模式
  246. }
  247. },
  248. data() {
  249. return {
  250. // 路由参数id,用于判断详情模式
  251. businessId: null,
  252. // 表单数据
  253. formData: {
  254. // 安检员信息
  255. inspectUserName: this.isKezhang ? '' : this.$store.state.user.name,
  256. inspectUserId: this.isKezhang ? '' : this.$store.state.user.id,
  257. seizureTime: this.formatDateTime(new Date()),
  258. securityLocation: '',
  259. securityLocationText: '',
  260. checkMethod: '', // 检查岗位
  261. checkMethodText: '',
  262. teamId: 1,
  263. team: '',
  264. teamName: '',
  265. reportTeam: '',
  266. reportTeamText: '',
  267. // 查获位置信息
  268. channelCode: '',
  269. channelName: '',
  270. // 违禁品信息
  271. forbiddenCategory: '',
  272. forbiddenCategoryText: '',
  273. forbiddenType: '',
  274. forbiddenTypeText: '',
  275. forbiddenName: '',
  276. quantity: '1',
  277. unit: '',
  278. unitText: '',
  279. // 查获部位
  280. partCategory: '',
  281. partCategoryText: '',
  282. partType: '',
  283. partTypeText: '',
  284. location: '',
  285. locationText: '',
  286. customLocation: '',
  287. handlingMethod: 'ABANDON',
  288. handlingMethodDesc: '自弃',
  289. isActiveConcealment: '0',
  290. // 旅客信息
  291. passengerName: '',
  292. passengerId: '',
  293. flightNumber: '',
  294. // 照片
  295. images: [],
  296. //暂时不要
  297. attendanceId: '',
  298. attendanceTeamId: '',
  299. attendanceTeamName: '无',
  300. attendanceDepartmentId: '',
  301. attendanceDepartmentName: '无',
  302. attendanceStationId: '',
  303. attendanceStationName: '无',
  304. regionalCode: '',
  305. regionalName: '无',
  306. terminlCode: '',
  307. terminlName: '无',
  308. inspectTeamId: '',
  309. inspectTeamName: '无',
  310. inspectDepartmentId: '',
  311. inspectDepartmentName: '无',
  312. checkMethodDesc: '无',
  313. passengerCard: '',
  314. flightNumber: '',
  315. },
  316. // 验证规则
  317. rules: {
  318. seizureTime: {
  319. rules: [{ required: true, errorMessage: '请选择查获时间' }]
  320. },
  321. checkMethodText: {
  322. rules: [{ required: true, errorMessage: '请选择安检位置' }]
  323. },
  324. reportTeam: {
  325. rules: [{ required: true, errorMessage: '请选择上报班组' }]
  326. },
  327. forbiddenCategory: {
  328. rules: [{ required: true, errorMessage: '请选择违禁品类别' }]
  329. },
  330. forbiddenType: {
  331. rules: [{ required: true, errorMessage: '请选择违禁品类型' }]
  332. },
  333. // forbiddenName: {
  334. // rules: [{ required: true, errorMessage: '请输入违禁品名称' }]
  335. // },
  336. quantity: {
  337. rules: [
  338. { required: true, errorMessage: '请输入数量' },
  339. { format: 'number', errorMessage: '数量必须为数字' }
  340. ]
  341. },
  342. partCategory: {
  343. rules: [{ required: true, errorMessage: '请选择部位类别' }]
  344. },
  345. unit: {
  346. rules: [{ required: true, errorMessage: '请选择违禁品数量单位' }]
  347. },
  348. partType: {
  349. rules: [{ required: true, errorMessage: '请选择部位类型' }]
  350. },
  351. // location: {
  352. // rules: [{ required: true, errorMessage: '请选择或输入具体位置' }]
  353. // },
  354. handlingMethod: {
  355. rules: [{ required: true, errorMessage: '请选择处理方式' }]
  356. },
  357. isActiveConcealment: {
  358. rules: [{ required: true, errorMessage: '请选择是否有意隐匿' }]
  359. },
  360. // passengerName: {
  361. // rules: [{ required: true, errorMessage: '请输入旅客姓名' }]
  362. // }
  363. },
  364. // 数据选项
  365. item_check_method_options: [], // 检查岗位
  366. position_options: [], // 位置通道
  367. teams: [],
  368. item_category_options: [], // 物品分类
  369. departmentUserOptions: [], // 部门人员选项(kezhang角色使用)
  370. typeData: [],
  371. item_unit_options: [],
  372. check_point_options: [],
  373. partTypeData: [],
  374. locations: [
  375. ],
  376. item_handling_method_options: [], // 处理方式
  377. concealOptions: [
  378. { name: '是', value: '1' },
  379. { name: '否', value: '0' }
  380. ],
  381. // 其他数据
  382. startDate: '2020-01-01',
  383. endDate: '2030-12-31',
  384. imageStyles: {
  385. width: 80,
  386. height: 80,
  387. border: {
  388. color: '#eee',
  389. width: '1px',
  390. style: 'solid'
  391. }
  392. },
  393. dataOptionMap1: { text: 'label', value: 'value' }, // 级联字段映射关系
  394. dataOptionMap: { text: 'label', value: 'value' }, // 级联字段映射关系
  395. dataTreeOptionMap: { text: 'label', value: 'id' }, // 级联字段映射关系树结构
  396. commonlyList: {
  397. forbidden: [],
  398. part: []
  399. },
  400. searchforbiddenName: '',
  401. forbiddenList: [],
  402. instanceId: '',
  403. nodeCode: '',
  404. id: '',
  405. type: '',
  406. approvalHistory: [],
  407. firstCollapsed: ["group1"],
  408. }
  409. },
  410. async onLoad(options) {
  411. // if (options && options?.params) {
  412. let params = {};
  413. if (options?.params) {
  414. params = JSON.parse(decodeURIComponent(options.params));
  415. }
  416. this.businessId = params?.businessId;
  417. this.instanceId = params?.instanceId;
  418. this.id = params?.id;
  419. this.nodeCode = params?.nodeCode;
  420. this.type = params?.type || 'add';
  421. // }
  422. await this.initPageData();
  423. // 如果是kezhang角色,加载部门人员
  424. if (this.isKezhang) {
  425. await this.loadDepartmentUsers();
  426. }
  427. if (this.type == 'add' && !this.isKezhang) {
  428. this.invokerGetLocationsbyTime()
  429. }
  430. this.invokerCategoryInfo()
  431. // 如果有路由ID,获取详情信息
  432. if (this.businessId) {
  433. this.getDetailInfo();
  434. }
  435. },
  436. mounted() {
  437. // this.$nextTick(() => {
  438. // this.isDetailMode = !!this.businessId
  439. // })
  440. },
  441. methods: {
  442. // 处理驳回确认
  443. // handleRejectConfirm(rejectReason) {
  444. // this.formData.comment = rejectReason
  445. // this.handleApproveReject()
  446. // },
  447. changeCollapse(e) {
  448. this.firstCollapsed = e
  449. },
  450. //审批通过
  451. async handleApprovePass() {
  452. try {
  453. let payload = this.formatData()
  454. uni.showLoading({ title: '审批中...', mask: true });
  455. const res = await approvePass(this.id, { formData: payload, comment: '审批通过' });
  456. if (res.code === 200) {
  457. uni.hideLoading();
  458. uni.showToast({ title: '审批通过', icon: 'success' });
  459. } else {
  460. uni.hideLoading();
  461. uni.showToast({ title: '审批失败', icon: 'none' });
  462. }
  463. setTimeout(() => {
  464. uni.navigateBack()
  465. }, 500)
  466. } catch (err) {
  467. uni.hideLoading();
  468. uni.showToast({ title: '审批失败', icon: 'none' });
  469. console.error('审批失败:', err);
  470. }
  471. },
  472. //审批驳回
  473. async handleApproveReject() {
  474. try {
  475. let payload = this.formatData()
  476. uni.showLoading({ title: '审批中...', mask: true });
  477. const res = await approveReject(this.id, { formData: payload, comment: '审批驳回' });
  478. if (res.code === 200) {
  479. uni.hideLoading();
  480. uni.showToast({ title: '审批驳回', icon: 'success' });
  481. } else {
  482. uni.hideLoading();
  483. uni.showToast({ title: '审批失败', icon: 'none' });
  484. }
  485. setTimeout(() => {
  486. uni.navigateBack()
  487. }, 500)
  488. } catch (err) {
  489. uni.hideLoading();
  490. uni.showToast({ title: '审批失败', icon: 'none' });
  491. console.error('审批失败:', err);
  492. }
  493. },
  494. // 获取详情信息
  495. async getDetailInfo() {
  496. try {
  497. uni.showLoading({ title: '加载详情中...', mask: true });
  498. const res = await getInfo(this.businessId);
  499. let inspectUserInfo = await getUserInfoById(res.data.inspectUserId)
  500. res.data.inspectUserRoleName = inspectUserInfo?.data?.roles[0]?.roleName || ''
  501. if (res.code === 200 && res.data) {
  502. this.fillFormData(res.data);
  503. // 获取审批历史
  504. const historyRes = await getApprovelHistory(this.instanceId);
  505. if (historyRes.code === 200 && historyRes.rows) {
  506. this.approvalHistory = historyRes.rows;
  507. }
  508. uni.hideLoading();
  509. } else {
  510. uni.hideLoading();
  511. uni.showToast({ title: '获取详情失败', icon: 'none' });
  512. }
  513. } catch (err) {
  514. uni.hideLoading();
  515. uni.showToast({ title: '获取详情失败', icon: 'none' });
  516. console.error('获取详情失败:', err);
  517. }
  518. },
  519. // 填充表单数据
  520. fillFormData(detailData) {
  521. if (!detailData) return;
  522. let files = detailData?.itemSeizureItemsList[0].baseAttachmentList && detailData?.itemSeizureItemsList[0].baseAttachmentList.map(file => ({
  523. ...file,
  524. url: file.attachmentUrl || file.url,
  525. }))
  526. // 填充基础信息
  527. this.formData = {
  528. ...this.formData,
  529. ...detailData,
  530. // 处理下拉选择器数据格式 - 组成[{text: '', value: ''}]格式以支持回显
  531. // 处理图片数据
  532. // images: detailData.images ? detailData.images.map(img => ({
  533. // ...img,
  534. // url: img.attachmentUrl || img.url,
  535. // name: img.attachmentName || img.name,
  536. // extname: img.extname
  537. // })) : [],
  538. forbiddenCategory: detailData?.itemSeizureItemsList[0].categoryCodeOne,
  539. forbiddenCategoryText: detailData?.itemSeizureItemsList[0].categoryNameOne,
  540. forbiddenType: detailData?.itemSeizureItemsList[0].categoryCodeTwo,
  541. forbiddenTypeText: detailData?.itemSeizureItemsList[0].categoryNameTwo,
  542. partCategory: detailData?.itemSeizureItemsList[0].checkPositionCodeOne,
  543. partCategoryText: detailData?.itemSeizureItemsList[0].checkPositionNameOne,
  544. partType: detailData?.itemSeizureItemsList[0].checkPositionCodeTwo,
  545. partTypeText: detailData?.itemSeizureItemsList[0].checkPositionNameTwo,
  546. forbiddenName: detailData?.itemSeizureItemsList[0].itemName,
  547. quantity: detailData?.itemSeizureItemsList[0].quantity,
  548. images: files || [],
  549. location: detailData?.itemSeizureItemsList[0].location,
  550. isActiveConcealment: String(detailData?.itemSeizureItemsList[0].isActiveConcealment),
  551. handlingMethodDesc: detailData?.itemSeizureItemsList[0].handlingMethodDesc,
  552. handlingMethod: detailData?.itemSeizureItemsList[0].handlingMethod,
  553. // reportTeamText:`${detailData?.inspectStationName}/${detailData?.inspectBrigadeName}/${detailData?.inspectDepartmentName}/${detailData?.inspectTeamName}`,
  554. securityLocationText: `${detailData?.terminlName}/${detailData?.regionalName}/${detailData?.channelName}`
  555. };
  556. this.$nextTick(() => {
  557. // 处理所有下拉选择器字段的数组格式转换
  558. const dropdownFields = [
  559. { field: 'checkMethod', textField: 'checkMethodText', descField: 'checkMethodDesc' },
  560. { field: 'reportTeam', textField: 'reportTeamText' },
  561. { field: 'unit', textField: 'unitText' },
  562. ]
  563. dropdownFields.forEach(({ field, textField, descField }) => {
  564. if (detailData[field]) {
  565. // 对于checkMethod字段,保持字符串格式(uni-combox需要)
  566. if (field === 'checkMethod') {
  567. this.formData[field] = detailData[field];
  568. this.formData[textField] = detailData[descField] || detailData[textField] || detailData[field];
  569. } else {
  570. // 其他下拉字段保持数组格式
  571. this.formData[field] = [{
  572. value: detailData[field],
  573. text: detailData[descField] || detailData[textField] || detailData[field]
  574. }]
  575. this.formData[textField] = detailData[descField] || detailData[textField] || detailData[field]
  576. }
  577. }
  578. })
  579. })
  580. console.log('表单数据已回填:', this.formData);
  581. },
  582. searchLoadData(val) {
  583. return categoryList({ name: val, level: 2 }).then(res => {
  584. return res.data
  585. })
  586. },
  587. invokerGetLocationsbyTime() {
  588. return getLocationsbyTime({
  589. searchtime: formatTime(new Date())
  590. }).then(res => {
  591. const curUserInfo = (res.data || []).find(item => {
  592. return item.userId === this.currentUser.id && (!item.checkOutTime || item.checkOutTime === '2000-01-01 00:00:00')
  593. }) || {}
  594. this.formData.securityLocation = curUserInfo.channelCode || curUserInfo.regionalCode
  595. this.formData.securityLocationText = curUserInfo.channelName || curUserInfo.regionalName
  596. this.formData.team = curUserInfo.attendanceTeamId
  597. this.formData.reportTeam = curUserInfo.attendanceTeamId
  598. if (curUserInfo.attendanceStationName && curUserInfo.attendanceDepartmentName) {
  599. this.formData.teamName = `${curUserInfo.attendanceStationName} / ${curUserInfo.attendanceDepartmentName} / ${curUserInfo.attendanceTeamName}`
  600. this.formData.reportTeamText = `${curUserInfo.attendanceStationName} / ${curUserInfo.attendanceDepartmentName} / ${curUserInfo.attendanceTeamName}`
  601. }
  602. console.log(this.formData);
  603. const locationResult = this.getParentLocation(this.formData.securityLocation)
  604. console.log(locationResult);
  605. // 安全地处理可能为null的结果
  606. if (locationResult) {
  607. this.formData.terminlName = locationResult.grandParent?.text || '';
  608. this.formData.terminlCode = locationResult.grandParent?.value || '';
  609. this.formData.regionalName = locationResult.parent?.text || '';
  610. this.formData.regionalCode = locationResult.parent?.value || '';
  611. this.formData.channelName = locationResult.current?.text || '';
  612. this.formData.channelCode = locationResult.current?.value || '';
  613. } else {
  614. // 如果找不到位置信息,清空相关字段
  615. this.formData.terminlName = '';
  616. this.formData.terminlCode = '';
  617. this.formData.regionalName = '';
  618. this.formData.regionalCode = '';
  619. this.formData.channelName = '';
  620. this.formData.channelCode = '';
  621. }
  622. })
  623. },
  624. //根据securityLocation,从this.position_options中向上找到前两级别的父级对象和当前级别对象
  625. getParentLocation(securityLocation) {
  626. if (!securityLocation || !this.position_options || !this.position_options.length) {
  627. return null;
  628. }
  629. // 递归查找节点及其父级
  630. const findNodeAndParents = (nodes, targetValue, parents = []) => {
  631. for (const node of nodes) {
  632. if (node.value === targetValue) {
  633. return { node, parents };
  634. }
  635. if (node.children && node.children.length) {
  636. const result = findNodeAndParents(node.children, targetValue, [...parents, node]);
  637. if (result) {
  638. return result;
  639. }
  640. }
  641. }
  642. return null;
  643. };
  644. const result = findNodeAndParents(this.position_options, securityLocation);
  645. if (!result) {
  646. return null;
  647. }
  648. const { node, parents } = result;
  649. // 返回当前级别对象和前两级的父级对象(如果存在)
  650. if (parents.length >= 2) {
  651. return {
  652. current: node, // 当前级别对象
  653. grandParent: parents[parents.length - 2], // 祖父级
  654. parent: parents[parents.length - 1] // 父级
  655. };
  656. } else if (parents.length === 1) {
  657. return {
  658. current: node, // 当前级别对象
  659. grandParent: null, // 没有祖父级
  660. parent: parents[0] // 只有父级
  661. };
  662. } else {
  663. return {
  664. current: node, // 当前级别对象
  665. grandParent: null, // 没有祖父级
  666. parent: null // 没有父级
  667. };
  668. }
  669. },
  670. invokerCategoryInfo() {
  671. categoryInfo(1).then(res => {
  672. this.commonlyList.forbidden = res.data || []
  673. })
  674. categoryInfo(2).then(res => {
  675. this.commonlyList.part = res.data || []
  676. })
  677. },
  678. async initPageData() {
  679. try {
  680. uni.showLoading({ title: '加载中...', mask: true });
  681. // 查询基础数据
  682. // 位置 航站楼 区域 通道 locationData 树结构 POSITION
  683. // 物品类型 categoryData 树结构 ITEM_CATEGORY
  684. // 身体部位类型 partCategoryData 树结构 CHECK_POINT
  685. const deptTree = await getDeptList();
  686. this.teams = this.buildTeamOptions(deptTree.data || []);
  687. const [positionRes, itemCategoryRes, checkPointRes] = await Promise.all([
  688. treeSelectByType("POSITION", 3),
  689. treeSelectByType("ITEM_CATEGORY", 3),
  690. treeSelectByType("CHECK_POINT", 3)
  691. ]);
  692. // 初始化岗位选项数据
  693. await this.initPositionAndOptions();
  694. const convertTree = (list = []) =>
  695. list.map(node => ({
  696. text: node.label,
  697. value: node.code,
  698. children: node.children ? convertTree(node.children) : null
  699. }))
  700. this.position_options = convertTree(positionRes.data || []);
  701. this.item_category_options = itemCategoryRes.data || [];
  702. this.forbiddenList = itemCategoryRes.data || [];
  703. this.check_point_options = checkPointRes.data || [];
  704. // 处理方式 item_handling_method_options 字典 item_handling_method
  705. // 单位 units 字典 item_unit
  706. const dict = await this.useDict(
  707. 'item_handling_method',
  708. 'item_unit'
  709. )
  710. this.item_handling_method_options = dict.item_handling_method || [];
  711. // console.log(this.item_handling_method_options,"this.item_handling_method_options")
  712. this.item_unit_options = dict.item_unit || [];
  713. uni.hideLoading();
  714. } catch (err) {
  715. uni.hideLoading();
  716. uni.showToast({ title: '加载失败', icon: 'none' });
  717. console.error('初始化数据失败:', err);
  718. }
  719. },
  720. buildTeamOptions(tree = []) {
  721. const result = [];
  722. function dfs(node, path = []) {
  723. const currentPath = [...path, node.label];
  724. // 如果是 TEAMS 叶子节点
  725. if (node.deptType === 'TEAMS') {
  726. result.push({
  727. text: currentPath.join(' / '),
  728. value: node.id
  729. });
  730. }
  731. // 继续递归子节点
  732. if (node.children && Array.isArray(node.children)) {
  733. node.children.forEach(child => dfs(child, currentPath));
  734. }
  735. }
  736. tree.forEach(root => dfs(root));
  737. return result;
  738. },
  739. // 初始化岗位和选项数据
  740. async initPositionAndOptions() {
  741. try {
  742. // 使用当前选择的inspectUserId查询岗位列表
  743. const userId = this.formData.inspectUserId || this.currentUser.id;
  744. const postListsRes = await getPostListsByUserId(userId);
  745. // 更新岗位选项
  746. this.item_check_method_options = postListsRes.data || [];
  747. console.log("岗位和选项数据已更新,用户ID:", userId);
  748. } catch (error) {
  749. console.error("初始化岗位和选项数据失败:", error);
  750. }
  751. },
  752. // 加载部门人员(kezhang角色使用)
  753. async loadDepartmentUsers() {
  754. if (!this.isKezhang) return;
  755. try {
  756. const currentUserInfo = this.userInfo || {};
  757. const currentUserDeptId = currentUserInfo.departmentId || currentUserInfo.deptId;
  758. if (!currentUserDeptId) {
  759. console.warn('无法获取当前用户的部门ID');
  760. return;
  761. }
  762. const response = await getUserList({
  763. deptId: currentUserDeptId,
  764. status: '0',
  765. pageSize: 1000
  766. });
  767. if (response && response.code === 200) {
  768. this.departmentUserOptions = (response.rows || []).map(user => ({
  769. ...user,
  770. value: user.userId,
  771. text: user.nickName || user.userName,
  772. }));
  773. }
  774. } catch (error) {
  775. console.error('获取部门人员失败:', error);
  776. uni.showToast({
  777. title: '获取部门人员失败',
  778. icon: 'none',
  779. duration: 2000
  780. });
  781. }
  782. },
  783. // 选择文件后手动上传
  784. async onSelect(event) {
  785. // 由于限制只能上传1个文件,直接取第一个文件进行上传
  786. const files = await this.uploadFile(event);
  787. console.log("上传成功====", files);
  788. let fileArr = files.map(file => ({
  789. url: file.url,
  790. name: file.newFileName,
  791. attachmentName: file.newFileName,
  792. attachmentUrl: file.url,
  793. extname: file.newFileName.split('.').pop()
  794. }))
  795. // 直接替换而不是追加,因为限制只能上传1张
  796. this.formData.images = [
  797. ...this.formData.images,
  798. ...fileArr
  799. ];
  800. },
  801. // 封装上传
  802. uploadFile(event) {
  803. return Promise.all(event.tempFilePaths.map(filePath => {
  804. return new Promise((resolve, reject) => {
  805. uni.uploadFile({
  806. url: `${config.baseUrl}/common/upload`,
  807. filePath: filePath,
  808. name: 'file',
  809. header: { Authorization: 'Bearer ' + getToken() },
  810. formData: {
  811. // 可添加其他参数
  812. },
  813. success: (res) => resolve(JSON.parse(res.data)),
  814. fail: reject
  815. });
  816. });
  817. }));
  818. },
  819. formatDateTime(date) {
  820. const y = date.getFullYear();
  821. const m = String(date.getMonth() + 1).padStart(2, '0');
  822. const d = String(date.getDate()).padStart(2, '0');
  823. const h = String(date.getHours()).padStart(2, '0');
  824. const mm = String(date.getMinutes()).padStart(2, '0');
  825. const s = String(date.getSeconds()).padStart(2, '0');
  826. return `${y}-${m}-${d} ${h}:${mm}:${s}`;
  827. },
  828. // 安检位置变化
  829. onLocationChange(e) {
  830. const arr = e.detail.value || [];
  831. this.formData.securityLocation = arr[arr.length - 1]?.value || '';
  832. this.formData.securityLocationText = arr.map(item => item.text).join('/');
  833. const locationResult = this.getParentLocation(this.formData.securityLocation)
  834. console.log(locationResult);
  835. // 安全地处理可能为null的结果
  836. if (locationResult) {
  837. this.formData.terminlName = locationResult.grandParent?.text || '';
  838. this.formData.terminlCode = locationResult.grandParent?.value || '';
  839. this.formData.regionalName = locationResult.parent?.text || '';
  840. this.formData.regionalCode = locationResult.parent?.value || '';
  841. this.formData.channelName = locationResult.current?.text || '';
  842. this.formData.channelCode = locationResult.current?.value || '';
  843. } else {
  844. // 如果找不到位置信息,清空相关字段
  845. this.formData.terminlName = '';
  846. this.formData.terminlCode = '';
  847. this.formData.regionalName = '';
  848. this.formData.regionalCode = '';
  849. this.formData.channelName = '';
  850. this.formData.channelCode = '';
  851. }
  852. },
  853. // 通用取值:只拿最后一级
  854. lastValue(e) {
  855. const val = e.detail.value;
  856. if (Array.isArray(val)) return val[val.length - 1] || '';
  857. if (val && typeof val === 'object') return val.value || '';
  858. return String(val || '');
  859. },
  860. // 安检岗位 - combox版本
  861. onCheckMethodComboxChange(text) {
  862. // 根据选中的文本找到对应的原始对象
  863. const selectedItem = this.item_check_method_options.find(item =>
  864. item.postName === text || item.label === text || item.text === text || item.value === text
  865. );
  866. if (!selectedItem) {
  867. this.formData.checkMethod = '';
  868. this.formData.checkMethodText = '';
  869. return
  870. }
  871. this.formData.checkMethod = selectedItem?.postCode || text;
  872. this.formData.checkMethodText = selectedItem?.postName || selectedItem?.label || selectedItem?.text || text;
  873. },
  874. // 安检岗位 - 原data-picker版本(已弃用)
  875. onItemCheckMethodChange(e) {
  876. this.formData.checkMethod = e.detail.value[0]?.value || '';
  877. this.formData.checkMethodText = e.detail.value[0]?.text || e.detail.value[0]?.text || '';
  878. },
  879. // 查获班组变化
  880. onTeamChange(e) {
  881. this.formData.team = e.detail.value[0].value;
  882. this.formData.teamName = e.detail.value[1]?.text || e.detail.value[0]?.text || '';
  883. },
  884. // 上报班组变化
  885. onReportTeamChange(e) {
  886. console.log("e.detail.value", e.detail.value)
  887. this.formData.reportTeam = e.detail.value[0].value;
  888. this.formData.reportTeamText = e.detail.value[1]?.text || e.detail.value[0]?.text || '';
  889. },
  890. // 快捷选中违禁品
  891. selectCategory(item) {
  892. const createEventInfo = {
  893. detail: {
  894. value: [
  895. { value: item.parentId, text: item.parentName },
  896. { value: item.categoryId, text: item.categoryName },
  897. ]
  898. }
  899. }
  900. this.onCategoryChange(createEventInfo)
  901. },
  902. // 搜索违禁品 选中
  903. searchSelectChange(selectItem) {
  904. const curParent = this.item_category_options.find(item => item.id === selectItem.parentId)
  905. const createEventInfo = {
  906. detail: {
  907. value: [
  908. { value: selectItem.parentId, text: selectItem.parentName || curParent?.label },
  909. { value: selectItem.id, text: selectItem.name },
  910. ]
  911. }
  912. }
  913. this.onCategoryChange(createEventInfo)
  914. },
  915. // 违禁品类别变化
  916. onCategoryChange(e) {
  917. if (!e.detail.value || !e.detail.value.length) {
  918. this.formData.forbiddenCategory = ''
  919. this.formData.forbiddenCategoryText = ''
  920. this.formData.forbiddenType = ''
  921. this.formData.forbiddenTypeText = ''
  922. return
  923. }
  924. this.formData.forbiddenCategory = e.detail.value[0].value;
  925. this.formData.forbiddenCategoryText = e.detail.value[0].text;
  926. this.formData.forbiddenType = e.detail.value[1].value;
  927. this.formData.forbiddenTypeText = e.detail.value[1].text;
  928. },
  929. // 单位变化
  930. onUnitChange(e) {
  931. this.formData.unit = e.detail.value;
  932. this.formData.unitText =
  933. this.item_unit_options.find(item => item.value === e.detail.value)?.label || '件';
  934. },
  935. // 快捷选中违禁品
  936. selectPart(item) {
  937. const createEventInfo = {
  938. detail: {
  939. value: [
  940. { value: item.parentId, text: item.parentName },
  941. { value: item.categoryId, text: item.categoryName },
  942. ]
  943. }
  944. }
  945. this.onPartCategoryChange(createEventInfo)
  946. },
  947. // 部位类别变化
  948. onPartCategoryChange(e) {
  949. if (!e.detail.value || !e.detail.value.length) {
  950. this.formData.partCategory = ''
  951. this.formData.partCategoryText = ''
  952. this.formData.partType = ''
  953. this.formData.partTypeText = ''
  954. return
  955. }
  956. this.formData.partCategory = e.detail.value[0].value;
  957. this.formData.partCategoryText = e.detail.value[0].text;
  958. this.formData.partType = e.detail.value[1].value;
  959. this.formData.partTypeText = e.detail.value[1].text;
  960. },
  961. // 安检员选择变化(kezhang角色使用)
  962. async onInspectUserChange(e) {
  963. console.log("查获人员选择变化", e.detail.value)
  964. const arr = e.detail.value || [];
  965. this.formData.inspectUserId = arr[arr.length - 1]?.value || '';
  966. this.formData.inspectUserName = arr.map(item => item.text).join('/');
  967. this.formData.reportTeam = this.departmentUserOptions.find(item => item.userId === this.formData.inspectUserId)?.deptId;
  968. this.formData.reportTeamText = this.teams.find(item => item.value === this.formData.reportTeam)?.text;
  969. // 切换查获人员后,重新初始化岗位和选项数据
  970. if (this.formData.inspectUserId) {
  971. await this.initPositionAndOptions();
  972. }
  973. },
  974. // 部位类型变化
  975. onPartTypeChange(e) {
  976. this.formData.partType = e.detail.value[0].value;
  977. this.formData.partTypeText = e.detail.value[0].text;
  978. },
  979. // 具体位置选择
  980. onLocationSelectChange(e) {
  981. this.formData.location = e.detail.value;
  982. this.formData.locationText = this.locations.find(item => item.value === e.detail.value)?.text || '';
  983. this.formData.customLocation = this.formData.locationText;
  984. },
  985. // 处理方式变化
  986. onMethodChange(e) {
  987. this.formData.handlingMethod = e.detail.value[0].value;
  988. this.formData.handlingMethodDesc = e.detail.value[0].text;
  989. },
  990. // 是否有意隐匿选择
  991. bindConcealChange(e) {
  992. if (this.isDetailMode) {
  993. return; // 详情模式下不处理change事件
  994. }
  995. this.formData.isActiveConcealment = e.detail.value;
  996. },
  997. generateNumericID() {
  998. // 使用更安全的ID生成方式,避免重复
  999. const timestamp = Date.now();
  1000. const random = Math.floor(Math.random() * 1e9); // 9位随机数
  1001. return parseInt(`${timestamp}${random}`.slice(-15)); // 确保总长度不超过15位
  1002. },
  1003. formatData() {
  1004. // this.formData.regionalCode = this.formData.securityLocation
  1005. // this.formData.regionalName = this.formData.securityLocationText
  1006. this.formData.channelCode =
  1007. this.formData.channelCode || this.formData.securityLocation || '无'
  1008. this.formData.channelName =
  1009. this.formData.channelName || this.formData.securityLocationText || '无'
  1010. this.formData.inspectTeamId = this.formData.team
  1011. this.formData.inspectTeamName = this.formData.teamName
  1012. this.formData.attendanceTeamId = this.formData.reportTeam
  1013. this.formData.attendanceTeamName = this.formData.reportTeamText
  1014. this.formData.passengerCard = this.formData.passengerId
  1015. this.formData.passengerFlight = this.formData.flightNumber
  1016. this.formData.checkMethodDesc = this.formData.checkMethodText
  1017. // if (this.formData.isActiveConcealment === 'yes') {
  1018. // this.formData.isActiveConcealment = 1
  1019. // } else {
  1020. // this.formData.isActiveConcealment = 0
  1021. // }
  1022. const item = {
  1023. // 违禁品信息
  1024. forbiddenType: this.formData.forbiddenType,
  1025. forbiddenTypeText: this.formData.forbiddenTypeText,
  1026. itemName: this.formData.forbiddenName,
  1027. quantity: this.formData.quantity,
  1028. unit: this.formData.unit[0]?.value || '',
  1029. unitDesc: this.formData.unitText,
  1030. checkPositionCodeOne: this.formData.partCategory,
  1031. checkPositionNameOne: this.formData.partCategoryText,
  1032. checkPositionCodeTwo: this.formData.partType,
  1033. checkPositionNameTwo: this.formData.partTypeText,
  1034. checkPositionSpecific: this.formData.customLocation,
  1035. //附件
  1036. baseAttachmentList: this.formData.images,
  1037. //暂时不要
  1038. itemCode: '无',
  1039. isActiveConcealment: this.formData.isActiveConcealment,
  1040. categoryCodeOne: this.formData.forbiddenCategory,
  1041. categoryNameOne: this.formData.forbiddenCategoryText,
  1042. categoryCodeTwo: this.formData.forbiddenType,
  1043. categoryNameTwo: this.formData.forbiddenTypeText,
  1044. handlingMethod: this.formData.handlingMethod,
  1045. handlingMethodDesc: this.formData.handlingMethodDesc,
  1046. location: this.formData.location,
  1047. id: this.generateNumericID(),
  1048. }
  1049. const payload = {
  1050. ...this.formData,
  1051. itemSeizureItemsList: [item],
  1052. };
  1053. return payload
  1054. },
  1055. // 提交表单
  1056. submitForm() {
  1057. this.$refs.form.validate().then(res => {
  1058. uni.showLoading({ title: '提交中...', mask: true });
  1059. let payload = this.formatData()
  1060. let params = {
  1061. businessType: 'SEIZURE_REPORT',
  1062. title: '查获物品上报审批流程',
  1063. formData: payload,
  1064. submitterId: this.currentUser.id,
  1065. submitterName: this.currentUser.name,
  1066. submitterRole: 'SEIZURE_REPORT_DEFAULT',
  1067. }
  1068. addSeizureRecord(payload)
  1069. .then((res) => {
  1070. uni.showToast({ title: '提交成功', icon: 'success' });
  1071. //开始流程
  1072. console.log("res0", res)
  1073. approvalStart({ ...params, businessId: res.data }).then(res => {
  1074. setTimeout(() => uni.navigateBack(), 1500); // 提交成功后跳转
  1075. })
  1076. })
  1077. .catch((error) => {
  1078. uni.showToast({ title: '操作失败,请稍后重试!', icon: 'none' }); // 提交失败提示
  1079. console.error('提交失败:', error);
  1080. });
  1081. }).catch(err => {
  1082. console.log('表单验证失败:', err);
  1083. });
  1084. }
  1085. }
  1086. }
  1087. </script>
  1088. <style lang="scss" scoped>
  1089. .report-container {
  1090. // background-color: #f5f5f5;
  1091. min-height: 100vh;
  1092. padding-top: 35px;
  1093. .button-group {
  1094. display: flex;
  1095. justify-content: space-between;
  1096. padding: 15px;
  1097. }
  1098. .collapse-card {
  1099. border-radius: 12px;
  1100. margin: 15px 0;
  1101. box-shadow: rgba(0, 0, 0, 0.08) 0px 0px 3px 1px;
  1102. ::v-deep .uni-collapse-item__wrap {
  1103. overflow: visible !important;
  1104. border-radius: 12px;
  1105. }
  1106. }
  1107. .collapse-card-hidden {
  1108. border-radius: 12px;
  1109. margin: 15px 0;
  1110. box-shadow: rgba(0, 0, 0, 0.08) 0px 0px 3px 1px;
  1111. ::v-deep .uni-collapse-item__wrap {
  1112. overflow: hidden !important;
  1113. border-radius: 12px;
  1114. }
  1115. }
  1116. .card {
  1117. border-radius: 12px;
  1118. overflow: hidden;
  1119. margin: 15px 0;
  1120. box-shadow: rgba(0, 0, 0, 0.08) 0px 0px 3px 1px;
  1121. .gridWrap {
  1122. display: flex;
  1123. column-gap: 8px;
  1124. row-gap: 8px;
  1125. flex-wrap: wrap;
  1126. }
  1127. ::v-deep .collapse {
  1128. border-radius: 16px;
  1129. }
  1130. }
  1131. .userInfo {
  1132. display: flex;
  1133. flex-direction: column;
  1134. row-gap: 10px;
  1135. .userName {
  1136. font-size: 18px;
  1137. font-weight: 500;
  1138. }
  1139. .teamInfo {
  1140. display: flex;
  1141. column-gap: 10px;
  1142. font-size: 14px;
  1143. color: #666;
  1144. .team {
  1145. display: flex;
  1146. }
  1147. }
  1148. }
  1149. }
  1150. .form-scroll {
  1151. height: calc(100vh - 50px);
  1152. padding: 1px;
  1153. box-sizing: border-box;
  1154. }
  1155. /* 折叠面板标题 */
  1156. .collapse-title {
  1157. display: flex;
  1158. flex-direction: column;
  1159. padding: 12px 15px;
  1160. .collapse-summary {
  1161. font-size: 12px;
  1162. color: #999;
  1163. margin-top: 4px;
  1164. }
  1165. }
  1166. /* 表单项样式 */
  1167. ::v-deep .uni-forms-item {
  1168. margin-bottom: 0;
  1169. padding: 0 15px;
  1170. .uni-forms-item__label {
  1171. padding: 12px 0 8px;
  1172. font-size: 14px;
  1173. color: #666;
  1174. width: auto !important;
  1175. }
  1176. .uni-forms-item__content {
  1177. padding: 0 0 12px;
  1178. border-bottom: 1px solid #f0f0f0;
  1179. }
  1180. &:last-child .uni-forms-item__content {
  1181. border-bottom: none;
  1182. }
  1183. }
  1184. .picker-box {
  1185. display: flex;
  1186. align-items: center;
  1187. justify-content: space-between;
  1188. height: 44px;
  1189. .picker-value {
  1190. font-size: 15px;
  1191. color: #333;
  1192. &:empty::after {
  1193. content: attr(placeholder);
  1194. color: #999;
  1195. }
  1196. }
  1197. &.disabled {
  1198. opacity: 0.5;
  1199. }
  1200. }
  1201. .form-value {
  1202. font-size: 15px;
  1203. color: #333;
  1204. height: 44px;
  1205. line-height: 44px;
  1206. }
  1207. .number-input {
  1208. display: flex;
  1209. align-items: center;
  1210. height: 44px;
  1211. .input-number {
  1212. flex: 1;
  1213. }
  1214. .unit-picker {
  1215. width: 80px;
  1216. margin-left: 10px;
  1217. }
  1218. }
  1219. .location-input {
  1220. display: flex;
  1221. height: 44px;
  1222. .picker-box {
  1223. width: 120px;
  1224. }
  1225. .custom-location {
  1226. flex: 1;
  1227. margin-left: 0px;
  1228. }
  1229. }
  1230. // .radio-group {
  1231. // display: flex;
  1232. // padding: 8px 0;
  1233. // .radio-item {
  1234. // display: flex;
  1235. // align-items: center;
  1236. // margin-right: 30px;
  1237. // text {
  1238. // font-size: 15px;
  1239. // color: #333;
  1240. // margin-left: 5px;
  1241. // }
  1242. // }
  1243. // &.disabled-group {
  1244. // opacity: 0.5;
  1245. // pointer-events: none;
  1246. // }
  1247. // }
  1248. .submit-btn {
  1249. margin-top: 20px;
  1250. width: calc(100% - 30px);
  1251. margin-left: 15px;
  1252. }
  1253. /* 底部弹窗样式调整 */
  1254. ::v-deep .uni-popup__wrapper {
  1255. border-radius: 16px;
  1256. .uni-popup__wrapper-box {
  1257. max-height: 70vh;
  1258. overflow-y: auto;
  1259. }
  1260. .uni-data-pickerview {
  1261. padding-bottom: 20px;
  1262. }
  1263. }
  1264. </style>