saleTruckOrder.vue 53 KB

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