123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <template>
- <!-- 修改车皮装车实绩 -->
- <div class="addWagonLoad">
- <page-title>编辑</page-title>
- <div class="form">
- <div class="form_box">
- <dil-form :formId="254" v-model="form1"></dil-form>
- </div>
- </div>
- <div class="fromOther">
- <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:520px;">
- <el-form-item label="发站:">
- <el-autocomplete
- class="inline-input"
- v-model="sendStation"
- :fetch-suggestions="querySearchSendStation"
- placeholder="请输入发站名称"
- :trigger-on-focus="false"
- @select="handleSelectSendStation"
- >
- <template slot-scope="{ item }">
- <div class="name">{{ item.arrivalName }}</div>
- </template>
- </el-autocomplete>
- </el-form-item>
- </el-form>
- <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:520px;">
- <el-form-item label="到站:">
- <el-autocomplete
- class="inline-input"
- v-model="toTheStation"
- :fetch-suggestions="querySearchToTheStation"
- placeholder="请输入到站名称"
- :trigger-on-focus="false"
- @select="handleSelectToTheStation"
- >
- <template slot-scope="{ item }">
- <div class="name">{{ item.arrivalName }}</div>
- </template>
- </el-autocomplete>
- </el-form-item>
- </el-form>
- </div>
- <div class="button_box">
- <el-button type="primary" @click="onClickConfirm">确认</el-button>
- <el-button @click="onClickCancel">返回</el-button>
- </div>
- </div>
- </template>
- <script>
- import PageTitle from "@/components/Page/Title";
- import { sjTime } from "@/utils/sharedJsFile";
- export default {
- components: { PageTitle },
- data() {
- return {
- form1: {},
- sendStationId:null,
- toTheStationId:null,
- sendStation:"",
- toTheStation:""
- };
- },
- created() {
- this.form1 = {
- arrivalStationId: 1,
- };
- },
- mounted() {
- this.information();
- },
- methods: {
- information() {
- console.log("add", this.$route.params);
- //编辑车皮装车作业
- this.axios
- .post(
- "/api/v1/tms/getTmstrainLoadingResultByResultId/" +
- this.$route.params.unloadingId
- )
- .then((res) => {
- res.data.data.forEach((e) => {
- this.form1 = e;
- console.log(e)
- this.toTheStationId = e.arrivalStationId
- this.sendStationId = e.sendStationId
- this.sendStation = e.sendName
- this.toTheStation = e.arrivalName
- });
- });
- },
- handleCheckedCitiesChange(value) {
- console.log(value);
- },
- // 返回
- onClickCancel() {
- this.$router.go(-1);
- },
- currentRadioChange(row) {
- this.aaaa = row;
- },
- //发站弹出层
- handleSelectSendStation(item) {
- this.sendStationId = item.arrivalId;
- this.sendStation = item.arrivalName;
- },
- //以下是发站边输边查搜索
- querySearchSendStation(queryString, cb) {
- this.axios
- .get("/api/v1/uc/getArrivalByLike?index=" + this.sendStation)
- .then((res) => {
- if (res.data.code == "200") {
- var restaurantsSupplier = res.data.data;
- console.log(restaurantsSupplier)
- var results = queryString
- ? restaurantsSupplier.filter(
- this.createFilterSendStation(queryString)
- )
- : restaurantsSupplier;
- // 调用 callback 返回建议列表的数据
- cb(results);
- }
- });
- },
- //发站
- createFilterSendStation(queryString) {
- return (restaurantsSupplier) => {
- return (
- restaurantsSupplier.arrivalName
- .toLowerCase()
- .indexOf(queryString.toLowerCase()) > -1
- );
- };
- },
- //到站弹出层
- handleSelectToTheStation(item) {
- this.toTheStationId = item.arrivalId;
- this.toTheStation = item.arrivalName;
- },
- //以下是到站边输边查搜索
- querySearchToTheStation(queryString, cb) {
- this.axios
- .get("/api/v1/uc/getArrivalByLike?index=" + this.toTheStation)
- .then((res) => {
- if (res.data.code == "200") {
- var restaurantsSupplier = res.data.data;
- console.log(restaurantsSupplier)
- var results = queryString
- ? restaurantsSupplier.filter(
- this.createFilterToTheStation(queryString)
- )
- : restaurantsSupplier;
- // 调用 callback 返回建议列表的数据
- cb(results);
- }
- });
- },
- //到站
- createFilterToTheStation(queryString) {
- return (restaurantsSupplier) => {
- return (
- restaurantsSupplier.arrivalName
- .toLowerCase()
- .indexOf(queryString.toLowerCase()) > -1
- );
- };
- },
- // 确认
- onClickConfirm() {
- let tmstrainLoadingResult = {
- resultId: this.$route.params.unloadingId,
- resultWagonNo: this.form1.resultWagonNo,
- resultBillableTonnage: this.form1.resultBillableTonnage,
- resultClass: this.form1.resultClass,
- sendStationId: this.sendStationId,
- arrivalStationId: this.toTheStationId,
- resultLoadingDate: sjTime(this.form1.resultLoadingDate),
- batchId: this.form1.batchId,
- capacityId: this.form1.capacityId,
- resultMaterialNumber: this.form1.resultMaterialNumber,
- resultMaterialTheoryweight: this.form1.resultMaterialTheoryweight,
- resultRemarks: this.form1.resultRemarks,
- };
- console.log(tmstrainLoadingResult)
- if (
- tmstrainLoadingResult.resultWagonNo == null ||
- tmstrainLoadingResult.sendStationId == null ||
- tmstrainLoadingResult.arrivalStationId == null ||
- tmstrainLoadingResult.resultLoadingDate == null ||
- tmstrainLoadingResult.batchId == null
- )
- this.$message.error("必填项存在空值!");
- else
- this.axios
- .post(
- "/api/v1/tms/upadteTmstrainLoadingResultByResultId",
- tmstrainLoadingResult
- )
- .then(() => {
- this.$message({
- type: "success",
- message: "修改成功!",
- });
- this.$router.go(-1);
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .addWagonLoad {
- color: #606266;
- font-size: 0.675rem;
- font-weight: 500;
- .form {
- display: flex;
- .form_box {
- width: 340px;
- margin-left: 37%;
- margin-right: 20px;
- .el-form {
- .preview-group {
- .el-form-item {
- .el-form-item__label {
- display: inline-block;
- width: 70px !important;
- }
- .el-form-item__content {
- .el-select {
- width: 250px;
- }
- .el-input {
- width: 250px;
- }
- .el-textarea {
- .el-textarea__inner {
- width: 220px;
- margin-top: 0.03rem;
- }
- }
- }
- }
- }
- }
- }
- }
- .button_box {
- display: flex;
- justify-content: center;
- padding-top: 30px;
- margin-left: 3.5%;
- }
- }
- </style>
|