addRequirement.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. // 新增采购内转需求
  2. <template>
  3. <div class="addInwardRequirement">
  4. <page-title>新增需求</page-title>
  5. <div class="form-box f2">
  6. <el-form
  7. :inline="true"
  8. class="demo-form-inline"
  9. :label-position="left"
  10. label-width="80px"
  11. >
  12. <el-form-item label="采购订单号">
  13. <el-input v-model="purchaseOrder" placeholder="必填" disabled>
  14. </el-input>
  15. </el-form-item>
  16. <el-form-item>
  17. <el-button type="primary" @click="ondrawer(1)">浏览</el-button>
  18. </el-form-item>
  19. </el-form>
  20. <el-form
  21. :inline="true"
  22. class="demo-form-inline"
  23. :label-position="left"
  24. label-width="80px"
  25. >
  26. <el-form-item label="外轮船名" class="tx">
  27. <el-input v-model="foreignShipName" disabled></el-input>
  28. </el-form-item>
  29. </el-form>
  30. <el-form
  31. :inline="true"
  32. class="demo-form-inline"
  33. :label-position="left"
  34. label-width="80px"
  35. >
  36. <el-form-item label="发货单位" class="tx">
  37. <el-input v-model="supplierName" disabled></el-input>
  38. </el-form-item>
  39. </el-form>
  40. <el-form
  41. :inline="true"
  42. class="demo-form-inline"
  43. :label-position="left"
  44. label-width="80px"
  45. >
  46. <el-form-item label="收货单位" class="tx">
  47. <el-input v-model="shipperName" disabled></el-input>
  48. </el-form-item>
  49. </el-form>
  50. <el-form
  51. :inline="true"
  52. class="demo-form-inline"
  53. :label-position="left"
  54. label-width="80px"
  55. >
  56. <el-form-item label="物资名称" class="tx">
  57. <el-input v-model="materialName" disabled></el-input>
  58. </el-form-item>
  59. </el-form>
  60. <el-form
  61. :inline="true"
  62. class="demo-form-inline"
  63. :label-position="left"
  64. label-width="80px"
  65. >
  66. <el-form-item label="装车点">
  67. <el-input v-model="truckPoint" placeholder="必填" disabled>
  68. </el-input>
  69. </el-form-item>
  70. <el-form-item>
  71. <el-button type="primary" @click="ondrawer(2)">浏览</el-button>
  72. </el-form-item>
  73. </el-form>
  74. <el-form
  75. :inline="true"
  76. class="demo-form-inline"
  77. :label-position="left"
  78. label-width="80px"
  79. >
  80. <el-form-item label="卸车点">
  81. <el-input v-model="truckPoint1" placeholder="必填" disabled>
  82. </el-input>
  83. </el-form-item>
  84. <el-form-item>
  85. <el-button type="primary" @click="ondrawer(3)">浏览</el-button>
  86. </el-form-item>
  87. </el-form>
  88. </div>
  89. <el-drawer
  90. :visible.sync="drawer"
  91. :direction="direction"
  92. :before-close="handleClose"
  93. size="30%"
  94. >
  95. <el-input
  96. placeholder="请输入内容"
  97. v-model="input"
  98. style="margin-top: 10px ;width:50%"
  99. clearable
  100. >
  101. </el-input>
  102. <el-button
  103. type="primary"
  104. class="btn"
  105. @click="onclick(a)"
  106. style="margin-bottom: 15px"
  107. >
  108. <i class="el-icon-search"></i>查询
  109. </el-button>
  110. <div v-show="a == 1">
  111. <dilTable
  112. v-bind.sync="second"
  113. @radio-change="currentRadioChange1"
  114. ></dilTable>
  115. </div>
  116. <div v-show="a == 2">
  117. <dilTable
  118. v-bind.sync="second1"
  119. @radio-change="currentRadioChange2"
  120. ></dilTable>
  121. </div>
  122. <div v-show="a == 3">
  123. <dilTable
  124. v-bind.sync="second2"
  125. @radio-change="currentRadioChange3"
  126. ></dilTable>
  127. </div>
  128. <div v-show="a == 4">
  129. <dilTable
  130. v-bind.sync="second3"
  131. @radio-change="currentRadioChange4"
  132. ></dilTable>
  133. </div>
  134. </el-drawer>
  135. <div class="box-form">
  136. <dil-form :formId="300" v-model="form"></dil-form>
  137. </div>
  138. <div class="button-box">
  139. <el-button type="primary" @click="makeSure">确认新增</el-button>
  140. <el-button type="primary" @click="cancel">返回</el-button>
  141. </div>
  142. </div>
  143. </template>
  144. <script>
  145. import PageTitle from "@/components/Page/Title";
  146. import { sjTime } from "@/utils/sharedJsFile";
  147. export default {
  148. components: { PageTitle },
  149. data() {
  150. return {
  151. purchaseOrder: null,
  152. foreignShipName: null,
  153. materialName: null,
  154. shipperName: null,
  155. supplierName: null,
  156. a: 1,
  157. direction: "rtl",
  158. input: "",
  159. truckPoint: null,
  160. truckPoint1: null,
  161. drawer: false,
  162. form: {},
  163. second: {
  164. requestUrl: "/api/v1/ams/getPurchaseIdByBatch?apiId=252",
  165. selectionType: "radio",
  166. mapList1: []
  167. },
  168. second1: {
  169. requestUrl: "/api/v1/ams/getWareHouse?apiId=251",
  170. selectionType: "radio",
  171. mapList2: []
  172. },
  173. second2: {
  174. requestUrl: "/api/v1/ams/getWareHouse?apiId=251",
  175. selectionType: "radio",
  176. mapList3: []
  177. },
  178. second3: {
  179. requestUrl: "/api/v1/ams/getWareHouse?apiId=251",
  180. selectionType: "radio",
  181. mapList4: []
  182. }
  183. };
  184. },
  185. methods: {
  186. ondrawer(num) {
  187. this.drawer = true;
  188. this.a = num;
  189. },
  190. handleClose(done) {
  191. done();
  192. },
  193. onclick(a) {
  194. if (a == 1) {
  195. console.log(a);
  196. this.second.requestUrl =
  197. "/api/v1/ams/getPurchaseIdByBatch?apiId=252&con=" + this.input;
  198. } else {
  199. if (this.input == "") {
  200. this.second1.requestUrl = "/api/v1/ams/getWareHouse?apiId=251";
  201. } else {
  202. this.second1.requestUrl =
  203. "/api/v1/ams/getWareHouse?apiId=251&con=" + this.input;
  204. }
  205. }
  206. },
  207. currentRadioChange1(selection) {
  208. this.mapList1 = selection;
  209. this.purchaseOrder = this.mapList1.purchaseOrderNo;
  210. this.foreignShipName = this.mapList1.resultForeignShipName;
  211. this.supplierName = this.mapList1.supplierName;
  212. this.shipperName = this.mapList1.shipperName;
  213. this.materialName = this.mapList1.materialName;
  214. },
  215. currentRadioChange2(selection) {
  216. this.mapList2 = selection;
  217. console.log(this.mapList2);
  218. if (this.mapList2.companyBranchName == null) {
  219. this.mapList2.companyBranchName = "";
  220. }
  221. if (this.mapList2.branchFactory == null) {
  222. this.mapList2.branchFactory = "";
  223. }
  224. if (this.mapList2.wareHouseName == null) {
  225. this.mapList2.wareHouseName = "";
  226. }
  227. this.truckPoint =
  228. this.mapList2.companyBranchName +
  229. this.mapList2.branchFactory +
  230. this.mapList2.wareHouseName;
  231. },
  232. currentRadioChange3(selection) {
  233. this.mapList3 = selection;
  234. console.log(selection);
  235. if (this.mapList3.companyBranchName == null) {
  236. this.mapList3.companyBranchName = "";
  237. }
  238. if (this.mapList3.branchFactory == null) {
  239. this.mapList3.branchFactory = "";
  240. }
  241. if (this.mapList3.wareHouseName == null) {
  242. this.mapList3.wareHouseName = "";
  243. }
  244. this.truckPoint1 =
  245. this.mapList3.companyBranchName +
  246. this.mapList3.branchFactory +
  247. this.mapList3.wareHouseName;
  248. },
  249. // 新增
  250. makeSure() {
  251. if (this.purchaseOrder == null) {
  252. this.$alert("没有选择采购订单,请点击浏览选择采购订单!");
  253. return;
  254. } else if (this.truckPoint == null) {
  255. this.$alert("没有选择装车点,请点击浏览选择装车点!");
  256. return;
  257. } else if (this.truckPoint1 == null) {
  258. this.$alert("没有选择卸货点,请点击浏览选择卸货点!");
  259. return;
  260. } else if (typeof this.form.materialWeight == "undefined") {
  261. this.$alert("没有输入物资重量,请输入!");
  262. return;
  263. } else if (typeof this.form.requirementType == "undefined") {
  264. this.$alert("没有选择需求类型,请选择!");
  265. return;
  266. } else if (typeof this.form.requirementTruckTime == "undefined") {
  267. this.$alert("没有选择用车时间,请选择!");
  268. return;
  269. } else if (typeof this.form.requirementShipperId == "undefined") {
  270. this.$alert("没有选择用车单位,请选择!");
  271. return;
  272. } else if (typeof this.form.requirementWorkType == "undefined") {
  273. this.$alert("没有选择费用类别,请选择!");
  274. return;
  275. } else if (typeof this.form.requirementEstimatedDuration == "undefined") {
  276. this.$alert("没有输入预计作业时长,请输入!");
  277. return;
  278. }
  279. let requiremnet = {
  280. purchaseOrderId: this.mapList1.purchaseOrderId,
  281. requiremntUnitId: this.mapList2.wareHouseId,
  282. materialWeight: this.form.materialWeight,
  283. requirementEstimatedDuration: this.form.requirementEstimatedDuration,
  284. requirementOverlimit: this.form.requirementOverlimit,
  285. requirementShipperId: this.form.requirementShipperId,
  286. requirementTruckTime: sjTime(this.form.requirementTruckTime),
  287. requirementType: this.form.requirementType,
  288. requirementWorkContent: this.form.requirementWorkContent,
  289. requirementWorkEnvironment: this.form.requirementWorkEnvironment,
  290. requirementWorkType: this.form.requirementWorkType,
  291. requirementUnloadUnitId: this.mapList3.wareHouseId
  292. };
  293. this.axios
  294. .post("/api/v1/ams/addTruckRequirement", requiremnet)
  295. .then(res => {
  296. if (res.data.code == 200) {
  297. this.$message({
  298. type: "success",
  299. message: "新增成功!"
  300. });
  301. this.$router.go(-1);
  302. } else {
  303. this.$message.error("新增失败!");
  304. }
  305. });
  306. },
  307. // 返回
  308. cancel() {
  309. this.$router.go(-1);
  310. }
  311. }
  312. };
  313. </script>
  314. <style lang="scss" scoped>
  315. .addInwardRequirement{
  316. .form-box {
  317. display: inline-block !important;
  318. margin-left: 38% !important;
  319. .el-input {
  320. width: 288px;
  321. }
  322. .el-form {
  323. padding: 10px;
  324. }
  325. .tx{
  326. margin-left: -75px;
  327. }
  328. }
  329. .box-form {
  330. display: flex ;
  331. padding-left: 38%;
  332. .el-form-item {
  333. display: flex !important;
  334. padding: 10px;
  335. .el-form-item__label {
  336. width: 80px !important;
  337. }
  338. .el-input {
  339. width: 288px;
  340. }
  341. }
  342. }
  343. .button-box {
  344. margin-left: 25px !important;
  345. }
  346. }
  347. </style>