addRequirement2.vue 31 KB

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