workOrderReport.vue 34 KB

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