workOrderReport.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
  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" :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. this.form.contactName = data[0].name;
  367. this.form.contactId = data[0].id;
  368. this.form.supplierName = data[0].name;
  369. this.form.supplierId = data[0].id;
  370. if (['QualityInspection', 'HaulSlag', 'TransportAsh'].includes(
  371. this.pageName
  372. )) {
  373. this.form.purchaseOrderId = ''
  374. this.form.purchaseOrderNo = ''
  375. //来煤获取采购订单
  376. getPurchaseOrderList({
  377. pageNum: 1,
  378. size: 999,
  379. orderStatus: 2,
  380. partbId: data[0].id
  381. }).then((res) => {
  382. if (res.list?.length == 1) {
  383. this.form.purchaseOrderId = res.list[0].id;
  384. this.form.purchaseOrderNo = res.list[0].orderNo;
  385. }
  386. });
  387. }
  388. }
  389. });
  390. if (type == "edit") {
  391. this.title = "报工";
  392. } else {
  393. this.title = "详情";
  394. }
  395. this.getTreeList();
  396. await this.getOrderDetials(row.id);
  397. this.visible = true;
  398. },
  399. cancel() {
  400. this.form = {
  401. ...JSON.parse(JSON.stringify(formBaseData)),
  402. };
  403. this.visible = false;
  404. },
  405. async getTreeList() {
  406. const data = await listOrganizations({});
  407. let treeList = toTreeData({
  408. data: data || [],
  409. idField: "id",
  410. parentIdField: "parentId",
  411. });
  412. this.classificationList = treeList;
  413. },
  414. selectContactShow(type) {
  415. uni.navigateTo({
  416. url: "/pages/saleManage/components/selectContact?isAll=" +
  417. false +
  418. "&contactType=" +
  419. type + '&code=' + this.getCode(),
  420. });
  421. },
  422. confirmProductLine(e) {
  423. this.form.productLineId = e.value[0].value;
  424. this.form.productLineName = e.value[0].label;
  425. this.showProductLineIdPicker = false;
  426. },
  427. closePopup() {
  428. this.cancel();
  429. },
  430. openOrd() {
  431. if (!this.form.supplierId) {
  432. this.$refs.uToast.show({
  433. type: "error",
  434. icon: false,
  435. message: `请先选择供应商!`,
  436. });
  437. return;
  438. }
  439. this.$refs.orderListDialogRef.open(
  440. this.form.supplierId,
  441. //渣和灰拿委外订单
  442. ['TransportAsh', 'HaulSlag'].includes(this.pageName) ?
  443. '3,4,5,6,7' :
  444. ''
  445. );
  446. },
  447. orderListDialogSuccess(data) {
  448. this.form.purchaseOrderId = data.id;
  449. this.form.purchaseOrderNo = data.orderNo;
  450. },
  451. getCode() {
  452. let userInfo = uni.getStorageSync("userInfo")
  453. if (userInfo.clientEnvironmentId == 10) {
  454. return this.pageName == 'QualityInspection' ?
  455. '06mei' :
  456. this.pageName == 'TransportAsh' ?
  457. '07lafei' :
  458. this.pageName == 'HaulSlag' ?
  459. '08lazha' :
  460. '';
  461. } else {
  462. return '';
  463. }
  464. },
  465. // 获取工单详情
  466. async getOrderDetials(id) {
  467. try {
  468. const data = await getById(id);
  469. let userInfo = uni.getStorageSync("userInfo")
  470. if (data.type == 1) {
  471. //班组报工默认单前登录人
  472. data.executeUsers = [{
  473. groupId: userInfo.groupId,
  474. groupName: userInfo.groupName,
  475. teamId: null,
  476. teamName: '',
  477. userId: userInfo.userId,
  478. userName: userInfo.name
  479. }];
  480. }
  481. data.detailList = data.detailList.map((i) => {
  482. i.toolNames = i.tools.map((j) => j.toolName).join(",");
  483. if (i.checkUsers && i.checkUsers.length > 0) {
  484. console.log("i.checkUsers", i.checkUsers);
  485. i.checkUsersIds = i.checkUsers.map((j) => j.userId);
  486. }
  487. if (
  488. (!i.checkUsersIds || i.checkUsersIds.length == 0) &&
  489. data.executeUsers.length > 0
  490. ) {
  491. // 默认执行人作为检查人
  492. i.checkUsersIds = data.executeUsers
  493. .filter((i) => i.userId)
  494. .map((j) => j.userId);
  495. i.checkUsers = data.executeUsers
  496. .filter((i) => i.userId)
  497. .map((j) => {
  498. return {
  499. teamId: j.teamId,
  500. teamName: j.teamName,
  501. userId: j.userId,
  502. userName: j.userName,
  503. };
  504. });
  505. }
  506. return i;
  507. });
  508. // this.$util.assignObject(this.form, data);
  509. Object.assign(this.form, data);
  510. this.form.vehiclePhotoUrl = this.form.vehiclePhotoUrl || [];
  511. this.form.unloadCheckStatus = this.form.unloadCheckStatus || 1;
  512. this.form.checkStartTime =
  513. this.form.checkStartTime ||
  514. dayjs(new Date()).format('YYYY-M-D HH:mm:ss');
  515. this.form.checkFinishTime =
  516. this.form.checkFinishTime ||
  517. dayjs(new Date()).format('YYYY-M-D HH:mm:ss');
  518. console.log(
  519. this.form.checkStartTime,
  520. 'this.form.checkStartTime'
  521. );
  522. this.form.executeUsersIds = this.form.executeUsers
  523. .map((i) => i.userId)
  524. .filter((i) => i); // 过滤掉 undefined
  525. if (this.form.executeUsers.length > 0 && !this.form.type) {
  526. this.form.groupId = this.form.executeUsers[0]?.groupId + "";
  527. this.form.groupName = this.form.executeUsers[0]?.groupName;
  528. if (this.form.groupId) {
  529. this.searchDeptNodeClick(
  530. this.form.groupId,
  531. this.form.groupName,
  532. "init",
  533. );
  534. }
  535. }
  536. if (!this.form.teamId && this.teamList.length > 0) {
  537. this.form.teamId = this.teamList[0].id;
  538. }
  539. this.form.recordRulesClassify += "";
  540. // 加载班组人员列表
  541. if (this.form.teamId && this.form.type) {
  542. await this.getAllTeamList();
  543. const index = this.allTeamList.findIndex(
  544. (item) => item.id == this.form.teamId,
  545. );
  546. this.executorList = this.allTeamList[index].userVOList;
  547. this.productLineList = [];
  548. this.allTeamList[index].factoryWorkstationVOList.forEach((item) => {
  549. if (
  550. !this.productLineList.find((p) => p.id === item.productionLineId)
  551. ) {
  552. this.productLineList.push({
  553. name: item.productionLineName,
  554. id: item.productionLineId,
  555. });
  556. }
  557. });
  558. }
  559. console.log(userInfo, 'this.clientEnvironmentId')
  560. //宇信
  561. if (
  562. userInfo.clientEnvironmentId == 10 && ['productionRecords', 'qualityTestRecords'].includes(this
  563. .pageName)
  564. ) {
  565. //客户:5#和6#默认是重油公司7#默认是红山 2008389016775864321==7#
  566. if (this.form.productLineId == '2008389016775864321') {
  567. this.form.contactId =
  568. this.form.contactId || '2008562263580520449';
  569. this.form.contactName =
  570. this.form.contactName || '克拉玛依红山油田有限责任公司';
  571. } else {
  572. this.form.contactId =
  573. this.form.contactId || '2008383566202318850';
  574. this.form.contactName =
  575. this.form.contactName || '中国石油新疆油田分公司(重油公司)';
  576. }
  577. }
  578. this.setValue();
  579. this.$nextTick(() => {
  580. this.loading = false;
  581. });
  582. } catch (error) {
  583. console.log("error", error);
  584. this.loading = false;
  585. }
  586. },
  587. checkTeamList(id) {
  588. const index = this.teamList.findIndex((item) => item.id == id);
  589. this.teamUserList = this.teamAllList[index];
  590. this.form.teamName = this.teamList[index].name;
  591. console.log("this.teamUserList", this.teamUserList);
  592. },
  593. chooseImage() {
  594. const _this = this
  595. uni.chooseImage({
  596. count: 9, //默认9
  597. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  598. sourceType: ['camera', 'album'], //从相册选择
  599. success: function(res) {
  600. uni.showLoading({
  601. title: '加载中'
  602. })
  603. _this.uploadFile(res.tempFilePaths).then(res => {
  604. res.forEach(item => {
  605. // let fileNames = item.storePath.split('/')
  606. // let url =
  607. // '/main/file/getFile?objectName=' + item.storePath +
  608. // '&fullfilename=' + fileNames[fileNames.length -
  609. // 1]
  610. _this.form.vehiclePhotoUrl.push(item.storePath)
  611. })
  612. uni.hideLoading()
  613. })
  614. }
  615. });
  616. },
  617. getUrl(arr) {
  618. // console.log(arr, 'arr')
  619. if (arr.length) {
  620. return arr.map(item => {
  621. let fileNames = item.split('/')
  622. return this.apiUrl + '/main/file/getFile?objectName=' + item + '&fullfilename=' +
  623. fileNames[fileNames.length - 1]
  624. })
  625. } else {
  626. return []
  627. }
  628. },
  629. uploadFile(list) {
  630. let PromiseAll = []
  631. const apiUrl = this.apiUrl
  632. const token = uni.getStorageSync("token"); //取存本地的token
  633. list.forEach(item => {
  634. PromiseAll.push(
  635. new Promise((resolve, reject) => {
  636. uni.uploadFile({
  637. url: apiUrl + '/main/file/upload',
  638. filePath: item,
  639. name: 'multiPartFile',
  640. header: {
  641. authorization: token
  642. },
  643. success: (uploadFileRes) => {
  644. let data = JSON.parse(uploadFileRes.data)
  645. resolve(data.data)
  646. }
  647. });
  648. }),
  649. )
  650. })
  651. return Promise.all(PromiseAll)
  652. },
  653. setValue() {
  654. if (this.title == '报工') {
  655. this.form.detailList.forEach((item, index) => {
  656. if (this.pageName == 'qualityTestRecords') {
  657. let num1 = this.form.detailList.find(
  658. (item1) => item1.paramValue == '给水量'
  659. )?.num;
  660. let num2 = this.form.detailList.find(
  661. (item1) => item1.paramValue == '炉水量'
  662. )?.num;
  663. let num = 0;
  664. if (num1 && num2) {
  665. num = (num2 - num1) / num2;
  666. }
  667. if (item.paramValue == '干度') {
  668. this.$set(
  669. this.form.detailList[index],
  670. 'num',
  671. parseFloat(num.toFixed(5)) * 100
  672. );
  673. }
  674. if (item.paramValue == '是否合格' && num1) {
  675. this.$set(
  676. this.form.detailList[index],
  677. 'num',
  678. parseFloat(num.toFixed(5)) * 100 >= 90 ? '合格' : '不合格'
  679. );
  680. }
  681. }
  682. if (this.pageName == 'productionRecords') {
  683. let num1 = this.form.detailList.find(
  684. (item1) => item1.paramValue == '日用水量'
  685. )?.num;
  686. let num = 0;
  687. if (num1) {
  688. num = num1 * 0.1034;
  689. }
  690. if (item.paramValue == '日用煤量') {
  691. this.$set(
  692. this.form.detailList[index],
  693. 'num',
  694. parseFloat(num.toFixed(5))
  695. );
  696. }
  697. }
  698. });
  699. }
  700. },
  701. handleDeleteImage(index) {
  702. this.form.vehiclePhotoUrl.splice(index, 1);
  703. },
  704. // 批量检查
  705. batchCheck() {
  706. this.form.detailList.forEach((i, index) => {
  707. this.$set(this.form.detailList[index], "checkStatus", 1);
  708. });
  709. },
  710. // 批量合格
  711. batchQualified() {
  712. this.form.detailList.forEach((i, index) => {
  713. this.$set(this.form.detailList[index], "checkResult", 1);
  714. });
  715. },
  716. itemExecuteUsers(index, row) {
  717. this.currentIndex = index;
  718. this.$refs.selector1.open();
  719. },
  720. executeIdListChange1() {
  721. this.$set(
  722. this.form.detailList[this.currentIndex],
  723. "checkUsersIds",
  724. this.checkUsersIds,
  725. );
  726. const checkUsersIds = this.checkUsersIds;
  727. this.checkUsersIds = [];
  728. const checkUsers = checkUsersIds.map((i) => {
  729. const user = this.form.executeUsers.find((item) => item.userId === i);
  730. return user;
  731. });
  732. console.log(checkUsers, "checkUsers");
  733. this.$set(
  734. this.form.detailList[this.currentIndex],
  735. "checkUsers",
  736. checkUsers,
  737. );
  738. },
  739. // 获取审核人列表、巡点检人员
  740. async getUserList(params) {
  741. try {
  742. let data = {
  743. pageNum: 1,
  744. size: -1,
  745. };
  746. // 如果传了参数就是获取部门人员数据
  747. if (params) {
  748. data = Object.assign(data, params);
  749. }
  750. const res = await getUserPage(data);
  751. if (params) {
  752. this.executorList = res.list;
  753. }
  754. } catch (error) {}
  755. },
  756. //选择部门(搜索)
  757. async searchDeptNodeClick(id, name, type) {
  758. this.form.groupId = id;
  759. this.form.groupName = name;
  760. if (id) {
  761. // 根据部门获取人员
  762. const params = {
  763. groupId: id,
  764. };
  765. await this.getUserList(params);
  766. } else {
  767. this.form.groupId = null;
  768. }
  769. if (type != "init") {
  770. this.form.detailList.forEach((detail) => {
  771. detail.checkUsersIds = [];
  772. detail.checkUsers = [];
  773. });
  774. this.form.executeUsers = [];
  775. this.form.executeUsersIds = [];
  776. }
  777. },
  778. // 负责人变更 同步执行人列表
  779. executeIdListChange() {
  780. console.log(this.form.executeUsersIds, "this.form.executeUsersIds");
  781. this.form.executeUsers = this.form.executeUsersIds
  782. .map((userId) => {
  783. const user = this.executorList.find((u) => u.id === userId);
  784. if (!user) return null;
  785. return {
  786. userId: user.id,
  787. userName: user.name,
  788. groupId: user.groupId,
  789. groupName: user.groupName,
  790. };
  791. })
  792. .filter((i) => i);
  793. // 同步详情执行人
  794. this.form.detailList.forEach((detail, index) => {
  795. this.$set(
  796. this.form.detailList[index],
  797. "checkUsersIds",
  798. this.form.executeUsersIds,
  799. );
  800. this.$set(
  801. this.form.detailList[index],
  802. "checkUsers",
  803. this.form.executeUsers,
  804. );
  805. });
  806. console.log("this.form.executeUsers", this.form.detailList);
  807. },
  808. async getAllTeamList() {
  809. const {
  810. list
  811. } = await getTeamPage({
  812. pageNum: 1,
  813. size: -1,
  814. });
  815. console.log("teamAllList 班组", list);
  816. this.allTeamList = list;
  817. },
  818. // 提交
  819. async submit() {
  820. // 验证检查时间和报工时间必填
  821. if (!this.form.checkStartTime) {
  822. this.$refs.uToast.show({
  823. type: "error",
  824. icon: false,
  825. message: `请选择检查时间`,
  826. });
  827. return;
  828. }
  829. if (!this.form.checkFinishTime) {
  830. this.$refs.uToast.show({
  831. type: "error",
  832. icon: false,
  833. message: `请选择报工时间`,
  834. });
  835. return;
  836. }
  837. if (['QualityInspection', 'TransportAsh', 'HaulSlag'].includes(this.pageName) && !this.form
  838. .supplierName) {
  839. this.$refs.uToast.show({
  840. type: "error",
  841. icon: false,
  842. message: `请选择供应商!`,
  843. });
  844. return;
  845. }
  846. if (['QualityInspection', 'TransportAsh', 'HaulSlag'].includes(this.pageName) && !this.form
  847. .purchaseOrderNo) {
  848. this.$refs.uToast.show({
  849. type: "error",
  850. icon: false,
  851. message: `请选择采购订单!`,
  852. });
  853. return;
  854. }
  855. if (['QualityInspection', 'TransportAsh', 'HaulSlag'].includes(this.pageName) && !this.form
  856. .vehiclePhotoUrl.length) {
  857. this.$refs.uToast.show({
  858. type: "error",
  859. icon: false,
  860. message: `请选择照片!`,
  861. });
  862. return;
  863. }
  864. // 验证报工时间必须大于等于检查时间
  865. const startTime = new Date(this.form.checkStartTime).getTime();
  866. const finishTime = new Date(this.form.checkFinishTime).getTime();
  867. if (finishTime < startTime) {
  868. this.$refs.uToast.show({
  869. type: "error",
  870. icon: false,
  871. message: `报工时间不能早于检查时间`,
  872. });
  873. return;
  874. }
  875. if (this.form.executeUsersIds.length == 0) {
  876. this.$refs.uToast.show({
  877. type: "error",
  878. icon: false,
  879. message: `请选择执行人`,
  880. });
  881. return;
  882. }
  883. if (![
  884. 'qualityTestRecords',
  885. 'productionRecords',
  886. 'QualityInspection',
  887. 'HaulSlag',
  888. 'TransportAsh'
  889. ].includes(this.pageName)) {
  890. // 验证检查项目
  891. const detailRequired = this.form.detailList.some((i) => {
  892. return i.checkResult == null || i.checkStatus == null;
  893. });
  894. if (detailRequired) {
  895. this.$refs.uToast.show({
  896. type: "error",
  897. icon: false,
  898. message: `请先完善、检查情况、检查结果`,
  899. });
  900. return;
  901. }
  902. }
  903. this.form.checkStartTime = dayjs(this.form.checkStartTime).format('YYYY-MM-DD HH:mm:ss')
  904. this.form.checkFinishTime = dayjs(this.form.checkFinishTime).format('YYYY-MM-DD HH:mm:ss')
  905. const body = JSON.parse(JSON.stringify(this.form));
  906. try {
  907. await producetaskrulerecordSaveOrUpdateAndSubmit(body);
  908. this.$emit("refresh");
  909. this.closePopup();
  910. } catch (error) {
  911. console.log(error, "dsdsd");
  912. }
  913. },
  914. },
  915. };
  916. </script>
  917. <style scoped lang="scss">
  918. .popup-content {
  919. width: 100vw;
  920. height: calc(100vh - 100px);
  921. background: #fff;
  922. border-radius: 0;
  923. display: flex;
  924. background-color: #eff2f7;
  925. flex-direction: column;
  926. }
  927. .popup-header {
  928. display: flex;
  929. justify-content: space-between;
  930. align-items: center;
  931. padding: 30rpx;
  932. border-bottom: 1rpx solid #e5e5e5;
  933. .popup-title {
  934. font-size: 36rpx;
  935. font-weight: bold;
  936. color: #333;
  937. }
  938. .close-btn {
  939. width: 60rpx;
  940. height: 60rpx;
  941. display: flex;
  942. align-items: center;
  943. justify-content: center;
  944. font-size: 60rpx;
  945. color: #999;
  946. line-height: 1;
  947. }
  948. }
  949. .popup-body {
  950. flex: 1;
  951. overflow-y: auto;
  952. padding: 28rpx;
  953. }
  954. .page {
  955. font-family:
  956. system-ui,
  957. -apple-system,
  958. "Segoe UI",
  959. Roboto,
  960. Helvetica,
  961. sans-serif;
  962. }
  963. .design-section {
  964. /* margin-bottom: 60rpx; */
  965. }
  966. .design-header {
  967. margin-bottom: 20rpx;
  968. padding-left: 8rpx;
  969. }
  970. .design-title {
  971. font-size: 44rpx;
  972. font-weight: 800;
  973. color: #1f2b3c;
  974. display: block;
  975. }
  976. .design-desc {
  977. font-size: 26rpx;
  978. color: #6b7280;
  979. margin-top: 6rpx;
  980. }
  981. /* 卡片白色风格 */
  982. .card-a {
  983. background: #ffffff;
  984. border-radius: 48rpx;
  985. box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.05);
  986. overflow: hidden;
  987. }
  988. .a-header {
  989. padding: 40rpx 32rpx 24rpx;
  990. border-bottom: 2rpx solid #f0f2f5;
  991. }
  992. .a-main-title {
  993. font-size: 36rpx;
  994. font-weight: 800;
  995. background: linear-gradient(135deg, #1f2b3c, #2c3e50);
  996. background-clip: text;
  997. -webkit-background-clip: text;
  998. color: transparent;
  999. letter-spacing: -0.5rpx;
  1000. }
  1001. .a-sub {
  1002. font-size: 24rpx;
  1003. color: #8e9aae;
  1004. margin-top: 12rpx;
  1005. display: flex;
  1006. gap: 24rpx;
  1007. }
  1008. .info-grid {
  1009. padding: 30rpx 32rpx;
  1010. display: grid;
  1011. grid-template-columns: 1fr 1fr;
  1012. gap: 28rpx 20rpx;
  1013. // background: #fcfdfe;
  1014. border-bottom: 2rpx solid #f0f2f5;
  1015. }
  1016. .info-item {
  1017. display: flex;
  1018. flex-direction: column;
  1019. gap: 8rpx;
  1020. }
  1021. .info-label {
  1022. font-size: 26rpx;
  1023. font-weight: 600;
  1024. color: #6c7a91;
  1025. text-transform: uppercase;
  1026. }
  1027. .records-area {
  1028. padding: 16rpx 28rpx 32rpx;
  1029. }
  1030. .section-header {
  1031. display: flex;
  1032. justify-content: space-between;
  1033. align-items: center;
  1034. margin: 16rpx 0 20rpx 8rpx;
  1035. }
  1036. .section-title {
  1037. font-size: 36rpx;
  1038. font-weight: 700;
  1039. color: #1f2a44;
  1040. display: flex;
  1041. align-items: center;
  1042. gap: 16rpx;
  1043. }
  1044. .badge {
  1045. background: #eff3fa;
  1046. padding: 6rpx 20rpx;
  1047. border-radius: 60rpx;
  1048. font-size: 24rpx;
  1049. font-weight: normal;
  1050. color: #2c5f8a;
  1051. }
  1052. .device-card-a {
  1053. background: #f8fbfe;
  1054. border-radius: 36rpx;
  1055. padding: 20rpx 24rpx;
  1056. margin-bottom: 30rpx;
  1057. display: flex;
  1058. align-items: center;
  1059. justify-content: space-between;
  1060. flex-wrap: wrap;
  1061. border: 2rpx solid #e9edf2;
  1062. }
  1063. .device-label {
  1064. font-weight: 700;
  1065. font-size: 28rpx;
  1066. color: #1f2a44;
  1067. background: #eff3fa;
  1068. padding: 8rpx 24rpx;
  1069. border-radius: 60rpx;
  1070. }
  1071. .device-input-a {
  1072. flex: 1;
  1073. min-width: 280rpx;
  1074. background: #ffffff;
  1075. border: 2rpx solid #dce3ec;
  1076. border-radius: 36rpx;
  1077. padding: 16rpx 24rpx;
  1078. font-size: 28rpx;
  1079. }
  1080. .check-item-a {
  1081. background: #ffffff;
  1082. border-radius: 36rpx;
  1083. padding: 24rpx 24rpx;
  1084. margin-bottom: 24rpx;
  1085. box-shadow:
  1086. 0 4rpx 16rpx rgba(0, 0, 0, 0.02),
  1087. 0 0 0 2rpx #edf2f7;
  1088. }
  1089. .item-row1 {
  1090. display: flex;
  1091. justify-content: space-between;
  1092. align-items: baseline;
  1093. flex-wrap: wrap;
  1094. margin-bottom: 20rpx;
  1095. gap: 16rpx;
  1096. }
  1097. .item-name {
  1098. font-weight: 620;
  1099. font-size: 30rpx;
  1100. color: #1f2a44;
  1101. background: #f5f7fb;
  1102. padding: 6rpx 20rpx;
  1103. border-radius: 50rpx;
  1104. }
  1105. .item-info {
  1106. display: flex;
  1107. flex-direction: column;
  1108. gap: 8rpx;
  1109. }
  1110. .item-row-input {
  1111. display: flex;
  1112. align-items: center;
  1113. gap: 16rpx;
  1114. margin-bottom: 20rpx;
  1115. padding: 0 8rpx;
  1116. }
  1117. .input-label {
  1118. font-size: 28rpx;
  1119. color: #555;
  1120. font-weight: 500;
  1121. white-space: nowrap;
  1122. }
  1123. .item-input {
  1124. // background: #f8fafe;
  1125. border: 2rpx solid #e2e8f0;
  1126. border-radius: 36rpx;
  1127. padding: 12rpx 24rpx;
  1128. font-size: 30rpx;
  1129. min-height: 60rpx;
  1130. flex: 1;
  1131. font-family: monospace;
  1132. }
  1133. .item-actions {
  1134. display: flex;
  1135. justify-content: space-between;
  1136. align-items: center;
  1137. flex-wrap: wrap;
  1138. gap: 20rpx;
  1139. }
  1140. .check-status,
  1141. .result-group {
  1142. display: flex;
  1143. align-items: center;
  1144. gap: 24rpx;
  1145. background: #f8fafe;
  1146. padding: 8rpx 24rpx;
  1147. border-radius: 60rpx;
  1148. font-size: 28rpx;
  1149. }
  1150. /deep/.result-group {
  1151. .u-radio__text {
  1152. font-size: 28rpx !important;
  1153. }
  1154. .u-radio__icon-wrap {
  1155. width: 30rpx !important;
  1156. height: 30rpx !important;
  1157. }
  1158. }
  1159. .radio-label {
  1160. display: flex;
  1161. align-items: center;
  1162. gap: 8rpx;
  1163. }
  1164. .batch-bar {
  1165. display: flex;
  1166. gap: 16rpx;
  1167. margin: 16rpx 0 20rpx 8rpx;
  1168. }
  1169. .btn {
  1170. flex: 1;
  1171. text-align: center;
  1172. border-radius: 80rpx;
  1173. font-weight: 700;
  1174. font-size: 30rpx;
  1175. border: none;
  1176. }
  1177. .btn-primary {
  1178. background: #1e6f5c;
  1179. color: white;
  1180. box-shadow: 0 4rpx 12rpx rgba(30, 111, 92, 0.2);
  1181. }
  1182. .btn-secondary {
  1183. background: #2c7da0;
  1184. color: white;
  1185. }
  1186. .footnote {
  1187. font-size: 22rpx;
  1188. color: #8e9aab;
  1189. text-align: center;
  1190. margin-top: 16rpx;
  1191. display: block;
  1192. }
  1193. /* 修复组件样式 */
  1194. radio,
  1195. checkbox {
  1196. transform: scale(0.9);
  1197. margin-right: 6rpx;
  1198. }
  1199. button:after {
  1200. border: none;
  1201. }
  1202. .info-value {
  1203. font-size: 28rpx;
  1204. font-weight: 500;
  1205. color: #1e2a3a;
  1206. // background: #f2f5f9;
  1207. padding: 16rpx 20rpx;
  1208. border-radius: 24rpx;
  1209. border: 2rpx solid #e9edf2;
  1210. &.disabled {
  1211. color: #999;
  1212. background: #f5f5f5;
  1213. }
  1214. }
  1215. .popup-footer {
  1216. display: flex;
  1217. padding: 20rpx 30rpx;
  1218. border-top: 1rpx solid #e5e5e5;
  1219. gap: 20rpx;
  1220. /deep/ .u-button {
  1221. flex: 1;
  1222. }
  1223. }
  1224. /deep/.uni-select {
  1225. border-radius: 36rpx;
  1226. }
  1227. </style>