123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- <template>
- <!-- 添加运力信息 -->
- <div class="addWagonLoad">
- <PageTitle>返回</PageTitle>
- <el-divider content-position="left">运力信息</el-divider>
- <div class="form_box" style="margin-right: 10rem">
- <dil-form :formId="309" v-model="form1" ref="from1"></dil-form>
- </div>
- <div class="inputBox">
- <span class="text">所属单位类型</span>
- <el-autocomplete
- v-model="state"
- @input="onInput"
- :fetch-suggestions="querySearch"
- placeholder="边输入边查询"
- :trigger-on-focus="false"
- @select="handleSelect"
- ></el-autocomplete>
- </div>
- <div class="button_box">
- <el-button @click="cancel">取消</el-button>
- <el-button type="primary" @click="makeSure">确定</el-button>
- </div>
- </div>
- </template>
- <script>
- import PageTitle from "@/components/Page/Title";
- export default {
- components: { PageTitle },
- data() {
- return {
- form1: {},
- // value: undefined,
- carrierIds:"",
- state: "",
- restaurants: [],
- };
- },
- mounted() {},
- methods: {
- onInput() {
- this.axios.post(
- "/api/v1/rms/getCarrierName?state="+this.state,
- )
- .then((res) => {
- if(res.data.code == "200"){
- res.data.data.forEach(element => {
- this.restaurants.push({
- value:element.carrierName,
- carrierIds:element.carrierId
- })
- });
- }
-
- });
- },
- querySearch(queryString, cb) {
- var restaurants = this.restaurants;
- var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
- // 调用 callback 返回建议列表的数据
- cb(results);
- },
- createFilter(queryString) {
- return (restaurant) => {
- return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
- };
- },
- handleSelect(item){
- this.carrierIds=item.carrierIds;
- console.log(item)
- },
-
- makeSure() {
- // console.log(this.form1)
- let RmsCapacity={
- capacityTypeId:this.form1.capacityTypeId,
- capacityNumber:this.form1.capacityNumber.toUpperCase(),
- number:this.capacityNumber,
- capacityCorlor:this.form1.capacityCorlor,
- capacityOwneris:this.form1.capacityOwneris,
- capacityVip:this.form1.capacityVip,
- capacityBlacklist:this.form1.capacityBlacklist,
- // carrierId:this.form1.carrierId,
- state:this.state,
- carrierName:this.state,
- carrierIds: this.carrierIds,
- };
- // console.log("RmsCapacity",RmsCapacity)
- if(
- RmsCapacity.capacityNumber==null ||
- RmsCapacity.capacityCorlor==null ||
- RmsCapacity.capacityOwneris==null ||
- RmsCapacity.capacityVip==null ||
- RmsCapacity.capacityBlacklist==null ||
- RmsCapacity.carrierIds==null
- )this.$message.error("存在空值!");
- else
- this.axios
- .post(
- "/api/v1/rms/insertCapacity", RmsCapacity
- )
- .then((res) => {
- console.log("res.data.code",res.data.code);
- if (res.data.code == 200) {
- this.$message({
- type: "success",
- message: "新增成功!",
- });
- // this.$refs.table.refreshData();
- this.$router.go(-1);
- } else {
- this.$message.error("新增失败,可能存在重复!");
- }
- // this.$refs['table'].resetField();
- });
- },
- // 取消
- cancel() {
- this.$router.go(-1);
- },
- },
- };
- </script>
- <style lang='scss' >
- .addWagonLoad {
- .form_box {
- width: 100%;
- margin-top: 30px;
- display: flex;
- justify-content: center;
- .el-form-item{
- display: flex;
- justify-content: center;
- .el-form-item__label{
- display: flex;
- align-items: center;
- }
- .el-form-item__content{
- .el-select{
- width: 250px;
- }
- .el-input{
- width: 250px;
- }
- }
- }
- }
- .inputBox{
- display: flex;
- justify-content: center;
- margin-bottom: 30px;
- .text{
- text-align: right;
- display: flex;
- align-items: center;
- margin-right: 5px;
- }
- .input{
- width: 250px;
- }
- }
- .button_box{
- display: flex;
- justify-content: center;
- .el-button{
- width: 80px;
- margin-right: 10px;
- }
- }
- }
- </style>
|