addSaleOrderArrange.vue 14 KB

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