addWagonLoad.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829
  1. <template>
  2. <!-- 万州港-达州新增装车1 -->
  3. <div class="addWagonLoad">
  4. <page-title>返回</page-title>
  5. <!-- <div class="cp">
  6. <span >车皮号:</span>
  7. <el-upload style="margin: 8px;"
  8. class="upload-excel"
  9. action=""
  10. :on-change="importExcel"
  11. :show-file-list="false"
  12. accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
  13. :auto-upload="false">
  14. <el-button type="primary">导入</el-button>
  15. </el-upload>
  16. <span >当前导入数量:{{tableData.length}}</span>
  17. </div> -->
  18. <div class="tempTable">
  19. <div class="search" style="display:flex;margin: 10px;">
  20. <el-input
  21. placeholder="请输入"
  22. value="请先导入查询,再勾选,如果查询失败,可能是港口没有出库或者已经装车"
  23. style="margin: 10px; width:38%"
  24. clearable
  25. disabled
  26. ></el-input>
  27. <!-- <el-button
  28. type="primary"
  29. class="btn"
  30. @click="searchLoadTemp()"
  31. style="margin: 10px;"
  32. >
  33. <i class="el-icon-search"></i>查询
  34. </el-button> -->
  35. <el-upload style="margin: 10px;"
  36. class="upload-excel"
  37. action=""
  38. :on-change="importExcel"
  39. :show-file-list="false"
  40. accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
  41. :auto-upload="false">
  42. <el-button type="primary">
  43. <i class="el-icon-search"></i>导入查询</el-button>
  44. <span >查询结果数量:{{tableDataReal.length}}</span>
  45. </el-upload>
  46. </div>
  47. <!-- 临时表已导入配单的车皮 -->
  48. <div class="tempTable" style="height:300px;overflow:scroll;float:left;margin-left:5px">
  49. <el-table
  50. ref="tempTable"
  51. empty-text="请先查询,再查看数据"
  52. highlight-current-row
  53. @selection-change="handleSelectionChange"
  54. @row-click="rowClick"
  55. :data="tableDataReal"
  56. :row-style="{height:'40px'}"
  57. style="width: 100%;font-size: 18px"
  58. id="domesticTable">
  59. <el-table-column
  60. type="selection"
  61. width="55">
  62. </el-table-column>
  63. <el-table-column
  64. type="index"
  65. width="50"
  66. prop="tempResultId"
  67. label="编号"
  68. align="center"
  69. fixed="left"
  70. :resizable="false">
  71. </el-table-column>
  72. <el-table-column
  73. align="center"
  74. prop="materialName"
  75. label="物资名"
  76. width="240px">
  77. </el-table-column>
  78. <el-table-column
  79. align="center"
  80. prop="foreignShipName"
  81. label="外轮船名"
  82. width="100px">
  83. </el-table-column>
  84. <el-table-column
  85. align="center"
  86. prop="wagonNo"
  87. label="车号"
  88. width="180px">
  89. </el-table-column>
  90. <el-table-column
  91. align="center"
  92. width="100px"
  93. prop="resultBillableTonnage"
  94. label="标重">
  95. </el-table-column>
  96. <el-table-column
  97. align="center"
  98. prop="updateTime"
  99. label="出库时间"
  100. width="200px">
  101. </el-table-column>
  102. </el-table>
  103. </div>
  104. </div>
  105. <!-- <div class="importedTable" style="height:300px;overflow:scroll;">
  106. <el-table
  107. highlight-current-row
  108. :data="tableData"
  109. :row-style="{height:'40px'}"
  110. style="width: 100%,font-size: 20px"
  111. id="domesticTable">
  112. <el-table-column
  113. type="index"
  114. width="50"
  115. prop="number"
  116. label="序号"
  117. align="center"
  118. fixed="left"
  119. :resizable="false">
  120. </el-table-column>
  121. <el-table-column
  122. align="center"
  123. prop="productName"
  124. label="品 名"
  125. width="240px">
  126. </el-table-column>
  127. <el-table-column
  128. align="center"
  129. prop="mineral"
  130. label="矿种"
  131. width="100px">
  132. </el-table-column>
  133. <el-table-column
  134. align="center"
  135. prop="wagonNo"
  136. label="车号"
  137. width="180px">
  138. </el-table-column>
  139. <el-table-column
  140. align="center"
  141. prop="unloadPoint"
  142. label="卸货地点"
  143. width="180px">
  144. </el-table-column>
  145. <el-table-column
  146. align="center"
  147. prop="sendStation"
  148. label="发站"
  149. width="180px">
  150. </el-table-column>
  151. <el-table-column
  152. align="center"
  153. width="180px"
  154. prop="arrivalStation"
  155. label="到站">
  156. </el-table-column>
  157. <el-table-column
  158. align="center"
  159. width="180px"
  160. prop="weight"
  161. label="标重">
  162. </el-table-column>
  163. </el-table>
  164. </div> -->
  165. <div class="right"
  166. style="margin-top:10px
  167. float:right;">
  168. <div class="form">
  169. <div class="form_box" style="">
  170. <el-form>
  171. <div class="preview-group">
  172. <el-form-item label="发站:">
  173. <el-autocomplete
  174. disabled
  175. class="inline-input"
  176. v-model="sendStation"
  177. :fetch-suggestions="querySearchSendStation"
  178. placeholder="请输入发站名称"
  179. :trigger-on-focus="false"
  180. @select="handleSelectSendStation"
  181. >
  182. <template slot-scope="{ item }">
  183. <div class="name">{{ item.arrivalName }}</div>
  184. </template>
  185. </el-autocomplete>
  186. </el-form-item>
  187. <el-form-item label="到站:">
  188. <el-select filterable v-model="arrivalStationId">
  189. <el-option v-for="item in arrivalStations" :value="item.arrivalId" :key="item.arrivalId" :label="item.arrivalName"></el-option>
  190. </el-select>
  191. <!-- <el-autocomplete
  192. class="inline-input"
  193. v-model="toTheStation"
  194. :fetch-suggestions="querySearchToTheStation"
  195. placeholder="请输入到站名称"
  196. :trigger-on-focus="false"
  197. @select="handleSelectToTheStation"
  198. >
  199. <template slot-scope="{ item }">
  200. <div class="name">{{ item.arrivalName }}</div>
  201. </template>
  202. </el-autocomplete> -->
  203. </el-form-item>
  204. </div>
  205. </el-form>
  206. <dil-form :formId="387" v-model="form1" ref="from1"></dil-form>
  207. </div>
  208. </div>
  209. <div class="button-box">
  210. <el-button @click="cancel">取消</el-button>
  211. <el-button type="primary" :loading="isLoading" @click="makeSure">确定</el-button>
  212. </div>
  213. </div>
  214. </div>
  215. </template>
  216. <script>
  217. import PageTitle from "@/components/Page/Title";
  218. import { sjTime } from "@/utils/sharedJsFile";
  219. import {getCookie} from "@/utils/util.js";
  220. export default {
  221. components: { PageTitle },
  222. data() {
  223. return {
  224. isLoading:false,
  225. list: [],
  226. form1: {},
  227. tableData:[],
  228. tableDataReal:[],
  229. selectionRow:[],
  230. input: "",
  231. value: undefined,
  232. //船名
  233. remark: null,
  234. //采购订单id
  235. purchaseOrderId: null,
  236. //物资名称
  237. materialName: null,
  238. //发货单位名称
  239. supplierName: null,
  240. //发货单位id
  241. supplierId: null,
  242. //物资id
  243. materialId: null,
  244. //是否需要打开模态窗口
  245. drawer: false,
  246. //卸货点id
  247. unloadPointId: null,
  248. //卸货点名称
  249. unloadPointName: null,
  250. //查询
  251. search1:null,
  252. search2:null,
  253. a: 1,
  254. direction: "rtl",
  255. inputText: "",
  256. sendStationId: 4,//发站id和到站id都写死了,并且赋了港口名,如果数据库id变化,要注意
  257. sendStation:"万州港",
  258. arrivalStationId:1,
  259. arrivalStations:[]
  260. };
  261. },
  262. mounted(){
  263. this.form1.resultLoadingDate=new Date();
  264. this.getArrivalStation();
  265. this.searchLoadTemp();
  266. },
  267. methods: {
  268. //发站弹出层
  269. handleSelectSendStation(item) {
  270. this.sendStationId = item.arrivalId;
  271. this.sendStation = item.arrivalName;
  272. },
  273. //以下是发站边输边查搜索
  274. querySearchSendStation(queryString, cb) {
  275. this.axios
  276. .get("/api/v1/uc/getArrivalByLike?index=" + this.sendStation)
  277. .then((res) => {
  278. if (res.data.code == "200") {
  279. var restaurantsSupplier = res.data.data;
  280. console.log(restaurantsSupplier)
  281. var results = queryString
  282. ? restaurantsSupplier.filter(
  283. this.createFilterSendStation(queryString)
  284. )
  285. : restaurantsSupplier;
  286. // 调用 callback 返回建议列表的数据
  287. cb(results);
  288. }
  289. });
  290. },
  291. //发站
  292. createFilterSendStation(queryString) {
  293. return (restaurantsSupplier) => {
  294. return (
  295. restaurantsSupplier.arrivalName
  296. .toLowerCase()
  297. .indexOf(queryString.toLowerCase()) > -1
  298. );
  299. };
  300. },
  301. //到站弹出层
  302. handleSelectToTheStation(item) {
  303. this.toTheStationId = item.arrivalId;
  304. this.toTheStation = item.arrivalName;
  305. },
  306. //以下是到站边输边查搜索
  307. querySearchToTheStation(queryString, cb) {
  308. this.axios
  309. .get("/api/v1/uc/getArrivalByLike?index=" + this.toTheStation)
  310. .then((res) => {
  311. if (res.data.code == "200") {
  312. var restaurantsSupplier = res.data.data;
  313. console.log(restaurantsSupplier)
  314. var results = queryString
  315. ? restaurantsSupplier.filter(
  316. this.createFilterToTheStation(queryString)
  317. )
  318. : restaurantsSupplier;
  319. // 调用 callback 返回建议列表的数据
  320. cb(results);
  321. }
  322. });
  323. },
  324. //到站
  325. createFilterToTheStation(queryString) {
  326. return (restaurantsSupplier) => {
  327. return (
  328. restaurantsSupplier.arrivalName
  329. .toLowerCase()
  330. .indexOf(queryString.toLowerCase()) > -1
  331. );
  332. };
  333. },
  334. // 确定
  335. makeSure() {
  336. this.isLoading=true;
  337. if (this.selectionRow.length <= 0 ||
  338. !this.sendStationId ||
  339. !this.arrivalStationId ||
  340. !this.form1.resultLoadingDate){
  341. if (this.selectionRow.length <= 0) {
  342. this.$message({
  343. type: "warning",
  344. message: "请选择车皮号!",
  345. });
  346. this.isLoading=false;
  347. return;
  348. }else{
  349. this.$message({
  350. type: "warning",
  351. message: "除备注外皆为必填!",
  352. });
  353. this.isLoading=false;
  354. return;
  355. }
  356. }
  357. let map = {
  358. wagonList:this.selectionRow,
  359. sendStationId: this.sendStationId,
  360. arrivalStationId: this.arrivalStationId,
  361. resultLoadingDate: sjTime(this.form1.resultLoadingDate),
  362. remarks: this.form1.resultRemarks,
  363. userId:getCookie("userId"),
  364. resultType:1,
  365. }
  366. console.log(map);
  367. this.axios.post('/api/v1/tms/addShipLoadResult',map).then((res)=>{
  368. console.log(res);
  369. if(res.data.code == "200"){
  370. this.$message({
  371. type: "success",
  372. message: "操作成功",
  373. });
  374. this.searchLoadTemp();
  375. }else {
  376. this.$message({
  377. type: "error",
  378. message: res.data.data,
  379. });
  380. }
  381. }).then(()=>{
  382. this.isLoading=false;
  383. });
  384. },
  385. // 取消
  386. cancel() {
  387. this.$router.go(-1);
  388. },
  389. // 导入excel
  390. importExcel(file) {
  391. let that=this;
  392. if (!file) {
  393. that.$message({
  394. message: "文件错误!",
  395. type: "warning",
  396. });
  397. return
  398. }
  399. let importData=[];
  400. var reader = new FileReader();
  401. var data=null;
  402. var workbook=null;
  403. //设置读取操作
  404. reader.onload = function (e) {
  405. console.log(e);
  406. data = e.target.result;
  407. workbook= XLSX.read(data, {
  408. type: 'binary'
  409. });
  410. console.log(workbook);
  411. let rows= XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);//只取第一页
  412. let index=1;
  413. for(index=1;index<rows.length;index++){
  414. if(typeof workbook.Sheets[workbook.SheetNames[0]]['A'+index] !='undefined'){
  415. index++;
  416. break;
  417. }
  418. }
  419. console.log('表头行数:'+index);
  420. if(index>=rows.length){
  421. that.$message({
  422. message: "文件错误!",
  423. type: "warning",
  424. });
  425. return
  426. }
  427. //校验表头
  428. if( workbook.Sheets[workbook.SheetNames[0]]['A'+index].v!='序号'
  429. || workbook.Sheets[workbook.SheetNames[0]]['B'+index].v!='发站'
  430. || workbook.Sheets[workbook.SheetNames[0]]['C'+index].v!='到站'
  431. || workbook.Sheets[workbook.SheetNames[0]]['D'+index].v!='发货日期'
  432. || workbook.Sheets[workbook.SheetNames[0]]['E'+index].v!='到货日期'
  433. || workbook.Sheets[workbook.SheetNames[0]]['F'+index].v!='卸货地点'
  434. || workbook.Sheets[workbook.SheetNames[0]]['G'+index].v!='品名'
  435. || (workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费\n吨位'
  436. && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费吨位'
  437. && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费&#10;吨位')
  438. || workbook.Sheets[workbook.SheetNames[0]]['J'+index].v!='车号'
  439. || workbook.Sheets[workbook.SheetNames[0]]['K'+index].v!='计量吨位'
  440. || workbook.Sheets[workbook.SheetNames[0]]['L'+index].v!='计费吨位合计'){
  441. if(workbook.Sheets[workbook.SheetNames[0]]['A'+index].v!='序号'){
  442. that.$message({
  443. message: "表格格式错误:序号错误",
  444. type: "warning",
  445. });
  446. }else if(workbook.Sheets[workbook.SheetNames[0]]['B'+index].v!='发站'){
  447. that.$message({
  448. message: "表格格式错误:发站错误",
  449. type: "warning",
  450. });
  451. }else if(workbook.Sheets[workbook.SheetNames[0]]['C'+index].v!='到站'){
  452. that.$message({
  453. message: "表格格式错误:到站错误",
  454. type: "warning",
  455. });
  456. }else if(workbook.Sheets[workbook.SheetNames[0]]['D'+index].v!='发货日期'){
  457. that.$message({
  458. message: "表格格式错误:发货日期错误",
  459. type: "warning",
  460. });
  461. }else if(workbook.Sheets[workbook.SheetNames[0]]['E'+index].v!='到货日期'){
  462. that.$message({
  463. message: "表格格式错误:到货日期错误",
  464. type: "warning",
  465. });
  466. }else if(workbook.Sheets[workbook.SheetNames[0]]['F'+index].v!='卸货地点'){
  467. that.$message({
  468. message: "表格格式错误:卸货地点错误",
  469. type: "warning",
  470. });
  471. }else if(workbook.Sheets[workbook.SheetNames[0]]['G'+index].v!='品名'){
  472. that.$message({
  473. message: "表格格式错误:品名错误",
  474. type: "warning",
  475. });
  476. }else if(workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费\n吨位'
  477. && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费吨位'
  478. && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费&#10;吨位'){
  479. that.$message({
  480. message: "表格格式错误:计费吨位错误",
  481. type: "warning",
  482. });
  483. }else if(workbook.Sheets[workbook.SheetNames[0]]['J'+index].v!='车号'){
  484. that.$message({
  485. message: "表格格式错误:车号错误",
  486. type: "warning",
  487. });
  488. }else if(workbook.Sheets[workbook.SheetNames[0]]['K'+index].v!='计量吨位'){
  489. that.$message({
  490. message: "表格格式错误:计量吨位错误",
  491. type: "warning",
  492. });
  493. }else if(workbook.Sheets[workbook.SheetNames[0]]['L'+index].v!='计费吨位合计'){
  494. that.$message({
  495. message: "表格格式错误:计费吨位合计错误",
  496. type: "warning",
  497. });
  498. }
  499. return;
  500. }
  501. let groupNo=1;
  502. let isLoading=true;
  503. //读取表格
  504. for(let i=index+1;i<=rows.length+1;i++){
  505. let row=workbook.Sheets[workbook.SheetNames[0]]['A'+i];
  506. if(row && typeof row.v == "number" && isLoading==false){
  507. isLoading=true;
  508. groupNo++;
  509. }else if(!row || typeof row.v != "number" && isLoading==true){
  510. isLoading=false;
  511. }
  512. if(row!='undefined' && row!=null && typeof row.v=='number'
  513. && workbook.Sheets[workbook.SheetNames[0]]['B'+i]!='undefined'
  514. && workbook.Sheets[workbook.SheetNames[0]]['B'+i]!=null
  515. && workbook.Sheets[workbook.SheetNames[0]]['C'+i]!='undefined'
  516. && workbook.Sheets[workbook.SheetNames[0]]['C'+i]!=null
  517. && workbook.Sheets[workbook.SheetNames[0]]['D'+i]!='undefined'
  518. && workbook.Sheets[workbook.SheetNames[0]]['D'+i]!=null
  519. && workbook.Sheets[workbook.SheetNames[0]]['E'+i]!='undefined'
  520. && workbook.Sheets[workbook.SheetNames[0]]['E'+i]!=null
  521. && workbook.Sheets[workbook.SheetNames[0]]['F'+i]!='undefined'
  522. && workbook.Sheets[workbook.SheetNames[0]]['F'+i]!=null
  523. && workbook.Sheets[workbook.SheetNames[0]]['G'+i]!='undefined'
  524. && workbook.Sheets[workbook.SheetNames[0]]['G'+i]!=null
  525. && workbook.Sheets[workbook.SheetNames[0]]['J'+i]!='undefined'
  526. && workbook.Sheets[workbook.SheetNames[0]]['J'+i]!=null){
  527. let tableRow={
  528. sendStation:workbook.Sheets[workbook.SheetNames[0]]['B'+i].v,
  529. arrivalStation:workbook.Sheets[workbook.SheetNames[0]]['C'+i].v,
  530. sendDate: that.formatDate(workbook.Sheets[workbook.SheetNames[0]]["D" + i].v),
  531. arrivalDate: that.formatDate(workbook.Sheets[workbook.SheetNames[0]]["E" + i].v),
  532. unloadPoint:workbook.Sheets[workbook.SheetNames[0]]['F'+i].v,
  533. productName:workbook.Sheets[workbook.SheetNames[0]]['G'+i].v,
  534. wagonNo:workbook.Sheets[workbook.SheetNames[0]]['J'+i].v,
  535. weight:workbook.Sheets[workbook.SheetNames[0]]['I'+i].v,
  536. mineral:workbook.Sheets[workbook.SheetNames[0]]['H'+i].v,
  537. groupNo:groupNo
  538. }
  539. if((tableRow.wagonNo+"").length!=7){
  540. that.$message({
  541. message: "存在车皮号长度不等于7:"+tableRow.wagonNo,
  542. type: "warning",
  543. });
  544. continue;
  545. }
  546. importData.push(tableRow);
  547. }
  548. }
  549. console.log("importData",importData);
  550. if(importData.length<=0){
  551. that.$message({
  552. message:"Excel没有可用数据",
  553. type:"warning"
  554. });
  555. return;
  556. }else if(that.tableData.length<=0){
  557. that.$message({
  558. message:"数据库没有可用数据",
  559. type:"warning "
  560. })
  561. return;
  562. }
  563. //批量查询
  564. let tableData=[];
  565. importData.forEach((row)=>{
  566. let temp=that.tableData.find(item=>item.wagonNo==row.wagonNo
  567. && row.productName.includes(item.foreignShipName));
  568. if(temp){
  569. temp.sendDate=row.sendDate;
  570. temp.arrivalDate=row.arrivalDate;
  571. temp.groupNo=row.groupNo;
  572. tableData.push(temp);
  573. }
  574. });
  575. that.tableDataReal=tableData;
  576. if(tableData.length<=0){
  577. that.$confirm('查询不到相关车皮!')
  578. .then(_ => {
  579. done();
  580. });
  581. }else if(tableData.length<importData.length){
  582. that.$confirm("共"+(importData.length-tableData.length)+"条车皮查询失败!")
  583. .then(_ => {
  584. done();
  585. });
  586. }else{
  587. that.$message({
  588. message: "查询成功!",
  589. type: "success",
  590. });
  591. }
  592. };
  593. reader.readAsBinaryString(file.raw); //以二进制方式读取
  594. },
  595. //采购订单表格选中
  596. orderChange(selection){
  597. console.log(selection);
  598. this.purchaseOrderId=selection.purchaseOrderId;
  599. this.form1 = {
  600. purchaseOrderNo: selection.purchaseOrderNo,
  601. resultLoadingDate:new Date()
  602. };
  603. this.materialId=selection.materialId;
  604. this.materialName=selection.materialName;
  605. this.supplierId=selection.supplierId;
  606. this.supplierName=selection.supplierName;
  607. },
  608. //查询临时表
  609. searchLoadTemp(){
  610. this.tableDataReal=[];
  611. this.axios.post('/api/v1/tms/getResultType?apiId=58&resultType=1&con='+this.input).then((res)=>{
  612. console.log("temp:",res.data.data);
  613. if(res.data.code == "200"){
  614. this.tableData=res.data.data;
  615. }else {
  616. this.$message({
  617. type: "error",
  618. message: res.data.data,
  619. });
  620. }
  621. })
  622. },
  623. //查询到站
  624. getArrivalStation(){
  625. this.axios.get("/api/v1/uc/getArrivalByLike?index="+this.input).then((res)=>{
  626. if(res.data.code == "200"){
  627. this.arrivalStations=res.data.data;
  628. }else {
  629. this.$message({
  630. type: "error",
  631. message: res.data.data,
  632. });
  633. }
  634. console.log("到站列表:",this.arrivalStations);
  635. })
  636. },
  637. //点击行勾选
  638. rowClick(row, column, event) {
  639. let tempTable = this.$refs.tempTable; // 获取表格对象
  640. //判断是否已存在
  641. let findRow = this.selectionRow.find(item => item.wagonNo == row.wagonNo);
  642. if (findRow) {
  643. tempTable.toggleRowSelection(row, false);
  644. }else{
  645. tempTable.toggleRowSelection(row);
  646. }
  647. //赋值
  648. this.selectionRow=this.$refs.tempTable.selection;
  649. },
  650. handleSelectionChange(rows) {
  651. this.selectionRow = rows //保存已选择行
  652. console.log(this.selectionRow);
  653. },
  654. formatDate(numb, format) {
  655. const time = new Date((numb - 1) * 24 * 3600000 + 1)
  656. time.setYear(time.getFullYear() - 70)
  657. const year = time.getFullYear() + ''
  658. const month = time.getMonth() + 1 + ''
  659. const date = time.getDate() + ''
  660. if (format && format.length === 1) {
  661. return year + format + month + format + date
  662. }
  663. return year + '年' + (month < 10 ? '0' + month : month)+ '月' + (date < 10 ? '0' + date : date) + '日'
  664. },
  665. },
  666. };
  667. </script>
  668. <style lang='scss'>
  669. .addWagonLoad {
  670. color: #606266;
  671. font-size: 0.675rem;
  672. font-weight: 500;
  673. .cp {
  674. width: 49%;
  675. display: flex;
  676. justify-content: center;
  677. align-items: center;
  678. padding-top: 0.625rem;
  679. padding-bottom: 0.625rem;
  680. margin-left: 364px;
  681. .cp_title {
  682. .cp_top {
  683. width: 3.125rem;
  684. padding-right: 1.55rem;
  685. }
  686. }
  687. }
  688. .cpList {
  689. display: flex;
  690. justify-content: center;
  691. width: 100%;
  692. height: 10rem;
  693. .list {
  694. width: 45%;
  695. border: #000 0.0625rem solid;
  696. padding: 0.625rem;
  697. display: flex;
  698. flex-wrap: wrap;
  699. .cpList1 {
  700. background-color: #c9c7c7;
  701. height: 1.875rem;
  702. margin-right: 0.5rem;
  703. padding: 0.625rem;
  704. display: flex;
  705. align-items: center;
  706. justify-content: center;
  707. position: relative;
  708. .itu {
  709. position: absolute;
  710. top: -0.125rem;
  711. right: 0.0625rem;
  712. width: 0.625rem;
  713. height: 0.625rem;
  714. }
  715. }
  716. }
  717. }
  718. .matching {
  719. width: 100%;
  720. height: 3.125rem;
  721. display: flex;
  722. justify-content: center;
  723. align-items: center;
  724. .text {
  725. width: 8.75rem;
  726. }
  727. .span {
  728. display: inline-block;
  729. width: 310px;
  730. height: 0.0625rem;
  731. }
  732. }
  733. .material {
  734. display: flex;
  735. justify-content: center;
  736. align-items: center;
  737. height: 3.75rem;
  738. margin-left: 27rem;
  739. width: 20rem;
  740. .text {
  741. text-align: right;
  742. width: 8.125rem;
  743. }
  744. }
  745. .forwardingUnit {
  746. display: flex;
  747. justify-content: center;
  748. align-items: center;
  749. height: 3.75rem;
  750. margin-left: 27rem;
  751. width: 20rem;
  752. .text {
  753. text-align: right;
  754. width: 8.125rem;
  755. }
  756. }
  757. .remark {
  758. display: flex;
  759. justify-content: center;
  760. align-items: center;
  761. height: 3.75rem;
  762. .text {
  763. text-align: right;
  764. width: 5.625rem;
  765. }
  766. .span {
  767. display: inline-block;
  768. width: 1.875rem;
  769. height: 1.25rem;
  770. }
  771. .el-input{
  772. width: 13.5rem;
  773. margin-right: 2.375rem;
  774. }
  775. }
  776. .purchaseOrder {
  777. display: flex;
  778. justify-content: center;
  779. align-items: center;
  780. .span {
  781. display: inline-block;
  782. width: 1.875rem;
  783. height: 0.0625rem;
  784. }
  785. }
  786. .form {
  787. display: flex;
  788. .form_box {
  789. width: 340px;
  790. margin-left: 30px;
  791. margin-right: 20px;
  792. .el-form {
  793. .preview-group {
  794. .el-form-item {
  795. .el-form-item__label {
  796. display: inline-block;
  797. width: 70px !important;
  798. }
  799. .el-form-item__content {
  800. .el-select {
  801. width: 250px;
  802. }
  803. .el-input {
  804. width: 250px;
  805. }
  806. .el-textarea{
  807. .el-textarea__inner{
  808. width: 225px;
  809. margin-top: 0.03rem;
  810. }
  811. }
  812. }
  813. }
  814. }
  815. }
  816. }
  817. }
  818. .button-box {
  819. display: flex;
  820. justify-content: center;
  821. padding-top: 10px;
  822. }
  823. .formOther .el-input__inner{
  824. width: 250px;
  825. }
  826. }
  827. </style>