form.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. <script setup>
  2. import { ref, computed, watch, nextTick, reactive } from "vue";
  3. import { onLoad } from "@dcloudio/uni-app";
  4. import { getRuiYingReportDetail } from "@/api/ruiying";
  5. import { useDataDictStore } from "@/store/modules/dataDict";
  6. import dayjs from "dayjs";
  7. const props = defineProps({
  8. type: {
  9. type: String,
  10. default: "edit",
  11. },
  12. });
  13. const NON_PROD_FIELDS = [
  14. { key: "repairTime", label: "设备故障" },
  15. { key: "selfStopTime", label: "设备保养" },
  16. { key: "accidentTime", label: "工程质量" },
  17. { key: "complexityTime", label: "技术受限" },
  18. { key: "rectificationTime", label: "生产组织" },
  19. { key: "waitingStopTime", label: "不可抗力" },
  20. { key: "partyaDesign", label: "甲方设计" },
  21. { key: "partyaPrepare", label: "甲方准备" },
  22. { key: "partyaResource", label: "甲方资源" },
  23. { key: "relocationTime", label: "生产配合" },
  24. { key: "winterBreakTime", label: "待命" },
  25. { key: "otherNptTime", label: "其他非生产时间" },
  26. ];
  27. const FORM_KEYS = [
  28. "id",
  29. "deptId",
  30. "projectId",
  31. "taskId",
  32. "deptName",
  33. "contractName",
  34. "taskName",
  35. "repairStatus",
  36. "technique",
  37. "wellCategory",
  38. "designWellDepth",
  39. "wellControlLevel",
  40. "casingPipeSize",
  41. "dailyFuel",
  42. "currentOperation",
  43. "nextPlan",
  44. "ratedProductionTime",
  45. "productionTime",
  46. "totalStaffNum",
  47. "onDutyStaffNum",
  48. "leaveStaffNum",
  49. "daySupervisors",
  50. "nightSupervisors",
  51. "reportDetails",
  52. "constructionBrief",
  53. "remark",
  54. "createTime",
  55. "opinion",
  56. "repairTime",
  57. "selfStopTime",
  58. "accidentTime",
  59. "complexityTime",
  60. "rectificationTime",
  61. "waitingStopTime",
  62. "partyaDesign",
  63. "partyaPrepare",
  64. "partyaResource",
  65. "relocationTime",
  66. "winterBreakTime",
  67. "otherNptTime",
  68. "otherNptReason",
  69. "status",
  70. "auditStatus",
  71. "location",
  72. ];
  73. const formType = ref("edit");
  74. const initFormData = () => {
  75. const base = {
  76. ratedProductionTime: 0,
  77. productionTime: 0,
  78. constructionBrief: "",
  79. reportDetails: [],
  80. daySupervisors: "",
  81. nightSupervisors: "",
  82. };
  83. // 初始化所有非生产时间字段为 0
  84. NON_PROD_FIELDS.forEach((field) => {
  85. base[field.key] = 0;
  86. });
  87. return base;
  88. };
  89. const form = ref(initFormData());
  90. const formatT = (arr) =>
  91. `${arr[0].toString().padStart(2, "0")}:${arr[1].toString().padStart(2, "0")}`;
  92. async function loadDetail(id) {
  93. try {
  94. const { data } = await getRuiYingReportDetail({ id });
  95. form.value = initFormData();
  96. FORM_KEYS.forEach((key) => {
  97. if (
  98. Object.prototype.hasOwnProperty.call(data, key) &&
  99. data[key] !== null &&
  100. data[key] !== undefined
  101. ) {
  102. form.value[key] = data[key];
  103. }
  104. });
  105. form.value.reportDetails = form.value.reportDetails.map((item) => ({
  106. reportDate: item.reportDate || form.value.createTime,
  107. duration: item.duration || 0,
  108. constructionDetail: item.constructionDetail || "",
  109. currentOperation: item.currentOperation || "",
  110. startTime: formatT(item.startTime),
  111. endTime: formatT(item.endTime),
  112. }));
  113. if (!form.value.reportDetails.length) {
  114. addReportDetailRow();
  115. }
  116. form.value.id = id;
  117. if (props.type.includes("approval") && data.auditStatus !== 10) {
  118. formType.value = "readonly";
  119. }
  120. if (props.type.includes("edit") && data.status !== 0) {
  121. formType.value = "readonly";
  122. }
  123. if (props.type.includes("detail")) {
  124. formType.value = "readonly";
  125. }
  126. } finally {
  127. }
  128. }
  129. const addReportDetailRow = () => {
  130. if (!form.value.reportDetails) {
  131. form.value.reportDetails = [];
  132. }
  133. form.value.reportDetails.push({
  134. reportDate: form.value.createTime ?? dayjs().valueOf(),
  135. startTime: "08:00",
  136. endTime: "08:00",
  137. duration: 0,
  138. constructionDetail: "",
  139. currentOperation: "",
  140. });
  141. };
  142. const removeReportDetailRow = (index) => {
  143. if (index === 0) {
  144. uni.showToast({ title: "至少填写一条生产动态", icon: "none" });
  145. return;
  146. }
  147. form.value.reportDetails?.splice(index, 1);
  148. };
  149. const dictStore = useDataDictStore();
  150. const nptReasonOptions = ref([]);
  151. const rigStatusOptions = ref([]);
  152. const techniqueOptions = ref([]);
  153. const loadOptions = () => {
  154. nptReasonOptions.value = dictStore
  155. .getStrDictOptions("ryNptReason")
  156. .map((v) => ({
  157. text: v.label,
  158. value: v.value,
  159. }));
  160. rigStatusOptions.value = dictStore
  161. .getStrDictOptions("repairStatus")
  162. .map((v) => ({
  163. text: v.label,
  164. value: v.value,
  165. }));
  166. techniqueOptions.value = dictStore
  167. .getStrDictOptions("rq_iot_project_technology_ry")
  168. .map((v) => ({
  169. text: v.label,
  170. value: v.value,
  171. }));
  172. };
  173. onLoad((options) => {
  174. if (dictStore.dataDict.length <= 0) {
  175. dictStore.loadDataDictList().then(() => {
  176. loadOptions();
  177. });
  178. } else loadOptions();
  179. loadDetail(options.id);
  180. });
  181. const defaultProps = computed(() => ({
  182. inputBorder: false,
  183. clearable: false,
  184. placeholder: "请输入",
  185. style: {
  186. "text-align": "right",
  187. },
  188. styles: {
  189. disableColor: "#fff",
  190. },
  191. }));
  192. const disabled = computed(() => (field) => {
  193. if (field === "edit")
  194. return (
  195. formType.value === "readonly" ||
  196. props.type.includes("approval") ||
  197. props.type.includes("detail")
  198. );
  199. else return formType.value === "readonly";
  200. });
  201. const transitTime = computed(() => {
  202. const cap = form.value.productionTime ?? 0;
  203. const gas = form.value.ratedProductionTime ?? 0;
  204. if (!gas) return { original: 0, value: "0%" };
  205. const original = cap / gas;
  206. return { original, value: (original * 100).toFixed(2) + "%" };
  207. });
  208. const formRef = ref(null);
  209. const onDutyStaffNum = computed(() => {
  210. return (form.value.totalStaffNum ?? 0) - (form.value.leaveStaffNum ?? 0);
  211. });
  212. // 辅助函数:计算总时间
  213. const sumNonProdTimes = () => {
  214. let sum = 0;
  215. NON_PROD_FIELDS.forEach((field) => {
  216. sum += Number(form.value[field.key] || 0);
  217. });
  218. return sum;
  219. };
  220. // 校验函数:总时间必须为 24
  221. const validateTotalTime = (rule, value, data, callback) => {
  222. const rateTime = Number(form.value.ratedProductionTime || 0);
  223. const time = Number(form.value.productionTime || 0);
  224. const nonProdSum = sumNonProdTimes();
  225. let total = 0;
  226. let msg = "";
  227. total = parseFloat((time + nonProdSum).toFixed(2));
  228. msg = `生产(${time})+非生产(${nonProdSum})=${total}H,必须等于额定${rateTime}H`;
  229. if (Math.abs(total - rateTime) > 0.01) {
  230. callback(msg);
  231. }
  232. return true;
  233. };
  234. const rules = reactive({
  235. repairStatus: {
  236. rules: [{ required: true, errorMessage: "请输入施工状态" }],
  237. },
  238. ratedProductionTime: {
  239. rules: [
  240. { required: true, errorMessage: "请输入额定生产时间" },
  241. { validateFunction: validateTotalTime },
  242. ],
  243. },
  244. productionTime: {
  245. rules: [
  246. { required: true, errorMessage: "请输入生产时间" },
  247. { validateFunction: validateTotalTime },
  248. ],
  249. },
  250. constructionBrief: {
  251. rules: [
  252. {
  253. required: props.type === "approval",
  254. errorMessage: `请输入当日施工简报`,
  255. },
  256. ],
  257. },
  258. daySupervisors: {
  259. rules: [{ required: true, errorMessage: "请输入白班跟班干部" }],
  260. },
  261. nightSupervisors: {
  262. rules: [{ required: true, errorMessage: "请输入夜班跟班干部" }],
  263. },
  264. });
  265. const allTimeKeys = [
  266. "ratedProductionTime",
  267. "productionTime",
  268. ...NON_PROD_FIELDS.map((f) => f.key),
  269. ];
  270. watch(
  271. () => allTimeKeys.map((key) => form.value[key]),
  272. () => {
  273. nextTick(() => {
  274. formRef.value?.validateField(["ratedProductionTime", "productionTime"]);
  275. });
  276. }
  277. );
  278. defineExpose({ formRef, form, loadDetail });
  279. const orange = computed(() => {
  280. const rateTime = Number(form.value.ratedProductionTime || 0);
  281. const time = Number(form.value.productionTime || 0);
  282. const nonProdSum = sumNonProdTimes();
  283. let total = 0;
  284. let msg = "";
  285. total = parseFloat((time + nonProdSum).toFixed(2));
  286. msg = `生产(${time})+非生产(${nonProdSum})=${total}H,必须等于额定${rateTime}H`;
  287. if (Math.abs(total - rateTime) > 0.01) return true;
  288. return false;
  289. });
  290. const reportDetailsTimeRangeRef = ref(null);
  291. const startTime = ref("00:00");
  292. const startDefaultTime = ref("08:00");
  293. const endTime = ref("24:00");
  294. const endDefaultTime = ref("08:00");
  295. const reportDetailIndex = ref(0);
  296. const handleClickTimeRangeItem = (index) => {
  297. reportDetailIndex.value = index;
  298. reportDetailsTimeRangeRef.value.open();
  299. };
  300. const calculateDuration = (row) => {
  301. if (!row.startTime || !row.endTime) {
  302. row.duration = 0;
  303. return;
  304. }
  305. const todayStr = dayjs().format("YYYY-MM-DD");
  306. const start = dayjs(`${todayStr} ${row.startTime}`);
  307. const end = dayjs(`${todayStr} ${row.endTime}`);
  308. let diffMinutes = end.diff(start, "minute");
  309. if (diffMinutes < 0) {
  310. diffMinutes += 1440;
  311. }
  312. row.duration = Number((diffMinutes / 60).toFixed(2));
  313. };
  314. const reportDetailsTimeRange = (data) => {
  315. form.value.reportDetails[reportDetailIndex.value].startTime = data[0];
  316. form.value.reportDetails[reportDetailIndex.value].endTime = data[1];
  317. calculateDuration(form.value.reportDetails[reportDetailIndex.value]);
  318. };
  319. </script>
  320. <template>
  321. <view class="content">
  322. <view class="tip">
  323. <view class="item">
  324. <view class="left">
  325. <span>运行时效:</span>
  326. 生产时间/额定生产时间
  327. </view>
  328. <span class="right red"> >100% 红色预警 </span>
  329. </view>
  330. <view class="item">
  331. <view class="left">
  332. <span>时间平衡:</span>
  333. 生产 + 非生产 = 额定生产
  334. </view>
  335. <span class="right orange"> ≠额定生产 橙色预警 </span>
  336. </view>
  337. <view class="item">
  338. <view class="left">
  339. <span>油量消耗:</span>
  340. 当日油耗
  341. </view>
  342. <span class="right blue"> >3500升 蓝色预警 </span>
  343. </view>
  344. </view>
  345. <view v-if="!type.includes('approval') && form.opinion" class="opinion">
  346. <span class="left">审批意见:</span>
  347. <span class="right"> {{ form.opinion }} </span>
  348. </view>
  349. <uni-forms
  350. ref="formRef"
  351. labelWidth="auto"
  352. :model="form"
  353. :rules="rules"
  354. validateTrigger="blur"
  355. err-show-type="toast">
  356. <uni-forms-item label="施工队伍" name="deptName">
  357. <span class="readOnly">{{ form.deptName }}</span>
  358. </uni-forms-item>
  359. <uni-forms-item label="项目" name="contractName">
  360. <span class="readOnly">{{ form.contractName }}</span>
  361. </uni-forms-item>
  362. <uni-forms-item label="任务" name="taskName">
  363. <span class="readOnly">{{ form.taskName }}</span>
  364. </uni-forms-item>
  365. <uni-forms-item label="施工区域" name="location">
  366. <span class="readOnly">{{ form.location }}</span>
  367. </uni-forms-item>
  368. <uni-forms-item label="施工状态" name="repairStatus" required>
  369. <uni-data-select
  370. :clear="true"
  371. align="right"
  372. placeholder="请选择"
  373. :localdata="rigStatusOptions"
  374. placement="top"
  375. :disabled="disabled('edit')"
  376. v-model="form.repairStatus" />
  377. </uni-forms-item>
  378. <uni-forms-item label="施工工艺" name="technique">
  379. <uni-data-select
  380. :clear="true"
  381. align="right"
  382. placeholder="请选择"
  383. :localdata="techniqueOptions"
  384. placement="top"
  385. :disabled="disabled('edit')"
  386. v-model="form.technique" />
  387. </uni-forms-item>
  388. <uni-forms-item label="井别" name="wellCategory">
  389. <uni-easyinput
  390. v-bind="defaultProps"
  391. v-model="form.wellCategory"
  392. :disabled="disabled('edit')" />
  393. </uni-forms-item>
  394. <uni-forms-item label="设计井深(m)" name="designWellDepth">
  395. <uni-easyinput
  396. v-bind="defaultProps"
  397. v-model="form.designWellDepth"
  398. :disabled="disabled('edit')" />
  399. </uni-forms-item>
  400. <uni-forms-item label="井控级别" name="wellControlLevel">
  401. <uni-easyinput
  402. v-bind="defaultProps"
  403. v-model="form.wellControlLevel"
  404. :disabled="disabled('edit')" />
  405. </uni-forms-item>
  406. <uni-forms-item label="套生段产管尺寸(mm)" name="casingPipeSize">
  407. <uni-easyinput
  408. v-bind="defaultProps"
  409. v-model="form.casingPipeSize"
  410. :disabled="disabled('edit')" />
  411. </uni-forms-item>
  412. <uni-forms-item label="当日油耗(升)" name="dailyFuel">
  413. <uni-easyinput
  414. type="number"
  415. :class="{ 'blue-text': Number(form.dailyFuel) > 3500 }"
  416. v-bind="defaultProps"
  417. :disabled="disabled('edit')"
  418. v-model="form.dailyFuel" />
  419. </uni-forms-item>
  420. <uni-forms-item label="目前工序" name="currentOperation">
  421. <uni-easyinput
  422. type="textarea"
  423. autoHeight
  424. v-bind="defaultProps"
  425. v-model="form.currentOperation"
  426. :disabled="disabled('edit')"
  427. :maxlength="1000" />
  428. </uni-forms-item>
  429. <uni-forms-item label="下步工序" name="nextPlan">
  430. <uni-easyinput
  431. type="textarea"
  432. autoHeight
  433. v-bind="defaultProps"
  434. v-model="form.nextPlan"
  435. :disabled="disabled('edit')"
  436. :maxlength="1000" />
  437. </uni-forms-item>
  438. <uni-forms-item label="运行时效" name="transitTime">
  439. <span
  440. class="readOnly"
  441. :class="{ 'red-text': transitTime.original > 1.0 }"
  442. >{{ transitTime.value }}</span
  443. >
  444. </uni-forms-item>
  445. <uni-forms-item label="全员数量" name="totalStaffNum">
  446. <uni-easyinput
  447. type="number"
  448. v-bind="defaultProps"
  449. :disabled="disabled('edit')"
  450. v-model="form.totalStaffNum" />
  451. </uni-forms-item>
  452. <uni-forms-item label="在岗人数" name="onDutyStaffNum">
  453. <uni-easyinput
  454. type="number"
  455. v-bind="defaultProps"
  456. disabled
  457. v-model="onDutyStaffNum" />
  458. </uni-forms-item>
  459. <uni-forms-item label="休假人员数量" name="leaveStaffNum">
  460. <uni-easyinput
  461. type="number"
  462. v-bind="defaultProps"
  463. :disabled="disabled('edit')"
  464. v-model="form.leaveStaffNum" />
  465. </uni-forms-item>
  466. <uni-forms-item label="白班跟班干部" name="daySupervisors" required>
  467. <uni-easyinput
  468. type="number"
  469. v-bind="defaultProps"
  470. :disabled="disabled('edit')"
  471. v-model="form.daySupervisors" />
  472. </uni-forms-item>
  473. <uni-forms-item label="夜班跟班干部" name="nightSupervisors" required>
  474. <uni-easyinput
  475. type="number"
  476. v-bind="defaultProps"
  477. :disabled="disabled('edit')"
  478. v-model="form.nightSupervisors" />
  479. </uni-forms-item>
  480. <!-- <uni-forms-item label="生产动态" name="productionStatus" required>
  481. <uni-easyinput
  482. type="textarea"
  483. autoHeight
  484. v-bind="defaultProps"
  485. v-model="form.productionStatus"
  486. :disabled="disabled('edit')"
  487. :maxlength="1000" />
  488. </uni-forms-item> -->
  489. <uni-forms-item
  490. label="当日施工简报"
  491. :required="type === 'approval'"
  492. name="constructionBrief">
  493. <uni-easyinput
  494. type="textarea"
  495. autoHeight
  496. v-bind="defaultProps"
  497. :disabled="type !== 'approval'"
  498. v-model="form.constructionBrief"
  499. :maxlength="2000" />
  500. </uni-forms-item>
  501. <uni-forms-item label="备注" name="remark">
  502. <uni-easyinput
  503. type="textarea"
  504. autoHeight
  505. v-bind="defaultProps"
  506. :disabled="disabled('edit')"
  507. v-model="form.remark"
  508. :maxlength="1000" />
  509. </uni-forms-item>
  510. <uv-divider text="生产时间" textPosition="left"></uv-divider>
  511. <uni-forms-item
  512. label="额定生产时间(H)"
  513. name="ratedProductionTime"
  514. required>
  515. <uni-easyinput
  516. type="number"
  517. v-bind="defaultProps"
  518. :class="{ 'orange-text': orange }"
  519. :disabled="disabled('edit')"
  520. v-model="form.ratedProductionTime" />
  521. </uni-forms-item>
  522. <uni-forms-item label="生产时间(H)" name="productionTime" required>
  523. <uni-easyinput
  524. type="number"
  525. v-bind="defaultProps"
  526. :class="{ 'orange-text': orange }"
  527. :disabled="disabled('edit')"
  528. v-model="form.productionTime" />
  529. </uni-forms-item>
  530. <uv-divider text="生产动态" textPosition="left"></uv-divider>
  531. <uni-forms-item v-if="!disabled('edit')">
  532. <button
  533. type="primary"
  534. size="mini"
  535. class="detail-btn"
  536. @click="addReportDetailRow()">
  537. 添加一行
  538. </button>
  539. </uni-forms-item>
  540. <template v-for="(item, index) in form.reportDetails" :key="index">
  541. <uv-divider v-if="index !== 0" class="divider"></uv-divider>
  542. <uni-forms-item
  543. label="日期"
  544. required
  545. :name="['reportDetails', index, 'reportDate']"
  546. :rules="[{ required: true, errorMessage: '请选择日期' }]">
  547. <uni-datetime-picker
  548. class="datetime-picker"
  549. type="date"
  550. returnType="timestamp"
  551. v-model="item.reportDate"
  552. :border="false"
  553. :disabled="disabled('edit')" />
  554. </uni-forms-item>
  555. <uni-forms-item :label="`${$t('ruiDu.timeNode')}:`" required>
  556. <view
  557. class="item-content"
  558. @click="disabled('edit') ? '' : handleClickTimeRangeItem(index)">
  559. <view class="time-range-item" v-if="item.startTime && item.endTime">
  560. {{ item.startTime }} 至 {{ item.endTime }}
  561. </view>
  562. <view class="time-range-item" v-else>
  563. {{ selectPlaceholder }}
  564. </view>
  565. </view>
  566. </uni-forms-item>
  567. <uni-forms-item label="时长(H)">
  568. <span class="readOnly">{{ item.duration }}</span>
  569. </uni-forms-item>
  570. <uni-forms-item
  571. label="工况"
  572. required
  573. :name="['reportDetails', index, 'currentOperation']"
  574. :rules="[{ required: true, errorMessage: '请输入工况' }]">
  575. <uni-easyinput
  576. type="textarea"
  577. autoHeight
  578. v-bind="defaultProps"
  579. :disabled="disabled('edit')"
  580. v-model="item.currentOperation"
  581. :maxlength="2000" />
  582. </uni-forms-item>
  583. <!-- <uni-forms-item
  584. label="结束井深(m)"
  585. required
  586. :name="['reportDetails', index, 'currentDepth']"
  587. :rules="[{ required: true, errorMessage: '请输入结束深度' }, { validateFunction: validateLastCurrentDepth }]">
  588. <uni-easyinput
  589. type="number"
  590. v-bind="defaultProps"
  591. :disabled="disabled('edit')"
  592. v-model.number="item.currentDepth" />
  593. </uni-forms-item> -->
  594. <uni-forms-item
  595. label="详情"
  596. required
  597. :name="['reportDetails', index, 'constructionDetail']"
  598. :rules="[{ required: true, errorMessage: '请输入详情' }]">
  599. <uni-easyinput
  600. type="textarea"
  601. autoHeight
  602. v-bind="defaultProps"
  603. :disabled="disabled('edit')"
  604. v-model="item.constructionDetail"
  605. :maxlength="2000" />
  606. </uni-forms-item>
  607. <uni-forms-item v-if="!disabled('edit')" label="操作">
  608. <button
  609. type="warn"
  610. size="mini"
  611. class="detail-btn"
  612. @click="removeReportDetailRow(index)">
  613. 删除
  614. </button>
  615. </uni-forms-item>
  616. </template>
  617. <uv-divider text="非生产时间" textPosition="left"></uv-divider>
  618. <uni-forms-item
  619. v-for="field in NON_PROD_FIELDS"
  620. :key="field.key"
  621. :label="field.label + '(H)'"
  622. :name="field.key">
  623. <uni-easyinput
  624. type="number"
  625. :class="{ 'orange-text': orange }"
  626. v-bind="defaultProps"
  627. :disabled="disabled('edit')"
  628. v-model="form[field.key]" />
  629. </uni-forms-item>
  630. <uni-forms-item label="其他非生产原因" name="otherNptReason">
  631. <uni-easyinput
  632. type="textarea"
  633. autoHeight
  634. v-bind="defaultProps"
  635. v-model="form.otherNptReason"
  636. :disabled="disabled('edit')"
  637. :maxlength="1000" />
  638. </uni-forms-item>
  639. <uni-forms-item
  640. v-if="type.includes('approval')"
  641. label="审批意见"
  642. name="opinion">
  643. <uni-easyinput
  644. type="textarea"
  645. autoHeight
  646. v-bind="defaultProps"
  647. :disabled="disabled('approval')"
  648. v-model="form.opinion"
  649. :maxlength="1000" />
  650. </uni-forms-item>
  651. </uni-forms>
  652. </view>
  653. <tpf-time-range
  654. ref="reportDetailsTimeRangeRef"
  655. :startTime="startTime"
  656. :startDefaultTime="startDefaultTime"
  657. :endTime="endTime"
  658. :endDefaultTime="endDefaultTime"
  659. @timeRange="reportDetailsTimeRange"></tpf-time-range>
  660. </template>
  661. <style lang="scss" scoped>
  662. .content {
  663. background-color: white;
  664. padding: 16px 16px;
  665. border-radius: 8px;
  666. box-sizing: border-box;
  667. }
  668. .uni-forms {
  669. margin-top: 10px;
  670. height: 100%;
  671. .uni-form {
  672. height: 100%;
  673. }
  674. .uni-forms-item {
  675. display: flex;
  676. align-items: center;
  677. flex: 1;
  678. margin-bottom: 6px;
  679. border-bottom: 1px dashed #cacccf;
  680. }
  681. :deep(.uni-forms-item__content) {
  682. text-align: right;
  683. .readOnly {
  684. padding-right: 10px;
  685. }
  686. }
  687. :deep(.uni-forms-item__label) {
  688. height: 44px;
  689. font-weight: 500;
  690. font-size: 14px;
  691. color: #333333 !important;
  692. width: max-content !important;
  693. }
  694. :deep(.uni-select) {
  695. border: none;
  696. text-align: right;
  697. padding-right: 0;
  698. .uniui-bottom:before {
  699. content: "\e6b5" !important;
  700. font-size: 16px !important;
  701. }
  702. }
  703. :deep(.uni-easyinput__content-textarea) {
  704. min-height: inherit;
  705. margin: 10px;
  706. }
  707. :deep(.is-disabled) {
  708. color: #333333 !important;
  709. }
  710. :deep(.red-text > .is-disabled) {
  711. color: rgb(220 38 38 / 0.8) !important;
  712. }
  713. :deep(.orange-text > .is-disabled) {
  714. color: rgb(234 88 12 / 0.8) !important;
  715. }
  716. :deep(.uni-select--disabled) {
  717. background-color: #fff;
  718. }
  719. }
  720. .red-text {
  721. color: rgb(220 38 38 / 0.8) !important;
  722. }
  723. .blue-text {
  724. color: rgb(59 130 246 / 0.8) !important;
  725. }
  726. .orange-text {
  727. color: rgb(234 88 12 / 0.8) !important;
  728. }
  729. .red {
  730. border: 1px solid rgb(254 226 226);
  731. color: rgb(220 38 38 / 0.8);
  732. background-color: rgb(254 226 226);
  733. }
  734. .orange {
  735. border: 1px solid rgb(254 215 170);
  736. color: rgb(234 88 12 / 0.8);
  737. background-color: rgb(254 215 170);
  738. }
  739. .blue {
  740. border: 1px solid rgb(219 234 254);
  741. color: rgb(59 130 246 / 0.8);
  742. background-color: rgb(240 249 255);
  743. }
  744. .tip {
  745. border-radius: 8px;
  746. border: 1px solid #e5e5e5;
  747. background-color: rgba(239, 246, 255, 0.8);
  748. box-sizing: border-box;
  749. padding: 10px;
  750. display: flex;
  751. flex-direction: column;
  752. gap: 6px;
  753. .item {
  754. display: flex;
  755. align-items: center;
  756. justify-content: space-between;
  757. font-size: 12px;
  758. .left {
  759. color: rgb(75 85 99);
  760. span {
  761. color: rgb(31 41 55);
  762. font-weight: 600;
  763. }
  764. }
  765. .right {
  766. display: inline-flex;
  767. align-items: center;
  768. border-radius: 4px;
  769. padding: 2px 4px;
  770. font-weight: 500;
  771. }
  772. }
  773. }
  774. .opinion {
  775. border-radius: 8px;
  776. border: 1px solid rgb(254 240 138);
  777. background-color: rgb(254 252 232);
  778. box-sizing: border-box;
  779. padding: 10px;
  780. display: flex;
  781. align-items: center;
  782. justify-content: space-between;
  783. font-size: 12px;
  784. margin-top: 10px;
  785. .left {
  786. font-weight: 600;
  787. color: rgb(133 77 14);
  788. }
  789. .right {
  790. font-weight: 500;
  791. color: rgb(75 85 99);
  792. }
  793. }
  794. .divider {
  795. margin: 0;
  796. transform: translateY(-7px);
  797. :deep(.uv-line) {
  798. border-width: 2px !important;
  799. border-color: rgb(41, 121, 255) !important;
  800. }
  801. }
  802. </style>