|
@@ -78,17 +78,13 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="应用类型:" prop="applicationType">
|
|
|
- <el-select
|
|
|
- v-model="dialogData.applicationType"
|
|
|
- placeholder="请选择设备类型"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in applicationType"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ <input type="checkbox" v-model="isChecked1" /> 小程序
|
|
|
+ <input
|
|
|
+ type="checkbox"
|
|
|
+ style="margin-left: 30px"
|
|
|
+ v-model="isChecked2"
|
|
|
+ />
|
|
|
+ APP
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
@@ -117,6 +113,9 @@ export default {
|
|
|
mixins: [devMixin, currentMixin, disabledMixin],
|
|
|
data() {
|
|
|
return {
|
|
|
+ isChecked1: false,
|
|
|
+ isChecked2: false,
|
|
|
+
|
|
|
// 遮罩层
|
|
|
loading: false,
|
|
|
// 表单
|
|
@@ -134,17 +133,6 @@ export default {
|
|
|
dialogData: {
|
|
|
sort: 1,
|
|
|
},
|
|
|
- // 设备连接
|
|
|
- applicationType: [
|
|
|
- {
|
|
|
- value: "0",
|
|
|
- label: "小程序",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "1",
|
|
|
- label: "APP",
|
|
|
- },
|
|
|
- ],
|
|
|
///弹窗类型
|
|
|
dialogStatus: 0,
|
|
|
|
|
@@ -181,13 +169,41 @@ export default {
|
|
|
|
|
|
// 弹窗
|
|
|
async getDialog(status, row) {
|
|
|
- console.log("gadfadfqwwerqewr=aaa==" + JSON.stringify(row));
|
|
|
this.dialogVisible = true;
|
|
|
this.dialogStatus = status;
|
|
|
+ ///新增
|
|
|
if (status == 0) {
|
|
|
this.dialogData = { sort: 1 };
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ ///编辑
|
|
|
+ else {
|
|
|
this.dialogData = row;
|
|
|
+ var applicationType = this.dialogData.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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -213,7 +229,7 @@ export default {
|
|
|
getDialogClose() {
|
|
|
this.dialogVisible = false;
|
|
|
this.dialogData = { sort: 1 };
|
|
|
- this.$refs.dialogData.resetFields();
|
|
|
+ // this.$refs.dialogData.resetFields();
|
|
|
},
|
|
|
|
|
|
// 上传
|
|
@@ -235,18 +251,19 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- var applicationType = this.dialogData.applicationType;
|
|
|
- if (applicationType == null || applicationType == "") {
|
|
|
+ if (!this.isChecked1 && !this.isChecked2) {
|
|
|
this.$message.success("请选择应用类型");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- console.log(
|
|
|
- "gadfadfqwwerqewr==111=" +
|
|
|
- this.dialogStatus +
|
|
|
- "===" +
|
|
|
- JSON.stringify(this.dialogData)
|
|
|
- );
|
|
|
+ if (this.isChecked1 && this.isChecked2) {
|
|
|
+ this.dialogData.applicationType = "[0,1]";
|
|
|
+ } else if (this.isChecked2) {
|
|
|
+ this.dialogData.applicationType = "[1]";
|
|
|
+ } else {
|
|
|
+ this.dialogData.applicationType = "[0]";
|
|
|
+ }
|
|
|
+
|
|
|
///新增
|
|
|
if (this.dialogStatus == 0) {
|
|
|
add(this.dialogData).then((res) => {
|
|
@@ -259,7 +276,7 @@ export default {
|
|
|
edit(this.dialogData).then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
this.$message.success("修改成功!");
|
|
|
- this.cancel();
|
|
|
+ this.getDialogClose();
|
|
|
}
|
|
|
});
|
|
|
}
|