luobisheng
2022-11-25 528c4590c60e18fc480b191cd284013ee8310723
src/views/systemSetting/device/bayonet/create/index.vue
@@ -4,8 +4,8 @@
            <!-- 卡口名称 -->
            <div class="device-item">
                <div class="item-left">
                    <el-form-item label="卡口名称:" prop="name">
                        <el-input v-model="bayonet.name" placeholder="请填写卡口名称"></el-input>
                    <el-form-item label="卡口名称:" prop="bayonetName">
                        <el-input v-model="bayonet.bayonetName" placeholder="请填写卡口名称"></el-input>
                    </el-form-item>
                </div>
                <div class="item-right"></div>
@@ -25,8 +25,8 @@
            <!-- 所属区域 -->
            <div class="device-item">
                <div class="item-left">
                    <el-form-item label="所属区域:" prop="belong_area">
                        <el-input v-model="bayonet.belong_area" placeholder="请填写区域名称"></el-input>
                    <el-form-item label="所属区域:" prop="belongArea">
                        <el-input v-model="bayonet.belongArea" placeholder="请填写区域名称"></el-input>
                    </el-form-item>
                </div>
                <div class="item-right"></div>
@@ -103,10 +103,10 @@
  data() {
      return {
          bayonet: {
              name: '',
              bayonetName: '',
              latitude: '',
              longitude: '',
              belong_area: '',
              belongArea: '',
              ipAddress: '',
              port: '',
              frontEndType: '',
@@ -114,10 +114,10 @@
              description: ''
          },
          rules: {
            name: [{ required: true, trigger: 'blur', message: '请填写卡口名称' }],
            bayonetName: [{ required: true, trigger: 'blur', message: '请填写卡口名称' }],
            latitude: [{ required: true, trigger: ['blur', 'change'], message: '请填写纬度位置' }],
            longitude: [{ required: true, trigger: ['blur', 'change'], message: '请填写经度位置' }],
            belong_area: [{ required: true, trigger: ['blur', 'change'], message: '请填写区域名称' }],
            belongArea: [{ required: true, trigger: ['blur', 'change'], message: '请填写区域名称' }],
            ipAddress: [{ required: true, trigger: ['blur', 'change'], message: '请填写域名或者IP' }],
            port: [{ required: true, trigger: ['blur', 'change'], message: '请输入端口号' }],
            frontEndType: [{ required: true, trigger: ['blur', 'change'], message: '请输入前端类型' }],
@@ -127,11 +127,19 @@
      }
  },
  created() {
    this.bayonet = deepClone(this.originalBayonet);
  },
  methods: {
      onSubmit() {
        this.$refs.device.validate(valid => {
          if (valid) {
            const copyBayonet = deepClone(this.bayonet);
            delete copyBayonet.id;
            copyBayonet.longitude = Number(copyBayonet.longitude);
            copyBayonet.latitude = Number(copyBayonet.latitude);
            copyBayonet.inOutCityType = Number(copyBayonet.inOutCityType);
            if (!this.isEdit) {
              bayonet.addBayonet(this.bayonet)
                  .then(() => {