detail.vue 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995
  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'"
  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 inputCurrentDepth = useDebounceFn(function inputCurrentDepth(list) {
  423. const details = reportDetails.value;
  424. if (Array.isArray(details) && details.length > 0) {
  425. const latestDetail = details.reduce((prev, current) => {
  426. const currentFullTime = dayjs(current.reportDate)
  427. .hour(parseInt(current.endTime.split(":")[0]))
  428. .minute(parseInt(current.endTime.split(":")[1]))
  429. .valueOf();
  430. const prevFullTime = dayjs(prev.reportDate)
  431. .hour(parseInt(prev.endTime.split(":")[0]))
  432. .minute(parseInt(prev.endTime.split(":")[1]))
  433. .valueOf();
  434. return currentFullTime >= prevFullTime ? current : prev;
  435. });
  436. const currentDepth = list.find(
  437. (item) => item?.description === "currentDepth"
  438. );
  439. if (currentDepth) currentDepth.fillContent = latestDetail.currentDepth;
  440. }
  441. }, 300);
  442. const showDepth = computed(() => (list) => {
  443. return list.some((item) => item.description === "currentDepth");
  444. });
  445. const NON_KEYS = [
  446. "repairTime",
  447. "selfStopTime",
  448. "accidentTime",
  449. "complexityTime",
  450. "rectificationTime",
  451. "waitingStopTime",
  452. "partyaDesign",
  453. "partyaPrepare",
  454. "partyaResource",
  455. "relocationTime",
  456. "winterBreakTime",
  457. "otherNptTime",
  458. ];
  459. const keys = [
  460. "repairTime",
  461. "selfStopTime",
  462. "accidentTime",
  463. "complexityTime",
  464. "rectificationTime",
  465. "waitingStopTime",
  466. "partyaDesign",
  467. "partyaPrepare",
  468. "partyaResource",
  469. "relocationTime",
  470. "winterBreakTime",
  471. "otherNptTime",
  472. "drillingWorkingTime",
  473. "otherProductionTime",
  474. "ratedProductionTime",
  475. "productionTime",
  476. "dailyInjectGasTime",
  477. "otherNptReason",
  478. ];
  479. const sumNonProdTimes = (index) => {
  480. let sum = 0;
  481. const { nonSumList } = dataList.value[index];
  482. NON_KEYS.forEach((field) => {
  483. sum += Number(
  484. (nonSumList || []).find((item) => item.description === field)
  485. ?.fillContent || 0
  486. );
  487. });
  488. return sum;
  489. };
  490. const handleInputRaw = (val, item) => {
  491. let num = Number(val);
  492. if (val === "" || isNaN(num) || num < 0) {
  493. num = 0;
  494. } else if (num > 24) {
  495. num = 24;
  496. }
  497. item.fillContent = num;
  498. };
  499. const onInputChange = debounce(handleInputRaw, 500);
  500. // 校验函数:总时间必须为 24
  501. const ryValidateTotalTime = (index) => (rule, value, data, callback) => {
  502. const { nonSumList } = dataList.value[index];
  503. const drillingTime = Number(
  504. (nonSumList || []).find(
  505. (item) => item.description === "drillingWorkingTime"
  506. )?.fillContent || 0
  507. );
  508. const otherTime = Number(
  509. (nonSumList || []).find(
  510. (item) => item.description === "otherProductionTime"
  511. )?.fillContent || 0
  512. );
  513. const nonProdSum = sumNonProdTimes(index);
  514. let total = 0;
  515. let msg = "";
  516. total = parseFloat((drillingTime + otherTime + nonProdSum).toFixed(2));
  517. msg = `进尺(${drillingTime})+其他(${otherTime})+非生产(${nonProdSum})=${total}H,必须为24H`;
  518. if (Math.abs(total - 24) > 0.01) {
  519. callback(msg);
  520. }
  521. return true;
  522. };
  523. const rhValidateTotalTime = (index) => (rule, value, data, callback) => {
  524. const { nonSumList } = dataList.value[index];
  525. const gasTime = Number(
  526. (nonSumList || []).find((item) => item.description === "dailyInjectGasTime")
  527. ?.fillContent || 0
  528. );
  529. const nonProdSum = sumNonProdTimes(index);
  530. let total = 0;
  531. let msg = "";
  532. total = parseFloat((gasTime + nonProdSum).toFixed(2));
  533. msg = `运转(${gasTime})+非生产(${nonProdSum})=${total}H,必须为24H`;
  534. console.log("total :>> ", total);
  535. if (Math.abs(total - 24) > 0.01) {
  536. callback(msg);
  537. }
  538. return true;
  539. };
  540. const rules = reactive({
  541. drillingWorkingTime: (index) => [
  542. { required: true, errorMessage: "请输入进尺工作时间" },
  543. { validateFunction: ryValidateTotalTime(index) },
  544. ],
  545. dailyInjectGasTime: (index) => [
  546. { required: true, errorMessage: "请输入当日运转时间" },
  547. { validateFunction: rhValidateTotalTime(index) },
  548. ],
  549. });
  550. // -------------------------------------
  551. const isFromMsg = ref(false);
  552. const params = ref({});
  553. const isView = ref(false); // 是否编辑 -- view == 1为编辑状态
  554. let deptName = ref("");
  555. // 累加状态对象,用于在生产日报加载前存储累加值
  556. const accumulatedValues = reactive({
  557. "当日注水量-方": 0,
  558. "当日用电量kWh": 0,
  559. "当日运转时间H": 0,
  560. "当日注气量-方": 0,
  561. });
  562. onReady(() => {
  563. console.log("onReady");
  564. });
  565. onLoad(async (option) => {
  566. console.log("onLoad", option);
  567. await reloginByUserId(option.reloginUserId);
  568. isFromMsg.value = !!option.reloginUserId;
  569. // 初始化params
  570. params.value = JSON.parse(option.param);
  571. // 处理createTime
  572. params.value.createTime = params.value.createTime
  573. ? dayjs(Number.parseInt(params.value.createTime)).format("YYYY-MM-DD")
  574. : "";
  575. // 请求工单详情
  576. if (params.value?.orderId) {
  577. const detail = (await getRecordFillingDetail(params.value.orderId)).data;
  578. const daily = detail ?? {
  579. wellNamePair: {},
  580. };
  581. taskOptions.value = Object.keys(daily.wellNamePair ?? {}).map((key) => ({
  582. text: daily.wellNamePair[key],
  583. value: Number(key),
  584. }));
  585. taskId.value = taskOptions.value[0]?.value || undefined;
  586. const data = await getDeptName(detail.deptId);
  587. console.log("data>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", data);
  588. deptName.value = data.data;
  589. console.log("deptName.value>>>>>>>>>>>>>>>>>>>", deptName.value);
  590. params.value = {
  591. ...params.value,
  592. ...detail,
  593. // 处理createTime
  594. createTime: detail.createTime
  595. ? dayjs(Number.parseInt(detail.createTime)).format("YYYY-MM-DD")
  596. : "",
  597. orderId: detail.id,
  598. };
  599. }
  600. console.log("🚀 ~ params.value:", params.value);
  601. // 处理是否可编辑 {0: '待填写', 1: '已完成', 2: '填写中', 3: '忽略'}
  602. isView.value = params.value?.orderStatus % 2 == 0;
  603. console.log("🚀 ~ isView.value:", isView.value);
  604. });
  605. const paging = ref(null);
  606. // v-model绑定的这个变量不要在分页请求结束中自己赋值,直接使用即可
  607. const dataList = ref([]);
  608. // 列表总数
  609. const totalNum = ref(0);
  610. // 监听dataList变化,初始化时计算一次总和
  611. watch(
  612. dataList,
  613. (newVal) => {
  614. // calculateTotalRunTime();
  615. },
  616. { deep: true }
  617. );
  618. // 处理fillContent变化的方法
  619. const handleFillContentChange = (nosum, deviceItem) => {
  620. console.log("🚀 ~ nosum, deviceItem:", nosum, deviceItem);
  621. // 处理增压机
  622. if (
  623. deviceItem.deviceName.includes("增压机") &&
  624. nosum.name === "当日运转时间"
  625. ) {
  626. calculateTotalRunTime("增压机", "当日运转时间"); // 计算当日运转时间总和
  627. }
  628. // 处理提纯撬
  629. if (deviceItem.deviceName.includes("提纯撬") && nosum.name === "当日注气量") {
  630. calculateTotalRunTime("提纯撬", "当日注气量"); // 计算当日注气量总和
  631. }
  632. // 处理注水泵
  633. if (deviceItem.deviceName.includes("注水泵") && nosum.name === "当日注水量") {
  634. calculateTotalRunTime("注水泵", "当日注水量"); // 计算当日注水量总和
  635. }
  636. // 处理箱式变电站
  637. if (
  638. deviceItem.deviceName.includes("箱式变电站") &&
  639. nosum.name === "当日用电量"
  640. ) {
  641. calculateTotalRunTime("箱式变电站", "当日用电量"); // 计算当日用电量总和
  642. }
  643. };
  644. // 防抖函数
  645. function debounce(func, delay) {
  646. let timer;
  647. return function (...args) {
  648. if (timer) clearTimeout(timer);
  649. timer = setTimeout(() => func.apply(this, args), delay);
  650. };
  651. }
  652. //防抖
  653. const debouncedCalculateTotalRunTime = debounce(calculateTotalRunTime, 100);
  654. const debouncedApplyAccumulatedToReport = debounce(
  655. applyAccumulatedToReport,
  656. 100
  657. );
  658. /**
  659. * 更新累加值
  660. * @param fieldName 字段名
  661. * @param deviceType 设备类型
  662. */
  663. const updateAccumulatedValue = (fieldName, deviceType) => {
  664. let total = 0;
  665. dataList.value.forEach((item) => {
  666. if (item.deviceName.includes(deviceType) && item.nonSumList) {
  667. item.nonSumList.forEach((nonSum) => {
  668. if (
  669. nonSum.type === "double" &&
  670. nonSum.name === fieldName &&
  671. nonSum.fillContent !== null &&
  672. nonSum.fillContent !== ""
  673. ) {
  674. const value = parseFloat(nonSum.fillContent) || 0;
  675. total += value;
  676. }
  677. });
  678. }
  679. });
  680. accumulatedValues[fieldName] = total;
  681. };
  682. /**
  683. * 重新计算所有累加值
  684. */
  685. const recalculateAllAccumulatedValues = () => {
  686. const fields = [
  687. { field: "当日运转时间H", device: "增压机" },
  688. { field: "当日注气量-方", device: "提纯撬" },
  689. { field: "当日注水量-方", device: "注水泵" },
  690. { field: "当日用电量kWh", device: "箱式变电站" },
  691. ];
  692. fields.forEach(({ field, device }) => {
  693. updateAccumulatedValue(field, device);
  694. });
  695. };
  696. /**
  697. * 将累加值应用到生产日报
  698. */
  699. function applyAccumulatedToReport() {
  700. // 先重新计算所有累加值
  701. recalculateAllAccumulatedValues();
  702. const reportItem = dataList.value.find(
  703. (item) => item.deviceName === "生产日报"
  704. );
  705. if (!reportItem) {
  706. console.warn("⚠️ 未找到生产日报,累加值已存储,等待加载");
  707. return;
  708. }
  709. Object.keys(accumulatedValues).forEach((fieldName) => {
  710. const targetItem = reportItem.nonSumList.find(
  711. (item) => item.name === fieldName
  712. );
  713. if (targetItem) {
  714. console.log(
  715. `📊 应用累加值 (${fieldName}):`,
  716. accumulatedValues[fieldName]
  717. );
  718. targetItem.fillContent = toFixed(accumulatedValues[fieldName]);
  719. }
  720. });
  721. }
  722. const handleRealTimeUpdate = (nosum, deviceItem) => {
  723. console.log("🚀 实时更新 ~ nosum, deviceItem:", nosum, deviceItem);
  724. let fieldName = "";
  725. let deviceType = "";
  726. // 当日运转时间累加
  727. if (
  728. deviceItem.deviceName.includes("增压机") &&
  729. nosum.name === "当日运转时间H"
  730. ) {
  731. fieldName = "当日运转时间H";
  732. deviceType = "增压机";
  733. }
  734. // 当日注气量累加
  735. if (
  736. deviceItem.deviceName.includes("提纯撬") &&
  737. nosum.name === "当日注气量-方"
  738. ) {
  739. fieldName = "当日注气量-方";
  740. deviceType = "提纯撬";
  741. }
  742. // 当日注水量累加
  743. if (
  744. deviceItem.deviceName.includes("注水泵") &&
  745. nosum.name === "当日注水量-方"
  746. ) {
  747. fieldName = "当日注水量-方";
  748. deviceType = "注水泵";
  749. }
  750. // 当日用电量累加
  751. if (
  752. deviceItem.deviceName.includes("箱式变电站") &&
  753. nosum.name === "当日用电量kWh"
  754. ) {
  755. fieldName = "当日用电量kWh";
  756. deviceType = "箱式变电站";
  757. }
  758. if (fieldName) {
  759. // 更新累加值
  760. updateAccumulatedValue(fieldName, deviceType);
  761. // 应用到生产日报(如果已加载)
  762. debouncedApplyAccumulatedToReport();
  763. }
  764. };
  765. /**
  766. * 计算所有deviceName中包含deviceNameToMatch的对象中对应的reportName的fillContent总和并更新到reportName的fillContent中
  767. * @param deviceNameToMatch {string} 设备名称包含的字符串
  768. * @param reportName {string} 填写项名称
  769. */
  770. function calculateTotalRunTime(
  771. deviceNameToMatch,
  772. sourceFieldName,
  773. targetFieldName
  774. ) {
  775. const reportItem = dataList.value.find(
  776. (item) => item.deviceName === "生产日报"
  777. );
  778. if (!reportItem) {
  779. console.warn("⚠️ 未找到生产日报");
  780. return;
  781. }
  782. const targetItem = reportItem.nonSumList.find(
  783. (item) => item.name === targetFieldName
  784. );
  785. if (!targetItem) {
  786. console.warn(`⚠️ 未找到目标字段:${targetFieldName}`);
  787. return;
  788. }
  789. let total = 0;
  790. dataList.value.forEach((item) => {
  791. if (item.deviceName.includes(deviceNameToMatch) && item.nonSumList) {
  792. item.nonSumList.forEach((nonSum) => {
  793. if (
  794. nonSum.type === "double" &&
  795. nonSum.name === sourceFieldName &&
  796. nonSum.fillContent !== null &&
  797. nonSum.fillContent !== ""
  798. ) {
  799. const value = parseFloat(nonSum.fillContent) || 0;
  800. total += value;
  801. }
  802. });
  803. }
  804. });
  805. console.log(`📊 累计值 (${sourceFieldName} -> ${targetFieldName}):`, total);
  806. targetItem.fillContent = toFixed(total);
  807. }
  808. const formatT = (arr) =>
  809. `${arr[0].toString().padStart(2, "0")}:${arr[1].toString().padStart(2, "0")}`;
  810. // @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用paging.value.reload()即可
  811. const queryList = (pageNo, pageSize) => {
  812. const userId = uni.getStorageSync("userId");
  813. if (!userId) {
  814. paging.value.complete([]);
  815. return;
  816. }
  817. // 请求填报设备及属性
  818. recordFillingDetailGetPageAndAttrs({
  819. pageNo,
  820. pageSize,
  821. orderId: params.value.orderId,
  822. // deviceCategoryId: 1,
  823. })
  824. .then(async (res) => {
  825. console.log("🚀 ~ res:", res);
  826. const { data } = res;
  827. const resList = [].concat(data.list);
  828. // 列表总数
  829. totalNum.value = data.total;
  830. // 遍历列表,处理attrsDetail
  831. resList.map(async (item) => {
  832. const attrParams = {
  833. deviceCode: item.deviceCode,
  834. deviceName: item.deviceName,
  835. deptId: item.deptId,
  836. createTime: params.value.createTime,
  837. deviceCategoryId: item.deviceCategoryId,
  838. deviceId: item.deviceId,
  839. userId: params.value.userId,
  840. orderId: params.value.orderId,
  841. };
  842. // console.log(
  843. // "getRecordFillingDetailGetAttrs- attrParams",
  844. // attrParams
  845. // );
  846. const resAttrs = item?.attrsDetail;
  847. // console.log("resAttrs", resAttrs);
  848. if (resAttrs) {
  849. attrParams.createTime = attrParams.createTime
  850. ? dayjs(attrParams.createTime).format("YYYY-MM-DD")
  851. : "";
  852. attrParams.id = attrParams.orderId;
  853. delete attrParams.orderId;
  854. delete attrParams.deviceName;
  855. resAttrs.map((rtem) => {
  856. // 将rtem中sumList和nonSumList两个数组中的
  857. // fillContent字段判断是否为null, 如果为null,则赋值为0 不为null则保留两位小数
  858. // 将attrParams合并到两个数组的每个对象中
  859. // 然后将sumList和nonSumList分别赋值给item的sumList和nonSumList
  860. if (rtem.sumList) {
  861. rtem.sumList.map((sumItem) => {
  862. if (sumItem.fillContent == null || sumItem.fillContent == "") {
  863. // console.log("🚀 ~ rtem.sumList.map ~ sumItem:", sumItem);
  864. // sumItem.fillContent = 0;
  865. } else {
  866. // 如果是double类型,保留两位小数
  867. if (sumItem.type == "double") {
  868. sumItem.fillContent = toFixed(sumItem.fillContent);
  869. }
  870. }
  871. // 将sumItem的id赋值给modelId
  872. sumItem.modelId = sumItem.id;
  873. sumItem.pointName = sumItem.name;
  874. // 合并attrParams到sumItem中
  875. sumItem = Object.assign(sumItem, attrParams);
  876. });
  877. }
  878. if (rtem.nonSumList) {
  879. //
  880. rtem.nonSumList.map((nonSumItem) => {
  881. if (
  882. nonSumItem.fillContent == null ||
  883. nonSumItem.fillContent == ""
  884. ) {
  885. // console.log(
  886. // "🚀 ~ rtem.nonSumList.map ~ nonSumItem:",
  887. // nonSumItem
  888. // );
  889. // nonSumItem.fillContent = 0;
  890. } else {
  891. // 如果是double类型,保留两位小数
  892. if (nonSumItem.type == "double") {
  893. nonSumItem.fillContent = toFixed(nonSumItem.fillContent);
  894. }
  895. }
  896. nonSumItem.pointName = nonSumItem.name;
  897. // 将nonSumItem的id赋值给modelId
  898. nonSumItem.modelId = nonSumItem.id;
  899. // 合并attrParams到nonSumItem中
  900. nonSumItem = Object.assign(nonSumItem, attrParams);
  901. // 如果是enum类型,且description不为null,则根据description获取对应字典项数组,赋值给enumList
  902. if (nonSumItem.type == "enum" && nonSumItem.description) {
  903. console.log("🚀 ~ onSumItem.description:");
  904. const dictOptions =
  905. nonSumItem.name === "非生产原因"
  906. ? getIntDictOptions(nonSumItem.description)
  907. : getStrDictOptions(nonSumItem.description);
  908. nonSumItem.enumList = dictOptions.map((dict) => {
  909. return {
  910. ...dict,
  911. text: dict.label,
  912. };
  913. });
  914. // 确保 fillContent 的类型与 enumList 中的 value 类型匹配
  915. if (nonSumItem.name === "非生产原因") {
  916. // 如果是"非生产原因",将 fillContent 转换为数字类型以匹配 getIntDictOptions
  917. if (
  918. nonSumItem.fillContent !== null &&
  919. nonSumItem.fillContent !== ""
  920. ) {
  921. nonSumItem.fillContent = parseInt(nonSumItem.fillContent);
  922. }
  923. }
  924. console.log("🚀 ~ nonSumItem.enumList:", nonSumItem.enumList);
  925. }
  926. });
  927. }
  928. item.sumList = rtem.sumList;
  929. const timeKeys = keys.filter((k) => k !== "otherNptReason");
  930. item.nonSumList = rtem.nonSumList
  931. .sort((a, b) => a.modelId - b.modelId)
  932. .map((item) => {
  933. if (timeKeys.includes(item.description)) {
  934. item.fillContent = Number(item.fillContent || 0);
  935. }
  936. return item;
  937. });
  938. });
  939. console.log("resAttrs-modelId", resAttrs);
  940. }
  941. return item;
  942. });
  943. console.log("resList--", resList);
  944. // 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
  945. paging.value.completeByNoMore(
  946. resList,
  947. pageNo * pageSize >= totalNum.value
  948. );
  949. // 如果加载的数据中包含生产日报,应用累加值
  950. const hasReport = resList.some((item) => item.deviceName === "生产日报");
  951. if (hasReport) {
  952. applyAccumulatedToReport();
  953. reportDetailsGet(params.value.orderId).then((res) => {
  954. reportDetails.value = (res.data ?? []).map((item) => ({
  955. reportDate: item.reportDate ?? dayjs(params.createTime).valueOf(),
  956. startTime: formatT(item.startTime),
  957. endTime: formatT(item.endTime),
  958. duration: item.duration,
  959. currentDepth: item.currentDepth,
  960. currentOperation: item.currentOperation,
  961. constructionDetail: item.constructionDetail,
  962. }));
  963. console.log("🚀 ~ reportDetails.value:", reportDetails.value);
  964. if (!reportDetails.value.length) {
  965. addProductionStatusRow();
  966. }
  967. });
  968. }
  969. })
  970. .catch((res) => {
  971. // 如果请求失败写paging.value.complete(false);
  972. // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
  973. // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
  974. paging.value.complete(false);
  975. });
  976. };
  977. /**
  978. * 检查累计公里数和运转时长限制(仅针对deptName为'rd'的公司)
  979. * @param item 需要检查的填报项
  980. * @param totalValue 累计值
  981. * @param maxIncrement 最大增量
  982. * @param itemName 项目名称
  983. */
  984. const rdThresholdExceededItems = ref([]);
  985. const checkRdThreshold = (item, totalValue, maxIncrement, itemName) => {
  986. if (deptName.value !== "rd") {
  987. return true; // 不是rd公司,跳过检查
  988. }
  989. if (!item.fillContent) {
  990. return true; // 没有填写内容,跳过检查
  991. }
  992. const fillValue = parseFloat(item.fillContent);
  993. const maxValue = totalValue + maxIncrement;
  994. if (fillValue > maxValue) {
  995. // 收集超限信息
  996. rdThresholdExceededItems.value.push({
  997. deviceCode: item.deviceCode,
  998. // deviceName: item.deviceName,
  999. itemName: itemName,
  1000. maxValue: maxValue,
  1001. currentValue: fillValue,
  1002. });
  1003. return false;
  1004. }
  1005. return true;
  1006. };
  1007. // 判断是否小于阈值 (<0)
  1008. const checkLessThreshold = (item) => {
  1009. if (item.fillContent < 0) {
  1010. uni.showToast({
  1011. title:
  1012. item.name +
  1013. t("operationRecordFilling.fillContentCannotLessThanThreshold") +
  1014. "0",
  1015. icon: "none",
  1016. });
  1017. item.fillContent = ""; // 清空输入
  1018. return false; // 返回false表示校验失败
  1019. }
  1020. };
  1021. // 判断是否大于阈值
  1022. const checkThreshold = (item) => {
  1023. checkLessThreshold(item);
  1024. // 如果threshold > 0,则判断fillContent是否大于threshold,如果大于则提示用户填写小于等于threshold的值
  1025. if (item.fillContent > item.threshold) {
  1026. uni.showToast({
  1027. title:
  1028. item.name +
  1029. t("operationRecordFilling.fillContentCannotGreaterThanThreshold") +
  1030. item.threshold,
  1031. icon: "none",
  1032. });
  1033. item.fillContent = ""; // 清空输入
  1034. return false; // 返回false表示校验失败
  1035. }
  1036. };
  1037. // 保留两位小数
  1038. const toFixed = (num) => {
  1039. if (num) {
  1040. num = Number(num);
  1041. num = num.toFixed(2);
  1042. } else {
  1043. num = 0.0;
  1044. }
  1045. return num;
  1046. };
  1047. const isSubmitting = ref(false); // 添加提交状态
  1048. // const onSubmit = async () => {
  1049. // // 清空之前的超限记录
  1050. // rdThresholdExceededItems.value = [];
  1051. // // console.log("onSubmit", dataList.value);
  1052. // // 校验是否所有待填写项都已加载
  1053. // if (dataList.value.length < totalNum) {
  1054. // uni.showToast({
  1055. // title: t("operationRecordFilling.PleaseLoadAllItems"),
  1056. // icon: "none",
  1057. // });
  1058. // return; // 校验失败直接返回
  1059. // }
  1060. // // 1. 校验所有必填项
  1061. // // 遍历dataList.value中nonSumList每个item(非生产日报 isReport!=1)的fillContent字段,
  1062. // // 如果为null或者为空,则提示用户填写,
  1063. // // 如果threshold > 0,则判断fillContent是否大于threshold,如果大于则提示用户填写小于等于threshold的值
  1064. // // 如果所有项全部填写,则调用填写记录接口
  1065. // for (const item of dataList.value) {
  1066. // const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
  1067. // // 查找当日运转时间H项目
  1068. // const runtimeItem = nonSumList.find((i) => i.name === "当日运转时间H");
  1069. // const isRuntime24 =
  1070. // runtimeItem &&
  1071. // (runtimeItem.fillContent == 24 || runtimeItem.fillContent == "24");
  1072. // for (const nonSumItem of nonSumList) {
  1073. // // 增加判断条件:如果当日运转时间H等于24,则非生产原因和非生产时间H为非必填,否则为必填
  1074. // const isExemptField =
  1075. // isRuntime24 &&
  1076. // (nonSumItem.name === "非生产原因" || nonSumItem.name === "非生产时间H");
  1077. // if (
  1078. // (!item.isReport || item.isReport != 1) &&
  1079. // !isExemptField &&
  1080. // (nonSumItem.fillContent == null || nonSumItem.fillContent === "")
  1081. // ) {
  1082. // uni.showToast({
  1083. // title:
  1084. // t("operation.PleaseFillIn") +
  1085. // item.deviceCode +
  1086. // "(" +
  1087. // item.deviceName +
  1088. // ")" +
  1089. // t("operation.allItem"),
  1090. // icon: "none",
  1091. // });
  1092. // return; // 校验失败直接返回
  1093. // }
  1094. // if (nonSumItem.fillContent != "" && nonSumItem.fillContent != null) {
  1095. // console.log("🚀 ~ nonSumItem:", nonSumItem);
  1096. // console.log("🚀 ~ nonSumItem.fillContent:", nonSumItem.fillContent);
  1097. // // 先将值转换为字符串进行操作
  1098. // const fillContentStr = String(nonSumItem.fillContent);
  1099. // // 将字符串转换为数字
  1100. // const num = Number(fillContentStr);
  1101. // // 检查转换后的数字是否有效
  1102. // if (!isNaN(num)) {
  1103. // // 检查是否包含小数(使用字符串检查)
  1104. // if (fillContentStr.includes(".")) {
  1105. // // 保留两位小数(假设toFixed是你定义的保留两位小数的函数)
  1106. // nonSumItem.fillContent = toFixed(num);
  1107. // } else {
  1108. // // 转换为整数
  1109. // nonSumItem.fillContent = Math.floor(num);
  1110. // }
  1111. // }
  1112. // // **********************
  1113. // // 新增:针对rd公司的特殊阈值检查
  1114. // // 检查包含"累计公里数填报"的字段不能超过对应"累计公里数"字段 + 3000
  1115. // if (nonSumItem.name.includes("累计公里数填报")) {
  1116. // const correspondingSumItem = item.sumList.find((sumItem) =>
  1117. // sumItem.name.includes("累计公里数")
  1118. // );
  1119. // if (correspondingSumItem) {
  1120. // const totalKm = parseFloat(correspondingSumItem.totalRunTime) || 0;
  1121. // checkRdThreshold(nonSumItem, totalKm, 3000, nonSumItem.name);
  1122. // }
  1123. // }
  1124. // // 检查包含"累计运转时长填报"的字段不能超过对应"累计运转时长"字段 + 100
  1125. // else if (nonSumItem.name.includes("累计运转时长填报")) {
  1126. // const correspondingSumItem = item.sumList.find((sumItem) =>
  1127. // sumItem.name.includes("累计运转时长")
  1128. // );
  1129. // if (correspondingSumItem) {
  1130. // const totalRunTime =
  1131. // parseFloat(correspondingSumItem.totalRunTime) || 0;
  1132. // checkRdThreshold(nonSumItem, totalRunTime, 100, nonSumItem.name);
  1133. // }
  1134. // }
  1135. // }
  1136. // // 如果threshold > 0,则判断fillContent是否大于threshold
  1137. // if (nonSumItem.threshold > 0) {
  1138. // if (nonSumItem.fillContent > nonSumItem.threshold) {
  1139. // uni.showToast({
  1140. // title:
  1141. // item.deviceCode +
  1142. // "(" +
  1143. // item.deviceName +
  1144. // ")" +
  1145. // nonSumItem.name +
  1146. // t(
  1147. // "operationRecordFilling.fillContentCannotGreaterThanThreshold"
  1148. // ) +
  1149. // nonSumItem.threshold,
  1150. // icon: "none",
  1151. // duration: 3000,
  1152. // });
  1153. // nonSumItem.fillContent = ""; // 清空输入
  1154. // return; // 校验失败直接返回
  1155. // }
  1156. // }
  1157. // }
  1158. // }
  1159. // // 检查是否有超限的项目,如果有则统一显示
  1160. // if (rdThresholdExceededItems.value.length > 0) {
  1161. // const exceededInfo = rdThresholdExceededItems.value
  1162. // .map(
  1163. // (item, index) =>
  1164. // `${index + 1}. ${item.deviceCode} ${item.itemName}不能超过${
  1165. // item.maxValue
  1166. // },当前值为${item.currentValue}`
  1167. // )
  1168. // .join("\n");
  1169. // uni.showModal({
  1170. // title: "阈值超限提示",
  1171. // content: `以下项目超过阈值限制:\n${exceededInfo}\n\n是否继续保存?`,
  1172. // showCancel: true,
  1173. // cancelText: "取消",
  1174. // confirmText: "继续",
  1175. // success: (res) => {
  1176. // if (res.confirm) {
  1177. // // 用户选择继续,执行保存操作
  1178. // submitData();
  1179. // } else if (res.cancel) {
  1180. // // 用户选择取消,不执行保存
  1181. // return;
  1182. // }
  1183. // },
  1184. // });
  1185. // return;
  1186. // }
  1187. // // 如果没有超限项目,直接执行保存
  1188. // submitData();
  1189. // };
  1190. // 修改 onSubmit 方法
  1191. // const onSubmit = async () => {
  1192. // // 校验是否所有待填写项都已加载
  1193. // if (dataList.value.length < totalNum) {
  1194. // uni.showToast({
  1195. // title: t("operationRecordFilling.PleaseLoadAllItems"),
  1196. // icon: "none",
  1197. // });
  1198. // return; // 校验失败直接返回,不设置按钮禁用
  1199. // }
  1200. // // 1. 校验所有必填项 - 在这里进行所有基础校验
  1201. // for (const item of dataList.value) {
  1202. // const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
  1203. // // 查找当日运转时间H项目
  1204. // const runtimeItem = nonSumList.find((i) => i.name === "当日运转时间H");
  1205. // const isRuntime24 =
  1206. // runtimeItem &&
  1207. // (runtimeItem.fillContent == 24 || runtimeItem.fillContent == "24");
  1208. // for (const nonSumItem of nonSumList) {
  1209. // // 增加判断条件:如果当日运转时间H等于24,则非生产原因和非生产时间H为非必填,否则为必填
  1210. // const isExemptField =
  1211. // isRuntime24 &&
  1212. // (nonSumItem.name === "非生产原因" || nonSumItem.name === "非生产时间H");
  1213. // if (
  1214. // (!item.isReport || item.isReport != 1) &&
  1215. // !isExemptField &&
  1216. // (nonSumItem.fillContent == null || nonSumItem.fillContent === "")
  1217. // ) {
  1218. // uni.showToast({
  1219. // title:
  1220. // t("operation.PleaseFillIn") +
  1221. // item.deviceCode +
  1222. // "(" +
  1223. // item.deviceName +
  1224. // ")" +
  1225. // t("operation.allItem"),
  1226. // icon: "none",
  1227. // });
  1228. // return; // 校验失败直接返回,不设置按钮禁用
  1229. // }
  1230. // // 如果threshold > 0,则判断fillContent是否大于threshold
  1231. // if (nonSumItem.threshold > 0) {
  1232. // if (nonSumItem.fillContent > nonSumItem.threshold) {
  1233. // uni.showToast({
  1234. // title:
  1235. // item.deviceCode +
  1236. // "(" +
  1237. // item.deviceName +
  1238. // ")" +
  1239. // nonSumItem.name +
  1240. // t(
  1241. // "operationRecordFilling.fillContentCannotGreaterThanThreshold"
  1242. // ) +
  1243. // nonSumItem.threshold,
  1244. // icon: "none",
  1245. // duration: 3000,
  1246. // });
  1247. // nonSumItem.fillContent = ""; // 清空输入
  1248. // return; // 校验失败直接返回,不设置按钮禁用
  1249. // }
  1250. // }
  1251. // }
  1252. // }
  1253. // // 检查是否有超限的项目,如果有则统一显示
  1254. // if (rdThresholdExceededItems.value.length > 0) {
  1255. // const exceededInfo = rdThresholdExceededItems.value
  1256. // .map(
  1257. // (item, index) =>
  1258. // `${index + 1}. ${item.deviceCode} ${item.itemName}不能超过${
  1259. // item.maxValue
  1260. // },当前值为${item.currentValue}`
  1261. // )
  1262. // .join("\n");
  1263. // uni.showModal({
  1264. // title: "阈值超限提示",
  1265. // content: `以下项目超过阈值限制:\n${exceededInfo}\n\n是否继续保存?`,
  1266. // showCancel: true,
  1267. // cancelText: "取消",
  1268. // confirmText: "继续",
  1269. // success: (res) => {
  1270. // if (res.confirm) {
  1271. // // 用户选择继续,执行保存操作,此时才设置按钮禁用
  1272. // submitDataWithDisable();
  1273. // } else if (res.cancel) {
  1274. // // 用户选择取消,不执行保存
  1275. // return;
  1276. // }
  1277. // },
  1278. // });
  1279. // return;
  1280. // }
  1281. // // 所有基础校验通过后,才设置提交状态并执行提交
  1282. // submitDataWithDisable();
  1283. // };
  1284. const formRef = ref(null);
  1285. const onSubmit = async () => {
  1286. try {
  1287. if (formRef.value) {
  1288. for (const item of formRef.value) {
  1289. await item.validate();
  1290. }
  1291. }
  1292. } catch (error) {
  1293. return;
  1294. }
  1295. // 清空之前的超限记录
  1296. rdThresholdExceededItems.value = [];
  1297. // 校验是否所有待填写项都已加载
  1298. if (dataList.value.length < totalNum) {
  1299. uni.showToast({
  1300. title: t("operationRecordFilling.PleaseLoadAllItems"),
  1301. icon: "none",
  1302. });
  1303. return; // 校验失败直接返回,不设置按钮禁用
  1304. }
  1305. // 1. 校验所有必填项 - 在这里进行所有基础校验
  1306. for (const item of dataList.value) {
  1307. const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
  1308. // 查找当日运转时间H项目
  1309. const otherNptTime = nonSumList.find((i) => i.name === "其他非生产时间H");
  1310. const runtimeItem = nonSumList.find((i) => i.name === "当日运转时间H");
  1311. const isRuntime24 =
  1312. runtimeItem &&
  1313. (runtimeItem.fillContent == 24 || runtimeItem.fillContent == "24");
  1314. for (const nonSumItem of nonSumList) {
  1315. // 增加判断条件:如果当日运转时间H等于24,则非生产原因和非生产时间H为非必填,否则为必填
  1316. if (
  1317. nonSumItem.description === "dailyGasInjection" &&
  1318. deptName.value === "rh"
  1319. ) {
  1320. if (runtimeItem.fillContent > 0 && nonSumItem.fillContent > 0) {
  1321. } else {
  1322. uni.showToast({
  1323. title: "当日运转时间大于0,注气量也需要大于0",
  1324. icon: "none",
  1325. });
  1326. return;
  1327. }
  1328. }
  1329. if (
  1330. nonSumItem.name === "其他非生产时间原因" &&
  1331. !nonSumItem.fillContent &&
  1332. otherNptTime.fillContent > 0
  1333. ) {
  1334. uni.showToast({
  1335. title: "其他非生产时间大于 0 时,必须填写其他非生产时间原因",
  1336. icon: "none",
  1337. });
  1338. return;
  1339. }
  1340. const isExemptField =
  1341. isRuntime24 &&
  1342. (nonSumItem.name === "非生产原因" || nonSumItem.name === "非生产时间H");
  1343. if (
  1344. (!item.isReport || item.isReport != 1) &&
  1345. !isExemptField &&
  1346. (nonSumItem.fillContent == null || nonSumItem.fillContent === "") &&
  1347. nonSumItem.name !== "其他非生产时间原因"
  1348. ) {
  1349. uni.showToast({
  1350. title:
  1351. t("operation.PleaseFillIn") +
  1352. item.deviceCode +
  1353. "(" +
  1354. item.deviceName +
  1355. ")" +
  1356. t("operation.allItem"),
  1357. icon: "none",
  1358. });
  1359. return; // 校验失败直接返回,不设置按钮禁用
  1360. }
  1361. // 如果threshold > 0,则判断fillContent是否大于threshold
  1362. if (nonSumItem.threshold > 0) {
  1363. if (nonSumItem.fillContent > nonSumItem.threshold) {
  1364. uni.showToast({
  1365. title:
  1366. item.deviceCode +
  1367. "(" +
  1368. item.deviceName +
  1369. ")" +
  1370. nonSumItem.name +
  1371. t(
  1372. "operationRecordFilling.fillContentCannotGreaterThanThreshold"
  1373. ) +
  1374. nonSumItem.threshold,
  1375. icon: "none",
  1376. duration: 3000,
  1377. });
  1378. nonSumItem.fillContent = ""; // 清空输入
  1379. return; // 校验失败直接返回,不设置按钮禁用
  1380. }
  1381. }
  1382. }
  1383. }
  1384. // 检查是否有超限的项目,如果有则统一显示
  1385. // 需要在基础校验通过后,执行rd特殊阈值检查
  1386. // 重新检查rd特殊阈值
  1387. for (const item of dataList.value) {
  1388. const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
  1389. for (const nonSumItem of nonSumList) {
  1390. if (nonSumItem.fillContent != "" && nonSumItem.fillContent != null) {
  1391. // **********************
  1392. // 新增:针对rd公司的特殊阈值检查
  1393. // 检查包含"累计公里数填报"的字段不能超过对应"累计公里数"字段 + 3000
  1394. if (nonSumItem.name.includes("累计公里数填报")) {
  1395. const correspondingSumItem = item.sumList.find((sumItem) =>
  1396. sumItem.name.includes("累计公里数")
  1397. );
  1398. if (correspondingSumItem) {
  1399. const totalKm = parseFloat(correspondingSumItem.totalRunTime) || 0;
  1400. checkRdThreshold(nonSumItem, totalKm, 3000, nonSumItem.name);
  1401. }
  1402. }
  1403. // 检查包含"累计运转时长填报"的字段不能超过对应"累计运转时长"字段 + 100
  1404. else if (nonSumItem.name.includes("累计运转时长填报")) {
  1405. const correspondingSumItem = item.sumList.find((sumItem) =>
  1406. sumItem.name.includes("累计运转时长")
  1407. );
  1408. if (correspondingSumItem) {
  1409. const totalRunTime =
  1410. parseFloat(correspondingSumItem.totalRunTime) || 0;
  1411. checkRdThreshold(nonSumItem, totalRunTime, 100, nonSumItem.name);
  1412. }
  1413. }
  1414. }
  1415. }
  1416. }
  1417. // 检查是否有超限的项目,如果有则统一显示
  1418. if (rdThresholdExceededItems.value.length > 0) {
  1419. const exceededInfo = rdThresholdExceededItems.value
  1420. .map(
  1421. (item, index) =>
  1422. `${index + 1}. ${item.deviceCode} ${item.itemName}不能超过${item.maxValue},当前值为${item.currentValue}`
  1423. )
  1424. .join("\n");
  1425. uni.showModal({
  1426. title: "阈值超限提示",
  1427. content: `以下项目超过阈值限制:\n${exceededInfo}\n\n是否继续保存?`,
  1428. showCancel: true,
  1429. cancelText: "取消",
  1430. confirmText: "继续",
  1431. success: (res) => {
  1432. if (res.confirm) {
  1433. // 用户选择继续,执行保存操作,此时才设置按钮禁用
  1434. submitDataWithDisable();
  1435. } else if (res.cancel) {
  1436. // 用户选择取消,不执行保存
  1437. return;
  1438. }
  1439. },
  1440. });
  1441. return;
  1442. }
  1443. // 所有基础校验通过后,才设置提交状态并执行提交
  1444. submitDataWithDisable();
  1445. };
  1446. // 新增一个带禁用状态的提交方法
  1447. const submitDataWithDisable = async () => {
  1448. // 如果正在提交,直接返回
  1449. if (isSubmitting.value) {
  1450. return;
  1451. }
  1452. // 设置提交状态为 true,禁用按钮
  1453. isSubmitting.value = true;
  1454. try {
  1455. // 处理数据内容的校验和格式化
  1456. for (const item of dataList.value) {
  1457. const nonSumList = Array.isArray(item.nonSumList) ? item.nonSumList : [];
  1458. for (const nonSumItem of nonSumList) {
  1459. if (nonSumItem.fillContent != "" && nonSumItem.fillContent != null) {
  1460. console.log("🚀 ~ nonSumItem:", nonSumItem);
  1461. console.log("🚀 ~ nonSumItem.fillContent:", nonSumItem.fillContent);
  1462. // 先将值转换为字符串进行操作
  1463. const fillContentStr = String(nonSumItem.fillContent);
  1464. // 将字符串转换为数字
  1465. const num = Number(fillContentStr);
  1466. // 检查转换后的数字是否有效
  1467. if (!isNaN(num)) {
  1468. // 检查是否包含小数(使用字符串检查)
  1469. if (fillContentStr.includes(".")) {
  1470. // 保留两位小数(假设toFixed是你定义的保留两位小数的函数)
  1471. nonSumItem.fillContent = toFixed(num);
  1472. } else {
  1473. // 转换为整数
  1474. nonSumItem.fillContent = Math.floor(num);
  1475. }
  1476. }
  1477. // **********************
  1478. // 新增:针对rd公司的特殊阈值检查
  1479. // 检查包含"累计公里数填报"的字段不能超过对应"累计公里数"字段 + 3000
  1480. if (nonSumItem.name.includes("累计公里数填报")) {
  1481. const correspondingSumItem = item.sumList.find((sumItem) =>
  1482. sumItem.name.includes("累计公里数")
  1483. );
  1484. if (correspondingSumItem) {
  1485. const totalKm =
  1486. parseFloat(correspondingSumItem.totalRunTime) || 0;
  1487. checkRdThreshold(nonSumItem, totalKm, 3000, nonSumItem.name);
  1488. }
  1489. }
  1490. // 检查包含"累计运转时长填报"的字段不能超过对应"累计运转时长"字段 + 100
  1491. else if (nonSumItem.name.includes("累计运转时长填报")) {
  1492. const correspondingSumItem = item.sumList.find((sumItem) =>
  1493. sumItem.name.includes("累计运转时长")
  1494. );
  1495. if (correspondingSumItem) {
  1496. const totalRunTime =
  1497. parseFloat(correspondingSumItem.totalRunTime) || 0;
  1498. checkRdThreshold(nonSumItem, totalRunTime, 100, nonSumItem.name);
  1499. }
  1500. }
  1501. }
  1502. }
  1503. }
  1504. // 执行实际的数据提交
  1505. await submitData();
  1506. } catch (error) {
  1507. console.error("保存失败", error);
  1508. // 启用按钮
  1509. isSubmitting.value = false;
  1510. uni.showToast({
  1511. title: t("operation.fail"),
  1512. icon: "none",
  1513. });
  1514. }
  1515. };
  1516. // 修改 submitData 方法,使其返回 Promise
  1517. const submitData = async () => {
  1518. try {
  1519. // 定义新的dataList副本 用于提交数据,避免修改原数据
  1520. const subDataList = JSON.parse(JSON.stringify(dataList.value));
  1521. // 3. 处理副本:删除 enumList(仅修改副本,不影响原数据)
  1522. for (const item of subDataList) {
  1523. // 先判断 item.nonSumList 存在,避免空指针
  1524. if (item.nonSumList && item.nonSumList.length) {
  1525. for (const nonSumItem of item.nonSumList) {
  1526. if (nonSumItem.enumList) {
  1527. delete nonSumItem.enumList;
  1528. }
  1529. }
  1530. }
  1531. }
  1532. console.log("处理提交用的副本数据:subDataList", subDataList);
  1533. // 2. 处理提交数据:将nonSumList和sumList合并为新数组并赋值给deviceInfoList对象,将所有的deviceInfoList合并为submitList
  1534. const submitList = subDataList.map((item) => ({
  1535. deviceInfoList: [].concat(item.sumList).concat(item.nonSumList),
  1536. }));
  1537. console.log("提交用的数据:submitList", submitList);
  1538. // 3. 提交所有填写记录
  1539. const reqData = {
  1540. createReqVO: submitList,
  1541. reportDetails: reportDetails.value.map((item) => ({
  1542. ...item,
  1543. taskId: taskId.value,
  1544. })),
  1545. };
  1546. const res = await recordFillingDetailInsertDataList(reqData);
  1547. console.log("🚀 ~ 提交工单填报内容结果 ~ res:", res);
  1548. if (res?.code === 0) {
  1549. // 3. 调用更新工单状态接口
  1550. const upRes = await recordFillingUpOperationOrder({
  1551. id: params.value.orderId,
  1552. });
  1553. console.log("🚀 ~ upRes:", upRes);
  1554. if (upRes?.code === 0) {
  1555. console.log("工单状态更新成功");
  1556. uni.showToast({
  1557. title: t("operation.success"),
  1558. duration: 1500,
  1559. icon: "none",
  1560. });
  1561. // 成功后延迟跳转,不启用按钮
  1562. setTimeout(() => {
  1563. uni.navigateBack();
  1564. }, 1500);
  1565. // 注意:这里不设置 isSubmitting.value = false,因为成功后会跳转页面
  1566. return; // 成功完成,直接返回
  1567. } else {
  1568. console.error("工单状态更新失败", upRes);
  1569. throw new Error("工单状态更新失败"); // 抛出错误,让 catch 处理
  1570. }
  1571. } else {
  1572. throw new Error("提交失败"); // 抛出错误,让 catch 处理
  1573. }
  1574. } catch (error) {
  1575. console.error("保存失败", error);
  1576. // 启用按钮,让用户可以重试
  1577. isSubmitting.value = false;
  1578. uni.showToast({
  1579. title: t("operation.fail"),
  1580. icon: "none",
  1581. });
  1582. throw error; // 重新抛出错误
  1583. }
  1584. };
  1585. // 将原来的保存逻辑提取到单独函数中
  1586. // const submitData = async () => {
  1587. // // 定义新的dataList副本 用于提交数据,避免修改原数据
  1588. // const subDataList = JSON.parse(JSON.stringify(dataList.value));
  1589. // // 3. 处理副本:删除 enumList(仅修改副本,不影响原数据)
  1590. // for (const item of subDataList) {
  1591. // // 先判断 item.nonSumList 存在,避免空指针
  1592. // if (item.nonSumList && item.nonSumList.length) {
  1593. // for (const nonSumItem of item.nonSumList) {
  1594. // if (nonSumItem.enumList) {
  1595. // delete nonSumItem.enumList;
  1596. // }
  1597. // }
  1598. // }
  1599. // }
  1600. // console.log("处理提交用的副本数据:subDataList", subDataList);
  1601. // // 2. 处理提交数据:将nonSumList和sumList合并为新数组并赋值给deviceInfoList对象,将所有的deviceInfoList合并为submitList
  1602. // const submitList = subDataList.map((item) => ({
  1603. // deviceInfoList: [].concat(item.sumList).concat(item.nonSumList),
  1604. // }));
  1605. // console.log("提交用的数据:submitList", submitList);
  1606. // // 3. 提交所有填写记录
  1607. // await recordFillingDetailInsertDataList(submitList)
  1608. // .then(async (res) => {
  1609. // console.log("🚀 ~ 提交工单填报内容结果 ~ res:", res);
  1610. // if (res?.code === 0) {
  1611. // // 3. 调用更新工单状态接口
  1612. // const upRes = await recordFillingUpOperationOrder({
  1613. // id: params.value.orderId,
  1614. // });
  1615. // console.log("🚀 ~ upRes:", upRes);
  1616. // if (upRes?.code === 0) {
  1617. // console.log("工单状态更新成功");
  1618. // uni.showToast({
  1619. // title: t("operation.success"),
  1620. // duration: 1500,
  1621. // icon: "none",
  1622. // });
  1623. // setTimeout(() => {
  1624. // uni.navigateBack();
  1625. // }, 1500);
  1626. // } else {
  1627. // console.error("工单状态更新失败", upRes);
  1628. // uni.showToast({
  1629. // title: t("operation.fail"),
  1630. // icon: "none",
  1631. // });
  1632. // }
  1633. // } else {
  1634. // uni.showToast({
  1635. // title: t("operation.fail"),
  1636. // icon: "none",
  1637. // });
  1638. // }
  1639. // })
  1640. // .catch((error) => {
  1641. // console.error("保存失败", error);
  1642. // uni.showToast({
  1643. // title: t("operation.fail"),
  1644. // icon: "error",
  1645. // });
  1646. // });
  1647. // };
  1648. </script>
  1649. <style lang="scss" scoped>
  1650. .page {
  1651. padding: 0;
  1652. box-sizing: border-box;
  1653. }
  1654. .top {
  1655. padding: 10px;
  1656. }
  1657. .list {
  1658. // margin-top: calc(10px);
  1659. padding: 10px;
  1660. // height: calc(100%);
  1661. }
  1662. .item {
  1663. width: 100%;
  1664. // height: 204px;
  1665. background: #ffffff;
  1666. border-radius: 6px;
  1667. margin-bottom: 10px;
  1668. box-sizing: border-box;
  1669. padding: 20px 15px;
  1670. }
  1671. .item-module {
  1672. width: 100%;
  1673. height: 16px;
  1674. position: relative;
  1675. font-weight: 600;
  1676. font-size: 14px;
  1677. color: #333333;
  1678. margin-bottom: 10px;
  1679. .module-border {
  1680. position: absolute;
  1681. left: -15px;
  1682. width: 0px;
  1683. height: 12px;
  1684. border: 1px solid #004098;
  1685. }
  1686. }
  1687. .item-content {
  1688. position: relative;
  1689. width: 100%;
  1690. // height: calc(38px);
  1691. box-sizing: border-box;
  1692. font-weight: 500;
  1693. font-size: 14px;
  1694. color: #333333;
  1695. line-height: 20px;
  1696. border-bottom: 1px dashed #cacccf;
  1697. &:last-child {
  1698. border-bottom: none;
  1699. }
  1700. &.bold {
  1701. font-weight: 600;
  1702. // :deep(.uni-easyinput__content-input){
  1703. // padding-right: 0 !important;
  1704. // }
  1705. }
  1706. &.bottom-bold {
  1707. border-bottom: 1px dashed #cacccf;
  1708. }
  1709. }
  1710. .item-title {
  1711. position: relative;
  1712. min-height: 38px;
  1713. width: 55%;
  1714. &.total {
  1715. :deep(.is-disabled) {
  1716. color: #333333 !important;
  1717. }
  1718. }
  1719. &.full-cell {
  1720. width: 100%;
  1721. min-width: max-content;
  1722. }
  1723. }
  1724. .item-value {
  1725. width: 45%;
  1726. position: relative;
  1727. &.textarea {
  1728. width: 65%;
  1729. }
  1730. }
  1731. .word-break-all {
  1732. min-width: unset;
  1733. }
  1734. :deep(.uni-select) {
  1735. border: none;
  1736. text-align: right;
  1737. padding-right: 0;
  1738. .uniui-bottom:before {
  1739. content: "\e6b5" !important;
  1740. font-size: 16px !important;
  1741. }
  1742. }
  1743. :deep(.uni-select__input-text) {
  1744. text-align: right;
  1745. .align-left {
  1746. text-align: right;
  1747. }
  1748. }
  1749. :deep(.uni-select--disabled) {
  1750. color: #d5d5d5 !important;
  1751. background-color: transparent;
  1752. .uni-select__input-text {
  1753. color: #d5d5d5 !important;
  1754. }
  1755. }
  1756. :deep(.uni-select__selector) {
  1757. text-align: left;
  1758. }
  1759. :deep(.uni-select__selector-item) {
  1760. border-bottom: 1px dashed #cacccf;
  1761. text-align: left;
  1762. }
  1763. :deep(.uni-easyinput__content-textarea) {
  1764. min-height: inherit;
  1765. margin: 10px;
  1766. }
  1767. .uni-forms {
  1768. .uni-forms-item {
  1769. display: flex;
  1770. align-items: center;
  1771. flex: 1;
  1772. margin-bottom: 0px;
  1773. border-bottom: 1px dashed #cacccf;
  1774. }
  1775. :deep(.uni-forms-item__content) {
  1776. text-align: right;
  1777. .readOnly {
  1778. padding-right: 10px;
  1779. }
  1780. }
  1781. :deep(.uni-forms-item__label) {
  1782. height: 44px;
  1783. font-weight: 500;
  1784. font-size: 14px;
  1785. color: #333333 !important;
  1786. width: max-content !important;
  1787. }
  1788. :deep(.uni-easyinput__content-input) {
  1789. padding: 0 !important;
  1790. }
  1791. }
  1792. :deep(.uni-easyinput__content-textarea) {
  1793. margin: 0 !important;
  1794. }
  1795. .divider {
  1796. margin: 0;
  1797. transform: translateY(-2px);
  1798. :deep(.uv-line) {
  1799. border-width: 2px !important;
  1800. border-color: rgb(41, 121, 255) !important;
  1801. }
  1802. }
  1803. :deep(.datetime-picker) {
  1804. .uniui-calendar {
  1805. &::before {
  1806. display: none;
  1807. }
  1808. }
  1809. .uni-date-editor--x__disabled {
  1810. opacity: 1 !important;
  1811. }
  1812. .uni-date__x-input {
  1813. color: #333 !important;
  1814. }
  1815. }
  1816. </style>