printOriginalRecords.vue 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574
  1. <template>
  2. <BasicModal
  3. v-bind="$attrs"
  4. @register="registerModal"
  5. destroyOnClose
  6. title="推钢室生产原始记录"
  7. :width="1400"
  8. :height="930"
  9. ok-text="打印"
  10. @ok="onPrint"
  11. >
  12. <section
  13. ref="print"
  14. style="padding: 10px 10px 0; position: relative; border: 1px solid #c5c5c5; background: #fff; width: 100%; height: 100%"
  15. id="printBilletSampleCard"
  16. :key="printKey"
  17. >
  18. <div class="ticket next-ticket">
  19. <div style="text-align: center">
  20. <p style="font-size: 24px; font-weight: 800; display: inline-block; margin-bottom: 16px; line-height: 30px">
  21. <span class="ccmno">{{ hostNumber }}</span> #机推钢室生产原始记录
  22. </p>
  23. </div>
  24. <div class="flex ccmno-info" style="line-height: 24px">
  25. <div class="flex-1"> 班组:<component :is="renderDictTag(shiftInfo.shiftGroup, 'lg_bz')" /> </div>
  26. <div class="flex-1"> 班次:<component :is="renderDictTag(shiftInfo.shift, 'lg_bb')" /> </div>
  27. <div class="flex-1 flex"><span> 定尺:</span><a-input v-model:value="mainSize" style="flex: 1" :bordered="false" size="small" /> </div>
  28. <div class="flex-1" style="text-align: center; font-size: 13px">
  29. {{ dayjs(curTime).format('YYYY 年 MM 月 DD 日') }}
  30. </div>
  31. <div class="flex-1" style="text-align: right; font-size: 12px"> lg/R05 </div>
  32. </div>
  33. <a-table :columns="columns" size="small" :data-source="dataSource" bordered :pagination="false">
  34. <template #summary>
  35. <a-table-summary-row>
  36. <a-table-summary-cell :col-span="remakeColSpan" style="text-align: center">备注</a-table-summary-cell>
  37. <a-table-summary-cell :col-span="sizeColSpan" style="text-align: center"> 定尺 </a-table-summary-cell>
  38. <a-table-summary-cell :col-span="flowColSpan" style="text-align: center"> 支数(支) </a-table-summary-cell>
  39. <a-table-summary-cell :col-span="weightColSpan" style="text-align: center"> 产量(吨) </a-table-summary-cell>
  40. </a-table-summary-row>
  41. <a-table-summary-row class="summary-row-no-border">
  42. <a-table-summary-cell :row-span="2" :col-span="remakeColSpan">
  43. <div class="summary-cell-remark">
  44. <a-textarea v-model:value="mainRemark" style="min-height: 160px" :bordered="false" />
  45. </div>
  46. </a-table-summary-cell>
  47. <a-table-summary-cell :row-span="1" :col-span="1"> 热送 </a-table-summary-cell>
  48. <a-table-summary-cell :row-span="1" :col-span="sizeColSpan - 1">
  49. <div class="song-items flex" v-for="(item, index) in hotSendList" :key="index">
  50. <div class="title">{{ index }}</div>
  51. <div class="flex flex-col">
  52. <div class="song-item" v-for="ele in item">{{ ele.size }}</div>
  53. </div>
  54. </div>
  55. </a-table-summary-cell>
  56. <a-table-summary-cell :col-span="flowColSpan">
  57. <div class="song-items flex" v-for="(item, index) in hotSendList" :key="index">
  58. <div class="flex flex-col">
  59. <div class="song-item" v-for="ele in item">{{ ele.amount }}</div>
  60. </div>
  61. </div>
  62. </a-table-summary-cell>
  63. <a-table-summary-cell :col-span="weightColSpan">
  64. <div class="song-items flex" v-for="(item, index) in hotSendList" :key="index">
  65. <div class="flex flex-col">
  66. <div class="song-item" v-for="ele in item">{{ ele.weight ? ele.weight.toFixed(3) : '' }} t</div>
  67. </div>
  68. </div>
  69. </a-table-summary-cell>
  70. </a-table-summary-row>
  71. <a-table-summary-row>
  72. <!-- <a-table-summary-cell :col-span="remakeColSpan">
  73. <div class="summary-cell-remark"></div>
  74. </a-table-summary-cell> -->
  75. <a-table-summary-cell :row-span="1" :col-span="1"> 堆垛 </a-table-summary-cell>
  76. <a-table-summary-cell :row-span="1" :col-span="sizeColSpan - 1">
  77. <div class="song-items flex">
  78. <div class="flex flex-col">
  79. <div class="song-item" v-for="ele in stackingList">{{ ele.size }}</div>
  80. </div>
  81. </div>
  82. </a-table-summary-cell>
  83. <a-table-summary-cell :col-span="flowColSpan">
  84. <div class="song-items flex">
  85. <div class="flex flex-col">
  86. <div class="song-item" v-for="ele in stackingList">{{ ele.amount }}</div>
  87. </div>
  88. </div>
  89. </a-table-summary-cell>
  90. <a-table-summary-cell :col-span="weightColSpan">
  91. <div class="song-items flex">
  92. <div class="flex flex-col">
  93. <div class="song-item" v-for="ele in stackingList">{{ ele.weight ? ele.weight.toFixed(3) : '' }} t</div>
  94. </div>
  95. </div>
  96. </a-table-summary-cell>
  97. </a-table-summary-row>
  98. </template>
  99. </a-table>
  100. </div>
  101. </section>
  102. <template #appendFooter>
  103. <a-button @click="openJSModal = true"> 重量计算 </a-button>
  104. </template>
  105. </BasicModal>
  106. <a-modal
  107. v-model:open="openJSModal"
  108. title="重量计算"
  109. centered
  110. width="600px"
  111. :zIndex="9999"
  112. @ok="
  113. () => {
  114. openJSModal = false;
  115. }
  116. "
  117. @cancel="
  118. () => {
  119. openJSModal = false;
  120. }
  121. "
  122. >
  123. <div class="flex justify-center items-center" style="margin: 20px; line-height: 40px">
  124. <a-input-group size="large">
  125. <a-row :gutter="8">
  126. <a-col :span="5">
  127. <a-input type="number" :min="1" v-model:value="weightNum" placeholder="支数" />
  128. </a-col>
  129. <a-col :span="1" style="line-height: 40px; text-align: center">*</a-col>
  130. <a-col :span="5">
  131. <a-input type="number" v-model:value="sizeNum" placeholder="定尺" />
  132. </a-col>
  133. <a-col :span="1" style="line-height: 40px; text-align: center">*</a-col>
  134. <a-col :span="5">
  135. <a-input type="number" v-model:value="xiShu" placeholder="请输入比例" />
  136. </a-col>
  137. <a-col :span="1" style="line-height: 40px; text-align: center">=</a-col>
  138. <a-col :span="6" style="line-height: 40px; text-align: center">{{ weightCalc }}</a-col>
  139. </a-row>
  140. </a-input-group>
  141. </div>
  142. </a-modal>
  143. <!-- 设置定尺数量的modal -->
  144. <a-modal v-model:open="openSetSizeNumModal" title="设置定尺数量" centered width="500px" :zIndex="1100" @ok="confirmSetSizeNum">
  145. <div style="padding: 60px 30px 30px; font-size: 16px" v-if="editSizeNumRecord && editSizeNumRecord.hotChargeLengthArr">
  146. <div style="margin-bottom: 30px" v-for="(item, index) in editSizeNumRecord.hotChargeLengthArr" :key="index">
  147. <a-input-number
  148. size="large"
  149. v-model:value="item.totalCount"
  150. :addon-before="headText[item.hotChargeDestination] + ' ' + Number(item.hotChargeLength) / 1000 + 'm'"
  151. :min="0"
  152. :step="4"
  153. @change="
  154. (value) => {
  155. if (!value) {
  156. item.totalCount = 0;
  157. }
  158. if (value % 4 !== 0) {
  159. item.totalCount = value - (value % 4);
  160. }
  161. }
  162. "
  163. :controls="false"
  164. ></a-input-number>
  165. </div>
  166. <div style="font-size: 16px; color: #f50">注:请输入4或4的倍数.</div>
  167. </div>
  168. </a-modal>
  169. </template>
  170. <script lang="ts" setup>
  171. import { ref, computed, h } from 'vue';
  172. import { BasicModal, useModalInner } from '/@/components/Modal';
  173. import dayjs from 'dayjs';
  174. import { printJS } from '/@/hooks/web/usePrintJS';
  175. import type { TableColumnsType } from 'ant-design-vue';
  176. import { queryBilletRecordByCcmNo, editBilletRecord } from '../operator.api';
  177. import { render } from '/@/utils/common/renderUtils';
  178. import { isArray, isNumber } from '/@/utils/is';
  179. import Icon from '/@/components/Icon';
  180. import { Input, Select } from 'ant-design-vue';
  181. import { throttle } from 'lodash-es';
  182. import { useMessage } from '/@/hooks/web/useMessage';
  183. import { initDictOptions } from '/@/utils/dict';
  184. const { createMessage } = useMessage();
  185. const printKey = ref(dayjs().unix());
  186. // 渲染字典标签
  187. const renderDictTag = (value: string, dictCode: string) => {
  188. return render.renderDict(value, dictCode);
  189. };
  190. // 主机号
  191. const hostNumber = ref('5');
  192. const defaultColumns: TableColumnsType = [
  193. {
  194. title: '序号',
  195. width: 40,
  196. dataIndex: 'SerialNumber',
  197. align: 'center',
  198. key: 'SerialNumber',
  199. },
  200. {
  201. title: '炉号',
  202. dataIndex: 'heatNo',
  203. width: 80,
  204. align: 'center',
  205. key: 'heatNo',
  206. },
  207. {
  208. title: '钢种',
  209. width: 80,
  210. align: 'center',
  211. dataIndex: 'brandNum',
  212. key: 'brandNum',
  213. customRender: ({ text }) => {
  214. return render.renderDict(text, 'billet_spec');
  215. },
  216. },
  217. {
  218. title: '支数(根)',
  219. align: 'center',
  220. width: 570,
  221. children: [
  222. {
  223. title: 'I',
  224. dataIndex: 'oneFlow',
  225. key: 'oneFlow',
  226. align: 'center',
  227. width: 40,
  228. },
  229. {
  230. title: 'II',
  231. dataIndex: 'twoFlow',
  232. key: 'twoFlow',
  233. align: 'center',
  234. width: 40,
  235. },
  236. {
  237. title: 'III',
  238. dataIndex: 'threeFlow',
  239. key: 'threeFlow',
  240. align: 'center',
  241. width: 40,
  242. },
  243. {
  244. title: 'IV',
  245. dataIndex: 'fourFlow',
  246. key: 'fourFlow',
  247. align: 'center',
  248. width: 40,
  249. },
  250. {
  251. title: 'V',
  252. dataIndex: 'fiveFlow',
  253. key: 'fiveFlow',
  254. align: 'center',
  255. width: 40,
  256. },
  257. {
  258. title: 'VI',
  259. dataIndex: 'sixFlow',
  260. key: 'sixFlow',
  261. align: 'center',
  262. width: 40,
  263. },
  264. {
  265. title: 'VII',
  266. dataIndex: 'sevenFlow',
  267. key: 'sevenFlow',
  268. align: 'center',
  269. width: 40,
  270. },
  271. {
  272. title: 'VIII',
  273. dataIndex: 'eightFlow',
  274. key: 'eightFlow',
  275. align: 'center',
  276. width: 40,
  277. },
  278. {
  279. title: '合计',
  280. dataIndex: 'total',
  281. key: 'total',
  282. align: 'center',
  283. width: 40,
  284. customRender({ text, record }) {
  285. if (!record.heatNo) {
  286. return '';
  287. }
  288. const allCount = handleTotalSum(record.orgData);
  289. return h(
  290. Input,
  291. { class: 'total-input', size: 'small', bordered: false, value: allCount, onBlur: (e) => handleTotalChange(e, record) },
  292. ''
  293. );
  294. },
  295. },
  296. ],
  297. },
  298. {
  299. title: () => {
  300. return h('div', { style: { position: 'relative' } }, [
  301. h('span', {}, '棒一'),
  302. h(
  303. 'div',
  304. {
  305. style: {
  306. cursor: 'pointer',
  307. position: 'absolute',
  308. right: '4px',
  309. top: '1px',
  310. },
  311. class: 'noprint',
  312. onClick: () => {
  313. console.log('点击了');
  314. const rollOnrColumn: any = columns.value.find((item: any) => item.dataIndex === 'rollOne');
  315. let newSize: string | number = '';
  316. rollOnrColumn.children.push({
  317. title: () => {
  318. return h(
  319. // Select,
  320. Input,
  321. {
  322. // options: sizeListOPtions.value,
  323. bordered: false,
  324. // dropdownStyle: {
  325. // minWidth: '80px',
  326. // },
  327. defaultValue: '',
  328. style: {
  329. padding: 0,
  330. textAlign: 'center',
  331. },
  332. // onChange: (value) => {
  333. // newSize = value;
  334. // },
  335. onBlur: throttle((e) => {
  336. if (e.target.value.trim() === '') {
  337. createMessage.error('请输入定尺');
  338. return;
  339. }
  340. const size = Number(e.target.value.trim());
  341. if (!isNumber(size)) {
  342. createMessage.error('请输入数字');
  343. return;
  344. }
  345. newSize = size <= 20 ? size * 1000 : size;
  346. }, 500),
  347. },
  348. ''
  349. );
  350. },
  351. dataIndex: 'newSize',
  352. key: 'newSize',
  353. align: 'center',
  354. width: 40,
  355. customRender({ text, record }) {
  356. if (!record.heatNo) {
  357. return '';
  358. }
  359. return h(
  360. Input,
  361. { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleSizeChange(e, record, newSize) },
  362. ''
  363. );
  364. },
  365. });
  366. },
  367. },
  368. h(Icon, { icon: 'ant-design:plus-square-outlined' }, '')
  369. ),
  370. ]);
  371. },
  372. width: 40,
  373. align: 'center',
  374. dataIndex: 'rollOne',
  375. key: 'rollOne',
  376. children: [],
  377. },
  378. ];
  379. const columns = ref<TableColumnsType>(defaultColumns);
  380. const dataSource = ref<any[]>([]);
  381. const shiftInfoTxt = ref(['', '']);
  382. const shiftInfo = ref({ shift: '', shiftGroup: '' });
  383. const curTime = ref(dayjs().format('YYYY-MM-DD'));
  384. //表单赋值
  385. const fetchQueryType = ref(1);
  386. const fetchChangeShiftId = ref('');
  387. // 定尺
  388. const sizeListOPtions = ref([]);
  389. const [registerModal, { changeOkLoading, changeLoading }] = useModalInner(async (data) => {
  390. const { ccmNo, shiftText, queryType, curShiftInfo, changeShiftId, time } = data;
  391. printKey.value = dayjs().unix();
  392. hostNumber.value = ccmNo;
  393. fetchQueryType.value = queryType;
  394. fetchChangeShiftId.value = changeShiftId;
  395. shiftInfoTxt.value = shiftText.split('-');
  396. shiftInfo.value = curShiftInfo;
  397. if (time) {
  398. curTime.value = time;
  399. }
  400. let newSip: any[] = [];
  401. for (let index = 0; index < 22; index++) {
  402. newSip.push({
  403. SerialNumber: index + 1,
  404. heatNo: '',
  405. brandNum: '',
  406. oneFlow: '',
  407. twoFlow: '',
  408. threeFlow: '',
  409. fourFlow: '',
  410. fiveFlow: '',
  411. sixFlow: '',
  412. sevenFlow: '',
  413. eightFlow: '',
  414. total: '',
  415. });
  416. }
  417. dataSource.value = [...newSip];
  418. getHeatList({
  419. ccmNo,
  420. queryType,
  421. changeShiftId,
  422. });
  423. // 获取定尺啊
  424. initDictOptions('lg_dcgg').then((dc) => {
  425. sizeListOPtions.value = (dc || []).map((item) => {
  426. return {
  427. label: Number(item.value) / 1000,
  428. value: item.value,
  429. };
  430. });
  431. });
  432. });
  433. // 字段映射
  434. const headText = {
  435. rollClubTwoCount: '二',
  436. rollClubThreeCount: '三',
  437. rollClubShippCount: '上',
  438. roll_club_two: '棒二',
  439. roll_club_three: '棒三',
  440. roll_out_shipp: '上若',
  441. };
  442. // 备注
  443. const remakeColSpan = ref(8);
  444. // 定尺
  445. const sizeColSpan = ref(2);
  446. // 支数
  447. const flowColSpan = ref(2);
  448. // 产量
  449. const weightColSpan = ref(4);
  450. // 热送统计
  451. const hotSendList = ref<any>({});
  452. // 堆垛统计
  453. const stackingList = ref<any>([]);
  454. // 定尺和备注
  455. const mainSize = ref('');
  456. const mainRemark = ref('');
  457. const getHeatList = async (params) => {
  458. try {
  459. changeLoading(true);
  460. const { billetOriginalProductRecordList, content, sizeInfo } = await queryBilletRecordByCcmNo(params);
  461. let newArr: any[] = [];
  462. mainSize.value = sizeInfo;
  463. mainRemark.value = content;
  464. if (billetOriginalProductRecordList && Array.isArray(billetOriginalProductRecordList)) {
  465. // 根据时间排序
  466. newArr = billetOriginalProductRecordList.sort((a, b) => {
  467. return dayjs(a.createTime).isBefore(dayjs(b.createTime)) ? -1 : 1;
  468. });
  469. let sizeColumn: string | number[] = [];
  470. let sizeHeadContent = {};
  471. // 棒一
  472. const rollOneColumns: TableColumnsType = [];
  473. const rollOneSize = {};
  474. // 棒二
  475. const rollTwoSize = {};
  476. // 棒三
  477. const rollThreeSize = {};
  478. // 上若
  479. const rollShippSize = {};
  480. // 堆垛
  481. const stackingSize = {};
  482. // 堆垛字段
  483. let stackLengthColumn: any = {
  484. title: () => {
  485. return h('div', { style: { position: 'relative' } }, [
  486. h('span', {}, '堆垛'),
  487. h(
  488. 'div',
  489. {
  490. style: {
  491. cursor: 'pointer',
  492. position: 'absolute',
  493. right: '4px',
  494. top: '1px',
  495. },
  496. class: 'noprint',
  497. onClick: () => {
  498. const rollOnrColumn: any = columns.value.find((item: any) => item.dataIndex === 'stackLength');
  499. let newSize: string | number = '';
  500. rollOnrColumn.children.push({
  501. title: () => {
  502. return h(
  503. // Select,
  504. Input,
  505. {
  506. // options: sizeListOPtions.value,
  507. bordered: false,
  508. // dropdownStyle: {
  509. // minWidth: '80px',
  510. // },
  511. style: {
  512. padding: '0px',
  513. textAlign: 'center',
  514. },
  515. defaultValue: ' ',
  516. // onChange: (value) => {
  517. // newSize = value;
  518. // },
  519. onBlur: throttle((e) => {
  520. if (e.target.value.trim() === '') {
  521. createMessage.error('请输入定尺');
  522. return;
  523. }
  524. const size = Number(e.target.value.trim());
  525. if (!isNumber(size)) {
  526. createMessage.error('请输入数字');
  527. return;
  528. }
  529. newSize = size <= 20 ? size * 1000 : size;
  530. }, 500),
  531. },
  532. ''
  533. );
  534. },
  535. dataIndex: 'newSize',
  536. key: 'newSize',
  537. align: 'center',
  538. width: 40,
  539. customRender({ text, record }) {
  540. if (!record.heatNo) {
  541. return '';
  542. }
  543. return h(
  544. Input,
  545. { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleStackChange(e, record, newSize) },
  546. ''
  547. );
  548. },
  549. });
  550. },
  551. },
  552. h(Icon, { icon: 'ant-design:plus-square-outlined' }, '')
  553. ),
  554. ]);
  555. },
  556. dataIndex: 'stackLength',
  557. key: 'stackLength',
  558. width: 40,
  559. children: [],
  560. };
  561. dataSource.value = dataSource.value.map((item, index) => {
  562. if (!newArr[index]) return item;
  563. const { hotChargeLength, rollClubOneDetails, stackLength } = newArr[index];
  564. // 棒一
  565. let rollOneNum = '';
  566. let rollOneSizesObj = {};
  567. // if (hotSend) {
  568. // const obj = JSON.parse(hotSend);
  569. // rollOneNum = obj.hotSendTotalCount || '';
  570. // }
  571. if (rollClubOneDetails) {
  572. const obj = JSON.parse(rollClubOneDetails);
  573. rollOneNum = obj.directRollingTotalCount || '';
  574. const lengthGroupCount = obj.lengthGroupCount;
  575. if (lengthGroupCount) {
  576. // 热送棒一的定尺
  577. Object.keys(lengthGroupCount).forEach((key) => {
  578. const column = key;
  579. const columnKey = column + 'rollOneColumn';
  580. const findIndex = rollOneColumns.findIndex((item: any) => item.dataIndex === columnKey);
  581. if (findIndex === -1) {
  582. rollOneColumns.push({
  583. title: () => {
  584. return h('div', { class: 'rollOneColumnWrapper' }, [
  585. h(
  586. // Select,
  587. Input,
  588. {
  589. // options: sizeListOPtions.value,
  590. bordered: false,
  591. // dropdownStyle: {
  592. // minWidth: '80px',
  593. // },
  594. style: {
  595. padding: '0px',
  596. textAlign: 'center',
  597. },
  598. defaultValue: Number(column) > 20 ? Number(column) / 1000 : column,
  599. // onChange: (value) => {
  600. // switchSizehandler(value, column);
  601. // },
  602. onBlur: throttle((e) => {
  603. const value = Number(e.target.value) < 20 ? Number(e.target.value) * 1000 : Number(e.target.value);
  604. switchSizehandler(value, Number(column));
  605. }, 500),
  606. },
  607. ''
  608. ),
  609. h(
  610. 'div',
  611. { class: 'noprint', onClick: () => deleteRollOneColumn(column) },
  612. h(Icon, { icon: 'ant-design:delete-outlined' }, '')
  613. ),
  614. ]);
  615. },
  616. dataIndex: columnKey,
  617. key: columnKey,
  618. align: 'center',
  619. width: 40,
  620. customRender({ text, record }) {
  621. if (!record.heatNo) {
  622. return '';
  623. }
  624. return h(
  625. Input,
  626. { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleSizeChange(e, record, column) },
  627. ''
  628. );
  629. },
  630. });
  631. }
  632. rollOneSizesObj[columnKey] = lengthGroupCount[key];
  633. // 如果没有棒一的定尺
  634. if (!rollOneSize[key]) {
  635. rollOneSize[key] = {
  636. size: Number(column) / 1000 + 'm',
  637. amount: lengthGroupCount[key],
  638. weight: lengthGroupCount[key] * (Number(column) / 1000) * 0.2265,
  639. };
  640. } else {
  641. rollOneSize[key].amount += lengthGroupCount[key];
  642. rollOneSize[key].weight += lengthGroupCount[key] * (Number(column) / 1000) * 0.2265;
  643. }
  644. });
  645. }
  646. }
  647. // 定尺
  648. let sizeArr = {};
  649. if (hotChargeLength) {
  650. // "[{\"hotChargeLength\":\"11820\",\"hotChargeDestination\":\"roll_club_three\",\"totalWeight\":\"5.3545\",\"totalCount\":2}]"
  651. const hotChargeArr = JSON.parse(hotChargeLength);
  652. hotChargeArr.forEach((k) => {
  653. const sizeFormat = Number(k.hotChargeLength) / 1000;
  654. if (!sizeArr[sizeFormat + 'Arr']) {
  655. sizeArr[sizeFormat + 'Arr'] = {};
  656. }
  657. sizeColumn.push(sizeFormat);
  658. // 判断是否有该字段,列头显示
  659. if (!sizeHeadContent[sizeFormat]) {
  660. sizeHeadContent[sizeFormat] = [];
  661. }
  662. // 热送统计
  663. // 棒二
  664. if (k.hotChargeDestination === 'roll_club_two' && k.totalCount > 0) {
  665. sizeArr[sizeFormat + 'Arr'].rollClubTwoCount = k.totalCount;
  666. sizeHeadContent[sizeFormat].push('rollClubTwoCount');
  667. if (!rollTwoSize[k.hotChargeLength]) {
  668. rollTwoSize[k.hotChargeLength] = {
  669. size: Number(k.hotChargeLength) / 1000 + 'm',
  670. amount: k.totalCount,
  671. weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
  672. };
  673. } else {
  674. rollTwoSize[k.hotChargeLength].amount += k.totalCount;
  675. rollTwoSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
  676. }
  677. }
  678. // 棒三
  679. if (k.hotChargeDestination === 'roll_club_three' && k.totalCount > 0) {
  680. sizeArr[sizeFormat + 'Arr'].rollClubThreeCount = k.totalCount;
  681. sizeHeadContent[sizeFormat].push('rollClubThreeCount');
  682. if (!rollThreeSize[k.hotChargeLength]) {
  683. rollThreeSize[k.hotChargeLength] = {
  684. size: Number(k.hotChargeLength) / 1000 + 'm',
  685. amount: k.totalCount,
  686. weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
  687. };
  688. } else {
  689. rollThreeSize[k.hotChargeLength].amount += k.totalCount;
  690. rollThreeSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
  691. }
  692. }
  693. // 上若
  694. if (k.hotChargeDestination === 'roll_out_shipp' && k.totalCount > 0) {
  695. sizeArr[sizeFormat + 'Arr'].rollClubShippCount = k.totalCount;
  696. sizeHeadContent[sizeFormat].push('rollClubShippCount');
  697. if (!rollShippSize[k.hotChargeLength]) {
  698. rollShippSize[k.hotChargeLength] = {
  699. size: Number(k.hotChargeLength) / 1000 + 'm',
  700. amount: k.totalCount,
  701. weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
  702. };
  703. } else {
  704. rollShippSize[k.hotChargeLength].amount += k.totalCount;
  705. rollShippSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
  706. }
  707. }
  708. });
  709. }
  710. // 堆垛
  711. let stackSizeData = {};
  712. if (stackLength) {
  713. const stackLeghtObj = JSON.parse(stackLength);
  714. stackLeghtObj.forEach((v) => {
  715. const sSize = String(v.stackingLength);
  716. const hasChild = stackLengthColumn.children.findIndex((ele) => ele.dataIndex === sSize + 'stackLength');
  717. if (hasChild < 0) {
  718. stackLengthColumn.children.push({
  719. title: () => {
  720. return h('div', { class: 'rollOneColumnWrapper' }, [
  721. h(
  722. // Select,
  723. Input,
  724. {
  725. // options: sizeListOPtions.value,
  726. bordered: false,
  727. // dropdownStyle: {
  728. // minWidth: '80px',
  729. // },
  730. style: {
  731. padding: '0px',
  732. textAlign: 'center',
  733. },
  734. defaultValue: Number(sSize) > 20 ? Number(sSize) / 1000 : sSize,
  735. // onChange: (value) => {
  736. // switchSizehandler(value, column);
  737. // },
  738. onBlur: throttle((e) => {
  739. const value = Number(e.target.value) < 20 ? Number(e.target.value) * 1000 : Number(e.target.value);
  740. switchStackhandler(value, Number(sSize));
  741. }, 500),
  742. },
  743. ''
  744. ),
  745. h('div', { class: 'noprint', onClick: () => deleteStackColumn(sSize) }, h(Icon, { icon: 'ant-design:delete-outlined' }, '')),
  746. ]);
  747. },
  748. dataIndex: sSize + 'stackLength',
  749. key: sSize + 'stackLength',
  750. width: 40,
  751. customRender({ text, record }) {
  752. if (!record.heatNo) {
  753. return '';
  754. }
  755. return h(
  756. Input,
  757. { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleStackChange(e, record, sSize) },
  758. ''
  759. );
  760. },
  761. });
  762. }
  763. stackSizeData[sSize + 'stackLength'] = v.stackingCount;
  764. // 给堆垛添加致谢
  765. if (!stackingSize[sSize]) {
  766. stackingSize[sSize] = {
  767. size: Number(sSize) / 1000 + 'm',
  768. amount: v.stackingCount,
  769. weight: v.stackingCount * (Number(sSize) / 1000) * 0.2265,
  770. };
  771. } else {
  772. stackingSize[sSize].amount += v.stackingCount;
  773. stackingSize[sSize].weight += v.stackingCount * (Number(sSize) / 1000) * 0.2265;
  774. }
  775. });
  776. }
  777. return {
  778. ...item,
  779. heatNo: newArr[index].heatNo,
  780. brandNum: newArr[index].grade,
  781. oneFlow: newArr[index].oneStrandSum || '',
  782. twoFlow: newArr[index].twoStrandSum || '',
  783. threeFlow: newArr[index].threeStrandSum || '',
  784. fourFlow: newArr[index].fourStrandSum || '',
  785. fiveFlow: newArr[index].fiveStrandSum || '',
  786. sixFlow: newArr[index].sixStrandSum || '',
  787. sevenFlow: newArr[index].sevenStrandSum || '',
  788. eightFlow: newArr[index].eightStrandSum || '',
  789. total: newArr[index].amount || '',
  790. rollOneOld: rollOneNum,
  791. ...sizeArr,
  792. ...rollOneSizesObj,
  793. ...stackSizeData,
  794. orgData: newArr[index],
  795. };
  796. });
  797. const otherColumn: TableColumnsType = [...new Set(sizeColumn)].map((item) => {
  798. return {
  799. title: () => {
  800. const subHead = Object.keys(headText)
  801. .filter((key) => sizeHeadContent[item].includes(key))
  802. .map((key) => headText[key]);
  803. return h('div', {}, [h('div', { style: { fontSize: '12px' } }, subHead.join(' / ')), h('div', {}, item)]);
  804. },
  805. dataIndex: item,
  806. key: item,
  807. align: 'center',
  808. width: 50,
  809. customRender: ({ text, record }) => {
  810. if (record[item + 'Arr']) {
  811. const subHead = Object.keys(headText)
  812. .filter((key) => sizeHeadContent[item].includes(key))
  813. .map((key) => record[item + 'Arr'][key] || '~');
  814. return h(
  815. 'div',
  816. {
  817. class: 'size-st-num',
  818. onClick: () => {
  819. if (subHead.length === 0) return;
  820. const { orgData } = record;
  821. if (!orgData || !orgData.hotChargeLength) return;
  822. const { hotChargeLength } = orgData;
  823. editSizeNumRecord.value = {
  824. ...orgData,
  825. hotChargeLengthArr: JSON.parse(hotChargeLength),
  826. };
  827. openSetSizeNumModal.value = true;
  828. },
  829. },
  830. subHead.join('/')
  831. );
  832. }
  833. return '';
  834. },
  835. };
  836. });
  837. // 添加空白列
  838. otherColumn.push(stackLengthColumn);
  839. columns.value = [...defaultColumns, ...otherColumn];
  840. (columns.value[4] as any).children = rollOneColumns.length ? rollOneColumns : [];
  841. // if (rollOneColumns.length) {
  842. // columns.value[4].children = rollOneColumns;
  843. // } else {
  844. // columns.value[4].children = [];
  845. // }
  846. const allSpan = 12 + rollOneColumns.length + otherColumn.length + stackLengthColumn.children.length;
  847. remakeColSpan.value = Math.ceil(allSpan / 3);
  848. const nnColSpan = Math.ceil((allSpan - remakeColSpan.value) / 2);
  849. const newNNColSpan = nnColSpan % 2 === 0 ? nnColSpan : nnColSpan + 1;
  850. sizeColSpan.value = newNNColSpan / 2 > 4 ? newNNColSpan / 2 : 4;
  851. flowColSpan.value = newNNColSpan - sizeColSpan.value;
  852. weightColSpan.value = allSpan - remakeColSpan.value - newNNColSpan;
  853. // 热送统计
  854. if (Object.values(rollOneSize).length) {
  855. hotSendList.value['一'] = Object.values(rollOneSize);
  856. }
  857. if (Object.values(rollTwoSize).length) {
  858. hotSendList.value['二'] = Object.values(rollTwoSize);
  859. }
  860. if (Object.values(rollThreeSize).length) {
  861. hotSendList.value['三'] = Object.values(rollThreeSize);
  862. }
  863. if (Object.values(rollShippSize).length) {
  864. hotSendList.value['上'] = Object.values(rollShippSize);
  865. }
  866. if (Object.values(stackingSize)) {
  867. stackingList.value = Object.values(stackingSize);
  868. }
  869. }
  870. changeLoading(false);
  871. } catch (error) {
  872. changeLoading(false);
  873. console.log(error);
  874. }
  875. };
  876. const openJSModal = ref(false);
  877. const xiShu = ref(0.2265);
  878. const sizeNum = ref();
  879. const weightNum = ref();
  880. // 重量计算按钮
  881. const weightCalc = computed(() => {
  882. const w = Number(weightNum.value);
  883. const x = Number(xiShu.value);
  884. const s = Number(sizeNum.value);
  885. if (isNumber(w) && isNumber(x) && isNumber(s)) {
  886. const r = w * x * s;
  887. return !isNaN(r) ? r.toFixed(6) : '';
  888. }
  889. return '';
  890. });
  891. // 修改合计
  892. const handleTotalChange = throttle((e: any, record) => {
  893. const val = Number(e.target.value);
  894. if (!isNumber(val) || val <= 0) {
  895. createMessage.error('请输入数字');
  896. return;
  897. }
  898. if (record.total !== val) {
  899. const { orgData } = record;
  900. handleEdit({
  901. ...orgData,
  902. amount: val,
  903. });
  904. }
  905. }, 800);
  906. // 编辑
  907. const handleEdit = async (record) => {
  908. try {
  909. changeLoading(true);
  910. await editBilletRecord(record);
  911. await getHeatList({
  912. ccmNo: hostNumber.value,
  913. queryType: fetchQueryType.value,
  914. changeShiftId: fetchChangeShiftId.value,
  915. });
  916. changeLoading(false);
  917. } catch (error) {
  918. changeLoading(false);
  919. console.log(error);
  920. }
  921. };
  922. // 修改棒一定尺数量
  923. const handleSizeChange = throttle((e: any, record, size) => {
  924. if (!size) {
  925. createMessage.error('请选择定尺');
  926. return;
  927. }
  928. const val = Number(e.target.value);
  929. if (!isNumber(val) || val < 0) {
  930. createMessage.error('请输入大于或等于0的数字');
  931. return;
  932. }
  933. const { orgData } = record;
  934. const { rollClubOneDetails } = orgData;
  935. let obj = {
  936. lengthGroupCount: {},
  937. directRollingTotalWeight: 0,
  938. directRollingTotalCount: 0,
  939. };
  940. if (rollClubOneDetails) {
  941. obj = JSON.parse(rollClubOneDetails);
  942. }
  943. const lengthGroupCount = obj.lengthGroupCount;
  944. if (
  945. lengthGroupCount &&
  946. ((Object.hasOwn(lengthGroupCount, size) && (val === 0 || lengthGroupCount[size] !== val)) ||
  947. (!Object.hasOwn(lengthGroupCount, size) && val > 0))
  948. ) {
  949. if (val <= 0) {
  950. delete obj.lengthGroupCount[size];
  951. } else {
  952. obj.lengthGroupCount[size] = val;
  953. }
  954. const params = {
  955. ...orgData,
  956. rollClubOneDetails: JSON.stringify(obj),
  957. };
  958. const amount = handleTotalSum(params);
  959. handleEdit({
  960. ...params,
  961. amount,
  962. });
  963. }
  964. }, 800);
  965. // 计算总数
  966. const handleTotalSum = (record) => {
  967. const { rollClubOneDetails, stackLength, hotChargeLength } = record;
  968. let allCount = 0;
  969. if (rollClubOneDetails) {
  970. const sendObj = JSON.parse(rollClubOneDetails);
  971. if (sendObj.lengthGroupCount) {
  972. Object.keys(sendObj.lengthGroupCount).forEach((key) => {
  973. allCount += sendObj.lengthGroupCount[key];
  974. });
  975. }
  976. }
  977. if (stackLength) {
  978. const stackObj = JSON.parse(stackLength);
  979. if (isArray(stackObj)) {
  980. stackObj.forEach((item) => {
  981. allCount += item.stackingCount;
  982. });
  983. }
  984. }
  985. if (hotChargeLength) {
  986. const chargeObj = JSON.parse(hotChargeLength);
  987. if (isArray(chargeObj)) {
  988. chargeObj.forEach((item) => {
  989. allCount += item.totalCount;
  990. });
  991. }
  992. }
  993. return allCount;
  994. };
  995. // 修改堆垛定尺数量
  996. const handleStackChange = throttle((e: any, record, size) => {
  997. if (e.target.value.trim() === '') return;
  998. if (!size) {
  999. createMessage.error('请选择定尺');
  1000. return;
  1001. }
  1002. const val = Number(e.target.value);
  1003. if (!isNumber(val)) {
  1004. createMessage.error('请输入大于等于0的数字');
  1005. return;
  1006. }
  1007. const { orgData } = record;
  1008. const { stackLength } = orgData;
  1009. let obj: any[] = [];
  1010. if (stackLength) {
  1011. obj = JSON.parse(stackLength);
  1012. }
  1013. const lengthGroupCount = obj.findIndex((v) => v.stackingLength == size);
  1014. // 计算补的数量是不是4的倍数
  1015. let stackInfo: any = null;
  1016. const buCount = lengthGroupCount > -1 ? val - obj[lengthGroupCount].stackingCount : val;
  1017. if (buCount && buCount > 0) {
  1018. if (buCount % 4 !== 0) {
  1019. createMessage.error('补数量必须是4的倍数');
  1020. return;
  1021. }
  1022. stackInfo = buCount + '-' + size + '-10';
  1023. } else {
  1024. stackInfo = null;
  1025. }
  1026. if (lengthGroupCount === -1) {
  1027. obj.push({
  1028. stackingCount: val,
  1029. stackingLength: size,
  1030. stackingWeight: val * (Number(size) / 1000) * 0.2265,
  1031. });
  1032. } else {
  1033. if (obj[lengthGroupCount].stackingCount === val) return;
  1034. obj[lengthGroupCount].stackingCount = val;
  1035. obj[lengthGroupCount].stackingWeight = val * (Number(size) / 1000) * 0.2265;
  1036. }
  1037. const params = {
  1038. ...orgData,
  1039. stackLength: JSON.stringify(obj),
  1040. stackInfo,
  1041. };
  1042. const amount = handleTotalSum(params);
  1043. handleEdit({
  1044. ...params,
  1045. amount,
  1046. });
  1047. }, 800);
  1048. // 编辑切换定尺
  1049. const switchSizehandler = async (val, oldSize) => {
  1050. try {
  1051. changeLoading(true);
  1052. const fetchArr: any[] = [];
  1053. dataSource.value.forEach((item) => {
  1054. if (item.heatNo && item.orgData) {
  1055. const { rollClubOneDetails } = item.orgData;
  1056. if (rollClubOneDetails) {
  1057. const obj = JSON.parse(rollClubOneDetails);
  1058. if (obj && obj.lengthGroupCount) {
  1059. const lengthGroupCount = obj.lengthGroupCount;
  1060. if (lengthGroupCount[oldSize]) {
  1061. obj.lengthGroupCount[val] = lengthGroupCount[oldSize] + (lengthGroupCount[val] ? lengthGroupCount[val] : 0);
  1062. delete obj.lengthGroupCount[oldSize];
  1063. // 请求push了
  1064. fetchArr.push(
  1065. editBilletRecord({
  1066. ...item.orgData,
  1067. rollClubOneDetails: JSON.stringify(obj),
  1068. })
  1069. );
  1070. }
  1071. }
  1072. }
  1073. }
  1074. });
  1075. if (fetchArr.length > 0) {
  1076. await Promise.all(fetchArr);
  1077. await getHeatList({
  1078. ccmNo: hostNumber.value,
  1079. queryType: fetchQueryType.value,
  1080. changeShiftId: fetchChangeShiftId.value,
  1081. });
  1082. changeLoading(false);
  1083. }
  1084. } catch (error) {
  1085. changeLoading(false);
  1086. console.log(error);
  1087. }
  1088. };
  1089. // 堆垛编辑定尺
  1090. const switchStackhandler = async (val, oldSize) => {
  1091. console.log(val, oldSize);
  1092. try {
  1093. changeLoading(true);
  1094. const fetchArr: any[] = [];
  1095. dataSource.value.forEach((item) => {
  1096. if (item.heatNo && item.orgData) {
  1097. const { stackLength } = item.orgData;
  1098. if (stackLength) {
  1099. let obj = stackLength ? JSON.parse(stackLength) : [];
  1100. const oldSizeIndex = obj.findIndex((k) => k.stackingLength === oldSize);
  1101. if (oldSizeIndex > -1) {
  1102. const newSizeIndex = obj.findIndex((k) => k.stackingLength === Number(val));
  1103. if (newSizeIndex > -1) {
  1104. obj[newSizeIndex].stackingCount += obj[oldSizeIndex].stackingCount;
  1105. obj = obj.filter((j) => j.stackingLength !== oldSize);
  1106. } else {
  1107. obj[oldSizeIndex].stackingLength = Number(val);
  1108. }
  1109. // 请求push了
  1110. fetchArr.push(
  1111. editBilletRecord({
  1112. ...item.orgData,
  1113. stackLength: JSON.stringify(obj),
  1114. })
  1115. );
  1116. }
  1117. }
  1118. }
  1119. });
  1120. if (fetchArr.length > 0) {
  1121. await Promise.all(fetchArr);
  1122. await getHeatList({
  1123. ccmNo: hostNumber.value,
  1124. queryType: fetchQueryType.value,
  1125. changeShiftId: fetchChangeShiftId.value,
  1126. });
  1127. changeLoading(false);
  1128. }
  1129. } catch (error) {
  1130. changeLoading(false);
  1131. console.log(error);
  1132. }
  1133. };
  1134. // 删除定尺
  1135. const deleteRollOneColumn = async (size) => {
  1136. try {
  1137. changeLoading(true);
  1138. const fetchArr: any[] = [];
  1139. dataSource.value.forEach((item) => {
  1140. if (item.heatNo && item.orgData) {
  1141. const { rollClubOneDetails } = item.orgData;
  1142. if (rollClubOneDetails) {
  1143. const obj = JSON.parse(rollClubOneDetails);
  1144. if (obj && obj.lengthGroupCount) {
  1145. const lengthGroupCount = obj.lengthGroupCount;
  1146. if (lengthGroupCount[size]) {
  1147. delete obj.lengthGroupCount[size];
  1148. // 请求push了
  1149. const params = {
  1150. ...item.orgData,
  1151. rollClubOneDetails: JSON.stringify(obj),
  1152. };
  1153. const amount = handleTotalSum(params);
  1154. fetchArr.push(
  1155. editBilletRecord({
  1156. ...params,
  1157. amount,
  1158. })
  1159. );
  1160. }
  1161. }
  1162. }
  1163. }
  1164. });
  1165. if (fetchArr.length > 0) {
  1166. await Promise.all(fetchArr);
  1167. await getHeatList({
  1168. ccmNo: hostNumber.value,
  1169. queryType: fetchQueryType.value,
  1170. changeShiftId: fetchChangeShiftId.value,
  1171. });
  1172. changeLoading(false);
  1173. }
  1174. } catch (error) {
  1175. changeLoading(false);
  1176. console.log(error);
  1177. }
  1178. };
  1179. // 删除堆垛定尺
  1180. const deleteStackColumn = async (size) => {
  1181. try {
  1182. changeLoading(true);
  1183. const fetchArr: any[] = [];
  1184. dataSource.value.forEach((item) => {
  1185. if (item.heatNo && item.orgData) {
  1186. const { stackLength } = item.orgData;
  1187. if (stackLength) {
  1188. const obj = JSON.parse(stackLength);
  1189. const hasStackItem = obj.findIndex((n) => n.stackingLength == size);
  1190. if (hasStackItem > -1) {
  1191. const lengthGroupCount = obj.filter((m) => m.stackingLength != size);
  1192. // 请求push了
  1193. const params = {
  1194. ...item.orgData,
  1195. stackLength: JSON.stringify(lengthGroupCount),
  1196. };
  1197. const amount = handleTotalSum(params);
  1198. fetchArr.push(
  1199. editBilletRecord({
  1200. ...params,
  1201. amount,
  1202. })
  1203. );
  1204. }
  1205. }
  1206. }
  1207. });
  1208. if (fetchArr.length > 0) {
  1209. await Promise.all(fetchArr);
  1210. await getHeatList({
  1211. ccmNo: hostNumber.value,
  1212. queryType: fetchQueryType.value,
  1213. changeShiftId: fetchChangeShiftId.value,
  1214. });
  1215. }
  1216. changeLoading(false);
  1217. } catch (error) {
  1218. changeLoading(false);
  1219. console.log(error);
  1220. }
  1221. };
  1222. // 编辑目的地定尺数量
  1223. const openSetSizeNumModal = ref(false);
  1224. const editSizeNumRecord = ref<any>({});
  1225. const confirmSetSizeNum = async () => {
  1226. try {
  1227. changeLoading(true);
  1228. const { hotChargeLengthArr } = editSizeNumRecord.value;
  1229. if (!hotChargeLengthArr.length) {
  1230. return;
  1231. }
  1232. const arr = hotChargeLengthArr
  1233. .filter((ele) => ele.totalCount)
  1234. .map((k) => {
  1235. return {
  1236. ...k,
  1237. totalWeight: (k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265).toFixed(4),
  1238. };
  1239. });
  1240. editSizeNumRecord.value.hotChargeLength = arr.length ? JSON.stringify(arr) : null;
  1241. await editBilletRecord({
  1242. ...editSizeNumRecord.value,
  1243. });
  1244. openSetSizeNumModal.value = false;
  1245. await getHeatList({
  1246. ccmNo: hostNumber.value,
  1247. queryType: fetchQueryType.value,
  1248. changeShiftId: fetchChangeShiftId.value,
  1249. });
  1250. changeLoading(false);
  1251. } catch (e) {
  1252. changeLoading(false);
  1253. console.log(e);
  1254. }
  1255. };
  1256. function onPrint() {
  1257. changeOkLoading(true);
  1258. printJS({
  1259. printable: '#printBilletSampleCard',
  1260. type: 'html',
  1261. });
  1262. setTimeout(() => {
  1263. changeOkLoading(false);
  1264. }, 1000);
  1265. }
  1266. </script>
  1267. <style scoped lang="less">
  1268. .ticket {
  1269. max-width: 1400px;
  1270. height: 100%;
  1271. display: flex;
  1272. flex-direction: column;
  1273. .ccmno-info {
  1274. font-family: 'Kingsoft_Cloud_Font';
  1275. }
  1276. .ccmno {
  1277. display: inline-block;
  1278. width: 60px;
  1279. border-bottom: 1px solid black;
  1280. text-align: center;
  1281. }
  1282. .size-items-title {
  1283. font-size: 12px;
  1284. line-height: 32px;
  1285. border-bottom: 1px solid #bfbfbf;
  1286. padding-left: 10px;
  1287. min-width: 100px;
  1288. }
  1289. .size-num-title {
  1290. font-size: 12px;
  1291. line-height: 32px;
  1292. padding-left: 10px;
  1293. }
  1294. .size-items-content {
  1295. height: 32px;
  1296. text-align: center;
  1297. line-height: 32px;
  1298. }
  1299. .size-items-remark {
  1300. width: 100%;
  1301. min-height: 90px;
  1302. flex-wrap: wrap;
  1303. font-family: 'Kingsoft_Cloud_Font';
  1304. align-content: flex-start;
  1305. .size-remark-item {
  1306. width: 50%;
  1307. height: 30px;
  1308. color: #000;
  1309. }
  1310. .size-remark-size {
  1311. display: inline-block;
  1312. width: 80px;
  1313. }
  1314. .size-remark-num {
  1315. display: inline-block;
  1316. width: 80px;
  1317. padding: 0 40px 0 0;
  1318. font-size: 12px;
  1319. }
  1320. }
  1321. .two-num-wrapper {
  1322. position: absolute;
  1323. left: 0;
  1324. top: 0;
  1325. width: 100%;
  1326. height: 100%;
  1327. z-index: 10;
  1328. display: flex;
  1329. flex-direction: column;
  1330. justify-content: center;
  1331. align-items: flex-end;
  1332. padding-right: 6px;
  1333. }
  1334. .s-txt {
  1335. font-family: 'Kingsoft_Cloud_Font';
  1336. }
  1337. .ant-table-wrapper {
  1338. flex: 1;
  1339. :deep(.ant-spin-nested-loading) {
  1340. min-height: 100%;
  1341. .ant-table {
  1342. border-top: 1px solid rgba(0, 0, 0, 0.6);
  1343. > .ant-table-container {
  1344. border-inline-start: 1px solid rgba(0, 0, 0, 0.6);
  1345. }
  1346. .ant-table-content > table > thead > tr > th,
  1347. .ant-table-tbody > tr > td,
  1348. .ant-table-summary > tr > td {
  1349. padding: 2px;
  1350. border-inline-end: 1px solid rgba(0, 0, 0, 0.6);
  1351. border-bottom: 1px solid rgba(0, 0, 0, 0.6) !important;
  1352. text-align: center;
  1353. position: relative;
  1354. }
  1355. .size-st-wrapper {
  1356. position: absolute;
  1357. top: 1px;
  1358. left: 1px;
  1359. right: 1px;
  1360. bottom: 1px;
  1361. .line {
  1362. content: '';
  1363. position: absolute;
  1364. top: 0;
  1365. left: 0;
  1366. width: 100%; /* 等于长方形宽度 */
  1367. height: 100%; /* 等于长方形高度 */
  1368. /* 创建斜线:线性渐变从左上到右下 */
  1369. background: linear-gradient(
  1370. to bottom right,
  1371. transparent 0%,
  1372. transparent calc(50% - 0.5px),
  1373. /* 斜线上方透明 */ rgba(0, 0, 0, 0.6) calc(50% - 0.5px),
  1374. /* 斜线颜色 */ rgba(0, 0, 0, 0.6) calc(50% + 0.5px),
  1375. /* 斜线厚度 */ transparent calc(50% + 0.5px) /* 斜线下方透明 */
  1376. );
  1377. }
  1378. .size-st-item {
  1379. position: absolute;
  1380. top: -4px;
  1381. left: 2px;
  1382. color: #108ee9;
  1383. }
  1384. }
  1385. .size-st-num {
  1386. color: #f50;
  1387. cursor: pointer;
  1388. }
  1389. // 自定义啊
  1390. .total-input {
  1391. width: 100%;
  1392. padding: 0;
  1393. text-align: center;
  1394. cursor: pointer;
  1395. }
  1396. .ant-select {
  1397. width: 100%;
  1398. .ant-select-selector {
  1399. padding: 0;
  1400. .ant-select-selection-item,
  1401. .ant-select-selection-placeholder {
  1402. padding-inline-end: 0;
  1403. }
  1404. }
  1405. .ant-select-arrow {
  1406. display: none;
  1407. }
  1408. }
  1409. .rollOneColumnWrapper {
  1410. position: relative;
  1411. width: 100%;
  1412. height: 100%;
  1413. .noprint {
  1414. position: absolute;
  1415. left: 0;
  1416. top: 0;
  1417. display: none;
  1418. color: #f50;
  1419. cursor: pointer;
  1420. }
  1421. &:hover {
  1422. .noprint {
  1423. display: block;
  1424. }
  1425. }
  1426. }
  1427. }
  1428. }
  1429. .summary-row-no-border {
  1430. td:first-child {
  1431. border-bottom: none !important;
  1432. }
  1433. .song-items {
  1434. width: 100%;
  1435. height: 100%;
  1436. align-items: flex-start;
  1437. justify-content: flex-start;
  1438. .title {
  1439. margin-right: 10px;
  1440. }
  1441. }
  1442. }
  1443. .summary-cell-remark {
  1444. min-height: 70px;
  1445. }
  1446. }
  1447. }
  1448. </style>
  1449. <style lang="less">
  1450. @media print {
  1451. header,
  1452. footer,
  1453. .noprint {
  1454. display: none;
  1455. }
  1456. @page {
  1457. margin-top: 10px; /* 第一页的页眉距离顶部为0 */
  1458. margin-bottom: 0; /* 第一页的页脚距离底部为0 */
  1459. }
  1460. }
  1461. </style>