addRequirement2.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. // 新增厂内内转需求
  2. <template>
  3. <div class="inwardRequirement">
  4. <page-title>新增需求</page-title>
  5. <div>
  6. <div class="material form">
  7. <el-form :inline="true" class="demo-form-inline">
  8. <el-form-item label="物资">
  9. <el-input v-model="materialName" disabled> </el-input>
  10. </el-form-item>
  11. <el-form-item>
  12. <el-button type="primary" @click="ondrawer(1)">浏览</el-button>
  13. </el-form-item>
  14. </el-form>
  15. </div>
  16. <div class="materialWeight form">
  17. <el-form :inline="true" class="demo-form-inline">
  18. <el-form-item label="物资重量">
  19. <el-input v-model="materialWeight"> </el-input>
  20. </el-form-item>
  21. </el-form>
  22. </div>
  23. <div class="materialNum form">
  24. <el-form :inline="true" class="demo-form-inline">
  25. <el-form-item label="物资数量">
  26. <el-input v-model="materialNum"></el-input>
  27. </el-form-item>
  28. </el-form>
  29. </div>
  30. <!-- 用车单位 -->
  31. <div class="requireUnit form">
  32. <el-form
  33. :inline="true"
  34. class="demo-form-inline"
  35. label-width="80px"
  36. >
  37. <el-form-item label="用车单位">
  38. <el-autocomplete
  39. class="inline-input"
  40. v-model="requireUnitName"
  41. :fetch-suggestions="querySearchCarrier"
  42. placeholder="请输入用车单位名称"
  43. :trigger-on-focus="false"
  44. @select="handleSelectCarrier"
  45. >
  46. <template slot-scope="{ item }">
  47. <div class="name">{{ item.shipperName }}</div>
  48. </template>
  49. </el-autocomplete>
  50. </el-form-item>
  51. </el-form>
  52. </div>
  53. <div class="unloadPoint form">
  54. <el-form :inline="true" class="demo-form-inline">
  55. <el-form-item label="卸车点">
  56. <el-input v-model="truckPoint1" disabled> </el-input>
  57. </el-form-item>
  58. <el-form-item>
  59. <el-button type="primary" @click="ondrawer(3)">浏览</el-button>
  60. </el-form-item>
  61. </el-form>
  62. </div>
  63. <div class="loadPoint form">
  64. <el-form :inline="true" class="demo-form-inline">
  65. <el-form-item label="装车点">
  66. <el-input v-model="requirementPlatformName" disabled> </el-input>
  67. </el-form-item>
  68. <el-form-item>
  69. <el-button type="primary" @click="ondrawer(4)">浏览</el-button>
  70. </el-form-item>
  71. </el-form>
  72. </div>
  73. <div class="form-box">
  74. <dil-form :formId="300" v-model="form"></dil-form>
  75. </div>
  76. <el-drawer
  77. :visible.sync="drawer"
  78. :direction="direction"
  79. :before-close="handleClose"
  80. size="30%"
  81. >
  82. <el-input
  83. placeholder="请输入内容"
  84. v-model="input"
  85. style="margin-top: 10px; margin-left: 10px; width: 250px"
  86. clearable
  87. >
  88. </el-input>
  89. <el-button
  90. type="primary"
  91. class="btn"
  92. @click="onclick(a)"
  93. style="margin-bottom: 15px"
  94. >
  95. <i class="el-icon-search"></i>查询
  96. </el-button>
  97. <div v-show="a == 1">
  98. <dilTable
  99. v-bind.sync="materialTable"
  100. @radio-change="currentRadioChange1"
  101. ></dilTable>
  102. </div>
  103. <div v-show="a == 2">
  104. <dilTable
  105. v-bind.sync="second1"
  106. @radio-change="currentRadioChange2"
  107. ></dilTable>
  108. </div>
  109. <div v-show="a == 3">
  110. <dilTable
  111. v-bind.sync="second1"
  112. @radio-change="currentRadioChange2"
  113. ></dilTable>
  114. </div>
  115. <div v-show="a == 4">
  116. <dilTable
  117. v-bind.sync="second1"
  118. @radio-change="currentRadioChange2"
  119. ></dilTable>
  120. </div>
  121. </el-drawer>
  122. </div>
  123. <div class="button-box">
  124. <el-button type="primary" @click="makeSure">确认新增</el-button>
  125. <el-button type="primary" @click="cancel">返回</el-button>
  126. </div>
  127. </div>
  128. </template>
  129. <script>
  130. import PageTitle from "@/components/Page/Title";
  131. import { sjTime } from "@/utils/sharedJsFile";
  132. import { getCookie } from "@/utils/util.js";
  133. export default {
  134. components: { PageTitle },
  135. data() {
  136. return {
  137. materialName: null,
  138. requirementPlatformName: null,
  139. materialNum:null,
  140. materialWeight:null,
  141. a: 1,
  142. direction: "rtl",
  143. input:null,
  144. requiremntUnitId: null,
  145. requirementUnloadUnitId: null,
  146. requirementPlatformId: null,
  147. truckPoint: "",
  148. materialId: null,
  149. requireUnitName:null,
  150. shipperId:null,
  151. truckPoint1: "",
  152. drawer: false,
  153. form: {},
  154. materialTable: {
  155. requestUrl: "",
  156. selectionType: "radio",
  157. mapList1: []
  158. },
  159. second1: {
  160. requestUrl: "/api/v1/ams/getWareHouse?apiId=251",
  161. selectionType: "radio",
  162. mapList2: []
  163. }
  164. };
  165. },
  166. methods: {
  167. //用车单位弹出层
  168. handleSelectCarrier(item){
  169. this.shipperId = item.shipperId
  170. this.requireUnitName = item.shipperName
  171. },
  172. //以下是用车单位边输边查搜索
  173. querySearchCarrier(queryString, cb) {
  174. this.axios.post('/api/v1/uc/getRequireUnitName?index='+queryString).then((res)=>{
  175. if(res.data.code == "200"){
  176. var restaurantsCarrier = res.data.data
  177. console.log(restaurantsCarrier,"restaurantsCarrier");
  178. var results = queryString ? restaurantsCarrier.filter(this.createFilterCarrier(queryString)) :restaurantsCarrier;
  179. // 调用 callback 返回建议列表的数据
  180. cb(results);
  181. }
  182. })
  183. },
  184. createFilterCarrier(queryString) {
  185. return (restaurantsCarrier) => {
  186. return (restaurantsCarrier.shipperName.toLowerCase().indexOf(queryString.toLowerCase()) > -1);
  187. };
  188. },
  189. //以上是用车单位边输边查搜索
  190. ondrawer(num) {
  191. if(num==1){
  192. this.materialTable.requestUrl = "/api/v1/uc/queryMaterialByLike?apiId=244&i=" + new Date()
  193. }
  194. this.drawer = true;
  195. this.a = num;
  196. },
  197. handleClose(done) {
  198. done();
  199. },
  200. onclick(a) {
  201. if(this.input != null){
  202. if (a == 1) {
  203. this.materialTable.requestUrl =
  204. "/api/v1/uc/queryMaterialByLike?apiId=244&index=" + this.input;
  205. this.input = null
  206. } else {
  207. this.second1.requestUrl =
  208. "/api/v1/ams/getWareHouse?apiId=251&con=" + this.input;
  209. this.input = null
  210. }
  211. }else{
  212. this.materialTable.requestUrl = "/api/v1/uc/queryMaterialByLike?apiId=244&i=" + new Date()
  213. }
  214. },
  215. currentRadioChange1(selection) {
  216. this.mapList1 = selection;
  217. console.log(selection)
  218. if(selection.materialSpecification==null||selection.materialModel==null){
  219. this.materialName = this.mapList1.materialName
  220. }else{
  221. this.materialName = this.mapList1.materialName + selection.materialSpecification + '(' + selection.materialModel + ')';
  222. }
  223. this.materialId = selection.materialId;
  224. },
  225. currentRadioChange2(selection) {
  226. this.mapList2 = selection;
  227. if (this.a == 2) {
  228. this.truckPoint = selection.wareHouseName;
  229. this.requiremntUnitId = selection.wareHouseId;
  230. } else if (this.a == 3) {
  231. this.requirementUnloadUnitId = selection.wareHouseId;
  232. this.truckPoint1 = selection.wareHouseName;
  233. } else if (this.a == 4) {
  234. this.requirementPlatformId = selection.wareHouseId;
  235. this.requirementPlatformName = selection.wareHouseName;
  236. }
  237. },
  238. // 新增
  239. makeSure() {
  240. let requiremnet = {
  241. materialId: this.materialId,
  242. materialWeight: Number(this.materialWeight),
  243. materialNumber: Number(this.materialNum),
  244. requirementEstimatedDuration: this.form.requirementEstimatedDuration,
  245. requirementOverlimit: this.form.requirementOverlimit,
  246. requirementTruckTime: sjTime(this.form.requirementTruckTime),
  247. requirementType: this.form.requirementType,
  248. requirementWorkContent: this.form.requirementWorkContent,
  249. requirementWorkEnvironment: this.form.requirementWorkEnvironment,
  250. requirementWorkType: this.form.requirementWorkType,
  251. requirementUnloadUnitId: this.requirementUnloadUnitId,
  252. requirementPlatformId: this.requirementPlatformId,
  253. requirementShipperId: this.shipperId,
  254. orgCode:getCookie("orgCode")
  255. };
  256. console.log(requiremnet);
  257. debugger
  258. this.axios
  259. .post("/api/v1/ams/addTruckRequirement", requiremnet)
  260. .then(res => {
  261. if (res.data.code == 200) {
  262. this.$message({
  263. type: "success",
  264. message: "新增成功!"
  265. });
  266. this.$router.go(-1);
  267. } else {
  268. this.$message.error("新增失败!");
  269. }
  270. });
  271. },
  272. // 返回
  273. cancel() {
  274. this.$router.go(-1);
  275. }
  276. }
  277. };
  278. </script>
  279. <style lang="scss">
  280. .inwardRequirement {
  281. .from {
  282. display: flex;
  283. align-items: center;
  284. justify-content: center;
  285. margin-top: 5px;
  286. margin-bottom: 20px;
  287. }
  288. .material {
  289. display: flex;
  290. justify-content: center;
  291. margin-top: 20px;
  292. .text {
  293. display: inline-block;
  294. width: 170px;
  295. text-align: right;
  296. }
  297. .input {
  298. width: 250px;
  299. margin-right: 20px;
  300. }
  301. }
  302. .materialWeight,
  303. .materialNum {
  304. display: flex;
  305. justify-content: center;
  306. margin-top: 20px;
  307. margin-right: 100px;
  308. .text {
  309. display: inline-block;
  310. width: 170px;
  311. text-align: right;
  312. .input {
  313. width: 250px;
  314. margin-right: 20px;
  315. }
  316. }
  317. }
  318. .requireUnit {
  319. display: flex;
  320. justify-content: center;
  321. margin-top: 20px;
  322. margin-right: 127px;
  323. .text {
  324. display: inline-block;
  325. width: 170px;
  326. text-align: right;
  327. .input {
  328. width: 250px;
  329. margin-right: 90px;
  330. }
  331. }
  332. }
  333. .loadPoint,
  334. .unloadPoint {
  335. display: flex;
  336. justify-content: center;
  337. margin-top: 20px;
  338. margin-right: 10px;
  339. .text {
  340. display: inline-block;
  341. width: 170px;
  342. text-align: right;
  343. .input {
  344. width: 250px;
  345. margin-right: 90px;
  346. }
  347. }
  348. }
  349. .form-box {
  350. display: flex;
  351. text-align: center;
  352. align-items: center;
  353. justify-content: center;
  354. margin-top: 20px;
  355. margin-bottom: 20px;
  356. margin-right: 212px;
  357. .el-form-item {
  358. display: flex;
  359. .el-form-item__label {
  360. width: 170px !important;
  361. }
  362. .el-input {
  363. width: 210px !important;
  364. }
  365. }
  366. }
  367. .button-box {
  368. display: flex;
  369. align-items: center;
  370. justify-content: center;
  371. margin-top: 20px;
  372. margin-right: 90px;
  373. }
  374. }
  375. </style>