addRequirement2.vue 27 KB

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