FillDailyReportForm.vue 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611
  1. <template>
  2. <ContentWrap v-loading="formLoading">
  3. <!-- 第一部分:日报标题 -->
  4. <div class="daily-report-title">
  5. <h2>{{ pageTitle }}</h2>
  6. <!-- 在审批模式下显示审批状态提示 -->
  7. <div v-if="isReadonlyMode" class="approval-notice">
  8. <el-alert :title="modeNotice" type="info" :closable="false" />
  9. </div>
  10. </div>
  11. <!-- 第二部分:项目/任务信息 -->
  12. <ContentWrap>
  13. <div class="info-table" style="margin-top: 1em">
  14. <!-- 表格行 -->
  15. <div class="table-row">
  16. <div class="table-cell">
  17. <div class="cell-content">
  18. <span class="cell-label">甲方:</span>
  19. <!-- 甲方字段:添加 single-line-ellipsis 类 + title 绑定完整内容 -->
  20. <span
  21. class="cell-value single-line-ellipsis"
  22. :title="dailyReportData.manufactureName || '-'"
  23. >
  24. {{ dailyReportData.manufactureName || '-' }}
  25. </span>
  26. </div>
  27. </div>
  28. <div class="table-cell">
  29. <div class="cell-content">
  30. <span class="cell-label">合同号:</span>
  31. <span class="cell-value">{{ dailyReportData.contractName || '-' }}</span>
  32. </div>
  33. </div>
  34. <div class="table-cell">
  35. <div class="cell-content">
  36. <span class="cell-label">井号:</span>
  37. <span class="cell-value">{{ dailyReportData.wellName || dailyReportData.taskName || '-' }}</span>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="table-row">
  42. <div class="table-cell">
  43. <div class="cell-content">
  44. <span class="cell-label">施工队伍:</span>
  45. <span class="cell-value">{{ dailyReportData.deptName || '-' }}</span>
  46. </div>
  47. </div>
  48. <div class="table-cell">
  49. <div class="cell-content">
  50. <span class="cell-label">施工地点:</span>
  51. <span class="cell-value">{{ dailyReportData.location || '-' }}</span>
  52. </div>
  53. </div>
  54. <div class="table-cell">
  55. <div class="cell-content">
  56. <span class="cell-label">工艺:</span>
  57. <span class="cell-value">{{ dailyReportData.techniqueNames || '-' }}</span>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="table-row">
  62. <div class="table-cell">
  63. <div class="cell-content">
  64. <span class="cell-label">搬迁日期:</span>
  65. <span class="cell-value">{{ formatDate(dailyReportData.dpDate) || '-' }}</span>
  66. </div>
  67. </div>
  68. <div class="table-cell">
  69. <div class="cell-content">
  70. <span class="cell-label">开工日期:</span>
  71. <span class="cell-value">{{ formatDate(dailyReportData.sgDate) || '-' }}</span>
  72. </div>
  73. </div>
  74. <div class="table-cell">
  75. <div class="cell-content">
  76. <span class="cell-label">完工日期:</span>
  77. <span class="cell-value">{{ formatDate(dailyReportData.wgDate) || '-' }}</span>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="table-row">
  82. <div class="table-cell">
  83. <div class="cell-content">
  84. <span class="cell-label">施工周期D:</span>
  85. <span class="cell-value">{{ constructionPeriod || 0 }}</span>
  86. </div>
  87. </div>
  88. <div class="table-cell">
  89. <div class="cell-content">
  90. <span class="cell-label">停待时间D:</span>
  91. <span class="cell-value">{{ dailyReportData.faultDowntime || 0 }}</span>
  92. </div>
  93. </div>
  94. <div class="table-cell">
  95. <div class="cell-content">
  96. <span class="cell-label">带班干部:</span>
  97. <span class="cell-value">{{ dailyReportData.responsiblePersonNames || '-' }}</span>
  98. </div>
  99. </div>
  100. </div>
  101. <!-- 第五行:设备配置(单独一行) -->
  102. <div class="table-row">
  103. <div class="table-cell full-width">
  104. <div class="cell-content">
  105. <span class="cell-label">设备配置:</span>
  106. <span class="cell-value indent-multiline">{{ dailyReportData.deviceNames || '-' }}</span>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </ContentWrap>
  112. <!-- 第三部分:日报填报表单 -->
  113. <ContentWrap class="section-padding">
  114. <el-form
  115. ref="formRef"
  116. :model="formData"
  117. :rules="isReadonlyMode ? {} : formRules"
  118. v-loading="formLoading"
  119. style="margin-top: 1em"
  120. label-width="200px"
  121. :disabled="isReadonlyMode"
  122. >
  123. <!-- 第一行:时间节点、施工状态 -->
  124. <el-row :gutter="30">
  125. <el-col :span="12">
  126. <el-form-item label="时间节点" prop="timeRange">
  127. <el-time-picker
  128. is-range
  129. v-model="formData.timeRange"
  130. range-separator="至"
  131. start-placeholder="开始时间"
  132. end-placeholder="结束时间"
  133. placeholder="选择时间范围"
  134. style="width: 100%"
  135. :readonly="isReadonlyMode"
  136. :disabled="isReadonlyMode"
  137. />
  138. </el-form-item>
  139. </el-col>
  140. <el-col :span="12">
  141. <el-form-item label="施工状态" prop="rdStatus">
  142. <el-select v-model="formData.rdStatus" placeholder="请选择施工状态"
  143. style="width: 100%" :disabled="isReadonlyMode">
  144. <el-option
  145. v-for="dict in rdStatusOptions"
  146. :key="dict.value"
  147. :label="dict.label"
  148. :value="dict.value"
  149. />
  150. </el-select>
  151. </el-form-item>
  152. </el-col>
  153. </el-row>
  154. <!-- 施工设备字段 -->
  155. <el-row>
  156. <el-col :span="24">
  157. <el-form-item label="施工设备" prop="deviceIds">
  158. <!-- 编辑模式:显示选择按钮 -->
  159. <template v-if="isEditMode">
  160. <el-button
  161. @click="openDeviceDialog"
  162. type="primary"
  163. size="small"
  164. :disabled="formLoading"
  165. >
  166. 选择设备
  167. </el-button>
  168. <el-tooltip
  169. v-if="formData.deviceIds && formData.deviceIds.length > 0"
  170. :content="getAllDeviceNamesForDisplay"
  171. placement="top"
  172. >
  173. <span class="device-display-container">
  174. {{ formatDevicesForDisplay }}
  175. </span>
  176. </el-tooltip>
  177. <span v-else class="no-device">
  178. 未选择设备
  179. </span>
  180. </template>
  181. <!-- 只读模式:只显示设备信息 -->
  182. <template v-else>
  183. <el-tooltip
  184. v-if="formData.deviceIds && formData.deviceIds.length > 0"
  185. :content="getAllDeviceNamesForDisplay"
  186. placement="top"
  187. >
  188. <span class="device-display-container">
  189. {{ formatDevicesForDisplay }}
  190. </span>
  191. </el-tooltip>
  192. <span v-else class="no-device">-</span>
  193. </template>
  194. </el-form-item>
  195. </el-col>
  196. </el-row>
  197. <!-- 第二行:施工工艺 -->
  198. <el-row>
  199. <el-col :span="24">
  200. <el-form-item label="施工工艺" prop="techniqueIds">
  201. <el-select v-model="formData.techniqueIds" placeholder="请选择施工工艺"
  202. style="width: 100%" multiple :disabled="isReadonlyMode">
  203. <el-option
  204. v-for="dict in techniqueOptions"
  205. :key="dict.value"
  206. :label="dict.label"
  207. :value="dict.value"
  208. />
  209. </el-select>
  210. </el-form-item>
  211. </el-col>
  212. </el-row>
  213. <!-- 动态属性区域:施工工艺与当日生产动态之间 -->
  214. <el-row v-if="dynamicAttrs.length > 0" :gutter="30">
  215. <el-col
  216. v-for="attr in dynamicAttrs"
  217. :key="attr.id"
  218. :span="attr.dataType === 'textarea' ? 24 : 12"
  219. >
  220. <el-form-item
  221. :label="attr.name + (attr.unit ? `(${attr.unit})` : '')"
  222. :prop="'dynamicFields.' + attr.identifier"
  223. :rules="isReadonlyMode ? [] : getDynamicAttrRules(attr)"
  224. >
  225. <!-- 文本类型 -->
  226. <el-input
  227. v-if="attr.dataType === 'text'"
  228. v-model="formData.dynamicFields[attr.identifier]"
  229. :placeholder="`请输入${attr.name}`"
  230. :readonly="isReadonlyMode"
  231. />
  232. <!-- 文本域类型 -->
  233. <el-input
  234. v-else-if="attr.dataType === 'textarea'"
  235. v-model="formData.dynamicFields[attr.identifier]"
  236. :placeholder="`请输入${attr.name}`"
  237. type="textarea"
  238. :rows="3"
  239. :readonly="isReadonlyMode"
  240. />
  241. <!-- 数字类型 -->
  242. <el-input
  243. v-else-if="attr.dataType === 'double'"
  244. v-model="formData.dynamicFields[attr.identifier]"
  245. :placeholder="`请输入${attr.name}`"
  246. type="number"
  247. :min="attr.minValue || undefined"
  248. :max="attr.maxValue || undefined"
  249. :readonly="isReadonlyMode"
  250. />
  251. <!-- 日期类型 -->
  252. <el-date-picker
  253. v-else-if="attr.dataType === 'date'"
  254. v-model="formData.dynamicFields[attr.identifier]"
  255. type="date"
  256. value-format="x"
  257. :placeholder="`选择${attr.name}`"
  258. style="width: 100%"
  259. :readonly="isReadonlyMode"
  260. />
  261. <!-- 默认文本输入 -->
  262. <el-input
  263. v-else
  264. v-model="formData.dynamicFields[attr.identifier]"
  265. :placeholder="`请输入${attr.name}`"
  266. :readonly="isReadonlyMode"
  267. />
  268. </el-form-item>
  269. </el-col>
  270. </el-row>
  271. <!-- 第三行:当日生产动态 -->
  272. <el-row>
  273. <el-col :span="24">
  274. <el-form-item label="当日生产动态" prop="productionStatus">
  275. <el-input
  276. v-model="formData.productionStatus"
  277. type="textarea"
  278. :rows="3"
  279. placeholder="请输入当日生产动态"
  280. :readonly="isReadonlyMode"
  281. />
  282. </el-form-item>
  283. </el-col>
  284. </el-row>
  285. <!-- 第四行:下步工作计划 -->
  286. <el-row>
  287. <el-col :span="24">
  288. <el-form-item label="下步工作计划" prop="nextPlan">
  289. <el-input
  290. v-model="formData.nextPlan"
  291. type="textarea"
  292. :rows="3"
  293. placeholder="请输入下步工作计划"
  294. :readonly="isReadonlyMode"
  295. />
  296. </el-form-item>
  297. </el-col>
  298. </el-row>
  299. <!-- 第五行:外租设备 -->
  300. <el-row>
  301. <el-col :span="24">
  302. <el-form-item label="外租设备" prop="externalRental">
  303. <el-input
  304. v-model="formData.externalRental"
  305. type="textarea"
  306. :rows="3"
  307. placeholder="请输入外租设备信息"
  308. :readonly="isReadonlyMode"
  309. />
  310. </el-form-item>
  311. </el-col>
  312. </el-row>
  313. <!-- 故障情况 -->
  314. <el-row>
  315. <el-col :span="24">
  316. <el-form-item label="故障情况" prop="malfunction">
  317. <el-input
  318. v-model="formData.malfunction"
  319. type="textarea"
  320. :rows="3"
  321. placeholder="请输入故障情况"
  322. :readonly="isReadonlyMode"
  323. />
  324. </el-form-item>
  325. </el-col>
  326. </el-row>
  327. <!-- 故障误工H -->
  328. <el-row>
  329. <el-col :span="24">
  330. <el-form-item label="故障误工H" prop="faultDowntime">
  331. <el-input
  332. v-model="formData.faultDowntime"
  333. type="number"
  334. :rows="3"
  335. placeholder="请输入故障误工H"
  336. :readonly="isReadonlyMode"
  337. />
  338. </el-form-item>
  339. </el-col>
  340. </el-row>
  341. <!-- 第六行:上传附件 -->
  342. <el-row>
  343. <el-col :span="24">
  344. <el-form-item label="附件">
  345. <!-- 文件上传组件 -->
  346. <FileUpload
  347. v-if="!isReadonlyMode"
  348. ref="fileUploadRef"
  349. :device-id="deviceId"
  350. :show-folder-button="false"
  351. @upload-success="handleUploadSuccess"
  352. />
  353. <!-- 已上传附件列表显示 -->
  354. <div v-if="formData.attachments && formData.attachments.length > 0" class="attachment-container">
  355. <div class="attachment-list">
  356. <div
  357. v-for="(attachment, index) in formData.attachments"
  358. :key="attachment.id || index"
  359. class="attachment-item"
  360. >
  361. <!-- 为附件名称添加点击事件,传递整个附件对象 -->
  362. <a class="attachment-name" @click="inContent(attachment)">
  363. {{ attachment.filename }}
  364. </a>
  365. <el-button
  366. v-if="!isReadonlyMode"
  367. type="danger"
  368. link
  369. size="small"
  370. @click="removeAttachment(index)"
  371. >
  372. 删除
  373. </el-button>
  374. </div>
  375. </div>
  376. </div>
  377. <!-- 审批模式下只显示附件列表 -->
  378. <div v-else-if="isApprovalMode && (!formData.attachments || formData.attachments.length === 0)" class="no-attachment">
  379. 无附件
  380. </div>
  381. </el-form-item>
  382. </el-col>
  383. </el-row>
  384. </el-form>
  385. </ContentWrap>
  386. <!-- 第四部分:审批意见 - 只在审批模式下显示 -->
  387. <ContentWrap class="section-padding" v-if="isApprovalMode">
  388. <el-form
  389. ref="approvalFormRef"
  390. :model="approvalForm"
  391. style="margin-top: 1em"
  392. label-width="200px"
  393. >
  394. <el-row>
  395. <el-col :span="24">
  396. <el-form-item label="审批意见" prop="opinion">
  397. <el-input
  398. v-model="approvalForm.opinion"
  399. type="textarea"
  400. :rows="4"
  401. placeholder="请输入审批意见"
  402. maxlength="500"
  403. show-word-limit
  404. />
  405. </el-form-item>
  406. </el-col>
  407. </el-row>
  408. </el-form>
  409. </ContentWrap>
  410. <!-- 操作按钮 -->
  411. <ContentWrap class="section-padding" v-if="isEditMode">
  412. <el-form>
  413. <el-form-item style="float: right">
  414. <el-button @click="submitForm" type="primary" :disabled="formLoading">
  415. {{ t('common.save') }}
  416. </el-button>
  417. <el-button @click="close">{{ t('common.cancel') }}</el-button>
  418. </el-form-item>
  419. </el-form>
  420. </ContentWrap>
  421. <!-- 审批模式下的操作按钮 -->
  422. <ContentWrap class="section-padding" v-if="isApprovalMode">
  423. <el-form>
  424. <el-form-item style="float: right">
  425. <el-button @click="handleApprove('pass')" type="success">
  426. 审批通过
  427. </el-button>
  428. <el-button @click="handleApprove('reject')" type="danger">
  429. 审批驳回
  430. </el-button>
  431. <el-button @click="close">{{ t('common.close') }}</el-button>
  432. </el-form-item>
  433. </el-form>
  434. </ContentWrap>
  435. <!-- 详情模式下的操作按钮 - 只有关闭按钮 -->
  436. <ContentWrap class="section-padding" v-if="isDetailMode">
  437. <el-form>
  438. <el-form-item style="float: right">
  439. <el-button @click="close">{{ t('common.close') }}</el-button>
  440. </el-form-item>
  441. </el-form>
  442. </ContentWrap>
  443. </ContentWrap>
  444. <!-- 设备选择对话框 -->
  445. <el-dialog
  446. v-model="deviceDialogVisible"
  447. title="选择施工设备"
  448. width="1000px"
  449. :before-close="handleDeviceDialogClose"
  450. class="device-select-dialog"
  451. >
  452. <div class="transfer-container">
  453. <el-transfer
  454. v-model="selectedDeviceIds"
  455. :data="filteredDeviceList"
  456. :titles="['可选设备', '已选设备']"
  457. :props="{ key: 'id', label: 'deviceCode' }"
  458. filterable
  459. class="transfer-component"
  460. @change="handleTransferChange"
  461. >
  462. <template #default="{ option }">
  463. <el-tooltip
  464. effect="dark"
  465. placement="top"
  466. :content="`${option.deviceCode || ''} - ${option.deviceName || ''}`"
  467. :disabled="!option.deviceCode && !option.deviceName"
  468. transition="fade-in-linear"
  469. >
  470. <span class="transfer-option-text">
  471. {{ option.deviceCode }} - {{ option.deviceName }}
  472. </span>
  473. </el-tooltip>
  474. </template>
  475. </el-transfer>
  476. </div>
  477. <template #footer>
  478. <span class="dialog-footer">
  479. <el-button @click="handleDeviceDialogClose">取消</el-button>
  480. <el-button type="primary" @click="confirmDeviceSelection">确定</el-button>
  481. </span>
  482. </template>
  483. </el-dialog>
  484. </template>
  485. <script setup lang="ts">
  486. import { ref, reactive, computed, onMounted, nextTick, watch } from 'vue'
  487. import { useI18n } from '@/hooks/web/useI18n'
  488. import { useMessage } from '@/hooks/web/useMessage'
  489. import { useTagsViewStore } from '@/store/modules/tagsView'
  490. import { useRouter, useRoute } from 'vue-router'
  491. import {DICT_TYPE, getDictLabel, getStrDictOptions} from '@/utils/dict'
  492. import { IotRdDailyReportApi } from '@/api/pms/iotrddailyreport'
  493. import { IotDailyReportAttrsApi } from '@/api/pms/iotdailyreportattrs'
  494. import * as DeptApi from '@/api/system/dept'
  495. import { useUserStore } from '@/store/modules/user'
  496. import dayjs from 'dayjs'
  497. import FileUpload from "@/components/UploadFile/src/FileUpload.vue";
  498. const { t } = useI18n()
  499. const message = useMessage()
  500. const { delView } = useTagsViewStore()
  501. const { push, currentRoute } = useRouter()
  502. const { params } = useRoute()
  503. const userStore = useUserStore()
  504. /** 填报日报 表单 */
  505. defineOptions({ name: 'FillDailyReportForm' })
  506. const formLoading = ref(false)
  507. const formRef = ref()
  508. const id = params.id // 瑞都日报id
  509. // 日报数据
  510. const dailyReportData = ref<any>({})
  511. // 添加模式判断计算属性
  512. const isApprovalMode = computed(() => params.mode === 'approval')
  513. const isDetailMode = computed(() => params.mode === 'detail')
  514. const isEditMode = computed(() => params.mode === 'fill' || !params.mode) // 默认为编辑模式
  515. // 只读模式判断:审批模式或详情模式都为只读
  516. const isReadonlyMode = computed(() => isApprovalMode.value || isDetailMode.value)
  517. // 页面标题计算
  518. const pageTitle = computed(() => {
  519. if (isApprovalMode.value) {
  520. return dailyReportData.value.wellName && dailyReportData.value.constructionStartDate
  521. ? `${dailyReportData.value.wellName} - ${formatDate(dailyReportData.value.constructionStartDate)} 日报审批`
  522. : '日报审批'
  523. } else if (isDetailMode.value) {
  524. return dailyReportData.value.wellName && dailyReportData.value.constructionStartDate
  525. ? `${dailyReportData.value.wellName} - ${formatDate(dailyReportData.value.constructionStartDate)} 日报详情`
  526. : '日报详情'
  527. } else {
  528. return dailyReportData.value.wellName && dailyReportData.value.constructionStartDate
  529. ? `${dailyReportData.value.wellName} - ${formatDate(dailyReportData.value.constructionStartDate)} 生产日报`
  530. : '日报填报'
  531. }
  532. })
  533. // 模式提示信息
  534. const modeNotice = computed(() => {
  535. if (isApprovalMode.value) {
  536. return '审批模式:所有字段均为只读'
  537. } else if (isDetailMode.value) {
  538. return '详情模式:所有字段均为只读'
  539. }
  540. return ''
  541. })
  542. // 动态属性相关变量
  543. const dynamicAttrs = ref<any[]>([]) // 存储动态属性列表
  544. // 添加设备选择相关变量
  545. const deviceDialogVisible = ref(false)
  546. const filteredDeviceList = ref<any[]>([])
  547. const selectedDeviceIds = ref<number[]>([])
  548. const deviceMap = ref<Record<number, any>>({})
  549. // 添加审批表单相关变量
  550. const approvalFormRef = ref()
  551. const approvalForm = reactive({
  552. opinion: '' // 审批意见
  553. })
  554. // 审批表单验证规则(可选,根据需求添加)
  555. const approvalFormRules = reactive({
  556. opinion: [
  557. { required: false, message: '请输入审批意见', trigger: 'blur' },
  558. { min: 0, max: 500, message: '审批意见长度不能超过500个字符', trigger: 'blur' }
  559. ]
  560. })
  561. // 添加文件上传组件的引用
  562. const fileUploadRef = ref()
  563. // 表单数据
  564. const formData = ref({
  565. id: undefined,
  566. deptId: undefined,
  567. companyId: undefined,
  568. deptName: undefined,
  569. constructionStartDate: undefined,
  570. contractName: undefined,
  571. projectDepartment: '',
  572. costCenterId: undefined,
  573. costCenter: '',
  574. // 新增日报填报字段
  575. timeRange: [ // 设置默认时间范围 8:00 - 8:00
  576. dayjs().hour(8).minute(0).second(0).toDate(),
  577. dayjs().hour(8).minute(0).second(0).toDate()
  578. ],
  579. startTime: undefined, // 开始时间
  580. endTime: undefined, // 结束时间
  581. rdStatus: '', // 施工状态
  582. deviceIds: [] as number[], // 设备ID数组
  583. techniqueIds: [], // 施工工艺
  584. productionStatus: '', // 当日生产动态
  585. nextPlan: '', // 下步工作计划
  586. externalRental: '', // 外租设备
  587. malfunction: '', // 故障情况
  588. faultDowntime: '', // 故障误工
  589. // 添加动态字段对象
  590. dynamicFields: {} as Record<string, any>,
  591. // 附件列表
  592. attachments: [] as any[]
  593. })
  594. // 添加上传成功处理函数
  595. const handleUploadSuccess = (result: any) => {
  596. console.log('上传成功:', result)
  597. try {
  598. // 检查响应是否成功
  599. if (!result.response) {
  600. message.error('上传响应数据异常')
  601. return
  602. }
  603. if (result.response.code !== 0) {
  604. message.error(result.response.msg || '文件上传失败')
  605. return
  606. }
  607. const responseData = result.response.data
  608. if (!responseData) {
  609. message.error('上传数据为空')
  610. return
  611. }
  612. // 处理返回的文件列表
  613. if (responseData.files && Array.isArray(responseData.files) && responseData.files.length > 0) {
  614. responseData.files.forEach((file: any) => {
  615. if (!file.filePath) {
  616. console.warn('文件缺少 filePath:', file)
  617. return
  618. }
  619. // 根据后端返回的数据结构构建附件对象
  620. const attachment = {
  621. id: undefined,
  622. category: 'daily_report',
  623. bizId: formData.value.id,
  624. type: 'attachment',
  625. filename: file.name || '未知文件',
  626. fileType: getFileType(file.name),
  627. filePath: file.filePath, //使用正确的 filePath
  628. fileSize: formatFileSize(file.size || 0),
  629. remark: ''
  630. }
  631. // 添加到附件列表
  632. if (!formData.value.attachments) {
  633. formData.value.attachments = []
  634. }
  635. formData.value.attachments.push(attachment)
  636. })
  637. message.success(`成功上传 ${responseData.files.length} 个文件`)
  638. } else {
  639. console.warn('上传成功但没有返回文件信息')
  640. message.warning('上传成功但未获取到文件信息')
  641. }
  642. } catch (error) {
  643. console.error('处理上传结果时发生错误:', error)
  644. message.error('处理上传结果失败')
  645. }
  646. }
  647. // 删除附件
  648. const removeAttachment = (index: number) => {
  649. if (formData.value.attachments && formData.value.attachments.length > index) {
  650. formData.value.attachments.splice(index, 1)
  651. }
  652. }
  653. // 附件名称点击事件
  654. const inContent = async (attachment) => {
  655. if (!attachment || !attachment.filePath) {
  656. message.error('附件路径不存在')
  657. return
  658. }
  659. try {
  660. // 直接使用 attachment.filePath
  661. const filePath = attachment.filePath
  662. // 确保 filePath 是编码后的格式
  663. const encodedPath = encodeURIComponent(Base64.encode(filePath))
  664. // 打开预览窗口
  665. window.open(`http://doc.deepoil.cc:8012/onlinePreview?url=${encodedPath}`)
  666. } catch (error) {
  667. console.error('预览附件失败:', error)
  668. message.error('预览附件失败')
  669. }
  670. }
  671. // 获取文件类型辅助函数
  672. const getFileType = (filename: string) => {
  673. const ext = filename.split('.').pop()?.toLowerCase()
  674. if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(ext || '')) {
  675. return 'image'
  676. } else if (['pdf'].includes(ext || '')) {
  677. return 'pdf'
  678. } else if (['doc', 'docx'].includes(ext || '')) {
  679. return 'word'
  680. } else if (['xls', 'xlsx'].includes(ext || '')) {
  681. return 'excel'
  682. } else {
  683. return 'other'
  684. }
  685. }
  686. // 格式化文件大小辅助函数
  687. const formatFileSize = (bytes: number) => {
  688. if (bytes === 0) return '0 Bytes'
  689. const k = 1024
  690. const sizes = ['Bytes', 'KB', 'MB', 'GB']
  691. const i = Math.floor(Math.log(bytes) / Math.log(k))
  692. return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
  693. }
  694. // 计算属性:格式化设备显示
  695. const formatDevicesForDisplay = computed(() => {
  696. const deviceIds = formData.value.deviceIds
  697. if (!deviceIds || deviceIds.length === 0) {
  698. return '无设备'
  699. }
  700. const deviceNames = deviceIds
  701. .map(id => deviceMap.value[id]?.deviceCode)
  702. .filter(name => name !== undefined && name !== '')
  703. if (deviceNames.length === 0) return '无设备'
  704. // 如果设备数量超过2个,显示前两个加省略号
  705. /* if (deviceNames.length > 2) {
  706. return `${deviceNames[0]}, ${deviceNames[1]}...`
  707. } */
  708. return deviceNames.join(', ')
  709. })
  710. // 计算属性:获取所有设备名称(用于tooltip)
  711. const getAllDeviceNamesForDisplay = computed(() => {
  712. const deviceIds = formData.value.deviceIds
  713. if (!deviceIds || deviceIds.length === 0) {
  714. return '无设备'
  715. }
  716. const deviceNames = deviceIds
  717. .map(id => deviceMap.value[id]?.deviceCode || '未知设备')
  718. .filter(name => name !== '未知设备')
  719. return deviceNames.join(', ') || '无有效设备'
  720. })
  721. // 打开设备选择对话框
  722. const openDeviceDialog = async () => {
  723. if (!dailyReportData.value.deptId) {
  724. message.error('请先加载项目信息')
  725. return
  726. }
  727. try {
  728. formLoading.value = true
  729. selectedDeviceIds.value = [...(formData.value.deviceIds || [])]
  730. // 直接从日报数据的 selectedDevices 中获取设备列表
  731. const selectedDevices = dailyReportData.value.selectedDevices || []
  732. // 更新设备映射表
  733. const newDeviceMap = { ...deviceMap.value }
  734. selectedDevices.forEach((device: any) => {
  735. if (device.id) {
  736. newDeviceMap[device.id] = device
  737. }
  738. })
  739. deviceMap.value = newDeviceMap
  740. filteredDeviceList.value = selectedDevices
  741. deviceDialogVisible.value = true
  742. } catch (error) {
  743. console.error('获取设备列表失败:', error)
  744. message.error('获取设备列表失败')
  745. } finally {
  746. formLoading.value = false
  747. }
  748. }
  749. // 处理穿梭框变化
  750. const handleTransferChange = (value: number[], direction: string, movedKeys: number[]) => {
  751. // 可以添加额外的处理逻辑
  752. }
  753. // 确认设备选择
  754. const confirmDeviceSelection = () => {
  755. formData.value.deviceIds = [...selectedDeviceIds.value]
  756. deviceDialogVisible.value = false
  757. message.success(`已选择 ${selectedDeviceIds.value.length} 台设备`)
  758. }
  759. // 关闭设备选择对话框
  760. const handleDeviceDialogClose = () => {
  761. deviceDialogVisible.value = false
  762. }
  763. // 初始化设备数据
  764. const initDeviceData = (reportData: any) => {
  765. // 初始化设备ID
  766. if (reportData.deviceIds && Array.isArray(reportData.deviceIds)) {
  767. formData.value.deviceIds = [...reportData.deviceIds]
  768. } else {
  769. formData.value.deviceIds = []
  770. }
  771. // 初始化设备映射表(用于显示设备名称)
  772. if (reportData.selectedDevices && Array.isArray(reportData.selectedDevices)) {
  773. const newDeviceMap = { ...deviceMap.value }
  774. reportData.selectedDevices.forEach((device: any) => {
  775. if (device.id) {
  776. newDeviceMap[device.id] = device
  777. }
  778. })
  779. deviceMap.value = newDeviceMap
  780. }
  781. }
  782. // 表单验证规则
  783. const formRules = reactive({
  784. timeRange: [{ required: true, message: '时间节点不能为空', trigger: 'change' }],
  785. rdStatus: [{ required: true, message: '施工状态不能为空', trigger: 'change' }],
  786. techniqueIds: [{ required: true, message: '施工工艺不能为空', trigger: 'change' }],
  787. productionStatus: [{ required: true, message: '当日生产动态不能为空', trigger: 'blur' }]
  788. })
  789. const queryParams = reactive({
  790. deptId: undefined,
  791. techniqueIds: [],
  792. })
  793. // 下拉选项
  794. const rdStatusOptions = getStrDictOptions(DICT_TYPE.PMS_PROJECT_RD_STATUS) // 施工状态
  795. const techniqueOptions = getStrDictOptions(DICT_TYPE.PMS_PROJECT_RD_TECHNOLOGY) // 瑞都施工工艺
  796. // 计算属性:日报标题
  797. const dailyReportTitle = computed(() => {
  798. if (!dailyReportData.value.wellName || !dailyReportData.value.constructionStartDate) {
  799. return '日报填报'
  800. }
  801. const dateStr = formatDate(dailyReportData.value.constructionStartDate)
  802. return `${dailyReportData.value.wellName} - ${dateStr} 生产日报`
  803. })
  804. // 日报审批:日报标题
  805. const dailyReportApprovalTitle = computed(() => {
  806. if (!dailyReportData.value.wellName || !dailyReportData.value.constructionStartDate) {
  807. return '日报审批'
  808. }
  809. const dateStr = formatDate(dailyReportData.value.constructionStartDate)
  810. return `${dailyReportData.value.wellName} - ${dateStr} 日报审批`
  811. })
  812. // 计算属性:施工周期
  813. const constructionPeriod = computed(() => {
  814. const start = dailyReportData.value.constructionStartDate
  815. const end = dailyReportData.value.constructionEndDate
  816. if (!start || !end) return 0
  817. const startDate = dayjs(start)
  818. const endDate = dayjs(end)
  819. return endDate.diff(startDate, 'day')
  820. })
  821. // 日期格式化函数
  822. const formatDate = (timestamp: number) => {
  823. if (!timestamp) return ''
  824. return dayjs(timestamp).format('YYYY-MM-DD')
  825. }
  826. const close = () => {
  827. delView(unref(currentRoute))
  828. push({ name: 'FillDailyReport', params: {} })
  829. }
  830. /** 提交表单 */
  831. const emit = defineEmits(['success'])
  832. const submitForm = async () => {
  833. // 验证表单
  834. try {
  835. await formRef.value.validate()
  836. } catch (error) {
  837. return
  838. }
  839. // 处理时间范围数据
  840. if (formData.value.timeRange && formData.value.timeRange.length === 2) {
  841. // 将时间范围转换为 LocalTime 格式的字符串
  842. const startDate = dayjs(formData.value.timeRange[0])
  843. const endDate = dayjs(formData.value.timeRange[1])
  844. // 格式化为 HH:mm:ss 字符串,后端会自动转换为 LocalTime
  845. formData.value.startTime = startDate.format('HH:mm:ss')
  846. formData.value.endTime = endDate.format('HH:mm:ss')
  847. }
  848. // 构建动态属性 extProperty 数组
  849. const extProperties = dynamicAttrs.value.map(attr => {
  850. return {
  851. name: attr.name,
  852. sort: attr.sort,
  853. unit: attr.unit,
  854. actualValue: formData.value.dynamicFields[attr.identifier] || '', // 从 dynamicFields 中获取用户填写的值
  855. dataType: attr.dataType,
  856. maxValue: attr.maxValue,
  857. minValue: attr.minValue,
  858. required: attr.required,
  859. accessMode: attr.accessMode,
  860. identifier: attr.identifier,
  861. defaultValue: attr.defaultValue
  862. }
  863. })
  864. // 准备提交数据,包含动态字段
  865. const submitData = {
  866. ...formData.value,
  867. // 将动态字段组装成 extProperty 数组
  868. extProperty: extProperties,
  869. deviceIds: formData.value.deviceIds, // 设备ID集合
  870. }
  871. // 提交请求
  872. formLoading.value = true
  873. try {
  874. // 调用更新接口
  875. await IotRdDailyReportApi.updateIotRdDailyReport(submitData)
  876. message.success(t('common.updateSuccess'))
  877. close()
  878. // 发送操作成功的事件
  879. emit('success')
  880. } catch (error) {
  881. console.error('提交失败:', error)
  882. } finally {
  883. formLoading.value = false
  884. }
  885. }
  886. /** 重置表单 */
  887. const resetForm = () => {
  888. formRef.value?.resetFields()
  889. }
  890. // 初始化动态属性
  891. const initDynamicAttrs = (reportData: any) => {
  892. if (reportData.dailyReportAttrs && reportData.dailyReportAttrs.length > 0) {
  893. dynamicAttrs.value = reportData.dailyReportAttrs
  894. // 初始化动态字段的值
  895. const initialDynamicFields: Record<string, any> = {}
  896. // 优先从 extProperty 中获取实际值(编辑时)
  897. if (reportData.extProperty && reportData.extProperty.length > 0) {
  898. reportData.extProperty.forEach((extProp: any) => {
  899. if (extProp.identifier) {
  900. initialDynamicFields[extProp.identifier] = extProp.actualValue || ''
  901. }
  902. })
  903. }
  904. reportData.dailyReportAttrs.forEach((attr: any) => {
  905. if (!initialDynamicFields.hasOwnProperty(attr.identifier)) {
  906. // 优先使用实际值,如果没有则使用默认值
  907. const value = (attr.extProperty && attr.extProperty.actualValue !== undefined &&
  908. attr.extProperty.actualValue !== null && attr.extProperty.actualValue !== '')
  909. ? attr.extProperty.actualValue
  910. : (attr.defaultValue || (attr.extProperty?.defaultValue || ''))
  911. initialDynamicFields[attr.identifier] = value
  912. }
  913. })
  914. formData.value.dynamicFields = initialDynamicFields
  915. }
  916. }
  917. // 获取动态字段的验证规则
  918. const getDynamicAttrRules = (attr: any) => {
  919. const rules = []
  920. if (attr.required === 1) {
  921. rules.push({
  922. required: true,
  923. message: `${attr.name}不能为空`,
  924. trigger: 'blur'
  925. })
  926. }
  927. // 数字类型验证
  928. if (attr.dataType === 'double') {
  929. rules.push({
  930. validator: (rule: any, value: any, callback: any) => {
  931. if (value === '' || value === null || value === undefined) {
  932. callback()
  933. return
  934. }
  935. const numValue = Number(value)
  936. if (isNaN(numValue)) {
  937. callback(new Error(`${attr.name}必须是数字`))
  938. } else if (attr.minValue && numValue < Number(attr.minValue)) {
  939. callback(new Error(`${attr.name}不能小于${attr.minValue}`))
  940. } else if (attr.maxValue && numValue > Number(attr.maxValue)) {
  941. callback(new Error(`${attr.name}不能大于${attr.maxValue}`))
  942. } else {
  943. callback()
  944. }
  945. },
  946. trigger: 'blur'
  947. })
  948. }
  949. return rules
  950. }
  951. // 更新动态属性(处理交集、新增和删除)
  952. const updateDynamicAttrs = async (newAttrs: any[], newTechniqueIds: string[], oldTechniqueIds?: string[]) => {
  953. const oldAttrs = [...dynamicAttrs.value]
  954. const oldDynamicFields = { ...formData.value.dynamicFields }
  955. // 计算需要保留的字段(交集)
  956. const commonAttrs = oldAttrs.filter(oldAttr =>
  957. newAttrs.some(newAttr => newAttr.identifier === oldAttr.identifier)
  958. )
  959. // 计算需要新增的字段
  960. const addedAttrs = newAttrs.filter(newAttr =>
  961. !oldAttrs.some(oldAttr => oldAttr.identifier === newAttr.identifier)
  962. )
  963. // 计算需要删除的字段
  964. const removedAttrs = oldAttrs.filter(oldAttr =>
  965. !newAttrs.some(newAttr => newAttr.identifier === oldAttr.identifier)
  966. )
  967. // 构建新的动态属性数组
  968. const updatedAttrs = [...commonAttrs, ...addedAttrs]
  969. // 构建新的动态字段对象
  970. const updatedDynamicFields = { ...oldDynamicFields }
  971. // 移除已删除的字段
  972. removedAttrs.forEach(attr => {
  973. delete updatedDynamicFields[attr.identifier]
  974. })
  975. // 初始化新增字段的值
  976. addedAttrs.forEach(attr => {
  977. if (!updatedDynamicFields[attr.identifier]) {
  978. // 如果有默认值使用默认值,否则为空
  979. updatedDynamicFields[attr.identifier] = attr.defaultValue ||
  980. (attr.extProperty?.defaultValue || '')
  981. }
  982. })
  983. // 更新响应式数据
  984. dynamicAttrs.value = updatedAttrs
  985. formData.value.dynamicFields = updatedDynamicFields
  986. }
  987. // 加载动态属性
  988. const loadDynamicAttrs = async (newTechniqueIds: string[], oldTechniqueIds?: string[]) => {
  989. try {
  990. formLoading.value = true
  991. const queryParams = {
  992. techniqueIds: newTechniqueIds.join(',')
  993. }
  994. const response = await IotDailyReportAttrsApi.dailyReportAttrs(queryParams)
  995. const newAttrs = response || []
  996. // 处理动态属性更新
  997. await updateDynamicAttrs(newAttrs, newTechniqueIds, oldTechniqueIds)
  998. } catch (error) {
  999. console.error('加载动态属性失败:', error)
  1000. message.error('加载动态属性失败')
  1001. } finally {
  1002. formLoading.value = false
  1003. }
  1004. }
  1005. // 监听施工工艺变化
  1006. watch(() => formData.value.techniqueIds, async (newTechniqueIds, oldTechniqueIds) => {
  1007. if (newTechniqueIds && newTechniqueIds.length > 0) {
  1008. await loadDynamicAttrs(newTechniqueIds, oldTechniqueIds)
  1009. } else {
  1010. dynamicAttrs.value = []
  1011. formData.value.dynamicFields = {}
  1012. }
  1013. }, { deep: true })
  1014. // 初始化表单数据
  1015. const initFormData = (reportData: any) => {
  1016. // 处理附件数据格式转换
  1017. const formattedAttachments = (reportData.attachments || []).map((attachment: any) => ({
  1018. id: attachment.id,
  1019. category: attachment.category?.toLowerCase() || 'daily_report',
  1020. bizId: attachment.bizId,
  1021. type: attachment.type?.toLowerCase() || 'attachment',
  1022. filename: attachment.filename,
  1023. fileType: attachment.fileType, // 使用辅助函数获取文件类型
  1024. filePath: attachment.filePath,
  1025. fileSize: attachment.fileSize,
  1026. remark: attachment.remark || ''
  1027. }))
  1028. formData.value = {
  1029. ...formData.value,
  1030. id: reportData.id,
  1031. deptId: reportData.deptId,
  1032. rdStatus: reportData.rdStatus || '',
  1033. techniqueIds: reportData.techniqueIds ? reportData.techniqueIds.map((id: number) => id.toString()) : [],
  1034. productionStatus: reportData.productionStatus || '',
  1035. nextPlan: reportData.nextPlan || '',
  1036. externalRental: reportData.externalRental || '',
  1037. malfunction: reportData.malfunction || '',
  1038. faultDowntime: reportData.faultDowntime || '',
  1039. startTime: reportData.startTime || undefined,
  1040. endTime: reportData.endTime || undefined,
  1041. companyId: reportData.companyId || '',
  1042. dynamicFields: {}, // 确保有初始值
  1043. // 初始化附件数据
  1044. attachments: formattedAttachments
  1045. }
  1046. queryParams.deptId = reportData.companyId
  1047. // 设置时间范围选择器
  1048. if (reportData.startTime && reportData.startTime[0] && reportData.endTime && reportData.endTime[0]) {
  1049. formData.value.timeRange = [
  1050. new Date(reportData.startTime[0]),
  1051. new Date(reportData.endTime[0])
  1052. ]
  1053. }
  1054. // 初始化动态属性
  1055. initDynamicAttrs(reportData)
  1056. // 初始化设备数据
  1057. initDeviceData(reportData)
  1058. }
  1059. onMounted(async () => {
  1060. formLoading.value = true
  1061. try {
  1062. // 加载当前登录人所属部门
  1063. const deptId = userStore.getUser.deptId
  1064. const dept = await DeptApi.getDept(deptId)
  1065. // 查询瑞都日报详情
  1066. if (id) {
  1067. const response = await IotRdDailyReportApi.getIotRdDailyReport(id)
  1068. dailyReportData.value = response || {}
  1069. initFormData(dailyReportData.value)
  1070. }
  1071. } catch (error) {
  1072. console.error('初始化数据失败:', error)
  1073. message.error('数据加载失败')
  1074. } finally {
  1075. formLoading.value = false
  1076. }
  1077. })
  1078. /** 审批操作 */
  1079. const handleApprove = async (action: 'pass' | 'reject') => {
  1080. // 只有在审批模式下才执行审批操作
  1081. if (!isApprovalMode.value) {
  1082. message.warning('当前不是审批模式')
  1083. return
  1084. }
  1085. try {
  1086. // 验证审批表单(如果需要)
  1087. // await approvalFormRef.value.validate()
  1088. formLoading.value = true
  1089. // 处理时间范围数据
  1090. if (formData.value.timeRange && formData.value.timeRange.length === 2) {
  1091. // 将时间范围转换为 LocalTime 格式的字符串
  1092. const startDate = dayjs(formData.value.timeRange[0])
  1093. const endDate = dayjs(formData.value.timeRange[1])
  1094. // 格式化为 HH:mm:ss 字符串,后端会自动转换为 LocalTime
  1095. formData.value.startTime = startDate.format('HH:mm:ss')
  1096. formData.value.endTime = endDate.format('HH:mm:ss')
  1097. }
  1098. // 构建审批数据,包含审批意见
  1099. const approveData = {
  1100. ...formData.value,
  1101. id: Number(id),
  1102. opinion: approvalForm.opinion,
  1103. auditStatus: action === 'pass' ? 20 : 30
  1104. }
  1105. // 这里可以调用审批API
  1106. if (action === 'pass') {
  1107. // 审批通过逻辑
  1108. await IotRdDailyReportApi.approveRdDailyReport(approveData)
  1109. message.success('审批通过')
  1110. } else {
  1111. // 审批驳回逻辑
  1112. await IotRdDailyReportApi.approveRdDailyReport(approveData)
  1113. message.success('审批驳回')
  1114. }
  1115. close()
  1116. } catch (error) {
  1117. console.error('审批操作失败:', error)
  1118. message.error('审批操作失败')
  1119. } finally {
  1120. formLoading.value = false
  1121. }
  1122. }
  1123. </script>
  1124. <style scoped>
  1125. .info-table {
  1126. border: 1px solid #e0e0e0;
  1127. border-radius: 4px;
  1128. overflow: hidden;
  1129. }
  1130. .table-row {
  1131. display: flex;
  1132. border-bottom: 1px solid #e0e0e0;
  1133. }
  1134. .table-row:last-child {
  1135. border-bottom: none;
  1136. }
  1137. .table-cell {
  1138. flex: 1;
  1139. border-right: 1px solid #e0e0e0;
  1140. padding: 12px 8px;
  1141. min-height: 44px;
  1142. display: flex;
  1143. align-items: center;
  1144. }
  1145. .table-cell:last-child {
  1146. border-right: none;
  1147. }
  1148. .table-cell.full-width {
  1149. flex: 1;
  1150. border-right: none;
  1151. }
  1152. .cell-content {
  1153. display: flex;
  1154. align-items: center;
  1155. width: 100%;
  1156. }
  1157. .cell-label {
  1158. font-weight: 500;
  1159. /* 统一字体大小为 14px(Element 表单默认) */
  1160. font-size: 14px;
  1161. color: #606266;
  1162. min-width: 80px;
  1163. margin-right: 8px;
  1164. flex-shrink: 0;
  1165. }
  1166. .cell-value {
  1167. /* 统一字体大小为 14px(Element 输入框默认) */
  1168. font-size: 14px;
  1169. color: #303133;
  1170. /* 统一行高为 1.5(Element 组件默认行高) */
  1171. line-height: 1.5;
  1172. flex: 1;
  1173. word-break: break-all;
  1174. }
  1175. /* 响应式设计 */
  1176. @media (max-width: 768px) {
  1177. .table-row {
  1178. flex-direction: column;
  1179. }
  1180. .table-cell {
  1181. border-right: none;
  1182. border-bottom: 1px solid #e0e0e0;
  1183. }
  1184. .table-cell:last-child {
  1185. border-bottom: none;
  1186. }
  1187. }
  1188. .daily-report-title {
  1189. text-align: center;
  1190. margin: 20px 0;
  1191. padding: 10px;
  1192. border-bottom: 2px solid #409eff;
  1193. }
  1194. .daily-report-title h2 {
  1195. margin: 0;
  1196. color: #303133;
  1197. font-size: 16px;
  1198. font-weight: bold;
  1199. }
  1200. /* 为第二、三部分增加左右留白 */
  1201. .section-padding {
  1202. padding-left: 0px;
  1203. padding-right: 40px;
  1204. }
  1205. .project-info-section {
  1206. margin: 20px 0;
  1207. padding: 20px;
  1208. background-color: #f8f9fa;
  1209. border-radius: 4px;
  1210. border: 1px solid #e9ecef;
  1211. }
  1212. .info-row {
  1213. padding: 12px 0;
  1214. border-bottom: 1px solid #e9ecef;
  1215. }
  1216. .info-row:last-child {
  1217. border-bottom: none;
  1218. }
  1219. .info-label {
  1220. font-weight: bold;
  1221. color: #495057;
  1222. margin-right: 8px;
  1223. }
  1224. .info-value {
  1225. color: #212529;
  1226. }
  1227. :deep(.el-textarea .el-textarea__inner) {
  1228. min-height: 80px;
  1229. }
  1230. /* 确保表单label不换行 */
  1231. :deep(.el-form-item__label) {
  1232. white-space: nowrap;
  1233. text-overflow: ellipsis;
  1234. overflow: hidden;
  1235. }
  1236. /* 甲方字段:单行显示+超出省略 */
  1237. .single-line-ellipsis {
  1238. /* 强制文本单行显示 */
  1239. white-space: nowrap;
  1240. /* 超出容器部分隐藏 */
  1241. overflow: hidden;
  1242. /* 超出部分显示省略号 */
  1243. text-overflow: ellipsis;
  1244. /* 避免文本被截断(可选,根据需求调整) */
  1245. word-break: normal;
  1246. }
  1247. /* 设备配置字段:换行缩进(与首行对齐) */
  1248. .indent-multiline {
  1249. /* 首行及换行后缩进 2em(与 label 宽度匹配,可根据需求调整) */
  1250. text-indent: 0em;
  1251. /* 允许长文本换行(覆盖原有 cell-value 的 break-all,确保中文换行正常) */
  1252. word-break: break-word;
  1253. /* 保证换行后文本正常显示(可选,清除可能的 nowrap 影响) */
  1254. white-space: normal;
  1255. }
  1256. /* 添加审批模式下的样式 */
  1257. .approval-notice {
  1258. margin-top: 10px;
  1259. }
  1260. /* 审批模式下表单字段的只读样式 */
  1261. :deep(.el-form-item.is-disabled .el-input__inner),
  1262. :deep(.el-form-item.is-disabled .el-textarea__inner) {
  1263. background-color: #f5f7fa;
  1264. border-color: #e4e7ed;
  1265. color: #c0c4cc;
  1266. cursor: not-allowed;
  1267. }
  1268. :deep(.el-form-item.is-disabled .el-select .el-input__inner) {
  1269. background-color: #f5f7fa;
  1270. border-color: #e4e7ed;
  1271. color: #c0c4cc;
  1272. cursor: not-allowed;
  1273. }
  1274. :deep(.el-form-item.is-disabled .el-date-editor .el-input__inner) {
  1275. background-color: #f5f7fa;
  1276. border-color: #e4e7ed;
  1277. color: #c0c4cc;
  1278. cursor: not-allowed;
  1279. }
  1280. /* 只读模式下表单字段的样式 */
  1281. :deep(.el-form-item.is-disabled .el-input__inner),
  1282. :deep(.el-form-item.is-disabled .el-textarea__inner),
  1283. :deep(.el-form-item.is-disabled .el-select .el-input__inner),
  1284. :deep(.el-form-item.is-disabled .el-date-editor .el-input__inner) {
  1285. background-color: #f5f7fa;
  1286. border-color: #e4e7ed;
  1287. color: #606266; /* 保持文字可读性 */
  1288. cursor: not-allowed;
  1289. }
  1290. /* 详情模式下的特殊样式 */
  1291. .detail-mode .cell-value {
  1292. color: #303133;
  1293. font-weight: normal;
  1294. }
  1295. /* 添加审批意见区域的样式 */
  1296. .approval-opinion-section {
  1297. margin-top: 20px;
  1298. border-top: 2px solid #f0f0f0;
  1299. padding-top: 20px;
  1300. }
  1301. /* 审批意见文本域样式 */
  1302. :deep(.approval-opinion .el-textarea__inner) {
  1303. min-height: 100px;
  1304. resize: vertical;
  1305. }
  1306. /* 审批意见标签样式 */
  1307. :deep(.approval-opinion .el-form-item__label) {
  1308. font-weight: bold;
  1309. color: #606266;
  1310. }
  1311. /* 附件列表样式 */
  1312. .attachment-list {
  1313. width: 100%;
  1314. margin-top: 5px;
  1315. border: 1px solid #e0e0e0;
  1316. border-radius: 4px;
  1317. padding: 10px;
  1318. background-color: #fafafa;
  1319. box-sizing: border-box;
  1320. }
  1321. .attachment-item {
  1322. display: flex;
  1323. justify-content: space-between;
  1324. align-items: center;
  1325. padding: 8px 12px;
  1326. border-bottom: 1px solid #f0f0f0;
  1327. }
  1328. .attachment-item:last-child {
  1329. border-bottom: none;
  1330. }
  1331. .attachment-name {
  1332. flex: 1;
  1333. color: #606266;
  1334. font-size: 11px;
  1335. }
  1336. .no-attachment {
  1337. color: #909399;
  1338. font-style: italic;
  1339. margin-top: 5px;
  1340. padding: 10px;
  1341. }
  1342. /* 附件名称链接样式 */
  1343. .attachment-name {
  1344. color: #409eff;
  1345. text-decoration: underline;
  1346. cursor: pointer;
  1347. }
  1348. .attachment-name:hover {
  1349. color: #66b1ff;
  1350. }
  1351. /* 只读模式下的设备显示样式 */
  1352. .device-display-readonly {
  1353. color: #606266;
  1354. font-size: 11px;
  1355. line-height: 1.5;
  1356. background-color: #f5f7fa;
  1357. padding: 8px 12px;
  1358. border-radius: 4px;
  1359. border: 1px solid #e4e7ed;
  1360. display: inline-block;
  1361. min-width: 200px;
  1362. }
  1363. .no-device {
  1364. margin-left: 10px;
  1365. color: #909399;
  1366. font-style: italic;
  1367. }
  1368. /* 设备选择对话框样式 */
  1369. .transfer-container {
  1370. text-align: center;
  1371. padding: 0px;
  1372. }
  1373. .transfer-component {
  1374. width: 100%;
  1375. min-width: 600px;
  1376. }
  1377. :deep(.el-transfer-panel) {
  1378. width: 40% !important;
  1379. }
  1380. :deep(.el-transfer-panel__item) {
  1381. display: flex !important;
  1382. align-items: center !important;
  1383. height: 32px !important;
  1384. line-height: 32px !important;
  1385. padding: 0 8px !important;
  1386. margin: 0 !important;
  1387. white-space: nowrap;
  1388. overflow: hidden;
  1389. text-overflow: ellipsis;
  1390. }
  1391. .transfer-option-text {
  1392. display: inline-block;
  1393. max-width: 100%;
  1394. }
  1395. :deep(.el-transfer-panel__list) {
  1396. width: 100% !important;
  1397. }
  1398. .device-display-container {
  1399. /* 与其他文本域保持相同的宽度和样式 */
  1400. display: inline-block;
  1401. width: 100%; /* 减去按钮宽度 */
  1402. min-height: 32px;
  1403. line-height: 32px;
  1404. padding: 0 12px;
  1405. margin-left: 0px;
  1406. border-radius: 4px;
  1407. border: 1px solid #e4e7ed;
  1408. background-color: #fff;
  1409. font-size: 11px;
  1410. /* 文本溢出处理 */
  1411. white-space: nowrap;
  1412. overflow: hidden;
  1413. text-overflow: ellipsis;
  1414. }
  1415. /* 只读模式下的设备显示样式 */
  1416. :deep(.is-disabled) .device-display-container {
  1417. background-color: #f5f7fa;
  1418. color: #606266;
  1419. cursor: not-allowed;
  1420. }
  1421. /* 附件容器样式调整 */
  1422. .attachment-container {
  1423. /* 与其他文本域保持相同的宽度和边距 */
  1424. width: 100%;
  1425. margin-top: 10px;
  1426. }
  1427. </style>