addRequirement2.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  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. <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. };
  464. },
  465. computed: {
  466. requirementType() {
  467. return this.form.requirementType;
  468. }
  469. },
  470. watch: {
  471. requirementType() {
  472. if (this.form.requirementType == "计重") {
  473. this.materialTable.requestUrl =
  474. "/api/v1/uc/getInwardWeightMaterial?apiId=498&i=" + new Date();
  475. } else {
  476. this.materialTable.requestUrl =
  477. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" + new Date();
  478. }
  479. },
  480. // form: {
  481. // handler(oldVal, newVal) {
  482. // console.log(oldVal);
  483. // console.log(newVal);
  484. // },
  485. // deep: true
  486. // },
  487. value() {
  488. if (this.value) {
  489. // console.log(this.value)
  490. // console.log(this.tableTop.length)
  491. this.tableTop.splice(this.tableTop.length - 1, 1);
  492. this.tableTop.push({
  493. prop: "orderMaterialNumber",
  494. label: "件数",
  495. slot: true
  496. });
  497. } else {
  498. this.tableTop.splice(this.tableTop.length - 1, 1);
  499. this.tableTop.push({
  500. prop: "orderMaterialWeight",
  501. label: "重量",
  502. slot: true
  503. });
  504. }
  505. },
  506. table(val) {
  507. if (val) {
  508. this.aaadrawer = false;
  509. } else {
  510. this.aaadrawer = true;
  511. }
  512. }
  513. },
  514. methods: {
  515. //用车单位弹出层
  516. handleSelectCarrier(item) {
  517. this.shipperId = item.shipperId;
  518. this.requireUnitName = item.shipperName;
  519. },
  520. getUnloadRequestUrl() {
  521. this.second1.requestUrl =
  522. "/api/v1/uc/getUnloadingMesByLike?apiId=374&i=" + new Date();
  523. },
  524. //以下是用车单位边输边查搜索
  525. querySearchCarrier(queryString, cb) {
  526. this.axios
  527. .post("/api/v1/uc/getRequireUnitName?index=" + queryString)
  528. .then(res => {
  529. if (res.data.code == "200") {
  530. var restaurantsCarrier = res.data.data;
  531. // console.log(restaurantsCarrier,"restaurantsCarrier");
  532. var results = queryString
  533. ? restaurantsCarrier.filter(this.createFilterCarrier(queryString))
  534. : restaurantsCarrier;
  535. // 调用 callback 返回建议列表的数据
  536. cb(results);
  537. }
  538. });
  539. },
  540. createFilterCarrier(queryString) {
  541. return restaurantsCarrier => {
  542. return (
  543. restaurantsCarrier.shipperName
  544. .toLowerCase()
  545. .indexOf(queryString.toLowerCase()) > -1
  546. );
  547. };
  548. },
  549. // 返回选中的物资信息
  550. selectionChange(selection) {
  551. this.selectionList1 = [];
  552. this.selectionList1 = selection;
  553. },
  554. unloadPoint(index) {
  555. this.getUnloadRequestUrl();
  556. this.index = index;
  557. this.a = 3;
  558. this.drawer = true;
  559. },
  560. loadPoint(index) {
  561. this.getUnloadRequestUrl();
  562. this.index = index;
  563. this.a = 4;
  564. this.drawer = true;
  565. },
  566. //以上是用车单位边输边查搜索
  567. ondrawer(num) {
  568. if (num == 1) {
  569. this.table = true;
  570. if (this.form.requirementType == "计重") {
  571. this.materialTable.requestUrl =
  572. "/api/v1/uc/getInwardWeightMaterial?apiId=498&i=" + new Date();
  573. } else {
  574. this.materialTable.requestUrl =
  575. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" + new Date();
  576. }
  577. } else if (num == 3) {
  578. this.drawer2 = true;
  579. this.options3.requestUrl = "/api/v1/uc/getCapacityType?apiId=460";
  580. } else {
  581. this.drawer = true;
  582. }
  583. this.a = num;
  584. },
  585. handleClose(done) {
  586. done();
  587. //执行选择
  588. },
  589. handleClose2(done) {
  590. console.log(this.tableData.length);
  591. console.log("this.form.requirementType:", this.form.requirementType);
  592. if (
  593. this.tableData.length > 0 &&
  594. this.selectionList1.length > 0 &&
  595. this.form.requirementType != "倒库"
  596. ) {
  597. this.$message.warning("一个需求只允许填写一个物资");
  598. return;
  599. }
  600. if (
  601. this.selectionList1.length > 1 &&
  602. this.form.requirementType != "倒库"
  603. ) {
  604. this.$message.warning("一个需求只允许填写一个物资");
  605. return;
  606. }
  607. this.selectionList1.forEach(e => {
  608. // console.log(e.materialModel,e.materialSpecification)
  609. if (e.materialSpecification == null) {
  610. e.materialSpecification = "";
  611. }
  612. if (e.materialModel == null) {
  613. e.materialModel = "";
  614. }
  615. var addmap = {
  616. materialName:
  617. e.materialName + e.materialSpecification + e.materialModel,
  618. materialId: e.materialId
  619. };
  620. this.tableData.push(addmap);
  621. });
  622. this.selectionList1 = [];
  623. this.table = false;
  624. done();
  625. },
  626. refreshTable() {
  627. var arr = this.tableData;
  628. this.tableData = [];
  629. arr.forEach(e => {
  630. var addmap = {
  631. materialName: e.materialName,
  632. materialId: e.materialId,
  633. requirementPlatformName: e.requirementPlatformName,
  634. truckPoint1: e.truckPoint1,
  635. requirementPlatformId: e.requirementPlatformId,
  636. requirementUnloadUnitId: e.requirementUnloadUnitId,
  637. orderMaterialNumber: e.orderMaterialNumber,
  638. orderMaterialWeight: e.orderMaterialWeight,
  639. loadPointName: e.loadPointName,
  640. unloadPointName: e.unloadPointName
  641. };
  642. this.tableData.push(addmap);
  643. });
  644. },
  645. onclickMaterial() {
  646. if (this.inputMaterial == null) {
  647. this.materialTable.requestUrl =
  648. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" + new Date();
  649. } else {
  650. if (this.form.requirementType == "计重") {
  651. this.materialTable.requestUrl =
  652. "/api/v1/uc/getInwardWeightMaterial?apiId=498&i=" +
  653. new Date() +
  654. "&index=" +
  655. this.inputMaterial;
  656. } else {
  657. this.materialTable.requestUrl =
  658. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" +
  659. new Date() +
  660. "&index=" +
  661. this.inputMaterial;
  662. }
  663. }
  664. },
  665. onclickCapacity() {
  666. if (this.inputCapacityType == null) {
  667. this.options3.requestUrl = "/api/v1/uc/getCapacityType?apiId=460";
  668. } else {
  669. this.options3.requestUrl =
  670. "/api/v1/uc/getCapacityType?apiId=460&index=" +
  671. this.inputCapacityType;
  672. }
  673. },
  674. //删除行
  675. deleteRow(index, rows) {
  676. // console.log(index)
  677. // console.log("这里")
  678. rows.splice(index, 1);
  679. },
  680. // 返回主界面
  681. makeSure1() {
  682. console.log(this.tableData.length);
  683. if (
  684. this.tableData.length > 0 &&
  685. this.selectionList1.length > 0 &&
  686. this.form.requirementType != "倒库"
  687. ) {
  688. this.$message.warning("一个需求只允许填写一个物资");
  689. return;
  690. }
  691. if (
  692. this.selectionList1.length > 1 &&
  693. this.form.requirementType != "倒库"
  694. ) {
  695. this.$message.warning("一个需求只允许填写一个物资");
  696. return;
  697. }
  698. this.selectionList1.forEach(e => {
  699. // console.log(e.materialModel,e.materialSpecification)
  700. if (e.materialSpecification == null) {
  701. e.materialSpecification = "";
  702. }
  703. if (e.materialModel == null) {
  704. e.materialModel = "";
  705. }
  706. var addmap = {
  707. materialName:
  708. e.materialName + e.materialSpecification + e.materialModel,
  709. materialId: e.materialId
  710. };
  711. this.tableData.push(addmap);
  712. });
  713. this.selectionList1 = [];
  714. this.table = false;
  715. },
  716. refreshTable() {
  717. var arr = this.tableData;
  718. this.tableData = [];
  719. arr.forEach(e => {
  720. var addmap = {
  721. materialName: e.materialName,
  722. materialId: e.materialId,
  723. requirementPlatformName: e.requirementPlatformName,
  724. truckPoint1: e.truckPoint1,
  725. requirementPlatformId: e.requirementPlatformId,
  726. requirementUnloadUnitId: e.requirementUnloadUnitId,
  727. orderMaterialNumber: e.orderMaterialNumber,
  728. orderMaterialWeight: e.orderMaterialWeight,
  729. loadPointName: e.loadPointName,
  730. unloadPointName: e.unloadPointName
  731. };
  732. this.tableData.push(addmap);
  733. });
  734. },
  735. onclick(a) {
  736. if (this.input != null) {
  737. if (a == 1) {
  738. if (this.form.requirementType == "计重") {
  739. this.materialTable.requestUrl =
  740. "/api/v1/uc/getInwardWeightMaterial?apiId=498&i=" +
  741. new Date() +
  742. "&index=" +
  743. this.input;
  744. } else {
  745. this.materialTable.requestUrl =
  746. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" +
  747. new Date() +
  748. "&index=" +
  749. this.input;
  750. }
  751. this.input = null;
  752. } else {
  753. this.second1.requestUrl =
  754. "/api/v1/uc/getUnloadingMesByLike?apiId=374&index=" + this.input;
  755. this.input = null;
  756. }
  757. } else {
  758. if (this.form.requirementType == "计重") {
  759. this.materialTable.requestUrl =
  760. "/api/v1/uc/getInwardWeightMaterial?apiId=498&i=" + new Date();
  761. } else {
  762. this.materialTable.requestUrl =
  763. "/api/v1/uc/queryMaterialByLike?apiId=244&i=" + new Date();
  764. }
  765. this.inputMaterial = null;
  766. }
  767. },
  768. currentRadioChange1(selection) {
  769. this.mapList1 = selection;
  770. // console.log(selection)
  771. if (
  772. selection.materialSpecification == null ||
  773. selection.materialModel == null
  774. ) {
  775. this.materialName = this.mapList1.materialName;
  776. } else {
  777. this.materialName =
  778. this.mapList1.materialName +
  779. selection.materialSpecification +
  780. "(" +
  781. selection.materialModel +
  782. ")";
  783. }
  784. this.materialId = selection.materialId;
  785. },
  786. selectionChange1(radio) {
  787. console.log(radio);
  788. this.capacityTypeName = radio.capacityTypeName;
  789. this.capacityTypeId = radio.capacityTypeId;
  790. this.whether = radio.whether;
  791. },
  792. currentRadioChange2(selection) {
  793. if (this.a == 2) {
  794. this.truckPoint = selection.warehouseName;
  795. this.requiremntUnitId = selection.warehouseId;
  796. } else if (this.a == 3) {
  797. // console.log(this.tableData[this.index])
  798. this.tableData[this.index].requirementUnloadUnitId =
  799. selection.warehouseId;
  800. this.tableData[this.index].unloadPointName = selection.warehouseName;
  801. this.tableData[this.index].truckPoint1 = selection.warehouseName;
  802. this.refreshTable();
  803. } else if (this.a == 4) {
  804. // console.log(this.tableData[this.index])
  805. this.tableData[this.index].requirementPlatformId =
  806. selection.warehouseId;
  807. this.tableData[this.index].loadPointName = selection.warehouseName;
  808. this.tableData[this.index].requirementPlatformName =
  809. selection.warehouseName;
  810. this.refreshTable();
  811. }
  812. },
  813. // 新增
  814. makeSure() {
  815. // console.log(this.form.isMineral);
  816. // // 判断当前装机是否选择了装机必填
  817. // console.log("进来了");
  818. // console.log(this.whether);
  819. // console.log(this.installremark);
  820. if (this.tableData.length > 1 && this.form.requirementType != "倒库") {
  821. this.$message.warning("非倒库需求只允许填写一个物资");
  822. return;
  823. }
  824. if (this.whether == 2 && this.installremark == "") {
  825. console.log("确实进来了");
  826. this.$message.warning("请选择装机必填");
  827. return;
  828. }
  829. this.disabled = true;
  830. if (this.shipperId == null) {
  831. this.$message.error("请选择用车单位");
  832. this.disabled = false;
  833. return;
  834. }
  835. if (typeof this.form.requirementTruckTime == "undefined") {
  836. this.$message.error("请输入用车时间");
  837. this.disabled = false;
  838. return;
  839. }
  840. if (typeof this.form.transRange == "undefined") {
  841. this.$message.error("请选择运输起止范围");
  842. this.disabled = false;
  843. return;
  844. }
  845. if (typeof this.form.requirementType == "undefined") {
  846. this.$message.error("请选择需求类型");
  847. this.disabled = false;
  848. return;
  849. }
  850. if (this.tableData.length == 0) {
  851. this.$message.error("请点击浏览选择物资");
  852. this.disabled = false;
  853. return;
  854. }
  855. if (typeof this.form.requirementOverlimit != "undefined") {
  856. console.log(typeof this.form.remark == "undefined");
  857. if (typeof this.form.remark == "undefined") {
  858. this.$message.error("请填写超限备注");
  859. this.disabled = false;
  860. return;
  861. }
  862. }
  863. if (typeof this.form.Tel == "undefined") {
  864. this.$message.error("请填写联系电话");
  865. this.disabled = false;
  866. return;
  867. }
  868. var i = 0;
  869. this.tableData.forEach(e => {
  870. if (e.requirementPlatformId && e.requirementUnloadUnitId) {
  871. i++;
  872. }
  873. });
  874. if (i == 0) {
  875. this.$message.error("请选择装卸点");
  876. this.disabled = false;
  877. return;
  878. }
  879. // console.log(this.tableData)
  880. var DueTime;
  881. if (this.DueTime == null && this.isOpenDueTime == true) {
  882. this.$message.warning("截止日期必填");
  883. this.disabled = false;
  884. return;
  885. }
  886. if (this.DueTime == null && this.isOpenDueTime == false) {
  887. //默认选择明天0点
  888. var dd = new Date();
  889. dd.setDate(dd.getDate()+1);//获取AddDayCount天后的日期
  890. dd.setHours(null);
  891. dd.setMinutes(null);
  892. dd.setSeconds(null);
  893. var y = dd.getFullYear();
  894. var m = dd.getMonth()+1;//获取当前月份的日期
  895. var d = dd.getDate();
  896. this.DueTime=dd;
  897. }
  898. if (this.DueTime == null) {
  899. DueTime = null;
  900. } else {
  901. // 判断当前用户填写的截止日期是否大于当前时间
  902. let date2 = new Date();
  903. if (date2.getTime() > this.DueTime.getTime()) {
  904. this.$message.warning("截止日期必须大于当前时间!");
  905. this.disabled = false;
  906. return;
  907. } else {
  908. DueTime = sjTime(this.DueTime);
  909. }
  910. }
  911. if (this.form.capacityType == undefined) {
  912. this.form.capacityType = "";
  913. }
  914. if (this.form.typeRemarks == undefined) {
  915. this.form.typeRemarks = "";
  916. }
  917. let requiremnet = {
  918. requirementEstimatedDuration: this.form.requirementEstimatedDuration,
  919. requirementOverlimit:
  920. this.form.requirementOverlimit + this.form.remark + "米",
  921. requirementTruckTime: sjTime(this.form.requirementTruckTime),
  922. requirementType: this.form.requirementType,
  923. requirementWorkContent: this.form.requirementWorkContent,
  924. requirementWorkEnvironment: this.form.requirementWorkEnvironment,
  925. requirementWorkType: this.form.requirementWorkType,
  926. requirementShipperId: this.shipperId,
  927. rangeId: this.form.transRange,
  928. // 装机备注
  929. installremark: this.installremark,
  930. // 用车截日期
  931. DueTime: DueTime,
  932. // 用车类型Id
  933. capacityTypeId: this.capacityTypeId,
  934. mapList: this.tableData,
  935. orgCode: getCookie("orgCode"),
  936. remark: this.form.Tel + this.capacityTypeName + this.form.typeRemarks
  937. };
  938. this.axios
  939. .post("/api/v1/ams/addTruckRequirement", requiremnet)
  940. .then(res => {
  941. if (res.data.code == 200) {
  942. this.$message({
  943. type: "success",
  944. message: "新增成功!"
  945. });
  946. this.$router.go(-1);
  947. } else {
  948. this.$message.error("新增失败!");
  949. this.disabled = false;
  950. }
  951. });
  952. },
  953. func(res) {
  954. console.log(res);
  955. this.isKuang = false;
  956. },
  957. // 返回
  958. cancel() {
  959. this.$router.go(-1);
  960. }
  961. }
  962. };
  963. </script>
  964. <style lang="scss" scoped>
  965. .inwardRequirement {
  966. .from {
  967. display: flex;
  968. align-items: center;
  969. justify-content: center;
  970. margin-top: 5px;
  971. margin-bottom: 20px;
  972. }
  973. .drawSty {
  974. .el-input {
  975. width: 240px;
  976. }
  977. }
  978. .DueTime {
  979. display: flex;
  980. align-items: center;
  981. justify-content: center;
  982. margin-top: 5px;
  983. margin-bottom: 20px;
  984. .chooseDueTime {
  985. margin-right: 70px;
  986. }
  987. }
  988. .capacity {
  989. display: flex;
  990. text-align: center;
  991. align-items: center;
  992. justify-content: center;
  993. margin-top: 2rem;
  994. margin-bottom: 1.25rem;
  995. margin-right: 10px;
  996. }
  997. .materialDrawer {
  998. display: flex;
  999. justify-content: center;
  1000. align-items: center;
  1001. .el-input {
  1002. width: 320px;
  1003. }
  1004. .el-select {
  1005. width: 320px;
  1006. }
  1007. .el-autocomplete {
  1008. width: 320px;
  1009. }
  1010. .el-form {
  1011. padding: 10px;
  1012. }
  1013. .truckBtn {
  1014. width: 320px;
  1015. }
  1016. }
  1017. .swtichTop {
  1018. display: flex;
  1019. height: 40px;
  1020. align-content: center;
  1021. justify-content: center;
  1022. padding-right: 20px;
  1023. .titile {
  1024. color: red;
  1025. font-size: 14px;
  1026. }
  1027. .switch {
  1028. margin-right: -30px;
  1029. }
  1030. }
  1031. .requireUnit {
  1032. display: flex;
  1033. justify-content: center;
  1034. align-items: center;
  1035. margin-top: 20px;
  1036. .text {
  1037. display: inline-block;
  1038. width: 170px;
  1039. text-align: right;
  1040. .input {
  1041. width: 250px;
  1042. margin-right: 90px;
  1043. }
  1044. }
  1045. }
  1046. .form-box {
  1047. display: flex;
  1048. text-align: center;
  1049. align-items: center;
  1050. justify-content: center;
  1051. margin-top: 20px;
  1052. margin-bottom: 20px;
  1053. margin-left: 10px;
  1054. ::v-deep .el-form {
  1055. display: flex;
  1056. justify-content: center;
  1057. align-items: center;
  1058. margin-right: 600px;
  1059. // margin-left: -20px;
  1060. background-color: yellow;
  1061. .preview-group {
  1062. background-color: blue;
  1063. ::v-deep .el-form-item {
  1064. background-color: blue;
  1065. .el-form-item__label {
  1066. width: 170px !important;
  1067. background-color: blue;
  1068. }
  1069. ::v-deep .el-form-item__content {
  1070. background-color: red;
  1071. width: 300px;
  1072. }
  1073. .el-input {
  1074. width: 210px !important;
  1075. }
  1076. }
  1077. }
  1078. }
  1079. }
  1080. .button-box {
  1081. display: flex;
  1082. align-items: center;
  1083. justify-content: center;
  1084. margin-top: 20px;
  1085. margin-right: 90px;
  1086. }
  1087. }
  1088. </style>
  1089. <style>
  1090. .el-drawer__body {
  1091. overflow: auto;
  1092. }
  1093. .el-drawer__container ::-webkit-scrollbar {
  1094. display: none;
  1095. }
  1096. </style>