workOrderReport.vue 33 KB

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