saleTruckPreview.vue 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764
  1. <!-- 内转钢材到异地库派单界面 -->
  2. <template>
  3. <div class="purchasFuelNewMonitor">
  4. <div class="tableTop">
  5. <el-form :inline="true" style="margin-top: 5px">
  6. <el-form-item>
  7. <el-select
  8. v-model="screen"
  9. placeholder="请选择需筛选的内容"
  10. clearable
  11. @change="changeScreen"
  12. style="width: 150px"
  13. >
  14. <el-option
  15. v-for="item in options"
  16. :key="item.value"
  17. :label="item.label"
  18. :value="item.value"
  19. >
  20. </el-option>
  21. </el-select>
  22. <el-input
  23. style="width: 200px"
  24. v-model="input"
  25. placeholder="请输入查询条件"
  26. clearable
  27. ></el-input>
  28. </el-form-item>
  29. <el-form-item>
  30. <label class="el-form-item__label" style="width: auto"
  31. >订单时间:</label
  32. >
  33. <el-date-picker
  34. v-model="startTime"
  35. type="datetime"
  36. placeholder="选择日期时间"
  37. style="width: 200px"
  38. >
  39. </el-date-picker>
  40. <span>至</span>
  41. <el-date-picker
  42. v-model="endTime"
  43. type="datetime"
  44. placeholder="选择日期时间"
  45. style="width: 200px"
  46. >
  47. </el-date-picker>
  48. <el-button type="primary" class="btn" @click="onclick">
  49. <i class="el-icon-search"></i>
  50. </el-button>
  51. </el-form-item>
  52. <el-form-item>
  53. <el-button type="primary" @click="exportAllReportToExcel"
  54. ><i class="el-icon-download"></i>Excel</el-button
  55. >
  56. </el-form-item>
  57. <el-form-item>
  58. <el-button type="primary" @click="refresh">
  59. <i class="el-icon-refresh"></i>
  60. </el-button>
  61. </el-form-item>
  62. <el-form-item>
  63. <span style="margin-left: 1rem">合计车数:</span>
  64. <el-input
  65. v-model="totalCapacity"
  66. :disabled="true"
  67. style="width: 100px"
  68. ></el-input>
  69. </el-form-item>
  70. <el-form-item>
  71. <span style="margin-left: 1rem">合计件数:</span>
  72. <el-input
  73. v-model="totalNumber"
  74. :disabled="true"
  75. style="width: 100px"
  76. ></el-input>
  77. </el-form-item>
  78. <el-form-item>
  79. <el-button type="primary" @click="showDialog">多拼派车</el-button>
  80. </el-form-item>
  81. </el-form>
  82. </div>
  83. <div class="table">
  84. <el-table
  85. :data="tableData"
  86. :span-method="objectSpanMethod"
  87. ref="tableRef"
  88. border
  89. stripe
  90. style="width: 100%; margin-top: 20px"
  91. max-height="800px"
  92. @cell-click="cellClik"
  93. :row-style="{ height: '30px' }"
  94. :cell-style="{ fontWeight: '700' }"
  95. >
  96. <el-table-column type="selection" width="55"> </el-table-column>
  97. <el-table-column
  98. width="50"
  99. label="序号"
  100. align="center"
  101. fixed="left"
  102. :resizable="false"
  103. >
  104. <template slot-scope="scope">{{ scope.row.group + 1 }}</template>
  105. </el-table-column>
  106. <el-table-column
  107. prop="consigneeName"
  108. label="收货客户"
  109. :width="flexColumnWidth('consigneeName', tableData, 'max')"
  110. align="center"
  111. fixed
  112. >
  113. <template slot-scope="scope">
  114. <el-autocomplete
  115. class="inline-input"
  116. v-model="scope.row.consigneeName"
  117. :fetch-suggestions="querySearchConsignee"
  118. placeholder="请输入收货客户名称"
  119. :trigger-on-focus="false"
  120. @select="handleSelectConsignee"
  121. style="width: 300px"
  122. :disabled="true"
  123. >
  124. <!-- 上方写死不允许修改,右边是原来的修改 :disabled="scope.row.isConsigneeDisable != 1" -->
  125. <template slot-scope="{ item }">
  126. <div class="name">{{ item.consigneeCompanyName }}</div>
  127. </template>
  128. </el-autocomplete>
  129. <!-- <el-button
  130. @click="updateConsignnee(scope.row)"
  131. type="primary"
  132. v-if="scope.row.isConsigneeDisable == 1"
  133. >提交</el-button> -->
  134. </template>
  135. </el-table-column>
  136. <el-table-column
  137. prop="carrierName"
  138. label="承运商"
  139. align="center"
  140. width="250px"
  141. fixed
  142. >
  143. <template slot-scope="scope">
  144. <el-autocomplete
  145. style="width: 120px"
  146. v-model="scope.row.carrierName"
  147. :fetch-suggestions="querySearchCarrier"
  148. placeholder="请输入承运商"
  149. @select="handleSelectCarrier(scope.row, scope.$index)"
  150. :disabled="scope.row.isCarrierShow != 1"
  151. >
  152. </el-autocomplete>
  153. <el-button
  154. @click="updateTruckCarrier(scope.row)"
  155. type="primary"
  156. v-if="scope.row.isCarrierShow == 1"
  157. >提交</el-button>
  158. </template>
  159. </el-table-column>
  160. <el-table-column
  161. prop="sendStationName"
  162. column-key="sendStationName"
  163. label="发站"
  164. align="center"
  165. width="100px"
  166. fixed
  167. >
  168. <!-- 选择发站 -->
  169. <template slot-scope="scope">
  170. <el-select
  171. filterable
  172. v-model="scope.row.sendStationId"
  173. @change="updateSendStation($event, scope.row)"
  174. disabled
  175. >
  176. <el-option
  177. v-for="item in sendStations"
  178. :value="item.sendStationId"
  179. :key="item.sendStationId"
  180. :label="item.sendStation"
  181. ></el-option>
  182. </el-select>
  183. <!-- <el-button
  184. @click="updateStation(scope.row)"
  185. type="primary"
  186. v-if="scope.row.isSendStationName == 1"
  187. >提交</el-button
  188. > -->
  189. </template>
  190. </el-table-column>
  191. <!-- <el-table-column
  192. prop="lineName"
  193. column-key="lineName"
  194. label="路线"
  195. align="center"
  196. width="250px"
  197. fixed
  198. > -->
  199. <!-- 选择路线 -->
  200. <!-- <template slot-scope="scope">
  201. <el-autocomplete
  202. style="width: 120px"
  203. v-model="scope.row.lineName"
  204. :fetch-suggestions="querySearchLineName"
  205. placeholder="请选择路线"
  206. @select="handleSelectLine(scope.row, scope.$index)"
  207. :disabled="scope.row.isLineName != 1"
  208. >
  209. </el-autocomplete>
  210. <el-button
  211. @click="updateLine(scope.row)"
  212. type="primary"
  213. v-if="scope.row.isLineName == 1"
  214. >提交</el-button
  215. >
  216. </template>
  217. </el-table-column> -->
  218. <el-table-column
  219. prop="capacityNo"
  220. column-key="capacityNo"
  221. label="车牌号"
  222. align="center"
  223. width="250px"
  224. fixed
  225. >
  226. <template slot-scope="scope">
  227. <el-autocomplete
  228. style="width: 120px"
  229. v-model="scope.row.capacityNo"
  230. :fetch-suggestions="querySearch"
  231. placeholder="请输入车牌号"
  232. @select="handleSelect(scope.row, scope.$index)"
  233. :disabled="scope.row.isCapacityShow != 1"
  234. ></el-autocomplete>
  235. <el-button
  236. @click="updateCapacity(scope.row)"
  237. type="primary"
  238. v-if="scope.row.isCapacityShow == 1"
  239. >提交</el-button
  240. >
  241. </template>
  242. </el-table-column>
  243. <el-table-column
  244. prop="materialName"
  245. label="物资名称"
  246. align="center"
  247. width="150px"
  248. >
  249. </el-table-column>
  250. <el-table-column prop="materialSpe" label="物资规格" align="center">
  251. </el-table-column>
  252. <el-table-column
  253. prop="materialNum"
  254. label="物资件数"
  255. align="center"
  256. width="150px"
  257. >
  258. <template slot-scope="scope">
  259. <button
  260. type="primary"
  261. @click="scope.row.materialNum--"
  262. v-if="scope.row.isNumShow == 1"
  263. style="height: 40px"
  264. >
  265. -
  266. </button>
  267. <input
  268. v-model="scope.row.materialNum"
  269. disabled
  270. style="
  271. width: 40px;
  272. height: 40px;
  273. font-size: 16px;
  274. line-height: 40px;
  275. text-align: center;
  276. "
  277. />
  278. <el-button
  279. type="primary"
  280. @click="updateBillOrder(scope.row)"
  281. v-if="scope.row.isNumShow == 1"
  282. >提交</el-button
  283. >
  284. </template>
  285. </el-table-column>
  286. <!-- <el-table-column
  287. prop="addressPlace"
  288. label="收货地址"
  289. :width="flexColumnWidth('addressPlace', tableData, 'max')"
  290. >
  291. <template slot-scope="scope">
  292. <el-input
  293. style="width: 280px"
  294. v-model="scope.row.addressPlace"
  295. placeholder="请输入收货地址"
  296. :disabled="scope.row.isAddressShow != 1"
  297. ></el-input>
  298. <el-button
  299. @click="updateAddress(scope.row)"
  300. type="primary"
  301. v-if="scope.row.isAddressShow == 1"
  302. >选择</el-button
  303. >
  304. </template>
  305. </el-table-column> -->
  306. <el-table-column prop="orderStatus" label="运单状态" align="center">
  307. </el-table-column>
  308. <el-table-column prop="grossWeight" label="毛重"> </el-table-column>
  309. <el-table-column prop="grossWeightTime" label="毛重时间" width="130px">
  310. </el-table-column>
  311. <el-table-column prop="tareWeight" label="皮重"> </el-table-column>
  312. <el-table-column prop="tareWeightTime" label="皮重时间" width="130px">
  313. </el-table-column>
  314. <el-table-column prop="netWeight" label="净重"> </el-table-column>
  315. <el-table-column prop="entryGateTime" label="进厂时间" width="130px">
  316. </el-table-column>
  317. <el-table-column prop="loadTime" label="装货时间" width="130px">
  318. </el-table-column>
  319. <el-table-column prop="outGateTime" label="出厂时间" width="130px">
  320. </el-table-column>
  321. <el-table-column
  322. prop="arrivalAddress"
  323. label="抵达地址"
  324. :width="flexColumnWidth('arrivalAddress', tableData, 'max')"
  325. >
  326. </el-table-column>
  327. <el-table-column
  328. prop="receiptAddress"
  329. label="签收地址"
  330. :width="flexColumnWidth('receiptAddress', tableData, 'max')"
  331. >
  332. </el-table-column>
  333. <el-table-column
  334. prop="orderNo"
  335. label="运输订单号"
  336. width="180px"
  337. align="center"
  338. >
  339. </el-table-column>
  340. <el-table-column
  341. prop="capacityTel"
  342. label="司机电话"
  343. width="250px"
  344. align="center"
  345. >
  346. <template slot-scope="scope">
  347. <el-input
  348. style="width: 120px"
  349. v-model="scope.row.capacityTel"
  350. placeholder="请输入电话号码"
  351. :disabled="scope.row.isTelShow != 1"
  352. ></el-input>
  353. <el-button
  354. @click="updateDriverTel(scope.row)"
  355. type="primary"
  356. v-if="scope.row.isTelShow == 1"
  357. >提交</el-button
  358. >
  359. </template>
  360. </el-table-column>
  361. <el-table-column prop="saler" label="业务员" align="center">
  362. </el-table-column>
  363. <el-table-column
  364. prop="shipperName"
  365. label="发货单位"
  366. width="170px"
  367. align="center"
  368. >
  369. </el-table-column>
  370. <el-table-column prop="truckNo" label="车序号"> </el-table-column>
  371. <el-table-column prop="consigneeTel" label="收货客户电话" width="120px">
  372. </el-table-column>
  373. <el-table-column prop="isSelfMention" label="是否自提" align="center">
  374. </el-table-column>
  375. <el-table-column
  376. prop="saleOrderNo"
  377. label="销售订单号"
  378. width="200px"
  379. align="center"
  380. >
  381. </el-table-column>
  382. <el-table-column
  383. prop="saleOrderStatus"
  384. label="销售订单状态"
  385. width="100px"
  386. >
  387. </el-table-column>
  388. <!-- <el-table-column
  389. label="操作"
  390. fixed="right"
  391. width="120px"
  392. align="center"
  393. >
  394. <template slot-scope="scope">
  395. <el-button
  396. type="text"
  397. size="small"
  398. @click="closeEasEntryId(scope.row)"
  399. v-if="scope.row.deletedStatus == null"
  400. >关闭分录</el-button
  401. >
  402. </template>
  403. </el-table-column>
  404. <el-table-column
  405. label="操作"
  406. fixed="right"
  407. width="120px"
  408. align="center"
  409. >
  410. <template slot-scope="scope">
  411. <el-button
  412. type="text"
  413. size="small"
  414. @click="deleteEasEntryId(scope.row)"
  415. v-if="
  416. scope.row.carStatus == 4 ||
  417. scope.row.carStatus == 5 ||
  418. scope.row.carStatus == null
  419. "
  420. >关闭车辆</el-button
  421. >
  422. </template>
  423. </el-table-column> -->
  424. <!-- <el-table-column
  425. label="操作"
  426. fixed="right"
  427. width="120px"
  428. align="center"
  429. >
  430. <template slot-scope="scope">
  431. <el-button
  432. type="text"
  433. size="small"
  434. @click="adverseCloseSaleMaterial(scope.row)"
  435. v-if="scope.row.deletedStatus != null"
  436. >反关闭分录</el-button
  437. >
  438. </template>
  439. </el-table-column> -->
  440. </el-table>
  441. </div>
  442. <div class="address">
  443. <!-- 收货地址弹出框 -->
  444. <el-dialog title="收货地址" :visible.sync="drawer" width="90%">
  445. <el-form :inline="true">
  446. <el-form-item>
  447. <label class="el-form-item__label" style="width: auto">省</label>
  448. <el-select
  449. v-model="province"
  450. filterable
  451. placeholder="请选择"
  452. @change="onchangeProvince"
  453. >
  454. <el-option
  455. v-for="item in provinceList"
  456. :key="item.id"
  457. :label="item.addressProvince"
  458. :value="item.id"
  459. ></el-option>
  460. </el-select>
  461. </el-form-item>
  462. <el-form-item>
  463. <label class="el-form-item__label" style="width: auto">市</label>
  464. <el-select
  465. v-model="city"
  466. filterable
  467. placeholder="请选择"
  468. @change="onchangeCity"
  469. >
  470. <el-option
  471. v-for="item in cityList"
  472. :key="item.id"
  473. :label="item.addressDistrict"
  474. :value="item.id"
  475. ></el-option>
  476. </el-select>
  477. </el-form-item>
  478. <el-form-item>
  479. <label class="el-form-item__label" style="width: auto"
  480. >县(区)</label
  481. >
  482. <el-select
  483. v-model="county"
  484. filterable
  485. placeholder="请选择"
  486. @change="onchangeCounty"
  487. >
  488. <el-option
  489. v-for="item in countyList"
  490. :key="item.id"
  491. :label="item.addressTown"
  492. :value="item.id"
  493. ></el-option>
  494. </el-select>
  495. </el-form-item>
  496. <el-form-item>
  497. <label class="el-form-item__label" style="width: auto"
  498. >具体收货地址</label
  499. >
  500. <el-autocomplete
  501. class="inline-input"
  502. v-model="place"
  503. :fetch-suggestions="querySearch1"
  504. placeholder="请输入具体收货地址"
  505. :trigger-on-focus="false"
  506. @select="handleSelect1"
  507. >
  508. </el-autocomplete>
  509. </el-form-item>
  510. </el-form>
  511. <div slot="footer" class="button-box">
  512. <el-button @click="drawer = false">取消</el-button>
  513. <el-button type="primary" @click="addAddressClick">确定</el-button>
  514. </div>
  515. </el-dialog>
  516. </div>
  517. <!-- 多拼弹出层-->
  518. <el-dialog
  519. title="生成多拼"
  520. :visible.sync="dialogTableVisible"
  521. style="width: 500px"
  522. >
  523. <el-form :inline="true">
  524. <el-form-item>
  525. <el-autocomplete
  526. style="width: 120px"
  527. v-model="capacityNo"
  528. :fetch-suggestions="querySearch"
  529. placeholder="请输入车牌号"
  530. @select="handleMulSelect"
  531. ></el-autocomplete>
  532. <el-button @click="updateMulCapacity" type="primary">提交</el-button>
  533. </el-form-item>
  534. </el-form>
  535. </el-dialog>
  536. </div>
  537. </template>
  538. <script>
  539. import { sjTime, isVehicleNumber } from "@/utils/sharedJsFile";
  540. import { getCookie } from "@/utils/util.js";
  541. export default {
  542. data() {
  543. return {
  544. // 线路名称
  545. lineName: "",
  546. //线路id
  547. lineId: null,
  548. drawer: false,
  549. clickIndex: null,
  550. input: null,
  551. screen: "",
  552. dialogTableVisible: false,
  553. newsCapacityId: null,
  554. capacityNo: null,
  555. selection: [],
  556. options: [
  557. {
  558. value: "下单客户",
  559. lable: "下单客户",
  560. },
  561. {
  562. value: "承运商",
  563. lable: "承运商",
  564. },
  565. {
  566. value: "车牌号",
  567. lable: "车牌号",
  568. },
  569. {
  570. value: "路线",
  571. lable: "路线",
  572. },
  573. ],
  574. startTime: null,
  575. endTime: null,
  576. //合计净重
  577. totalNumber: 0,
  578. //合计车数
  579. totalCapacity: 0,
  580. tableTitle: "销售统计报表",
  581. capacityList: [],
  582. carrierList: [],
  583. // 线路
  584. LineList: [],
  585. tableData: [],
  586. spanArr: [],
  587. pos: 0,
  588. a: 1,
  589. isCellClick: 0,
  590. columnIndexs: [
  591. 1, 2, 3, 4, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
  592. 29, 31,
  593. ],
  594. //钢材多拼车辆线路ID
  595. //索引从1-10为1-10拼路线ID
  596. // lineSpelling: [
  597. // 0,
  598. // 110001,
  599. // 110002,
  600. // 110003,
  601. // 110004,
  602. // 110005,
  603. // 110006,
  604. // 110007,
  605. // 110008,
  606. // 110009,
  607. // 110010
  608. // ],
  609. //达州站内转多拼车辆线路ID,从1-5为1-5拼线路id
  610. lineDazhou: [0, 189982, 189983, 189984, 189985, 189986],
  611. //专用线内转多拼车辆线路ID,从1-5为1-5拼线路id
  612. lineZhuanxian: [0, 189987, 189988, 189989, 189990, 189991],
  613. sendStationId: null,
  614. sendStations: [],
  615. tableTitle: "销售钢材统计报表",
  616. //所有省
  617. provinceList: [],
  618. //选中的省
  619. province: "",
  620. //所有市
  621. cityList: [],
  622. //选中的市
  623. city: "",
  624. //所有的县(区)
  625. countyList: [],
  626. //选中的县
  627. county: "",
  628. //地址输入框的值
  629. addresText: "",
  630. //已选中省市县
  631. address: null,
  632. //具体地址
  633. place: null,
  634. //暂存具体地址
  635. place1: null,
  636. //省市县Id
  637. addressId: null,
  638. direction: "rtl",
  639. addressRow: {},
  640. consigneeDisable: false,
  641. };
  642. },
  643. created() {},
  644. mounted() {
  645. this.getSteelReport();
  646. this.getSendStations();
  647. },
  648. methods: {
  649. updateConsignnee(row) {
  650. if(!this.consigneeId){
  651. this.$message({
  652. message:"请先选择承运商",
  653. type:"warning"
  654. });
  655. return;
  656. }
  657. let map={
  658. consigneeId:this.consigneeId,
  659. saleOrderId:row.saleOrderId,
  660. }
  661. console.log("consigneeId",map);
  662. this.axios
  663. .post(
  664. "/api/v1/ams/updateInwardConsignee",map
  665. )
  666. .then((res) => {
  667. if (res.data.code == "200") {
  668. this.$message.success("修改成功");
  669. this.getSteelReport();
  670. } else {
  671. this.$message.error("修改失败");
  672. this.getSteelReport();
  673. }
  674. })
  675. },
  676. //反关闭整条分录
  677. adverseCloseSaleMaterial(row) {
  678. console.log(row.saleMaterialId);
  679. this.$confirm("确定反关闭该条分录?", "提示", {
  680. cancelButtonText: "确定",
  681. confirmButtonText: "取消",
  682. center: true,
  683. }).then(() => {
  684. this.axios
  685. .post(
  686. "/api/v1/ams/adverseCloseSaleMaterial?saleMaterialId=" +
  687. row.saleMaterialId
  688. )
  689. .then((res) => {
  690. if (res.data.code == "200") {
  691. this.$message.success("反关闭成功");
  692. this.getSteelReport();
  693. } else {
  694. this.$message.error("反关闭失败");
  695. this.getSteelReport();
  696. }
  697. })
  698. .catch(() => {
  699. this.$message.error("反关闭失败");
  700. this.getSteelReport();
  701. });
  702. });
  703. },
  704. //销售钢材报表导出excel
  705. exportAllReportToExcel() {
  706. const loading = this.$loading({
  707. lock: true,
  708. text: "正在导出Excel",
  709. spinner: "el-icon-loading",
  710. background: "rgba(0, 0, 0, 0.7)",
  711. });
  712. var title = this.tableTitle;
  713. let tHeader = [];
  714. let filterVal = [];
  715. console.log(this.$refs.tableRef);
  716. this.$refs.tableRef.$children.forEach((item) => {
  717. if (item.label != undefined && item.prop != undefined) {
  718. if (tHeader.indexOf(item.label) === -1) {
  719. tHeader.push(item.label);
  720. }
  721. if (filterVal.indexOf(item.prop) === -1) {
  722. filterVal.push(item.prop);
  723. }
  724. }
  725. });
  726. this.downloadLoading = true;
  727. require.ensure([], () => {
  728. const {
  729. export_json_to_excel,
  730. } = require("@/assets/excel/Export2Excel.js"); //这里必须使用绝对路径,使用@/+存放export2Excel的路径
  731. let data = this.tableData.map((v) => filterVal.map((j) => v[j])); //3.formatJson格式转换
  732. export_json_to_excel(tHeader, data, title); // (title)导出的表格名称
  733. });
  734. loading.close();
  735. },
  736. changeScreen() {
  737. console.log(this.screen);
  738. },
  739. cellClik(row, column, cell, event) {
  740. if (row.group != this.clickIndex) {
  741. // this.getSteelReport();
  742. this.tableData.forEach((item) => {
  743. if (item.group == this.clickIndex) {
  744. this.$set(item, "isCapacityShow", 0);
  745. this.$set(item, "isCarrierShow", 0);
  746. this.$set(item, "isTelShow", 0);
  747. this.$set(item, "isAddressShow", 0);
  748. this.$set(item, "isNumShow", 0);
  749. this.$set(item, "isLineName", 0);
  750. this.$set(item, "isSendStationName", 0);
  751. this.$set(item, "isConsigneeDisable", 0);
  752. }
  753. });
  754. }
  755. if (column.property == "capacityNo") {
  756. this.$set(row, "isCapacityShow", 1);
  757. this.clickIndex = row.group;
  758. }
  759. if (column.property == "lineName") {
  760. this.$set(row, "isLineName", 1);
  761. this.clickIndex = row.group;
  762. }
  763. if (column.property == "sendStationName") {
  764. this.$set(row, "isSendStationName", 1);
  765. this.clickIndex = row.group;
  766. }
  767. if (column.property == "carrierName") {
  768. this.$set(row, "isCarrierShow", 1);
  769. this.clickIndex = row.group;
  770. }
  771. if (column.property == "consigneeName") {
  772. this.$set(row, "isConsigneeDisable", 1);
  773. this.clickIndex = row.group;
  774. }
  775. if (column.property == "capacityTel") {
  776. this.$set(row, "isTelShow", 1);
  777. this.clickIndex = row.group;
  778. }
  779. if (column.property == "addressPlace") {
  780. this.$set(row, "isAddressShow", 1);
  781. this.clickIndex = row.group;
  782. }
  783. if (column.property == "materialNum") {
  784. this.$set(row, "isNumShow", 1);
  785. this.clickIndex = row.group;
  786. }
  787. },
  788. //承运商弹出层
  789. handleSelectCarrier(row, index, item) {
  790. this.carrierList.forEach((item) => {
  791. if (item.carrierName == row.carrierName) {
  792. row.newCarrierId = item.carrierId;
  793. row.carrierId = item.carrierId;
  794. row.carrierIds=item.carrierId;
  795. }
  796. });
  797. },
  798. //承运商边输边查
  799. querySearchCarrier(queryString, cb) {
  800. if (queryString.length > 1) {
  801. this.axios
  802. .post("/api/v1/uc/getCarrierMesByLike?index=" + queryString)
  803. .then((res) => {
  804. if (res.data.code == "200") {
  805. this.carrierList = [];
  806. if (res.data.data.length == 0) {
  807. this.$message.info("承运商不存在,请前往注册");
  808. return;
  809. }
  810. var restaurants = res.data.data;
  811. this.carrierList = res.data.data;
  812. var results = queryString
  813. ? restaurants.filter(this.createFilterCarrier(queryString))
  814. : restaurants;
  815. cb(results);
  816. }
  817. });
  818. }
  819. },
  820. querySearchLineName(queryString, cb) {
  821. if (queryString.length > 1) {
  822. this.axios
  823. .post(
  824. "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=" + queryString
  825. )
  826. .then((res) => {
  827. console.log(res.data.data.list.length);
  828. console.log(res.data.data);
  829. if (res.data.code == "200") {
  830. this.LineList = [];
  831. if (res.data.data.list.length == 0) {
  832. this.$message.info("线路不存在,请前往注册");
  833. return;
  834. }
  835. var restaurants = res.data.data.list;
  836. this.LineList = res.data.data.list;
  837. console.log(this.LineList);
  838. var results = queryString
  839. ? restaurants.filter(this.createFilterLine(queryString))
  840. : restaurants;
  841. cb(results);
  842. }
  843. });
  844. }
  845. },
  846. //获取发站
  847. getSendStations() {
  848. this.axios.get("/api/v1/uc/getInwardSendStation").then((res) => {
  849. console.log(res.data.data);
  850. if (res.data.code == "200") {
  851. this.sendStations = res.data.data;
  852. }
  853. });
  854. },
  855. // 过滤器
  856. createFilterLine(queryString) {
  857. return (restaurants) => {
  858. return (
  859. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  860. -1
  861. );
  862. };
  863. },
  864. createFilterCarrier(queryString) {
  865. return (restaurants) => {
  866. return (
  867. restaurants.value1.toLowerCase().indexOf(queryString.toLowerCase()) >
  868. -1
  869. );
  870. };
  871. },
  872. //以下是车牌号边输边查搜索
  873. querySearch(queryString, cb) {
  874. if (queryString.length > 3) {
  875. this.axios
  876. .post("/api/v1/uc/getCapacityByLike?index=" + queryString)
  877. .then((res) => {
  878. this.capacityList = [];
  879. if (res.data.code == "200") {
  880. if (res.data.data.length == 0) {
  881. this.$message.info("车牌号不存在,请前往注册");
  882. return;
  883. }
  884. var restaurants = res.data.data;
  885. this.capacityList = res.data.data;
  886. var results = queryString
  887. ? restaurants.filter(this.createFilter(queryString))
  888. : restaurants;
  889. // console.log("res",+results);
  890. // 调用 callback 返回建议列表的数据
  891. cb(results);
  892. }
  893. });
  894. }
  895. },
  896. createFilter(queryString) {
  897. return (restaurants) => {
  898. return (
  899. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  900. -1
  901. );
  902. };
  903. },
  904. //车牌号弹出层
  905. handleSelect(row, index) {
  906. this.capacityList.forEach((item) => {
  907. if (item.capacityNumber === row.capacityNo) {
  908. row.newsCapacityId = item.capacityId;
  909. }
  910. });
  911. },
  912. //多拼弹出层绑定车牌号
  913. handleMulSelect(row, index) {
  914. this.capacityList.forEach((item) => {
  915. if (item.capacityNumber === row.capacityNo) {
  916. this.selection.forEach((selected) => {
  917. selected.newsCapacityId = item.capacityId;
  918. selected.capacityNo = row.capacityNo;
  919. });
  920. this.newsCapacityId = item.capacityId;
  921. this.capacityNo = row.capacityNo;
  922. console.log("newCapacityId:", this.newsCapacityId);
  923. }
  924. });
  925. },
  926. // 线路弹出层
  927. handleSelectLine(row, index) {
  928. this.capacityList.forEach((item) => {
  929. if (item.lineName === row.lineName) {
  930. row.newLineId = item.lineId;
  931. }
  932. });
  933. },
  934. // 更新线路
  935. updateLine(row) {
  936. row.lineId = this.lineId;
  937. console.log("this.lineId" + this.lineId);
  938. },
  939. updateSendStation(selection, row) {
  940. let sendStation = this.sendStations.find(
  941. (item) => item.sendStationId == row.sendStationId
  942. );
  943. row.sendStation = sendStation.sendStation;
  944. console.log("sendStation", sendStation);
  945. //绑定线路id
  946. // let i = 0;
  947. // this.tableData.forEach((e) => {
  948. // if (row.group == e.group) {
  949. // i++;//得到拼数
  950. // }
  951. // });
  952. // if(row.sendStation=="达州站"){
  953. // row.lineId=this.lineDazhou[i];
  954. // }else if(row.sendStation=="专用线"){
  955. // row.lineId=this.lineZhuanxian[i];
  956. // }else{
  957. // console.log("没有该发站的线路");
  958. // }
  959. console.log("row:", row);
  960. },
  961. updateCapacity(row) {
  962. row.isIwardSteel = 4;
  963. row.saleOrderMaterialId = row.saleOrderId;
  964. if (row.newsCapacityId == null) {
  965. this.$message.warning("请先注册车牌号或者选中弹出后再提交!");
  966. return;
  967. }
  968. if (!isVehicleNumber(row.capacityNo)) {
  969. this.$message.error("请输入正确格式的车牌号!");
  970. return;
  971. }
  972. if (row.capacityIds != 0) {
  973. const loading = this.$loading({
  974. lock: true,
  975. text: "正在变更车牌号",
  976. spinner: "el-icon-loading",
  977. background: "rgba(0, 0, 0, 0.7)",
  978. });
  979. console.log("updateCapacityRow:",row);
  980. this.axios
  981. .post("/api/v1/ams/updateCapacityNumberInFactory", row)
  982. .then((res) => {
  983. if (res.data.code == "200") {
  984. this.$message.success("变更车牌号成功!");
  985. this.getSteelReport();
  986. loading.close();
  987. } else {
  988. this.$message.success("变更失败,请联系管理员");
  989. this.getSteelReport();
  990. loading.close();
  991. }
  992. })
  993. .catch(() => {
  994. this.$message.success("变更失败,请联系管理员");
  995. this.getSteelReport();
  996. loading.close();
  997. });
  998. } else {
  999. if (row.carrierIds == 0) {
  1000. this.$message.error("请先选择承运商!");
  1001. return;
  1002. }
  1003. row.driverTel = row.capacityTel;
  1004. row.capacityNumber = row.capacityNo;
  1005. let arr = [];
  1006. arr.push(row);
  1007. let map = {
  1008. sendStationId: row.sendStationId,
  1009. saleOrderId: row.saleOrderId,
  1010. mapList: arr,
  1011. };
  1012. console.log("map", map);
  1013. if(!map.saleOrderId ||
  1014. !map.sendStationId||
  1015. !map.mapList){
  1016. this.$message.warning("数据异常,请确认已选发站");
  1017. return;
  1018. }
  1019. console.log("map:",map);
  1020. const loading = this.$loading({
  1021. lock: true,
  1022. text: "正在派车",
  1023. spinner: "el-icon-loading",
  1024. background: "rgba(0, 0, 0, 0.7)",
  1025. });
  1026. this.axios
  1027. .post("/api/v1/ams/dispatchInwardTruckOrderBySale", map)
  1028. .then((res) => {
  1029. if (res.data.code == "200") {
  1030. this.$message.success("派车成功!");
  1031. this.getSteelReport();
  1032. loading.close();
  1033. } else {
  1034. this.$message.error("派车失败,请联系管理员");
  1035. this.getSteelReport();
  1036. loading.close();
  1037. }
  1038. })
  1039. .catch(() => {
  1040. this.$message.error("派车失败,请联系管理员");
  1041. this.getSteelReport();
  1042. loading.close();
  1043. });
  1044. }
  1045. },
  1046. //多拼派车
  1047. updateMulCapacity() {
  1048. this.selection.forEach((item) => {
  1049. item.isIwardSteel = 4;
  1050. item.saleOrderMaterialId = item.saleOrderId;
  1051. item.capacityId = this.capacityId;
  1052. item.capacityNumber = this.capacityNo;
  1053. });
  1054. if (this.selection[0].sendStation == "达州站") {
  1055. this.selection.forEach((item) => {
  1056. item.lineId = this.lineDazhou[this.selection.length];
  1057. item.lineName = "达州站";
  1058. });
  1059. } else if (this.selection[0].sendStation == "专用线") {
  1060. this.selection.forEach((item) => {
  1061. item.lineId = this.lineZhuanxian[this.selection.length];
  1062. item.lineName = "专用线";
  1063. });
  1064. } else {
  1065. console.log("没有该发站的线路");
  1066. }
  1067. let map = {
  1068. sendStationId: this.selection[0].sendStationId,
  1069. saleOrderId: this.selection[0].saleOrderId,
  1070. mapList: this.selection,
  1071. };
  1072. console.log("map", map);
  1073. if(!map.saleOrderId ||
  1074. !map.sendStationId||
  1075. !map.mapList){
  1076. this.$message.warning("数据异常,请确认已选发站");
  1077. return;
  1078. }
  1079. const loading = this.$loading({
  1080. lock: true,
  1081. text: "正在派车",
  1082. spinner: "el-icon-loading",
  1083. background: "rgba(0, 0, 0, 0.7)",
  1084. });
  1085. this.axios
  1086. .post("/api/v1/ams/dispatchInwardTruckOrderBySale", map)
  1087. .then((res) => {
  1088. if (res.data.code == "200") {
  1089. this.$message.success("派车成功!");
  1090. this.getSteelReport();
  1091. loading.close();
  1092. } else {
  1093. this.$message.error("派车失败,请联系管理员");
  1094. this.getSteelReport();
  1095. loading.close();
  1096. }
  1097. })
  1098. .catch(() => {
  1099. this.$message.error("派车失败,请联系管理员");
  1100. this.getSteelReport();
  1101. loading.close();
  1102. });
  1103. },
  1104. //修改司机电话号码
  1105. updateDriverTel(row) {
  1106. const loading = this.$loading({
  1107. lock: true,
  1108. text: "修改电话号码中",
  1109. spinner: "el-icon-loading",
  1110. background: "rgba(0, 0, 0, 0.7)",
  1111. });
  1112. if (row.capacityTel == null || row.capacityTel == "") {
  1113. this.$message.error("电话号码不能为空");
  1114. return;
  1115. }
  1116. this.axios
  1117. .post("/api/v1/uc/updateDriverTel", {
  1118. orderId: parseInt(row.orderId),
  1119. driverTel: row.capacityTel,
  1120. })
  1121. .then((res) => {
  1122. if (res.data.code == "200") {
  1123. this.$message.success("修改成功");
  1124. this.getSteelReport();
  1125. loading.close();
  1126. } else {
  1127. this.$message.error("修改失败");
  1128. this.getSteelReport();
  1129. loading.close();
  1130. }
  1131. })
  1132. .catch(() => {
  1133. this.$message.error("修改失败");
  1134. this.getSteelReport();
  1135. loading.close();
  1136. });
  1137. },
  1138. //关闭车辆金蝶分录
  1139. deleteEasEntryId(row) {
  1140. this.$confirm("确定关闭该车金蝶分录吗?", "提示", {
  1141. confirmButtonText: "是",
  1142. cancelButtonText: "否",
  1143. center: true,
  1144. type: "warning",
  1145. })
  1146. .then(() => {
  1147. let map = row;
  1148. map.isCloseEas = Number(0);
  1149. const loading = this.$loading({
  1150. lock: true,
  1151. text: "正在关闭车辆",
  1152. spinner: "el-icon-loading",
  1153. background: "rgba(0, 0, 0, 0.7)",
  1154. });
  1155. this.axios
  1156. .post("/api/v1/ams/updateCarAddress", map)
  1157. .then((res) => {
  1158. if (res.data.code == "200") {
  1159. this.$message.success("关闭车辆成功");
  1160. this.getSteelReport();
  1161. loading.close();
  1162. } else {
  1163. this.$message.error("关闭车辆失败");
  1164. this.getSteelReport();
  1165. loading.close();
  1166. }
  1167. })
  1168. .catch(() => {
  1169. this.$message.error("关闭车辆失败");
  1170. this.getSteelReport();
  1171. loading.close();
  1172. });
  1173. })
  1174. .catch(() => {
  1175. this.$message.info("取消关闭");
  1176. });
  1177. },
  1178. //修改承运商授权
  1179. updateTruckCarrier(row) {
  1180. if (!row.saleOrderMaterialId) {
  1181. row.saleOrderMaterialId = row.saleOrderId;
  1182. }
  1183. if (row.newCarrierId == null) {
  1184. this.$message.warning("请注册承运商或者选中弹出层之后再提交!");
  1185. this.getSteelReport();
  1186. return;
  1187. }
  1188. console.log("carrierIdRow:",row);
  1189. if (row.carrierIds != 0) {
  1190. const loading = this.$loading({
  1191. lock: true,
  1192. text: "正在修改承运商授权",
  1193. spinner: "el-icon-loading",
  1194. background: "rgba(0, 0, 0, 0.7)",
  1195. });
  1196. this.axios
  1197. .post("/api/v1/ams/updateTruckNoCarrier", row)
  1198. .then((res) => {
  1199. if (res.data.code == "200") {
  1200. this.$message.success("修改承运商授权成功");
  1201. this.getSteelReport();
  1202. loading.close();
  1203. } else {
  1204. this.$message.error("修改失败,请联系管理员!");
  1205. this.getSteelReport();
  1206. loading.close();
  1207. }
  1208. })
  1209. .catch(() => {
  1210. this.$message.error("修改失败,请联系管理员!");
  1211. this.getSteelReport();
  1212. loading.close();
  1213. });
  1214. } else {
  1215. //授权承运商
  1216. let arr = [];
  1217. arr.push(row);
  1218. const loading = this.$loading({
  1219. lock: true,
  1220. text: "正在授权承运商",
  1221. spinner: "el-icon-loading",
  1222. background: "rgba(0, 0, 0, 0.7)",
  1223. });
  1224. this.axios
  1225. .post("/api/v1/ams/dispatchToCarrier", arr)
  1226. .then((res) => {
  1227. if (res.data.code == "0") {
  1228. this.$message.success("授权承运商成功");
  1229. this.getSteelReport();
  1230. loading.close();
  1231. } else {
  1232. this.$message.error("授权失败,请联系管理员");
  1233. this.getSteelReport();
  1234. loading.close();
  1235. }
  1236. })
  1237. .catch(() => {
  1238. this.$message.error("授权失败,请联系管理员");
  1239. this.getSteelReport();
  1240. loading.close();
  1241. });
  1242. }
  1243. },
  1244. updateAddress(row) {
  1245. this.drawer = true;
  1246. this.addressRow = row;
  1247. this.province = row.addressProvince;
  1248. this.city = row.addressDistrict;
  1249. this.county = row.addressTown;
  1250. this.addressId = row.shipperAddressId;
  1251. this.getAllProvince();
  1252. this.onchangeProvince();
  1253. this.onchangeCity();
  1254. },
  1255. //获取所有省数据
  1256. getAllProvince() {
  1257. this.axios.post("/api/v1/uc/getAllProvince").then((res) => {
  1258. this.provinceList = res.data.data;
  1259. });
  1260. },
  1261. //省改变
  1262. onchangeProvince() {
  1263. this.axios
  1264. .post(
  1265. "/api/v1/uc/getDistrictByProvince?addressProvince=" +
  1266. this.province +
  1267. "&i=" +
  1268. new Date()
  1269. )
  1270. .then((res) => {
  1271. this.cityList = res.data.data;
  1272. // this.city = "";
  1273. // this.county = "";
  1274. });
  1275. },
  1276. //市改变
  1277. onchangeCity() {
  1278. this.axios
  1279. .post(
  1280. "/api/v1/uc/getTownByDistrict?addressDistrict=" +
  1281. this.city +
  1282. "&i=" +
  1283. new Date()
  1284. )
  1285. .then((res) => {
  1286. this.countyList = res.data.data;
  1287. });
  1288. },
  1289. //县(区)改变
  1290. onchangeCounty() {
  1291. let mapValue = {
  1292. addressProvince: this.province,
  1293. addressDistrict: this.city,
  1294. addressTown: this.county,
  1295. };
  1296. this.axios
  1297. .post("/api/v1/uc/getPlaceByAllAddress", mapValue)
  1298. .then((res) => {
  1299. this.addressId = res.data.data[0].addressId;
  1300. });
  1301. },
  1302. //收货地址弹出层
  1303. handleSelect1(item) {
  1304. console.log("获取所有下拉值!");
  1305. },
  1306. //以下是收货地址边输边查搜索
  1307. querySearch1(queryString, cb) {
  1308. this.axios
  1309. .post(
  1310. "/api/v1/ams/getRealAddressByLike?addressId=" +
  1311. this.addressId +
  1312. "&index=" +
  1313. queryString
  1314. )
  1315. .then((res) => {
  1316. if (res.data.code == "200") {
  1317. var restaurants = res.data.data;
  1318. var results = queryString
  1319. ? restaurants.filter(this.createFilter1(queryString))
  1320. : restaurants;
  1321. // 调用 callback 返回建议列表的数据
  1322. cb(results);
  1323. }
  1324. });
  1325. },
  1326. createFilter1(queryString) {
  1327. return (restaurants) => {
  1328. return (
  1329. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  1330. -1
  1331. );
  1332. };
  1333. },
  1334. //修改收货地址
  1335. addAddressClick() {
  1336. const loading = this.$loading({
  1337. lock: true,
  1338. text: "正在修改收货地址",
  1339. spinner: "el-icon-loading",
  1340. background: "rgba(0, 0, 0, 0.7)",
  1341. });
  1342. let map = this.addressRow;
  1343. map.isCloseEas = Number(1);
  1344. map.isNewCar = Number(1);
  1345. map.place = this.place;
  1346. map.shipperAddressId = this.addressId;
  1347. this.axios
  1348. .post("/api/v1/ams/updateCarAddress", map)
  1349. .then((res) => {
  1350. if (res.data.code == "200") {
  1351. this.$message.success("修改收货地址成功!");
  1352. this.getSteelReport();
  1353. this.drawer = false;
  1354. loading.close();
  1355. } else {
  1356. this.$message.error("修改失败,请联系管理员!");
  1357. this.getSteelReport();
  1358. this.drawer = false;
  1359. loading.close();
  1360. }
  1361. })
  1362. .catch(() => {
  1363. this.$message.error("修改失败,请联系管理员!");
  1364. this.getSteelReport();
  1365. this.drawer = false;
  1366. loading.close();
  1367. });
  1368. },
  1369. //记录每一行的合并数
  1370. getSpanArr(data) {
  1371. //每次调用方法初始化
  1372. this.spanArr = [];
  1373. for (var i = 0; i < data.length; i++) {
  1374. if (i === 0) {
  1375. this.spanArr.push(1);
  1376. data[i].group = i;
  1377. this.pos = 0;
  1378. } else {
  1379. // 判断当前元素与上一个元素是否相同
  1380. if (data[i].saleOrderId === data[i - 1].saleOrderId) {
  1381. this.spanArr[this.pos] += 1;
  1382. data[i].group = data[i - 1].group;
  1383. this.spanArr.push(0);
  1384. } else {
  1385. this.spanArr.push(1);
  1386. this.pos = i;
  1387. data[i].group = data[i - 1].group + 1;
  1388. }
  1389. }
  1390. this.totalCapacity = data[data.length - 1].group + 1;
  1391. this.totalNumber = data.reduce(function (prev, item) {
  1392. return prev + item.materialNum;
  1393. }, 0);
  1394. }
  1395. },
  1396. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  1397. if (this.columnIndexs.indexOf(columnIndex) != -1) {
  1398. const _row = this.spanArr[rowIndex];
  1399. const _col = _row > 0 ? 1 : 0;
  1400. return {
  1401. rowspan: _row,
  1402. colspan: _col,
  1403. };
  1404. }
  1405. },
  1406. //减少物资件数
  1407. updateBillOrder(row) {
  1408. const loading = this.$loading({
  1409. lock: true,
  1410. text: "修改物资件数中",
  1411. spinner: "el-icon-loading",
  1412. background: "rgba(0, 0, 0, 0.7)",
  1413. });
  1414. let map = {
  1415. materialId: row.materialId,
  1416. materialNum: row.materialNum,
  1417. };
  1418. let arr = [];
  1419. arr.push(map);
  1420. let updateMap = {
  1421. orderId: row.orderId,
  1422. saleOrderId: row.saleOrderId,
  1423. saleOrderMaterialId: row.saleOrderMaterialId,
  1424. mapList: arr,
  1425. };
  1426. this.axios
  1427. .post("/api/v1/oms/updateMaterialMes", updateMap)
  1428. .then((res) => {
  1429. if (res.data.code == "200") {
  1430. this.$message.success("修改物资数量成功");
  1431. this.getSteelReport();
  1432. loading.close();
  1433. } else {
  1434. this.$message.error("修改物资数量失败,请联系管理员");
  1435. this.getSteelReport();
  1436. loading.close();
  1437. }
  1438. })
  1439. .catch(() => {
  1440. this.$message.error("修改物资数量失败,请联系管理员");
  1441. this.getSteelReport();
  1442. loading.close();
  1443. });
  1444. },
  1445. //关闭单条分录
  1446. closeEasEntryId(row) {
  1447. console.log(row);
  1448. this.$prompt("确定关闭该条分录吗?", "警告", {
  1449. confirmButtonText: "确定",
  1450. cancelButtonText: "取消",
  1451. center: true,
  1452. inputPlaceholder: "请输入关闭理由",
  1453. })
  1454. .then(({ value }) => {
  1455. if (value != null || value != "") {
  1456. const loading = this.$loading({
  1457. lock: true,
  1458. text: "正在关闭该条分录",
  1459. spinner: "el-icon-loading",
  1460. background: "rgba(0, 0, 0, 0.7)",
  1461. });
  1462. let map = {
  1463. orderId: row.orderId,
  1464. saleOrderMaterialId: row.saleOrderMaterialId,
  1465. saleMaterialId: row.saleMaterialId,
  1466. reason: value,
  1467. number: row.saleOrderNo,
  1468. closeEntryId: row.closeEntryId,
  1469. };
  1470. this.axios
  1471. .post("/api/v1/ams/closeSteelMaterialId", map)
  1472. .then((res) => {
  1473. if (res.data.code == "200") {
  1474. this.$message.success("关闭成功");
  1475. this.getSteelReport();
  1476. loading.close();
  1477. } else {
  1478. this.$message.error("关闭失败,请联系管理员");
  1479. this.getSteelReport();
  1480. loading.close();
  1481. }
  1482. })
  1483. .catch(() => {
  1484. this.$message.error("关闭失败,请联系管理员");
  1485. this.getSteelReport();
  1486. loading.close();
  1487. });
  1488. }
  1489. })
  1490. .catch(() => {
  1491. this.$message.info("取消输入");
  1492. });
  1493. },
  1494. //查询,输入查询条件
  1495. onclick() {
  1496. let startTime = null;
  1497. let endTime = null;
  1498. let carrierSsoId = null;
  1499. let carrierName = null;
  1500. let consigneeName = null;
  1501. let capacityNo = null;
  1502. let remark = null;
  1503. let saler = null;
  1504. if (this.startTime && this.endTime) {
  1505. startTime = sjTime(this.startTime);
  1506. endTime = sjTime(this.endTime);
  1507. }
  1508. if (getCookie("orgCode") == "chengyunshang") {
  1509. carrierSsoId = getCookie("userId");
  1510. }
  1511. if (getCookie("orgCode") == "xiaoshouyewuyuan") {
  1512. saler = getCookie("loginName");
  1513. }
  1514. if (this.screen == "下单客户") {
  1515. consigneeName = this.input;
  1516. } else if (this.screen == "承运商") {
  1517. carrierName = this.input;
  1518. } else if (this.screen == "车牌号") {
  1519. capacityNo = this.input;
  1520. } else {
  1521. remark = this.input;
  1522. }
  1523. this.axios
  1524. .post(
  1525. "/api/v1/tms/getInwardSaleSteelOrder?startTime=" +
  1526. startTime +
  1527. "&endTime=" +
  1528. endTime +
  1529. "&carrierSsoId=" +
  1530. carrierSsoId +
  1531. "&i=" +
  1532. new Date() +
  1533. "&remark=" +
  1534. remark +
  1535. "&consigneeName=" +
  1536. consigneeName +
  1537. "&carrierName=" +
  1538. carrierName +
  1539. "&capacityNo=" +
  1540. capacityNo +
  1541. "&saler=" +
  1542. saler
  1543. )
  1544. .then((res) => {
  1545. this.tableData = res.data.data;
  1546. this.getSpanArr(res.data.data);
  1547. });
  1548. },
  1549. //重新获取表格数据
  1550. refresh() {
  1551. this.getSteelReport();
  1552. },
  1553. //获取钢材订单报表
  1554. getSteelReport() {
  1555. let carrierSsoId = null;
  1556. let saler = null;
  1557. if (getCookie("orgCode") == "chengyunshang") {
  1558. carrierSsoId = getCookie("userId");
  1559. }
  1560. if (getCookie("orgCode") == "xiaoshouyewuyuan") {
  1561. saler = getCookie("loginName");
  1562. }
  1563. this.axios
  1564. .post(
  1565. "/api/v1/tms/getInwardSaleSteelOrder?startTime=" +
  1566. null +
  1567. "&endTime=" +
  1568. null +
  1569. "&carrierSsoId=" +
  1570. carrierSsoId +
  1571. "&saler=" +
  1572. saler +
  1573. "&i=" +
  1574. new Date()
  1575. )
  1576. .then((res) => {
  1577. this.tableData = res.data.data;
  1578. this.getSpanArr(res.data.data);
  1579. });
  1580. },
  1581. //控制列自动撑开
  1582. flexColumnWidth(str, tableData, flag) {
  1583. // str为该列的字段名(传字符串);tableData为该表格的数据源(传变量);
  1584. // flag为可选值,可不传该参数,传参时可选'max'或'equal',默认为'max'
  1585. // flag为'max'则设置列宽适配该列中最长的内容,flag为'equal'则设置列宽适配该列中第一行内容的长度。
  1586. str = str + "";
  1587. let columnContent = "";
  1588. if (
  1589. !tableData ||
  1590. !tableData.length ||
  1591. tableData.length === 0 ||
  1592. tableData === undefined
  1593. ) {
  1594. return;
  1595. }
  1596. if (!str || !str.length || str.length === 0 || str === undefined) {
  1597. return;
  1598. }
  1599. if (flag === "equal") {
  1600. // 获取该列中第一个不为空的数据(内容)
  1601. for (let i = 0; i < tableData.length; i++) {
  1602. if (tableData[i][str].length > 0) {
  1603. columnContent = tableData[i][str] + "";
  1604. break;
  1605. }
  1606. }
  1607. } else {
  1608. // 获取该列中最长的数据(内容)
  1609. let index = 0;
  1610. for (let i = 0; i < tableData.length; i++) {
  1611. if (tableData[i][str] === null) {
  1612. // 当数据为空时跳过本次循环获取下一条数据长度
  1613. continue;
  1614. }
  1615. const now_temp = tableData[i][str] + "";
  1616. const max_temp = tableData[index][str] + "";
  1617. if (now_temp.length > max_temp.length) {
  1618. index = i;
  1619. }
  1620. }
  1621. columnContent = tableData[index][str] + "";
  1622. } // 以下分配的单位长度可根据实际需求进行调整
  1623. let flexWidth = 0;
  1624. if (columnContent != undefined) {
  1625. for (const char of columnContent) {
  1626. if ((char >= "A" && char <= "Z") || (char >= "a" && char <= "z")) {
  1627. // 如果是英文字符,为字符分配10个单位宽度
  1628. flexWidth += 10;
  1629. } else if (char >= "\u4e00" && char <= "\u9fa5") {
  1630. // 如果是中文字符,为字符分配16个单位宽度
  1631. flexWidth += 14;
  1632. } else {
  1633. // 其他种类字符,为字符分配10个单位宽度
  1634. flexWidth += 10;
  1635. }
  1636. }
  1637. }
  1638. if (flexWidth < 80) {
  1639. // 设置最小宽度
  1640. flexWidth = 80;
  1641. }
  1642. if (flexWidth > 500) {
  1643. // 设置最大宽度
  1644. flexWidth = 500;
  1645. }
  1646. return flexWidth + "px";
  1647. },
  1648. //多拼弹出层
  1649. showDialog() {
  1650. let selection = this.$refs.tableRef.selection;
  1651. console.log("selection", selection);
  1652. if (selection && selection.length > 0) {
  1653. if (
  1654. selection.find(
  1655. (item) =>
  1656. item.lineId != selection[0].lineId ||
  1657. item.saleOrderId != selection[0].saleOrderId
  1658. )
  1659. ) {
  1660. this.$message({
  1661. message: "无法生成多拼,订单或者线路不一致",
  1662. type: "warning",
  1663. });
  1664. return;
  1665. }else if(
  1666. !selection[0].sendStationId
  1667. ){
  1668. this.$message({
  1669. message: "无法生成多拼,请先选择发站",
  1670. type: "warning",
  1671. });
  1672. return;
  1673. }
  1674. this.dialogTableVisible = true;
  1675. this.selection = selection;
  1676. this.capacityNo = selection[0].capacityNo;
  1677. } else {
  1678. this.$message({
  1679. message: "请先勾选再生成多拼",
  1680. type: "warning",
  1681. });
  1682. }
  1683. },
  1684. handleSelectConsignee(item) {
  1685. this.consigneeName = item.consigneeCompanyName;
  1686. this.consigneeId = item.consigneeId;
  1687. // this.isReceiveHaveArea(this.consigneeId);
  1688. // //带出摘要
  1689. // this.axios
  1690. // .post("/api/v1/uc/getSaleArea?receiveId=" + this.consigneeId)
  1691. // .then(res => {
  1692. // this.remarks = res.data.data;
  1693. // });
  1694. // this.axios
  1695. // .post(
  1696. // "/api/v1/ams/matchingAddressRecently?receiveId=" + this.consigneeId
  1697. // )
  1698. // .then(res => {
  1699. // const place = res.data.data;
  1700. // console.log(place);
  1701. // this.saleShipperAddressName =
  1702. // place[0].addressProvince +
  1703. // place[0].addressDistrict +
  1704. // place[0].addressTown +
  1705. // place[0].place;
  1706. // this.saleShipperAddressId = place[0].shipperAddressId;
  1707. // this.addressId = place[0].shipperAddressId;
  1708. // this.place1 = place[0].place;
  1709. // this.saleMan = place[0].salerId;
  1710. // this.saleOrderConsigneeTel = place[0].saleOrderConsigneeTel;
  1711. // this.province = place[0].addressProvince;
  1712. // this.city = place[0].addressDistrict;
  1713. // this.county = place[0].addressTown;
  1714. // });
  1715. },
  1716. //以下是下单客户边输边查搜索
  1717. querySearchConsignee(queryString, cb) {
  1718. this.axios
  1719. .post("/api/v1/uc/getConsigneeByLike?index=" + queryString)
  1720. .then((res) => {
  1721. if (res.data.code == "200") {
  1722. var restaurantsConsignee = res.data.data;
  1723. var results = queryString
  1724. ? restaurantsConsignee.filter(this.createFilter1(queryString))
  1725. : restaurantsConsignee;
  1726. // 调用 callback 返回建议列表的数据
  1727. cb(results);
  1728. }
  1729. });
  1730. },
  1731. },
  1732. };
  1733. </script>
  1734. <style lang="scss" scoped>
  1735. .purchasFuelNewMonitor {
  1736. .tableTop {
  1737. margin-left: 20px;
  1738. margin-top: 20px;
  1739. }
  1740. .table {
  1741. margin-left: 20px;
  1742. margin-top: 20px;
  1743. }
  1744. .address {
  1745. .button-box {
  1746. display: flex;
  1747. justify-content: center;
  1748. align-items: center;
  1749. }
  1750. }
  1751. }
  1752. </style>