addSaleOrderSend.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <template>
  2. <!-- 添加销售订单排车 -->
  3. <div class="addSalePlan">
  4. <page-title>新增销售订单派车</page-title>
  5. <div>
  6. <el-tabs v-model="activeName" >
  7. <dilTable ref="tab" v-bind.sync="option">
  8. </dilTable>
  9. </el-tabs>
  10. </div>
  11. <el-form :inline="true" style="margin-top: 2rem;">
  12. <el-form-item>
  13. <label class="el-form-item__label" style="width: auto;margin-left: 2rem;">物资名称:</label>
  14. <el-select v-model="materials" placeholder="请选择">
  15. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item>
  19. <div class="lineId">
  20. <div class="materialId">
  21. <label class="el-form-item__label" style="width: auto;margin-left: 2rem;">承运商:</label>
  22. <el-input class="input" v-model="carrierName" disabled> </el-input>
  23. <el-button type="primary" class="btn" @click="table2 = true">浏览</el-button>
  24. </div>
  25. </div>
  26. </el-form-item>
  27. <el-form-item>
  28. <div class="lineId">
  29. <div class="materialId">
  30. <label class="el-form-item__label" style="width: auto;margin-left: 2rem;">选择路线:</label>
  31. <el-input class="input" v-model="lineName" disabled> </el-input>
  32. <el-button type="primary" class="btn" @click="table1 = true">浏览</el-button>
  33. </div>
  34. </div>
  35. </el-form-item>
  36. </el-form>
  37. <!-- 承运商模态框 -->
  38. <el-drawer
  39. title="选择承运商"
  40. :visible.sync="table2"
  41. direction="rtl"
  42. size="35%"
  43. :show-close="false"
  44. >
  45. <el-input placeholder="请输入内容" v-model="index"
  46. style="margin-top: 10px; margin-left: 20px;width:160px" clearable> </el-input
  47. ><el-button type="primary" class="btn" @click="onclick" style="margin-left: 4px;">
  48. <i class="el-icon-search"></i>查询
  49. </el-button>
  50. <div class="tablecls">
  51. <!-- 查询所有的承运商 -->
  52. <dilTable v-bind.sync="carrier" @radio-change="currentRadioChange2">
  53. </dilTable>
  54. </div>
  55. </el-drawer>
  56. <!-- 选择路线模态窗口 -->
  57. <el-drawer
  58. title="选择路线"
  59. :visible.sync="table1"
  60. direction="rtl"
  61. size="50%"
  62. :show-close="false"
  63. >
  64. <el-input placeholder="请输入内容" v-model="input"
  65. style="margin-top: 10px; margin-left: 20px;width:160px" clearable> </el-input
  66. ><el-button type="primary" class="btn" @click="onclick1" style="margin-left: 4px;">
  67. <i class="el-icon-search"></i>查询
  68. </el-button>
  69. <div class="tablecls">
  70. <!-- 查询所有的路线 -->
  71. <dilTable
  72. v-bind.sync="line" @radio-change="currentRadioChange5"
  73. ></dilTable>
  74. </div>
  75. </el-drawer>
  76. <!-- 选择新增条数及确认按钮 -->
  77. <div class="lineId">
  78. <div class="materialId">
  79. <label class="el-form-item__label" style="width: auto;margin-left: 2rem;margin-top: 0.3rem;">派车数:</label>
  80. <el-input class="input1" v-model="carCount"> </el-input>
  81. <el-button type="primary" class="btn" @click="makeSure1">确认分派</el-button>
  82. </div>
  83. </div>
  84. <!-- 派车表格 -->
  85. <div class="selectionTable from">
  86. <el-table :data="selectionList" border style="width: 100%" highlight-current-row>
  87. <el-table-column v-for="(item, i) in tableTop" :key="i" :prop="item.prop" :label="item.label" :width="item.width" align="center"
  88. show-overflow-tooltip>
  89. <template slot="scope" v-if="item.label !== '重量'">
  90. <span>{{ item.label }}</span>
  91. </template>
  92. <template slot="scope" v-if="item.label !== '车牌号'">
  93. <span>{{ item.label }}</span>
  94. </template>
  95. <template slot="scope" v-if="item.label !== '收货地址'">
  96. <span>{{ item.label }}</span>
  97. </template>
  98. <template slot="scope" v-if="item.label !== '收货日期'">
  99. <span>{{ item.label }}</span>
  100. </template>
  101. <template slot="scope" v-if="item.label !== '收货姓名'">
  102. <span>{{ item.label }}</span>
  103. </template>
  104. <template slot="scope" v-if="item.label !== '收货方电话'">
  105. <span>{{ item.label }}</span>
  106. </template>
  107. <!-- 插入输入框 -->
  108. <template slot-scope="scope">
  109. <template v-if="item.slot">
  110. <!-- 车牌号 -->
  111. <template v-if="item.prop == 'capacityNumber'">
  112. <el-input
  113. class="textinput1"
  114. v-model.number="scope.row.capacityNumber"
  115. ></el-input>
  116. </template>
  117. <!-- 物资重量 -->
  118. <template v-if="item.prop == 'orderPlanWeight'">
  119. <el-input
  120. class="textinput"
  121. v-model.number="scope.row.orderPlanWeight"
  122. ></el-input>
  123. </template>
  124. <!-- 收货地址id -->
  125. <template style="width: 400px" v-if="item.prop == 'saleShipperAddressName'">
  126. <el-input style="width: 200px" v-model="scope.row.saleShipperAddressName" disabled>
  127. </el-input>
  128. <el-button type="primary" @click="ondrawer(scope.row,scope.$index)"
  129. >浏览</el-button
  130. >
  131. </template>
  132. <!-- 收货日期 -->
  133. <template v-if="item.prop == 'saleDateOfReceipt'">
  134. <el-date-picker
  135. class="textinput3"
  136. type="date"
  137. v-model.number="scope.row.saleDateOfReceipt"
  138. ></el-date-picker>
  139. </template>
  140. <!-- 收货客户 -->
  141. <template v-if="item.prop == 'saleOrderConsignee'">
  142. <el-input
  143. class="textinput4"
  144. v-model.number="scope.row.saleOrderConsignee"
  145. ></el-input>
  146. </template>
  147. <!-- 收货客户电话号码 -->
  148. <template v-if="item.prop == 'saleOrderConsigneeTel'">
  149. <el-input
  150. class="textinput5"
  151. v-model.number="scope.row.saleOrderConsigneeTel"
  152. ></el-input>
  153. </template>
  154. </template>
  155. <template v-else>
  156. <span>{{ scope.row[item.prop] }}</span>
  157. </template>
  158. </template>
  159. </el-table-column>
  160. <!-- 操作列 -->
  161. <el-table-column fixed="right" label="操作" width="100">
  162. <template slot-scope="scope">
  163. <el-button
  164. @click.native.prevent="deleteRow(scope.$index, selectionList)"
  165. type="text"
  166. icon="el-icon-close"
  167. size="big"
  168. ></el-button>
  169. </template>
  170. </el-table-column>
  171. </el-table>
  172. </div>
  173. <el-drawer
  174. :visible.sync="drawer"
  175. :direction="direction"
  176. :close-on-press-escape="true"
  177. :show-close="true"
  178. :wrapperClosable="true"
  179. modal
  180. size="30%"
  181. >
  182. <el-input
  183. placeholder="请输入内容"
  184. v-model="textInput"
  185. style="margin-top: 10px; margin-left: 20px;width: 200px"
  186. clearable
  187. >
  188. </el-input>
  189. <el-button
  190. type="primary"
  191. class="btn"
  192. @click="onclick1()"
  193. style="margin-bottom: 15px"
  194. >
  195. <i class="el-icon-search"></i>查询
  196. </el-button>
  197. <dilTable
  198. v-bind.sync="frist"
  199. @radio-change="currentRadioChange1"
  200. ></dilTable>
  201. </el-drawer>
  202. <div class="button-box">
  203. <el-button @click="cancel">取消</el-button>
  204. <el-button type="primary" @click="makeSure">确定</el-button>
  205. </div>
  206. </div>
  207. </template>
  208. <script>
  209. import PageTitle from "@/components/Page/Title";
  210. export default {
  211. components: { PageTitle },
  212. data() {
  213. return {
  214. materials: "",
  215. //线路
  216. table1: false,
  217. lineName:"",
  218. line: {
  219. requestUrl: "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3",
  220. selectionType: "radio",
  221. },
  222. //承运商
  223. table2: false,
  224. carrierName: "",
  225. carrier: {
  226. requestUrl: "/api/v1/uc/getCarrierListByLike?apiId=412",
  227. selectionType: "radio",
  228. },
  229. //新增车数
  230. carCount: 1,
  231. textInput: "",
  232. input: "",
  233. //销售订单物资信息
  234. option: {
  235. // 表格请求数据的地址
  236. requestUrl: "/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=" + this.$route.params.saleOrderId,
  237. },
  238. table: false,
  239. //表格数据lists
  240. selectionList: [],
  241. //表格新增lists
  242. selectionList1: [],
  243. drawer: false,
  244. direction: "rtl",
  245. form1: {},
  246. value: false,
  247. frist: {
  248. requestUrl: "/api/v1/ams/getAddressDeliveryAddress?apiId=255",
  249. selectionType: "radio",
  250. mapList: [],
  251. },
  252. options: [
  253. {
  254. values: "yes",
  255. label: "是",
  256. },
  257. {
  258. values: "no",
  259. label: "否",
  260. },
  261. ],
  262. values: "yes",
  263. tableTop: [
  264. {
  265. prop: "capacityNumber",
  266. label: "车牌号",
  267. slot: true,
  268. },
  269. {
  270. prop: "materialName",
  271. label: "物资名称",
  272. width: "140",
  273. },
  274. {
  275. prop: "carrierName",
  276. label: "承运商",
  277. width: "120",
  278. },
  279. {
  280. prop: "lineName",
  281. label: "运输线路",
  282. width: "140",
  283. },
  284. {
  285. prop: "orderPlanWeight",
  286. label: "重量",
  287. slot: true,
  288. },
  289. {
  290. prop: "saleShipperAddressName",
  291. label: "收货地址",
  292. width: "300",
  293. slot: true,
  294. },
  295. {
  296. prop: "saleDateOfReceipt",
  297. label: "收货日期",
  298. width: "110",
  299. slot: true,
  300. },
  301. {
  302. prop: "saleOrderConsignee",
  303. label: "收货客户",
  304. slot: true,
  305. },
  306. {
  307. prop: "saleOrderConsigneeTel",
  308. label: "收货客户电话号码",
  309. slot: true,
  310. },
  311. ],
  312. row: {},
  313. };
  314. },
  315. watch: {
  316. },
  317. methods: {
  318. currentRadioChange2(selectoin){
  319. console.log("selectoin",selectoin)
  320. this.carrierName = selectoin.carrierName;
  321. },
  322. currentRadioChange5(selection) {
  323. this.lineName = selection.lineName;
  324. // this.lineId = selection.lineId;
  325. },
  326. // 确认新增一列或多列派车行
  327. // makeSure1() {
  328. // console.log("this.option[0].saleMaterialId",this.option)
  329. // for(var i=0;i<this.carCount;i++){
  330. // var addmap = {
  331. // capacityNumber : null,
  332. // materialName : this.materials,
  333. // carrierName : this.carrierName,
  334. // lineName : this.lineName,
  335. // orderPlanWeight : null,
  336. // saleShipperAddressId: null,
  337. // saleShipperAddressName:null,
  338. // saleDateOfReceipt: null,
  339. // saleOrderConsignee: null,
  340. // saleOrderConsigneeTel: null,
  341. // }
  342. // this.selectionList.push(addmap);
  343. // }
  344. // },
  345. //删除派车列
  346. deleteRow(index, rows) {
  347. rows.splice(index, 1);
  348. },
  349. //点击浏览事件
  350. ondrawer(row,index) {
  351. this.row = row;
  352. this.row.index = index;
  353. this.drawer = true;
  354. },
  355. //监听模态框点击事件
  356. currentRadioChange1(radioList) {
  357. this.selectionList[this.row.index].saleShipperAddressId = radioList.addressId;
  358. this.selectionList[this.row.index].saleShipperAddressName = radioList.address;
  359. },
  360. //收货地址模态框查询
  361. onclick1() {
  362. this.option.requestUrl =
  363. "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=" + this.textInput;
  364. },
  365. //物资模态框查询
  366. // 框计算
  367. onclick() {
  368. this.option.requestUrl =
  369. "/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=" + this.$route.params.saleOrderId;
  370. },
  371. open() {
  372. if (this.selectionList1.length != 0) {
  373. this.$confirm("取消会将已选择的数据清空, 是否继续?", "提示", {
  374. confirmButtonText: "确定",
  375. cancelButtonText: "取消",
  376. type: "warning",
  377. })
  378. .then(() => {
  379. this.selectionList1 = [];
  380. this.table = false;
  381. })
  382. .catch(() => {});
  383. } else {
  384. this.table = false;
  385. }
  386. },
  387. // 确定
  388. makeSure() {
  389. //初始化maplist
  390. var mapList = [];
  391. console.log("this.selectionList",this.selectionList)
  392. this.selectionList.forEach((item,i) => {
  393. //初始化mapItem
  394. var mapItem={
  395. //销售订单id
  396. saleOrderId : 0,
  397. //车序号
  398. truckNo : "",
  399. //收货地址id
  400. shippingAddressId : 0,
  401. //收货日期
  402. dateOfReceipt :null,
  403. //收货方姓名
  404. orderConsignee :"",
  405. //收货方电话
  406. orderConsigneeTel :"",
  407. //车序号物资ID
  408. saleMaterialId : 0,
  409. //物资数量
  410. materialNumber : 0,
  411. };
  412. mapItem.saleOrderId=this.$route.params.saleOrderId;
  413. mapItem.truckNo=item.cxh;
  414. mapItem.shippingAddressId=item.saleShipperAddressId;
  415. mapItem.dateOfReceipt=item.saleDateOfReceipt;
  416. mapItem.orderConsignee=item.saleOrderConsignee;
  417. mapItem.orderConsigneeTel=item.saleOrderConsigneeTel;
  418. mapItem.saleMaterialId=item.saleMaterialId;
  419. mapItem.materialNumber=item.orderPlanWeight;
  420. mapList.push(mapItem);
  421. });
  422. // console.log("mapList",mapList);
  423. this.axios.post("/api/v1/ams/addTruckNo", mapList).then((res) => {
  424. if (res.data.code == "200") {
  425. this.$router.go(-1);
  426. }
  427. this.$message({
  428. type: "success",
  429. message: "新增车序号成功!",
  430. });
  431. });
  432. },
  433. // 取消
  434. cancel() {
  435. this.$router.go(-1);
  436. },
  437. //关闭事件
  438. handleClose(done) {
  439. this.$confirm("确认关闭?")
  440. .then((_) => {
  441. done();
  442. })
  443. .catch((_) => {});
  444. },
  445. CloseClick() {},
  446. },
  447. };
  448. </script>
  449. <style lang='scss' scoped>
  450. .addSalePlan{
  451. width: 100%;
  452. }
  453. .switch{
  454. margin-left: 60rem;
  455. }
  456. .lineId {
  457. display: flex;
  458. justify-content: center;
  459. margin-left: 2rem;
  460. .text {
  461. display: inline-block;
  462. width: 170px;
  463. text-align: right;
  464. }
  465. .input{
  466. width: 250px;
  467. margin-right: 20px;
  468. }
  469. .input1{
  470. width: 60px;
  471. margin-right: 20px;
  472. }
  473. }
  474. .form-box,
  475. .from {
  476. display: flex;
  477. align-items: center;
  478. justify-content: center;
  479. margin-top: 5px;
  480. margin-bottom: 20px;
  481. }
  482. .button-box{
  483. display: flex;
  484. text-align: center;
  485. align-items: center;
  486. justify-content: center;
  487. margin-top: 0.3125rem;
  488. margin-bottom: 1.25rem;
  489. }
  490. .select {
  491. margin-left: 2rem;
  492. }
  493. .makeSureAdd{
  494. width: 100px;
  495. margin-left: 3.5rem;
  496. margin-top: 0.3rem;
  497. align-items: center;
  498. justify-content: center;
  499. text-align: center;
  500. display: flex;
  501. }
  502. .demo-form-inline {
  503. margin-left: 2rem;
  504. }
  505. .table_form {
  506. margin-left: -16rem;
  507. }
  508. .textinput {
  509. width: 50px;
  510. }
  511. .textinput1 {
  512. width: 50px;
  513. text-align: center;
  514. size: small;
  515. }
  516. .textinput2 {
  517. width: 50px;
  518. margin-right: 30px;
  519. }
  520. .textinput3 {
  521. width: 270px;
  522. }
  523. .textinput4 {
  524. width: 60px;
  525. }
  526. .textinput5 {
  527. width: 120px;
  528. }
  529. </style>