[1078] 合并新UI

This commit is contained in:
lin
2025-05-12 18:01:10 +08:00
parent c4ab55a456
commit e4a0a37f0b
6 changed files with 266 additions and 273 deletions

View File

@@ -10,13 +10,13 @@
@close="close()"
>
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
<el-form ref="form" :rules="rules" :model="form" label-width="200px" >
<el-form ref="form" :rules="rules" :model="form" label-width="200px">
<el-form-item label="终端手机号" prop="phoneNumber">
<el-input v-model="form.phoneNumber" clearable></el-input>
<el-input v-model="form.phoneNumber" clearable />
</el-form-item>
<el-form-item>
<div style="float: right;">
<el-button type="primary" @click="onSubmit" >确认</el-button>
<el-button type="primary" @click="onSubmit">确认</el-button>
<el-button @click="close">取消</el-button>
</div>
</el-form-item>
@@ -28,10 +28,8 @@
<script>
export default {
name: "deviceEdit",
name: 'DeviceEdit',
props: {},
computed: {},
created() {},
data() {
return {
listChangeCallback: null,
@@ -40,49 +38,50 @@ export default {
form: {},
isEdit: false,
rules: {
deviceId: [{ required: true, message: "请输入设备编号", trigger: "blur" }]
},
};
deviceId: [{ required: true, message: '请输入设备编号', trigger: 'blur' }]
}
}
},
computed: {},
created() {},
methods: {
openDialog: function (row, callback) {
openDialog: function(row, callback) {
console.log(row)
this.showDialog = true;
this.isEdit = false;
this.showDialog = true
this.isEdit = false
if (row) {
this.isEdit = true;
this.isEdit = true
}
this.form = {};
this.listChangeCallback = callback;
this.form = {}
this.listChangeCallback = callback
if (row != null) {
this.form = row;
this.form = row
}
},
onSubmit: function () {
console.log("onSubmit");
this.$axios({
method: 'post',
url:`/api/jt1078/terminal/${this.isEdit?'update':'add'}/`,
params: this.form
}).then((res) => {
console.log(res.data)
if (res.data.code === 0) {
this.listChangeCallback()
}else {
this.$message({
showClose: true,
message: res.data.msg,
type: "error",
});
}
}).catch(function (error) {
console.log(error);
});
onSubmit: function() {
console.log('onSubmit')
if (this.isEdit) {
this.$store.dispatch('jtDevice/update', this.form)
.then(data => {
this.listChangeCallback()
})
.catch(function(error) {
console.log(error)
})
} else {
this.$store.dispatch('jtDevice/add', this.form)
.then(data => {
this.listChangeCallback()
})
.catch(function(error) {
console.log(error)
})
}
},
close: function () {
this.showDialog = false;
this.$refs.form.resetFields();
},
},
};
close: function() {
this.showDialog = false
this.$refs.form.resetFields()
}
}
}
</script>