|
@@ -7,7 +7,7 @@
|
|
|
label-width="auto"
|
|
|
:disabled="disabled"
|
|
|
>
|
|
|
- <el-form-item label="应用类型:" prop="applicationType">
|
|
|
+ <!-- <el-form-item label="应用类型:" prop="applicationType">
|
|
|
<el-select v-model="form.applicationType" placeholder="请选择设备分类">
|
|
|
<el-option
|
|
|
v-for="item in applicationType"
|
|
@@ -16,11 +16,25 @@
|
|
|
:value="item.value"
|
|
|
/>
|
|
|
</el-select>
|
|
|
+ </el-form-item> -->
|
|
|
+
|
|
|
+ <!-- disabled === false -->
|
|
|
+ <el-form-item label="应用类型:" prop="applicationType">
|
|
|
+ <input type="checkbox" v-model="isChecked1" :disabled="disabled" />
|
|
|
+ 小程序
|
|
|
+ <input
|
|
|
+ type="checkbox"
|
|
|
+ style="margin-left: 30px"
|
|
|
+ v-model="isChecked2"
|
|
|
+ :disabled="disabled"
|
|
|
+ />
|
|
|
+ APP
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="设备型号:" prop="clientType">
|
|
|
<el-input v-model="form.clientType" placeholder="请输入设备型号" />
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<el-form-item label="设备名称:" prop="name">
|
|
|
<el-input v-model="form.name" placeholder="请输入设备名称" />
|
|
|
</el-form-item>
|
|
@@ -338,17 +352,9 @@ export default {
|
|
|
],
|
|
|
data() {
|
|
|
return {
|
|
|
- // 设备连接
|
|
|
- applicationType: [
|
|
|
- {
|
|
|
- value: "0",
|
|
|
- label: "小程序",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "1",
|
|
|
- label: "APP",
|
|
|
- },
|
|
|
- ],
|
|
|
+ isChecked1: false,
|
|
|
+ isChecked2: false,
|
|
|
+
|
|
|
// 表单
|
|
|
form: {
|
|
|
typeList: [
|
|
@@ -467,6 +473,33 @@ export default {
|
|
|
this.form.typeList.map((i) => {
|
|
|
this.devModeOptions[i.type - 1].disabled = true;
|
|
|
});
|
|
|
+
|
|
|
+ var applicationType = this.form.applicationType;
|
|
|
+ this.isChecked1 = false;
|
|
|
+ this.isChecked2 = false;
|
|
|
+ if (applicationType != null && applicationType != "") {
|
|
|
+ applicationType = applicationType.replace(/[\[\]]/g, "");
|
|
|
+ // 使用split按逗号分割字符串
|
|
|
+ let result = applicationType.split(",");
|
|
|
+ if (result != null && result != "" && result.length > 0) {
|
|
|
+ if (result.length == 2) {
|
|
|
+ this.isChecked1 = true;
|
|
|
+ this.isChecked2 = true;
|
|
|
+ } else {
|
|
|
+ if (result[0] == "0") {
|
|
|
+ this.isChecked1 = true;
|
|
|
+ } else {
|
|
|
+ this.isChecked2 = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (applicationType == 0) {
|
|
|
+ this.isChecked1 = true;
|
|
|
+ } else if (applicationType == 1) {
|
|
|
+ this.isChecked2 = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -561,11 +594,25 @@ export default {
|
|
|
|
|
|
// 提交
|
|
|
getSubmit() {
|
|
|
+ if (!this.isChecked1 && !this.isChecked2) {
|
|
|
+ this.$message.success("请选择应用类型");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.isChecked1 && this.isChecked2) {
|
|
|
+ this.form.applicationType = "[0,1]";
|
|
|
+ } else if (this.isChecked2) {
|
|
|
+ this.form.applicationType = "[1]";
|
|
|
+ } else {
|
|
|
+ this.form.applicationType = "[0]";
|
|
|
+ }
|
|
|
+
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
if (this.$route.query.id) {
|
|
|
// 编辑
|
|
|
edit(this.form).then((res) => {
|
|
|
+ console.log("gadsfqewrqewrqr====" + JSON.stringify(res));
|
|
|
if (res.code === 0) {
|
|
|
this.$message.success("修改成功!");
|
|
|
this.getCancel();
|