addRequirement2.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  1. // 新增厂内内转需求
  2. <template>
  3. <div class="inwardRequirement">
  4. <page-title>新增需求</page-title>
  5. <div>
  6. <!-- 用车单位 -->
  7. <div class="requireUnit for">
  8. <el-form :inline="true" class="demo-form-inline" label-width="80px">
  9. <el-form-item label="用车单位">
  10. <el-autocomplete
  11. class="inline-input"
  12. v-model="requireUnitName"
  13. :fetch-suggestions="querySearchCarrier"
  14. placeholder="请输入用车单位名称"
  15. :trigger-on-focus="false"
  16. @select="handleSelectCarrier"
  17. >
  18. <template slot-scope="{ item }">
  19. <div class="name">{{ item.shipperName }}</div>
  20. </template>
  21. </el-autocomplete>
  22. </el-form-item>
  23. </el-form>
  24. </div>
  25. <div class="form-box">
  26. <dil-form :formId="377" v-model="form"></dil-form>
  27. </div>
  28. <!-- 设置装机备注 -->
  29. <div class="form-box">
  30. <label>装机备注</label>
  31. <el-select v-model="installremark" placeholder="装机必填">
  32. <el-option
  33. v-for="item in options6"
  34. :key="item.value"
  35. :label="item.label"
  36. :value="item.value"
  37. >
  38. </el-option>
  39. </el-select>
  40. </div>
  41. <div class="DueTime">
  42. <el-form :inline="true" style="margin-top: 0.5rem">
  43. <el-form-item>
  44. <el-switch
  45. v-model="isOpenDueTime"
  46. active-text="打开截止日期"
  47. inactive-text="关闭截止日期"
  48. >
  49. </el-switch>
  50. </el-form-item>
  51. <div class="chooseDueTime">
  52. <el-form-item v-if="isOpenDueTime == true">
  53. <label
  54. class="el-form-item__label"
  55. style="width: auto; margin-left: 10px"
  56. >截止日期</label
  57. >
  58. <el-date-picker
  59. v-model="DueTime"
  60. type="date"
  61. placeholder="选择日期"
  62. >
  63. </el-date-picker>
  64. </el-form-item>
  65. </div>
  66. </el-form>
  67. </div>
  68. <!--选择车辆类型-->
  69. <div class="capacity">
  70. <div class="capacityName">
  71. <el-form :inline="true" class="demo-form-inline" label-width="80px">
  72. <el-form-item label="选择车辆类型"> </el-form-item>
  73. <el-form-item>
  74. <el-input el-input v-model="capacityTypeName" disabled>
  75. </el-input>
  76. </el-form-item>
  77. <el-form-item>
  78. <el-button type="primary" @click="ondrawer(3)" class="truckBtn"
  79. >浏览</el-button
  80. >
  81. </el-form-item>
  82. </el-form>
  83. </div>
  84. <div class="drawSty">
  85. <el-drawer
  86. :visible.sync="drawer2"
  87. direction="rtl"
  88. size="40%"
  89. :show-close="false"
  90. >
  91. <el-input
  92. placeholder="请输入内容"
  93. v-model="inputCapacityType"
  94. clearable
  95. style="margin-left:20px"
  96. >
  97. </el-input
  98. ><el-button type="primary" class="btn" @click="onclickCapacity">
  99. <i class="el-icon-search"></i>查询
  100. </el-button>
  101. <div class="tablecls">
  102. <dilTable
  103. ref="options3"
  104. v-bind.sync="options3"
  105. @radio-change="selectionChange1"
  106. :drawer="aaadrawer"
  107. >
  108. </dilTable>
  109. </div>
  110. </el-drawer>
  111. </div>
  112. </div>
  113. <!-- 选择物资 -->
  114. <div class="materialDrawer">
  115. <el-form :inline="true" class="demo-form-inline" label-width="80px">
  116. <el-form-item label="选择物资"> </el-form-item>
  117. <el-form-item>
  118. <el-button type="primary" @click="ondrawer(1)" class="truckBtn"
  119. >浏览</el-button
  120. >
  121. </el-form-item>
  122. </el-form>
  123. </div>
  124. <!-- 物资和装卸点以及装卸货次序 -->
  125. <div class="swtichTop">
  126. <span class="titile">点击浏览选择物资之前请选择物资单位!</span>
  127. <div class="switch" v-if="tableData.length > 0">
  128. <el-tooltip placement="top">
  129. <div slot="content">下面表格已有数据,不能进行更改!!!</div>
  130. <el-switch
  131. v-model="value"
  132. active-text="件数"
  133. inactive-text="重量"
  134. disabled
  135. >
  136. </el-switch>
  137. </el-tooltip>
  138. </div>
  139. <div class="switch" v-else>
  140. <el-tooltip placement="top">
  141. <div slot="content">当下面表格有数据之后,将不能进行更改!!!</div>
  142. <el-switch v-model="value" active-text="件数" inactive-text="重量">
  143. </el-switch>
  144. </el-tooltip>
  145. </div>
  146. </div>
  147. <!-- 物资表格 -->
  148. <div class="truckListTable">
  149. <div class="selectionTable">
  150. <el-table
  151. :data="tableData"
  152. border
  153. style="width: 100%"
  154. highlight-current-row
  155. >
  156. <el-table-column
  157. v-for="(item, i) in tableTop"
  158. :key="i"
  159. :prop="item.prop"
  160. :label="item.label"
  161. align="center"
  162. show-overflow-tooltip
  163. >
  164. <template slot="scope" v-if="item.label !== '件数'">
  165. <span>{{ item.label }}</span>
  166. </template>
  167. <!-- 插入输入框 -->
  168. <template slot-scope="scope">
  169. <template v-if="item.slot">
  170. <!-- 装货点 -->
  171. <template
  172. v-if="item.prop == 'requirementPlatformName'"
  173. style="width: 400px"
  174. >
  175. <el-input
  176. class="textinput"
  177. v-model="scope.row.requirementPlatformName"
  178. disabled
  179. ></el-input>
  180. </template>
  181. <!-- 卸货点 -->
  182. <template v-if="item.prop == 'truckPoint1'">
  183. <el-input
  184. class="textinput"
  185. v-model="scope.row.truckPoint1"
  186. disabled
  187. ></el-input>
  188. </template>
  189. <!-- 装卸货优先级 -->
  190. <template v-if="item.prop == 'materialPriority'">
  191. <el-input
  192. class="textinput"
  193. v-model.number="scope.row.materialPriority"
  194. @input="onInputPriority(scope.row.materialPriority)"
  195. ></el-input>
  196. </template>
  197. <!-- 物资件数 -->
  198. <template v-if="item.prop == 'orderMaterialNumber'">
  199. <el-input
  200. class="textinput"
  201. v-model.number="scope.row.orderMaterialNumber"
  202. @input="onInputNumber(scope.row.orderMaterialNumber)"
  203. ></el-input>
  204. </template>
  205. <!-- 物资重量 -->
  206. <template v-if="item.prop == 'orderMaterialWeight'">
  207. <el-input
  208. v-model.number="scope.row.orderMaterialWeight"
  209. @input="onInputWeight(scope.row.orderMaterialWeight)"
  210. ></el-input>
  211. </template>
  212. </template>
  213. <template v-else>
  214. <span>{{ scope.row[item.prop] }}</span>
  215. </template>
  216. </template>
  217. </el-table-column>
  218. <!-- 操作列 -->
  219. <el-table-column fixed="right" label="操作" width="250">
  220. <template slot-scope="scope">
  221. <el-button type="primary" @click="loadPoint(scope.$index)"
  222. >装货点</el-button
  223. >
  224. <el-button type="primary" @click="unloadPoint(scope.$index)"
  225. >卸货点</el-button
  226. >
  227. <el-button
  228. @click.native.prevent="deleteRow(scope.$index, tableData)"
  229. type="text"
  230. icon="el-icon-close"
  231. size="big"
  232. ></el-button>
  233. </template>
  234. </el-table-column>
  235. </el-table>
  236. </div>
  237. </div>
  238. <!-- 物资模态框 -->
  239. <div class="drawSty">
  240. <el-drawer
  241. title="选择物资信息"
  242. :visible.sync="table"
  243. direction="rtl"
  244. size="40%"
  245. :show-close="false"
  246. :before-close="handleClose2"
  247. >
  248. <el-input placeholder="请输入内容" v-model="inputMaterial" clearable>
  249. </el-input
  250. ><el-button type="primary" class="btn" @click="onclickMaterial">
  251. <i class="el-icon-search"></i>查询
  252. </el-button>
  253. <!-- <el-button @click="open">取消</el-button> -->
  254. <!-- <el-button type="primary" @click="makeSure1">确定</el-button> -->
  255. <div class="tablecls">
  256. <!-- 查询所有的物资 -->
  257. <vue-scroll :ops="ops" style="width:100%;height:100%">
  258. <dilTable
  259. ref="materialTable"
  260. v-bind.sync="materialTable"
  261. @selection-change="selectionChange"
  262. :drawer="aaadrawer"
  263. >
  264. </dilTable>
  265. </vue-scroll>
  266. </div>
  267. </el-drawer>
  268. </div>
  269. <el-drawer
  270. :visible.sync="drawer"
  271. :direction="direction"
  272. :before-close="handleClose"
  273. size="30%"
  274. >
  275. <el-input
  276. placeholder="请输入内容"
  277. v-model="input"
  278. style="width: 250px"
  279. clearable
  280. >
  281. </el-input>
  282. <el-button
  283. type="primary"
  284. class="btn"
  285. @click="onclick(a)"
  286. style="margin-bottom: 15px"
  287. >
  288. <i class="el-icon-search"></i>查询
  289. </el-button>
  290. <div v-show="a == 2">
  291. <dilTable
  292. v-bind.sync="second1"
  293. @radio-change="currentRadioChange2"
  294. ></dilTable>
  295. </div>
  296. <div v-show="a == 3">
  297. <dilTable
  298. v-bind.sync="second1"
  299. @radio-change="currentRadioChange2"
  300. ></dilTable>
  301. </div>
  302. <div v-show="a == 4">
  303. <dilTable
  304. v-bind.sync="second1"
  305. @radio-change="currentRadioChange2"
  306. ></dilTable>
  307. </div>
  308. </el-drawer>
  309. </div>
  310. <div class="button-box">
  311. <el-button type="primary" @click="makeSure">确认新增</el-button>
  312. <el-button type="primary" @click="cancel">返回</el-button>
  313. </div>
  314. </div>
  315. </template>
  316. <script>
  317. import PageTitle from "@/components/Page/Title";
  318. import { sjTime } from "@/utils/sharedJsFile";
  319. import { getCookie } from "@/utils/util.js";
  320. import { checkTel } from "@/utils/validator.js";
  321. import returnResultVue from "../offsetSteel/truckTransport/returnResult.vue";
  322. export default {
  323. components: { PageTitle },
  324. data() {
  325. return {
  326. aaadrawer: false,
  327. disabled: false,
  328. options6: [
  329. {
  330. value: "焦化",
  331. label: "焦化"
  332. },
  333. {
  334. value: "污粉",
  335. label: "污粉"
  336. },
  337. {
  338. value: "喷煤",
  339. label: "喷煤"
  340. },
  341. {
  342. value: "溶剂",
  343. label: "溶剂"
  344. },
  345. {
  346. value: "配料",
  347. label: "配料"
  348. },
  349. {
  350. value: "二次",
  351. label: "二次"
  352. },
  353. {
  354. value: "原料",
  355. label: "原料"
  356. },
  357. {
  358. value: "烧结矿",
  359. label: "烧结矿"
  360. },
  361. {
  362. value: "打堆、装车",
  363. label: "打堆、装车"
  364. },
  365. {
  366. value: "回收废旧物资",
  367. label: "回收废旧物资"
  368. }
  369. ],
  370. installremark: "",
  371. options: [],
  372. value: "",
  373. isOpenDueTime: true,
  374. inputCapacityType: null,
  375. DueTime: null,
  376. // 件数与重量的开关
  377. value: false,
  378. //物资模态框开关
  379. drawer2: false,
  380. table: false,
  381. //物资表格表头
  382. tableTop: [
  383. {
  384. prop: "materialName",
  385. label: "物资名称",
  386. width: "140"
  387. },
  388. {
  389. prop: "requirementPlatformName",
  390. label: "装货点",
  391. slot: true,
  392. width: "140"
  393. },
  394. {
  395. prop: "truckPoint1",
  396. label: "卸货点",
  397. slot: true,
  398. width: "140"
  399. },
  400. {
  401. prop: "orderMaterialWeight",
  402. label: "重量",
  403. slot: true
  404. }
  405. ],
  406. row: {},
  407. //物资表格数据
  408. tableData: [],
  409. materialName: null,
  410. requirementPlatformName: null,
  411. materialNum: null,
  412. materialWeight: null,
  413. a: 1,
  414. index: null,
  415. direction: "rtl",
  416. input: null,
  417. requiremntUnitId: null,
  418. requirementUnloadUnitId: null,
  419. requirementPlatformId: null,
  420. truckPoint: "",
  421. materialId: null,
  422. requireUnitName: null,
  423. inputMaterial: null,
  424. inputCapacityType: null,
  425. shipperId: null,
  426. truckPoint1: "",
  427. drawer: false,
  428. selectionList1: [],
  429. form: {},
  430. capacityTypeId: "",
  431. capacityTypeName: "",
  432. whether: "",
  433. materialTable: {
  434. requestUrl: "",
  435. selectionType: "select",
  436. mapList1: []
  437. },
  438. second1: {
  439. requestUrl: "",
  440. selectionType: "radio",
  441. mapList2: []
  442. },
  443. options3: {
  444. requestUrl: "",
  445. selectionType: "radio",
  446. mapList3: []
  447. },
  448. form: {},
  449. ops: {
  450. vuescroll: {},
  451. scrollPanel: {},
  452. rail: {
  453. keepShow: true
  454. },
  455. bar: {
  456. hoverStyle: true,
  457. onlyShowBarOnScroll: false, //是否只有滚动的时候才显示滚动条
  458. background: "#5f9ea0", //滚动条颜色
  459. opacity: 0.8, //滚动条透明度
  460. "overflow-x": "hidden"
  461. }
  462. },
  463. time2:null
  464. };
  465. },
  466. computed: {
  467. requirementType() {
  468. return this.form.requirementType;
  469. }
  470. },
  471. watch: {
  472. requirementType() {
  473. if (this.form.requirementType == "计重") {
  474. this.materialTable.requestUrl =
  475. "/api/v1/uc/getInwardWeightMaterial?apiId=498&i=" + new Date();
  476. } else {
  477. this.materialTable.requestUrl =
  478. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" + new Date();
  479. }
  480. },
  481. // form: {
  482. // handler(oldVal, newVal) {
  483. // console.log(oldVal);
  484. // console.log(newVal);
  485. // },
  486. // deep: true
  487. // },
  488. value() {
  489. if (this.value) {
  490. // console.log(this.value)
  491. // console.log(this.tableTop.length)
  492. this.tableTop.splice(this.tableTop.length - 1, 1);
  493. this.tableTop.push({
  494. prop: "orderMaterialNumber",
  495. label: "件数",
  496. slot: true
  497. });
  498. } else {
  499. this.tableTop.splice(this.tableTop.length - 1, 1);
  500. this.tableTop.push({
  501. prop: "orderMaterialWeight",
  502. label: "重量",
  503. slot: true
  504. });
  505. }
  506. },
  507. table(val) {
  508. if (val) {
  509. this.aaadrawer = false;
  510. } else {
  511. this.aaadrawer = true;
  512. }
  513. }
  514. },
  515. methods: {
  516. //用车单位弹出层
  517. handleSelectCarrier(item) {
  518. this.shipperId = item.shipperId;
  519. this.requireUnitName = item.shipperName;
  520. },
  521. getUnloadRequestUrl() {
  522. this.second1.requestUrl =
  523. "/api/v1/uc/getUnloadingMesByLike?apiId=374&i=" + new Date();
  524. },
  525. //以下是用车单位边输边查搜索
  526. querySearchCarrier(queryString, cb) {
  527. this.axios
  528. .post("/api/v1/uc/getRequireUnitName?index=" + queryString)
  529. .then(res => {
  530. if (res.data.code == "200") {
  531. var restaurantsCarrier = res.data.data;
  532. // console.log(restaurantsCarrier,"restaurantsCarrier");
  533. var results = queryString
  534. ? restaurantsCarrier.filter(this.createFilterCarrier(queryString))
  535. : restaurantsCarrier;
  536. // 调用 callback 返回建议列表的数据
  537. cb(results);
  538. }
  539. });
  540. },
  541. createFilterCarrier(queryString) {
  542. return restaurantsCarrier => {
  543. return (
  544. restaurantsCarrier.shipperName
  545. .toLowerCase()
  546. .indexOf(queryString.toLowerCase()) > -1
  547. );
  548. };
  549. },
  550. // 返回选中的物资信息
  551. selectionChange(selection) {
  552. this.selectionList1 = [];
  553. this.selectionList1 = selection;
  554. },
  555. unloadPoint(index) {
  556. this.getUnloadRequestUrl();
  557. this.index = index;
  558. this.a = 3;
  559. this.drawer = true;
  560. },
  561. loadPoint(index) {
  562. this.getUnloadRequestUrl();
  563. this.index = index;
  564. this.a = 4;
  565. this.drawer = true;
  566. },
  567. //以上是用车单位边输边查搜索
  568. ondrawer(num) {
  569. if (num == 1) {
  570. this.table = true;
  571. if (this.form.requirementType == "计重") {
  572. this.materialTable.requestUrl =
  573. "/api/v1/uc/getInwardWeightMaterial?apiId=498&i=" + new Date();
  574. } else {
  575. this.materialTable.requestUrl =
  576. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" + new Date();
  577. }
  578. } else if (num == 3) {
  579. this.drawer2 = true;
  580. this.options3.requestUrl = "/api/v1/uc/getCapacityType?apiId=460";
  581. } else {
  582. this.drawer = true;
  583. }
  584. this.a = num;
  585. },
  586. handleClose(done) {
  587. done();
  588. //执行选择
  589. },
  590. handleClose2(done) {
  591. console.log(this.tableData.length);
  592. console.log("this.form.requirementType:", this.form.requirementType);
  593. if (
  594. this.tableData.length > 0 &&
  595. this.selectionList1.length > 0 &&
  596. this.form.requirementType != "倒库"
  597. ) {
  598. this.$message.warning("一个需求只允许填写一个物资");
  599. return;
  600. }
  601. if (
  602. this.selectionList1.length > 1 &&
  603. this.form.requirementType != "倒库"
  604. ) {
  605. this.$message.warning("一个需求只允许填写一个物资");
  606. return;
  607. }
  608. this.selectionList1.forEach(e => {
  609. // console.log(e.materialModel,e.materialSpecification)
  610. if (e.materialSpecification == null) {
  611. e.materialSpecification = "";
  612. }
  613. if (e.materialModel == null) {
  614. e.materialModel = "";
  615. }
  616. var addmap = {
  617. materialName:
  618. e.materialName + e.materialSpecification + e.materialModel,
  619. materialId: e.materialId
  620. };
  621. this.tableData.push(addmap);
  622. });
  623. this.selectionList1 = [];
  624. this.table = false;
  625. done();
  626. },
  627. refreshTable() {
  628. var arr = this.tableData;
  629. this.tableData = [];
  630. arr.forEach(e => {
  631. var addmap = {
  632. materialName: e.materialName,
  633. materialId: e.materialId,
  634. requirementPlatformName: e.requirementPlatformName,
  635. truckPoint1: e.truckPoint1,
  636. requirementPlatformId: e.requirementPlatformId,
  637. requirementUnloadUnitId: e.requirementUnloadUnitId,
  638. orderMaterialNumber: e.orderMaterialNumber,
  639. orderMaterialWeight: e.orderMaterialWeight,
  640. loadPointName: e.loadPointName,
  641. unloadPointName: e.unloadPointName
  642. };
  643. this.tableData.push(addmap);
  644. });
  645. },
  646. onclickMaterial() {
  647. if (this.inputMaterial == null) {
  648. this.materialTable.requestUrl =
  649. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" + new Date();
  650. } else {
  651. if (this.form.requirementType == "计重") {
  652. this.materialTable.requestUrl =
  653. "/api/v1/uc/getInwardWeightMaterial?apiId=498&i=" +
  654. new Date() +
  655. "&index=" +
  656. this.inputMaterial;
  657. } else {
  658. this.materialTable.requestUrl =
  659. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" +
  660. new Date() +
  661. "&index=" +
  662. this.inputMaterial;
  663. }
  664. }
  665. },
  666. onclickCapacity() {
  667. if (this.inputCapacityType == null) {
  668. this.options3.requestUrl = "/api/v1/uc/getCapacityType?apiId=460";
  669. } else {
  670. this.options3.requestUrl =
  671. "/api/v1/uc/getCapacityType?apiId=460&index=" +
  672. this.inputCapacityType;
  673. }
  674. },
  675. //删除行
  676. deleteRow(index, rows) {
  677. // console.log(index)
  678. // console.log("这里")
  679. rows.splice(index, 1);
  680. },
  681. // 返回主界面
  682. makeSure1() {
  683. console.log(this.tableData.length);
  684. if (
  685. this.tableData.length > 0 &&
  686. this.selectionList1.length > 0 &&
  687. this.form.requirementType != "倒库"
  688. ) {
  689. this.$message.warning("一个需求只允许填写一个物资");
  690. return;
  691. }
  692. if (
  693. this.selectionList1.length > 1 &&
  694. this.form.requirementType != "倒库"
  695. ) {
  696. this.$message.warning("一个需求只允许填写一个物资");
  697. return;
  698. }
  699. this.selectionList1.forEach(e => {
  700. // console.log(e.materialModel,e.materialSpecification)
  701. if (e.materialSpecification == null) {
  702. e.materialSpecification = "";
  703. }
  704. if (e.materialModel == null) {
  705. e.materialModel = "";
  706. }
  707. var addmap = {
  708. materialName:
  709. e.materialName + e.materialSpecification + e.materialModel,
  710. materialId: e.materialId
  711. };
  712. this.tableData.push(addmap);
  713. });
  714. this.selectionList1 = [];
  715. this.table = false;
  716. },
  717. refreshTable() {
  718. var arr = this.tableData;
  719. this.tableData = [];
  720. arr.forEach(e => {
  721. var addmap = {
  722. materialName: e.materialName,
  723. materialId: e.materialId,
  724. requirementPlatformName: e.requirementPlatformName,
  725. truckPoint1: e.truckPoint1,
  726. requirementPlatformId: e.requirementPlatformId,
  727. requirementUnloadUnitId: e.requirementUnloadUnitId,
  728. orderMaterialNumber: e.orderMaterialNumber,
  729. orderMaterialWeight: e.orderMaterialWeight,
  730. loadPointName: e.loadPointName,
  731. unloadPointName: e.unloadPointName
  732. };
  733. this.tableData.push(addmap);
  734. });
  735. },
  736. onclick(a) {
  737. if (this.input != null) {
  738. if (a == 1) {
  739. if (this.form.requirementType == "计重") {
  740. this.materialTable.requestUrl =
  741. "/api/v1/uc/getInwardWeightMaterial?apiId=498&i=" +
  742. new Date() +
  743. "&index=" +
  744. this.input;
  745. } else {
  746. this.materialTable.requestUrl =
  747. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" +
  748. new Date() +
  749. "&index=" +
  750. this.input;
  751. }
  752. this.input = null;
  753. } else {
  754. this.second1.requestUrl =
  755. "/api/v1/uc/getUnloadingMesByLike?apiId=374&index=" + this.input;
  756. this.input = null;
  757. }
  758. } else {
  759. if (this.form.requirementType == "计重") {
  760. this.materialTable.requestUrl =
  761. "/api/v1/uc/getInwardWeightMaterial?apiId=498&i=" + new Date();
  762. } else {
  763. this.materialTable.requestUrl =
  764. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" + new Date();
  765. }
  766. this.inputMaterial = null;
  767. }
  768. },
  769. currentRadioChange1(selection) {
  770. this.mapList1 = selection;
  771. // console.log(selection)
  772. if (
  773. selection.materialSpecification == null ||
  774. selection.materialModel == null
  775. ) {
  776. this.materialName = this.mapList1.materialName;
  777. } else {
  778. this.materialName =
  779. this.mapList1.materialName +
  780. selection.materialSpecification +
  781. "(" +
  782. selection.materialModel +
  783. ")";
  784. }
  785. this.materialId = selection.materialId;
  786. },
  787. selectionChange1(radio) {
  788. console.log(radio);
  789. this.capacityTypeName = radio.capacityTypeName;
  790. this.capacityTypeId = radio.capacityTypeId;
  791. this.whether = radio.whether;
  792. },
  793. currentRadioChange2(selection) {
  794. if (this.a == 2) {
  795. this.truckPoint = selection.warehouseName;
  796. this.requiremntUnitId = selection.warehouseId;
  797. } else if (this.a == 3) {
  798. // console.log(this.tableData[this.index])
  799. this.tableData[this.index].requirementUnloadUnitId =
  800. selection.warehouseId;
  801. this.tableData[this.index].unloadPointName = selection.warehouseName;
  802. this.tableData[this.index].truckPoint1 = selection.warehouseName;
  803. this.refreshTable();
  804. } else if (this.a == 4) {
  805. // console.log(this.tableData[this.index])
  806. this.tableData[this.index].requirementPlatformId =
  807. selection.warehouseId;
  808. this.tableData[this.index].loadPointName = selection.warehouseName;
  809. this.tableData[this.index].requirementPlatformName =
  810. selection.warehouseName;
  811. this.refreshTable();
  812. }
  813. },
  814. // 新增
  815. async makeSure() {
  816. // console.log(this.form.isMineral);
  817. // // 判断当前装机是否选择了装机必填
  818. // console.log("进来了");
  819. // console.log(this.whether);
  820. // console.log(this.installremark);
  821. if (this.tableData.length > 1 && this.form.requirementType != "倒库") {
  822. this.$message.warning("非倒库需求只允许填写一个物资");
  823. return;
  824. }
  825. if (this.whether == 2 && this.installremark == "") {
  826. console.log("确实进来了");
  827. this.$message.warning("请选择装机必填");
  828. return;
  829. }
  830. this.disabled = true;
  831. if (this.shipperId == null) {
  832. this.$message.error("请选择用车单位");
  833. this.disabled = false;
  834. return;
  835. }
  836. if (typeof this.form.requirementTruckTime == "undefined") {
  837. this.$message.error("请输入用车时间");
  838. this.disabled = false;
  839. return;
  840. }
  841. if (typeof this.form.transRange == "undefined") {
  842. this.$message.error("请选择运输起止范围");
  843. this.disabled = false;
  844. return;
  845. }
  846. if (typeof this.form.requirementType == "undefined") {
  847. this.$message.error("请选择需求类型");
  848. this.disabled = false;
  849. return;
  850. }
  851. if (this.tableData.length == 0) {
  852. this.$message.error("请点击浏览选择物资");
  853. this.disabled = false;
  854. return;
  855. }
  856. if (typeof this.form.requirementOverlimit != "undefined") {
  857. console.log(typeof this.form.remark == "undefined");
  858. if (typeof this.form.remark == "undefined") {
  859. this.$message.error("请填写超限备注");
  860. this.disabled = false;
  861. return;
  862. }
  863. }
  864. if (typeof this.form.Tel == "undefined") {
  865. this.$message.error("请填写联系电话");
  866. this.disabled = false;
  867. return;
  868. }
  869. var i = 0;
  870. this.tableData.forEach(e => {
  871. if (e.requirementPlatformId && e.requirementUnloadUnitId) {
  872. i++;
  873. }
  874. });
  875. if (i == 0) {
  876. this.$message.error("请选择装卸点");
  877. this.disabled = false;
  878. return;
  879. }
  880. // console.log(this.tableData)
  881. var DueTime;
  882. if (this.DueTime == null && this.isOpenDueTime == true) {
  883. this.$message.warning("截止日期必填");
  884. this.disabled = false;
  885. return;
  886. }
  887. if (this.DueTime == null) {
  888. DueTime = null;
  889. } else {
  890. // 判断当前用户填写的截止日期是否大于当前时间
  891. let date2 = new Date();
  892. if (date2.getTime() > this.DueTime.getTime()) {
  893. this.$message.warning("截止日期必须大于当前时间!");
  894. this.disabled = false;
  895. return;
  896. } else {
  897. DueTime = sjTime(this.DueTime);
  898. }
  899. }
  900. if (this.form.capacityType == undefined) {
  901. this.form.capacityType = "";
  902. }
  903. if (this.form.typeRemarks == undefined) {
  904. this.form.typeRemarks = "";
  905. }
  906. if (this.DueTime == null && this.isOpenDueTime == false) {
  907. //默认选择明天0点
  908. var dd = new Date(this.form.requirementTruckTime);
  909. dd.setDate(dd.getDate() + 1);//获取AddDayCount天后的日期
  910. dd.setHours(null);
  911. dd.setMinutes(null);
  912. dd.setSeconds(null);
  913. DueTime = sjTime(dd);
  914. }
  915. let requiremnet = {
  916. requirementEstimatedDuration: this.form.requirementEstimatedDuration,
  917. requirementOverlimit:
  918. this.form.requirementOverlimit + this.form.remark + "米",
  919. requirementTruckTime: sjTime(this.form.requirementTruckTime),
  920. requirementType: this.form.requirementType,
  921. requirementWorkContent: this.form.requirementWorkContent,
  922. requirementWorkEnvironment: this.form.requirementWorkEnvironment,
  923. requirementWorkType: this.form.requirementWorkType,
  924. requirementShipperId: this.shipperId,
  925. rangeId: this.form.transRange,
  926. // 装机备注
  927. installremark: this.installremark,
  928. // 用车截日期
  929. DueTime: DueTime,
  930. // 用车类型Id
  931. capacityTypeId: this.capacityTypeId,
  932. mapList: this.tableData,
  933. orgCode: getCookie("orgCode"),
  934. remark: this.form.Tel + this.capacityTypeName + this.form.typeRemarks
  935. };
  936. try {
  937. await this.axios
  938. .post("/api/v1/ams/addTruckRequirement", requiremnet,{timeout: 45000})
  939. .then(res => {
  940. if (res.data.code == 200) {
  941. this.$message({
  942. type: "success",
  943. message: "新增成功!"
  944. });
  945. this.$router.go(-1);
  946. } else {
  947. this.$message.error("新增失败!");
  948. this.disabled = false;
  949. }
  950. });
  951. } catch (e) {
  952. console.log(e)
  953. Message.error('网络异常,请刷新页面')
  954. }
  955. },
  956. func(res) {
  957. console.log(res);
  958. this.isKuang = false;
  959. },
  960. // 返回
  961. cancel() {
  962. this.$router.go(-1);
  963. }
  964. }
  965. };
  966. </script>
  967. <style lang="scss" scoped>
  968. .inwardRequirement {
  969. .from {
  970. display: flex;
  971. align-items: center;
  972. justify-content: center;
  973. margin-top: 5px;
  974. margin-bottom: 20px;
  975. }
  976. .drawSty {
  977. .el-input {
  978. width: 240px;
  979. }
  980. }
  981. .DueTime {
  982. display: flex;
  983. align-items: center;
  984. justify-content: center;
  985. margin-top: 5px;
  986. margin-bottom: 20px;
  987. .chooseDueTime {
  988. margin-right: 70px;
  989. }
  990. }
  991. .capacity {
  992. display: flex;
  993. text-align: center;
  994. align-items: center;
  995. justify-content: center;
  996. margin-top: 2rem;
  997. margin-bottom: 1.25rem;
  998. margin-right: 10px;
  999. }
  1000. .materialDrawer {
  1001. display: flex;
  1002. justify-content: center;
  1003. align-items: center;
  1004. .el-input {
  1005. width: 320px;
  1006. }
  1007. .el-select {
  1008. width: 320px;
  1009. }
  1010. .el-autocomplete {
  1011. width: 320px;
  1012. }
  1013. .el-form {
  1014. padding: 10px;
  1015. }
  1016. .truckBtn {
  1017. width: 320px;
  1018. }
  1019. }
  1020. .swtichTop {
  1021. display: flex;
  1022. height: 40px;
  1023. align-content: center;
  1024. justify-content: center;
  1025. padding-right: 20px;
  1026. .titile {
  1027. color: red;
  1028. font-size: 14px;
  1029. }
  1030. .switch {
  1031. margin-right: -30px;
  1032. }
  1033. }
  1034. .requireUnit {
  1035. display: flex;
  1036. justify-content: center;
  1037. align-items: center;
  1038. margin-top: 20px;
  1039. .text {
  1040. display: inline-block;
  1041. width: 170px;
  1042. text-align: right;
  1043. .input {
  1044. width: 250px;
  1045. margin-right: 90px;
  1046. }
  1047. }
  1048. }
  1049. .form-box {
  1050. display: flex;
  1051. text-align: center;
  1052. align-items: center;
  1053. justify-content: center;
  1054. margin-top: 20px;
  1055. margin-bottom: 20px;
  1056. margin-left: 10px;
  1057. ::v-deep .el-form {
  1058. display: flex;
  1059. justify-content: center;
  1060. align-items: center;
  1061. margin-right: 600px;
  1062. // margin-left: -20px;
  1063. background-color: yellow;
  1064. .preview-group {
  1065. background-color: blue;
  1066. ::v-deep .el-form-item {
  1067. background-color: blue;
  1068. .el-form-item__label {
  1069. width: 170px !important;
  1070. background-color: blue;
  1071. }
  1072. ::v-deep .el-form-item__content {
  1073. background-color: red;
  1074. width: 300px;
  1075. }
  1076. .el-input {
  1077. width: 210px !important;
  1078. }
  1079. }
  1080. }
  1081. }
  1082. }
  1083. .button-box {
  1084. display: flex;
  1085. align-items: center;
  1086. justify-content: center;
  1087. margin-top: 20px;
  1088. margin-right: 90px;
  1089. }
  1090. }
  1091. </style>
  1092. <style>
  1093. .el-drawer__body {
  1094. overflow: auto;
  1095. }
  1096. .el-drawer__container ::-webkit-scrollbar {
  1097. display: none;
  1098. }
  1099. </style>