diff --git a/src/api/communication/basiccard.js b/src/api/communication/basiccard.js new file mode 100644 index 0000000..51429ac --- /dev/null +++ b/src/api/communication/basiccard.js @@ -0,0 +1,49 @@ +import request from '@/router/axios'; +//列表 +export const getList = (current, size, params) => { + return request({ + url: '/api/iot-sim/simcard/page', + method: 'get', + params: { + ...params, + current, + size, + } + }) +} + +export const getDetail = (id) => { + return request({ + url: '/api/iot-sim/simcard/detail', + method: 'get', + params: { + id + } + }) +} +//新增 +export const add = (row) => { + return request({ + url: '/api/iot-sim/simcard/save', + method: 'post', + data: row + }) +} +//删除 +export const remove = (ids) => { + return request({ + url: '/api/iot-sim/simcard/remove', + method: 'post', + params: { + ids, + } + }) +} +//修改 +export const update = (row) => { + return request({ + url: '/api/iot-sim/simcard/update', + method: 'post', + data: row + }) +} diff --git a/src/api/communication/channel.js b/src/api/communication/channel.js new file mode 100644 index 0000000..9d63e04 --- /dev/null +++ b/src/api/communication/channel.js @@ -0,0 +1,49 @@ +import request from '@/router/axios'; +//列表 +export const getList = (current, size, params) => { + return request({ + url: '/api/iot-sim/channel/page', + method: 'get', + params: { + ...params, + current, + size, + } + }) +} +export const getDetail = (id) => { + return request({ + url: '/api/iot-sim/channel/detail', + method: 'get', + params: { + id + } + }) +} +//新增 +export const add = (row) => { + return request({ + url: '/api/iot-sim/channel/save', + method: 'post', + data: row + }) +} +//删除 +export const remove = (ids) => { + return request({ + url: '/api/iot-sim/channel/remove', + method: 'post', + params: { + ids, + } + }) +} +//修改 +export const update = (row) => { + return request({ + url: '/api/iot-sim/channel/update', + method: 'post', + data: row + }) +} + diff --git a/src/api/communication/outbound.js b/src/api/communication/outbound.js new file mode 100644 index 0000000..69309d7 --- /dev/null +++ b/src/api/communication/outbound.js @@ -0,0 +1,48 @@ +import request from '@/router/axios'; +//列表 +export const getList = (current, size, params) => { + return request({ + url: '/api/iot-sim/channel/page', + method: 'get', + params: { + ...params, + current, + size, + } + }) +} +export const getDetail = (id) => { + return request({ + url: '/api/iot-sim/simcarddeliver/detail', + method: 'get', + params: { + id + } + }) +} +//新增 +export const add = (row) => { + return request({ + url: '/api/iot-sim/simcarddeliver/save', + method: 'post', + data: row + }) +} +//删除 +export const remove = (id) => { + return request({ + url: '/api/iot-sim/simcarddeliver/remove', + method: 'post', + params: { + id, + } + }) +} +//修改 +export const update = (row) => { + return request({ + url: '/api/iot-sim/simcarddeliver/update', + method: 'post', + data: row + }) +} diff --git a/src/config/website.js b/src/config/website.js index 0c3550e..e479f04 100644 --- a/src/config/website.js +++ b/src/config/website.js @@ -5,7 +5,7 @@ export default { title: "saber", logo: "S", key: 'saber',//配置主键,目前用于存储 - indexTitle: '大数据服务平台', + indexTitle: '物联网平台', clientId: 'falcon', // 客户端id clientSecret: 'falcon_secret', // 客户端密钥 tenantMode: true, // 是否开启租户模式 diff --git a/src/views/communicationmanage/basiccard/basiccard.vue b/src/views/communicationmanage/basiccard/basiccard.vue new file mode 100644 index 0000000..6a264f6 --- /dev/null +++ b/src/views/communicationmanage/basiccard/basiccard.vue @@ -0,0 +1,326 @@ +<template> + <basic-container> + <avue-crud + :option="option" + :table-loading="loading" + :data="data" + :page.sync="page" + :permission="permissionList" + :before-open="beforeOpen" + v-model="form" + ref="crud" + @row-update="rowUpdate" + @row-save="rowSave" + @row-del="rowDel" + @search-change="searchChange" + @search-reset="searchReset" + @current-change="currentChange" + @size-change="sizeChange" + @refresh-change="refreshChange" + @on-load="onLoad" + > + </avue-crud> + </basic-container> +</template> + +<script> +import { + getList, + add, + getDetail, + remove, + update, +} from "@/api/communication/basiccard"; +import { mapGetters } from "vuex"; + +export default { + data() { + return { + form: {}, + query: {}, + loading: false, + page: { + pageSize: 10, + currentPage: 1, + total: 0, + }, + option: { + tip: false, + searchShow: true, + searchMenuSpan: 6, + border: true, + index: true, + addBtn: true, + viewBtn: true, + delBtn: true, + columnBtn: false, + selection: false, + dialogClickModal: false, + dialogWidth: "60%", + column: [ + { + label: "通道名称", + prop: "channelId", + dataType: "number", + type: "select", + span: 12, + labelWidth: 130, + search: true, + dicUrl: "/api/iot-sim/simcard/getChannel", + props: { + label: "name", + value: "id", + }, + rules: [ + { + required: true, + message: "请选择通道名称", + trigger: "change", + }, + ], + }, + { + label: "批次号", + prop: "batchNum", + span: 12, + labelWidth: 130, + search: true, + rules: [ + { + required: true, + message: "请输入批次号", + trigger: "blur", + }, + ], + }, + // { + // label: "卡类型", + // prop: "cardType", + // type: "select", + // span: 12, + // dicUrl: "/api/iot-system/dict/dictionary?code=card_type", + // props: { + // label: "dictValue", + // value: "dictKey", + // }, + // dataType:"number", + // labelWidth: 130, + // searchLabelWidth: 120, + // search: true, + // rules: [ + // { + // required: true, + // message: "请选择卡类型", + // trigger: "change", + // }, + // ], + // }, + { + label: "iccid", + prop: "iccid", + width: 150, + span: 12, + labelWidth: 130, + search: true, + rules: [ + { + required: true, + message: "请输入iccid", + trigger: "blur", + }, + ], + }, + { + label: "imsi", + prop: "imsi", + span: 12, + width: 150, + labelWidth: 130, + search: true, + rules: [ + { + required: true, + message: "请输入imsi", + trigger: "blur", + }, + ], + }, + { + label: "msisdn", + prop: "msisdn", + span: 12, + labelWidth: 130, + search: true, + rules: [ + { + required: true, + message: "请输入msisdn", + trigger: "blur", + }, + ], + }, + { + label: "是否出库", + prop: "isDeliver", + type: "select", + dicUrl: "/api/iot-system/dict/dictionary?code=yes_no", + props: { + label: "dictValue", + value: "dictKey", + }, + dataType: "number", + span: 12, + labelWidth: 130, + search: true, + rules: [ + { required: true, message: "请选择是否出库", trigger: "change" }, + ], + }, + { + label: "沉默期最后时间", + prop: "silentLastTime", + span: 12, + labelWidth: 130, + type: "datetime", + format: "yyyy-MM-dd hh:mm:ss", + valueFormat: "yyyy-MM-dd hh:mm:ss", + hide: true, + rules: [ + { + required: true, + message: "请选择沉默期最后时间", + trigger: "change", + }, + ], + }, + { + label: "测试期最后时间", + prop: "testLastTime", + span: 12, + labelWidth: 130, + type: "datetime", + format: "yyyy-MM-dd hh:mm:ss", + valueFormat: "yyyy-MM-dd hh:mm:ss", + hide: true, + rules: [ + { + required: true, + message: "请选择测试期最后时间", + trigger: "change", + }, + ], + }, + ], + }, + data: [], + }; + }, + computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + // viewBtn: this.vaildData(this.permission.sourceApi_view, false), + // editBtn: this.vaildData(this.permission.sourceApi_edit, false), + // delBtn: this.vaildData(this.permission.sourceApi_delete, false), + }; + }, + }, + + methods: { + beforeOpen(done, type) { + if (["edit", "view"].includes(type)) { + getDetail(this.form.id).then((res) => { + this.form = res.data.data; + }); + } + done(); + }, + searchReset() { + this.query = {}; + this.onLoad(this.page); + }, + searchChange(params, done) { + this.query = params; + this.page.currentPage = 1; + this.onLoad(this.page, params); + done(); + }, + //新增 + rowSave(row, done, loading) { + add(row).then( + () => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + done(); + }, + (error) => { + window.console.log(error); + loading(); + } + ); + }, + //修改 + rowUpdate(row, index, done, loading) { + update(row).then( + () => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + done(); + }, + (error) => { + window.console.log(error); + loading(); + } + ); + }, + //删除 + rowDel(row) { + this.$confirm("确定将选择数据删除?", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + return remove(row.id); + }) + .then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + }); + }, + currentChange(currentPage) { + this.page.currentPage = currentPage; + }, + sizeChange(pageSize) { + this.page.pageSize = pageSize; + }, + refreshChange() { + this.onLoad(this.page, this.query); + }, + onLoad(page, params = {}) { + this.loading = true; + getList( + page.currentPage, + page.pageSize, + Object.assign(params, this.query) + ).then((res) => { + const data = res.data.data; + this.page.total = data.total; + this.data = data.records; + this.loading = false; + }); + }, + }, +}; +</script> + +<style></style> diff --git a/src/views/communicationmanage/channel/channel.vue b/src/views/communicationmanage/channel/channel.vue new file mode 100644 index 0000000..16897cd --- /dev/null +++ b/src/views/communicationmanage/channel/channel.vue @@ -0,0 +1,235 @@ +<template> + <basic-container> + <avue-crud + :option="option" + :table-loading="loading" + :data="data" + :page.sync="page" + :permission="permissionList" + :before-open="beforeOpen" + v-model="form" + ref="crud" + @row-update="rowUpdate" + @row-save="rowSave" + @row-del="rowDel" + @search-change="searchChange" + @search-reset="searchReset" + @current-change="currentChange" + @size-change="sizeChange" + @refresh-change="refreshChange" + @on-load="onLoad" + > + </avue-crud> + </basic-container> +</template> + +<script> +import { + getDetail, + getList, + add, + remove, + update, +} from "@/api/communication/channel"; +import { mapGetters } from "vuex"; + +export default { + data() { + return { + form: {}, + query: {}, + loading: false, + page: { + pageSize: 10, + currentPage: 1, + total: 0, + }, + option: { + tip: false, + searchShow: true, + searchMenuSpan: 6, + border: true, + index: true, + addBtn: true, + viewBtn: true, + delBtn: true, + columnBtn: false, + selection: false, + dialogClickModal: false, + dialogWidth: "60%", + column: [ + { + label: "通道名称", + prop: "name", + span: 12, + labelWidth: 130, + search: true, + rules: [ + { + required: true, + message: "请输入通道名称", + trigger: "blur", + }, + ], + }, + { + label: "所属运营商类型", + type: "select", + span: 12, + dicUrl: "/api/iot-system/dict/dictionary?code=carrier_type", + props: { + label: "dictValue", + value: "dictKey", + }, + dataType: "number", + prop: "carrierType", + labelWidth: 130, + searchLabelWidth: 120, + search: true, + rules: [ + { + required: true, + message: "请选择所属运营商类型", + trigger: "change", + }, + ], + }, + { + label: "接口类型", + type: "select", + dicUrl: "/api/iot-system/dict/dictionary?code=interface_type", + props: { + label: "dictValue", + value: "dictKey", + }, + span: 12, + dataType: "number", + prop: "interfaceType", + labelWidth: 130, + search: true, + rules: [ + { required: true, message: "请选择接口类型", trigger: "change" }, + ], + }, + { + label: "apiUrl", + prop: "apiUrl", + span: 12, + labelWidth: 130, + rules: [ + { required: true, message: "请输入apiUrl", trigger: "blur" }, + ], + }, + ], + }, + data: [], + }; + }, + computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + // viewBtn: this.vaildData(this.permission.sourceApi_view, false), + // editBtn: this.vaildData(this.permission.sourceApi_edit, false), + // delBtn: this.vaildData(this.permission.sourceApi_delete, false), + }; + }, + }, + methods: { + beforeOpen(done, type) { + if (["edit", "view"].includes(type)) { + getDetail(this.form.id).then((res) => { + this.form = res.data.data; + }); + } + done(); + }, + searchReset() { + this.query = {}; + this.onLoad(this.page); + }, + searchChange(params, done) { + this.query = params; + this.page.currentPage = 1; + this.onLoad(this.page, params); + done(); + }, + //新增 + rowSave(row, done, loading) { + add(row).then( + () => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + done(); + }, + (error) => { + window.console.log(error); + loading(); + } + ); + }, + //修改 + rowUpdate(row, index, done, loading) { + update(row).then( + () => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + done(); + }, + (error) => { + window.console.log(error); + loading(); + } + ); + }, + //删除 + rowDel(row) { + this.$confirm("确定将选择数据删除?", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + return remove(row.id); + }) + .then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + }); + }, + currentChange(currentPage) { + this.page.currentPage = currentPage; + }, + sizeChange(pageSize) { + this.page.pageSize = pageSize; + }, + refreshChange() { + this.onLoad(this.page, this.query); + }, + onLoad(page, params = {}) { + this.loading = true; + getList( + page.currentPage, + page.pageSize, + Object.assign(params, this.query) + ).then((res) => { + const data = res.data.data; + this.page.total = data.total; + this.data = data.records; + this.loading = false; + }); + }, + }, +}; +</script> + +<style></style> diff --git a/src/views/communicationmanage/outbound/outbound.vue b/src/views/communicationmanage/outbound/outbound.vue new file mode 100644 index 0000000..c26c32b --- /dev/null +++ b/src/views/communicationmanage/outbound/outbound.vue @@ -0,0 +1,285 @@ +<template> + <basic-container> + <avue-crud + :option="option" + :table-loading="loading" + :data="data" + :page.sync="page" + :permission="permissionList" + :before-open="beforeOpen" + v-model="form" + ref="crud" + @row-update="rowUpdate" + @row-save="rowSave" + @row-del="rowDel" + @search-change="searchChange" + @search-reset="searchReset" + @current-change="currentChange" + @size-change="sizeChange" + @refresh-change="refreshChange" + @on-load="onLoad" + > + </avue-crud> + </basic-container> +</template> + +<script> +import { getList,add,getDetail,remove,update } from "@/api/communication/basiccard"; +import { mapGetters } from "vuex"; + +export default { + data() { + return { + form: {}, + query: {}, + loading: true, + page: { + pageSize: 10, + currentPage: 1, + total: 0, + }, + option: { + tip: false, + searchShow: true, + searchMenuSpan: 6, + border: true, + index: true, + addBtn: true, + viewBtn: true, + delBtn: true, + columnBtn: false, + selection: false, + dialogClickModal: false, + dialogWidth: "60%", + column: [ + { + label: "批次号", + prop: "batchNum", + span: 12, + labelWidth: 130, + search: true, + rules: [ + { + required: true, + message: "请输入通道名称", + trigger: "blur", + }, + ], + }, + { + label: "卡类型", + prop: "cardType", + type: "select", + span: 12, + dicUrl: "/api/iot-sim/channel/fillData", + props: { + label: "dictValue", + value: "dictKey", + }, + // dataType: "number", + labelWidth: 130, + searchLabelWidth: 120, + search: true, + rules: [ + { + required: true, + message: "请选择所属运营商类型", + trigger: "change", + }, + ], + }, + { + label: "iccid", + prop: "iccid", + span: 12, + labelWidth: 130, + search: true, + rules: [ + { + required: true, + message: "请输入通道名称", + trigger: "blur", + }, + ], + }, + { + label: "imsi", + prop: "imsi", + span: 12, + labelWidth: 130, + search: true, + rules: [ + { + required: true, + message: "请输入通道名称", + trigger: "blur", + }, + ], + }, + { + label: "是否出库", + prop: "isDeliver", + type: "select", + dicData: [ + { + label: "否", + value: 0, + }, + { + label: "是", + value: 1, + }, + ], + span: 12, + props: { + label: "label", + value: "value", + }, + labelWidth: 130, + search: true, + // slot: true, + // editDisplay: false, + rules: [ + { required: true, message: "请选择接口类型", trigger: "change" }, + ], + }, + { + label: "业务状态", + prop: "status", + span: 12, + labelWidth: 130, + rules: [ + { required: true, message: "请输入apiUrl", trigger: "blur" }, + ], + }, + { + label: "剩余流量(单位M)", + prop: "surplus", + span: 12, + labelWidth: 130, + rules: [ + { required: true, message: "请输入apiUrl", trigger: "blur" }, + ], + }, + { + label: "使用量(单位M)", + prop: "usage", + span: 12, + labelWidth: 130, + rules: [ + { required: true, message: "请输入apiUrl", trigger: "blur" }, + ], + }, + ], + }, + data: [], + }; + }, + computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + viewBtn: this.vaildData(this.permission.sourceApi_view, false), + editBtn: this.vaildData(this.permission.sourceApi_edit, false), + delBtn: this.vaildData(this.permission.sourceApi_delete, false), + }; + }, + }, + methods: { + beforeOpen(done, type) { + if (["edit", "view"].includes(type)) { + getDetail(this.form.id).then((res) => { + this.form = res.data.data; + }); + } + done(); + }, + searchReset() { + this.query = {}; + this.onLoad(this.page); + }, + searchChange(params, done) { + this.query = params; + this.page.currentPage = 1; + this.onLoad(this.page, params); + done(); + }, + //新增 + rowSave(row, done, loading) { + add(row).then( + () => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + done(); + }, + (error) => { + window.console.log(error); + loading(); + } + ); + }, + //修改 + rowUpdate(row, index, done, loading) { + update(row).then( + () => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + done(); + }, + (error) => { + window.console.log(error); + loading(); + } + ); + }, + //删除 + rowDel(row) { + this.$confirm("确定将选择数据删除?", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + return remove(row.id); + }) + .then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + }); + }, + currentChange(currentPage) { + this.page.currentPage = currentPage; + }, + sizeChange(pageSize) { + this.page.pageSize = pageSize; + }, + refreshChange() { + this.onLoad(this.page, this.query); + }, + onLoad(page, params = {}) { + this.loading = true; + getList( + page.currentPage, + page.pageSize, + Object.assign(params, this.query) + ).then((res) => { + const data = res.data.data; + this.page.total = data.total; + this.data = data.records; + this.loading = false; + }); + }, + }, +}; +</script> + +<style></style> diff --git a/src/views/test.vue b/src/views/test.vue index 04e63b9..55d208e 100644 --- a/src/views/test.vue +++ b/src/views/test.vue @@ -1,10 +1,324 @@ <template> - <basic-container>测试页</basic-container> + <basic-container> + <!-- :table-loading="loading" :permission="permissionList" --> + <avue-crud + :option="option" + :data="data" + :page.sync="page" + :before-open="beforeOpen" + v-model="form" + ref="crud" + @row-update="rowUpdate" + @row-save="rowSave" + @row-del="rowDel" + @search-change="searchChange" + @search-reset="searchReset" + @current-change="currentChange" + @size-change="sizeChange" + @refresh-change="refreshChange" + @on-load="onLoad" + > + <template slot-scope="scope" slot="menu"> + <el-button type="text" icon="el-icon-circle-plus-outline" size="small" + >新增子项 + </el-button> + </template> + </avue-crud> + </basic-container> </template> <script> - export default {}; +// import {getDetail, getList} from "@/api/core/customer/customerApi"; +import { mapGetters } from "vuex"; + +export default { + data() { + return { + form: {}, + query: {}, + // loading: true, + page: { + pageSize: 10, + currentPage: 1, + total: 0, + }, + option: { + height: "auto", //高度自动 + calcHeight: 30, + index: true, //表格序号 + searchShow: true, //搜索是否展示 + searchMenuSpan: 6, //搜索按钮的占位大小 + searchType:'menu', + tip: true, //提示 + border: true, //边框 + headerAlign: "center", //表头居中 + align: "center", //内容居中 + addBtn: true, //添加按钮 + editBtn: true, //编辑按钮 + viewBtn: true, //查看按钮 + delBtn: true, //删除按钮 + searchBtn: true, //搜索按钮 + saveBtn: true, //弹窗保存按钮 + updateBtn: true, //更新按钮 + cancelBtn: true, //弹窗取消按钮 + dateBtn: false, //日期组件 + printBtn: true, //打印按钮 + excelBtn: true, //导出按钮 + searchShowBtn:true,//搜索折叠 + searchIcon:true,//半搜索按钮 + refreshBtn: true, //刷新按钮 + filterBtn: false, //筛选按钮 + showColumnBtn: false, + dialogType: "dialog", //弹窗类型 dialog弹窗 drawer抽屉 + dialogFullscreen: false, //弹窗是否全屏 + dialogEscape: true, //弹窗esc关闭 + dialogModal: true, //弹窗模态框 + dialogClickModal: false, //弹窗点击模态框 是否关闭 + dialogCloseBtn: true, //弹窗关闭按钮 + menu: true, //操作栏是否显示 + menuAlign: "center", //操作栏对齐方式 + menuType: "menu", //按钮样式 icon 图标 + column: [ + { + label: "姓名", + prop: "name", + type: "input", + size: "mini", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + // { + // label: "时间", + // prop: "time", + // type: "timerange", + // search: true, + // span: 24, + // }, + ], + }, + data: [], + }; + }, + computed: { + ...mapGetters(["permission"]), + // permissionList() { + // return { + // viewBtn: this.vaildData(this.permission.sourceApi_view, false), + // editBtn: this.vaildData(this.permission.sourceApi_edit, false), + // delBtn: this.vaildData(this.permission.sourceApi_delete, false), + // }; + // }, + }, + methods: { + beforeOpen(done, type) { + if (["edit", "view"].includes(type)) { + getDetail(this.form.id).then((res) => { + this.form = res.data.data; + }); + } + done(); + }, + rowSave(row, done, loading) { + add(row).then( + () => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + done(); + }, + (error) => { + window.console.log(error); + loading(); + } + ); + }, + rowUpdate(row, index, done, loading) { + update(row).then( + () => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + done(); + }, + (error) => { + window.console.log(error); + loading(); + } + ); + }, + rowDel(row) { + this.$confirm("确定将选择数据删除?", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + return remove(row.id); + }) + .then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + }); + }, + searchReset() { + this.query = {}; + this.onLoad(this.page); + }, + searchChange(params, done) { + this.query = params; + this.page.currentPage = 1; + this.onLoad(this.page, params); + done(); + }, + currentChange(currentPage) { + this.page.currentPage = currentPage; + }, + sizeChange(pageSize) { + this.page.pageSize = pageSize; + }, + refreshChange() { + this.onLoad(this.page, this.query); + }, + onLoad(page, params = {}) { + this.data = [ + { + name: "喜羊羊", + age: 12, + }, + { + name: "懒羊羊", + age: 16, + }, + ]; + // this.loading = true; + // getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { + // const data = res.data.data; + // this.page.total = data.total; + // this.data = data.records; + // this.loading = false; + // }); + }, + }, +}; </script> -<style> -</style> +<style></style> diff --git a/src/views/util/test.vue b/src/views/util/test.vue index 6609c25..e3865f4 100644 --- a/src/views/util/test.vue +++ b/src/views/util/test.vue @@ -1,21 +1,324 @@ <template> - <div> - <basic-container>测试页</basic-container> - </div> + <basic-container> + <!-- :table-loading="loading" :permission="permissionList" --> + <avue-crud + :option="option" + :data="data" + :page.sync="page" + :before-open="beforeOpen" + v-model="form" + ref="crud" + @row-update="rowUpdate" + @row-save="rowSave" + @row-del="rowDel" + @search-change="searchChange" + @search-reset="searchReset" + @current-change="currentChange" + @size-change="sizeChange" + @refresh-change="refreshChange" + @on-load="onLoad" + > + <template slot-scope="scope" slot="menu"> + <el-button type="text" icon="el-icon-circle-plus-outline" size="small" + >新增子项 + </el-button> + </template> + </avue-crud> + </basic-container> </template> <script> - export default { - name: "wel", - data() { - return {}; +// import {getDetail, getList} from "@/api/core/customer/customerApi"; +import { mapGetters } from "vuex"; + +export default { + data() { + return { + form: {}, + query: {}, + // loading: true, + page: { + pageSize: 10, + currentPage: 1, + total: 0, + }, + option: { + height: "auto", //高度自动 + calcHeight: 30, + index: true, //表格序号 + searchShow: true, //搜索是否展示 + searchMenuSpan: 6, //搜索按钮的占位大小 + searchType:'menu', + tip: true, //提示 + border: true, //边框 + headerAlign: "center", //表头居中 + align: "center", //内容居中 + addBtn: true, //添加按钮 + editBtn: true, //编辑按钮 + viewBtn: true, //查看按钮 + delBtn: true, //删除按钮 + searchBtn: true, //搜索按钮 + saveBtn: true, //弹窗保存按钮 + updateBtn: true, //更新按钮 + cancelBtn: true, //弹窗取消按钮 + dateBtn: false, //日期组件 + printBtn: true, //打印按钮 + excelBtn: true, //导出按钮 + searchShowBtn:true,//搜索显隐 + searchIcon:true,//搜索折叠 + refreshBtn: true, //刷新按钮 + filterBtn: false, //筛选按钮 + showColumnBtn: false, + dialogType: "dialog", //弹窗类型 dialog弹窗 drawer抽屉 + dialogFullscreen: false, //弹窗是否全屏 + dialogEscape: true, //弹窗esc关闭 + dialogModal: true, //弹窗模态框 + dialogClickModal: false, //弹窗点击模态框 是否关闭 + dialogCloseBtn: true, //弹窗关闭按钮 + menu: true, //操作栏是否显示 + menuAlign: "center", //操作栏对齐方式 + menuType: "menu", //按钮样式 icon 图标 + column: [ + { + label: "姓名", + prop: "name", + type: "input", + size: "mini", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + { + label: "年龄", + prop: "age", + type: "input", + search: true, + span: 12, + }, + // { + // label: "时间", + // prop: "time", + // type: "timerange", + // search: true, + // span: 24, + // }, + ], + }, + data: [], + }; + }, + computed: { + ...mapGetters(["permission"]), + // permissionList() { + // return { + // viewBtn: this.vaildData(this.permission.sourceApi_view, false), + // editBtn: this.vaildData(this.permission.sourceApi_edit, false), + // delBtn: this.vaildData(this.permission.sourceApi_delete, false), + // }; + // }, + }, + methods: { + beforeOpen(done, type) { + if (["edit", "view"].includes(type)) { + getDetail(this.form.id).then((res) => { + this.form = res.data.data; + }); + } + done(); + }, + rowSave(row, done, loading) { + add(row).then( + () => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + done(); + }, + (error) => { + window.console.log(error); + loading(); + } + ); + }, + rowUpdate(row, index, done, loading) { + update(row).then( + () => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + done(); + }, + (error) => { + window.console.log(error); + loading(); + } + ); + }, + rowDel(row) { + this.$confirm("确定将选择数据删除?", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + return remove(row.id); + }) + .then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!", + }); + }); + }, + searchReset() { + this.query = {}; + this.onLoad(this.page); + }, + searchChange(params, done) { + this.query = params; + this.page.currentPage = 1; + this.onLoad(this.page, params); + done(); + }, + currentChange(currentPage) { + this.page.currentPage = currentPage; + }, + sizeChange(pageSize) { + this.page.pageSize = pageSize; + }, + refreshChange() { + this.onLoad(this.page, this.query); }, - computed: {}, - created() { + onLoad(page, params = {}) { + this.data = [ + { + name: "喜羊羊", + age: 12, + }, + { + name: "懒羊羊", + age: 16, + }, + ]; + // this.loading = true; + // getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { + // const data = res.data.data; + // this.page.total = data.total; + // this.data = data.records; + // this.loading = false; + // }); }, - methods: {} - }; + }, +}; </script> -<style scoped="scoped" lang="scss"> -</style> +<style></style> diff --git a/src/views/wel/component/Administrator.vue b/src/views/wel/component/Administrator.vue index 521c05b..173d326 100644 --- a/src/views/wel/component/Administrator.vue +++ b/src/views/wel/component/Administrator.vue @@ -1,7 +1,7 @@ <template> <div class="app-container"> <div class="dashboard-container"> - <div class="dashboard-text">欢迎访问大数据服务平台!</div> + <div class="dashboard-text">欢迎访问物联网平台!</div> <div> <img src="@/assets/shouye.png" alt class="dashboard-img" /> </div>