IotMaintenancePlan.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211
  1. <template>
  2. <ContentWrap v-loading="formLoading">
  3. <el-form
  4. ref="formRef"
  5. :model="formData"
  6. :rules="formRules"
  7. v-loading="formLoading"
  8. style="margin-right: 4em; margin-left: 0.5em; margin-top: 1em"
  9. label-width="130px"
  10. >
  11. <div class="base-expandable-content">
  12. <el-row>
  13. <el-col :span="12">
  14. <el-form-item :label="t('main.planName')" prop="name">
  15. <el-input type="text" v-model="formData.name" />
  16. </el-form-item>
  17. </el-col>
  18. <el-col :span="12">
  19. <el-form-item :label="t('main.planCode')" prop="serialNumber">
  20. <el-input type="text" v-model="formData.serialNumber" disabled/>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="24">
  24. <el-form-item :label="t('iotMaintain.remark')" prop="remark">
  25. <el-input v-model="formData.remark" type="textarea" :placeholder="t('iotMaintain.remarkHolder')" />
  26. </el-form-item>
  27. </el-col>
  28. </el-row>
  29. </div>
  30. </el-form>
  31. </ContentWrap>
  32. <ContentWrap>
  33. <ContentWrap>
  34. <!-- 搜索工作栏 -->
  35. <el-form
  36. class="-mb-15px"
  37. :model="queryParams"
  38. ref="queryFormRef"
  39. :inline="true"
  40. label-width="68px"
  41. >
  42. <el-form-item>
  43. <el-button @click="openForm" type="warning">
  44. <Icon icon="ep:plus" class="mr-5px" /> {{ t('operationFill.add') }}</el-button>
  45. </el-form-item>
  46. </el-form>
  47. </ContentWrap>
  48. <!-- 列表 -->
  49. <ContentWrap>
  50. <el-table v-loading="loading" :data="pagedList" :stripe="true" :show-overflow-tooltip="true" :cell-class-name="cellClassName">
  51. <!-- 添加序号列 -->
  52. <el-table-column
  53. type="index"
  54. :label="t('iotDevice.serial')"
  55. width="70"
  56. align="center"
  57. />
  58. <el-table-column label="设备id" align="center" prop="deviceId" v-if="false"/>
  59. <el-table-column :label="t('iotMaintain.deviceCode')" align="center" prop="deviceCode" />
  60. <el-table-column :label="t('iotMaintain.deviceName')" align="center" prop="deviceName" />
  61. <el-table-column :label="t('operationFillForm.sumTime')" align="center" prop="totalRunTime" :formatter="erpPriceTableColumnFormatter">
  62. <template #default="{ row }">
  63. {{ row.totalRunTime ?? row.tempTotalRunTime }}
  64. </template>
  65. </el-table-column>
  66. <el-table-column :label="t('operationFillForm.sumKil')" align="center" prop="totalMileage" :formatter="erpPriceTableColumnFormatter">
  67. <template #default="{ row }">
  68. {{ row.totalMileage ?? row.tempTotalMileage }}
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="tempTotalRunTime" align="center" prop="tempTotalRunTime" :formatter="erpPriceTableColumnFormatter" v-if="false"/>
  72. <el-table-column label="tempTotalMileage" align="center" prop="tempTotalMileage" :formatter="erpPriceTableColumnFormatter" v-if="false"/>
  73. <el-table-column :label="t('bomList.bomNode')" align="center" prop="name" />
  74. <el-table-column :label="t('main.mileage')" key="mileageRule" width="80">
  75. <template #default="scope">
  76. <el-switch
  77. v-model="scope.row.mileageRule"
  78. :active-value="0"
  79. :inactive-value="1"
  80. @change="handleRuleChange(scope.row, 'mileage')"
  81. />
  82. </template>
  83. </el-table-column>
  84. <el-table-column :label="t('main.runTime')" key="runningTimeRule" width="90">
  85. <template #default="scope">
  86. <el-switch
  87. v-model="scope.row.runningTimeRule"
  88. :active-value="0"
  89. :inactive-value="1"
  90. @change="handleRuleChange(scope.row, 'runningTime')"
  91. />
  92. </template>
  93. </el-table-column>
  94. <el-table-column :label="t('main.date')" key="naturalDateRule" width="80">
  95. <template #default="scope">
  96. <el-switch
  97. v-model="scope.row.naturalDateRule"
  98. :active-value="0"
  99. :inactive-value="1"
  100. />
  101. </template>
  102. </el-table-column>
  103. <el-table-column :label="t('operationFill.operation')" align="center" min-width="120px">
  104. <template #default="scope">
  105. <div style="display: flex; justify-content: center; align-items: center; width: 100%">
  106. <div>
  107. <Icon style="vertical-align: middle; color: #ea3434" icon="ep:zoom-out" />
  108. <el-button
  109. style="vertical-align: middle"
  110. link
  111. type="danger"
  112. @click="handleDelete(scope.row.deviceId+'-'+scope.row.bomNodeId)"
  113. >
  114. {{t('modelTemplate.delete')}}
  115. </el-button>
  116. </div>
  117. <!-- 新增配置按钮 -->
  118. <div style="margin-left: 12px">
  119. <el-button
  120. link
  121. type="primary"
  122. @click="openConfigDialog(scope.row)"
  123. >
  124. {{t('modelTemplate.update')}}
  125. </el-button>
  126. </div>
  127. </div>
  128. </template>
  129. </el-table-column>
  130. </el-table>
  131. <!-- 添加分页组件 -->
  132. <el-pagination
  133. :key="`pagination-${list.length}-${currentPage}`"
  134. style="margin-top: 20px; justify-content: flex-end"
  135. :total="list.length"
  136. v-model:current-page="currentPage"
  137. v-model:page-size="pageSize"
  138. :page-sizes="[10, 20, 50, 100]"
  139. layout="total, sizes, prev, pager, next, jumper"
  140. @current-change="handlePageChange"
  141. @size-change="handleSizeChange"
  142. />
  143. </ContentWrap>
  144. </ContentWrap>
  145. <ContentWrap>
  146. <el-form>
  147. <el-form-item style="float: right">
  148. <el-button @click="submitForm" type="primary" :disabled="formLoading">{{t('iotMaintain.save')}}</el-button>
  149. <el-button @click="close">{{t('iotMaintain.cancel')}}</el-button>
  150. </el-form-item>
  151. </el-form>
  152. </ContentWrap>
  153. <MainPlanDeviceList ref="deviceFormRef" @choose="deviceChoose" />
  154. <!-- 新增配置对话框 -->
  155. <el-dialog
  156. v-model="configDialog.visible"
  157. :title="`设备 ${configDialog.current?.deviceCode+'-'+configDialog.current?.name} 保养配置`"
  158. width="600px"
  159. :close-on-click-modal="false"
  160. >
  161. <!-- 使用header插槽自定义标题 -->
  162. <template #header>
  163. <span>设备 <strong>{{ configDialog.current?.deviceCode }}-{{ configDialog.current?.name }}</strong> 保养项配置</span>
  164. </template>
  165. <el-form :model="configDialog.form" label-width="200px" :rules="configFormRules" ref="configFormRef">
  166. <div class="form-group">
  167. <div class="group-title">{{ t('mainPlan.basicMaintenanceRecords') }}</div>
  168. <!-- 里程配置 -->
  169. <el-form-item
  170. v-if="configDialog.current?.mileageRule === 0"
  171. :label="t('mainPlan.lastMaintenanceMileage')"
  172. prop="lastRunningKilometers"
  173. >
  174. <el-input-number
  175. v-model="configDialog.form.lastRunningKilometers"
  176. :precision="2"
  177. :min="0"
  178. controls-position="right"
  179. :controls="false"
  180. style="width: 80%"
  181. />
  182. </el-form-item>
  183. <!-- 运行时间配置 -->
  184. <el-form-item
  185. v-if="configDialog.current?.runningTimeRule === 0"
  186. :label="t('mainPlan.lastMaintenanceOperationTime')"
  187. prop="lastRunningTime"
  188. >
  189. <el-input-number
  190. v-model="configDialog.form.lastRunningTime"
  191. :precision="1"
  192. :min="0"
  193. controls-position="right"
  194. :controls="false"
  195. style="width: 80%"
  196. />
  197. </el-form-item>
  198. <!-- 自然日期配置 -->
  199. <el-form-item
  200. v-if="configDialog.current?.naturalDateRule === 0"
  201. :label="t('mainPlan.lastMaintenanceNaturalDate')"
  202. prop="lastNaturalDate"
  203. >
  204. <el-date-picker
  205. v-model="configDialog.form.lastNaturalDate"
  206. type="date"
  207. placeholder="选择日期"
  208. format="YYYY-MM-DD"
  209. value-format="YYYY-MM-DD"
  210. style="width: 80%"
  211. />
  212. </el-form-item>
  213. </div>
  214. <div class="form-group" v-if="configDialog.current?.mileageRule === 0">
  215. <div class="group-title">{{ t('mainPlan.operatingMileageRuleConfiguration') }}</div>
  216. <!-- 保养规则周期值 + 提前量 -->
  217. <el-form-item
  218. v-if="configDialog.current?.mileageRule === 0"
  219. :label="t('mainPlan.operatingMileageCycle')"
  220. prop="nextRunningKilometers"
  221. >
  222. <el-input-number
  223. v-model="configDialog.form.nextRunningKilometers"
  224. :precision="2"
  225. :min="0"
  226. controls-position="right"
  227. :controls="false"
  228. style="width: 80%"
  229. />
  230. </el-form-item>
  231. <el-form-item
  232. v-if="configDialog.current?.mileageRule === 0"
  233. :label="t('mainPlan.OperatingMileageCycle_lead')"
  234. prop="kiloCycleLead"
  235. >
  236. <el-input-number
  237. v-model="configDialog.form.kiloCycleLead"
  238. :precision="2"
  239. :min="0"
  240. controls-position="right"
  241. :controls="false"
  242. style="width: 80%"
  243. />
  244. </el-form-item>
  245. </div>
  246. <div class="form-group" v-if="configDialog.current?.runningTimeRule === 0">
  247. <div class="group-title">{{ t('mainPlan.RunTimeRuleConfiguration') }}</div>
  248. <el-form-item
  249. v-if="configDialog.current?.runningTimeRule === 0"
  250. :label="t('mainPlan.RunTimeCycle')"
  251. prop="nextRunningTime"
  252. >
  253. <el-input-number
  254. v-model="configDialog.form.nextRunningTime"
  255. :precision="1"
  256. :min="0"
  257. controls-position="right"
  258. :controls="false"
  259. style="width: 80%"
  260. />
  261. </el-form-item>
  262. <el-form-item
  263. v-if="configDialog.current?.runningTimeRule === 0"
  264. :label="t('mainPlan.RunTimeCycle_Lead')"
  265. prop="timePeriodLead"
  266. >
  267. <el-input-number
  268. v-model="configDialog.form.timePeriodLead"
  269. :precision="1"
  270. :min="0"
  271. controls-position="right"
  272. :controls="false"
  273. style="width: 80%"
  274. />
  275. </el-form-item>
  276. </div>
  277. <div class="form-group" v-if="configDialog.current?.naturalDateRule === 0">
  278. <div class="group-title">{{ t('mainPlan.NaturalDayRuleConfig') }}</div>
  279. <el-form-item
  280. v-if="configDialog.current?.naturalDateRule === 0"
  281. :label="t('mainPlan.NaturalDailyCycle') "
  282. prop="nextNaturalDate"
  283. >
  284. <el-input-number
  285. v-model="configDialog.form.nextNaturalDate"
  286. :min="0"
  287. controls-position="right"
  288. :controls="false"
  289. style="width: 80%"
  290. />
  291. </el-form-item>
  292. <el-form-item
  293. v-if="configDialog.current?.naturalDateRule === 0"
  294. :label="t('mainPlan.NaturalDailyCycle_Lead') "
  295. prop="naturalDatePeriodLead"
  296. >
  297. <el-input-number
  298. v-model="configDialog.form.naturalDatePeriodLead"
  299. :min="0"
  300. controls-position="right"
  301. :controls="false"
  302. style="width: 80%"
  303. />
  304. </el-form-item>
  305. </div>
  306. <!-- 运行记录模板中 多个 累计运行时长 累计运行里程 属性匹配-->
  307. <div class="form-group"
  308. v-if="(configDialog.current?.runningTimeRule === 0 || configDialog.current?.mileageRule === 0)
  309. && (configDialog.current?.timeAccumulatedAttrs?.length || configDialog.current?.mileageAccumulatedAttrs?.length)
  310. && !configDialog.current.totalRunTime && !configDialog.current.totalMileage" >
  311. <div class="group-title">{{ t('mainPlan.accumulatedParams') }}</div>
  312. <!-- 累计运行时长 -->
  313. <el-form-item
  314. v-if="configDialog.current?.runningTimeRule === 0
  315. && configDialog.current?.timeAccumulatedAttrs?.length && !configDialog.current.totalRunTime"
  316. :label="t('mainPlan.accumulatedRunTime')"
  317. prop="accumulatedTimeOption"
  318. :rules="[{
  319. required: configDialog.current?.runningTimeRule === 0 && configDialog.current?.timeAccumulatedAttrs?.length,
  320. message: '请选择累计运行时长',
  321. trigger: 'change'
  322. }]"
  323. >
  324. <el-select
  325. v-model="configDialog.form.accumulatedTimeOption"
  326. placeholder="请选择累计运行时长"
  327. style="width: 80%"
  328. clearable
  329. @change="handleAccumulatedTimeChange"
  330. >
  331. <el-option
  332. v-for="(item, index) in configDialog.current.timeAccumulatedAttrs"
  333. :key="`time-${item.pointName}-${index}`"
  334. :label="item.pointName"
  335. :value="item.pointName"
  336. />
  337. </el-select>
  338. </el-form-item>
  339. <!-- 累计运行公里数 -->
  340. <el-form-item
  341. v-if="configDialog.current?.mileageRule === 0
  342. && configDialog.current?.mileageAccumulatedAttrs?.length && !configDialog.current.totalMileage"
  343. :label="t('mainPlan.accumulatedMileage')"
  344. prop="accumulatedMileageOption"
  345. :rules="[{
  346. required: configDialog.current?.mileageRule === 0 && configDialog.current?.mileageAccumulatedAttrs?.length,
  347. message: '请选择累计运行公里数',
  348. trigger: 'change'
  349. }]"
  350. >
  351. <el-select
  352. v-model="configDialog.form.accumulatedMileageOption"
  353. placeholder="请选择累计运行公里数"
  354. style="width: 80%"
  355. clearable
  356. @change="handleAccumulatedMileageChange"
  357. >
  358. <el-option
  359. v-for="(item, index) in configDialog.current.mileageAccumulatedAttrs"
  360. :key="`mileage-${item.pointName}-${index}`"
  361. :label="item.pointName"
  362. :value="item.pointName"
  363. />
  364. </el-select>
  365. </el-form-item>
  366. </div>
  367. </el-form>
  368. <template #footer>
  369. <el-button @click="configDialog.visible = false">{{ t('common.cancel') }}</el-button>
  370. <el-button type="primary" @click="saveConfig">{{ t('common.save') }}</el-button>
  371. </template>
  372. </el-dialog>
  373. </template>
  374. <script setup lang="ts">
  375. import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
  376. import * as UserApi from '@/api/system/user'
  377. import { useUserStore } from '@/store/modules/user'
  378. import { ref, computed, nextTick } from 'vue'
  379. import { IotMaintenanceBomApi, IotMaintenanceBomVO } from '@/api/pms/iotmaintenancebom'
  380. import { IotMaintenancePlanApi, IotMaintenancePlanVO } from '@/api/pms/maintenance'
  381. import { useTagsViewStore } from '@/store/modules/tagsView'
  382. import {CACHE_KEY, useCache} from "@/hooks/web/useCache";
  383. import MainPlanDeviceList from "@/views/pms/maintenance/MainPlanDeviceList.vue";
  384. import * as DeptApi from "@/api/system/dept";
  385. import {erpPriceTableColumnFormatter} from "@/utils";
  386. import dayjs from 'dayjs'
  387. /** 保养计划 表单 */
  388. defineOptions({ name: 'IotAddMainPlan' })
  389. const { t } = useI18n() // 国际化
  390. const message = useMessage() // 消息弹窗
  391. const { delView } = useTagsViewStore() // 视图操作
  392. const { currentRoute, push } = useRouter()
  393. const deptUsers = ref<UserApi.UserVO[]>([]) // 用户列表
  394. const dept = ref() // 当前登录人所属部门对象
  395. const configFormRef = ref() // 配置弹出框对象
  396. const dialogTitle = ref('') // 弹窗的标题
  397. const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
  398. const formType = ref('') // 表单的类型:create - 新增;update - 修改
  399. const deviceLabel = ref('') // 表单的类型:create - 新增;update - 修改
  400. const list = ref<IotMaintenanceBomVO[]>([]) // 设备bom关联列表的数据
  401. const deviceIds = ref<number[]>([]) // 已经选择的设备id数组
  402. // 分页相关变量
  403. const currentPage = ref(1)
  404. const pageSize = ref(10)
  405. // 计算分页后的数据
  406. const pagedList = computed(() => {
  407. const start = (currentPage.value - 1) * pageSize.value;
  408. const end = Math.min(start + pageSize.value, list.value.length);
  409. return list.value.slice(start, end);
  410. });
  411. // 处理页码变化
  412. const handlePageChange = (page: number) => {
  413. currentPage.value = page
  414. }
  415. // 处理每页数量变化
  416. const handleSizeChange = (size: number) => {
  417. pageSize.value = size
  418. // currentPage.value = 1 // 重置到第一页
  419. // 添加以下两行防止页码越界
  420. const maxPage = Math.ceil(list.value.length / size);
  421. if (currentPage.value > maxPage) currentPage.value = maxPage;
  422. }
  423. const { params, name } = useRoute() // 查询参数
  424. const id = params.id
  425. const formData = ref({
  426. id: undefined,
  427. deptId: undefined,
  428. name: '',
  429. serialNumber: undefined,
  430. responsiblePerson: undefined,
  431. remark: undefined,
  432. failureName: undefined,
  433. status: undefined,
  434. devicePersons: '',
  435. })
  436. const formRules = reactive({
  437. name: [{ required: true, message: '计划名称不能为空', trigger: 'blur' }],
  438. responsiblePerson: [{ required: true, message: '责任人不能为空', trigger: 'blur' }],
  439. })
  440. const formRef = ref() // 表单 Ref
  441. // 新增配置相关状态
  442. const configDialog = reactive({
  443. visible: false,
  444. current: null as IotMaintenanceBomVO | null,
  445. form: {
  446. lastRunningKilometers: 0,
  447. lastRunningTime: 0,
  448. lastNaturalDate: '',
  449. // 保养规则 周期
  450. nextRunningKilometers: 0,
  451. nextRunningTime: 0,
  452. nextNaturalDate: 0,
  453. // 提前量
  454. kiloCycleLead: 0,
  455. timePeriodLead: 0,
  456. naturalDatePeriodLead: 0,
  457. // 多个累计时长 累计里程 匹配
  458. accumulatedTimeOption: null, // 累计运行时长选项
  459. accumulatedMileageOption: null, // 累计运行公里数选项
  460. }
  461. })
  462. // 单元格类名回调方法
  463. const cellClassName = ({ row, column }) => {
  464. // 只对序号列进行处理
  465. if (column.type === 'index') {
  466. // 检查该行所有启用的规则是否都已配置完整
  467. if (checkRowFilled(row)) {
  468. return 'all-filled'; // 返回自定义类名
  469. }
  470. }
  471. return '';
  472. };
  473. // 检查行数据是否完整填写
  474. const checkRowFilled = (row: IotMaintenanceBomVO) => {
  475. // 检查是否启用了至少一个规则
  476. const hasRuleEnabled =
  477. row.mileageRule === 0 ||
  478. row.runningTimeRule === 0 ||
  479. row.naturalDateRule === 0;
  480. if (!hasRuleEnabled) {
  481. return false; // 没有任何规则启用,不显示背景色
  482. }
  483. // 检查里程规则
  484. const mileageFilled = row.mileageRule !== 0
  485. ? true // 规则未启用,视为已"填写"
  486. : (row.lastRunningKilometers > 0 &&
  487. row.nextRunningKilometers > 0 &&
  488. row.kiloCycleLead > 0 &&
  489. // 检查累计里程参数是否已选择(当条件满足时)
  490. (!(row.mileageAccumulatedAttrs?.length && !row.totalMileage) ||
  491. (row.mileageAccumulatedAttrs?.length && !row.totalMileage && row.type)));
  492. // 检查运行时间规则
  493. const runningTimeFilled = row.runningTimeRule !== 0
  494. ? true
  495. : (row.lastRunningTime > 0 &&
  496. row.nextRunningTime > 0 &&
  497. row.timePeriodLead > 0 &&
  498. // 检查累计时间参数是否已选择(当条件满足时)
  499. (!(row.timeAccumulatedAttrs?.length && !row.totalRunTime) ||
  500. (row.timeAccumulatedAttrs?.length && !row.totalRunTime && row.code)));
  501. // 检查自然日期规则
  502. const naturalDateFilled = row.naturalDateRule !== 0
  503. ? true
  504. : (row.lastNaturalDate &&
  505. row.nextNaturalDate > 0 &&
  506. row.naturalDatePeriodLead > 0);
  507. return mileageFilled && runningTimeFilled && naturalDateFilled;
  508. };
  509. // 打开配置对话框
  510. const openConfigDialog = (row: IotMaintenanceBomVO) => {
  511. // 新增规则校验:至少一个规则开启
  512. if (row.mileageRule !== 0 && row.runningTimeRule !== 0 && row.naturalDateRule !== 0) {
  513. message.error('请先设置保养规则')
  514. return
  515. }
  516. configDialog.current = row
  517. // 处理日期初始化(核心修改)
  518. let initialDate = ''
  519. if (row.lastNaturalDate) {
  520. // 如果已有值:时间戳 -> 日期字符串
  521. initialDate = dayjs(row.lastNaturalDate).format('YYYY-MM-DD')
  522. } else {
  523. // 如果无值:设置默认值避免1970问题
  524. initialDate = ''
  525. }
  526. configDialog.form = {
  527. lastRunningKilometers: row.lastRunningKilometers || 0,
  528. lastRunningTime: row.lastRunningTime || 0,
  529. // 时间戳 -> Date对象(用于日期选择器)
  530. lastNaturalDate: row.lastNaturalDate
  531. ? dayjs(row.lastNaturalDate).format('YYYY-MM-DD')
  532. : null,
  533. // 保养规则 周期值
  534. nextRunningKilometers: row.nextRunningKilometers || 0,
  535. nextRunningTime: row.nextRunningTime || 0,
  536. nextNaturalDate: row.nextNaturalDate || 0,
  537. // 提前量
  538. kiloCycleLead: row.kiloCycleLead || 0,
  539. timePeriodLead: row.timePeriodLead || 0,
  540. naturalDatePeriodLead: row.naturalDatePeriodLead || 0,
  541. // 多个累计时长 累计里程 匹配
  542. accumulatedTimeOption: null, // 累计运行时长选项
  543. accumulatedMileageOption: null, // 累计运行公里数选项
  544. }
  545. // 初始化累计参数选择
  546. configDialog.form.accumulatedTimeOption = row.isRuntimeFromTemp
  547. ? row.code
  548. : null;
  549. configDialog.form.accumulatedMileageOption = row.isMileageFromTemp
  550. ? row.type
  551. : null;
  552. configDialog.visible = true
  553. }
  554. // 保存配置
  555. const saveConfig = () => {
  556. (configFormRef.value as any).validate((valid: boolean) => {
  557. if (!valid) return
  558. if (!configDialog.current) return
  559. // 累计运行时长配置 校验逻辑
  560. if (configDialog.current.runningTimeRule === 0 &&
  561. configDialog.current.timeAccumulatedAttrs?.length &&
  562. !configDialog.form.accumulatedTimeOption) {
  563. message.error('请选择累计运行时长');
  564. return;
  565. }
  566. // 累计运行公里数配置 校验逻辑
  567. if (configDialog.current.mileageRule === 0 &&
  568. configDialog.current.mileageAccumulatedAttrs?.length &&
  569. !configDialog.form.accumulatedMileageOption) {
  570. message.error('请选择累计运行公里数');
  571. return;
  572. }
  573. // 动态校验逻辑
  574. const requiredFields = []
  575. if (configDialog.current.mileageRule === 0) {
  576. requiredFields.push('nextRunningKilometers', 'kiloCycleLead')
  577. }
  578. if (configDialog.current.runningTimeRule === 0) {
  579. requiredFields.push('nextRunningTime', 'timePeriodLead')
  580. }
  581. if (configDialog.current.naturalDateRule === 0) {
  582. requiredFields.push('nextNaturalDate', 'naturalDatePeriodLead')
  583. }
  584. const missingFields = requiredFields.filter(field =>
  585. !configDialog.form[field as keyof typeof configDialog.form]
  586. )
  587. if (missingFields.length > 0) {
  588. message.error('请填写所有必填项')
  589. return
  590. }
  591. // 强制校验逻辑
  592. if (configDialog.current.naturalDateRule === 0) {
  593. if (!configDialog.form.lastNaturalDate) {
  594. message.error('必须选择自然日期')
  595. return
  596. }
  597. // 验证日期有效性
  598. const dateValue = dayjs(configDialog.form.lastNaturalDate)
  599. if (!dateValue.isValid()) {
  600. message.error('日期格式不正确')
  601. return
  602. }
  603. }
  604. // 转换逻辑(关键修改)
  605. const finalDate = configDialog.form.lastNaturalDate
  606. ? dayjs(configDialog.form.lastNaturalDate).valueOf()
  607. : null // 改为null而不是0
  608. const updateData = {
  609. ...configDialog.form,
  610. lastNaturalDate: finalDate,
  611. };
  612. // 处理累计运行时长
  613. // 当规则关闭时,无论是否有选择值,都清除相关数据
  614. if (configDialog.current.runningTimeRule !== 0) {
  615. configDialog.current.code = null;
  616. configDialog.current.totalRunTime = null;
  617. configDialog.form.accumulatedTimeOption = null; // 清除选择值
  618. } else if (configDialog.form.accumulatedTimeOption) {
  619. // 查找选中的累计运行时长项
  620. const selectedTimeOption = configDialog.current.timeAccumulatedAttrs?.find(
  621. item => item.pointName === configDialog.form.accumulatedTimeOption
  622. );
  623. if (selectedTimeOption) {
  624. configDialog.current.code = selectedTimeOption.pointName;
  625. // 优先使用接口值,没有则使用临时值
  626. configDialog.current.tempTotalRunTime = selectedTimeOption.totalRunTime;
  627. configDialog.current.isRuntimeFromTemp = true;
  628. // 只有接口未提供值时才使用临时值
  629. if (!configDialog.current.totalRunTime) {
  630. // configDialog.current.totalRunTime = selectedTimeOption.totalRunTime;
  631. }
  632. }
  633. }
  634. if (configDialog.current.mileageRule !== 0) {
  635. configDialog.current.type = null;
  636. configDialog.current.totalMileage = null;
  637. configDialog.form.accumulatedMileageOption = null; // 清除选择值
  638. } else if (configDialog.form.accumulatedMileageOption) {
  639. // 查找选中的累计运行公里数项
  640. const selectedMileageOption = configDialog.current.mileageAccumulatedAttrs?.find(
  641. item => item.pointName === configDialog.form.accumulatedMileageOption
  642. );
  643. if (selectedMileageOption) {
  644. configDialog.current.type = selectedMileageOption.pointName;
  645. configDialog.current.tempTotalMileage = selectedMileageOption.totalRunTime;
  646. configDialog.current.isMileageFromTemp = true;
  647. if (!configDialog.current.totalMileage) {
  648. // configDialog.current.totalMileage = selectedMileageOption.totalRunTime;
  649. }
  650. }
  651. }
  652. // 更新当前行的数据
  653. Object.assign(configDialog.current, updateData);
  654. configDialog.visible = false
  655. })
  656. }
  657. // 累计运行时长变更
  658. const handleAccumulatedTimeChange = (option) => {
  659. }
  660. // 累计运行公里数变更
  661. const handleAccumulatedMileageChange = (option) => {
  662. }
  663. const queryParams = reactive({
  664. deviceIds: undefined,
  665. planId: id,
  666. bomFlag: 'b'
  667. })
  668. // 处理保养规则变化 取消保养规则 时 清空已经设置的相应保养规则数据
  669. const handleRuleChange = (row: IotMaintenanceBomVO, ruleType: 'mileage' | 'runningTime') => {
  670. // 当规则关闭时(inactive-value=1)
  671. console.log('执行了保养规则变化事件' + row.totalRunTime + ' - ' + row.totalMileage)
  672. // 当前保养项行已经返回了 totalRunTime totalMileage 数据 不需要再清空 累计运行时长 累计公里数
  673. // 选择完设备匹配了保养项后 不能直接置空 因为可能是正常的累计时长 累计公里数
  674. if (ruleType === 'runningTime' && row.runningTimeRule === 1) {
  675. // 清除临时来源的值
  676. if (row.isRuntimeFromTemp) {
  677. row.totalRunTime = null;
  678. row.tempTotalRunTime = null;
  679. row.code = null;
  680. // row.isRuntimeFromTemp = false;
  681. }
  682. // 强制清除配置对话框中的值(如果打开的是当前行)
  683. if (configDialog.current?.deviceId === row.deviceId
  684. && configDialog.current?.bomNodeId === row.bomNodeId) {
  685. configDialog.form.accumulatedTimeOption = null;
  686. }
  687. } else if (ruleType === 'mileage' && row.mileageRule === 1) {
  688. if (row.isMileageFromTemp) {
  689. row.totalMileage = null;
  690. row.tempTotalMileage = null;
  691. row.type = null;
  692. // row.isMileageFromTemp = false;
  693. }
  694. // 强制清除配置对话框中的值(如果打开的是当前行)
  695. if (configDialog.current?.deviceId === row.deviceId &&
  696. configDialog.current?.bomNodeId === row.bomNodeId) {
  697. configDialog.form.accumulatedMileageOption = null;
  698. }
  699. }
  700. // 如果配置对话框打开的是当前行,同步清除对话框中的选择值
  701. if (configDialog.visible && configDialog.current &&
  702. configDialog.current.deviceId === row.deviceId &&
  703. configDialog.current.bomNodeId === row.bomNodeId) {
  704. if (ruleType === 'runningTime') {
  705. configDialog.form.accumulatedTimeOption = null;
  706. } else if (ruleType === 'mileage') {
  707. configDialog.form.accumulatedMileageOption = null;
  708. }
  709. }
  710. }
  711. const deviceChoose = async(selectedDevices) => {
  712. const newIds = selectedDevices.map(device => device.id)
  713. deviceIds.value = [...new Set([...deviceIds.value, ...newIds])]
  714. const params = {
  715. deviceIds: newIds.join(',') // 明确传递数组参数
  716. }
  717. queryParams.deviceIds = JSON.parse(JSON.stringify(params.deviceIds))
  718. queryParams.bomFlag = 'b'
  719. // 根据选择的设备筛选出设备BOM中与保养相关的节点项
  720. const res = await IotDeviceApi.deviceAssociateBomList(queryParams)
  721. const rawData = res || []
  722. if(rawData.length === 0){
  723. message.error('选择的设备不存在待保养BOM项')
  724. }
  725. if (!Array.isArray(rawData)) {
  726. console.error('接口返回数据结构异常:', rawData)
  727. return
  728. }
  729. // 创建当前列表的唯一键集合(关键修改)
  730. const existingKeys = new Set(
  731. list.value.map(item => `${item.deviceId}-${item.bomNodeId}`)
  732. )
  733. // 转换数据结构(根据你的接口定义调整)
  734. const newItems = rawData
  735. .filter(device => {
  736. // 排除已存在的项(设备ID+bom节点ID)
  737. const key = `${device.id}-${device.bomNodeId}`
  738. return !existingKeys.has(key)
  739. })
  740. .map(device => ({
  741. assetClass: device.assetClass,
  742. deviceCode: device.deviceCode,
  743. deviceName: device.deviceName,
  744. deviceStatus: device.deviceStatus,
  745. deptName: device.deptName,
  746. name: device.name,
  747. code: device.code,
  748. assetProperty: device.assetProperty,
  749. remark: null, // 初始化备注
  750. deviceId: device.id, // 移除操作需要
  751. bomNodeId: device.bomNodeId,
  752. totalRunTime: device.totalRunTime,
  753. totalMileage: device.totalMileage,
  754. nextRunningKilometers: 0,
  755. nextRunningTime: 0,
  756. nextNaturalDate: 0,
  757. lastNaturalDate: null, // 初始化为null而不是0
  758. // 保养规则 提前量
  759. kiloCycleLead: 0,
  760. timePeriodLead: 0,
  761. naturalDatePeriodLead: 0,
  762. tempTotalRunTime: null,
  763. tempTotalMileage: null,
  764. isRuntimeFromTemp: false,
  765. isMileageFromTemp: false,
  766. // 添加累计时长参数列表 属性
  767. timeAccumulatedAttrs: device.timeAccumulatedAttrs || [],
  768. // 添加累计里程参数列表 属性
  769. mileageAccumulatedAttrs: device.mileageAccumulatedAttrs || []
  770. }))
  771. // 获取选择的设备相关的id数组
  772. newItems.forEach(item => {
  773. deviceIds.value.push(item.deviceId)
  774. })
  775. // 合并到现有列表(去重)
  776. newItems.forEach(item => {
  777. const exists = list.value.some(
  778. existing => (existing.deviceId === item.deviceId && existing.bomNodeId === item.bomNodeId)
  779. )
  780. if (!exists) {
  781. list.value.push(item)
  782. }
  783. })
  784. }
  785. const deviceFormRef = ref<InstanceType<typeof MainPlanDeviceList>>()
  786. const openForm = () => {
  787. deviceFormRef.value?.open();
  788. }
  789. const close = () => {
  790. delView(unref(currentRoute))
  791. push({ name: 'IotMaintenancePlan', params:{}})
  792. }
  793. /** 提交表单 */
  794. const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
  795. const submitForm = async () => {
  796. // 校验表单
  797. await formRef.value.validate()
  798. // 校验表格数据
  799. const isValid = validateTableData()
  800. if (!isValid) return
  801. // 提交请求
  802. formLoading.value = true
  803. try {
  804. // 将值为NULL 的保养规则 设置为 1
  805. list.value.forEach(item => {
  806. // 确保保养规则不为null
  807. item.mileageRule = item.mileageRule ?? 1
  808. item.runningTimeRule = item.runningTimeRule ?? 1
  809. item.naturalDateRule = item.naturalDateRule ?? 1
  810. })
  811. // 转换日期格式
  812. const convertedList = list.value.map(item => ({
  813. ...item,
  814. lastNaturalDate: typeof item.lastNaturalDate === 'number'
  815. ? item.lastNaturalDate
  816. : (item.lastNaturalDate ? dayjs(item.lastNaturalDate).valueOf() : null)
  817. }));
  818. const data = {
  819. mainPlan: formData.value,
  820. mainPlanBom: convertedList
  821. }
  822. if (formType.value === 'create') {
  823. await IotMaintenancePlanApi.createIotMaintenancePlan(data)
  824. message.success(t('common.createSuccess'))
  825. close()
  826. } else {
  827. await IotMaintenancePlanApi.updatePlan(data)
  828. message.success(t('common.updateSuccess'))
  829. close()
  830. }
  831. // 发送操作成功的事件
  832. emit('success')
  833. } finally {
  834. formLoading.value = false
  835. }
  836. }
  837. // 新增表单校验规则
  838. const configFormRules = reactive({
  839. nextRunningKilometers: [{
  840. required: true,
  841. message: '里程周期必须填写',
  842. trigger: 'blur'
  843. }],
  844. kiloCycleLead: [{
  845. required: true,
  846. message: '提前量必须填写',
  847. trigger: 'blur'
  848. }],
  849. nextRunningTime: [{
  850. required: true,
  851. message: '时间周期必须填写',
  852. trigger: 'blur'
  853. }],
  854. timePeriodLead: [{
  855. required: true,
  856. message: '提前量必须填写',
  857. trigger: 'blur'
  858. }],
  859. nextNaturalDate: [{
  860. required: true,
  861. message: '自然日周期必须填写',
  862. trigger: 'blur'
  863. }],
  864. naturalDatePeriodLead: [{
  865. required: true,
  866. message: '提前量必须填写',
  867. trigger: 'blur'
  868. }]
  869. })
  870. /** 校验表格数据 */
  871. const validateTableData = (): boolean => {
  872. let isValid = true
  873. const errorMessages: string[] = []
  874. const noRulesErrorMessages: string[] = [] // 未设置任何保养项规则 的错误提示信息
  875. const noRules: string[] = [] // 行记录中设置了保养规则的记录数量
  876. const configErrors: string[] = [] // 保养规则配置弹出框
  877. let shouldBreak = false;
  878. if (list.value.length === 0) {
  879. errorMessages.push('请至少添加一条设备保养明细')
  880. isValid = false
  881. // 直接返回无需后续校验
  882. message.error('请至少添加一条设备保养明细')
  883. return isValid
  884. }
  885. list.value.forEach((row, index) => {
  886. if (shouldBreak) return;
  887. const rowNumber = index + 1 // 用户可见的行号从1开始
  888. const deviceIdentifier = `${row.deviceCode}-${row.name}` // 设备标识
  889. // 累计参数校验逻辑
  890. if (row.mileageRule === 0 &&
  891. row.mileageAccumulatedAttrs?.length &&
  892. !row.totalMileage &&
  893. !row.type) {
  894. errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行公里数参数`)
  895. isValid = false
  896. }
  897. if (row.runningTimeRule === 0 &&
  898. row.timeAccumulatedAttrs?.length &&
  899. !row.totalRunTime &&
  900. !row.code) {
  901. errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行时长参数`)
  902. isValid = false
  903. }
  904. // 校验逻辑
  905. const checkConfig = (ruleName: string, ruleValue: number, configField: keyof typeof row) => {
  906. if (ruleValue === 0) { // 规则开启
  907. if (!row[configField] || row[configField] <= 0) {
  908. configErrors.push(`第 ${rowNumber} 行(${deviceIdentifier}):请点击【配置】维护${ruleName}上次保养值`)
  909. isValid = false
  910. }
  911. }
  912. }
  913. // 里程校验逻辑
  914. if (row.mileageRule === 0) { // 假设 0 表示开启状态
  915. if (!row.nextRunningKilometers || row.nextRunningKilometers <= 0) {
  916. errorMessages.push(`第 ${rowNumber} 行:开启里程规则必须填写有效的里程周期`)
  917. isValid = false
  918. }
  919. // 再校验配置值
  920. checkConfig('里程', row.mileageRule, 'lastRunningKilometers')
  921. } else {
  922. noRules.push(`第 ${rowNumber} 行:未设置里程规则`)
  923. }
  924. // 运行时间校验逻辑
  925. if (row.runningTimeRule === 0) {
  926. if (!row.nextRunningTime || row.nextRunningTime <= 0) {
  927. errorMessages.push(`第 ${rowNumber} 行:开启运行时间规则必须填写有效的时间周期`)
  928. isValid = false
  929. }
  930. checkConfig('运行时间', row.runningTimeRule, 'lastRunningTime')
  931. } else {
  932. noRules.push(`第 ${rowNumber} 行:未设置运行时间规则`)
  933. }
  934. // 自然日期校验逻辑
  935. if (row.naturalDateRule === 0) {
  936. if (!row.nextNaturalDate) {
  937. errorMessages.push(`第 ${rowNumber} 行:开启自然日期规则必须填写有效的自然日期周期`)
  938. isValid = false
  939. }
  940. checkConfig('自然日期', row.naturalDateRule, 'lastNaturalDate')
  941. } else {
  942. noRules.push(`第 ${rowNumber} 行:未设置自然日期规则`)
  943. }
  944. // 如果选中的一行记录未设置任何保养规则 提示 ‘保养项未设置任何保养规则’
  945. if (noRules.length === 3) {
  946. isValid = false
  947. shouldBreak = true; // 设置标志变量为true,退出循环
  948. noRulesErrorMessages.push('保养项至少设置1个保养规则')
  949. }
  950. noRules.length = 0;
  951. })
  952. if (errorMessages.length > 0) {
  953. message.error('设置保养规则后,请维护对应的周期值')
  954. } else if (noRulesErrorMessages.length > 0) {
  955. message.error(noRulesErrorMessages.pop())
  956. } else if (configErrors.length > 0) {
  957. message.error(configErrors.pop())
  958. }
  959. return isValid
  960. }
  961. // 修改后的排序应用方法
  962. const applySorting = () => {
  963. // 创建新数组并排序
  964. const sortedList = sortDeviceList(list.value)
  965. // 使用Vue的响应式方法更新数组
  966. list.value = sortedList
  967. // 重置分页到第一页
  968. currentPage.value = 1
  969. }
  970. // 保养项排序函数
  971. const sortDeviceList = (devices: IotMaintenanceBomVO[]) => {
  972. // 使用slice()创建数组副本,避免修改原数组
  973. return devices.slice().sort((a, b) => {
  974. // 处理可能的空值
  975. const aCode = a.deviceCode || ''
  976. const bCode = b.deviceCode || ''
  977. const aName = a.name || ''
  978. const bName = b.name || ''
  979. // 设备编码排序
  980. if (aCode !== bCode) {
  981. return aCode.localeCompare(bCode)
  982. }
  983. // 保养项名称排序
  984. return aName.localeCompare(bName)
  985. })
  986. };
  987. /** 重置表单 */
  988. const resetForm = () => {
  989. formData.value = {
  990. id: undefined,
  991. failureName: undefined,
  992. deviceId: undefined,
  993. status: undefined,
  994. ifStop: undefined,
  995. failureTime: undefined,
  996. failureInfluence: undefined,
  997. failureSystem: undefined,
  998. description: undefined,
  999. pic: undefined,
  1000. solution: undefined,
  1001. maintainStartTime: undefined,
  1002. maintainEndTime: undefined,
  1003. remark: undefined,
  1004. deviceName: undefined,
  1005. processInstanceId: undefined,
  1006. auditStatus: undefined,
  1007. deptId: undefined
  1008. }
  1009. formRef.value?.resetFields()
  1010. }
  1011. onMounted(async () => {
  1012. const route = useRoute()
  1013. const deptId = useUserStore().getUser.deptId
  1014. // 优先从路由参数获取部门信息
  1015. if (route.query.deptId && route.query.deptName) {
  1016. formData.value.deptId = Number(route.query.deptId)
  1017. formData.value.name = `${route.query.deptName} - 保养计划`
  1018. } else {
  1019. // 查询当前登录人所属部门名称
  1020. dept.value = await DeptApi.getDept(deptId)
  1021. // 根据当前登录人部门信息生成生成 保养计划 名称
  1022. formData.value.name = dept.value.name + ' - 保养计划'
  1023. formData.value.deptId = deptId
  1024. }
  1025. if (id){
  1026. formType.value = 'update'
  1027. const plan = await IotMaintenancePlanApi.getIotMaintenancePlan(id);
  1028. deviceLabel.value = plan.deviceName
  1029. formData.value = plan
  1030. // 查询保养计划明细
  1031. const data = await IotMaintenanceBomApi.getMainPlanBOMs(queryParams);
  1032. list.value = []
  1033. if (Array.isArray(data)) {
  1034. list.value = data.map(item => ({
  1035. ...item,
  1036. // 这里可以添加必要的字段转换(如果有日期等需要格式化的字段)
  1037. lastNaturalDate: item.lastNaturalDate
  1038. }))
  1039. }
  1040. } else {
  1041. formType.value = 'create';
  1042. const { wsCache } = useCache()
  1043. const userInfo = wsCache.get(CACHE_KEY.USER)
  1044. formData.value.responsiblePerson = userInfo.user.id;
  1045. }
  1046. })
  1047. const handleDelete = async (str: string) => {
  1048. try {
  1049. // 1. 记录删除前状态
  1050. const currentPageBeforeDelete = currentPage.value;
  1051. const [deviceIdStr, bomNodeId] = str.split('-')
  1052. const deviceId = parseInt(deviceIdStr)
  1053. // 删除列表项
  1054. const index = list.value.findIndex((item) => (item.deviceId+'-'+item.bomNodeId) === str)
  1055. if (index !== -1) {
  1056. list.value.splice(index, 1)
  1057. deviceIds.value = []
  1058. }
  1059. // 更新设备ID列表(需要检查是否还有该设备的其他项)
  1060. const hasOtherItems = list.value.some(item => item.deviceId === deviceId)
  1061. if (!hasOtherItems) {
  1062. deviceIds.value = deviceIds.value.filter(id => id !== deviceId)
  1063. }
  1064. // message.success('移除成功')
  1065. // 2. 计算新总记录数和总页数
  1066. const newTotal = list.value.length;
  1067. const newTotalPages = Math.ceil(newTotal / pageSize.value);
  1068. // 3. 智能页码调整(核心修正)[1,5](@ref)
  1069. if (newTotal === 0) {
  1070. currentPage.value = 1; // 无数据时回首页
  1071. } else {
  1072. currentPage.value = currentPageBeforeDelete > newTotalPages
  1073. ? newTotalPages // 当前页超出范围时跳末页
  1074. : currentPageBeforeDelete; // 否则保持当前页
  1075. }
  1076. } catch (error) {
  1077. console.error('移除失败:', error)
  1078. message.error('移除失败')
  1079. }
  1080. // 检查是否需要调整页码
  1081. // if (list.value.length > 0 && pagedList.value.length === 0) {
  1082. // currentPage.value = Math.max(1, currentPage.value - 1)
  1083. // }
  1084. }
  1085. </script>
  1086. <style scoped>
  1087. .base-expandable-content {
  1088. overflow: hidden; /* 隐藏溢出的内容 */
  1089. transition: max-height 0.3s ease; /* 平滑过渡效果 */
  1090. }
  1091. :deep(.el-input-number .el-input__inner) {
  1092. text-align: left !important;
  1093. padding-left: 10px; /* 保持左侧间距 */
  1094. }
  1095. /* 分组容器样式 */
  1096. .form-group {
  1097. position: relative;
  1098. border: 1px solid #dcdfe6;
  1099. border-radius: 4px;
  1100. padding: 20px 15px 10px;
  1101. margin-bottom: 18px;
  1102. transition: border-color 0.2s;
  1103. }
  1104. /* 分组标题样式 */
  1105. .group-title {
  1106. position: absolute;
  1107. top: -10px;
  1108. left: 20px;
  1109. background: white;
  1110. padding: 0 8px;
  1111. color: #606266;
  1112. font-size: 12px;
  1113. font-weight: 500;
  1114. }
  1115. /* 确保分页组件右对齐 */
  1116. .el-pagination {
  1117. display: flex;
  1118. justify-content: flex-end;
  1119. margin-top: 20px;
  1120. }
  1121. /* 已完整填写行的背景色 */
  1122. :deep(.el-table .all-filled) {
  1123. background-color: #f0fff3 !important; /* 淡绿色背景 */
  1124. transition: background-color 0.3s ease; /* 平滑过渡效果 */
  1125. }
  1126. </style>