workOrderReport.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297
  1. <template>
  2. <u-popup :show="visible" :round="0" :closeOnClickOverlay="false" :zIndex="99999" @close="closePopup"
  3. class="u-popup-my">
  4. <view class="popup-content">
  5. <view class="popup-header">
  6. <text class="popup-title">{{ title }}</text>
  7. <view class="close-btn" @click="closePopup">×</view>
  8. </view>
  9. <scroll-view class="popup-body" scroll-y>
  10. <view class="page">
  11. <view class="card-a">
  12. <!-- 头部 -->
  13. <view class="a-header">
  14. <text class="a-main-title">{{ form.ruleName }}</text>
  15. <view class="a-sub">
  16. <text>📋
  17. {{
  18. getDictValue("记录规则类型", form.recordRulesClassify)
  19. }}</text>
  20. </view>
  21. </view>
  22. <!-- 基本信息网格 -->
  23. <view class="info-grid">
  24. <view class="info-item">
  25. <text class="info-label">检查时间</text>
  26. <uni-datetime-picker type="datetime" v-model="form.checkStartTime"
  27. returnType="timestamp" :disabled="title == '详情'">
  28. <view class="info-value">{{
  29. form.checkStartTime&& dayjs(form.checkStartTime).format('YYYY-MM-DD HH:mm:ss')|| "请选择" }}</view>
  30. </uni-datetime-picker>
  31. </view>
  32. <view class="info-item">
  33. <text class="info-label">报工时间</text>
  34. <uni-datetime-picker type="datetime" v-model="form.checkFinishTime"
  35. :disabled="title == '详情'" returnType="timestamp">
  36. <view class="info-value">
  37. {{ form.checkFinishTime&& dayjs(form.checkFinishTime).format('YYYY-MM-DD HH:mm:ss')|| "请选择"}}
  38. </view>
  39. </uni-datetime-picker>
  40. </view>
  41. <view class="info-item" v-if="!form.type">
  42. <text class="info-label">部门</text>
  43. <view class="info-value" :class="{ disabled: title == '详情' }"
  44. @click="title != '详情' && $refs.treePicker._show()">{{ form.groupName || "请选择" }}
  45. </view>
  46. </view>
  47. <view class="info-item" v-if="!form.type">
  48. <text class="info-label">指定负责人</text>
  49. <view class="info-value" :class="{ disabled: title == '详情' }"
  50. @click="title != '详情' && $refs.selector.open()">{{
  51. form.executeUsers.map((item) => item.userName).toString() ||
  52. "请选择"
  53. }}</view>
  54. </view>
  55. <view class="info-item" v-if="form.type">
  56. <text class="info-label">班组</text>
  57. <view class="info-value">{{ form.teamName }}</view>
  58. </view>
  59. <view class="info-item" v-if="form.type">
  60. <text class="info-label">执行人</text>
  61. <view class="info-value" :class="{ disabled: title == '详情' }"
  62. @click="title != '详情' && $refs.selector.open()">{{
  63. form.executeUsers.map((item) => item.userName).toString() ||
  64. "请选择"
  65. }}</view>
  66. </view>
  67. <view class="info-item" v-if="form.type">
  68. <text class="info-label">场站</text>
  69. <view class="info-value" :class="{ disabled: title == '详情' }"
  70. @click="title != '详情' && (showProductLineIdPicker = true)">
  71. {{ form.productLineName || "请选择" }}
  72. </view>
  73. </view>
  74. <view class="info-item" v-if="pageName == 'productionRecords' || pageName == 'qualityTestRecords'
  75. "><text class="info-label">客户</text>
  76. <view class="info-value" :class="{ disabled: title == '详情' }"
  77. @click="title != '详情' && selectContactShow(17)">{{ form.contactName || "请选择" }}
  78. </view>
  79. </view>
  80. <view class="info-item"
  81. v-if="['QualityInspection', 'TransportAsh', 'HaulSlag'].includes(pageName)">
  82. <text class="info-label">供应商</text>
  83. <view class="info-value" :class="{ disabled: title == '详情' }"
  84. @click="title != '详情' && selectContactShow(19)">{{ form.supplierName || "请选择" }}
  85. </view>
  86. </view>
  87. <view class="info-item" v-if="
  88. ['QualityInspection', 'TransportAsh', 'HaulSlag'].includes(pageName)
  89. ">
  90. <text class="info-label">采购订单</text>
  91. <view class="info-value" :class="{ disabled: title == '详情' }" @click="openOrd">
  92. {{ form.purchaseOrderNo || "请选择" }}
  93. </view>
  94. </view>
  95. <view class="info-item" v-if="pageName == 'QualityInspection'">
  96. <text class="info-label">检查卸车是否到位</text>
  97. <view class="info-value" :class="{ disabled: title == '详情' }">
  98. <u-radio-group class="result-group" v-model="form.unloadCheckStatus"
  99. :disabled="title == '详情'">
  100. <u-radio label="已到位" :name="1"></u-radio>
  101. <u-radio label="未到位" :name="2"></u-radio>
  102. </u-radio-group>
  103. </view>
  104. </view>
  105. <view class="info-item" v-if="pageName == 'QualityInspection'||pageName=='TransportAsh'||pageName=='HaulSlag'">
  106. <view class="info-label" style="display: flex;align-items: center;">{{pageName=='QualityInspection'?'车辆照片':'照片'}} <u-button
  107. type="primary" style="width: 150rpx;margin-left: 10px;" size="small" text="拍照上传"
  108. v-if="title != '详情'" @click="chooseImage"></u-button>
  109. </view>
  110. </view>
  111. </view>
  112. <view style="padding-left: 30rpx;" v-if="pageName == 'QualityInspection'||pageName=='TransportAsh'||pageName=='HaulSlag'">
  113. <AlbumDeletable :urls="getUrl(form.vehiclePhotoUrl)" :singleSize="170" :multipleSize="170"
  114. :deletable="title != '详情'" @delete="handleDeleteImage"></AlbumDeletable>
  115. </view>
  116. <!-- 运行参数记录区 -->
  117. <view class="records-area">
  118. <view class="section-header">
  119. <view class="section-title">
  120. <text>📊 记录数据</text>
  121. </view>
  122. </view>
  123. <!-- 批量操作按钮放在标题下方 -->
  124. <view class="batch-bar" v-if="![
  125. 'qualityTestRecords',
  126. 'productionRecords',
  127. 'QualityInspection',
  128. 'HaulSlag',
  129. 'TransportAsh'
  130. ].includes(pageName) && title != '详情'">
  131. <button class="btn btn-primary" @click="batchCheck">
  132. ✅ 批量检查
  133. </button>
  134. <button class="btn btn-secondary" @click="batchQualified">
  135. 🏭 批量合格
  136. </button>
  137. </view>
  138. <!-- 检查项列表 -->
  139. <view v-for="(item, idx) in form.detailList" :key="idx" class="check-item-a">
  140. <view class="item-row1">
  141. <view class="item-info">
  142. <text class="item-name">{{ idx + 1 }}. {{ item.paramValue }}
  143. {{ item.unitName ? "(" + item.unitName + ")" : "" }}</text>
  144. </view>
  145. </view>
  146. <view class="item-row-input" v-if="item.substanceName">
  147. <text class="input-label">设备</text>
  148. <view class="item-input"> {{ item.substanceName }}</view>
  149. </view>
  150. <!-- 描述/数量 -->
  151. <view class="item-row-input">
  152. <text class="input-label">值</text>
  153. <input class="item-input" v-model="item.num" type="text" placeholder="请输入数量"
  154. @input="setValue" :disabled="title == '详情'" />
  155. </view>
  156. <view class="item-row-input" v-if="pageName == 'qualityTestRecords'">
  157. <text class="input-label">执行人</text>
  158. <view class="info-value" style="padding: 6px 10px; flex: 1; border-radius: 28rpx"
  159. :class="{ disabled: title == '详情' }"
  160. @click="title != '详情' && itemExecuteUsers(idx, item)">{{
  161. (item.checkUsers &&
  162. item.checkUsers
  163. .map((item) => item.userName)
  164. .toString()) ||
  165. "请选择"
  166. }}</view>
  167. </view>
  168. <view class="item-actions" v-if="![
  169. 'qualityTestRecords',
  170. 'productionRecords',
  171. 'QualityInspection',
  172. 'HaulSlag',
  173. 'TransportAsh'
  174. ].includes(pageName)">
  175. <u-radio-group class="result-group" v-model="item.checkStatus"
  176. :disabled="title == '详情'">
  177. <u-radio label="已检查" :name="1"></u-radio>
  178. <u-radio label="未检查" :name="0"></u-radio>
  179. </u-radio-group>
  180. <u-radio-group class="result-group" v-model="item.checkResult"
  181. :disabled="title == '详情'">
  182. <u-radio label="合格" :name="1"></u-radio>
  183. <u-radio label="不合格" :name="0"></u-radio>
  184. </u-radio-group>
  185. </view>
  186. </view>
  187. </view>
  188. </view>
  189. </view>
  190. </scroll-view>
  191. <view class="popup-footer">
  192. <u-button type="default" @click="closePopup">关闭</u-button>
  193. <u-button type="primary" @click="submit()" v-if="title == '报工'" :loading="loading">提交</u-button>
  194. </view>
  195. </view>
  196. <u-toast ref="uToast"></u-toast>
  197. <ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="searchDeptNodeClick"
  198. title="选择部门" :localdata="classificationList" valueKey="id" textKey="name" childrenKey="children" />
  199. <search-select :multiple="true" ref="selector" v-model="form.executeUsersIds" :data-list="
  200. executorList.map((val) => {
  201. return {
  202. text: val.name,
  203. value: val.id,
  204. };
  205. })
  206. " title="选择" @confirm="executeIdListChange">
  207. </search-select>
  208. <!-- 场站 -->
  209. <u-picker :show="showProductLineIdPicker" keyName="label" :columns="[
  210. productLineList.map((item) => {
  211. return {
  212. label: item.name,
  213. value: item.id,
  214. };
  215. }),
  216. ]" @confirm="confirmProductLine" @cancel="showProductLineIdPicker = false"></u-picker>
  217. <search-select :multiple="true" ref="selector1" v-model="checkUsersIds" :data-list="
  218. (form.executeUsers &&
  219. form.executeUsers.map((val) => {
  220. return {
  221. text: val.userName,
  222. value: val.userId,
  223. };
  224. })) ||
  225. []
  226. " title="选择" @confirm="executeIdListChange1">
  227. </search-select>
  228. <orderListDialog ref="orderListDialogRef" @changeParent="orderListDialogSuccess" :radioValue='true'>
  229. </orderListDialog>
  230. </u-popup>
  231. </template>
  232. <script>
  233. const formBaseData = {
  234. id: null,
  235. workshopArea: "",
  236. workshopAreaId: null,
  237. checkFinishTime: "",
  238. checkStartTime: "",
  239. checkValidity: null,
  240. checkValidityUnit: "",
  241. checkValidityUnit: "",
  242. conclusion: null,
  243. detailList: [],
  244. deviceId: 0,
  245. deviceName: "",
  246. batchNo: "",
  247. executeMethod: 0,
  248. formingNum: 0,
  249. itemType: 0,
  250. produceRoutingId: 0,
  251. produceRoutingName: "",
  252. produceTaskConfigId: 0,
  253. produceTaskId: 0,
  254. produceTaskName: "",
  255. productCode: "",
  256. productModel: "",
  257. productName: "",
  258. recordRulesClassify: null,
  259. recordTemplateStyle: null,
  260. ruleId: 0,
  261. ruleName: "",
  262. reportWorkType: 0,
  263. specification: "",
  264. workOrderCode: "",
  265. workOrderId: 0,
  266. itemTaskName: "",
  267. brandNo: "",
  268. duration: null,
  269. // 执行人
  270. executeUsersIds: [],
  271. executeUsers: [],
  272. showProductLineIdPicker: false,
  273. // 班组id
  274. teamId: "",
  275. groupId: null,
  276. // 物料字段name
  277. pickDetails: [],
  278. // 本次产出明细
  279. outputDetails: [],
  280. recordRulesExecuteMethodId: null,
  281. recordRulesExecuteMethodName: "",
  282. // 产出类型 1-原材料,2-在制品,3.BOM标准产出
  283. outputType: 1,
  284. type: 0,
  285. contactName: "",
  286. contactId: "",
  287. supplierId: "",
  288. supplierName: "",
  289. productLineId: null,
  290. productLineName: "",
  291. unloadCheckStatus: '',
  292. vehiclePhotoUrl: [],
  293. purchaseOrderId: '',
  294. purchaseOrderNo: '',
  295. clientEnvironmentId: uni.getStorageSync("userInfo") &&
  296. uni.getStorageSync("userInfo").clientEnvironmentId,
  297. };
  298. import {
  299. getById,
  300. producetaskrulerecordSaveOrUpdateAndSubmit,
  301. } from "@/api/recordRules/index";
  302. import {
  303. getTeamPage
  304. } from "@/api/pda/workOrderHandover.js";
  305. import {
  306. getUserPage,
  307. listOrganizations
  308. } from "@/api/common.js";
  309. import {
  310. toTreeData
  311. } from "@/utils/utils.js";
  312. import {
  313. mapGetters
  314. } from "vuex";
  315. import searchSelect from "@/pages/salesServiceManagement/accessory/components/searchSelect.vue";
  316. import AlbumDeletable from "@/components/AlbumDeletable/AlbumDeletable.vue";
  317. import orderListDialog from './OrderListDialog.vue';
  318. import {
  319. getPurchaseOrderList
  320. } from '@/api/purchasingManage/index.js'
  321. import dayjs from 'dayjs'
  322. export default {
  323. data() {
  324. return {
  325. visible: false,
  326. executeUsersIds: [],
  327. imgs: [],
  328. title: "",
  329. loading: false,
  330. butLoading: false,
  331. checked: false,
  332. teamUserList: [],
  333. teamList: [],
  334. teamAllList: [],
  335. classificationList: [],
  336. showProductLineIdPicker: false,
  337. showCheckUsersIds: false,
  338. checkUsersIds: '',
  339. executorList: [],
  340. allTeamList: [],
  341. productLineList: [],
  342. dayjs,
  343. currentIndex: "",
  344. form: JSON.parse(JSON.stringify(formBaseData)),
  345. };
  346. },
  347. computed: {
  348. ...mapGetters(["getDictValue"]),
  349. },
  350. components: {
  351. searchSelect,
  352. AlbumDeletable,
  353. orderListDialog
  354. },
  355. props: {
  356. pageName: "",
  357. },
  358. methods: {
  359. async open(row, type) {
  360. uni.$off("setSelectList");
  361. uni.$on("setSelectList", (data) => {
  362. if (data && data.length > 0) {
  363. this.form.contactName = data[0].name;
  364. this.form.contactId = data[0].id;
  365. this.form.supplierName = data[0].name;
  366. this.form.supplierId = data[0].id;
  367. if (['QualityInspection', 'HaulSlag', 'TransportAsh'].includes(
  368. this.pageName
  369. )) {
  370. this.form.purchaseOrderId = ''
  371. this.form.purchaseOrderNo = ''
  372. //来煤获取采购订单
  373. getPurchaseOrderList({
  374. pageNum: 1,
  375. size: 999,
  376. orderStatus: 2,
  377. partbId: data[0].id
  378. }).then((res) => {
  379. if (res.list?.length == 1) {
  380. this.form.purchaseOrderId = res.list[0].id;
  381. this.form.purchaseOrderNo = res.list[0].orderNo;
  382. }
  383. });
  384. }
  385. }
  386. });
  387. if (type == "edit") {
  388. this.title = "报工";
  389. } else {
  390. this.title = "详情";
  391. }
  392. this.getTreeList();
  393. await this.getOrderDetials(row.id);
  394. this.visible = true;
  395. },
  396. cancel() {
  397. this.form = {
  398. ...JSON.parse(JSON.stringify(formBaseData)),
  399. };
  400. this.visible = false;
  401. },
  402. async getTreeList() {
  403. const data = await listOrganizations({});
  404. let treeList = toTreeData({
  405. data: data || [],
  406. idField: "id",
  407. parentIdField: "parentId",
  408. });
  409. this.classificationList = treeList;
  410. },
  411. selectContactShow(type) {
  412. uni.navigateTo({
  413. url: "/pages/saleManage/components/selectContact?isAll=" +
  414. false +
  415. "&contactType=" +
  416. type + '&code=' + this.getCode(),
  417. });
  418. },
  419. confirmProductLine(e) {
  420. this.form.productLineId = e.value[0].value;
  421. this.form.productLineName = e.value[0].label;
  422. this.showProductLineIdPicker = false;
  423. },
  424. closePopup() {
  425. this.cancel();
  426. },
  427. openOrd() {
  428. if (!this.form.supplierId) {
  429. this.$refs.uToast.show({
  430. type: "error",
  431. icon: false,
  432. message: `请先选择供应商!`,
  433. });
  434. return;
  435. }
  436. this.$refs.orderListDialogRef.open(
  437. this.form.supplierId,
  438. //渣和灰拿委外订单
  439. ['TransportAsh', 'HaulSlag'].includes(this.pageName) ?
  440. '3,4,5,6,7' :
  441. ''
  442. );
  443. },
  444. orderListDialogSuccess(data) {
  445. this.form.purchaseOrderId = data.id;
  446. this.form.purchaseOrderNo = data.orderNo;
  447. },
  448. getCode() {
  449. if (this.clientEnvironmentId == 10) {
  450. return this.pageName == 'QualityInspection' ?
  451. '06mei' :
  452. this.pageName == 'TransportAsh' ?
  453. '07lafei' :
  454. this.pageName == 'HaulSlag' ?
  455. '08lazha' :
  456. '';
  457. } else {
  458. return '';
  459. }
  460. },
  461. // 获取工单详情
  462. async getOrderDetials(id) {
  463. try {
  464. const data = await getById(id);
  465. data.detailList = data.detailList.map((i) => {
  466. i.toolNames = i.tools.map((j) => j.toolName).join(",");
  467. if (i.checkUsers && i.checkUsers.length > 0) {
  468. console.log("i.checkUsers", i.checkUsers);
  469. i.checkUsersIds = i.checkUsers.map((j) => j.userId);
  470. }
  471. if (
  472. (!i.checkUsersIds || i.checkUsersIds.length == 0) &&
  473. data.executeUsers.length > 0
  474. ) {
  475. // 默认执行人作为检查人
  476. i.checkUsersIds = data.executeUsers
  477. .filter((i) => i.userId)
  478. .map((j) => j.userId);
  479. i.checkUsers = data.executeUsers
  480. .filter((i) => i.userId)
  481. .map((j) => {
  482. return {
  483. teamId: j.teamId,
  484. teamName: j.teamName,
  485. userId: j.userId,
  486. userName: j.userName,
  487. };
  488. });
  489. }
  490. return i;
  491. });
  492. // this.$util.assignObject(this.form, data);
  493. Object.assign(this.form, data);
  494. this.form.vehiclePhotoUrl = this.form.vehiclePhotoUrl || [];
  495. this.form.unloadCheckStatus = this.form.unloadCheckStatus || 1;
  496. this.form.checkStartTime =
  497. this.form.checkStartTime ||
  498. dayjs(new Date()).format('YYYY-M-D HH:mm:ss');
  499. this.form.checkFinishTime =
  500. this.form.checkFinishTime ||
  501. dayjs(new Date()).format('YYYY-M-D HH:mm:ss');
  502. console.log(
  503. this.form.checkStartTime,
  504. 'this.form.checkStartTime'
  505. );
  506. this.form.executeUsersIds = this.form.executeUsers
  507. .map((i) => i.userId)
  508. .filter((i) => i); // 过滤掉 undefined
  509. if (this.form.executeUsers.length > 0 && !this.form.type) {
  510. this.form.groupId = this.form.executeUsers[0]?.groupId + "";
  511. this.form.groupName = this.form.executeUsers[0]?.groupName;
  512. if (this.form.groupId) {
  513. this.searchDeptNodeClick(
  514. this.form.groupId,
  515. this.form.groupName,
  516. "init",
  517. );
  518. }
  519. }
  520. if (!this.form.teamId && this.teamList.length > 0) {
  521. this.form.teamId = this.teamList[0].id;
  522. }
  523. this.form.recordRulesClassify += "";
  524. // 加载班组人员列表
  525. if (this.form.teamId && this.form.type) {
  526. await this.getAllTeamList();
  527. const index = this.allTeamList.findIndex(
  528. (item) => item.id == this.form.teamId,
  529. );
  530. this.executorList = this.allTeamList[index].userVOList;
  531. this.productLineList = [];
  532. this.allTeamList[index].factoryWorkstationVOList.forEach((item) => {
  533. if (
  534. !this.productLineList.find((p) => p.id === item.productionLineId)
  535. ) {
  536. this.productLineList.push({
  537. name: item.productionLineName,
  538. id: item.productionLineId,
  539. });
  540. }
  541. });
  542. }
  543. //宇信
  544. if (
  545. this.clientEnvironmentId == 10 && ['productionRecords',
  546. 'qualityTestRecords'
  547. ].includes(this.pageName)
  548. ) {
  549. //客户:5#和6#默认是重油公司7#默认是红山 2008389016775864321==7#
  550. if (this.form.productLineId == '2008389016775864321') {
  551. this.form.contactId =
  552. this.form.contactId || '2008562263580520449';
  553. this.form.contactName =
  554. this.form.contactName || '克拉玛依红山油田有限责任公司';
  555. } else {
  556. this.form.contactId =
  557. this.form.contactId || '2008383566202318850';
  558. this.form.contactName =
  559. this.form.contactName || '中国石油新疆油田分公司(重油公司)';
  560. }
  561. }
  562. this.setValue();
  563. this.$nextTick(() => {
  564. this.loading = false;
  565. });
  566. } catch (error) {
  567. console.log("error", error);
  568. this.loading = false;
  569. }
  570. },
  571. checkTeamList(id) {
  572. const index = this.teamList.findIndex((item) => item.id == id);
  573. this.teamUserList = this.teamAllList[index];
  574. this.form.teamName = this.teamList[index].name;
  575. console.log("this.teamUserList", this.teamUserList);
  576. },
  577. chooseImage() {
  578. const _this = this
  579. uni.chooseImage({
  580. count: 9, //默认9
  581. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  582. sourceType: ['camera','album'], //从相册选择
  583. success: function(res) {
  584. uni.showLoading({
  585. title: '加载中'
  586. })
  587. _this.uploadFile(res.tempFilePaths).then(res => {
  588. res.forEach(item => {
  589. let fileNames = item.storePath.split('/')
  590. let url =
  591. '/main/file/getFile?objectName=' + item.storePath +
  592. '&fullfilename=' + fileNames[fileNames.length -
  593. 1]
  594. _this.form.vehiclePhotoUrl.push(url)
  595. })
  596. uni.hideLoading()
  597. })
  598. }
  599. });
  600. },
  601. getUrl(arr) {
  602. console.log(arr, 'arr')
  603. if (arr.length) {
  604. return arr.map(item => {
  605. return this.apiUrl + item
  606. })
  607. } else {
  608. return []
  609. }
  610. },
  611. uploadFile(list) {
  612. let PromiseAll = []
  613. const apiUrl = this.apiUrl
  614. const token = uni.getStorageSync("token"); //取存本地的token
  615. list.forEach(item => {
  616. PromiseAll.push(
  617. new Promise((resolve, reject) => {
  618. uni.uploadFile({
  619. url: apiUrl + '/main/file/upload',
  620. filePath: item,
  621. name: 'multiPartFile',
  622. header: {
  623. authorization: token
  624. },
  625. success: (uploadFileRes) => {
  626. let data = JSON.parse(uploadFileRes.data)
  627. resolve(data.data)
  628. }
  629. });
  630. }),
  631. )
  632. })
  633. return Promise.all(PromiseAll)
  634. },
  635. setValue() {
  636. if (this.title == '报工') {
  637. this.form.detailList.forEach((item, index) => {
  638. if (this.pageName == 'qualityTestRecords') {
  639. let num1 = this.form.detailList.find(
  640. (item1) => item1.paramValue == '给水量'
  641. )?.num;
  642. let num2 = this.form.detailList.find(
  643. (item1) => item1.paramValue == '炉水量'
  644. )?.num;
  645. let num = 0;
  646. if (num1 && num2) {
  647. num = (num2 - num1) / num2;
  648. }
  649. if (item.paramValue == '干度') {
  650. this.$set(
  651. this.form.detailList[index],
  652. 'num',
  653. parseFloat(num.toFixed(5)) * 100
  654. );
  655. }
  656. if (item.paramValue == '是否合格' && num1) {
  657. this.$set(
  658. this.form.detailList[index],
  659. 'num',
  660. parseFloat(num.toFixed(5)) * 100 >= 90 ? '合格' : '不合格'
  661. );
  662. }
  663. }
  664. if (this.pageName == 'productionRecords') {
  665. let num1 = this.form.detailList.find(
  666. (item1) => item1.paramValue == '日用水量'
  667. )?.num;
  668. let num = 0;
  669. if (num1) {
  670. num = num1 * 0.1034;
  671. }
  672. if (item.paramValue == '日用煤量') {
  673. this.$set(
  674. this.form.detailList[index],
  675. 'num',
  676. parseFloat(num.toFixed(5))
  677. );
  678. }
  679. }
  680. });
  681. }
  682. },
  683. handleDeleteImage(index) {
  684. this.form.vehiclePhotoUrl.splice(index, 1);
  685. },
  686. // 批量检查
  687. batchCheck() {
  688. this.form.detailList.forEach((i, index) => {
  689. this.$set(this.form.detailList[index], "checkStatus", 1);
  690. });
  691. },
  692. // 批量合格
  693. batchQualified() {
  694. this.form.detailList.forEach((i, index) => {
  695. this.$set(this.form.detailList[index], "checkResult", 1);
  696. });
  697. },
  698. itemExecuteUsers(index, row) {
  699. this.currentIndex = index;
  700. this.$refs.selector1.open();
  701. },
  702. executeIdListChange1() {
  703. this.$set(
  704. this.form.detailList[this.currentIndex],
  705. "checkUsersIds",
  706. this.checkUsersIds,
  707. );
  708. const checkUsersIds = this.checkUsersIds;
  709. this.checkUsersIds = [];
  710. const checkUsers = checkUsersIds.map((i) => {
  711. const user = this.form.executeUsers.find((item) => item.userId === i);
  712. return user;
  713. });
  714. console.log(checkUsers, "checkUsers");
  715. this.$set(
  716. this.form.detailList[this.currentIndex],
  717. "checkUsers",
  718. checkUsers,
  719. );
  720. },
  721. // 获取审核人列表、巡点检人员
  722. async getUserList(params) {
  723. try {
  724. let data = {
  725. pageNum: 1,
  726. size: -1,
  727. };
  728. // 如果传了参数就是获取部门人员数据
  729. if (params) {
  730. data = Object.assign(data, params);
  731. }
  732. const res = await getUserPage(data);
  733. if (params) {
  734. this.executorList = res.list;
  735. }
  736. } catch (error) {}
  737. },
  738. //选择部门(搜索)
  739. async searchDeptNodeClick(id, name, type) {
  740. this.form.groupId = id;
  741. this.form.groupName = name;
  742. if (id) {
  743. // 根据部门获取人员
  744. const params = {
  745. groupId: id,
  746. };
  747. await this.getUserList(params);
  748. } else {
  749. this.form.groupId = null;
  750. }
  751. if (type != "init") {
  752. this.form.detailList.forEach((detail) => {
  753. detail.checkUsersIds = [];
  754. detail.checkUsers = [];
  755. });
  756. this.form.executeUsers = [];
  757. this.form.executeUsersIds = [];
  758. }
  759. },
  760. // 负责人变更 同步执行人列表
  761. executeIdListChange() {
  762. console.log(this.form.executeUsersIds, "this.form.executeUsersIds");
  763. this.form.executeUsers = this.form.executeUsersIds
  764. .map((userId) => {
  765. const user = this.executorList.find((u) => u.id === userId);
  766. if (!user) return null;
  767. return {
  768. userId: user.id,
  769. userName: user.name,
  770. groupId: user.groupId,
  771. groupName: user.groupName,
  772. };
  773. })
  774. .filter((i) => i);
  775. // 同步详情执行人
  776. this.form.detailList.forEach((detail, index) => {
  777. this.$set(
  778. this.form.detailList[index],
  779. "checkUsersIds",
  780. this.form.executeUsersIds,
  781. );
  782. this.$set(
  783. this.form.detailList[index],
  784. "checkUsers",
  785. this.form.executeUsers,
  786. );
  787. });
  788. console.log("this.form.executeUsers", this.form.detailList);
  789. },
  790. async getAllTeamList() {
  791. const {
  792. list
  793. } = await getTeamPage({
  794. pageNum: 1,
  795. size: -1,
  796. });
  797. console.log("teamAllList 班组", list);
  798. this.allTeamList = list;
  799. },
  800. // 提交
  801. async submit() {
  802. // 验证检查时间和报工时间必填
  803. if (!this.form.checkStartTime) {
  804. this.$refs.uToast.show({
  805. type: "error",
  806. icon: false,
  807. message: `请选择检查时间`,
  808. });
  809. return;
  810. }
  811. if (!this.form.checkFinishTime) {
  812. this.$refs.uToast.show({
  813. type: "error",
  814. icon: false,
  815. message: `请选择报工时间`,
  816. });
  817. return;
  818. }
  819. // if (this.pageName == 'steamInjectionInspectionRecord' && !this.form.contactName) {
  820. // this.$refs.uToast.show({
  821. // type: "error",
  822. // icon: false,
  823. // message: `请选择甲方检查人!`,
  824. // });
  825. // return;
  826. // }
  827. // if (this.pageName == 'solidWasteRecord' && !this.form.supplierName) {
  828. // this.$refs.uToast.show({
  829. // type: "error",
  830. // icon: false,
  831. // message: `请选择处理方!`,
  832. // });
  833. // return;
  834. // }
  835. // 验证报工时间必须大于等于检查时间
  836. const startTime = new Date(this.form.checkStartTime).getTime();
  837. const finishTime = new Date(this.form.checkFinishTime).getTime();
  838. if (finishTime < startTime) {
  839. this.$refs.uToast.show({
  840. type: "error",
  841. icon: false,
  842. message: `报工时间不能早于检查时间`,
  843. });
  844. return;
  845. }
  846. if (this.form.executeUsersIds.length == 0) {
  847. this.$refs.uToast.show({
  848. type: "error",
  849. icon: false,
  850. message: `请选择执行人`,
  851. });
  852. return;
  853. }
  854. if (![
  855. 'qualityTestRecords',
  856. 'productionRecords',
  857. 'QualityInspection',
  858. 'HaulSlag',
  859. 'TransportAsh'
  860. ].includes(this.pageName)) {
  861. // 验证检查项目
  862. const detailRequired = this.form.detailList.some((i) => {
  863. return i.checkResult == null || i.checkStatus == null;
  864. });
  865. if (detailRequired) {
  866. this.$refs.uToast.show({
  867. type: "error",
  868. icon: false,
  869. message: `请先完善、检查情况、检查结果`,
  870. });
  871. return;
  872. }
  873. }
  874. this.form.checkStartTime = dayjs(this.form.checkStartTime).format('YYYY-MM-DD HH:mm:ss')
  875. this.form.checkFinishTime = dayjs(this.form.checkFinishTime).format('YYYY-MM-DD HH:mm:ss')
  876. const body = JSON.parse(JSON.stringify(this.form));
  877. try {
  878. await producetaskrulerecordSaveOrUpdateAndSubmit(body);
  879. this.$emit("refresh");
  880. this.closePopup();
  881. } catch (error) {
  882. console.log(error, "dsdsd");
  883. }
  884. },
  885. },
  886. };
  887. </script>
  888. <style scoped lang="scss">
  889. .popup-content {
  890. width: 100vw;
  891. height: calc(100vh - 100px);
  892. background: #fff;
  893. border-radius: 0;
  894. display: flex;
  895. background-color: #eff2f7;
  896. flex-direction: column;
  897. }
  898. .popup-header {
  899. display: flex;
  900. justify-content: space-between;
  901. align-items: center;
  902. padding: 30rpx;
  903. border-bottom: 1rpx solid #e5e5e5;
  904. .popup-title {
  905. font-size: 36rpx;
  906. font-weight: bold;
  907. color: #333;
  908. }
  909. .close-btn {
  910. width: 60rpx;
  911. height: 60rpx;
  912. display: flex;
  913. align-items: center;
  914. justify-content: center;
  915. font-size: 60rpx;
  916. color: #999;
  917. line-height: 1;
  918. }
  919. }
  920. .popup-body {
  921. flex: 1;
  922. overflow-y: auto;
  923. padding: 28rpx;
  924. }
  925. .page {
  926. font-family:
  927. system-ui,
  928. -apple-system,
  929. "Segoe UI",
  930. Roboto,
  931. Helvetica,
  932. sans-serif;
  933. }
  934. .design-section {
  935. /* margin-bottom: 60rpx; */
  936. }
  937. .design-header {
  938. margin-bottom: 20rpx;
  939. padding-left: 8rpx;
  940. }
  941. .design-title {
  942. font-size: 44rpx;
  943. font-weight: 800;
  944. color: #1f2b3c;
  945. display: block;
  946. }
  947. .design-desc {
  948. font-size: 26rpx;
  949. color: #6b7280;
  950. margin-top: 6rpx;
  951. }
  952. /* 卡片白色风格 */
  953. .card-a {
  954. background: #ffffff;
  955. border-radius: 48rpx;
  956. box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.05);
  957. overflow: hidden;
  958. }
  959. .a-header {
  960. padding: 40rpx 32rpx 24rpx;
  961. border-bottom: 2rpx solid #f0f2f5;
  962. }
  963. .a-main-title {
  964. font-size: 36rpx;
  965. font-weight: 800;
  966. background: linear-gradient(135deg, #1f2b3c, #2c3e50);
  967. background-clip: text;
  968. -webkit-background-clip: text;
  969. color: transparent;
  970. letter-spacing: -0.5rpx;
  971. }
  972. .a-sub {
  973. font-size: 24rpx;
  974. color: #8e9aae;
  975. margin-top: 12rpx;
  976. display: flex;
  977. gap: 24rpx;
  978. }
  979. .info-grid {
  980. padding: 30rpx 32rpx;
  981. display: grid;
  982. grid-template-columns: 1fr 1fr;
  983. gap: 28rpx 20rpx;
  984. // background: #fcfdfe;
  985. border-bottom: 2rpx solid #f0f2f5;
  986. }
  987. .info-item {
  988. display: flex;
  989. flex-direction: column;
  990. gap: 8rpx;
  991. }
  992. .info-label {
  993. font-size: 26rpx;
  994. font-weight: 600;
  995. color: #6c7a91;
  996. text-transform: uppercase;
  997. }
  998. .records-area {
  999. padding: 16rpx 28rpx 32rpx;
  1000. }
  1001. .section-header {
  1002. display: flex;
  1003. justify-content: space-between;
  1004. align-items: center;
  1005. margin: 16rpx 0 20rpx 8rpx;
  1006. }
  1007. .section-title {
  1008. font-size: 36rpx;
  1009. font-weight: 700;
  1010. color: #1f2a44;
  1011. display: flex;
  1012. align-items: center;
  1013. gap: 16rpx;
  1014. }
  1015. .badge {
  1016. background: #eff3fa;
  1017. padding: 6rpx 20rpx;
  1018. border-radius: 60rpx;
  1019. font-size: 24rpx;
  1020. font-weight: normal;
  1021. color: #2c5f8a;
  1022. }
  1023. .device-card-a {
  1024. background: #f8fbfe;
  1025. border-radius: 36rpx;
  1026. padding: 20rpx 24rpx;
  1027. margin-bottom: 30rpx;
  1028. display: flex;
  1029. align-items: center;
  1030. justify-content: space-between;
  1031. flex-wrap: wrap;
  1032. border: 2rpx solid #e9edf2;
  1033. }
  1034. .device-label {
  1035. font-weight: 700;
  1036. font-size: 28rpx;
  1037. color: #1f2a44;
  1038. background: #eff3fa;
  1039. padding: 8rpx 24rpx;
  1040. border-radius: 60rpx;
  1041. }
  1042. .device-input-a {
  1043. flex: 1;
  1044. min-width: 280rpx;
  1045. background: #ffffff;
  1046. border: 2rpx solid #dce3ec;
  1047. border-radius: 36rpx;
  1048. padding: 16rpx 24rpx;
  1049. font-size: 28rpx;
  1050. }
  1051. .check-item-a {
  1052. background: #ffffff;
  1053. border-radius: 36rpx;
  1054. padding: 24rpx 24rpx;
  1055. margin-bottom: 24rpx;
  1056. box-shadow:
  1057. 0 4rpx 16rpx rgba(0, 0, 0, 0.02),
  1058. 0 0 0 2rpx #edf2f7;
  1059. }
  1060. .item-row1 {
  1061. display: flex;
  1062. justify-content: space-between;
  1063. align-items: baseline;
  1064. flex-wrap: wrap;
  1065. margin-bottom: 20rpx;
  1066. gap: 16rpx;
  1067. }
  1068. .item-name {
  1069. font-weight: 620;
  1070. font-size: 30rpx;
  1071. color: #1f2a44;
  1072. background: #f5f7fb;
  1073. padding: 6rpx 20rpx;
  1074. border-radius: 50rpx;
  1075. }
  1076. .item-info {
  1077. display: flex;
  1078. flex-direction: column;
  1079. gap: 8rpx;
  1080. }
  1081. .item-row-input {
  1082. display: flex;
  1083. align-items: center;
  1084. gap: 16rpx;
  1085. margin-bottom: 20rpx;
  1086. padding: 0 8rpx;
  1087. }
  1088. .input-label {
  1089. font-size: 28rpx;
  1090. color: #555;
  1091. font-weight: 500;
  1092. white-space: nowrap;
  1093. }
  1094. .item-input {
  1095. // background: #f8fafe;
  1096. border: 2rpx solid #e2e8f0;
  1097. border-radius: 36rpx;
  1098. padding: 12rpx 24rpx;
  1099. font-size: 30rpx;
  1100. min-height: 60rpx;
  1101. flex: 1;
  1102. font-family: monospace;
  1103. }
  1104. .item-actions {
  1105. display: flex;
  1106. justify-content: space-between;
  1107. align-items: center;
  1108. flex-wrap: wrap;
  1109. gap: 20rpx;
  1110. }
  1111. .check-status,
  1112. .result-group {
  1113. display: flex;
  1114. align-items: center;
  1115. gap: 24rpx;
  1116. background: #f8fafe;
  1117. padding: 8rpx 24rpx;
  1118. border-radius: 60rpx;
  1119. font-size: 28rpx;
  1120. }
  1121. /deep/.result-group {
  1122. .u-radio__text {
  1123. font-size: 28rpx !important;
  1124. }
  1125. .u-radio__icon-wrap {
  1126. width: 30rpx !important;
  1127. height: 30rpx !important;
  1128. }
  1129. }
  1130. .radio-label {
  1131. display: flex;
  1132. align-items: center;
  1133. gap: 8rpx;
  1134. }
  1135. .batch-bar {
  1136. display: flex;
  1137. gap: 16rpx;
  1138. margin: 16rpx 0 20rpx 8rpx;
  1139. }
  1140. .btn {
  1141. flex: 1;
  1142. text-align: center;
  1143. border-radius: 80rpx;
  1144. font-weight: 700;
  1145. font-size: 30rpx;
  1146. border: none;
  1147. }
  1148. .btn-primary {
  1149. background: #1e6f5c;
  1150. color: white;
  1151. box-shadow: 0 4rpx 12rpx rgba(30, 111, 92, 0.2);
  1152. }
  1153. .btn-secondary {
  1154. background: #2c7da0;
  1155. color: white;
  1156. }
  1157. .footnote {
  1158. font-size: 22rpx;
  1159. color: #8e9aab;
  1160. text-align: center;
  1161. margin-top: 16rpx;
  1162. display: block;
  1163. }
  1164. /* 修复组件样式 */
  1165. radio,
  1166. checkbox {
  1167. transform: scale(0.9);
  1168. margin-right: 6rpx;
  1169. }
  1170. button:after {
  1171. border: none;
  1172. }
  1173. .info-value {
  1174. font-size: 28rpx;
  1175. font-weight: 500;
  1176. color: #1e2a3a;
  1177. // background: #f2f5f9;
  1178. padding: 16rpx 20rpx;
  1179. border-radius: 24rpx;
  1180. border: 2rpx solid #e9edf2;
  1181. &.disabled {
  1182. color: #999;
  1183. background: #f5f5f5;
  1184. }
  1185. }
  1186. .popup-footer {
  1187. display: flex;
  1188. padding: 20rpx 30rpx;
  1189. border-top: 1rpx solid #e5e5e5;
  1190. gap: 20rpx;
  1191. /deep/ .u-button {
  1192. flex: 1;
  1193. }
  1194. }
  1195. /deep/.uni-select {
  1196. border-radius: 36rpx;
  1197. }
  1198. </style>