|
@@ -3,87 +3,137 @@
|
|
|
<test v-model="queryParams" :form-config="queryForm"></test>
|
|
|
|
|
|
<el-table :data="tableList" v-loading="loading">
|
|
|
- <el-table-column :label="$t('Internet_of_things.equipment.applicationName')" align="center" prop="applicationName" />
|
|
|
- <el-table-column :label="$t('Internet_of_things.equipment.productName')" align="center" prop="productName" />
|
|
|
- <el-table-column :label="$t('Internet_of_things.equipment.deviceName')" align="center" prop="deviceName" />
|
|
|
- <el-table-column :label="$t('Internet_of_things.equipment.nodeId')" align="center" prop="nodeId" width="120" />
|
|
|
- <el-table-column :label="$t('Internet_of_things.equipment.deviceStatus')" align="center" prop="" width="120" />
|
|
|
- <el-table-column :label="$t('Internet_of_things.equipment.deviceId')" align="center" prop="deviceId" />
|
|
|
- <el-table-column :label="$t('Internet_of_things.equipment.secret')" align="center" prop="secret" width="120" />
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('Internet_of_things.equipment.applicationName')"
|
|
|
+ align="center"
|
|
|
+ prop="applicationName"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('Internet_of_things.equipment.productName')"
|
|
|
+ align="center"
|
|
|
+ prop="productName"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('Internet_of_things.equipment.deviceName')"
|
|
|
+ align="center"
|
|
|
+ prop="deviceName"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('Internet_of_things.equipment.nodeId')"
|
|
|
+ align="center"
|
|
|
+ prop="nodeId"
|
|
|
+ width="120"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('Internet_of_things.equipment.deviceStatus')"
|
|
|
+ align="center"
|
|
|
+ prop=""
|
|
|
+ width="120"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('Internet_of_things.equipment.deviceId')"
|
|
|
+ align="center"
|
|
|
+ prop="deviceId"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('Internet_of_things.equipment.secret')"
|
|
|
+ align="center"
|
|
|
+ prop="secret"
|
|
|
+ width="120"
|
|
|
+ />
|
|
|
<el-table-column :label="$t('operation')" align="center" width="80">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" @click="handleDelete(scope.row)">{{ $t('delete') }} </el-button>
|
|
|
+ <el-button type="text" @click="handleDelete(scope.row)"
|
|
|
+ >{{ $t("delete") }}
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
- <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
|
|
+ <pagination
|
|
|
+ v-show="total > 0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
|
|
|
<el-dialog title="添加设备" v-if="open" :visible.sync="open" width="30%">
|
|
|
- <test ref="test" v-model="dialogParams" :form-config="dialogForm" :insideRules="dialogRules"></test>
|
|
|
+ <test
|
|
|
+ ref="test"
|
|
|
+ v-model="dialogParams"
|
|
|
+ :form-config="dialogForm"
|
|
|
+ :insideRules="dialogRules"
|
|
|
+ ></test>
|
|
|
</el-dialog>
|
|
|
</el-card>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import * as API from '@/api/Internet-of-things/equipment-management.js'
|
|
|
-import * as APISelect from '@/api/Internet-of-things/select.js'
|
|
|
-import test from '@/components/form-test/index.vue'
|
|
|
+import * as API from "@/api/Internet-of-things/equipment-management.js";
|
|
|
+import * as APISelect from "@/api/Internet-of-things/select.js";
|
|
|
+import test from "@/components/form-test/index.vue";
|
|
|
|
|
|
export default {
|
|
|
- name: 'equipment-management',
|
|
|
+ name: "equipment-management",
|
|
|
components: { test },
|
|
|
data() {
|
|
|
return {
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
- keyword: '',
|
|
|
- tdaApplicationId: '',
|
|
|
- tdaProductId: '',
|
|
|
+ keyword: "",
|
|
|
+ tdaApplicationId: "",
|
|
|
+ tdaProductId: "",
|
|
|
},
|
|
|
queryForm: {
|
|
|
keyword: {
|
|
|
- label: this.$t('Internet_of_things.equipment.keyword'),
|
|
|
+ label: this.$t("Internet_of_things.equipment.keyword"),
|
|
|
span: 6,
|
|
|
},
|
|
|
tdaApplicationId: {
|
|
|
- label: this.$t('Internet_of_things.equipment.tdaApplicationId'),
|
|
|
+ label: this.$t("Internet_of_things.equipment.tdaApplicationId"),
|
|
|
span: 6,
|
|
|
- type: 'select',
|
|
|
+ type: "select",
|
|
|
data: [],
|
|
|
- keyName: 'id',
|
|
|
- labelName: 'appName',
|
|
|
+ keyName: "id",
|
|
|
+ labelName: "appName",
|
|
|
},
|
|
|
tdaProductId: {
|
|
|
- label: this.$t('Internet_of_things.equipment.tdaProductId'),
|
|
|
+ label: this.$t("Internet_of_things.equipment.tdaProductId"),
|
|
|
span: 6,
|
|
|
- type: 'select',
|
|
|
+ type: "select",
|
|
|
data: [],
|
|
|
- keyName: 'id',
|
|
|
- labelName: 'name',
|
|
|
+ keyName: "id",
|
|
|
+ labelName: "name",
|
|
|
},
|
|
|
operation: {
|
|
|
// 搜索按钮操作
|
|
|
query: () => {
|
|
|
- this.queryParams.pageNum = 1
|
|
|
- this.getList()
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
},
|
|
|
// 重置按钮操作
|
|
|
reset: () => {
|
|
|
- this.queryParams = { pageNum: 1, pageSize: 10, keyword: '', tdaApplicationId: '', name: '' }
|
|
|
- this.queryParams.pageNum = 1
|
|
|
- this.getList()
|
|
|
+ this.queryParams = {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ keyword: "",
|
|
|
+ tdaApplicationId: "",
|
|
|
+ name: "",
|
|
|
+ };
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
},
|
|
|
},
|
|
|
otherButton: {
|
|
|
list: [
|
|
|
{
|
|
|
- name: this.$t('Internet_of_things.equipment.addEquipment'),
|
|
|
- methodsText: 'add',
|
|
|
- type: 'primary',
|
|
|
+ name: this.$t("Internet_of_things.equipment.addEquipment"),
|
|
|
+ methodsText: "add",
|
|
|
+ type: "primary",
|
|
|
add: () => {
|
|
|
- this.handleAdd()
|
|
|
+ this.handleAdd();
|
|
|
},
|
|
|
},
|
|
|
],
|
|
@@ -93,89 +143,121 @@ export default {
|
|
|
total: 0,
|
|
|
loading: false,
|
|
|
open: false,
|
|
|
- title: '',
|
|
|
+ title: "",
|
|
|
dialogParams: {
|
|
|
- tdaApplicationId: '',
|
|
|
- tdaProductId: '',
|
|
|
- nodeId: '',
|
|
|
- deviceName: '',
|
|
|
- secret: 'Fjhx@2012#',
|
|
|
+ tdaApplicationId: "",
|
|
|
+ tdaProductId: "",
|
|
|
+ nodeId: "",
|
|
|
+ deviceName: "",
|
|
|
+ secret: "Fjhx@2012#",
|
|
|
},
|
|
|
dialogForm: {
|
|
|
loadingStatus: false,
|
|
|
tdaApplicationId: {
|
|
|
- label: this.$t('Internet_of_things.equipment.applicationName'),
|
|
|
- type: 'select',
|
|
|
+ label: this.$t("Internet_of_things.equipment.applicationName"),
|
|
|
+ type: "select",
|
|
|
data: [],
|
|
|
- keyName: 'id',
|
|
|
- labelName: 'appName',
|
|
|
+ keyName: "id",
|
|
|
+ labelName: "appName",
|
|
|
},
|
|
|
tdaProductId: {
|
|
|
- label: this.$t('Internet_of_things.equipment.productName'),
|
|
|
- type: 'select',
|
|
|
+ label: this.$t("Internet_of_things.equipment.productName"),
|
|
|
+ type: "select",
|
|
|
data: [],
|
|
|
- keyName: 'id',
|
|
|
- labelName: 'name',
|
|
|
+ keyName: "id",
|
|
|
+ labelName: "name",
|
|
|
},
|
|
|
deviceName: {
|
|
|
- label: this.$t('Internet_of_things.equipment.deviceName'),
|
|
|
+ label: this.$t("Internet_of_things.equipment.deviceName"),
|
|
|
},
|
|
|
nodeId: {
|
|
|
- label: this.$t('Internet_of_things.equipment.nodeId'),
|
|
|
+ label: this.$t("Internet_of_things.equipment.nodeId"),
|
|
|
span: 2,
|
|
|
},
|
|
|
secret: {
|
|
|
- label: this.$t('Internet_of_things.equipment.secret'),
|
|
|
+ label: this.$t("Internet_of_things.equipment.secret"),
|
|
|
disabled: true,
|
|
|
span: 2,
|
|
|
},
|
|
|
otherButton: {
|
|
|
- align: 'center',
|
|
|
+ align: "center",
|
|
|
list: [
|
|
|
{
|
|
|
- name: this.$t('cancelText'),
|
|
|
- methodsText: 'cancel',
|
|
|
+ name: this.$t("cancelText"),
|
|
|
+ methodsText: "cancel",
|
|
|
cancel: () => {
|
|
|
- this.open = false
|
|
|
+ this.open = false;
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
- name: this.$t('submitText'),
|
|
|
- methodsText: 'submit',
|
|
|
- type: 'primary',
|
|
|
+ name: this.$t("submitText"),
|
|
|
+ methodsText: "submit",
|
|
|
+ type: "primary",
|
|
|
submit: () => {
|
|
|
- this.handleSubmit()
|
|
|
+ this.handleSubmit();
|
|
|
},
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
},
|
|
|
dialogRules: {
|
|
|
- tdaApplicationId: [{ required: true, message: this.$t('Internet_of_things.equipment.tdaApplicationIdRules'), trigger: 'change' }],
|
|
|
- tdaProductId: [{ required: true, message: this.$t('Internet_of_things.equipment.tdaProductIdRules'), trigger: 'change' }],
|
|
|
- deviceName: [{ required: true, message: this.$t('Internet_of_things.equipment.deviceNameRules'), trigger: 'blur' }],
|
|
|
- nodeId: [{ required: true, message: this.$t('Internet_of_things.equipment.nodeIdRules'), trigger: 'blur' }],
|
|
|
- secret: [{ required: true, message: this.$t('Internet_of_things.equipment.secretRules'), trigger: 'blur' }],
|
|
|
+ tdaApplicationId: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t(
|
|
|
+ "Internet_of_things.equipment.tdaApplicationIdRules"
|
|
|
+ ),
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ tdaProductId: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t("Internet_of_things.equipment.tdaProductIdRules"),
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ deviceName: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t("Internet_of_things.equipment.deviceNameRules"),
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ nodeId: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t("Internet_of_things.equipment.nodeIdRules"),
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ secret: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: this.$t("Internet_of_things.equipment.secretRules"),
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
},
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
created() {
|
|
|
- this.getSelectList()
|
|
|
+ this.getSelectList();
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.getList()
|
|
|
+ this.getList();
|
|
|
},
|
|
|
watch: {
|
|
|
- 'dialogParams.tdaApplicationId': {
|
|
|
+ "dialogParams.tdaApplicationId": {
|
|
|
handler(val) {
|
|
|
if (val) {
|
|
|
APISelect.tdaProductList({ tdaApplicationId: val }).then((res) => {
|
|
|
- this.dialogForm.tdaProductId.data = res.data.data
|
|
|
- })
|
|
|
+ this.dialogForm.tdaProductId.data = res.data.data;
|
|
|
+ });
|
|
|
} else {
|
|
|
- this.dialogForm.tdaProductId.data = []
|
|
|
+ this.dialogForm.tdaProductId.data = [];
|
|
|
}
|
|
|
- this.dialogParams.tdaProductId = ''
|
|
|
+ this.dialogParams.tdaProductId = "";
|
|
|
},
|
|
|
immediate: true,
|
|
|
},
|
|
@@ -183,75 +265,75 @@ export default {
|
|
|
methods: {
|
|
|
getSelectList() {
|
|
|
APISelect.tdaApplicationList().then((res) => {
|
|
|
- this.queryForm.tdaApplicationId.data = res.data.data
|
|
|
- this.dialogForm.tdaApplicationId.data = res.data.data
|
|
|
- })
|
|
|
+ this.queryForm.tdaApplicationId.data = res.data.data;
|
|
|
+ this.dialogForm.tdaApplicationId.data = res.data.data;
|
|
|
+ });
|
|
|
APISelect.tdaProductList().then((res) => {
|
|
|
- this.queryForm.tdaProductId.data = res.data.data
|
|
|
- })
|
|
|
+ this.queryForm.tdaProductId.data = res.data.data;
|
|
|
+ });
|
|
|
},
|
|
|
getList() {
|
|
|
- this.loading = true
|
|
|
+ this.loading = true;
|
|
|
API.tdaDevicePage(this.queryParams).then(
|
|
|
(res) => {
|
|
|
- this.total = res.data.data.total
|
|
|
- this.tableList = res.data.data.records
|
|
|
- this.loading = false
|
|
|
+ this.total = res.data.data.total;
|
|
|
+ this.tableList = res.data.data.records;
|
|
|
+ this.loading = false;
|
|
|
},
|
|
|
(err) => {
|
|
|
- console.log('tdaDevicePage: ' + err)
|
|
|
- this.loading = false
|
|
|
- },
|
|
|
- )
|
|
|
+ console.log("tdaDevicePage: " + err);
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
},
|
|
|
handleAdd() {
|
|
|
this.dialogParams = {
|
|
|
- tdaApplicationId: '',
|
|
|
- tdaProductId: '',
|
|
|
- nodeId: '',
|
|
|
- deviceName: '',
|
|
|
- secret: 'Fjhx@2012#',
|
|
|
- }
|
|
|
- this.open = true
|
|
|
+ tdaApplicationId: "",
|
|
|
+ tdaProductId: "",
|
|
|
+ nodeId: "",
|
|
|
+ deviceName: "",
|
|
|
+ secret: "Fjhx@2012#",
|
|
|
+ };
|
|
|
+ this.open = true;
|
|
|
},
|
|
|
handleSubmit() {
|
|
|
- this.$refs.test.$refs['form'].validate((valid) => {
|
|
|
+ this.$refs.test.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- this.dialogForm.loadingStatus = true
|
|
|
+ this.dialogForm.loadingStatus = true;
|
|
|
API.tdaDeviceAdd(this.dialogParams).then(
|
|
|
() => {
|
|
|
- this.msgSuccess(this.$t('addSuccess'))
|
|
|
- this.open = false
|
|
|
- this.dialogForm.loadingStatus = false
|
|
|
- this.getList()
|
|
|
+ this.msgSuccess(this.$t("addSuccess"));
|
|
|
+ this.open = false;
|
|
|
+ this.dialogForm.loadingStatus = false;
|
|
|
+ this.getList();
|
|
|
},
|
|
|
(err) => {
|
|
|
- console.log('tdaDeviceAdd: ' + err)
|
|
|
- this.dialogForm.loadingStatus = false
|
|
|
- },
|
|
|
- )
|
|
|
+ console.log("tdaDeviceAdd: " + err);
|
|
|
+ this.dialogForm.loadingStatus = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
// } else {
|
|
|
// setTimeout(() => {
|
|
|
// const errorDiv = document.getElementsByClassName('is-error')
|
|
|
// errorDiv[0].scrollIntoView()
|
|
|
// }, 0)
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
handleDelete(row) {
|
|
|
- this.$confirm(this.$t('askDeleteData'), {
|
|
|
- confirmButtonText: this.$t('submitText'),
|
|
|
- cancelButtonText: this.$t('cancelText'),
|
|
|
- type: 'warning',
|
|
|
+ this.$confirm(this.$t("askDeleteData"), {
|
|
|
+ confirmButtonText: this.$t("submitText"),
|
|
|
+ cancelButtonText: this.$t("cancelText"),
|
|
|
+ type: "warning",
|
|
|
}).then(() => {
|
|
|
API.tdaDeviceDelete({ id: row.id }).then(() => {
|
|
|
- this.msgSuccess(this.$t('deleteSuccess'))
|
|
|
- this.getList()
|
|
|
- })
|
|
|
- })
|
|
|
+ this.msgSuccess(this.$t("deleteSuccess"));
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|