BoilerPlanScheduleDialog.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412
  1. <template>
  2. <el-dialog
  3. :title="title"
  4. v-model="dialogVisible"
  5. :width="'1000px'"
  6. append-to-body
  7. destroy-on-close
  8. @closed="handleCancel"
  9. >
  10. <div class="flex flex-col">
  11. <div class="w-full">
  12. <el-form
  13. ref="formRef"
  14. :model="formData"
  15. :rules="formRules"
  16. label-width="120px"
  17. >
  18. <div v-if="props.selectedRows.length > 1" class="mb-4 text-gray-500">
  19. 已选择 {{ props.selectedRows.length }} 条记录进行批量排期
  20. </div>
  21. <el-form-item label="检验性质" prop="checkType" labelWidth="80px">
  22. <el-radio-group v-model="formData.checkType">
  23. <el-radio
  24. v-for="(label, value) in PressureBoilerCheckTypeMap"
  25. :key="value"
  26. :value="value"
  27. >
  28. {{ label }}
  29. </el-radio>
  30. </el-radio-group>
  31. </el-form-item>
  32. <!-- 内部检验配置 -->
  33. <div class="plan-section" v-if="formData.checkType == PressureBoilerCheckType.IN">
  34. <div class="section-title">
  35. <span>内部检验</span>
  36. <span class="section-info">
  37. 待检设备数量: {{ inEquipCount }} &nbsp;&nbsp; 最近临期时间: {{ inLatestTime }}
  38. </span>
  39. </div>
  40. <el-form-item label="内检日期" prop="inDate">
  41. <el-date-picker
  42. v-model="formData.inDate"
  43. type="date"
  44. placeholder="选择日期"
  45. value-format="YYYY-MM-DD"
  46. :disabled-date="(time) => time.getTime() < Date.now() - 8.64e7"
  47. :disabled="inEquipCount === 0"
  48. class="!w-240px"
  49. />
  50. <el-checkbox
  51. v-if="!isFrontDesk"
  52. v-model="formData.inIsOrderConfirm"
  53. class="ml-4"
  54. :disabled="inEquipCount === 0"
  55. >
  56. 由前台约检确认
  57. </el-checkbox>
  58. </el-form-item>
  59. <el-form-item label="检验员" v-if="inEquipCount > 0">
  60. <CheckerSelect
  61. ref="checkerInRef"
  62. v-model="inSelectedCheckers"
  63. required
  64. @change="(v: CheckerItem[]) => handleCheckerSelectChange('in', v)"
  65. />
  66. </el-form-item>
  67. <el-form-item label="收费形式" prop="inChargeType" v-if="inEquipCount > 0">
  68. <div class="flex items-center gap-4">
  69. <el-select v-model="formData.inChargeType" placeholder="请选择收费形式"
  70. class="!w-120px">
  71. <el-option label="非合同收费" value="1"/>
  72. </el-select>
  73. <span class="text-gray-600">是否免征:</span>
  74. <el-select v-model="formData.inIsExempt" placeholder="请选择是否免征"
  75. class="!w-60px" @change="handleInExemptChange">
  76. <el-option label="否" value="0"/>
  77. <el-option label="是" value="1"/>
  78. </el-select>
  79. <span class="text-gray-600">应收法定金额: {{ formData.inShouldAmount }}</span>
  80. <span class="text-gray-600">服务收费金额: {{ formData.inServiceAmount }}</span>
  81. <span class="text-gray-600">免征费用: {{ formData.inReduceFee }}</span>
  82. </div>
  83. </el-form-item>
  84. </div>
  85. <!-- 外部检验配置 -->
  86. <div class="plan-section" v-if="formData.checkType == PressureBoilerCheckType.OUT">
  87. <div class="section-title">
  88. <span>外部检验</span>
  89. <span class="section-info">
  90. 待检设备数量: {{ outEquipCount }} &nbsp;&nbsp; 最近临期时间: {{ outLatestTime }}
  91. <template v-if="isSameYear(inLatestTime, outLatestTime)">&nbsp;&nbsp; 内检临期时间: {{ inLatestTime }}</template>
  92. </span>
  93. </div>
  94. <el-form-item label="外检日期" prop="outDate">
  95. <el-date-picker
  96. v-model="formData.outDate"
  97. type="date"
  98. placeholder="选择日期"
  99. value-format="YYYY-MM-DD"
  100. :disabled-date="(time) => time.getTime() < Date.now() - 8.64e7"
  101. :disabled="outEquipCount === 0"
  102. class="!w-240px"
  103. />
  104. <el-checkbox
  105. v-if="!isFrontDesk"
  106. v-model="formData.outIsOrderConfirm"
  107. class="ml-4"
  108. :disabled="outEquipCount === 0"
  109. >
  110. 由前台约检确认
  111. </el-checkbox>
  112. </el-form-item>
  113. <el-form-item label="检验员" v-if="outEquipCount > 0">
  114. <CheckerSelect
  115. ref="checkerOutRef"
  116. v-model="outSelectedCheckers"
  117. required
  118. @change="(v: CheckerItem[]) => handleCheckerSelectChange('out', v)"
  119. />
  120. </el-form-item>
  121. <el-form-item label="收费形式" prop="outChargeType" v-if="outEquipCount > 0">
  122. <div class="flex items-center gap-4">
  123. <el-select v-model="formData.outChargeType" placeholder="请选择收费形式"
  124. class="!w-120px">
  125. <el-option label="非合同收费" value="1"/>
  126. </el-select>
  127. <span class="text-gray-600">是否免征:</span>
  128. <el-select v-model="formData.outIsExempt" placeholder="请选择是否免征"
  129. class="!w-60px" @change="handleOutExemptChange">
  130. <el-option label="否" value="0"/>
  131. <el-option label="是" value="1"/>
  132. </el-select>
  133. <span class="text-gray-600">应收法定金额: {{ formData.outShouldAmount }}</span>
  134. <span class="text-gray-600">服务收费金额: {{ formData.outServiceAmount }}</span>
  135. <span class="text-gray-600">免征费用: {{ formData.outReduceFee }}</span>
  136. </div>
  137. </el-form-item>
  138. </div>
  139. <!-- 耐压检验配置 -->
  140. <div class="plan-section" v-if="formData.checkType == PressureBoilerCheckType.PRESSURE">
  141. <div class="section-title">
  142. <span>耐压检验</span>
  143. <span class="section-info">
  144. 待检设备数量: {{ preEquipCount }} &nbsp;&nbsp; 最近临期时间: {{ preLatestTime }}
  145. <template v-if="isSameYear(inLatestTime, preLatestTime)">&nbsp;&nbsp; 内检临期时间: {{ inLatestTime }}</template>
  146. <template v-if="isSameYear(outLatestTime, preLatestTime)">&nbsp;&nbsp; 外检临期时间: {{ outLatestTime }}</template>
  147. </span>
  148. </div>
  149. <el-form-item label="耐压检验日期" prop="preDate">
  150. <el-date-picker
  151. v-model="formData.preDate"
  152. type="date"
  153. placeholder="选择日期"
  154. value-format="YYYY-MM-DD"
  155. :disabled-date="(time) => time.getTime() < Date.now() - 8.64e7"
  156. :disabled="preEquipCount == 0"
  157. class="!w-240px"
  158. />
  159. <el-checkbox
  160. v-if="!isFrontDesk"
  161. v-model="formData.pressureIsOrderConfirm"
  162. class="ml-4"
  163. :disabled="preEquipCount == 0"
  164. >
  165. 由前台约检确认
  166. </el-checkbox>
  167. </el-form-item>
  168. <el-form-item label="检验员" v-if="preEquipCount !== 0">
  169. <CheckerSelect
  170. ref="checkerPreRef"
  171. v-model="preSelectedCheckers"
  172. required
  173. @change="(v: CheckerItem[]) => handleCheckerSelectChange('pre', v)"
  174. />
  175. </el-form-item>
  176. <el-form-item label="收费形式" prop="preChargeType" v-if="preEquipCount !== 0">
  177. <div class="flex items-center gap-4">
  178. <el-select v-model="formData.preChargeType" placeholder="请选择收费形式"
  179. class="!w-120px">
  180. <el-option label="非合同收费" value="1"/>
  181. </el-select>
  182. <span class="text-gray-600">是否免征:</span>
  183. <el-select v-model="formData.preIsExempt" placeholder="请选择是否免征"
  184. class="!w-60px" @change="handlePreExemptChange">
  185. <el-option label="否" value="0"/>
  186. <el-option label="是" value="1"/>
  187. </el-select>
  188. <span class="text-gray-600">应收法定金额: {{ formData.preShouldAmount }}</span>
  189. <span class="text-gray-600">服务收费金额: {{ formData.preServiceAmount }}</span>
  190. <span class="text-gray-600">免征费用: {{ formData.preReduceFee }}</span>
  191. </div>
  192. </el-form-item>
  193. </div>
  194. <!-- 检验项目 -->
  195. <div
  196. class="checkItemContent"
  197. v-for="checkItem in checkItemList"
  198. :key="checkItem.inspectionNature + '-' + checkItem.type"
  199. >
  200. <div v-if="checkItem.inspectionNature == formData.checkType && getEquipCountByType(checkItem.inspectionNature) != 0">
  201. <div class="content-title" @click="toggleCheckItemCollapse(checkItem)">
  202. <el-icon class="collapse-icon" :class="{ 'is-collapsed': !checkItem.isExpanded }">
  203. <ArrowDown />
  204. </el-icon>
  205. {{ checkItem.inspectionNatureName }}
  206. </div>
  207. <div class="inspection-grid" v-show="checkItem.isExpanded">
  208. <template v-if="checkItem.itemList.length > 0">
  209. <!-- Grid 容器 -->
  210. <div
  211. class="grid-container"
  212. :style="{
  213. 'grid-template-columns':
  214. checkItem.itemList.length < 3
  215. ? `repeat(${checkItem.itemList.length}, 1fr)`
  216. : `repeat(3, 1fr)`
  217. }"
  218. >
  219. <!-- 循环渲染子项(模拟数据) -->
  220. <div class="grid-item" v-for="(item, index) in checkItem.itemList" :key="index">
  221. <el-checkbox
  222. v-model="item.use"
  223. :disabled="item.isMainProject === '1'"
  224. />
  225. <!-- @change="(val) => handleCheckItemSelectedChange(item, val)"-->
  226. <div style="display: flex; align-items: center; gap: 4px;">
  227. <span v-if="item.isMainProject === '1'"
  228. style="display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; background-color: #6cbcf5; color: #fff; font-size: 12px; border-radius: 2px; font-weight: bold;">主</span>
  229. <span>{{ item.name }}</span>
  230. </div>
  231. <span v-if="item.isFee === '1'">
  232. (
  233. <el-button link type="primary" @click="() => {
  234. openFeeDialog(item)
  235. }"
  236. >费用:{{ item.fee || '无' }}</el-button
  237. >
  238. )
  239. </span>
  240. </div>
  241. </div>
  242. </template>
  243. <el-empty style="height: 200px;" v-else
  244. :description="`暂无【${checkItem.inspectionNatureName}】检验项目`"/>
  245. </div>
  246. </div>
  247. </div>
  248. </el-form>
  249. </div>
  250. </div>
  251. <template #footer>
  252. <div class="flex justify-end">
  253. <el-button @click="handleCancel">取消</el-button>
  254. <el-button
  255. type="primary"
  256. @click="handleConfirm"
  257. :disabled="isConfirmDisabled"
  258. :loading="submitLoading"
  259. >
  260. 确定
  261. </el-button>
  262. </div>
  263. </template>
  264. <!-- 费用计算弹窗 -->
  265. <CalcProjectFee
  266. v-if="showCalcCheckItemFeeDialog"
  267. v-model="showCalcCheckItemFeeDialog"
  268. :project-id="currentFeeItem.connectId"
  269. :old-fee="currentFeeItem.fee || 0"
  270. :fee-calculate-json-str="currentFeeItem.feeCalculateJson || ''"
  271. @save="handleFeeSave"
  272. />
  273. </el-dialog>
  274. </template>
  275. <script setup lang="ts">
  276. import {FormInstance} from 'element-plus'
  277. import {ArrowDown} from '@element-plus/icons-vue'
  278. import {useMessage} from '@/hooks/web/useMessage'
  279. import dayjs from 'dayjs';
  280. import {
  281. EquipBoilerSchedulingVO,
  282. EquipBoilerSchedulingApi
  283. } from "@/api/pressure2/equipboilerscheduling";
  284. import {
  285. PressureBoilerCheckType,
  286. PressureBoilerCheckTypeMap,
  287. PressurePipeCheckTypeMap
  288. } from "@/utils/constants";
  289. import {BoilerTaskOrderApi} from "@/api/pressure2/boilertaskorder";
  290. import {is} from "@/utils/is";
  291. import {EquipBoilerApi} from "@/api/pressure2/equipboiler";
  292. import {InspectionNatureTypeApi} from "@/api/pressure2/inspectionnaturetype";
  293. import {getDept} from "@/api/system/dept";
  294. import {ClientUnitApi} from "../../../../api/system/clientunit";
  295. import CalcProjectFee from './calcProjectFee.vue'
  296. import CheckerSelect from '@/views/pressure2/components/CheckerSelect/index.vue'
  297. import type { CheckerItem } from '@/views/pressure2/components/CheckerSelect'
  298. const message = useMessage()
  299. const {queryCheckItemList, querySchedulingCheckItemList} = BoilerTaskOrderApi
  300. const props = defineProps({
  301. selectedRows: {
  302. type: Array as PropType<EquipBoilerSchedulingVO[]>,
  303. default: () => []
  304. },
  305. selectedInList: {
  306. type: Array as PropType<EquipBoilerSchedulingVO[]>,
  307. default: () => []
  308. },
  309. selectedOutList: {
  310. type: Array as PropType<EquipBoilerSchedulingVO[]>,
  311. default: () => []
  312. },
  313. selectedPreList: {
  314. type: Array as PropType<EquipBoilerSchedulingVO[]>,
  315. default: () => []
  316. },
  317. source: {
  318. type: String as PropType<string>,
  319. default: 'pressure'
  320. }
  321. })
  322. // 是否前台约检来源:前台约检跳过计划表提交+约检确认,直接生成受理单
  323. const isFrontDesk = computed(() => props.source === 'plan')
  324. const emit = defineEmits(['success', 'close', 'clear-selected-rows'])
  325. const dialogVisible = ref(false)
  326. const formRef = ref<FormInstance>()
  327. const submitLoading = ref(false) // 提交按钮 loading
  328. const isBatch = ref(false)
  329. const title = computed(() => props.selectedRows.length > 1 ? '批量计划排期' : '计划排期')
  330. // 判断确定按钮是否禁用
  331. const isConfirmDisabled = computed(() => {
  332. // 根据当前选择的检验类型,判断对应设备数量是否为0
  333. if (formData.value.checkType == PressureBoilerCheckType.IN) {
  334. return inEquipCount.value === 0
  335. } else if (formData.value.checkType == PressureBoilerCheckType.OUT) {
  336. return outEquipCount.value === 0
  337. } else if (formData.value.checkType == PressureBoilerCheckType.PRESSURE) {
  338. return preEquipCount.value === 0
  339. }
  340. return false
  341. })
  342. // 根据检验类型获取设备数量
  343. const getEquipCountByType = (type: string) => {
  344. if (type === PressureBoilerCheckType.IN) {
  345. return inEquipCount.value
  346. } else if (type === PressureBoilerCheckType.OUT) {
  347. return outEquipCount.value
  348. } else if (type === PressureBoilerCheckType.PRESSURE) {
  349. return preEquipCount.value
  350. }
  351. return 0
  352. }
  353. // 检验项目
  354. const checkItemList = ref<any[]>([])
  355. const showCalcCheckItemFeeDialog = ref(false)
  356. const currentFeeItem = ref<any>(null)
  357. const equipList = ref<any[]>([])
  358. // 内部检验设备数量
  359. const inEquipCount = computed(() => {
  360. return props.selectedInList.length
  361. })
  362. // 外部检验设备数量
  363. const outEquipCount = computed(() => {
  364. return props.selectedOutList.length
  365. })
  366. // 耐压检验设备数量
  367. const preEquipCount = computed(() => {
  368. return props.selectedPreList.length
  369. })
  370. // 内部检验最近临期时间
  371. const inLatestTime = computed(() => {
  372. const latestTime = props.selectedRows.reduce((nextInCheckDate, row) => {
  373. if (!row.nextInCheckDate) return nextInCheckDate
  374. if (!nextInCheckDate || row.nextInCheckDate < nextInCheckDate) {
  375. return row.nextInCheckDate
  376. }
  377. return nextInCheckDate
  378. }, '')
  379. return latestTime ? dayjs(latestTime).format('YYYY-MM-DD') : '无'
  380. })
  381. // 外部检验最近临期时间
  382. const outLatestTime = computed(() => {
  383. const latestTime = props.selectedRows.reduce((nextOutCheckDate, row) => {
  384. if (!row.nextOutCheckDate) return nextOutCheckDate
  385. if (!nextOutCheckDate || row.nextOutCheckDate < nextOutCheckDate) {
  386. return row.nextOutCheckDate
  387. }
  388. return nextOutCheckDate
  389. }, '')
  390. return latestTime ? dayjs(latestTime).format('YYYY-MM-DD') : '无'
  391. })
  392. // 超年限检验最近临期时间
  393. const preLatestTime = computed(() => {
  394. const latestTime = props.selectedRows.reduce((nextPressureCheckDate, row) => {
  395. if (!row.nextPressureCheckDate) return nextPressureCheckDate
  396. if (!nextPressureCheckDate || row.nextPressureCheckDate < nextPressureCheckDate) {
  397. return row.nextPressureCheckDate
  398. }
  399. return nextPressureCheckDate
  400. }, '')
  401. return latestTime ? dayjs(latestTime).format('YYYY-MM-DD') : '无'
  402. })
  403. /** 判断两个临检时间是否同一年 */
  404. const isSameYear = (time1: string, time2: string) => {
  405. if (time1 === '无' || time2 === '无') return false
  406. return time1.substring(0, 4) === time2.substring(0, 4)
  407. }
  408. const formData = ref({
  409. checkType: '100',
  410. // 内部检验
  411. inDate: '',
  412. inTeamList: [{
  413. groupTeamId: '',
  414. leaderId: '',
  415. memberIdList: []
  416. }],
  417. inTaskList: [],
  418. inIsOrderConfirm: true,
  419. inChargeType: '1',
  420. inIsExempt: '0',
  421. inShouldAmount: 0,
  422. inServiceAmount: 0,
  423. inReduceFee: 0,
  424. // 外部检验
  425. outDate: '',
  426. outTeamList: [{
  427. groupTeamId: '',
  428. leaderId: '',
  429. memberIdList: []
  430. }],
  431. outTaskList: [],
  432. outIsOrderConfirm: true,
  433. outChargeType: '1',
  434. outIsExempt: '0',
  435. outShouldAmount: 0,
  436. outServiceAmount: 0,
  437. outReduceFee: 0,
  438. // 耐压检验
  439. preDate: '',
  440. preTeamList: [{
  441. groupTeamId: '',
  442. leaderId: '',
  443. memberIdList: []
  444. }],
  445. pressureTaskList: [],
  446. pressureIsOrderConfirm: true,
  447. preChargeType: '1',
  448. preIsExempt: '0',
  449. preShouldAmount: 0,
  450. preServiceAmount: 0,
  451. preReduceFee: 0,
  452. taskList: [{
  453. inEquipIds: '',
  454. outEquipIds: '',
  455. preEquipIds: ''
  456. }]
  457. })
  458. // 各类型检验员选择状态
  459. const inSelectedCheckers = ref<CheckerItem[]>([])
  460. const outSelectedCheckers = ref<CheckerItem[]>([])
  461. const preSelectedCheckers = ref<CheckerItem[]>([])
  462. // CheckerSelect 组件引用
  463. const checkerInRef = ref()
  464. const checkerOutRef = ref()
  465. const checkerPreRef = ref()
  466. // 表单验证规则
  467. const formRules = {
  468. inDate: [{
  469. validator: (rule, value, callback) => {
  470. if (!value) {
  471. callback(new Error('请选择内检日期'))
  472. } else {
  473. callback()
  474. }
  475. },
  476. trigger: 'change'
  477. }],
  478. outDate: [{
  479. validator: (rule, value, callback) => {
  480. if (!value) {
  481. callback(new Error('请选择外检日期'))
  482. } else {
  483. callback()
  484. }
  485. },
  486. trigger: 'change'
  487. }],
  488. outTeamList: [{
  489. validator: (rule, value, callback) => {
  490. if ((!value || value.length === 0)) {
  491. callback(new Error('请选择检验员'))
  492. } else {
  493. callback()
  494. }
  495. },
  496. trigger: 'change'
  497. }],
  498. preDate: [{
  499. validator: (rule, value, callback) => {
  500. if (!value) {
  501. callback(new Error('请选择耐压检验日期'))
  502. } else {
  503. callback()
  504. }
  505. },
  506. trigger: 'change'
  507. }],
  508. preTeamList: [{
  509. validator: (rule, value, callback) => {
  510. if ((!value || value.length === 0)) {
  511. callback(new Error('请选择检验员'))
  512. } else {
  513. callback()
  514. }
  515. },
  516. trigger: 'change'
  517. }]
  518. }
  519. /** 处理统一 CheckerSelect 组件的选择变化 */
  520. const handleCheckerSelectChange = (type: 'in' | 'out' | 'pre', checkers: CheckerItem[]) => {
  521. updateTeamList(type)
  522. syncCheckers(type, checkers)
  523. }
  524. /** 监听检验性质变化 */
  525. watch(() => formData.value.checkType, (newType, oldType) => {
  526. if (newType && newType !== oldType && !isOpening.value) {
  527. handleQueryCheckItemList(newType)
  528. }
  529. })
  530. watch(() => formData.value.inDate, (newDate) => {
  531. if (newDate) {
  532. // 只有在未设置且未勾选"无需安排"的情况下才自动填充
  533. if (!formData.value.outDate) {
  534. formData.value.outDate = newDate
  535. }
  536. if (!formData.value.preDate) {
  537. formData.value.preDate = newDate
  538. }
  539. }
  540. })
  541. watch(() => formData.value.outDate, (newDate) => {
  542. if (newDate) {
  543. if (!formData.value.outDate) {
  544. formData.value.outDate = newDate
  545. }
  546. if (!formData.value.preDate) {
  547. formData.value.preDate = newDate
  548. }
  549. }
  550. })
  551. watch(() => formData.value.preDate, (newDate) => {
  552. if (newDate) {
  553. if (!formData.value.inDate) {
  554. formData.value.inDate = newDate
  555. }
  556. if (!formData.value.outDate) {
  557. formData.value.outDate = newDate
  558. }
  559. }
  560. })
  561. /** 监听检验员变化 */
  562. const syncCheckers = (sourceType: string, checkers: CheckerItem[]) => {
  563. const typeMap = {
  564. in: ['out', 'pre'],
  565. out: ['in', 'pre'],
  566. pre: ['in', 'out']
  567. }
  568. typeMap[sourceType].forEach(type => {
  569. const checkerMap = {
  570. in: inSelectedCheckers,
  571. out: outSelectedCheckers,
  572. pre: preSelectedCheckers
  573. }
  574. // 只有在未选择检验员且未勾选"无需安排"的情况下才自动同步
  575. if (checkerMap[type].value.length === 0) {
  576. checkerMap[type].value = [...checkers]
  577. updateTeamList(type)
  578. }
  579. })
  580. }
  581. const openFeeDialog = (item) => {
  582. showCalcCheckItemFeeDialog.value = true
  583. currentFeeItem.value = item
  584. }
  585. const handleFeeSave = (result: { fee: number; feeCalculateJson: string }) => {
  586. if (currentFeeItem.value) {
  587. currentFeeItem.value.fee = result.fee
  588. currentFeeItem.value.feeCalculateJson = result.feeCalculateJson
  589. }
  590. currentFeeItem.value = null
  591. handleCheckItemFeeConfirm()
  592. showCalcCheckItemFeeDialog.value = false
  593. }
  594. /** 处理内部检验免征变化 */
  595. const handleInExemptChange = (val: string) => {
  596. calculateInAmounts()
  597. }
  598. /** 处理外部检查免征变化 */
  599. const handleOutExemptChange = (val: string) => {
  600. calculateOutAmounts()
  601. }
  602. /** 处理耐压检查免征变化 */
  603. const handlePreExemptChange = (val: string) => {
  604. calculatePreAmounts()
  605. }
  606. /** 计算内部检验金额 */
  607. const calculateInAmounts = () => {
  608. const inItems = checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.IN)
  609. if (!inItems) return
  610. // 分离法定收费项目和服务收费项目
  611. const find = inItems?.find(item => item.type === '1');
  612. if (!find) return;
  613. const statutoryItems = find.itemList.filter(item => item.use)
  614. const find1 = inItems?.find(item => item.type === '2');
  615. if (!find1) return;
  616. const serviceItems = find1.itemList.filter(item => item.use)
  617. // 计算法定金额总和
  618. const totalStatutoryAmount = statutoryItems.reduce((sum, item) => sum + (item.fee || 0), 0)
  619. // 计算服务收费金额总和
  620. const totalServiceAmount = serviceItems.reduce((sum, item) => sum + (item.fee || 0), 0)
  621. if (formData.value.inIsExempt === '1') {
  622. // 免征:免征费用=应收法定金额,应收法定金额=0
  623. formData.value.inReduceFee = totalStatutoryAmount
  624. formData.value.inShouldAmount = 0
  625. } else {
  626. // 不免征:免征费用=0,应收法定金额=总金额
  627. formData.value.inReduceFee = 0
  628. formData.value.inShouldAmount = totalStatutoryAmount
  629. }
  630. formData.value.inServiceAmount = totalServiceAmount
  631. }
  632. /** 外部检验金额 */
  633. const calculateOutAmounts = () => {
  634. const outItems = checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.OUT)
  635. if (!outItems) return
  636. // 分离法定收费项目和服务收费项目
  637. const find = outItems?.find(item => item.type === '1');
  638. if (!find) return;
  639. const statutoryItems = find.itemList.filter(item => item.use)
  640. const find1 = outItems?.find(item => item.type === '2');
  641. if (!find1) return;
  642. const serviceItems = find1.itemList.filter(item => item.use)
  643. // 计算法定金额总和
  644. const totalStatutoryAmount = statutoryItems.reduce((sum, item) => sum + (item.fee || 0), 0)
  645. // 计算服务收费金额总和
  646. const totalServiceAmount = serviceItems.reduce((sum, item) => sum + (item.fee || 0), 0)
  647. if (formData.value.outIsExempt === '1') {
  648. // 免征:免征费用=应收法定金额,应收法定金额=0
  649. formData.value.outReduceFee = totalStatutoryAmount
  650. formData.value.outShouldAmount = 0
  651. } else {
  652. // 不免征:免征费用=0,应收法定金额=总金额
  653. formData.value.outReduceFee = 0
  654. formData.value.outShouldAmount = totalStatutoryAmount
  655. }
  656. formData.value.outServiceAmount = totalServiceAmount
  657. }
  658. /** 计算耐压检验金额 */
  659. const calculatePreAmounts = () => {
  660. const preItems = checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.PRESSURE)
  661. if (!preItems) return
  662. // 分离法定收费项目和服务收费项目
  663. const find = preItems?.find(item => item.type === '1');
  664. if (!find) return;
  665. const statutoryItems = find.itemList.filter(item => item.use)
  666. const find1 = preItems?.find(item => item.type === '2');
  667. if (!find1) return;
  668. const serviceItems = find1.itemList.filter(item => item.use)
  669. // 计算法定金额总和
  670. const totalStatutoryAmount = statutoryItems.reduce((sum, item) => sum + (item.fee || 0), 0)
  671. // 计算服务收费金额总和
  672. const totalServiceAmount = serviceItems.reduce((sum, item) => sum + (item.fee || 0), 0)
  673. if (formData.value.preIsExempt === '1') {
  674. // 免征:免征费用=应收法定金额,应收法定金额=0
  675. formData.value.preReduceFee = totalStatutoryAmount
  676. formData.value.preShouldAmount = 0
  677. } else {
  678. // 不免征:免征费用=0,应收法定金额=总金额
  679. formData.value.preReduceFee = 0
  680. formData.value.preShouldAmount = totalStatutoryAmount
  681. }
  682. formData.value.preServiceAmount = totalServiceAmount
  683. }
  684. const handleCheckItemFeeConfirm = () => {
  685. // formData.value.actualAmount = 0
  686. // checkItemList.value.forEach(item => {
  687. // item.itemList.forEach(item => {
  688. // let num= 0
  689. // if (PressureBoilerCheckType.IN == item.inspectionNature){
  690. // num = nextInCheckCount.value
  691. // }
  692. // if (PressureBoilerCheckType.OUT == item.inspectionNature){
  693. // num = nextOutCheckCount.value
  694. // }
  695. // if (PressureBoilerCheckType.PRESSURE == item.inspectionNature){
  696. // num = nextPressureCheckCount.value
  697. // }
  698. // formData.value.actualAmount += item.fee * num
  699. // })
  700. // })
  701. calculateInAmounts()
  702. calculateOutAmounts()
  703. calculatePreAmounts()
  704. }
  705. // 监听检验项目使用状态变化,自动重新计算金额
  706. watch(() => checkItemList.value, () => {
  707. calculateInAmounts()
  708. calculateOutAmounts()
  709. calculatePreAmounts()
  710. }, {deep: true})
  711. /** 更新 teamList */
  712. const updateTeamList = (type) => {
  713. const checkerMap = {
  714. in: inSelectedCheckers,
  715. out: outSelectedCheckers,
  716. pre: preSelectedCheckers
  717. }
  718. const teamListMap = {
  719. in: 'inTeamList',
  720. out: 'outTeamList',
  721. pre: 'preTeamList'
  722. }
  723. const groupedTeams = checkerMap[type].value.reduce((acc, checker) => {
  724. const {groupTeamId} = checker
  725. if (!acc[groupTeamId]) {
  726. acc[groupTeamId] = {
  727. groupTeamId,
  728. leaderId: '',
  729. memberIdList: []
  730. }
  731. }
  732. if (checker.isLeader) {
  733. acc[groupTeamId].leaderId = checker.memberId
  734. } else {
  735. acc[groupTeamId].memberIdList.push(checker.memberId)
  736. }
  737. return acc
  738. }, {})
  739. formData.value[teamListMap[type]] = Object.values(groupedTeams)
  740. }
  741. // 查询项目列表(按当前检验性质查询,并缓存结果)
  742. const checkItemListCache = ref<Record<string, any[]>>({})
  743. const isOpening = ref(false) // 标记弹窗是否正在打开,防止watch在数据未就绪时触发查询
  744. const handleQueryCheckItemList = async (checkType?: string) => {
  745. const targetType = checkType || formData.value.checkType
  746. // 如果已缓存,直接使用缓存数据
  747. if (checkItemListCache.value[targetType]) {
  748. // 合并缓存数据到 checkItemList(保留其他类型的数据,更新当前类型)
  749. const cachedItems = checkItemListCache.value[targetType]
  750. checkItemList.value = [
  751. ...checkItemList.value.filter(i => i.inspectionNature != targetType),
  752. ...cachedItems
  753. ]
  754. return
  755. }
  756. // 校验所有选中的任务列表中的设备类型是否一致
  757. const allTasks = [
  758. ...formData.value.inTaskList,
  759. ...formData.value.outTaskList,
  760. ...formData.value.pressureTaskList
  761. ]
  762. if (allTasks.length > 0) {
  763. const firstType = allTasks[0].type
  764. const firstUnit = allTasks[0].unitId
  765. const hasDifferentType = allTasks.some(task => task.type !== firstType)
  766. const hasDifferentUnit = allTasks.some(task => task.unitId !== firstUnit)
  767. if (hasDifferentType) {
  768. ElMessage.error('请选择同一类型设备')
  769. dialogVisible.value = false
  770. return
  771. }
  772. if (hasDifferentUnit) {
  773. ElMessage.error('请选择同一单位设备')
  774. dialogVisible.value = false
  775. return
  776. }
  777. if (firstUnit){
  778. ClientUnitApi.getClientUnit(firstUnit).then(res => {
  779. formData.value.inIsExempt = res.isExempt
  780. formData.value.outIsExempt = res.isExempt
  781. formData.value.preIsExempt = res.isExempt
  782. })
  783. }
  784. }
  785. // 获取统一的设备类型,如果列表为空则设为 undefined
  786. const equipType = allTasks.length > 0 ? allTasks[0].type : undefined
  787. const type = Number(targetType) || targetType
  788. const params = {
  789. orderId: "0",
  790. itemIds: equipList.value.map(item => item.id),
  791. equipmentCategory: 200,
  792. inspectionNature: [type],
  793. equipType:equipType
  794. };
  795. const queryResult = await querySchedulingCheckItemList(params);
  796. const inspectionNatureType = await InspectionNatureTypeApi.getInspectionNatureTypePage({
  797. pageNo: 1,
  798. pageSize: 1,
  799. equip: '200',
  800. nature: type
  801. })
  802. const inType = inspectionNatureType.list[0].type
  803. const newItems: any[] = []
  804. newItems.push({
  805. inspectionNatureName: PressureBoilerCheckTypeMap[type] + " 法定收费项目",
  806. inspectionNature: type,
  807. type: '1',
  808. isExpanded: inType == 1,
  809. itemList: (queryResult || []).map((item) => (
  810. {
  811. ...item,
  812. isAutoAmount: '0',
  813. inspectionNature: type,
  814. type: '1',
  815. use: inType == 1 ? item.use : false
  816. }
  817. ))
  818. });
  819. newItems.push({
  820. inspectionNatureName: PressureBoilerCheckTypeMap[type] + " 服务收费项目",
  821. inspectionNature: type,
  822. type: '2',
  823. isExpanded: inType == 2,
  824. itemList: (queryResult || []).map((item) => (
  825. {
  826. ...item,
  827. isAutoAmount: '0',
  828. inspectionNature: type,
  829. type: '2',
  830. use: inType == 2 ? item.use : false
  831. }
  832. ))
  833. });
  834. // 缓存当前类型的结果
  835. checkItemListCache.value[type] = newItems
  836. // 合并到 checkItemList
  837. checkItemList.value = [
  838. ...checkItemList.value.filter(i => i.inspectionNature != type),
  839. ...newItems
  840. ]
  841. }
  842. /** 切换检验项目展开/收缩状态 */
  843. const toggleCheckItemCollapse = (checkItem: any) => {
  844. checkItem.isExpanded = !checkItem.isExpanded
  845. }
  846. // 判断当前用户部门是否为锅炉检验部
  847. const isBoilerInspectionDept = ref(false)
  848. /** 检查设备部门是否为锅炉检验部 */
  849. const checkEquipDept = async (selectedRows: any[]) => {
  850. console.log(selectedRows)
  851. if (!selectedRows || selectedRows.length === 0) {
  852. isBoilerInspectionDept.value = false
  853. return
  854. }
  855. try {
  856. // 获取第一个设备的部门ID(假设选中的设备都属于同一个部门)
  857. const firstRow = selectedRows[0]
  858. const deptId = firstRow.relatedDepartment
  859. if (!deptId) {
  860. console.warn('设备数据中没有部门信息')
  861. isBoilerInspectionDept.value = false
  862. return
  863. }
  864. const deptInfo = await getDept(deptId)
  865. // 判断部门名称是否包含"锅炉检验部"
  866. isBoilerInspectionDept.value = deptInfo?.name?.includes('锅炉检验部') || false
  867. } catch (error) {
  868. console.error('获取设备部门信息失败:', error)
  869. isBoilerInspectionDept.value = false
  870. }
  871. }
  872. /** 打开弹窗 */
  873. const open = async (selectedInList, selectedOutList, selectedPreList, type?: string) => {
  874. //console.log('open', props.selectedRows)
  875. isOpening.value = true
  876. dialogVisible.value = true
  877. // 合并所有选中的设备列表
  878. const allSelectedRows = [
  879. ...(selectedInList.value || []),
  880. ...(selectedOutList.value || []),
  881. ...(selectedPreList.value || [])
  882. ]
  883. // 检查设备部门
  884. await checkEquipDept(allSelectedRows)
  885. // 重置所有检验员选择
  886. inSelectedCheckers.value = []
  887. outSelectedCheckers.value = []
  888. preSelectedCheckers.value = []
  889. // 重置校验状态(需等 nextTick 组件 ref 就绪)
  890. nextTick(() => {
  891. checkerInRef.value?.resetValidation()
  892. checkerOutRef.value?.resetValidation()
  893. checkerPreRef.value?.resetValidation()
  894. })
  895. // 根据设备部门设置默认的约检确认状态
  896. const defaultOrderConfirm = !isBoilerInspectionDept.value
  897. // 重置表单数据
  898. formData.value = {
  899. checkType: type || '100',
  900. inDate: '',
  901. inTeamList: [],
  902. inTaskList: [],
  903. inIsOrderConfirm: defaultOrderConfirm,
  904. inChargeType: '1',
  905. inIsExempt: '0',
  906. inShouldAmount: 0,
  907. inServiceAmount: 0,
  908. inReduceFee: 0,
  909. outDate: '',
  910. outTeamList: [],
  911. outTaskList: [],
  912. outChargeType: '1',
  913. outIsOrderConfirm: defaultOrderConfirm,
  914. outIsExempt: '0',
  915. outShouldAmount: 0,
  916. outServiceAmount: 0,
  917. outReduceFee: 0,
  918. preDate: '',
  919. preTeamList: [],
  920. pressureTaskList: [],
  921. pressureIsOrderConfirm: defaultOrderConfirm,
  922. preChargeType: '1',
  923. preIsExempt: '0',
  924. preShouldAmount: 0,
  925. preServiceAmount: 0,
  926. preReduceFee: 0,
  927. }
  928. formData.value.inTaskList = selectedInList
  929. formData.value.outTaskList = selectedOutList
  930. formData.value.pressureTaskList = selectedPreList
  931. // 清空缓存和项目列表,只查询当前检验性质
  932. checkItemList.value = []
  933. checkItemListCache.value = {}
  934. await handleQueryCheckItemList(formData.value.checkType)
  935. isOpening.value = false
  936. // 检验员选择由统一的 CheckerSelect 组件自行管理,无需手动加载
  937. }
  938. /** 取消操作 */
  939. const handleCancel = () => {
  940. dialogVisible.value = false
  941. checkItemList.value = []
  942. checkItemListCache.value = {}
  943. if (!isBatch.value) {
  944. emit('clear-selected-rows') // 新增事件用于清空选中行
  945. }
  946. emit('close')
  947. }
  948. /** 确认操作 */
  949. const handleConfirm = async () => {
  950. const form = unref(formRef)
  951. if (!form) return
  952. submitLoading.value = true
  953. try {
  954. // 验证日期
  955. await form.validate()
  956. // 验证检验员必填
  957. const validations: boolean[] = []
  958. if (inEquipCount.value > 0) validations.push(checkerInRef.value?.validate())
  959. if (outEquipCount.value > 0) validations.push(checkerOutRef.value?.validate())
  960. if (preEquipCount.value !== 0) validations.push(checkerPreRef.value?.validate())
  961. if (validations.some(v => v === false)) return
  962. // 组装新的数据结构
  963. const submitData: { taskList: any[]; source: number } = {
  964. taskList: [],
  965. source: props.source === 'pressure' ? 100 : 200
  966. }
  967. const inUnitList = formData.value.inTaskList.reduce((acc, item) => {
  968. const key = item.unitId;
  969. if (!acc[key]) {
  970. acc[key] = [];
  971. }
  972. acc[key].push(item)
  973. return acc;
  974. }, {})
  975. const outUnitList = formData.value.outTaskList.reduce((acc, item) => {
  976. const key = item.unitId;
  977. if (!acc[key]) {
  978. acc[key] = [];
  979. }
  980. acc[key].push(item)
  981. return acc;
  982. }, {})
  983. const preUnitList = formData.value.pressureTaskList.reduce((acc, item) => {
  984. const key = item.unitId;
  985. if (!acc[key]) {
  986. acc[key] = [];
  987. }
  988. acc[key].push(item)
  989. return acc;
  990. }, {})
  991. // 遍历 formData.value.taskList 中的每个项目
  992. if (formData.value.checkType == '100') {
  993. Object.values(inUnitList).forEach(item => {
  994. // 处理内部检验
  995. if (formData.value.inDate && formData.value.inTaskList.length > 0) {
  996. let actualAmount = 0
  997. console.log(checkItemList.value.find(i => i.inspectionNature == PressureBoilerCheckType.IN))
  998. checkItemList.value.find(i => i.inspectionNature == PressureBoilerCheckType.IN).itemList.filter(i => i.use).forEach(i => {
  999. actualAmount += i.fee
  1000. })
  1001. submitData.taskList.push({
  1002. equipIds: item.map(item => item.id).join(','),
  1003. type: '100',
  1004. hasOrderConfirm: isFrontDesk.value ? false : formData.value.inIsOrderConfirm,
  1005. date: formData.value.inDate,
  1006. teamList: formData.value.inTeamList,
  1007. chargeType: formData.value.inChargeType,
  1008. isExempt: formData.value.inIsExempt,
  1009. shouldAmount: formData.value.inShouldAmount,
  1010. serviceAmount: formData.value.inServiceAmount,
  1011. reduceFee: formData.value.inReduceFee,
  1012. actualAmount,
  1013. checkItemList: [...checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.IN)[0].itemList.filter(i => i.use).map(
  1014. i => {
  1015. return {
  1016. //reportId: i.templateId,
  1017. reportId: i.connectId,
  1018. newAmount: i.fee,
  1019. type: i.type,
  1020. feeCalculateJson: i.feeCalculateJson || '',
  1021. defaultCount: i.defaultCount || 1,
  1022. sort: i.sort || 0,
  1023. }
  1024. }
  1025. ), ...checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.IN)[1].itemList.filter(i => i.use).map(
  1026. i => {
  1027. return {
  1028. //reportId: i.templateId,
  1029. reportId: i.connectId,
  1030. newAmount: i.fee,
  1031. type: i.type,
  1032. feeCalculateJson: i.feeCalculateJson || '',
  1033. defaultCount: i.defaultCount || 1,
  1034. sort: i.sort || 0,
  1035. }
  1036. }
  1037. ),]
  1038. })
  1039. }
  1040. })
  1041. }
  1042. // 处理外部检验
  1043. if (formData.value.checkType == '200') {
  1044. Object.values(outUnitList).forEach(item => {
  1045. // 处理内部检验
  1046. if (formData.value.outDate && formData.value.outTaskList.length > 0) {
  1047. let actualAmount = 0
  1048. checkItemList.value.find(i => i.inspectionNature == PressureBoilerCheckType.OUT).itemList.filter(i => i.use).forEach(i => {
  1049. actualAmount += i.fee
  1050. })
  1051. submitData.taskList.push({
  1052. equipIds: item.map(item => item.id).join(','),
  1053. type: '200',
  1054. hasOrderConfirm: isFrontDesk.value ? false : formData.value.outIsOrderConfirm,
  1055. date: formData.value.outDate,
  1056. teamList: formData.value.outTeamList,
  1057. chargeType: formData.value.outChargeType,
  1058. isExempt: formData.value.outIsExempt,
  1059. shouldAmount: formData.value.outShouldAmount,
  1060. serviceAmount: formData.value.outServiceAmount,
  1061. reduceFee: formData.value.outReduceFee,
  1062. actualAmount,
  1063. checkItemList: [...checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.OUT)[0].itemList.filter(i => i.use).map(
  1064. i => {
  1065. return {
  1066. //reportId: i.templateId,
  1067. reportId: i.connectId,
  1068. newAmount: i.fee,
  1069. type: i.type,
  1070. feeCalculateJson: i.feeCalculateJson || '',
  1071. defaultCount: i.defaultCount || 1,
  1072. sort: i.sort || 0,
  1073. }
  1074. }
  1075. ), ...checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.OUT)[1].itemList.filter(i => i.use).map(
  1076. i => {
  1077. return {
  1078. //reportId: i.templateId,
  1079. reportId: i.connectId,
  1080. newAmount: i.fee,
  1081. type: i.type,
  1082. feeCalculateJson: i.feeCalculateJson || '',
  1083. defaultCount: i.defaultCount || 1,
  1084. sort: i.sort || 0,
  1085. }
  1086. }
  1087. ),]
  1088. })
  1089. }
  1090. })
  1091. }
  1092. // 处理耐压检验
  1093. if (formData.value.checkType == '300') {
  1094. Object.values(preUnitList).forEach(item => {
  1095. // 处理耐压检验
  1096. if (formData.value.preDate && formData.value.pressureTaskList.length > 0) {
  1097. let actualAmount = 0
  1098. checkItemList.value.find(i => i.inspectionNature == PressureBoilerCheckType.PRESSURE).itemList.filter(i => i.use).forEach(i => {
  1099. actualAmount += i.fee
  1100. })
  1101. submitData.taskList.push({
  1102. equipIds: item.map(item => item.id).join(','),
  1103. type: '300',
  1104. hasOrderConfirm: isFrontDesk.value ? false : formData.value.pressureIsOrderConfirm,
  1105. date: formData.value.preDate,
  1106. teamList: formData.value.preTeamList,
  1107. chargeType: formData.value.preChargeType,
  1108. isExempt: formData.value.preIsExempt,
  1109. shouldAmount: formData.value.preShouldAmount,
  1110. serviceAmount: formData.value.preServiceAmount,
  1111. reduceFee: formData.value.preReduceFee,
  1112. actualAmount,
  1113. checkItemList: [...checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.PRESSURE)[0].itemList.filter(i => i.use).map(
  1114. i => {
  1115. return {
  1116. //reportId: i.templateId,
  1117. reportId: i.connectId,
  1118. newAmount: i.fee,
  1119. type: i.type,
  1120. feeCalculateJson: i.feeCalculateJson || '',
  1121. defaultCount: i.defaultCount || 1,
  1122. sort: i.sort || 0,
  1123. }
  1124. }
  1125. ), ...checkItemList.value.filter(i => i.inspectionNature == PressureBoilerCheckType.PRESSURE)[1].itemList.filter(i => i.use).map(
  1126. i => {
  1127. return {
  1128. //reportId: i.templateId,
  1129. reportId: i.connectId,
  1130. newAmount: i.fee,
  1131. type: i.type,
  1132. feeCalculateJson: i.feeCalculateJson || '',
  1133. defaultCount: i.defaultCount || 1,
  1134. sort: i.sort || 0,
  1135. }
  1136. }
  1137. ),]
  1138. })
  1139. }
  1140. })
  1141. }
  1142. console.log('submitData', submitData)
  1143. const res = await EquipBoilerSchedulingApi.planSchedulingAssign(submitData)
  1144. //console.log(res)
  1145. message.success('保存成功')
  1146. dialogVisible.value = false
  1147. emit('success')
  1148. } catch
  1149. (error) {
  1150. console.error( error)
  1151. message.error('保存失败')
  1152. } finally {
  1153. submitLoading.value = false
  1154. }
  1155. }
  1156. // 向父组件暴露方法
  1157. defineExpose({
  1158. open
  1159. })
  1160. </script>
  1161. <style lang="scss" scoped>
  1162. .plan-section {
  1163. margin-bottom: 24px;
  1164. padding: 16px;
  1165. border: 1px solid #EBEEF5;
  1166. border-radius: 4px;
  1167. .section-title {
  1168. margin: -16px -16px 16px -16px;
  1169. padding: 8px 16px;
  1170. background-color: #F5F7FA;
  1171. border-bottom: 1px solid #EBEEF5;
  1172. font-weight: bold;
  1173. display: flex;
  1174. align-items: center;
  1175. .section-info {
  1176. font-weight: normal;
  1177. font-size: 13px;
  1178. color: #606266;
  1179. margin-left: 26px;
  1180. }
  1181. }
  1182. }
  1183. .content-title {
  1184. display: flex;
  1185. justify-content: flex-start;
  1186. align-items: center;
  1187. width: 100%;
  1188. height: 36px;
  1189. line-height: 36px;
  1190. background-color: var(--el-color-primary-light-9);
  1191. cursor: pointer;
  1192. user-select: none;
  1193. transition: background-color 0.3s;
  1194. &:hover {
  1195. background-color: var(--el-color-primary-light-8);
  1196. }
  1197. .collapse-icon {
  1198. margin-right: 8px;
  1199. transition: transform 0.3s;
  1200. font-size: 14px;
  1201. &.is-collapsed {
  1202. transform: rotate(-90deg);
  1203. }
  1204. }
  1205. &::before {
  1206. content: '';
  1207. height: 70%;
  1208. width: 4px;
  1209. margin-right: 12px;
  1210. background-color: var(--el-color-primary);
  1211. }
  1212. }
  1213. /* 外层容器 */
  1214. .inspection-grid {
  1215. width: 100%;
  1216. padding: 16px;
  1217. }
  1218. /* 标题行 */
  1219. .grid-header {
  1220. font-size: 16px;
  1221. font-weight: bold;
  1222. text-align: center;
  1223. height: 38px;
  1224. line-height: 38px;
  1225. border: 1px solid var(--el-border-color-light);
  1226. border-bottom: 0;
  1227. background-color: var(--el-color-primary-light-9);
  1228. }
  1229. /* Grid 容器核心配置 */
  1230. .grid-container {
  1231. display: grid;
  1232. /* 5列等宽,列间距 12px,行间距 16px */
  1233. grid-template-columns: repeat(5, 1fr);
  1234. align-items: center; /* 垂直居中 */
  1235. grid-gap: 1px;
  1236. background-color: var(--el-border-color-light);
  1237. border: 1px solid var(--el-border-color-light);
  1238. }
  1239. /* 子项布局:复选框 + 文本 + 图标 */
  1240. .grid-item {
  1241. display: flex;
  1242. align-items: center;
  1243. padding-left: 20px;
  1244. padding-right: 12px;
  1245. height: 52px;
  1246. background-color: #fff;
  1247. .el-checkbox {
  1248. margin-right: 6px;
  1249. }
  1250. }
  1251. .form-row {
  1252. display: flex;
  1253. align-items: center;
  1254. .info-label {
  1255. font-weight: bold;
  1256. text-align: right;
  1257. margin-right: 10px;
  1258. }
  1259. .info-value {
  1260. flex: 1;
  1261. }
  1262. }
  1263. .fee-amount {
  1264. font-weight: bold;
  1265. color: #e6a23c;
  1266. font-size: 16px;
  1267. }
  1268. .fee-form-item {
  1269. margin-top: 20px;
  1270. :deep(.el-form-item__label) {
  1271. font-weight: bold;
  1272. }
  1273. }
  1274. .leader-tag {
  1275. display: inline-block;
  1276. width: 14px;
  1277. height: 14px;
  1278. line-height: 12px;
  1279. text-align: center;
  1280. border: 1px solid #4475d6;
  1281. font-size: 10px;
  1282. margin-right: 4px;
  1283. color: #4475d6;
  1284. }
  1285. </style>