ke_junjie
2025-06-04 bb6e2230bb8ded3c5546bc4e4c282ee343754475
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<template>
  <div class="casslineEdit height overflow">
    <div class="centent-form overflowy-auto">
      <el-form
        class="margin-auto width90"
        ref="registerForm"
        :model="registerForm"
        size="mini"
        :rules="rules"
        label-position="left"
        label-width="130px"
      >
        <el-form-item label="班线编号:" prop="productionCode">
          <el-input v-model="registerForm.productionCode" clearable></el-input>
        </el-form-item>
        <el-form-item label="班线名称:" prop="productionName">
          <el-input v-model="registerForm.productionName" clearable></el-input>
        </el-form-item>
        <el-form-item label="能否作为目的地:" prop="isDestination">
          <el-select v-model="registerForm.isDestination" clearable placeholder="请选择">
            <el-option v-for="item in isDestinationlist" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
    </div>
    <div class="palteEdit-button text-right margin-right15 margin-top2">
      <el-button
        type="primary"
        size="mini"
        class="form-buttom"
        :loading="savloading"
        @click="submitForm('registerForm')"
        >提交</el-button
      >
      <el-button type="primary" size="mini" class="form-buttom" @click="$emit('cancel')">取消</el-button>
    </div>
  </div>
</template>
 
<script>
import { ProductionLineAddOrUpdate } from '@/api/cass-line';
export default {
  data() {
    return {
      registerForm: {},
      usernameList: [],
      isDestinationlist: [
        {
          label: '是',
          value: 1
        },
        {
          label: '否',
          value: 0
        }
      ],
      rules: {
        productionCode: { required: true, message: '请输入班线编号', trigger: 'change' },
        productionName: { required: true, message: '请输入班线名称', trigger: 'change' },
        isDestination: { required: true, message: '请选择能否作为目的地', trigger: 'change' }
      },
      savloading: false
    };
  },
  props: {
    rowitem: {
      type: Object,
      default: {}
    }
  },
  mounted() {
    if (JSON.stringify(this.rowitem) != '{}') {
      this.registerForm = this.rowitem;
    }
  },
  methods: {
    submitForm(registerForm) {
      this.$refs[registerForm].validate(valid => {
        if (valid) {
          this.savloading = true;
          ProductionLineAddOrUpdate(this.registerForm).then(res => {
            if (res.code == 0) {
              this.$message({
                type: 'success',
                message: '提交成功'
              });
              this.$emit('addsubmit');
            } else {
              this.$message({
                type: 'warning',
                message: '提交失败'
              });
            }
            this.savloading = false;
          });
        } else {
        }
      });
    }
  },
  watch: {}
};
</script>
 
<style lang="scss" scoped>
.casslineEdit {
  width: 98%;
  padding: 1%;
  .show-pwd {
    position: absolute;
    right: 10px;
    top: 3px;
    font-size: 16px;
    color: #889aa4;
    cursor: pointer;
    user-select: none;
  }
  .centent-form {
    height: 92%;
    width: 100%;
    margin: auto;
  }
  .casslineEdit-button {
  }
  ::v-deep .el-form-item__content {
    width: 60%;
  }
  ::v-deep .el-select {
    width: 100%;
  }
}
</style>