IotMainWorkOrder.vue 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788
  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="8">
  14. <el-form-item :label="t('bomList.name')" prop="name">
  15. <el-input type="text" v-model="formData.name" />
  16. </el-form-item>
  17. </el-col>
  18. <el-col :span="8">
  19. <el-form-item :label="t('mainPlan.MaintenanceMethod')" prop="type">
  20. <el-select v-model="formData.outsourcingFlag" :placeholder="t('faultForm.choose')" clearable>
  21. <el-option
  22. v-for="dict in getIntDictOptions(DICT_TYPE.PMS_ORDER_PROCESS_MODE)"
  23. :key="dict.value"
  24. :label="dict.label"
  25. :value="dict.value"
  26. />
  27. </el-select>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="8">
  31. <el-form-item :label="t('mainPlan.MaintenanceCost')" prop="cost">
  32. <el-input
  33. v-model="formData.cost"
  34. placeholder="根据物料消耗自动生成"
  35. disabled
  36. />
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="8">
  40. <el-form-item :label="t('fault.start')" prop="actualStartTime">
  41. <el-date-picker
  42. style="width: 150%"
  43. v-model="formData.actualStartTime"
  44. type="datetime"
  45. value-format="x"
  46. :placeholder="t('fault.start')"
  47. />
  48. </el-form-item>
  49. </el-col>
  50. <el-col :span="8">
  51. <el-form-item :label="t('fault.end')" prop="actualEndTime">
  52. <el-date-picker
  53. style="width: 150%"
  54. v-model="formData.actualEndTime"
  55. type="datetime"
  56. value-format="x"
  57. :placeholder="t('fault.end')"
  58. />
  59. </el-form-item>
  60. </el-col>
  61. <el-col :span="8">
  62. <el-form-item :label="t('mainPlan.otherCost')" prop="otherCost">
  63. <el-input
  64. v-model="formData.otherCost"
  65. @input="handleInput(formData.otherCost, 'otherCost')"
  66. placeholder="其他费用"
  67. />
  68. </el-form-item>
  69. </el-col>
  70. <el-col :span="24">
  71. <el-form-item :label="t('faultForm.remark')" prop="remark">
  72. <el-input v-model="formData.remark" type="textarea" :placeholder="t('faultForm.rHolder')" />
  73. </el-form-item>
  74. </el-col>
  75. </el-row>
  76. </div>
  77. </el-form>
  78. </ContentWrap>
  79. <ContentWrap>
  80. <!-- 列表 -->
  81. <ContentWrap>
  82. <el-table v-loading="loading" :data="paginatedList" :stripe="true" :show-overflow-tooltip="true" :header-cell-style="tableHeaderStyle">
  83. <!-- 添加序号列 -->
  84. <el-table-column
  85. type="index"
  86. :label="t('maintain.serial')"
  87. align="center"
  88. prop="serial"
  89. :width="columnWidths.serial"
  90. fixed="left"
  91. />
  92. <el-table-column :label="t('bomList.bomNode')" align="center" prop="bomNodeId" v-if="false"/>
  93. <el-table-column :label="t('iotDevice.code')" align="center" prop="deviceCode" :width="columnWidths.deviceCode" fixed="left">
  94. <template #default="{ row }">
  95. <div class="full-content-cell"> <!-- 自定义样式 -->
  96. {{ row.deviceCode }}
  97. </div>
  98. </template>
  99. </el-table-column>
  100. <el-table-column :label="t('iotDevice.name')" align="center" prop="deviceName" :width="columnWidths.deviceName" fixed="left">
  101. <template #default="{ row }">
  102. <div class="full-content-cell"> <!-- 自定义样式 -->
  103. {{ row.deviceName }}
  104. </div>
  105. </template>
  106. </el-table-column>
  107. <el-table-column :label="t('mainPlan.MaintItems')" align="center" prop="name"
  108. :show-overflow-tooltip="false" :width="columnWidths.name" fixed="left">
  109. <template #default="{ row }">
  110. <div class="full-content-cell"> <!-- 自定义样式 -->
  111. {{ row.name }}
  112. </div>
  113. </template>
  114. </el-table-column>
  115. <el-table-column :label="t('main.mileage')" key="mileageRule" align="center"
  116. :width="columnWidths.mileageRule" v-if="hasMileageRuleInCurrentPage">
  117. <template #default="scope">
  118. <el-switch
  119. v-model="scope.row.mileageRule"
  120. :active-value="0"
  121. :inactive-value="1"
  122. :disabled="true"
  123. />
  124. </template>
  125. </el-table-column>
  126. <el-table-column :label="t('main.runTime')" key="runningTimeRule" align="center"
  127. :width="columnWidths.runningTimeRule" v-if="hasTimeRuleInCurrentPage">
  128. <template #default="scope">
  129. <el-switch
  130. v-model="scope.row.runningTimeRule"
  131. :active-value="0"
  132. :inactive-value="1"
  133. :disabled="true"
  134. />
  135. </template>
  136. </el-table-column>
  137. <el-table-column :label="t('main.date')" key="naturalDateRule" align="center"
  138. :width="columnWidths.naturalDateRule" v-if="hasDateRuleInCurrentPage">
  139. <template #default="scope">
  140. <el-switch
  141. v-model="scope.row.naturalDateRule"
  142. :active-value="0"
  143. :inactive-value="1"
  144. :disabled="true"
  145. />
  146. </template>
  147. </el-table-column>
  148. <el-table-column :label="t('operationFillForm.sumTime')" align="center" prop="totalRunTime" v-if="hasTimeRuleInCurrentPage"
  149. :formatter="erpPriceTableColumnFormatter" :width="columnWidths.totalRunTime">
  150. <template #default="{ row }">
  151. {{ row.totalRunTime ?? row.tempTotalRunTime }}
  152. </template>
  153. </el-table-column>
  154. <el-table-column :label="t('operationFillForm.sumKil')" align="center" prop="totalMileage" v-if="hasMileageRuleInCurrentPage"
  155. :formatter="erpPriceTableColumnFormatter" :width="columnWidths.totalMileage">
  156. <template #default="{ row }">
  157. {{ row.totalMileage ?? row.tempTotalMileage }}
  158. </template>
  159. </el-table-column>
  160. <el-table-column :label="t('mainPlan.lastMaintenanceDate')" prop="lastMaintenanceDate" :width="columnWidths.lastMaintenanceDate">
  161. <template #default="{ row }">
  162. <div class="full-content-cell">
  163. {{ row.lastMaintenanceDate }}
  164. </div>
  165. </template>
  166. </el-table-column>
  167. <!-- 保养里程 分组 -->
  168. <el-table-column v-if="hasMileageRuleInCurrentPage" label="保养里程" align="center">
  169. <el-table-column :label="t('mainPlan.lastMaintenanceMileage')" align="center" prop="lastRunningKilometers"
  170. :formatter="erpPriceTableColumnFormatter" :width="columnWidths.lastRunningKilometers">
  171. <template #default="{ row }">
  172. {{ row.lastRunningKilometers }}
  173. </template>
  174. </el-table-column>
  175. <el-table-column :label="t('mainPlan.nextMaintenanceKm')"
  176. align="center" prop="nextMaintenanceKm" :width="columnWidths.nextMaintenanceKm">
  177. <template #default="{ row }">
  178. {{ row.nextMaintenanceKm ?? '-' }}
  179. </template>
  180. </el-table-column>
  181. <el-table-column :label="t('mainPlan.remainKm')"
  182. align="center" prop="remainKm" :width="columnWidths.remainKm">
  183. <template #default="{ row }">
  184. {{ row.remainKm ?? '-' }}
  185. </template>
  186. </el-table-column>
  187. </el-table-column>
  188. <!-- 保养时长 分组 -->
  189. <el-table-column v-if="hasTimeRuleInCurrentPage" label="保养时长" align="center">
  190. <el-table-column :label="t('mainPlan.lastMaintenanceOperationTime')" align="center" prop="lastRunningTime"
  191. :formatter="erpPriceTableColumnFormatter" :width="columnWidths.lastRunningTime">
  192. <template #default="{ row }">
  193. {{ row.lastRunningTime }}
  194. </template>
  195. </el-table-column>
  196. <el-table-column :label="t('mainPlan.nextMaintenanceH')"
  197. align="center" prop="nextMaintenanceH" :width="columnWidths.nextMaintenanceH">
  198. <template #default="{ row }">
  199. {{ row.nextMaintenanceH ?? '-' }}
  200. </template>
  201. </el-table-column>
  202. <el-table-column :label="t('mainPlan.remainH')"
  203. align="center" prop="remainH" :width="columnWidths.remainH">
  204. <template #default="{ row }">
  205. {{ row.remainH ?? '-' }}
  206. </template>
  207. </el-table-column>
  208. <el-table-column
  209. v-if="shouldShowRunningTimeColumn"
  210. :label="t('mainPlan.RunTimeCycle')"
  211. align="center"
  212. prop="nextRunningTime"
  213. :width="columnWidths.nextRunningTime"
  214. >
  215. <template #default="scope">
  216. <el-input-number
  217. v-if="scope.row.runningTimeRule === 0"
  218. v-model="scope.row.nextRunningTime"
  219. :precision="1"
  220. :min="1"
  221. :controls="false"
  222. style="width: 100%"
  223. @change="validateRunningTime(scope.row)"
  224. />
  225. <span v-else>-</span>
  226. <!-- 错误提示 -->
  227. <div v-if="scope.row.timeError" class="error-text">
  228. {{ scope.row.timeError }}
  229. </div>
  230. </template>
  231. </el-table-column>
  232. </el-table-column>
  233. <!-- 保养日期 分组 -->
  234. <el-table-column v-if="hasDateRuleInCurrentPage" label="保养日期" align="center">
  235. <el-table-column :label="t('mainPlan.lastMaintenanceNaturalDate')" align="center" prop="tempLastNaturalDate"
  236. :formatter="erpPriceTableColumnFormatter" :width="columnWidths.tempLastNaturalDate">
  237. <template #default="{ row }">
  238. {{ row.tempLastNaturalDate }}
  239. </template>
  240. </el-table-column>
  241. <el-table-column :label="t('mainPlan.nextMaintDate')"
  242. align="center" prop="nextMaintenanceDate" :width="columnWidths.nextMaintenanceDate">
  243. <template #default="{ row }">
  244. {{ row.nextMaintenanceDate ?? '-' }}
  245. </template>
  246. </el-table-column>
  247. <el-table-column :label="t('mainPlan.remainDay')"
  248. align="center" prop="remainDay" :width="columnWidths.remainDay">
  249. <template #default="{ row }">
  250. {{ row.remainDay ?? '-' }}
  251. </template>
  252. </el-table-column>
  253. </el-table-column>
  254. <el-table-column :label="t('common.status')" align="center" width="100">
  255. <template #default="scope">
  256. {{ getStatusText(scope.row) }}
  257. </template>
  258. </el-table-column>
  259. <el-table-column :label="t('iotMaintain.numberOfMaterials')" align="center" width="90">
  260. <template #default="scope">
  261. {{ getMaterialCount(scope.row.bomNodeId) }}
  262. </template>
  263. </el-table-column>
  264. <el-table-column :label="t('iotMaintain.operation')" align="center" prop="operation" :width="columnWidths.operation" fixed="right">
  265. <template #default="scope">
  266. <div class="horizontal-actions">
  267. <!-- 查看当前保养项已经绑定的物料列表 -->
  268. <el-tooltip
  269. v-if="scope.row.deviceBomMaterials && scope.row.deviceBomMaterials.length > 0"
  270. effect="dark"
  271. :content="t('mainPlan.deviceBomMaterials')"
  272. placement="top"
  273. :show-after="300"
  274. >
  275. <el-button
  276. type="primary"
  277. link
  278. :icon="View"
  279. @click="handleDropdownCommand({ action: 'deviceBomMaterials', row: scope.row })"
  280. class="action-button"
  281. />
  282. </el-tooltip>
  283. <!-- 延迟保养按钮 -->
  284. <el-tooltip
  285. v-if="scope.row.status === 0"
  286. effect="dark"
  287. :content="t('stock.DelayMaintenance')"
  288. placement="top"
  289. :show-after="300"
  290. >
  291. <el-button
  292. type="primary"
  293. link
  294. :icon="Clock"
  295. @click="handleDropdownCommand({ action: 'delay', row: scope.row })"
  296. class="action-button"
  297. />
  298. </el-tooltip>
  299. <!-- 选择物料按钮 -->
  300. <el-tooltip
  301. v-if="scope.row.status === 0"
  302. effect="dark"
  303. :content="t('stock.selectMaterial')"
  304. placement="top"
  305. :show-after="300"
  306. >
  307. <el-button
  308. type="primary"
  309. link
  310. :icon="Box"
  311. @click="handleDropdownCommand({ action: 'material', row: scope.row })"
  312. class="action-button"
  313. />
  314. </el-tooltip>
  315. <!-- 物料详情按钮 -->
  316. <el-tooltip
  317. effect="dark"
  318. :content="t('bomList.materialDetail')"
  319. placement="top"
  320. :show-after="300"
  321. >
  322. <el-button
  323. type="primary"
  324. link
  325. :icon="Document"
  326. @click="handleDropdownCommand({ action: 'detail', row: scope.row })"
  327. class="action-button"
  328. />
  329. </el-tooltip>
  330. </div>
  331. </template>
  332. </el-table-column>
  333. </el-table>
  334. <div style="margin-top: 20px; display: flex; justify-content: flex-end;">
  335. <el-pagination
  336. v-model:current-page="currentPage"
  337. v-model:page-size="pageSize"
  338. :page-sizes="[10]"
  339. :background="true"
  340. layout="total, sizes, prev, pager, next, jumper"
  341. :total="list.length"
  342. @current-change="handleCurrentChange"
  343. @size-change="handleSizeChange"
  344. />
  345. </div>
  346. </ContentWrap>
  347. <!-- 选择的物料列表 -->
  348. <ContentWrap>
  349. <el-table v-loading="false" :data="materialList" :stripe="true" :show-overflow-tooltip="true" v-if="false">
  350. <el-table-column :label="t('bomList.bomNode')" align="center" prop="bomNodeId" />
  351. <el-table-column label="工厂id" align="center" prop="factoryId" v-if="false"/>
  352. <el-table-column label="工厂名称" align="center" prop="factory" v-if="false"/>
  353. <el-table-column label="成本中心id" align="center" prop="costCenterId" v-if="false"/>
  354. <el-table-column label="成本中心名称" align="center" prop="costCenter" v-if="false"/>
  355. <el-table-column label="库存地点id" align="center" prop="storageLocationId" v-if="false"/>
  356. <el-table-column label="库存地点名称" align="center" prop="projectDepartment" v-if="false"/>
  357. <el-table-column label="物料编码" align="center" prop="materialCode" />
  358. <el-table-column label="物料名称" align="center" prop="materialName" />
  359. <el-table-column label="单位" align="center" prop="unit" />
  360. <el-table-column label="单价(CNY/元)" align="center" prop="unitPrice" :formatter="erpPriceTableColumnFormatter"/>
  361. <el-table-column label="消耗数量" align="center" prop="quantity" />
  362. <el-table-column label="总库存数量" align="center" prop="totalInventoryQuantity" />
  363. </el-table>
  364. </ContentWrap>
  365. </ContentWrap>
  366. <ContentWrap>
  367. <el-form>
  368. <el-form-item style="float: right">
  369. <el-button @click="submitForm" type="primary" :disabled="formLoading">{{t('common.save')}}</el-button>
  370. <el-button @click="close">{{t('common.cancel')}}</el-button>
  371. </el-form-item>
  372. </el-form>
  373. </ContentWrap>
  374. <!-- 新增配置对话框 -->
  375. <el-dialog
  376. v-model="configDialog.visible"
  377. :title="`设备 ${configDialog.current?.deviceCode+'-'+configDialog.current?.name} 保养配置`"
  378. width="600px"
  379. >
  380. <!-- 使用header插槽自定义标题 -->
  381. <template #header>
  382. <span>设备 <strong>{{ configDialog.current?.deviceCode }}-{{ configDialog.current?.name }}</strong> 保养项配置</span>
  383. </template>
  384. <el-form :model="configDialog.form" label-width="200px" :rules="configFormRules" ref="configFormRef">
  385. <div class="form-group">
  386. <div class="group-title">{{ t('mainPlan.basicMaintenanceRecords') }}</div>
  387. <!-- 里程配置 -->
  388. <el-form-item
  389. v-if="configDialog.current?.mileageRule === 0"
  390. :label="t('mainPlan.lastMaintenanceMileage')"
  391. prop="lastRunningKilometers"
  392. >
  393. <el-input-number
  394. v-model="configDialog.form.lastRunningKilometers"
  395. :precision="2"
  396. :min="0"
  397. controls-position="right"
  398. :controls="false"
  399. style="width: 60%"
  400. :disabled="true"
  401. />
  402. </el-form-item>
  403. <!-- 推迟公里数 -->
  404. <el-form-item
  405. v-if="configDialog.current?.mileageRule === 0"
  406. :label="t('mainPlan.DelayKil')"
  407. prop="delayKilometers"
  408. >
  409. <el-input-number
  410. v-model="configDialog.form.delayKilometers"
  411. :precision="2"
  412. :min="0"
  413. controls-position="right"
  414. :controls="false"
  415. style="width: 60%"
  416. />
  417. </el-form-item>
  418. <!-- 运行时间配置 -->
  419. <el-form-item
  420. v-if="configDialog.current?.runningTimeRule === 0"
  421. :label="t('mainPlan.lastMaintenanceOperationTime')"
  422. prop="lastRunningTime"
  423. >
  424. <el-input-number
  425. v-model="configDialog.form.lastRunningTime"
  426. :precision="1"
  427. :min="0"
  428. controls-position="right"
  429. :controls="false"
  430. style="width: 60%"
  431. :disabled="true"
  432. />
  433. </el-form-item>
  434. <!-- 推迟时长 -->
  435. <el-form-item
  436. v-if="configDialog.current?.runningTimeRule === 0"
  437. :label="t('mainPlan.DelayDuration')"
  438. prop="delayDuration"
  439. >
  440. <el-input-number
  441. v-model="configDialog.form.delayDuration"
  442. :precision="2"
  443. :min="0"
  444. controls-position="right"
  445. :controls="false"
  446. style="width: 60%"
  447. />
  448. </el-form-item>
  449. <!-- 自然日期配置 -->
  450. <el-form-item
  451. v-if="configDialog.current?.naturalDateRule === 0"
  452. :label="t('mainPlan.lastMaintenanceNaturalDate')"
  453. prop="lastNaturalDate"
  454. >
  455. <el-date-picker
  456. v-model="configDialog.form.lastNaturalDate"
  457. type="date"
  458. placeholder="选择日期"
  459. format="YYYY-MM-DD"
  460. value-format="YYYY-MM-DD"
  461. style="width: 60%"
  462. :disabled="true"
  463. />
  464. </el-form-item>
  465. <!-- 推迟自然日期 -->
  466. <el-form-item
  467. v-if="configDialog.current?.naturalDateRule === 0"
  468. :label="t('mainPlan.DelayDate')"
  469. prop="delayNaturalDate"
  470. >
  471. <el-input-number
  472. v-model="configDialog.form.delayNaturalDate"
  473. :precision="2"
  474. :min="0"
  475. controls-position="right"
  476. :controls="false"
  477. style="width: 60%"
  478. />
  479. </el-form-item>
  480. <el-form-item
  481. :label="t('stock.DelayReason')"
  482. prop="delayReason"
  483. v-if="configDialog.current?.mileageRule === 0 ||
  484. configDialog.current?.runningTimeRule === 0 ||
  485. configDialog.current?.naturalDateRule === 0"
  486. >
  487. <el-input
  488. v-model="configDialog.form.delayReason"
  489. type="textarea"
  490. :rows="2"
  491. :placeholder="t('stock.DelayReason')"
  492. style="width: 60%"
  493. />
  494. </el-form-item>
  495. </div>
  496. <div class="form-group" v-if="configDialog.current?.mileageRule === 0">
  497. <div class="group-title">{{ t('mainPlan.operatingMileageRuleConfiguration') }}</div>
  498. <!-- 保养规则周期值 + 提前量 -->
  499. <el-form-item
  500. v-if="configDialog.current?.mileageRule === 0"
  501. :label="t('mainPlan.operatingMileageCycle')"
  502. prop="nextRunningKilometers"
  503. >
  504. <el-input-number
  505. v-model="configDialog.form.nextRunningKilometers"
  506. :precision="2"
  507. :min="0"
  508. controls-position="right"
  509. :controls="false"
  510. style="width: 60%"
  511. :disabled="true"
  512. />
  513. </el-form-item>
  514. <el-form-item
  515. v-if="configDialog.current?.mileageRule === 0"
  516. :label="t('mainPlan.OperatingMileageCycle_lead')"
  517. prop="kiloCycleLead"
  518. >
  519. <el-input-number
  520. v-model="configDialog.form.kiloCycleLead"
  521. :precision="2"
  522. :min="0"
  523. controls-position="right"
  524. :controls="false"
  525. style="width: 60%"
  526. :disabled="true"
  527. />
  528. </el-form-item>
  529. </div>
  530. <div class="form-group" v-if="configDialog.current?.runningTimeRule === 0">
  531. <div class="group-title">{{ t('mainPlan.RunTimeRuleConfiguration') }}</div>
  532. <el-form-item
  533. v-if="configDialog.current?.runningTimeRule === 0"
  534. :label="t('mainPlan.RunTimeCycle')"
  535. prop="nextRunningTime"
  536. >
  537. <el-input-number
  538. v-model="configDialog.form.nextRunningTime"
  539. :precision="1"
  540. :min="0"
  541. controls-position="right"
  542. :controls="false"
  543. style="width: 60%"
  544. :disabled="true"
  545. />
  546. </el-form-item>
  547. <el-form-item
  548. v-if="configDialog.current?.runningTimeRule === 0"
  549. :label="t('mainPlan.RunTimeCycle_Lead')"
  550. prop="timePeriodLead"
  551. >
  552. <el-input-number
  553. v-model="configDialog.form.timePeriodLead"
  554. :precision="1"
  555. :min="0"
  556. controls-position="right"
  557. :controls="false"
  558. style="width: 60%"
  559. :disabled="true"
  560. />
  561. </el-form-item>
  562. </div>
  563. <div class="form-group" v-if="configDialog.current?.naturalDateRule === 0">
  564. <div class="group-title">{{ t('mainPlan.NaturalDayRuleConfig') }}</div>
  565. <el-form-item
  566. v-if="configDialog.current?.naturalDateRule === 0"
  567. :label="t('mainPlan.NaturalDailyCycle') "
  568. prop="nextNaturalDate"
  569. >
  570. <el-input-number
  571. v-model="configDialog.form.nextNaturalDate"
  572. :min="0"
  573. controls-position="right"
  574. :controls="false"
  575. style="width: 60%"
  576. :disabled="true"
  577. />
  578. </el-form-item>
  579. <el-form-item
  580. v-if="configDialog.current?.naturalDateRule === 0"
  581. :label="t('mainPlan.NaturalDailyCycle_Lead') "
  582. prop="naturalDatePeriodLead"
  583. >
  584. <el-input-number
  585. v-model="configDialog.form.naturalDatePeriodLead"
  586. :min="0"
  587. controls-position="right"
  588. :controls="false"
  589. style="width: 60%"
  590. :disabled="true"
  591. />
  592. </el-form-item>
  593. </div>
  594. </el-form>
  595. <template #footer>
  596. <el-button @click="configDialog.visible = false">{{ t('common.cancel')}}</el-button>
  597. <el-button type="primary" @click="saveConfig">{{ t('common.ok')}}</el-button>
  598. </template>
  599. </el-dialog>
  600. <!-- 表单弹窗:添加/修改 -->
  601. <WorkOrderMaterial ref="materialFormRef" @choose="selectChoose" />
  602. <!-- 设备BOM节点绑定的物料列表 -->
  603. <DeviceBomMaterials ref="deviceBomMaterialsRef" />
  604. <!-- 抽屉组件 展示已经选择的物料 并编辑物料消耗 -->
  605. <MaterialListDrawer
  606. :model-value="drawerVisible"
  607. @update:model-value="val => drawerVisible = val"
  608. :node-id="currentBomNodeId"
  609. :materials="materialList.filter(item => item.bomNodeId === currentBomNodeId)"
  610. @delete="handleDeleteMaterial"
  611. :hide-extra-columns="hideExtraColumnsInDrawer"
  612. />
  613. </template>
  614. <script setup lang="ts">
  615. import * as UserApi from '@/api/system/user'
  616. import { useUserStore } from '@/store/modules/user'
  617. import { ref } from 'vue'
  618. import { useRouter } from 'vue-router'
  619. import { IotMaintenanceBomApi, IotMaintenanceBomVO } from '@/api/pms/iotmaintenancebom'
  620. import { IotMainWorkOrderBomApi, IotMainWorkOrderBomVO } from '@/api/pms/iotmainworkorderbom'
  621. import { IotMainWorkOrderBomMaterialApi, IotMainWorkOrderBomMaterialVO } from '@/api/pms/iotmainworkorderbommaterial'
  622. import { IotMainWorkOrderApi, IotMainWorkOrderVO } from '@/api/pms/iotmainworkorder'
  623. import { useTagsViewStore } from '@/store/modules/tagsView'
  624. import * as DeptApi from "@/api/system/dept";
  625. import {erpPriceTableColumnFormatter} from "@/utils";
  626. import dayjs from 'dayjs'
  627. import MaterialListDrawer from "@/views/pms/iotmainworkorder/SelectedMaterialDrawer.vue";
  628. import WorkOrderMaterial from "@/views/pms/iotmainworkorder/WorkOrderMaterial.vue";
  629. import { IotDevicePersonApi, IotDevicePersonVO } from '@/api/pms/iotdeviceperson'
  630. import {DICT_TYPE, getIntDictOptions} from "@/utils/dict";
  631. // 引入图标
  632. import { View, Clock, Box, Document } from '@element-plus/icons-vue';
  633. /** 保养计划 表单 */
  634. defineOptions({ name: 'IotMainWorkOrderBom' })
  635. const { t } = useI18n() // 国际化
  636. const message = useMessage() // 消息弹窗
  637. const { delView } = useTagsViewStore() // 视图操作
  638. const { currentRoute, push } = useRouter()
  639. const deptUsers = ref<UserApi.UserVO[]>([]) // 用户列表
  640. const dept = ref() // 当前登录人所属部门对象
  641. const configFormRef = ref() // 配置弹出框对象
  642. const bomNodeId = ref() // 最新的bomNodeId
  643. const dialogTitle = ref('') // 弹窗的标题
  644. const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
  645. const formType = ref('') // 表单的类型:create - 新增;update - 修改
  646. const deviceLabel = ref('') // 表单的类型:create - 新增;update - 修改
  647. const drawerVisible = ref<boolean>(false)
  648. const currentBomNodeId = ref() // 当前选中的bom节点
  649. const showDrawer = ref()
  650. const list = ref<IotMainWorkOrderBomVO[]>([]) // 保养工单bom关联列表的数据
  651. const materialList = ref<IotMainWorkOrderBomMaterialVO[]>([]) // 保养工单bom关联物料列表
  652. const deviceIds = ref<number[]>([]) // 已经选择的设备id数组
  653. const { params, name } = useRoute() // 查询参数
  654. const id = params.id
  655. const devicePersonsMap = ref<Map<number, Set<string>>>(new Map()) // 存储设备-责任人映射
  656. // 控制抽屉额外列的显示
  657. const hideExtraColumnsInDrawer = ref(false)
  658. // 分页相关变量
  659. const currentPage = ref(1)
  660. const pageSize = ref(10)
  661. const tableRef = ref();
  662. // 新增响应式变量
  663. const maintItemsWidth = ref('auto')
  664. const lastNaturalDateWatchers = ref(new Map())
  665. const columnWidths = ref<Record<string, string>>({});
  666. const formData = ref({
  667. id: undefined,
  668. deptId: undefined,
  669. name: '',
  670. orderNumber: undefined,
  671. responsiblePerson: undefined,
  672. actualStartTime: undefined,
  673. actualEndTime: undefined,
  674. cost: undefined,
  675. otherCost: undefined,
  676. outsourcingFlag: 0,
  677. remark: undefined,
  678. status: undefined,
  679. devicePersons: '',
  680. })
  681. const formRules = reactive({
  682. name: [{ required: true, message: '工单名称不能为空', trigger: 'blur' }],
  683. actualStartTime: [{
  684. required: true,
  685. message: t('fault.start') + '不能为空',
  686. trigger: 'change'
  687. }, {
  688. validator: (rule, value, callback) => {
  689. const now = dayjs();
  690. const start = value ? dayjs(Number(value)) : null;
  691. // 验证开始时间 <= 当前日期
  692. if (start && start.isAfter(now)) {
  693. callback(new Error(t('fault.start') + '不能超过当前日期'));
  694. return;
  695. }
  696. const end = formData.value.actualEndTime
  697. ? dayjs(Number(formData.value.actualEndTime))
  698. : null;
  699. // 只有当结束时间有效时,才比较开始和结束时间
  700. if (end && end.isValid() && !end.isAfter(now)) {
  701. if (start && start.isAfter(end)) {
  702. callback(new Error(t('fault.start') + '不能超过' + t('fault.end')));
  703. return;
  704. }
  705. }
  706. // 触发结束时间的重新校验
  707. if (formRef.value) {
  708. formRef.value.validateField('actualEndTime', () => {});
  709. }
  710. callback();
  711. },
  712. trigger: 'change'
  713. }],
  714. actualEndTime: [{
  715. required: true,
  716. message: t('fault.end') + '不能为空',
  717. trigger: 'change'
  718. }, {
  719. validator: (rule, value, callback) => {
  720. const now = dayjs();
  721. const end = value ? dayjs(Number(value)) : null;
  722. // 验证结束时间 <= 当前日期
  723. if (end && end.isAfter(now)) {
  724. callback(new Error(t('fault.end') + '不能超过当前日期'));
  725. return;
  726. }
  727. const start = formData.value.actualStartTime
  728. ? dayjs(Number(formData.value.actualStartTime))
  729. : null;
  730. // 验证结束时间 >= 开始时间(仅当开始时间存在时)
  731. if (start && end && end.isBefore(start)) {
  732. callback(new Error(t('fault.end') + '必须大于等于' + t('fault.start')));
  733. return;
  734. }
  735. callback();
  736. },
  737. trigger: 'change'
  738. }]
  739. })
  740. const formRef = ref() // 表单 Ref
  741. interface MaterialFormExpose {
  742. open: (deptId: number, bomNodeId: number, row: any, type: string) => void
  743. }
  744. const materialFormRef = ref<MaterialFormExpose>();
  745. const deviceBomMaterialsRef = ref<MaterialFormExpose>();
  746. // 新增配置相关状态
  747. const configDialog = reactive({
  748. visible: false,
  749. current: null as IotMaintenanceBomVO | null,
  750. form: {
  751. lastRunningKilometers: 0,
  752. delayKilometers: 0,
  753. lastRunningTime: 0,
  754. delayDuration: 0,
  755. lastNaturalDate: '',
  756. delayNaturalDate: 0,
  757. // 保养规则 周期
  758. nextRunningKilometers: 0,
  759. nextRunningTime: 0,
  760. nextNaturalDate: 0,
  761. // 提前量
  762. kiloCycleLead: 0,
  763. timePeriodLead: 0,
  764. naturalDatePeriodLead: 0,
  765. // 推迟原因
  766. delayReason: ''
  767. }
  768. })
  769. // 打开配置对话框
  770. const openConfigDialog = (row: IotMainWorkOrderBomVO) => {
  771. configDialog.current = row
  772. // 处理日期初始化(核心修改)
  773. let initialDate = ''
  774. if (row.lastNaturalDate) {
  775. // 如果已有值:时间戳 -> 日期字符串
  776. initialDate = dayjs(row.lastNaturalDate).format('YYYY-MM-DD')
  777. } else {
  778. // 如果无值:设置默认值避免1970问题
  779. initialDate = ''
  780. }
  781. configDialog.form = {
  782. lastRunningKilometers: row.lastRunningKilometers || 0,
  783. delayKilometers: row.delayKilometers || 0,
  784. lastRunningTime: row.lastRunningTime || 0,
  785. delayDuration: row.delayDuration || 0,
  786. lastNaturalDate: initialDate,
  787. delayNaturalDate: row.delayNaturalDate || 0,
  788. // 保养规则 周期值
  789. nextRunningKilometers: row.nextRunningKilometers || 0,
  790. nextRunningTime: row.nextRunningTime || 0,
  791. nextNaturalDate: row.nextNaturalDate || 0,
  792. // 提前量
  793. kiloCycleLead: row.kiloCycleLead || 0,
  794. timePeriodLead: row.timePeriodLead || 0,
  795. naturalDatePeriodLead: row.naturalDatePeriodLead || 0,
  796. // 推迟原因
  797. delayReason: row.delayReason || ''
  798. }
  799. configDialog.visible = true
  800. }
  801. // 运行时间周期 单行校验方法
  802. const validateRunningTime = (row: IotMainWorkOrderBomVO) => {
  803. if (row.runningTimeRule === 0 && (!row.nextRunningTime || row.nextRunningTime <= 0)) {
  804. row.timeError = t('mainPlan.runningTimeCycleError');
  805. return false;
  806. }
  807. row.timeError = '';
  808. return true;
  809. };
  810. // 计算属性:获取当前页的数据
  811. const paginatedList = computed(() => {
  812. const start = (currentPage.value - 1) * pageSize.value
  813. const end = start + pageSize.value
  814. return list.value.slice(start, end)
  815. })
  816. // 页码改变处理
  817. const handleCurrentChange = (newPage: number) => {
  818. currentPage.value = newPage
  819. }
  820. // 每页条数改变处理(保持10条)
  821. const handleSizeChange = (newSize: number) => {
  822. pageSize.value = newSize
  823. currentPage.value = 1 // 重置到第一页
  824. }
  825. // 列宽调整后的处理
  826. const handleHeaderDragEnd = () => {
  827. nextTick(() => {
  828. tableRef.value?.doLayout();
  829. });
  830. };
  831. // 运行时间周期 全局校验方法(在submitForm中调用)
  832. const validateAllRunningTimes = (): boolean => {
  833. let isValid = true;
  834. list.value.forEach(row => {
  835. if (row.runningTimeRule === 0 && (!row.nextRunningTime || row.nextRunningTime <= 0)) {
  836. isValid = false;
  837. // 高亮标记错误行
  838. row.timeError = t('mainPlan.runningTimeCycleError');
  839. message.error(`${t('mainPlan.runningTimeCycleError')}: ${row.deviceCode}-${row.name}`);
  840. }
  841. });
  842. return isValid;
  843. };
  844. const openMaterialForm = (row: any) => {
  845. bomNodeId.value = row.bomNodeId;
  846. console.log('这是一个对象:', row.bomNodeId)
  847. const type = 'maintenance'
  848. materialFormRef.value.open(formData.value.deptId, bomNodeId.value, row, type)
  849. }
  850. // 查看当前保养项已经绑定的物料列表
  851. const openDeviceBomMaterials = (row: any) => {
  852. bomNodeId.value = row.bomNodeId;
  853. const type = 'maintenance'
  854. deviceBomMaterialsRef.value.open(formData.value.deptId, bomNodeId.value, row, type)
  855. }
  856. const selectChoose = (selectedMaterial) => {
  857. selectedMaterial.bomNodeId = bomNodeId.value
  858. // 关联 bomNodeId
  859. const processedMaterials = selectedMaterial.map(material => ({
  860. ...material,
  861. bomNodeId: bomNodeId.value // 统一关联当前行的 bomNodeId
  862. }));
  863. // 避免重复添加
  864. processedMaterials.forEach(newMaterial => {
  865. // 检查是否已存在相同 工厂+成本中心+库存地点+bomNodeId + materialCode 的条目
  866. const isExist = materialList.value.some(item =>
  867. item.bomNodeId === bomNodeId.value &&
  868. item.materialCode === newMaterial.materialCode &&
  869. item.factoryId === newMaterial.factoryId &&
  870. item.costCenterId === newMaterial.costCenterId &&
  871. item.storageLocationId === newMaterial.storageLocationId
  872. );
  873. if (!isExist) {
  874. materialList.value.push(newMaterial);
  875. }
  876. });
  877. }
  878. // 计算属性:判断是否需要显示运行时间周期列
  879. const shouldShowRunningTimeColumn = computed(() => {
  880. return list.value.some(item => item.runningTimeRule === 0);
  881. });
  882. /** 查看已经选择的物料 并编辑 */
  883. const handleView = (row: IotMainWorkOrderBomVO) => {
  884. currentBomNodeId.value = row.bomNodeId
  885. drawerVisible.value = true
  886. // 根据状态值设置是否隐藏额外列
  887. hideExtraColumnsInDrawer.value = row.status === 1
  888. console.log('当前bom节点:', currentBomNodeId.value)
  889. }
  890. // 计算保养金额
  891. const calculateTotalCost = () => {
  892. // 物料总金额 = ∑(单价 * 消耗数量)
  893. const materialTotal = materialList.value.reduce((sum, item) => {
  894. const price = Number(item.unitPrice) || 0
  895. const quantity = Number(item.quantity) || 0
  896. return sum + (price * quantity)
  897. }, 0)
  898. // 保养 = 物料总金额
  899. formData.value.cost = (materialTotal).toFixed(2)
  900. }
  901. // 监听物料列表变化
  902. watch(
  903. () => materialList.value,
  904. () => {
  905. calculateTotalCost()
  906. },
  907. { deep: true }
  908. )
  909. const handleInput = (value, obj) => {
  910. // 1. 过滤非法字符(只允许数字和小数点)
  911. let filtered = value.replace(/[^\d.]/g, '')
  912. // 2. 处理多个小数点的情况
  913. filtered = filtered.replace(/\.{2,}/g, '.')
  914. // 3. 限制小数点后最多两位
  915. let decimalParts = filtered.split('.')
  916. if (decimalParts.length > 1) {
  917. decimalParts = decimalParts.slice(0, 2)
  918. filtered = decimalParts.join('.')
  919. }
  920. // 4. 处理以小数点开头的情况(自动补0)
  921. if (filtered.startsWith('.')) {
  922. filtered = '0' + filtered
  923. }
  924. // 5. 更新绑定值(同时处理连续输入多个0的情况)
  925. formData.value[obj] = filtered.replace(/^0+(?=\d)/, '')
  926. }
  927. // 保存配置
  928. const saveConfig = () => {
  929. (configFormRef.value as any).validate((valid: boolean) => {
  930. if (!valid) return
  931. if (!configDialog.current) return
  932. // 动态校验逻辑
  933. const requiredFields = []
  934. if (configDialog.current.mileageRule === 0) {
  935. requiredFields.push('nextRunningKilometers', 'kiloCycleLead')
  936. }
  937. if (configDialog.current.runningTimeRule === 0) {
  938. requiredFields.push('nextRunningTime', 'timePeriodLead')
  939. }
  940. if (configDialog.current.naturalDateRule === 0) {
  941. requiredFields.push('nextNaturalDate', 'naturalDatePeriodLead')
  942. }
  943. const missingFields = requiredFields.filter(field =>
  944. !configDialog.form[field as keyof typeof configDialog.form]
  945. )
  946. if (missingFields.length > 0) {
  947. message.error('请填写所有必填项')
  948. return
  949. }
  950. // 强制校验逻辑
  951. if (configDialog.current.naturalDateRule === 0) {
  952. if (!configDialog.form.lastNaturalDate) {
  953. message.error('必须选择自然日期')
  954. return
  955. }
  956. // 验证日期有效性
  957. const dateValue = dayjs(configDialog.form.lastNaturalDate)
  958. if (!dateValue.isValid()) {
  959. message.error('日期格式不正确')
  960. return
  961. }
  962. }
  963. // 转换逻辑(关键修改)
  964. const finalDate = configDialog.form.lastNaturalDate
  965. ? dayjs(configDialog.form.lastNaturalDate).valueOf()
  966. : null // 改为null而不是0
  967. // 更新当前行的数据
  968. Object.assign(configDialog.current, {
  969. ...configDialog.form,
  970. lastNaturalDate: finalDate
  971. })
  972. configDialog.visible = false
  973. })
  974. }
  975. const queryParams = reactive({
  976. workOrderId: id
  977. })
  978. /** 获取当前所有设备ID集合 */
  979. const getCurrentDeviceIds = (): number[] => {
  980. return [...new Set(list.value.map(item => item.deviceId))]
  981. }
  982. /** 更新责任人显示 */
  983. function updateDevicePersonsDisplay() {
  984. const allNames = new Set<string>()
  985. devicePersonsMap.value.forEach(names => {
  986. names.forEach(name => allNames.add(name))
  987. })
  988. formData.value.devicePersons = Array.from(allNames).join(', ')
  989. }
  990. /**
  991. * 根据选择的设备查询所有设备关联的 责任人姓名 逗号分隔
  992. */
  993. async function getDevicePersons() {
  994. // 获取当前已经选择的设备ID集合
  995. const existDeviceIds = getCurrentDeviceIds()
  996. if (existDeviceIds.length === 0) {
  997. formData.value.devicePersons = ''
  998. return
  999. }
  1000. try {
  1001. // 调用接口获取数据
  1002. const params = {
  1003. deviceIds: existDeviceIds.join(',') // 明确传递数组参数
  1004. }
  1005. const res = await IotDevicePersonApi.getPersonsByDeviceIds(params)
  1006. const personsData = res || []
  1007. // 清空旧数据
  1008. devicePersonsMap.value.clear()
  1009. // 处理接口数据
  1010. personsData.forEach((item: { deviceId: number; personName: string }) => {
  1011. if (!devicePersonsMap.value.has(item.deviceId)) {
  1012. devicePersonsMap.value.set(item.deviceId, new Set())
  1013. }
  1014. devicePersonsMap.value.get(item.deviceId)?.add(item.personName)
  1015. })
  1016. // 生成展示字符串
  1017. updateDevicePersonsDisplay()
  1018. } catch (error) {
  1019. console.error('获取设备责任人失败:', error)
  1020. }
  1021. }
  1022. // 获取指定bomNodeId的物料数量
  1023. const getMaterialCount = (bomNodeId: number) => {
  1024. console.log('当前BOM节点:' + bomNodeId)
  1025. return materialList.value.filter(item => item.bomNodeId === bomNodeId).length
  1026. }
  1027. const hasDelay = (row) => {
  1028. return row.delayKilometers > 0 ||
  1029. row.delayNaturalDate > 0 ||
  1030. row.delayDuration > 0
  1031. }
  1032. const handleDeleteMaterial = (material) => {
  1033. // 根据唯一标识查找要删除的物料索引
  1034. const index = materialList.value.findIndex(item =>
  1035. item.bomNodeId === material.bomNodeId &&
  1036. item.factoryId === material.factoryId &&
  1037. item.costCenterId === material.costCenterId &&
  1038. item.storageLocationId === material.storageLocationId &&
  1039. item.materialCode === material.materialCode
  1040. );
  1041. if (index !== -1) {
  1042. materialList.value.splice(index, 1);
  1043. message.success('物料删除成功');
  1044. }
  1045. };
  1046. const close = () => {
  1047. delView(unref(currentRoute))
  1048. push({ name: 'IotMainWorkOrder', params:{}})
  1049. }
  1050. /** 提交表单 */
  1051. const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
  1052. const submitForm = async () => {
  1053. // 校验表单
  1054. await formRef.value.validate()
  1055. // 运行时间周期全局校验
  1056. if (!validateAllRunningTimes()) {
  1057. return; // 校验失败则终止提交
  1058. }
  1059. // 校验表格数据
  1060. const isValid = validateTableData()
  1061. if (!isValid) return
  1062. // 提交请求
  1063. formLoading.value = true
  1064. try {
  1065. const convertedList = list.value.map(item => ({
  1066. ...item,
  1067. lastNaturalDate: typeof item.lastNaturalDate === 'number'
  1068. ? item.lastNaturalDate
  1069. : (item.lastNaturalDate ? dayjs(item.lastNaturalDate).valueOf() : null)
  1070. }));
  1071. const data = {
  1072. mainWorkOrder: formData.value,
  1073. mainWorkOrderBom: convertedList,
  1074. mainWorkOrderMaterials: materialList.value
  1075. }
  1076. await IotMainWorkOrderApi.fillWorkOrder(data)
  1077. message.success(t('common.createSuccess'))
  1078. close()
  1079. // 发送操作成功的事件
  1080. emit('success')
  1081. } finally {
  1082. formLoading.value = false
  1083. }
  1084. }
  1085. const validateDelayReason = (rule: any, value: any, callback: any) => {
  1086. const form = configDialog.form
  1087. const hasDelay =
  1088. (form.delayKilometers > 0) ||
  1089. (form.delayDuration > 0) ||
  1090. (form.delayNaturalDate > 0)
  1091. if (hasDelay && (!value || value.trim() === '')) {
  1092. callback(new Error('请填写推迟原因'))
  1093. } else {
  1094. callback()
  1095. }
  1096. }
  1097. // 新增表单校验规则
  1098. const configFormRules = reactive({
  1099. nextRunningKilometers: [{
  1100. required: true,
  1101. message: '里程周期必须填写',
  1102. trigger: 'blur'
  1103. }],
  1104. kiloCycleLead: [{
  1105. required: true,
  1106. message: '提前量必须填写',
  1107. trigger: 'blur'
  1108. }],
  1109. nextRunningTime: [{
  1110. required: true,
  1111. message: '时间周期必须填写',
  1112. trigger: 'blur'
  1113. }],
  1114. timePeriodLead: [{
  1115. required: true,
  1116. message: '提前量必须填写',
  1117. trigger: 'blur'
  1118. }],
  1119. nextNaturalDate: [{
  1120. required: true,
  1121. message: '自然日周期必须填写',
  1122. trigger: 'blur'
  1123. }],
  1124. naturalDatePeriodLead: [{
  1125. required: true,
  1126. message: '提前量必须填写',
  1127. trigger: 'blur'
  1128. }],
  1129. // 新增推迟原因验证规则
  1130. delayReason: [
  1131. { validator: validateDelayReason, trigger: ['blur', 'change'] }
  1132. ]
  1133. })
  1134. // 计算文本宽度的辅助函数
  1135. const getTextWidth = (text: string, fontSize = 14): number => {
  1136. const span = document.createElement('span')
  1137. span.style.visibility = 'hidden'
  1138. span.style.position = 'absolute'
  1139. span.style.whiteSpace = 'nowrap'
  1140. span.style.fontSize = '14px' // 与表格实际字体一致
  1141. span.style.fontFamily = 'inherit'
  1142. span.innerText = text
  1143. document.body.appendChild(span)
  1144. const width = span.offsetWidth
  1145. document.body.removeChild(span)
  1146. return width
  1147. }
  1148. // 计算列宽的主函数
  1149. const calculateMaintItemsWidth = () => {
  1150. if (list.value.length === 0) {
  1151. maintItemsWidth.value = 'auto'
  1152. return
  1153. }
  1154. // 1. 计算表头文本宽度
  1155. const headerText = t('mainPlan.MaintItems')
  1156. const headerWidth = getTextWidth(headerText)
  1157. // 2. 计算内容最大宽度
  1158. let contentMaxWidth = 0
  1159. list.value.forEach(item => {
  1160. if (item.name) {
  1161. const width = getTextWidth(item.name.toString())
  1162. if (width > contentMaxWidth) {
  1163. contentMaxWidth = width
  1164. }
  1165. }
  1166. })
  1167. // 3. 取最大值 + 内边距(20px)
  1168. const maxWidth = Math.max(headerWidth, contentMaxWidth) + 20
  1169. maintItemsWidth.value = `${maxWidth}px`
  1170. }
  1171. // 计算下次保养公里数(通用函数)
  1172. const calculateNextMaintenanceKm = (row: IotMaintenanceBomVO) => {
  1173. // 验证条件:规则开启 + 两个值都存在且 > 0
  1174. const isValid = row.mileageRule === 0 &&
  1175. row.lastRunningKilometers > 0 &&
  1176. row.nextRunningKilometers > 0;
  1177. return isValid
  1178. ? (row.lastRunningKilometers + row.nextRunningKilometers)
  1179. : null; // 不满足条件返回null
  1180. };
  1181. // 计算剩余保养公里数(通用函数)
  1182. const calculateRemainKm = (row: IotMaintenanceBomVO) => {
  1183. // 确定使用的里程值(优先totalMileage)
  1184. const mileageValue = row.totalMileage ?? row.tempTotalMileage;
  1185. // 验证条件:规则开启 + 3个值都存在且 > 0
  1186. const isValid = row.mileageRule === 0 &&
  1187. row.lastRunningKilometers > 0 &&
  1188. mileageValue > 0 &&
  1189. row.nextRunningKilometers > 0;
  1190. return isValid
  1191. ? (row.nextRunningKilometers - (mileageValue - row.lastRunningKilometers))
  1192. : null; // 不满足条件返回null
  1193. };
  1194. // 计算下次保养运行时长(通用函数)
  1195. const calculateNextMaintenanceH = (row: IotMaintenanceBomVO) => {
  1196. // 验证条件:规则开启 + 两个值都存在且 > 0
  1197. const isValid = row.runningTimeRule === 0 &&
  1198. row.lastRunningTime > 0 &&
  1199. row.nextRunningTime > 0;
  1200. return isValid
  1201. ? (row.lastRunningTime + row.nextRunningTime)
  1202. : null; // 不满足条件返回null
  1203. };
  1204. // 计算剩余运行时间(通用函数)
  1205. const calculateRemainH = (row: IotMaintenanceBomVO) => {
  1206. // 确定使用的 运行时长 值(优先 totalRunTime)
  1207. const runTimeValue = row.totalRunTime ?? row.tempTotalRunTime;
  1208. // 验证条件:规则开启 + 3个值都存在且 > 0
  1209. const isValid = row.runningTimeRule === 0 &&
  1210. row.lastRunningTime > 0 &&
  1211. runTimeValue > 0 &&
  1212. row.nextRunningTime > 0;
  1213. return isValid
  1214. ? (row.nextRunningTime - (runTimeValue - row.lastRunningTime))
  1215. : null; // 不满足条件返回null
  1216. };
  1217. // 计算下次保养日期(通用函数)
  1218. const calculateNextMaintenanceDate = (row: IotMaintenanceBomVO) => {
  1219. // 验证条件:规则开启 + 两个值都存在且 > 0
  1220. const isValid = row.naturalDateRule === 0 &&
  1221. row.lastNaturalDate &&
  1222. row.nextNaturalDate;
  1223. return isValid
  1224. ? dayjs(row.lastNaturalDate).add(row.nextNaturalDate, 'day').format('YYYY-MM-DD')
  1225. : null; // 不满足条件返回null
  1226. };
  1227. // 计算 自然日期保养 剩余天数(通用函数)
  1228. const calculateRemainDay = (row: IotMaintenanceBomVO) => {
  1229. // 验证条件:规则开启 + 两个值都存在且有效
  1230. const isValid = row.naturalDateRule === 0 &&
  1231. row.lastNaturalDate !== null &&
  1232. row.nextNaturalDate !== null &&
  1233. row.nextNaturalDate > 0;
  1234. if (!isValid) {
  1235. return null;
  1236. }
  1237. try {
  1238. // 上次保养日期:将时间戳转换为 Day.js 对象
  1239. const lastNaturalDate = dayjs(row.lastNaturalDate);
  1240. // 计算下次保养日期
  1241. const nextMaintenanceDate = lastNaturalDate.add(row.nextNaturalDate, 'day');
  1242. // 计算剩余天数(当前日期到下次保养日期的天数差)
  1243. return nextMaintenanceDate.diff(dayjs(), 'day');
  1244. } catch (error) {
  1245. console.error('计算保养剩余天数错误:', error);
  1246. return null;
  1247. }
  1248. };
  1249. const getStatusText = (row: any) => {
  1250. // 状态为1直接返回"完成"
  1251. if (row.status === 1) return t('mainPlan.completed');
  1252. // 状态为0时判断延迟字段
  1253. const delayDuration = Number(row.delayDuration) || 0;
  1254. const delayKilometers = Number(row.delayKilometers) || 0;
  1255. const delayNaturalDate = Number(row.delayNaturalDate) || 0;
  1256. // 任意延迟字段大于0 -> 延时
  1257. if (delayDuration > 0 || delayKilometers > 0 || delayNaturalDate > 0) {
  1258. return t('mainPlan.delayed');
  1259. }
  1260. // 否则显示保养中
  1261. return t('mainPlan.maintaining');
  1262. };
  1263. // 监听数据变化重新计算
  1264. /* watch(() => list.value, () => {
  1265. calculateMaintItemsWidth()
  1266. }, { deep: true }) */
  1267. // 计算属性 - 检查当前页是否有开启的里程规则
  1268. const hasMileageRuleInCurrentPage = computed(() => {
  1269. return paginatedList.value.some(row => row.mileageRule === 0);
  1270. });
  1271. // 计算属性 - 检查当前页是否有开启的 运行时间 规则
  1272. const hasTimeRuleInCurrentPage = computed(() => {
  1273. return paginatedList.value.some(row => row.runningTimeRule === 0);
  1274. });
  1275. // 计算属性 - 检查当前页是否有开启的 自然日期 规则
  1276. const hasDateRuleInCurrentPage = computed(() => {
  1277. return paginatedList.value.some(row => row.naturalDateRule === 0);
  1278. });
  1279. // 统一计算所有列宽
  1280. const calculateAllColumnsWidth = () => {
  1281. const MIN_WIDTH = 70; // 最小列宽
  1282. const PADDING = 10; // 列内边距
  1283. const FIXED_COLUMN_PADDING = 10; // 固定列额外内边距
  1284. const GROUP_COLUMN_EXTRA = 20; // 分组列额外宽度
  1285. // 需要自适应的列配置
  1286. const autoColumns = [
  1287. { prop: 'serial', label: t('iotDevice.serial') },
  1288. { prop: 'deviceCode', label: t('iotMaintain.deviceCode') },
  1289. { prop: 'deviceName', label: t('iotMaintain.deviceName') },
  1290. {
  1291. prop: 'totalRunTime',
  1292. label: t('operationFillForm.sumTime'),
  1293. getValue: (row) => row.totalRunTime ?? row.tempTotalRunTime
  1294. },
  1295. {
  1296. prop: 'totalMileage',
  1297. label: t('operationFillForm.sumKil'),
  1298. getValue: (row) => row.totalMileage ?? row.tempTotalMileage
  1299. },
  1300. { prop: 'name', label: t('bomList.bomNode') },
  1301. { prop: 'lastMaintenanceDate', label: t('mainPlan.lastMaintenanceDate') },
  1302. { prop: 'mileageRule', label: t('main.mileage') },
  1303. { prop: 'runningTimeRule', label: t('main.runTime') },
  1304. { prop: 'naturalDateRule', label: t('main.date') },
  1305. { prop: 'lastRunningKilometers', label: t('mainPlan.lastMaintenanceMileage') },
  1306. { prop: 'nextMaintenanceKm', label: t('mainPlan.nextMaintenanceKm') },
  1307. { prop: 'remainKm', label: t('mainPlan.remainKm') },
  1308. { prop: 'lastRunningTime', label: t('mainPlan.lastMaintenanceOperationTime') },
  1309. { prop: 'nextMaintenanceH', label: t('mainPlan.nextMaintenanceH') },
  1310. { prop: 'remainH', label: t('mainPlan.remainH') },
  1311. { prop: 'nextRunningTime', label: t('mainPlan.RunTimeCycle') },
  1312. { prop: 'tempLastNaturalDate', label: t('mainPlan.lastMaintenanceNaturalDate') },
  1313. { prop: 'nextMaintenanceDate', label: t('mainPlan.nextMaintDate') },
  1314. { prop: 'remainDay', label: t('mainPlan.remainDay') },
  1315. { prop: 'operation', label: t('operationFill.operation') }
  1316. ];
  1317. const newWidths: Record<string, number> = {};
  1318. autoColumns.forEach(col => {
  1319. const headerText = col.label;
  1320. // 计算表头宽度
  1321. const headerWidth = getTextWidth(headerText) * 1.2;
  1322. // 计算内容最大宽度
  1323. let contentMaxWidth = 0;
  1324. if (col.prop === 'operation') {
  1325. // 操作列固定宽度(根据按钮数量)
  1326. contentMaxWidth = 120;
  1327. } else if (['mileageRule', 'runningTimeRule', 'naturalDateRule'].includes(col.prop)) {
  1328. // 开关列固定宽度
  1329. contentMaxWidth = 80;
  1330. } else {
  1331. list.value.forEach(row => {
  1332. const text = col.getValue ? String(col.getValue(row)) : String(row[col.prop] || '');
  1333. const textWidth = getTextWidth(text);
  1334. if (textWidth > contentMaxWidth) contentMaxWidth = textWidth;
  1335. });
  1336. }
  1337. // 取最大值并添加内边距
  1338. let finalWidth = Math.max(headerWidth, contentMaxWidth, MIN_WIDTH) + PADDING;
  1339. // 为分组列增加额外宽度(重点修改)
  1340. if ([
  1341. 'lastRunningKilometers',
  1342. 'nextMaintenanceKm',
  1343. 'remainKm',
  1344. 'lastRunningTime',
  1345. 'nextMaintenanceH',
  1346. 'remainH',
  1347. 'tempLastNaturalDate',
  1348. 'nextMaintenanceDate',
  1349. 'remainDay'
  1350. ].includes(col.prop)) {
  1351. finalWidth += GROUP_COLUMN_EXTRA;
  1352. }
  1353. newWidths[col.prop] = finalWidth;
  1354. });
  1355. // 固定列特殊处理 - 增加额外空间
  1356. ['serial', 'deviceCode', 'deviceName', 'name'].forEach(prop => {
  1357. if (newWidths[prop]) {
  1358. newWidths[prop] += FIXED_COLUMN_PADDING;
  1359. }
  1360. });
  1361. // 转换为CSS宽度值
  1362. Object.keys(newWidths).forEach(prop => {
  1363. columnWidths.value[prop] = `${newWidths[prop]}px`;
  1364. });
  1365. };
  1366. // 为每一行建立lastNaturalDate到tempLastNaturalDate的同步
  1367. const setupNaturalDateSync = (row: IotMaintenanceBomVO) => {
  1368. // 如果该行已有watcher则跳过
  1369. if (lastNaturalDateWatchers.value.has(row.id)) return
  1370. // 为该行创建单独的watcher
  1371. const unwatch = watch(
  1372. () => row.lastNaturalDate,
  1373. (newVal) => {
  1374. // 转换日期格式 (时间戳 -> YYYY-MM-DD)
  1375. row.tempLastNaturalDate = newVal
  1376. ? dayjs(newVal).format('YYYY-MM-DD')
  1377. : null;
  1378. },
  1379. { immediate: true, deep: true }
  1380. )
  1381. // 保存watcher用于后续清理
  1382. lastNaturalDateWatchers.value.set(row.id, unwatch)
  1383. }
  1384. const tableHeaderStyle = ({ row, rowIndex }) => {
  1385. return {
  1386. border: '1px solid #333',
  1387. backgroundColor: rowIndex === 0 ? '#f0f9eb' : '#f5f7fa' // 分组行特殊背景
  1388. }
  1389. }
  1390. // 监听分页数据和规则变化 - 重新布局表格
  1391. watch([paginatedList, hasMileageRuleInCurrentPage, hasTimeRuleInCurrentPage, hasDateRuleInCurrentPage], () => {
  1392. nextTick(() => {
  1393. tableRef.value?.doLayout();
  1394. calculateAllColumnsWidth(); // 重新计算列宽
  1395. });
  1396. });
  1397. // 下拉菜单命令处理
  1398. const handleDropdownCommand = (command: { action: string; row: IotMainWorkOrderBomVO }) => {
  1399. switch (command.action) {
  1400. case 'delay':
  1401. openConfigDialog(command.row);
  1402. break;
  1403. case 'material':
  1404. openMaterialForm(command.row);
  1405. break;
  1406. case 'deviceBomMaterials':
  1407. openDeviceBomMaterials(command.row);
  1408. break;
  1409. case 'detail':
  1410. handleView(command.row);
  1411. break;
  1412. }
  1413. };
  1414. /** 校验表格数据 */
  1415. const validateTableData = (): boolean => {
  1416. let isValid = true;
  1417. const errorMessages: string[] = []; // 通用错误集合
  1418. const materialRequiredErrors: string[] = []; // 物料缺失专用错误集合
  1419. // 1. 基础校验:工单明细是否存在
  1420. if (list.value.length === 0) {
  1421. message.error('工单明细不存在');
  1422. return false;
  1423. }
  1424. // 2. 校验设备状态
  1425. list.value.forEach((row, index) => {
  1426. const rowNumber = index + 1;
  1427. if (row.deviceCode === null || row.deviceName === null) {
  1428. errorMessages.push(`第${rowNumber}行设备状态错误`);
  1429. isValid = false;
  1430. }
  1431. });
  1432. // 3. 校验物料必填(仅在非委外模式下)
  1433. if (formData.value.outsourcingFlag !== 1) {
  1434. list.value.forEach((row, index) => {
  1435. const rowNumber = index + 1;
  1436. const deviceIdentifier = `${row.deviceCode}-${row.name}`;
  1437. // 检查是否设置了推迟保养
  1438. const hasDelay =
  1439. (row.delayKilometers || 0) > 0 ||
  1440. (row.delayNaturalDate || 0) > 0 ||
  1441. (row.delayDuration || 0) > 0;
  1442. // 未设置推迟保养且未选择物料
  1443. if (!hasDelay && getMaterialCount(row.bomNodeId) === 0) {
  1444. materialRequiredErrors.push(`第${rowNumber}行【${deviceIdentifier}】未添加物料`);
  1445. isValid = false;
  1446. }
  1447. });
  1448. }
  1449. // 4. 智能错误提示
  1450. if (!isValid) {
  1451. // 构建错误消息HTML
  1452. let errorHtml = '';
  1453. // 添加通用错误
  1454. if (errorMessages.length > 0) {
  1455. errorHtml += errorMessages.join('<br>');
  1456. }
  1457. // 添加物料错误(带智能截断)
  1458. if (materialRequiredErrors.length > 0) {
  1459. if (errorHtml) errorHtml += '<br>'; // 添加换行分隔
  1460. if (materialRequiredErrors.length > 3) {
  1461. errorHtml += materialRequiredErrors.slice(0, 3).join('<br>');
  1462. errorHtml += `<br>...等共 ${materialRequiredErrors.length} 个保养项未添加物料`;
  1463. } else {
  1464. errorHtml += materialRequiredErrors.join('<br>');
  1465. }
  1466. }
  1467. // 添加标题
  1468. const title = "<span style='font-weight:bold;color:#f56c6c'></span>";
  1469. errorHtml = title + errorHtml;
  1470. // 显示带格式的错误消息
  1471. message.error({
  1472. message: errorHtml,
  1473. dangerouslyUseHTMLString: true,
  1474. duration: 8000 // 延长显示时间
  1475. });
  1476. }
  1477. return isValid;
  1478. };
  1479. /** 重置表单 */
  1480. const resetForm = () => {
  1481. formData.value = {
  1482. id: undefined,
  1483. deviceId: undefined,
  1484. status: undefined,
  1485. description: undefined,
  1486. pic: undefined,
  1487. remark: undefined,
  1488. deviceName: undefined,
  1489. processInstanceId: undefined,
  1490. auditStatus: undefined,
  1491. deptId: undefined
  1492. }
  1493. formRef.value?.resetFields()
  1494. }
  1495. // 防抖函数实现
  1496. function debounce(func: Function, wait: number) {
  1497. let timeout: ReturnType<typeof setTimeout> | null
  1498. return function executedFunction(...args: any[]) {
  1499. const later = () => {
  1500. clearTimeout(timeout!)
  1501. func(...args)
  1502. }
  1503. clearTimeout(timeout!)
  1504. timeout = setTimeout(later, wait)
  1505. }
  1506. }
  1507. // 响应窗口大小变化
  1508. const handleResize = debounce(calculateMaintItemsWidth, 300)
  1509. onMounted(async () => {
  1510. materialList.value = []
  1511. const deptId = useUserStore().getUser.deptId
  1512. // 查询当前登录人所属部门名称
  1513. dept.value = await DeptApi.getDept(deptId)
  1514. deptUsers.value = await UserApi.getDeptUsersByDeptId(deptId)
  1515. formData.value.deptId = deptId
  1516. try{
  1517. formType.value = 'update'
  1518. // 查询保养工单 主表数据
  1519. const workOrder = await IotMainWorkOrderApi.getIotMainWorkOrder(id);
  1520. formData.value = workOrder
  1521. // 查询保养工单 明细数据
  1522. const data = await IotMainWorkOrderBomApi.getWorkOrderBOMs(queryParams);
  1523. list.value = []
  1524. if (Array.isArray(data)) {
  1525. list.value = data.map(item => {
  1526. if (item.mileageRule === 0) {
  1527. item.nextMaintenanceKm = calculateNextMaintenanceKm(item);
  1528. item.remainKm = calculateRemainKm(item);
  1529. }
  1530. if (item.runningTimeRule === 0) {
  1531. item.nextMaintenanceH = calculateNextMaintenanceH(item);
  1532. item.remainH = calculateRemainH(item);
  1533. }
  1534. if (item.naturalDateRule === 0) {
  1535. item.nextMaintenanceDate = calculateNextMaintenanceDate(item);
  1536. item.remainDay = calculateRemainDay(item);
  1537. }
  1538. setupNaturalDateSync(item);
  1539. return {
  1540. ...item,
  1541. lastNaturalDate: item.lastNaturalDate
  1542. }
  1543. })
  1544. }
  1545. // 查询当前保养工单已经关联的所有物料
  1546. const materials = await IotMainWorkOrderBomMaterialApi.getWorkOrderBomMaterials(queryParams);
  1547. materialList.value = []
  1548. if (Array.isArray(materials)) {
  1549. materialList.value = materials
  1550. .map(item => ({
  1551. ...item,
  1552. }))
  1553. }
  1554. } catch (error) {
  1555. console.error('数据加载失败:', error)
  1556. message.error('数据加载失败,请重试')
  1557. }
  1558. nextTick(() => {
  1559. calculateAllColumnsWidth()
  1560. window.addEventListener('resize', calculateAllColumnsWidth);
  1561. })
  1562. })
  1563. onUnmounted(async () => {
  1564. window.removeEventListener('resize', calculateAllColumnsWidth);
  1565. })
  1566. </script>
  1567. <style scoped>
  1568. .base-expandable-content {
  1569. overflow: hidden; /* 隐藏溢出的内容 */
  1570. transition: max-height 0.3s ease; /* 平滑过渡效果 */
  1571. }
  1572. :deep(.el-input-number .el-input__inner) {
  1573. text-align: left !important;
  1574. padding-left: 10px; /* 保持左侧间距 */
  1575. }
  1576. /* 分组容器样式 */
  1577. .form-group {
  1578. position: relative;
  1579. border: 1px solid #dcdfe6;
  1580. border-radius: 4px;
  1581. padding: 20px 15px 10px;
  1582. margin-bottom: 18px;
  1583. transition: border-color 0.2s;
  1584. }
  1585. /* 分组标题样式 */
  1586. .group-title {
  1587. position: absolute;
  1588. top: -10px;
  1589. left: 20px;
  1590. background: white;
  1591. padding: 0 8px;
  1592. color: #606266;
  1593. font-size: 12px;
  1594. font-weight: 500;
  1595. }
  1596. .error-text {
  1597. color: #f56c6c;
  1598. font-size: 12px;
  1599. margin-top: 5px;
  1600. }
  1601. :deep(.el-table__body) {
  1602. .el-table__cell {
  1603. .cell {
  1604. word-break: break-word;
  1605. max-width: 600px; /* 最大宽度限制 */
  1606. }
  1607. }
  1608. }
  1609. .full-content-cell {
  1610. white-space: nowrap; /* 禁止换行 */
  1611. overflow: visible; /* 允许内容溢出单元格 */
  1612. }
  1613. /* 新增分组表头样式 */
  1614. :deep(.el-table__header) {
  1615. border: 1px solid #dcdfe6 !important;
  1616. }
  1617. :deep(.el-table__header th) {
  1618. border-right: 1px solid #dcdfe6 !important;
  1619. border-bottom: 1px solid #dcdfe6 !important;
  1620. }
  1621. :deep(.el-table__header .is-group th) {
  1622. background-color: #f5f7fa !important;
  1623. border-bottom: 1px solid #dcdfe6 !important;
  1624. font-weight: 600;
  1625. position: relative;
  1626. }
  1627. :deep(.el-table__header .is-group th::after) {
  1628. display: none !important;
  1629. }
  1630. /* 分组标题下的子表头单元格 */
  1631. :deep(.el-table__header .el-table__cell:not(.is-group)) {
  1632. border-top: 1px solid #dcdfe6 !important; /* 添加顶部边框连接分组标题 */
  1633. }
  1634. </style>