addTransportPrice.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <template>
  2. <!-- 添加汽运单价 111-->
  3. <div class="addTransportPrice">
  4. <page-title>新增</page-title>
  5. <div class="form">
  6. <div class="form_box">
  7. <dil-form :formId="287" v-model="form1" ref="from1"></dil-form>
  8. </div>
  9. <div id="liulan">
  10. <el-button type="primary" class="btn" @click="oilPriceFormulaClick">浏览</el-button>
  11. <el-button type="primary" class="btn1" @click="ondrawerOut">浏览</el-button>
  12. <!-- <el-button type="primary" class="btn1" @click="addressClick">浏览</el-button> -->
  13. </div>
  14. </div>
  15. <div class="elForm">
  16. <el-form :inline="true" class="demo-form-inline" label-width="80px">
  17. <el-button type="primary" id="cysbutton" @click="ondrawerOutcys">浏览所属承运商</el-button>
  18. </el-form>
  19. </div>
  20. <!-- 油价联动公式模态框 -->
  21. <el-drawer
  22. title="请选择油价联动公式"
  23. :visible.sync="oilPriceFormulaDrawer"
  24. :direction="direction"
  25. :before-close="handleClose"
  26. close-on-press-escape
  27. modal
  28. wrapperClosable
  29. size="70%"
  30. >
  31. <div class="selectText">
  32. <!-- <span></span> -->
  33. <el-input v-model="LineText" placeholder="请输入内容"></el-input>
  34. <el-button type="primary" @click="selectLineClick" :loading="selectLineLoading"><i class="el-icon-search"></i>查询</el-button>
  35. <el-button type="primary" @click="addoilPriceFormula">确定</el-button>
  36. </div>
  37. <div class="LineTable">
  38. <vue-scroll :ops="ops" style="width:100%;height:100%">
  39. <dilTable
  40. v-bind.sync="oilPriceFormula"
  41. @radio-change="currentRadioChange"
  42. :isKuang="isKuang"
  43. :loading="tableLoading"
  44. :drawer="oilPriceFormulaDrawer"
  45. @func="func"
  46. ></dilTable>
  47. </vue-scroll>
  48. </div>
  49. </el-drawer>
  50. <!-- 收货地址弹出框 -->
  51. <el-dialog title="收货地址" :visible.sync="drawer1" width="90%">
  52. <el-form :inline="true">
  53. <el-form-item>
  54. <label class="el-form-item__label" style="width: auto;">省</label>
  55. <el-select v-model="province" filterable placeholder="请选择" @change="onchangeProvince">
  56. <el-option v-for="item in provinceList" :key="item.id" :label="item.addressProvince" :value="item.id"></el-option>
  57. </el-select>
  58. </el-form-item>
  59. <el-form-item>
  60. <label class="el-form-item__label" style="width: auto;">市</label>
  61. <el-select v-model="city" filterable placeholder="请选择" @change="onchangeCity">
  62. <el-option v-for="item in cityList" :key="item.id" :label="item.addressDistrict" :value="item.id"></el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item>
  66. <label class="el-form-item__label" style="width: auto;">县(区)</label>
  67. <el-select v-model="county" filterable placeholder="请选择" @change="onchangeCounty">
  68. <el-option v-for="item in countyList" :key="item.id" :label="item.addressTown" :value="item.id"></el-option>
  69. </el-select>
  70. </el-form-item>
  71. <el-form-item>
  72. <label class="el-form-item__label" style="width: auto;">具体收货地址</label>
  73. <el-autocomplete
  74. class="inline-input"
  75. v-model="place"
  76. :fetch-suggestions="querySearch1"
  77. placeholder="请输入具体收货地址"
  78. :trigger-on-focus="false"
  79. @select="handleSelect1"
  80. >
  81. </el-autocomplete>
  82. </el-form-item>
  83. </el-form>
  84. <div slot="footer" class="button-box">
  85. <el-button @click="drawer1 = false">取 消</el-button>
  86. <el-button type="primary" @click="specificAddress">确定</el-button>
  87. </div>
  88. </el-dialog>
  89. <!-- 承运商模态框 -->
  90. <el-drawer
  91. title="选择承运商"
  92. :visible.sync="drawer"
  93. direction="rtl"
  94. size="40%"
  95. :show-close="false"
  96. >
  97. <el-input
  98. placeholder="请输入内容"
  99. v-model="index"
  100. style="margin-top: 10px; margin-left: 20px;width:250px"
  101. clearable
  102. >
  103. </el-input
  104. ><el-button
  105. type="primary"
  106. class="btn"
  107. @click="onclickCarrier"
  108. style="margin-left: 4px;"
  109. >
  110. <i class="el-icon-search"></i>查询
  111. </el-button>
  112. <!-- <el-button @click="open">取消</el-button> -->
  113. <el-button type="primary" @click="selectMakeSure">确定</el-button>
  114. <div class="tablecls">
  115. <!-- 查询所有的承运商 -->
  116. <dilTable
  117. v-bind.sync="carrier"
  118. @selection-change="currentRadioChangecys"
  119. :drawer="drawer"
  120. >
  121. </dilTable>
  122. </div>
  123. </el-drawer>
  124. <!-- 所属承运商表格 -->
  125. <div class="selectionTable from">
  126. <el-table
  127. :data="selectionList"
  128. border
  129. style="width: 100%"
  130. highlight-current-row
  131. >
  132. <el-table-column type="index" label="序号" width="50">
  133. </el-table-column>
  134. <el-table-column
  135. v-for="(item, i) in tableTop"
  136. :key="i"
  137. :prop="item.prop"
  138. :label="item.label"
  139. :width="item.width"
  140. align="center"
  141. show-overflow-tooltip
  142. >
  143. </el-table-column>
  144. <!-- 操作列 -->
  145. <el-table-column fixed="right" label="操作" width="100">
  146. <template slot-scope="scope">
  147. <el-button
  148. @click="deleteRow(scope.$index)"
  149. type="text"
  150. icon="el-icon-close"
  151. size="big"
  152. ></el-button>
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. </div>
  157. <div class="button_box">
  158. <el-button @click="cancel">取消</el-button>
  159. <el-button type="primary" @click="makeSure">确定</el-button>
  160. </div>
  161. </div>
  162. </template>
  163. <script>
  164. import PageTitle from "@/components/Page/Title";
  165. import { sjTime,isNumber } from "@/utils/sharedJsFile";
  166. export default {
  167. components: { PageTitle },
  168. data() {
  169. return {
  170. carrierIdArray:[],
  171. tableTop: [
  172. {
  173. prop: "carrierName",
  174. label: "承运商"
  175. }
  176. ],
  177. selectionList: [],
  178. carrierTypes:[],
  179. carrier: {
  180. requestUrl: "",
  181. selectionType: "select"
  182. },
  183. //是否显示承运商模态框
  184. drawer: false,
  185. index: "",
  186. //具体收货地址
  187. place:null,
  188. //承运商名称
  189. state: null,
  190. //承运商id
  191. carrierIds: null,
  192. //收货地址id
  193. addressId:null,
  194. //收货地址模态框数据
  195. addressDetailed :null,
  196. addres:{
  197. requestUrl:"",
  198. selectionType: "radio",
  199. },
  200. //是否打开收货地址弹出框
  201. drawer1:false,
  202. //所有省
  203. provinceList: [],
  204. //选中的省
  205. province: '',
  206. //所有市
  207. cityList: [],
  208. //选中的市
  209. city: '',
  210. //所有的县(区)
  211. countyList: [],
  212. //选中的县
  213. county: '',
  214. //是否点击查询
  215. isKuang:false,
  216. //表格加载状态
  217. tableLoading:false,
  218. //公式内容
  219. formulaString:null,
  220. //油价联动公式Id
  221. oilPriceFormulaId:null,
  222. //是否打开油价联动公式的模态窗口
  223. oilPriceFormulaDrawer:false,
  224. //油价联动公式查询条件
  225. LineText:null,
  226. //油价联动公式模态框查询按钮状态
  227. selectLineLoading:false,
  228. //油价联动公式模态窗口的数据
  229. oilPriceFormula:{
  230. requestUrl:"",
  231. selectionType: "radio",
  232. },
  233. //模态窗口的打开的方向
  234. direction: 'rtl',
  235. //表单数据
  236. form1: {
  237. shipperId:1,
  238. priceDate:new Date(),
  239. oilTypeId:10,
  240. capacityTypeId:1,
  241. type: "销售钢材"
  242. },
  243. //提交给后端的数据
  244. // map:{},
  245. ops: {
  246. vuescroll: {},
  247. scrollPanel: {},
  248. rail: {
  249. keepShow: true
  250. },
  251. bar: {
  252. hoverStyle: true,
  253. onlyShowBarOnScroll: false, //是否只有滚动的时候才显示滚动条
  254. background: "#5f9ea0",//滚动条颜色
  255. opacity: 0.8,//滚动条透明度
  256. "overflow-x": "hidden"
  257. }
  258. }
  259. };
  260. },
  261. mounted() {
  262. this.axios
  263. .post(
  264. "/api/v1/rms/getCarrierNameBySSOId?carrierSSOId=" + this.carrierUserId
  265. )
  266. .then((res) => {
  267. if (res.data.code == "200") {
  268. if (res.data.data) {
  269. this.state = res.data.data.carrierName;
  270. this.carrierIds = res.data.data.carrierId;
  271. }
  272. }
  273. });
  274. },
  275. created(){
  276. //获取所有的省
  277. this.getAllProvince();
  278. },
  279. methods: {
  280. //点击删除按钮删除当前点击的对象
  281. deleteRow(index) {
  282. this.selectionList.splice(index, 1);
  283. },
  284. ondrawerOutcys(){
  285. this.carrier.requestUrl =
  286. "/api/v1/uc/getCarrierListByLike?apiId=412&i=" + new Date();
  287. this.drawer = true;
  288. },
  289. currentRadioChangecys(selection) {
  290. this.carrierTypes=[];
  291. for (let i = 0; i < selection.length; i++) {
  292. if (this.carrierTypes.indexOf(selection[i]) === -1) {
  293. this.carrierTypes.push(selection[i]);
  294. }
  295. }
  296. console.log("this.carrierTypes "+JSON.stringify(this.carrierTypes));
  297. },
  298. //承运商确定按钮
  299. selectMakeSure() {
  300. for (let i = 0; i < this.carrierTypes.length; i++) {
  301. this.selectionList.push(this.carrierTypes[i])
  302. }
  303. this.index = null;
  304. this.drawer = false;
  305. },
  306. //模糊查询承运商
  307. onclickCarrier() {
  308. this.carrier.requestUrl =
  309. "/api/v1/uc/getCarrierListByLike?apiId=412&index=" +
  310. this.index +
  311. "&i=" +
  312. new Date();
  313. },
  314. func(res){
  315. this.selectLineLoading = false;
  316. this.isKuang = false;
  317. this.tableLoading = false;
  318. },
  319. //点击外层收货地址选择事件
  320. ondrawerOut(){
  321. this.drawer1 = true;
  322. },
  323. //获取所有省数据
  324. getAllProvince(){
  325. this.axios.post('/api/v1/uc/getAllProvince').then((res)=>{
  326. this.provinceList = res.data.data;
  327. })
  328. },
  329. //省改变
  330. onchangeProvince(){
  331. this.axios.post('/api/v1/uc/getDistrictByProvince?addressProvince='+this.province).then((res)=>{
  332. this.cityList = res.data.data;
  333. })
  334. },
  335. //市改变
  336. onchangeCity(){
  337. this.axios.post('/api/v1/uc/getTownByDistrict?addressDistrict='+this.city).then((res)=>{
  338. this.countyList = res.data.data;
  339. })
  340. },
  341. //县(区)改变
  342. onchangeCounty(){
  343. let mapValue = {
  344. addressProvince : this.province,
  345. addressDistrict : this.city,
  346. addressTown : this.county
  347. }
  348. this.axios.post('/api/v1/uc/getPlaceByAllAddress',mapValue).then((res)=>{
  349. this.addressId = res.data.data[0].addressId;
  350. })
  351. },
  352. selectLineClick(){
  353. this.tableLoading = true;
  354. this.selectLineLoading = true;
  355. this.isKuang = true;
  356. if(this.LineText){
  357. this.oilPriceFormula.requestUrl = "api/v1/uc/getOilFormula?apiId=444&con="+this.LineText;
  358. }else{
  359. this.oilPriceFormula.requestUrl = "api/v1/uc/getOilFormula?apiId=444&i=" + new Date();
  360. }
  361. },
  362. //承运商弹出层
  363. handleSelect(item) {
  364. this.carrierIds = item.carrierId;
  365. item.carrierName = this.state;
  366. },
  367. //收货地址弹出层
  368. handleSelect1(item) {
  369. console.log("获取所有下拉值!");
  370. },
  371. //以下是承运商边输边查搜索
  372. querySearch(queryString, cb) {
  373. this.axios
  374. .post("/api/v1/uc/getCarrierMesByLike?index=" + queryString)
  375. .then((res) => {
  376. if (res.data.code == "200") {
  377. var restaurants = res.data.data;
  378. var results = queryString
  379. ? restaurants.filter(this.createFilter(queryString))
  380. : restaurants;
  381. // 调用 callback 返回建议列表的数据
  382. cb(results);
  383. }
  384. });
  385. },
  386. createFilter(queryString) {
  387. return (restaurants) => {
  388. return (
  389. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  390. -1
  391. );
  392. };
  393. },
  394. //以上是承运商边输边查搜索
  395. //以下是收货地址边输边查搜索
  396. querySearch1(queryString, cb){
  397. this.axios
  398. .post("/api/v1/ams/getRealAddressByLike?addressId="+this.addressId + "&index=" + queryString)
  399. .then((res) => {
  400. if (res.data.code == "200") {
  401. console.log(res.data.data);
  402. var restaurants = res.data.data;
  403. // console.log(restaurants, "restaurants");
  404. var results = queryString
  405. ? restaurants.filter(this.createFilter1(queryString))
  406. : restaurants;
  407. // 调用 callback 返回建议列表的数据
  408. cb(results);
  409. }
  410. });
  411. },
  412. createFilter1(queryString) {
  413. return (restaurants) => {
  414. return (
  415. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  416. -1
  417. );
  418. };
  419. },
  420. //以上是收货地址边输边查搜索
  421. //选定联动公式确定
  422. addoilPriceFormula(){
  423. let mapvalue = {
  424. shipperId : this.form1.shipperId,
  425. oilPriceFormula:this.formulaString,
  426. cargonameId : this.oilPriceFormulaId,
  427. capacityTypeId : this.form1.capacityTypeId,
  428. priceValue : this.form1.priceValue,
  429. priceDate : this.form1.priceDate,
  430. addressName:this.form1.addressName,
  431. type : this.form1.type,
  432. oilpriceBase : this.form1.oilpriceBase,
  433. oilTypeId : this.form1.oilTypeId,
  434. oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
  435. }
  436. this.form1 = mapvalue;
  437. this.oilPriceFormulaDrawer = false;
  438. },
  439. currentRadioChange(val){
  440. this.formulaString = val.formulaString;
  441. this.oilPriceFormulaId = val.formulaId;
  442. },
  443. //具体地址确定
  444. specificAddress(){
  445. let mapvalue = {
  446. shipperId : this.form1.shipperId,
  447. oilPriceFormula:this.formulaString,
  448. capacityTypeId : this.form1.capacityTypeId,
  449. cargonameId : this.oilPriceFormulaId,
  450. priceValue : this.form1.priceValue,
  451. priceDate : this.form1.priceDate,
  452. addressName:this.province+this.city+this.county+this.place,
  453. type : this.form1.type,
  454. oilpriceBase : this.form1.oilpriceBase,
  455. oilTypeId : this.form1.oilTypeId,
  456. oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold
  457. }
  458. this.form1 = mapvalue;
  459. this.drawer1 = false;
  460. },
  461. //打开线路的模态窗口
  462. oilPriceFormulaClick(){
  463. this.oilPriceFormulaDrawer = true;
  464. this.oilPriceFormula.requestUrl = "/api/v1/uc/getOilFormula?apiId=444"
  465. },
  466. //模态窗口关闭时调用
  467. handleClose(){
  468. if(this.oilPriceFormulaDrawer){
  469. this.oilPriceFormulaDrawer = false;
  470. this.LineText = null;
  471. }
  472. },
  473. makeSure() {
  474. for (let i = 0; i < this.selectionList.length; i++) {
  475. this.carrierIdArray.push(this.selectionList[i].carrierId)
  476. }
  477. let mapValue={
  478. shipperId : this.form1.shipperId,
  479. carrierId : this.carrierIdArray,
  480. cargonameId : this.oilPriceFormulaId,
  481. capacityTypeId : this.form1.capacityTypeId,
  482. priceValue : this.form1.priceValue,
  483. priceDate : sjTime(this.form1.priceDate),
  484. addressId : this.addressId,
  485. type : this.form1.type,
  486. oilpriceBase : this.form1.oilpriceBase,
  487. oilTypeId : this.form1.oilTypeId,
  488. oilpriceChangeThreshold : this.form1.oilpriceChangeThreshold,
  489. place: this.place
  490. }
  491. this.axios.post("/api/v1/ams/addAmsContractTransportPrice", mapValue).then((res) => {
  492. if (res.data.code == "200") {
  493. this.$router.go(-1);
  494. }
  495. this.$message({
  496. type: "success",
  497. message: "新增运输单价成功!",
  498. });
  499. });
  500. },
  501. // 取消
  502. cancel() {
  503. this.$router.push('/transportPrice');
  504. },
  505. },
  506. };
  507. </script>
  508. <style lang='scss'>
  509. .elForm {
  510. margin-left: 38%;
  511. }
  512. .button-box{
  513. display: flex;
  514. text-align: center;
  515. align-items: center;
  516. justify-content: center;
  517. margin-top: 0.3125rem;
  518. margin-bottom: 1.25rem;
  519. }
  520. .addTransportPrice{
  521. .form{
  522. display: flex;
  523. .form_box{
  524. width: 320px;
  525. margin-left: 38%;
  526. margin-top: 30px;
  527. margin-right: 20px;
  528. .el-form{
  529. .preview-group{
  530. .el-form-item{
  531. .el-form-item__label{
  532. display: inline-block;
  533. width: 70px !important;
  534. }
  535. .el-form-item__content{
  536. .el-select{
  537. width: 250px;
  538. }
  539. .el-input{
  540. width: 250px;
  541. }
  542. }
  543. }
  544. }
  545. }
  546. }
  547. #liulan{
  548. width: 120px;
  549. margin-top: 30px;
  550. .el-button{
  551. width: 100px !important;
  552. margin-top: 14px;
  553. }
  554. .btn{
  555. margin-top: 106px;
  556. }
  557. .btn1{
  558. margin-top: 13px;
  559. margin-left: 0px;
  560. }
  561. .btn2{
  562. margin-top: 67px;
  563. }
  564. }
  565. }
  566. .button_box{
  567. margin-left: 45%;
  568. }
  569. .selectText{
  570. .el-input{
  571. width: 250px;
  572. }
  573. }
  574. .LineTable{
  575. width: 100%;
  576. height: 480px;
  577. overflow: hidden;
  578. margin-top: 10px;
  579. }
  580. }
  581. </style>
  582. <style lang='scss'>
  583. /deep/.__bar-is-vertical {
  584. right: -1px !important;
  585. }
  586. /deep/.__bar-is-horizontal {
  587. display: none !important;
  588. }
  589. </style>