addSaleOrder.vue 13 KB

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