workOrderReport.vue 34 KB

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