addRequirement2.vue 34 KB

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