detail.vue 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007
  1. <template>
  2. <z-paging
  3. class="page"
  4. ref="paging"
  5. v-model="dataList"
  6. :loading-more-enabled="true"
  7. @query="queryList">
  8. <!-- z-paging默认铺满全屏,此时页面所有view都应放在z-paging标签内,否则会被盖住 -->
  9. <!-- 需要固定在页面顶部的view请通过slot="top"插入,包括自定义的导航栏 -->
  10. <template #top>
  11. <!-- 工单基础信息 -->
  12. <view class="item top">
  13. <view class="item-content flex-row align-center">
  14. <view class="item-title full-cell flex-row align-center">
  15. <span class="item-title-width"
  16. >{{ $t("operationRecordFilling.workOrderName") }}:</span
  17. >
  18. <span>{{ params.orderName }}</span>
  19. </view>
  20. </view>
  21. <view class="item-content flex-row align-center">
  22. <view class="item-title full-cell flex-row align-center">
  23. <span class="item-title-width"
  24. >{{ $t("operationRecordFilling.responsiblePerson") }}:</span
  25. >
  26. <span>{{ params.userName }}</span>
  27. </view>
  28. </view>
  29. <view class="item-content flex-row align-center">
  30. <view class="item-title full-cell flex-row align-center">
  31. <span class="item-title-width"
  32. >{{ $t("operation.createTime") }}:</span
  33. >
  34. <span>{{ params.createTime }}</span>
  35. </view>
  36. </view>
  37. <view
  38. v-if="deptName === 'ry' || deptName === 'rh'"
  39. class="item-content flex-row align-center">
  40. <view class="item-title full-cell flex-row align-center">
  41. <span class="item-title-width">井号:</span>
  42. <uni-data-select
  43. :localdata="taskOptions"
  44. style="text-align: right"
  45. :styles="{ disableColor: '#fff' }"
  46. :clear="false"
  47. :disabled="!isView"
  48. :placeholder="$t('operation.PleaseSelect')"
  49. v-model="taskId"></uni-data-select>
  50. </view>
  51. </view>
  52. <view v-else class="item-content flex-row align-center">
  53. <view class="item-title full-cell flex-row align-center">
  54. <span class="item-title-width">井号:</span>
  55. <span>{{ params.wellName || "" }}</span>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <!-- 填报列表 -->
  61. <view class="list">
  62. <view class="item" v-for="(item, index) in dataList" :key="index">
  63. <view class="item-module flex-row align-center justify-between">
  64. <view class="module-name">
  65. {{ item.deviceCode }}({{ item.deviceName }})
  66. </view>
  67. <view class="module-border"> </view>
  68. </view>
  69. <view class="item-content flex-row align-center justify-between bold">
  70. <view class="item-title flex-row align-center">
  71. <span>{{ $t("operationRecordFilling.belongToTeam") }}:</span>
  72. <span>{{ item.orgName }}</span>
  73. </view>
  74. </view>
  75. <view
  76. class="item-content flex-row align-center justify-between bold"
  77. v-for="sum in item.sumList">
  78. <view class="item-title flex-row align-center word-break-all">
  79. <span>{{ sum.name }}:</span>
  80. </view>
  81. <view class="item-value flex-row align-center justify-end total">
  82. <uni-easyinput
  83. style="text-align: right"
  84. :inputBorder="false"
  85. :clearable="true"
  86. :styles="{ disableColor: '#fff' }"
  87. :value="`${sum.totalRunTime} ${sum.modelAttr ? (sum.modelAttr.includes('Time') ? 'h' : '') : ''}`"
  88. :disabled="true"></uni-easyinput>
  89. </view>
  90. </view>
  91. <view
  92. class="item-content flex-col align-center justify-between"
  93. :class="{ 'bottom-bold': item.nonSumList.length > 0 }"
  94. v-for="nosum in item.nonSumList.filter(
  95. (nosum) =>
  96. !keys.includes(nosum.description) &&
  97. (deptName === 'ry'
  98. ? nosum.description !== 'productionStatus'
  99. : true)
  100. )">
  101. <!-- isCollection为1,提示:以下数值取自PLC,如有不符请修改 -->
  102. <uni-notice-bar
  103. :text="$t('operationRecordFilling.plcNotice')"
  104. v-if="nosum.isCollection == 1" />
  105. <view class="flex-row align-center justify-between item-content">
  106. <view class="item-title flex-row align-center">
  107. <span>{{ nosum.name }}:</span>
  108. </view>
  109. <!-- 判断填写项的属性 -->
  110. <!-- type为double时,输入框为数字类型 -->
  111. <view
  112. class="item-value flex-row align-center justify-end"
  113. v-if="nosum.type == 'double'">
  114. <uni-easyinput
  115. style="text-align: right"
  116. :styles="{ disableColor: '#fff' }"
  117. :inputBorder="false"
  118. :clearable="true"
  119. :placeholder="$t('operation.PleaseFillIn')"
  120. :disabled="!isView"
  121. v-model="nosum.fillContent"
  122. :type="'digit'"
  123. @blur="
  124. nosum.threshold > 0
  125. ? checkThreshold(nosum)
  126. : checkLessThreshold(nosum)
  127. "
  128. @input="handleRealTimeUpdate(nosum, item)"></uni-easyinput>
  129. </view>
  130. <!-- type为textarea时,输入框为文本类型 -->
  131. <view
  132. class="item-value flex-row align-center justify-end"
  133. v-else-if="nosum.type == 'textarea'">
  134. <uni-easyinput
  135. style="text-align: right"
  136. :styles="{ disableColor: '#fff' }"
  137. :inputBorder="false"
  138. :clearable="true"
  139. :placeholder="$t('operation.PleaseFillIn')"
  140. :disabled="!isView"
  141. v-model="nosum.fillContent"
  142. :type="'textarea'"
  143. :autoHeight="true"
  144. :maxlength="-1"></uni-easyinput>
  145. </view>
  146. <!-- type为enum时,使用下拉菜单 -->
  147. <view
  148. class="item-value select flex-row align-center justify-end"
  149. v-else-if="nosum.type == 'enum' && nosum.description !== null">
  150. <uni-data-select
  151. :localdata="nosum.enumList"
  152. style="text-align: right"
  153. :styles="{ disableColor: '#fff' }"
  154. :clear="false"
  155. :disabled="!isView"
  156. :placeholder="$t('operation.PleaseSelect')"
  157. v-model="nosum.fillContent"></uni-data-select>
  158. </view>
  159. <!-- 其他类型时,输入框为文本类型 -->
  160. <view class="item-value flex-row align-center justify-end" v-else>
  161. <uni-easyinput
  162. style="text-align: right"
  163. :styles="{ disableColor: '#fff' }"
  164. :inputBorder="false"
  165. :clearable="true"
  166. :placeholder="$t('operation.PleaseFillIn')"
  167. :disabled="!isView"
  168. v-model="nosum.fillContent"
  169. :type="'text'"></uni-easyinput>
  170. </view>
  171. </view>
  172. </view>
  173. <!-- {{ nosum.name }} {{ nosum.description }} -->
  174. <uni-forms
  175. v-if="item.deviceName === '生产日报'"
  176. ref="formRef"
  177. labelWidth="auto"
  178. validateTrigger="submit"
  179. err-show-type="toast"
  180. :model="{ nonSumList: item.nonSumList, reportDetails }">
  181. <template
  182. v-for="(nosum, nosumIndex) in item.nonSumList"
  183. :key="nosumIndex">
  184. <uni-forms-item
  185. v-if="keys.includes(nosum.description)"
  186. :label="nosum.name"
  187. :rules="rules[nosum.description]?.(index)"
  188. :name="['nonSumList', nosumIndex, 'fillContent']">
  189. <uni-easyinput
  190. v-if="nosum.description !== 'otherNptReason'"
  191. type="number"
  192. :placeholder="$t('operation.PleaseFillIn')"
  193. style="text-align: right"
  194. :styles="{ disableColor: '#fff' }"
  195. :inputBorder="false"
  196. :clearable="false"
  197. :disabled="!isView"
  198. v-model.number="nosum.fillContent"
  199. @input="(val) => onInputChange(val, nosum)" />
  200. <uni-easyinput
  201. v-else
  202. type="textarea"
  203. autoHeight
  204. :placeholder="$t('operation.PleaseFillIn')"
  205. style="text-align: right"
  206. :styles="{ disableColor: '#fff' }"
  207. :inputBorder="false"
  208. :clearable="false"
  209. :disabled="!isView"
  210. v-model="nosum.fillContent"
  211. :maxlength="1000" />
  212. </uni-forms-item>
  213. </template>
  214. <template v-if="deptName === 'ry'">
  215. <uv-divider text="生产动态" textPosition="left"> </uv-divider>
  216. <uni-forms-item v-if="isView">
  217. <button
  218. type="primary"
  219. size="mini"
  220. class="detail-btn"
  221. @click="addProductionStatusRow()">
  222. 添加一行
  223. </button>
  224. </uni-forms-item>
  225. <template v-for="(detail, index) in reportDetails" :key="index">
  226. <uv-divider v-if="index !== 0" class="divider"></uv-divider>
  227. <uni-forms-item
  228. label="日期"
  229. required
  230. :name="['reportDetails', index, 'reportDate']"
  231. :rules="[{ required: true, errorMessage: '请选择日期' }]">
  232. <uni-datetime-picker
  233. class="datetime-picker"
  234. type="date"
  235. returnType="timestamp"
  236. v-model="detail.reportDate"
  237. :border="false"
  238. :disabled="!isView"
  239. @change="inputCurrentDepth(item.nonSumList)" />
  240. </uni-forms-item>
  241. <uni-forms-item :label="`${$t('ruiDu.timeNode')}:`" required>
  242. <view
  243. @click="
  244. !isView
  245. ? undefined
  246. : handleClickTimeRangeItem(index, item.nonSumList)
  247. ">
  248. <view
  249. class="time-range-item"
  250. v-if="detail.startTime && detail.endTime">
  251. {{ detail.startTime }} 至 {{ detail.endTime }}
  252. </view>
  253. <view class="time-range-item" v-else> 请选择 </view>
  254. </view>
  255. </uni-forms-item>
  256. <uni-forms-item label="时长(H)">
  257. <span>{{ detail.duration }}</span>
  258. </uni-forms-item>
  259. <uni-forms-item
  260. label="工况"
  261. required
  262. :name="['reportDetails', index, 'currentOperation']"
  263. :rules="[{ required: true, errorMessage: '请输入工况' }]">
  264. <uni-easyinput
  265. type="textarea"
  266. autoHeight
  267. v-bind="defaultProps"
  268. v-model="detail.currentOperation"
  269. :disabled="!isView"
  270. :maxlength="2000" />
  271. </uni-forms-item>
  272. <uni-forms-item
  273. label="结束井深(m)"
  274. required
  275. v-if="showDepth(item.nonSumList)"
  276. :name="['reportDetails', index, 'currentDepth']"
  277. :rules="[{ required: true, errorMessage: '请输入结束深度' }]">
  278. <uni-easyinput
  279. type="number"
  280. v-bind="defaultProps"
  281. :disabled="!isView"
  282. v-model.number="detail.currentDepth"
  283. @input="(val) => inputCurrentDepth(item.nonSumList)" />
  284. </uni-forms-item>
  285. <uni-forms-item
  286. label="详情"
  287. required
  288. :name="['reportDetails', index, 'constructionDetail']"
  289. :rules="[{ required: true, errorMessage: '请输入详情' }]">
  290. <uni-easyinput
  291. type="textarea"
  292. autoHeight
  293. :disabled="!isView"
  294. v-bind="defaultProps"
  295. v-model="detail.constructionDetail"
  296. :maxlength="2000" />
  297. </uni-forms-item>
  298. <uni-forms-item v-if="isView" label="操作">
  299. <button
  300. type="warn"
  301. size="mini"
  302. class="detail-btn"
  303. @click="removeReportDetailRow(index)">
  304. 删除
  305. </button>
  306. </uni-forms-item>
  307. </template>
  308. </template>
  309. </uni-forms>
  310. </view>
  311. </view>
  312. <!-- 如果需要使用页脚,请使用slot="bottom"slot节点不支持通过v-if或v-show动态显示/隐藏,若需要动态控制,可将v-if添加在其子节点上 -->
  313. <template #bottom>
  314. <button
  315. style="border-radius: 0"
  316. type="primary"
  317. @click="onSubmit()"
  318. :disabled="dataList.length < totalNum || isSubmitting"
  319. v-if="isView">
  320. {{ isSubmitting ? "提交中" : $t("operation.save") }}
  321. </button>
  322. </template>
  323. </z-paging>
  324. <tpf-time-range
  325. ref="reportDetailsTimeRangeRef"
  326. :startTime="startTime"
  327. :startDefaultTime="startDefaultTime"
  328. :endTime="endTime"
  329. :endDefaultTime="endDefaultTime"
  330. @timeRange="reportDetailsTimeRange"></tpf-time-range>
  331. </template>
  332. <script setup>
  333. import { ref, reactive, getCurrentInstance, watch, computed } from "vue";
  334. import { onReady, onLoad } from "@dcloudio/uni-app";
  335. import dayjs from "dayjs";
  336. import {
  337. getRecordFillingDetail,
  338. recordFillingUpOperationOrder,
  339. recordFillingDetailGetPageAndAttrs,
  340. recordFillingDetailInsertDataList,
  341. getDeptName,
  342. reportDetailsGet,
  343. } from "@/api/recordFilling";
  344. import { reloginByUserId } from "@/utils/auth.js";
  345. import { useDataDictStore } from "@/store/modules/dataDict";
  346. import { useDebounceFn } from "@/utils/useDebounceFn.js";
  347. import tpfTimeRange from "@/components/tpf-time-range/tpf-time-range.vue";
  348. // 引用全局变量$t
  349. const { appContext } = getCurrentInstance();
  350. const t = appContext.config.globalProperties.$t;
  351. // 获取字典项
  352. const { getStrDictOptions, getIntDictOptions } = useDataDictStore();
  353. const defaultProps = computed(() => ({
  354. inputBorder: false,
  355. clearable: false,
  356. placeholder: "请输入",
  357. style: {
  358. "text-align": "right",
  359. },
  360. styles: {
  361. disableColor: "#fff",
  362. },
  363. }));
  364. const reportDetailsTimeRangeRef = ref(null);
  365. const startTime = ref("00:00");
  366. const startDefaultTime = ref("08:00");
  367. const endTime = ref("24:00");
  368. const endDefaultTime = ref("08:00");
  369. const reportDetailIndex = ref(0);
  370. const aaaList = ref();
  371. const handleClickTimeRangeItem = (index, list) => {
  372. reportDetailIndex.value = index;
  373. aaaList.value = list;
  374. reportDetailsTimeRangeRef.value.open();
  375. };
  376. const calculateDuration = (row) => {
  377. if (!row.startTime || !row.endTime) {
  378. row.duration = 0;
  379. return;
  380. }
  381. const todayStr = dayjs().format("YYYY-MM-DD");
  382. const start = dayjs(`${todayStr} ${row.startTime}`);
  383. const end = dayjs(`${todayStr} ${row.endTime}`);
  384. let diffMinutes = end.diff(start, "minute");
  385. if (diffMinutes < 0) {
  386. diffMinutes += 1440;
  387. }
  388. row.duration = Number((diffMinutes / 60).toFixed(2));
  389. };
  390. const reportDetailsTimeRange = (data) => {
  391. reportDetails.value[reportDetailIndex.value].startTime = data[0];
  392. reportDetails.value[reportDetailIndex.value].endTime = data[1];
  393. calculateDuration(reportDetails.value[reportDetailIndex.value]);
  394. inputCurrentDepth(aaaList.value ?? []);
  395. };
  396. const reportDetails = ref([]);
  397. const addProductionStatusRow = () => {
  398. if (!reportDetails.value) {
  399. reportDetails.value = [];
  400. }
  401. reportDetails.value.push({
  402. reportDate: params.createTime
  403. ? dayjs(params.createTime).valueOf()
  404. : dayjs().valueOf(),
  405. startTime: "08:00",
  406. endTime: "08:00",
  407. duration: 0,
  408. currentDepth: 0,
  409. currentOperation: "",
  410. constructionDetail: "",
  411. });
  412. };
  413. const removeReportDetailRow = (index) => {
  414. if (index === 0) {
  415. uni.showToast({ title: "至少填写一条生产动态", icon: "none" });
  416. return;
  417. }
  418. reportDetails.value.splice(index, 1);
  419. };
  420. const taskId = ref(undefined);
  421. const taskOptions = ref([]);
  422. const noGasTasks = ref([]);
  423. const inputCurrentDepth = useDebounceFn(function inputCurrentDepth(list) {
  424. const details = reportDetails.value;
  425. if (Array.isArray(details) && details.length > 0) {
  426. const latestDetail = details.reduce((prev, current) => {
  427. const currentFullTime = dayjs(current.reportDate)
  428. .hour(parseInt(current.endTime.split(":")[0]))
  429. .minute(parseInt(current.endTime.split(":")[1]))
  430. .valueOf();
  431. const prevFullTime = dayjs(prev.reportDate)
  432. .hour(parseInt(prev.endTime.split(":")[0]))
  433. .minute(parseInt(prev.endTime.split(":")[1]))
  434. .valueOf();
  435. return currentFullTime >= prevFullTime ? current : prev;
  436. });
  437. const currentDepth = list.find(
  438. (item) => item?.description === "currentDepth"
  439. );
  440. if (currentDepth) currentDepth.fillContent = latestDetail.currentDepth;
  441. }
  442. }, 300);
  443. const showDepth = computed(() => (list) => {
  444. return list.some((item) => item.description === "currentDepth");
  445. });
  446. const NON_KEYS = [
  447. "repairTime",
  448. "selfStopTime",
  449. "accidentTime",
  450. "complexityTime",
  451. "rectificationTime",
  452. "waitingStopTime",
  453. "partyaDesign",
  454. "partyaPrepare",
  455. "partyaResource",
  456. "relocationTime",
  457. "winterBreakTime",
  458. "otherNptTime",
  459. ];
  460. const keys = [
  461. "repairTime",
  462. "selfStopTime",
  463. "accidentTime",
  464. "complexityTime",
  465. "rectificationTime",
  466. "waitingStopTime",
  467. "partyaDesign",
  468. "partyaPrepare",
  469. "partyaResource",
  470. "relocationTime",
  471. "winterBreakTime",
  472. "otherNptTime",
  473. "drillingWorkingTime",
  474. "otherProductionTime",
  475. "ratedProductionTime",
  476. "productionTime",
  477. "dailyInjectGasTime",
  478. "otherNptReason",
  479. ];
  480. const sumNonProdTimes = (index) => {
  481. let sum = 0;
  482. const { nonSumList } = dataList.value[index];
  483. NON_KEYS.forEach((field) => {
  484. sum += Number(
  485. (nonSumList || []).find((item) => item.description === field)
  486. ?.fillContent || 0
  487. );
  488. });
  489. return sum;
  490. };
  491. const handleInputRaw = (val, item) => {
  492. let num = Number(val);
  493. if (val === "" || isNaN(num) || num < 0) {
  494. num = 0;
  495. } else if (num > 24) {
  496. num = 24;
  497. }
  498. item.fillContent = num;
  499. };
  500. const onInputChange = debounce(handleInputRaw, 500);
  501. // 校验函数:总时间必须为 24
  502. const ryValidateTotalTime = (index) => (rule, value, data, callback) => {
  503. const { nonSumList } = dataList.value[index];
  504. const drillingTime = Number(
  505. (nonSumList || []).find(
  506. (item) => item.description === "drillingWorkingTime"
  507. )?.fillContent || 0
  508. );
  509. const otherTime = Number(
  510. (nonSumList || []).find(
  511. (item) => item.description === "otherProductionTime"
  512. )?.fillContent || 0
  513. );
  514. const nonProdSum = sumNonProdTimes(index);
  515. let total = 0;
  516. let msg = "";
  517. total = parseFloat((drillingTime + otherTime + nonProdSum).toFixed(2));
  518. msg = `进尺(${drillingTime})+其他(${otherTime})+非生产(${nonProdSum})=${total}H,必须为24H`;
  519. if (Math.abs(total - 24) > 0.01) {
  520. callback(msg);
  521. }
  522. return true;
  523. };
  524. const rhValidateTotalTime = (index) => (rule, value, data, callback) => {
  525. const { nonSumList } = dataList.value[index];
  526. const gasTime = Number(
  527. (nonSumList || []).find((item) => item.description === "dailyInjectGasTime")
  528. ?.fillContent || 0
  529. );
  530. const nonProdSum = sumNonProdTimes(index);
  531. let total = 0;
  532. let msg = "";
  533. total = parseFloat((gasTime + nonProdSum).toFixed(2));
  534. msg = `运转(${gasTime})+非生产(${nonProdSum})=${total}H,必须为24H`;
  535. console.log("total :>> ", total);
  536. if (Math.abs(total - 24) > 0.01) {
  537. callback(msg);
  538. }
  539. return true;
  540. };
  541. const rules = reactive({
  542. drillingWorkingTime: (index) => [
  543. { required: true, errorMessage: "请输入进尺工作时间" },
  544. { validateFunction: ryValidateTotalTime(index) },
  545. ],
  546. dailyInjectGasTime: (index) => [
  547. { required: true, errorMessage: "请输入当日运转时间" },
  548. { validateFunction: rhValidateTotalTime(index) },
  549. ],
  550. });
  551. // -------------------------------------
  552. const isFromMsg = ref(false);
  553. const params = ref({});
  554. const isView = ref(false); // 是否编辑 -- view == 1为编辑状态
  555. let deptName = ref("");
  556. // 累加状态对象,用于在生产日报加载前存储累加值
  557. const accumulatedValues = reactive({
  558. "当日注水量-方": 0,
  559. "当日用电量kWh": 0,
  560. "当日运转时间H": 0,
  561. "当日注气量-方": 0,
  562. });
  563. onReady(() => {
  564. console.log("onReady");
  565. });
  566. onLoad(async (option) => {
  567. console.log("onLoad", option);
  568. await reloginByUserId(option.reloginUserId);
  569. isFromMsg.value = !!option.reloginUserId;
  570. // 初始化params
  571. params.value = JSON.parse(option.param);
  572. // 处理createTime
  573. params.value.createTime = params.value.createTime
  574. ? dayjs(Number.parseInt(params.value.createTime)).format("YYYY-MM-DD")
  575. : "";
  576. // 请求工单详情
  577. if (params.value?.orderId) {
  578. const detail = (await getRecordFillingDetail(params.value.orderId)).data;
  579. const daily = detail ?? {
  580. wellNamePair: {},
  581. noGasTasks: [],
  582. };
  583. taskOptions.value = Object.keys(daily.wellNamePair ?? {}).map((key) => ({
  584. text: daily.wellNamePair[key],
  585. value: Number(key),
  586. }));
  587. noGasTasks.value = (daily.noGasTasks ?? []).map(Number);
  588. taskId.value = taskOptions.value[0]?.value || undefined;
  589. const data = await getDeptName(detail.deptId);
  590. console.log("data>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", data);
  591. deptName.value = data.data;
  592. console.log("deptName.value>>>>>>>>>>>>>>>>>>>", deptName.value);
  593. params.value = {
  594. ...params.value,
  595. ...detail,
  596. // 处理createTime
  597. createTime: detail.createTime
  598. ? dayjs(Number.parseInt(detail.createTime)).format("YYYY-MM-DD")
  599. : "",
  600. orderId: detail.id,
  601. };
  602. }
  603. console.log("🚀 ~ params.value:", params.value);
  604. // 处理是否可编辑 {0: '待填写', 1: '已完成', 2: '填写中', 3: '忽略'}
  605. isView.value = params.value?.orderStatus % 2 == 0;
  606. console.log("🚀 ~ isView.value:", isView.value);
  607. });
  608. const paging = ref(null);
  609. // v-model绑定的这个变量不要在分页请求结束中自己赋值,直接使用即可
  610. const dataList = ref([]);
  611. // 列表总数
  612. const totalNum = ref(0);
  613. // 监听dataList变化,初始化时计算一次总和
  614. watch(
  615. dataList,
  616. (newVal) => {
  617. // calculateTotalRunTime();
  618. },
  619. { deep: true }
  620. );
  621. // 处理fillContent变化的方法
  622. const handleFillContentChange = (nosum, deviceItem) => {
  623. console.log("🚀 ~ nosum, deviceItem:", nosum, deviceItem);
  624. // 处理增压机
  625. if (
  626. deviceItem.deviceName.includes("增压机") &&
  627. nosum.name === "当日运转时间"
  628. ) {
  629. calculateTotalRunTime("增压机", "当日运转时间"); // 计算当日运转时间总和
  630. }
  631. // 处理提纯撬
  632. if (deviceItem.deviceName.includes("提纯撬") && nosum.name === "当日注气量") {
  633. calculateTotalRunTime("提纯撬", "当日注气量"); // 计算当日注气量总和
  634. }
  635. // 处理注水泵
  636. if (deviceItem.deviceName.includes("注水泵") && nosum.name === "当日注水量") {
  637. calculateTotalRunTime("注水泵", "当日注水量"); // 计算当日注水量总和
  638. }
  639. // 处理箱式变电站
  640. if (
  641. deviceItem.deviceName.includes("箱式变电站") &&
  642. nosum.name === "当日用电量"
  643. ) {
  644. calculateTotalRunTime("箱式变电站", "当日用电量"); // 计算当日用电量总和
  645. }
  646. };
  647. // 防抖函数
  648. function debounce(func, delay) {
  649. let timer;
  650. return function (...args) {
  651. if (timer) clearTimeout(timer);
  652. timer = setTimeout(() => func.apply(this, args), delay);
  653. };
  654. }
  655. //防抖
  656. const debouncedCalculateTotalRunTime = debounce(calculateTotalRunTime, 100);
  657. const debouncedApplyAccumulatedToReport = debounce(
  658. applyAccumulatedToReport,
  659. 100
  660. );
  661. /**
  662. * 更新累加值
  663. * @param fieldName 字段名
  664. * @param deviceType 设备类型
  665. */
  666. const updateAccumulatedValue = (fieldName, deviceType) => {
  667. let total = 0;
  668. dataList.value.forEach((item) => {
  669. if (item.deviceName.includes(deviceType) && item.nonSumList) {
  670. item.nonSumList.forEach((nonSum) => {
  671. if (
  672. nonSum.type === "double" &&
  673. nonSum.name === fieldName &&
  674. nonSum.fillContent !== null &&
  675. nonSum.fillContent !== ""
  676. ) {
  677. const value = parseFloat(nonSum.fillContent) || 0;
  678. total += value;
  679. }
  680. });
  681. }
  682. });
  683. accumulatedValues[fieldName] = total;
  684. };
  685. /**
  686. * 重新计算所有累加值
  687. */
  688. const recalculateAllAccumulatedValues = () => {
  689. const fields = [
  690. { field: "当日运转时间H", device: "增压机" },
  691. { field: "当日注气量-方", device: "提纯撬" },
  692. { field: "当日注水量-方", device: "注水泵" },
  693. { field: "当日用电量kWh", device: "箱式变电站" },
  694. ];
  695. fields.forEach(({ field, device }) => {
  696. updateAccumulatedValue(field, device);
  697. });
  698. };
  699. /**
  700. * 将累加值应用到生产日报
  701. */
  702. function applyAccumulatedToReport() {
  703. // 先重新计算所有累加值
  704. recalculateAllAccumulatedValues();
  705. const reportItem = dataList.value.find(
  706. (item) => item.deviceName === "生产日报"
  707. );
  708. if (!reportItem) {
  709. console.warn("⚠️ 未找到生产日报,累加值已存储,等待加载");
  710. return;
  711. }
  712. Object.keys(accumulatedValues).forEach((fieldName) => {
  713. const targetItem = reportItem.nonSumList.find(
  714. (item) => item.name === fieldName
  715. );
  716. if (targetItem) {
  717. console.log(
  718. `📊 应用累加值 (${fieldName}):`,
  719. accumulatedValues[fieldName]
  720. );
  721. targetItem.fillContent = toFixed(accumulatedValues[fieldName]);
  722. }
  723. });
  724. }
  725. const handleRealTimeUpdate = (nosum, deviceItem) => {
  726. console.log("🚀 实时更新 ~ nosum, deviceItem:", nosum, deviceItem);
  727. let fieldName = "";
  728. let deviceType = "";
  729. // 当日运转时间累加
  730. if (
  731. deviceItem.deviceName.includes("增压机") &&
  732. nosum.name === "当日运转时间H"
  733. ) {
  734. fieldName = "当日运转时间H";
  735. deviceType = "增压机";
  736. }
  737. // 当日注气量累加
  738. if (
  739. deviceItem.deviceName.includes("提纯撬") &&
  740. nosum.name === "当日注气量-方"
  741. ) {
  742. fieldName = "当日注气量-方";
  743. deviceType = "提纯撬";
  744. }
  745. // 当日注水量累加
  746. if (
  747. deviceItem.deviceName.includes("注水泵") &&
  748. nosum.name === "当日注水量-方"
  749. ) {
  750. fieldName = "当日注水量-方";
  751. deviceType = "注水泵";
  752. }
  753. // 当日用电量累加
  754. if (
  755. deviceItem.deviceName.includes("箱式变电站") &&
  756. nosum.name === "当日用电量kWh"
  757. ) {
  758. fieldName = "当日用电量kWh";
  759. deviceType = "箱式变电站";
  760. }
  761. if (fieldName) {
  762. // 更新累加值
  763. updateAccumulatedValue(fieldName, deviceType);
  764. // 应用到生产日报(如果已加载)
  765. debouncedApplyAccumulatedToReport();
  766. }
  767. };
  768. /**
  769. * 计算所有deviceName中包含deviceNameToMatch的对象中对应的reportName的fillContent总和并更新到reportName的fillContent中
  770. * @param deviceNameToMatch {string} 设备名称包含的字符串
  771. * @param reportName {string} 填写项名称
  772. */
  773. function calculateTotalRunTime(
  774. deviceNameToMatch,
  775. sourceFieldName,
  776. targetFieldName
  777. ) {
  778. const reportItem = dataList.value.find(
  779. (item) => item.deviceName === "生产日报"
  780. );
  781. if (!reportItem) {
  782. console.warn("⚠️ 未找到生产日报");
  783. return;
  784. }
  785. const targetItem = reportItem.nonSumList.find(
  786. (item) => item.name === targetFieldName
  787. );
  788. if (!targetItem) {
  789. console.warn(`⚠️ 未找到目标字段:${targetFieldName}`);
  790. return;
  791. }
  792. let total = 0;
  793. dataList.value.forEach((item) => {
  794. if (item.deviceName.includes(deviceNameToMatch) && item.nonSumList) {
  795. item.nonSumList.forEach((nonSum) => {
  796. if (
  797. nonSum.type === "double" &&
  798. nonSum.name === sourceFieldName &&
  799. nonSum.fillContent !== null &&
  800. nonSum.fillContent !== ""
  801. ) {
  802. const value = parseFloat(nonSum.fillContent) || 0;
  803. total += value;
  804. }
  805. });
  806. }
  807. });
  808. console.log(`📊 累计值 (${sourceFieldName} -> ${targetFieldName}):`, total);
  809. targetItem.fillContent = toFixed(total);
  810. }
  811. const formatT = (arr) =>
  812. `${arr[0].toString().padStart(2, "0")}:${arr[1].toString().padStart(2, "0")}`;
  813. // @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用paging.value.reload()即可
  814. const queryList = (pageNo, pageSize) => {
  815. const userId = uni.getStorageSync("userId");
  816. if (!userId) {
  817. paging.value.complete([]);
  818. return;
  819. }
  820. // 请求填报设备及属性
  821. recordFillingDetailGetPageAndAttrs({
  822. pageNo,
  823. pageSize,
  824. orderId: params.value.orderId,
  825. // deviceCategoryId: 1,
  826. })
  827. .then(async (res) => {
  828. console.log("🚀 ~ res:", res);
  829. const { data } = res;
  830. const resList = [].concat(data.list);
  831. // 列表总数
  832. totalNum.value = data.total;
  833. // 遍历列表,处理attrsDetail
  834. resList.map(async (item) => {
  835. const attrParams = {
  836. deviceCode: item.deviceCode,
  837. deviceName: item.deviceName,
  838. deptId: item.deptId,
  839. createTime: params.value.createTime,
  840. deviceCategoryId: item.deviceCategoryId,
  841. deviceId: item.deviceId,
  842. userId: params.value.userId,
  843. orderId: params.value.orderId,
  844. };
  845. // console.log(
  846. // "getRecordFillingDetailGetAttrs- attrParams",
  847. // attrParams
  848. // );
  849. const resAttrs = item?.attrsDetail;
  850. // console.log("resAttrs", resAttrs);
  851. if (resAttrs) {
  852. attrParams.createTime = attrParams.createTime
  853. ? dayjs(attrParams.createTime).format("YYYY-MM-DD")
  854. : "";
  855. attrParams.id = attrParams.orderId;
  856. delete attrParams.orderId;
  857. delete attrParams.deviceName;
  858. resAttrs.map((rtem) => {
  859. // 将rtem中sumList和nonSumList两个数组中的
  860. // fillContent字段判断是否为null, 如果为null,则赋值为0 不为null则保留两位小数
  861. // 将attrParams合并到两个数组的每个对象中
  862. // 然后将sumList和nonSumList分别赋值给item的sumList和nonSumList
  863. if (rtem.sumList) {
  864. rtem.sumList.map((sumItem) => {
  865. if (sumItem.fillContent == null || sumItem.fillContent == "") {
  866. // console.log("🚀 ~ rtem.sumList.map ~ sumItem:", sumItem);
  867. // sumItem.fillContent = 0;
  868. } else {
  869. // 如果是double类型,保留两位小数
  870. if (sumItem.type == "double") {
  871. sumItem.fillContent = toFixed(sumItem.fillContent);
  872. }
  873. }
  874. // 将sumItem的id赋值给modelId
  875. sumItem.modelId = sumItem.id;
  876. sumItem.pointName = sumItem.name;
  877. // 合并attrParams到sumItem中
  878. sumItem = Object.assign(sumItem, attrParams);
  879. });
  880. }
  881. if (rtem.nonSumList) {
  882. //
  883. rtem.nonSumList.map((nonSumItem) => {
  884. if (
  885. nonSumItem.fillContent == null ||
  886. nonSumItem.fillContent == ""
  887. ) {
  888. // console.log(
  889. // "🚀 ~ rtem.nonSumList.map ~ nonSumItem:",
  890. // nonSumItem
  891. // );
  892. // nonSumItem.fillContent = 0;
  893. } else {
  894. // 如果是double类型,保留两位小数
  895. if (nonSumItem.type == "double") {
  896. nonSumItem.fillContent = toFixed(nonSumItem.fillContent);
  897. }
  898. }
  899. nonSumItem.pointName = nonSumItem.name;
  900. // 将nonSumItem的id赋值给modelId
  901. nonSumItem.modelId = nonSumItem.id;
  902. // 合并attrParams到nonSumItem中
  903. nonSumItem = Object.assign(nonSumItem, attrParams);
  904. // 如果是enum类型,且description不为null,则根据description获取对应字典项数组,赋值给enumList
  905. if (nonSumItem.type == "enum" && nonSumItem.description) {
  906. console.log("🚀 ~ onSumItem.description:");
  907. const dictOptions =
  908. nonSumItem.name === "非生产原因"
  909. ? getIntDictOptions(nonSumItem.description)
  910. : getStrDictOptions(nonSumItem.description);
  911. nonSumItem.enumList = dictOptions.map((dict) => {
  912. return {
  913. ...dict,
  914. text: dict.label,
  915. };
  916. });
  917. // 确保 fillContent 的类型与 enumList 中的 value 类型匹配
  918. if (nonSumItem.name === "非生产原因") {
  919. // 如果是"非生产原因",将 fillContent 转换为数字类型以匹配 getIntDictOptions
  920. if (
  921. nonSumItem.fillContent !== null &&
  922. nonSumItem.fillContent !== ""
  923. ) {
  924. nonSumItem.fillContent = parseInt(nonSumItem.fillContent);
  925. }
  926. }
  927. console.log("🚀 ~ nonSumItem.enumList:", nonSumItem.enumList);
  928. }
  929. });
  930. }
  931. item.sumList = rtem.sumList;
  932. const timeKeys = keys.filter((k) => k !== "otherNptReason");
  933. item.nonSumList = rtem.nonSumList
  934. .sort((a, b) => a.modelId - b.modelId)
  935. .map((item) => {
  936. if (timeKeys.includes(item.description)) {
  937. item.fillContent = Number(item.fillContent || 0);
  938. }
  939. return item;
  940. });
  941. });
  942. console.log("resAttrs-modelId", resAttrs);
  943. }
  944. return item;
  945. });
  946. console.log("resList--", resList);
  947. // 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
  948. paging.value.completeByNoMore(
  949. resList,
  950. pageNo * pageSize >= totalNum.value
  951. );
  952. // 如果加载的数据中包含生产日报,应用累加值
  953. const hasReport = resList.some((item) => item.deviceName === "生产日报");
  954. if (hasReport) {
  955. applyAccumulatedToReport();
  956. reportDetailsGet(params.value.orderId).then((res) => {
  957. reportDetails.value = (res.data ?? []).map((item) => ({
  958. reportDate: item.reportDate ?? dayjs(params.createTime).valueOf(),
  959. startTime: formatT(item.startTime),
  960. endTime: formatT(item.endTime),
  961. duration: item.duration,
  962. currentDepth: item.currentDepth,
  963. currentOperation: item.currentOperation,
  964. constructionDetail: item.constructionDetail,
  965. }));
  966. console.log("🚀 ~ reportDetails.value:", reportDetails.value);
  967. if (!reportDetails.value.length) {
  968. addProductionStatusRow();
  969. }
  970. });
  971. }
  972. })
  973. .catch((res) => {
  974. // 如果请求失败写paging.value.complete(false);
  975. // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
  976. // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
  977. paging.value.complete(false);
  978. });
  979. };
  980. /**
  981. * 检查累计公里数和运转时长限制(仅针对deptName为'rd'的公司)
  982. * @param item 需要检查的填报项
  983. * @param totalValue 累计值
  984. * @param maxIncrement 最大增量
  985. * @param itemName 项目名称
  986. */
  987. const rdThresholdExceededItems = ref([]);
  988. const checkRdThreshold = (item, totalValue, maxIncrement, itemName) => {
  989. if (deptName.value !== "rd") {
  990. return true; // 不是rd公司,跳过检查
  991. }
  992. if (!item.fillContent) {
  993. return true; // 没有填写内容,跳过检查
  994. }
  995. const fillValue = parseFloat(item.fillContent);
  996. const maxValue = totalValue + maxIncrement;
  997. if (fillValue > maxValue) {
  998. // 收集超限信息
  999. rdThresholdExceededItems.value.push({
  1000. deviceCode: item.deviceCode,
  1001. // deviceName: item.deviceName,
  1002. itemName: itemName,
  1003. maxValue: maxValue,
  1004. currentValue: fillValue,
  1005. });
  1006. return false;
  1007. }
  1008. return true;
  1009. };
  1010. // 判断是否小于阈值 (<0)
  1011. const checkLessThreshold = (item) => {
  1012. if (item.fillContent < 0) {
  1013. uni.showToast({
  1014. title:
  1015. item.name +
  1016. t("operationRecordFilling.fillContentCannotLessThanThreshold") +
  1017. "0",
  1018. icon: "none",
  1019. });
  1020. item.fillContent = ""; // 清空输入
  1021. return false; // 返回false表示校验失败
  1022. }
  1023. };
  1024. // 判断是否大于阈值
  1025. const checkThreshold = (item) => {
  1026. checkLessThreshold(item);
  1027. // 如果threshold > 0,则判断fillContent是否大于threshold,如果大于则提示用户填写小于等于threshold的值
  1028. if (item.fillContent > item.threshold) {
  1029. uni.showToast({
  1030. title:
  1031. item.name +
  1032. t("operationRecordFilling.fillContentCannotGreaterThanThreshold") +
  1033. item.threshold,
  1034. icon: "none",
  1035. });
  1036. item.fillContent = ""; // 清空输入
  1037. return false; // 返回false表示校验失败
  1038. }
  1039. };
  1040. // 保留两位小数
  1041. const toFixed = (num) => {
  1042. if (num) {
  1043. num = Number(num);
  1044. num = num.toFixed(2);
  1045. } else {
  1046. num = 0.0;
  1047. }
  1048. return num;
  1049. };
  1050. const isSubmitting = ref(false); // 添加提交状态
  1051. // const onSubmit = async () => {
  1052. // // 清空之前的超限记录
  1053. // rdThresholdExceededItems.value = [];
  1054. // // console.log("onSubmit", dataList.value);
  1055. // // 校验是否所有待填写项都已加载
  1056. // if (dataList.value.length < totalNum) {
  1057. // uni.showToast({
  1058. // title: t("operationRecordFilling.PleaseLoadAllItems"),
  1059. // icon: "none",
  1060. // });
  1061. // return; // 校验失败直接返回
  1062. // }
  1063. // // 1. 校验所有必填项
  1064. // // 遍历dataList.value中nonSumList每个item(非生产日报 isReport!=1)的fillContent字段,
  1065. // // 如果为null或者为空,则提示用户填写,
  1066. // // 如果threshold > 0,则判断fillContent是否大于threshold,如果大于则提示用户填写小于等于threshold的值
  1067. // // 如果所有项全部填写,则调用填写记录接口
  1068. // for (const item of dataList.value) {
  1069. // const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
  1070. // // 查找当日运转时间H项目
  1071. // const runtimeItem = nonSumList.find((i) => i.name === "当日运转时间H");
  1072. // const isRuntime24 =
  1073. // runtimeItem &&
  1074. // (runtimeItem.fillContent == 24 || runtimeItem.fillContent == "24");
  1075. // for (const nonSumItem of nonSumList) {
  1076. // // 增加判断条件:如果当日运转时间H等于24,则非生产原因和非生产时间H为非必填,否则为必填
  1077. // const isExemptField =
  1078. // isRuntime24 &&
  1079. // (nonSumItem.name === "非生产原因" || nonSumItem.name === "非生产时间H");
  1080. // if (
  1081. // (!item.isReport || item.isReport != 1) &&
  1082. // !isExemptField &&
  1083. // (nonSumItem.fillContent == null || nonSumItem.fillContent === "")
  1084. // ) {
  1085. // uni.showToast({
  1086. // title:
  1087. // t("operation.PleaseFillIn") +
  1088. // item.deviceCode +
  1089. // "(" +
  1090. // item.deviceName +
  1091. // ")" +
  1092. // t("operation.allItem"),
  1093. // icon: "none",
  1094. // });
  1095. // return; // 校验失败直接返回
  1096. // }
  1097. // if (nonSumItem.fillContent != "" && nonSumItem.fillContent != null) {
  1098. // console.log("🚀 ~ nonSumItem:", nonSumItem);
  1099. // console.log("🚀 ~ nonSumItem.fillContent:", nonSumItem.fillContent);
  1100. // // 先将值转换为字符串进行操作
  1101. // const fillContentStr = String(nonSumItem.fillContent);
  1102. // // 将字符串转换为数字
  1103. // const num = Number(fillContentStr);
  1104. // // 检查转换后的数字是否有效
  1105. // if (!isNaN(num)) {
  1106. // // 检查是否包含小数(使用字符串检查)
  1107. // if (fillContentStr.includes(".")) {
  1108. // // 保留两位小数(假设toFixed是你定义的保留两位小数的函数)
  1109. // nonSumItem.fillContent = toFixed(num);
  1110. // } else {
  1111. // // 转换为整数
  1112. // nonSumItem.fillContent = Math.floor(num);
  1113. // }
  1114. // }
  1115. // // **********************
  1116. // // 新增:针对rd公司的特殊阈值检查
  1117. // // 检查包含"累计公里数填报"的字段不能超过对应"累计公里数"字段 + 3000
  1118. // if (nonSumItem.name.includes("累计公里数填报")) {
  1119. // const correspondingSumItem = item.sumList.find((sumItem) =>
  1120. // sumItem.name.includes("累计公里数")
  1121. // );
  1122. // if (correspondingSumItem) {
  1123. // const totalKm = parseFloat(correspondingSumItem.totalRunTime) || 0;
  1124. // checkRdThreshold(nonSumItem, totalKm, 3000, nonSumItem.name);
  1125. // }
  1126. // }
  1127. // // 检查包含"累计运转时长填报"的字段不能超过对应"累计运转时长"字段 + 100
  1128. // else if (nonSumItem.name.includes("累计运转时长填报")) {
  1129. // const correspondingSumItem = item.sumList.find((sumItem) =>
  1130. // sumItem.name.includes("累计运转时长")
  1131. // );
  1132. // if (correspondingSumItem) {
  1133. // const totalRunTime =
  1134. // parseFloat(correspondingSumItem.totalRunTime) || 0;
  1135. // checkRdThreshold(nonSumItem, totalRunTime, 100, nonSumItem.name);
  1136. // }
  1137. // }
  1138. // }
  1139. // // 如果threshold > 0,则判断fillContent是否大于threshold
  1140. // if (nonSumItem.threshold > 0) {
  1141. // if (nonSumItem.fillContent > nonSumItem.threshold) {
  1142. // uni.showToast({
  1143. // title:
  1144. // item.deviceCode +
  1145. // "(" +
  1146. // item.deviceName +
  1147. // ")" +
  1148. // nonSumItem.name +
  1149. // t(
  1150. // "operationRecordFilling.fillContentCannotGreaterThanThreshold"
  1151. // ) +
  1152. // nonSumItem.threshold,
  1153. // icon: "none",
  1154. // duration: 3000,
  1155. // });
  1156. // nonSumItem.fillContent = ""; // 清空输入
  1157. // return; // 校验失败直接返回
  1158. // }
  1159. // }
  1160. // }
  1161. // }
  1162. // // 检查是否有超限的项目,如果有则统一显示
  1163. // if (rdThresholdExceededItems.value.length > 0) {
  1164. // const exceededInfo = rdThresholdExceededItems.value
  1165. // .map(
  1166. // (item, index) =>
  1167. // `${index + 1}. ${item.deviceCode} ${item.itemName}不能超过${
  1168. // item.maxValue
  1169. // },当前值为${item.currentValue}`
  1170. // )
  1171. // .join("\n");
  1172. // uni.showModal({
  1173. // title: "阈值超限提示",
  1174. // content: `以下项目超过阈值限制:\n${exceededInfo}\n\n是否继续保存?`,
  1175. // showCancel: true,
  1176. // cancelText: "取消",
  1177. // confirmText: "继续",
  1178. // success: (res) => {
  1179. // if (res.confirm) {
  1180. // // 用户选择继续,执行保存操作
  1181. // submitData();
  1182. // } else if (res.cancel) {
  1183. // // 用户选择取消,不执行保存
  1184. // return;
  1185. // }
  1186. // },
  1187. // });
  1188. // return;
  1189. // }
  1190. // // 如果没有超限项目,直接执行保存
  1191. // submitData();
  1192. // };
  1193. // 修改 onSubmit 方法
  1194. // const onSubmit = async () => {
  1195. // // 校验是否所有待填写项都已加载
  1196. // if (dataList.value.length < totalNum) {
  1197. // uni.showToast({
  1198. // title: t("operationRecordFilling.PleaseLoadAllItems"),
  1199. // icon: "none",
  1200. // });
  1201. // return; // 校验失败直接返回,不设置按钮禁用
  1202. // }
  1203. // // 1. 校验所有必填项 - 在这里进行所有基础校验
  1204. // for (const item of dataList.value) {
  1205. // const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
  1206. // // 查找当日运转时间H项目
  1207. // const runtimeItem = nonSumList.find((i) => i.name === "当日运转时间H");
  1208. // const isRuntime24 =
  1209. // runtimeItem &&
  1210. // (runtimeItem.fillContent == 24 || runtimeItem.fillContent == "24");
  1211. // for (const nonSumItem of nonSumList) {
  1212. // // 增加判断条件:如果当日运转时间H等于24,则非生产原因和非生产时间H为非必填,否则为必填
  1213. // const isExemptField =
  1214. // isRuntime24 &&
  1215. // (nonSumItem.name === "非生产原因" || nonSumItem.name === "非生产时间H");
  1216. // if (
  1217. // (!item.isReport || item.isReport != 1) &&
  1218. // !isExemptField &&
  1219. // (nonSumItem.fillContent == null || nonSumItem.fillContent === "")
  1220. // ) {
  1221. // uni.showToast({
  1222. // title:
  1223. // t("operation.PleaseFillIn") +
  1224. // item.deviceCode +
  1225. // "(" +
  1226. // item.deviceName +
  1227. // ")" +
  1228. // t("operation.allItem"),
  1229. // icon: "none",
  1230. // });
  1231. // return; // 校验失败直接返回,不设置按钮禁用
  1232. // }
  1233. // // 如果threshold > 0,则判断fillContent是否大于threshold
  1234. // if (nonSumItem.threshold > 0) {
  1235. // if (nonSumItem.fillContent > nonSumItem.threshold) {
  1236. // uni.showToast({
  1237. // title:
  1238. // item.deviceCode +
  1239. // "(" +
  1240. // item.deviceName +
  1241. // ")" +
  1242. // nonSumItem.name +
  1243. // t(
  1244. // "operationRecordFilling.fillContentCannotGreaterThanThreshold"
  1245. // ) +
  1246. // nonSumItem.threshold,
  1247. // icon: "none",
  1248. // duration: 3000,
  1249. // });
  1250. // nonSumItem.fillContent = ""; // 清空输入
  1251. // return; // 校验失败直接返回,不设置按钮禁用
  1252. // }
  1253. // }
  1254. // }
  1255. // }
  1256. // // 检查是否有超限的项目,如果有则统一显示
  1257. // if (rdThresholdExceededItems.value.length > 0) {
  1258. // const exceededInfo = rdThresholdExceededItems.value
  1259. // .map(
  1260. // (item, index) =>
  1261. // `${index + 1}. ${item.deviceCode} ${item.itemName}不能超过${
  1262. // item.maxValue
  1263. // },当前值为${item.currentValue}`
  1264. // )
  1265. // .join("\n");
  1266. // uni.showModal({
  1267. // title: "阈值超限提示",
  1268. // content: `以下项目超过阈值限制:\n${exceededInfo}\n\n是否继续保存?`,
  1269. // showCancel: true,
  1270. // cancelText: "取消",
  1271. // confirmText: "继续",
  1272. // success: (res) => {
  1273. // if (res.confirm) {
  1274. // // 用户选择继续,执行保存操作,此时才设置按钮禁用
  1275. // submitDataWithDisable();
  1276. // } else if (res.cancel) {
  1277. // // 用户选择取消,不执行保存
  1278. // return;
  1279. // }
  1280. // },
  1281. // });
  1282. // return;
  1283. // }
  1284. // // 所有基础校验通过后,才设置提交状态并执行提交
  1285. // submitDataWithDisable();
  1286. // };
  1287. const formRef = ref(null);
  1288. const onSubmit = async () => {
  1289. try {
  1290. if (formRef.value) {
  1291. for (const item of formRef.value) {
  1292. await item.validate();
  1293. }
  1294. }
  1295. } catch (error) {
  1296. return;
  1297. }
  1298. // 清空之前的超限记录
  1299. rdThresholdExceededItems.value = [];
  1300. // 校验是否所有待填写项都已加载
  1301. if (dataList.value.length < totalNum) {
  1302. uni.showToast({
  1303. title: t("operationRecordFilling.PleaseLoadAllItems"),
  1304. icon: "none",
  1305. });
  1306. return; // 校验失败直接返回,不设置按钮禁用
  1307. }
  1308. // 1. 校验所有必填项 - 在这里进行所有基础校验
  1309. for (const item of dataList.value) {
  1310. const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
  1311. // 查找当日运转时间H项目
  1312. const otherNptTime = nonSumList.find((i) => i.name === "其他非生产时间H");
  1313. const runtimeItem = nonSumList.find((i) => i.name === "当日运转时间H");
  1314. const dailyInjectGasTime = nonSumList.find(
  1315. (i) => i.description === "dailyInjectGasTime"
  1316. );
  1317. const isRuntime24 =
  1318. runtimeItem &&
  1319. (runtimeItem.fillContent == 24 || runtimeItem.fillContent == "24");
  1320. for (const nonSumItem of nonSumList) {
  1321. // 增加判断条件:如果当日运转时间H等于24,则非生产原因和非生产时间H为非必填,否则为必填
  1322. if (
  1323. nonSumItem.description === "dailyGasInjection" &&
  1324. deptName.value === "rh" &&
  1325. taskId.value &&
  1326. !noGasTasks.value.includes(taskId.value)
  1327. ) {
  1328. if (dailyInjectGasTime.fillContent > 0) {
  1329. if (nonSumItem.fillContent <= 0) {
  1330. uni.showToast({
  1331. title: "当日运转时间大于0,注气量也需要大于0",
  1332. icon: "none",
  1333. });
  1334. return;
  1335. }
  1336. }
  1337. }
  1338. if (
  1339. nonSumItem.name === "其他非生产时间原因" &&
  1340. !nonSumItem.fillContent &&
  1341. otherNptTime.fillContent > 0
  1342. ) {
  1343. uni.showToast({
  1344. title: "其他非生产时间大于 0 时,必须填写其他非生产时间原因",
  1345. icon: "none",
  1346. });
  1347. return;
  1348. }
  1349. const isExemptField =
  1350. isRuntime24 &&
  1351. (nonSumItem.name === "非生产原因" || nonSumItem.name === "非生产时间H");
  1352. if (
  1353. (!item.isReport || item.isReport != 1) &&
  1354. !isExemptField &&
  1355. (nonSumItem.fillContent == null || nonSumItem.fillContent === "") &&
  1356. nonSumItem.name !== "其他非生产时间原因"
  1357. ) {
  1358. uni.showToast({
  1359. title:
  1360. t("operation.PleaseFillIn") +
  1361. item.deviceCode +
  1362. "(" +
  1363. item.deviceName +
  1364. ")" +
  1365. t("operation.allItem"),
  1366. icon: "none",
  1367. });
  1368. return; // 校验失败直接返回,不设置按钮禁用
  1369. }
  1370. // 如果threshold > 0,则判断fillContent是否大于threshold
  1371. if (nonSumItem.threshold > 0) {
  1372. if (nonSumItem.fillContent > nonSumItem.threshold) {
  1373. uni.showToast({
  1374. title:
  1375. item.deviceCode +
  1376. "(" +
  1377. item.deviceName +
  1378. ")" +
  1379. nonSumItem.name +
  1380. t(
  1381. "operationRecordFilling.fillContentCannotGreaterThanThreshold"
  1382. ) +
  1383. nonSumItem.threshold,
  1384. icon: "none",
  1385. duration: 3000,
  1386. });
  1387. nonSumItem.fillContent = ""; // 清空输入
  1388. return; // 校验失败直接返回,不设置按钮禁用
  1389. }
  1390. }
  1391. }
  1392. }
  1393. // 检查是否有超限的项目,如果有则统一显示
  1394. // 需要在基础校验通过后,执行rd特殊阈值检查
  1395. // 重新检查rd特殊阈值
  1396. for (const item of dataList.value) {
  1397. const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
  1398. for (const nonSumItem of nonSumList) {
  1399. if (nonSumItem.fillContent != "" && nonSumItem.fillContent != null) {
  1400. // **********************
  1401. // 新增:针对rd公司的特殊阈值检查
  1402. // 检查包含"累计公里数填报"的字段不能超过对应"累计公里数"字段 + 3000
  1403. if (nonSumItem.name.includes("累计公里数填报")) {
  1404. const correspondingSumItem = item.sumList.find((sumItem) =>
  1405. sumItem.name.includes("累计公里数")
  1406. );
  1407. if (correspondingSumItem) {
  1408. const totalKm = parseFloat(correspondingSumItem.totalRunTime) || 0;
  1409. checkRdThreshold(nonSumItem, totalKm, 3000, nonSumItem.name);
  1410. }
  1411. }
  1412. // 检查包含"累计运转时长填报"的字段不能超过对应"累计运转时长"字段 + 100
  1413. else if (nonSumItem.name.includes("累计运转时长填报")) {
  1414. const correspondingSumItem = item.sumList.find((sumItem) =>
  1415. sumItem.name.includes("累计运转时长")
  1416. );
  1417. if (correspondingSumItem) {
  1418. const totalRunTime =
  1419. parseFloat(correspondingSumItem.totalRunTime) || 0;
  1420. checkRdThreshold(nonSumItem, totalRunTime, 100, nonSumItem.name);
  1421. }
  1422. }
  1423. }
  1424. }
  1425. }
  1426. // 检查是否有超限的项目,如果有则统一显示
  1427. if (rdThresholdExceededItems.value.length > 0) {
  1428. const exceededInfo = rdThresholdExceededItems.value
  1429. .map(
  1430. (item, index) =>
  1431. `${index + 1}. ${item.deviceCode} ${item.itemName}不能超过${item.maxValue},当前值为${item.currentValue}`
  1432. )
  1433. .join("\n");
  1434. uni.showModal({
  1435. title: "阈值超限提示",
  1436. content: `以下项目超过阈值限制:\n${exceededInfo}\n\n是否继续保存?`,
  1437. showCancel: true,
  1438. cancelText: "取消",
  1439. confirmText: "继续",
  1440. success: (res) => {
  1441. if (res.confirm) {
  1442. // 用户选择继续,执行保存操作,此时才设置按钮禁用
  1443. submitDataWithDisable();
  1444. } else if (res.cancel) {
  1445. // 用户选择取消,不执行保存
  1446. return;
  1447. }
  1448. },
  1449. });
  1450. return;
  1451. }
  1452. // 所有基础校验通过后,才设置提交状态并执行提交
  1453. submitDataWithDisable();
  1454. };
  1455. // 新增一个带禁用状态的提交方法
  1456. const submitDataWithDisable = async () => {
  1457. // 如果正在提交,直接返回
  1458. if (isSubmitting.value) {
  1459. return;
  1460. }
  1461. // 设置提交状态为 true,禁用按钮
  1462. isSubmitting.value = true;
  1463. try {
  1464. // 处理数据内容的校验和格式化
  1465. for (const item of dataList.value) {
  1466. const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
  1467. for (const nonSumItem of nonSumList) {
  1468. if (nonSumItem.fillContent != "" && nonSumItem.fillContent != null) {
  1469. console.log("🚀 ~ nonSumItem:", nonSumItem);
  1470. console.log("🚀 ~ nonSumItem.fillContent:", nonSumItem.fillContent);
  1471. // 先将值转换为字符串进行操作
  1472. const fillContentStr = String(nonSumItem.fillContent);
  1473. // 将字符串转换为数字
  1474. const num = Number(fillContentStr);
  1475. // 检查转换后的数字是否有效
  1476. if (!isNaN(num)) {
  1477. // 检查是否包含小数(使用字符串检查)
  1478. if (fillContentStr.includes(".")) {
  1479. // 保留两位小数(假设toFixed是你定义的保留两位小数的函数)
  1480. nonSumItem.fillContent = toFixed(num);
  1481. } else {
  1482. // 转换为整数
  1483. nonSumItem.fillContent = Math.floor(num);
  1484. }
  1485. }
  1486. // **********************
  1487. // 新增:针对rd公司的特殊阈值检查
  1488. // 检查包含"累计公里数填报"的字段不能超过对应"累计公里数"字段 + 3000
  1489. if (nonSumItem.name.includes("累计公里数填报")) {
  1490. const correspondingSumItem = item.sumList.find((sumItem) =>
  1491. sumItem.name.includes("累计公里数")
  1492. );
  1493. if (correspondingSumItem) {
  1494. const totalKm =
  1495. parseFloat(correspondingSumItem.totalRunTime) || 0;
  1496. checkRdThreshold(nonSumItem, totalKm, 3000, nonSumItem.name);
  1497. }
  1498. }
  1499. // 检查包含"累计运转时长填报"的字段不能超过对应"累计运转时长"字段 + 100
  1500. else if (nonSumItem.name.includes("累计运转时长填报")) {
  1501. const correspondingSumItem = item.sumList.find((sumItem) =>
  1502. sumItem.name.includes("累计运转时长")
  1503. );
  1504. if (correspondingSumItem) {
  1505. const totalRunTime =
  1506. parseFloat(correspondingSumItem.totalRunTime) || 0;
  1507. checkRdThreshold(nonSumItem, totalRunTime, 100, nonSumItem.name);
  1508. }
  1509. }
  1510. }
  1511. }
  1512. }
  1513. // 执行实际的数据提交
  1514. await submitData();
  1515. } catch (error) {
  1516. console.error("保存失败", error);
  1517. // 启用按钮
  1518. isSubmitting.value = false;
  1519. uni.showToast({
  1520. title: t("operation.fail"),
  1521. icon: "none",
  1522. });
  1523. }
  1524. };
  1525. // 修改 submitData 方法,使其返回 Promise
  1526. const submitData = async () => {
  1527. try {
  1528. // 定义新的dataList副本 用于提交数据,避免修改原数据
  1529. const subDataList = JSON.parse(JSON.stringify(dataList.value));
  1530. // 3. 处理副本:删除 enumList(仅修改副本,不影响原数据)
  1531. for (const item of subDataList) {
  1532. // 先判断 item.nonSumList 存在,避免空指针
  1533. if (item.nonSumList && item.nonSumList.length) {
  1534. for (const nonSumItem of item.nonSumList) {
  1535. if (nonSumItem.enumList) {
  1536. delete nonSumItem.enumList;
  1537. }
  1538. }
  1539. }
  1540. }
  1541. console.log("处理提交用的副本数据:subDataList", subDataList);
  1542. // 2. 处理提交数据:将nonSumList和sumList合并为新数组并赋值给deviceInfoList对象,将所有的deviceInfoList合并为submitList
  1543. const submitList = subDataList.map((item) => ({
  1544. deviceInfoList: [].concat(item.sumList).concat(item.nonSumList),
  1545. }));
  1546. console.log("提交用的数据:submitList", submitList);
  1547. // 3. 提交所有填写记录
  1548. const reqData = {
  1549. createReqVO: submitList,
  1550. reportDetails: reportDetails.value.map((item) => ({
  1551. ...item,
  1552. taskId: taskId.value,
  1553. })),
  1554. };
  1555. const res = await recordFillingDetailInsertDataList(reqData);
  1556. console.log("🚀 ~ 提交工单填报内容结果 ~ res:", res);
  1557. if (res?.code === 0) {
  1558. // 3. 调用更新工单状态接口
  1559. const upRes = await recordFillingUpOperationOrder({
  1560. id: params.value.orderId,
  1561. });
  1562. console.log("🚀 ~ upRes:", upRes);
  1563. if (upRes?.code === 0) {
  1564. console.log("工单状态更新成功");
  1565. uni.showToast({
  1566. title: t("operation.success"),
  1567. duration: 1500,
  1568. icon: "none",
  1569. });
  1570. // 成功后延迟跳转,不启用按钮
  1571. setTimeout(() => {
  1572. uni.navigateBack();
  1573. }, 1500);
  1574. // 注意:这里不设置 isSubmitting.value = false,因为成功后会跳转页面
  1575. return; // 成功完成,直接返回
  1576. } else {
  1577. console.error("工单状态更新失败", upRes);
  1578. throw new Error("工单状态更新失败"); // 抛出错误,让 catch 处理
  1579. }
  1580. } else {
  1581. throw new Error("提交失败"); // 抛出错误,让 catch 处理
  1582. }
  1583. } catch (error) {
  1584. console.error("保存失败", error);
  1585. // 启用按钮,让用户可以重试
  1586. isSubmitting.value = false;
  1587. uni.showToast({
  1588. title: t("operation.fail"),
  1589. icon: "none",
  1590. });
  1591. throw error; // 重新抛出错误
  1592. }
  1593. };
  1594. // 将原来的保存逻辑提取到单独函数中
  1595. // const submitData = async () => {
  1596. // // 定义新的dataList副本 用于提交数据,避免修改原数据
  1597. // const subDataList = JSON.parse(JSON.stringify(dataList.value));
  1598. // // 3. 处理副本:删除 enumList(仅修改副本,不影响原数据)
  1599. // for (const item of subDataList) {
  1600. // // 先判断 item.nonSumList 存在,避免空指针
  1601. // if (item.nonSumList && item.nonSumList.length) {
  1602. // for (const nonSumItem of item.nonSumList) {
  1603. // if (nonSumItem.enumList) {
  1604. // delete nonSumItem.enumList;
  1605. // }
  1606. // }
  1607. // }
  1608. // }
  1609. // console.log("处理提交用的副本数据:subDataList", subDataList);
  1610. // // 2. 处理提交数据:将nonSumList和sumList合并为新数组并赋值给deviceInfoList对象,将所有的deviceInfoList合并为submitList
  1611. // const submitList = subDataList.map((item) => ({
  1612. // deviceInfoList: [].concat(item.sumList).concat(item.nonSumList),
  1613. // }));
  1614. // console.log("提交用的数据:submitList", submitList);
  1615. // // 3. 提交所有填写记录
  1616. // await recordFillingDetailInsertDataList(submitList)
  1617. // .then(async (res) => {
  1618. // console.log("🚀 ~ 提交工单填报内容结果 ~ res:", res);
  1619. // if (res?.code === 0) {
  1620. // // 3. 调用更新工单状态接口
  1621. // const upRes = await recordFillingUpOperationOrder({
  1622. // id: params.value.orderId,
  1623. // });
  1624. // console.log("🚀 ~ upRes:", upRes);
  1625. // if (upRes?.code === 0) {
  1626. // console.log("工单状态更新成功");
  1627. // uni.showToast({
  1628. // title: t("operation.success"),
  1629. // duration: 1500,
  1630. // icon: "none",
  1631. // });
  1632. // setTimeout(() => {
  1633. // uni.navigateBack();
  1634. // }, 1500);
  1635. // } else {
  1636. // console.error("工单状态更新失败", upRes);
  1637. // uni.showToast({
  1638. // title: t("operation.fail"),
  1639. // icon: "none",
  1640. // });
  1641. // }
  1642. // } else {
  1643. // uni.showToast({
  1644. // title: t("operation.fail"),
  1645. // icon: "none",
  1646. // });
  1647. // }
  1648. // })
  1649. // .catch((error) => {
  1650. // console.error("保存失败", error);
  1651. // uni.showToast({
  1652. // title: t("operation.fail"),
  1653. // icon: "error",
  1654. // });
  1655. // });
  1656. // };
  1657. </script>
  1658. <style lang="scss" scoped>
  1659. .page {
  1660. padding: 0;
  1661. box-sizing: border-box;
  1662. }
  1663. .top {
  1664. padding: 10px;
  1665. }
  1666. .list {
  1667. // margin-top: calc(10px);
  1668. padding: 10px;
  1669. // height: calc(100%);
  1670. }
  1671. .item {
  1672. width: 100%;
  1673. // height: 204px;
  1674. background: #ffffff;
  1675. border-radius: 6px;
  1676. margin-bottom: 10px;
  1677. box-sizing: border-box;
  1678. padding: 20px 15px;
  1679. }
  1680. .item-module {
  1681. width: 100%;
  1682. height: 16px;
  1683. position: relative;
  1684. font-weight: 600;
  1685. font-size: 14px;
  1686. color: #333333;
  1687. margin-bottom: 10px;
  1688. .module-border {
  1689. position: absolute;
  1690. left: -15px;
  1691. width: 0px;
  1692. height: 12px;
  1693. border: 1px solid #004098;
  1694. }
  1695. }
  1696. .item-content {
  1697. position: relative;
  1698. width: 100%;
  1699. // height: calc(38px);
  1700. box-sizing: border-box;
  1701. font-weight: 500;
  1702. font-size: 14px;
  1703. color: #333333;
  1704. line-height: 20px;
  1705. border-bottom: 1px dashed #cacccf;
  1706. &:last-child {
  1707. border-bottom: none;
  1708. }
  1709. &.bold {
  1710. font-weight: 600;
  1711. // :deep(.uni-easyinput__content-input){
  1712. // padding-right: 0 !important;
  1713. // }
  1714. }
  1715. &.bottom-bold {
  1716. border-bottom: 1px dashed #cacccf;
  1717. }
  1718. }
  1719. .item-title {
  1720. position: relative;
  1721. min-height: 38px;
  1722. width: 55%;
  1723. &.total {
  1724. :deep(.is-disabled) {
  1725. color: #333333 !important;
  1726. }
  1727. }
  1728. &.full-cell {
  1729. width: 100%;
  1730. min-width: max-content;
  1731. }
  1732. }
  1733. .item-value {
  1734. width: 45%;
  1735. position: relative;
  1736. &.textarea {
  1737. width: 65%;
  1738. }
  1739. }
  1740. .word-break-all {
  1741. min-width: unset;
  1742. }
  1743. :deep(.uni-select) {
  1744. border: none;
  1745. text-align: right;
  1746. padding-right: 0;
  1747. .uniui-bottom:before {
  1748. content: "\e6b5" !important;
  1749. font-size: 16px !important;
  1750. }
  1751. }
  1752. :deep(.uni-select__input-text) {
  1753. text-align: right;
  1754. .align-left {
  1755. text-align: right;
  1756. }
  1757. }
  1758. :deep(.uni-select--disabled) {
  1759. color: #d5d5d5 !important;
  1760. background-color: transparent;
  1761. .uni-select__input-text {
  1762. color: #d5d5d5 !important;
  1763. }
  1764. }
  1765. :deep(.uni-select__selector) {
  1766. text-align: left;
  1767. }
  1768. :deep(.uni-select__selector-item) {
  1769. border-bottom: 1px dashed #cacccf;
  1770. text-align: left;
  1771. }
  1772. :deep(.uni-easyinput__content-textarea) {
  1773. min-height: inherit;
  1774. margin: 10px;
  1775. }
  1776. .uni-forms {
  1777. .uni-forms-item {
  1778. display: flex;
  1779. align-items: center;
  1780. flex: 1;
  1781. margin-bottom: 0px;
  1782. border-bottom: 1px dashed #cacccf;
  1783. }
  1784. :deep(.uni-forms-item__content) {
  1785. text-align: right;
  1786. .readOnly {
  1787. padding-right: 10px;
  1788. }
  1789. }
  1790. :deep(.uni-forms-item__label) {
  1791. height: 44px;
  1792. font-weight: 500;
  1793. font-size: 14px;
  1794. color: #333333 !important;
  1795. width: max-content !important;
  1796. }
  1797. :deep(.uni-easyinput__content-input) {
  1798. padding: 0 !important;
  1799. }
  1800. }
  1801. :deep(.uni-easyinput__content-textarea) {
  1802. margin: 0 !important;
  1803. }
  1804. .divider {
  1805. margin: 0;
  1806. transform: translateY(-2px);
  1807. :deep(.uv-line) {
  1808. border-width: 2px !important;
  1809. border-color: rgb(41, 121, 255) !important;
  1810. }
  1811. }
  1812. :deep(.datetime-picker) {
  1813. .uniui-calendar {
  1814. &::before {
  1815. display: none;
  1816. }
  1817. }
  1818. .uni-date-editor--x__disabled {
  1819. opacity: 1 !important;
  1820. }
  1821. .uni-date__x-input {
  1822. color: #333 !important;
  1823. }
  1824. }
  1825. </style>