Browse Source

feat:开发基础卡导出 导入 分拨 功能

confidence
杜贤金 3 years ago
parent
commit
84d489ad3c
  1. 33
      src/api/communication/basiccard.js
  2. 361
      src/views/communicationmanage/basiccard/basiccard.vue
  3. 27
      src/views/communicationmanage/device/device.vue
  4. 1808
      src/views/system/user.vue

33
src/api/communication/basiccard.js

@ -47,3 +47,36 @@ export const update = (row) => {
data: row data: row
}) })
} }
//分拨类型下拉
export const allocate = () => {
return request({
url: '/api/iot-system/dict/dictionary?code=allocate',
method: 'get',
})
}
//租户下拉
export const tenant = () => {
return request({
url:'/api/iot-system/tenant/fillData',
method: 'get',
})
}
//分拨操作
export const simdeliver = (params) => {
return request({
url:'/api/iot-sim/simcard/simdeliver',
method: 'post',
params: {
...params,
}
})
}
//通道
export const channelfillData = () => {
return request({
url:'/api/iot-sim/channel/fillData',
method: 'get',
})
}

361
src/views/communicationmanage/basiccard/basiccard.vue

@ -12,6 +12,7 @@
@row-update="rowUpdate" @row-update="rowUpdate"
@row-save="rowSave" @row-save="rowSave"
@row-del="rowDel" @row-del="rowDel"
@selection-change="selectionChange"
@search-change="searchChange" @search-change="searchChange"
@search-reset="searchReset" @search-reset="searchReset"
@current-change="currentChange" @current-change="currentChange"
@ -19,7 +20,117 @@
@refresh-change="refreshChange" @refresh-change="refreshChange"
@on-load="onLoad" @on-load="onLoad"
> >
<template slot="menuLeft">
<el-button
size="small"
type="primary"
icon="el-icon-download"
@click="handleExport"
>导出
</el-button>
<el-button
type="primary"
size="small"
icon="el-icon-upload2"
@click="handleImport"
>导入</el-button
>
<el-button
type="primary"
size="small"
icon="el-icon-share"
@click="handleAllocate"
>分拨</el-button
>
<!-- <el-button
size="small"
type="primary"
icon="el-icon-sell"
@click="delivery"
>&nbsp库</el-button> -->
</template>
</avue-crud> </avue-crud>
<!-- 导出 :upload-after="uploadAfter"-->
<el-dialog title="导入" append-to-body :visible.sync="excelBox" width="40%">
<avue-form :option="excelOption" v-model="excelForm" @submit="submit">
<template slot="excelTemplate">
<el-button type="primary" @click="handleTemplate">
点击下载<i class="el-icon-download el-icon--right"></i>
</el-button>
</template>
</avue-form>
</el-dialog>
<!-- 分拨弹窗 -->
<el-dialog
title="分拨"
:visible.sync="dialogVisible"
append-to-body
width="35%"
:before-close="handleClose"
>
<el-form
ref="distribution"
:model="distribution"
:rules="distrules"
label-width="120px"
>
<el-form-item label="分拨租户" prop="tenantId">
<el-select
v-model="distribution.tenantId"
placeholder="请选择分拨租户"
size="mini"
style="width: 90%"
>
<el-option
v-for="(item, index) in tenantlist"
:label="item.tenantName"
:value="item.tenantId"
:key="item.tenantId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="分拨类型" prop="deliverType">
<el-select
v-model="distribution.deliverType"
placeholder="请选择分拨类型"
size="mini"
style="width: 90%"
>
<el-option
v-for="(item, index) in distributionlist"
:label="item.dictValue"
:value="item.dictKey"
:key="item.dictKey"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="开始/结束号码" required>
<el-col :span="10">
<el-form-item prop="numStart">
<el-input
v-model="distribution.numStart"
placeholder="请输入开始号码"
size="mini"
></el-input>
</el-form-item>
</el-col>
<el-col style="text-align: center" :span="2">-</el-col>
<el-col :span="10">
<el-form-item prop="numEnd">
<el-input
v-model="distribution.numEnd"
placeholder="请输入结束号码"
size="mini"
></el-input>
</el-form-item>
</el-col>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleSubmit"> </el-button>
<el-button @click="handleClose"> </el-button>
</span>
</el-dialog>
</basic-container> </basic-container>
</template> </template>
@ -30,15 +141,115 @@ import {
getDetail, getDetail,
remove, remove,
update, update,
allocate,
tenant,
simdeliver,
channelfillData,
} from "@/api/communication/basiccard"; } from "@/api/communication/basiccard";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import website from "@/config/website";
import { getToken } from "@/util/auth";
export default { export default {
data() { data() {
var start = (rule, value, callback) => {
if (value == null) {
callback(new Error("开始号码不能为空"));
} else if (value < 0) {
callback(new Error("开始号码不能为负数"));
} else {
callback();
}
};
var end = (rule, value, callback) => {
if (value == null) {
callback(new Error("结束号码不能为空"));
} else if (value < 0) {
callback(new Error("结束号码不能为负数"));
} else if (Number(value) < Number(this.distribution.numStart)) {
callback(new Error("结束号码必须大于开始号码"));
} else {
callback();
}
};
return { return {
form: {}, form: {},
excelForm: {
tenantId: "",
isCovered: 0,
},
excelOption: {
column: [
{
label: "通道名称",
prop: "tenantId",
type: "select",
span: 24,
dicUrl: "/api/iot-sim/channel/fillData",
props: {
label: "name",
value: "id",
},
rules: [
{
required: true,
message: "请选择通道名称",
trigger: "change",
},
],
},
{
label: "模板上传",
prop: "excelFile",
type: "upload",
drag: true,
loadText: "模板上传中,请稍等",
span: 24,
propsHttp: {
res: "data",
},
tip: "请上传 .xls,.xlsx 标准格式文件",
action: "/api/iot-sim/simcard/import-simCard",
rules: [
{
required: true,
message: "请选择文件",
trigger: "change",
},
],
},
{
label: "模板下载",
prop: "excelTemplate",
formslot: true,
span: 24,
},
],
},
distribution: {
tenantId: "", //id
deliverType: null, //
numStart: null, //
numEnd: null, //
}, //
distributionlist: [], //
tenantlist: [], //
distrules: {
tenantId: [
{ required: true, message: "请选择分拨租户", trigger: "change" },
],
deliverType: [
{ required: true, message: "请选择分拨类型", trigger: "change" },
],
numStart: [{ validator: start, trigger: "blur" }],
numEnd: [{ validator: end, trigger: "blur" }],
},
channellist: [], //
ruleForm: {}, //
dialogVisible: false, //
query: {}, query: {},
selectionList: [],
loading: false, loading: false,
excelBox: false,
page: { page: {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
@ -53,6 +264,7 @@ export default {
addBtn: true, addBtn: true,
viewBtn: true, viewBtn: true,
delBtn: true, delBtn: true,
excelBtn: false, //
columnBtn: false, columnBtn: false,
selection: false, selection: false,
dialogClickModal: false, dialogClickModal: false,
@ -66,7 +278,7 @@ export default {
span: 12, span: 12,
labelWidth: 130, labelWidth: 130,
search: true, search: true,
dicUrl: "/api/iot-sim/simcard/getChannel", dicUrl: "/api/iot-sim/channel/fillData",
props: { props: {
label: "name", label: "name",
value: "id", value: "id",
@ -224,9 +436,34 @@ export default {
// delBtn: this.vaildData(this.permission.sourceApi_delete, false), // delBtn: this.vaildData(this.permission.sourceApi_delete, false),
}; };
}, },
ids() {
let ids = [];
this.selectionList.forEach((ele) => {
ids.push(ele.id);
});
return ids.join(",");
},
},
created() {
this.allocatelist(); //
this.tenantlists(); //
// this.channellists(); //
},
watch: {
"excelForm.tenantId"() {
if (this.excelForm.tenantId != "") {
if (process.env.NODE_ENV === "production") {
const column = this.findObject(this.excelOption.column, "excelFile");
column.action = `http://223.99.228.240:18081/api/iot-sim/simcard/import-simCard?channelId=${this.excelForm.tenantId}`;
} else {
const column = this.findObject(this.excelOption.column, "excelFile");
column.action = `/api/iot-sim/simcard/import-simCard?channelId=${this.excelForm.tenantId}`;
}
}
},
}, },
methods: { methods: {
//
beforeOpen(done, type) { beforeOpen(done, type) {
if (["edit", "view"].includes(type)) { if (["edit", "view"].includes(type)) {
getDetail(this.form.id).then((res) => { getDetail(this.form.id).then((res) => {
@ -235,10 +472,12 @@ export default {
} }
done(); done();
}, },
//
searchReset() { searchReset() {
this.query = {}; this.query = {};
this.onLoad(this.page); this.onLoad(this.page);
}, },
//
searchChange(params, done) { searchChange(params, done) {
this.query = params; this.query = params;
this.page.currentPage = 1; this.page.currentPage = 1;
@ -297,15 +536,130 @@ export default {
}); });
}); });
}, },
//
selectionChange(list) {
this.selectionList = list;
},
//
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
//
currentChange(currentPage) { currentChange(currentPage) {
this.page.currentPage = currentPage; this.page.currentPage = currentPage;
}, },
//
sizeChange(pageSize) { sizeChange(pageSize) {
this.page.pageSize = pageSize; this.page.pageSize = pageSize;
}, },
//
refreshChange() { refreshChange() {
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
}, },
//
delivery() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
} else {
this.$message.error(this.ids);
console.log(this.ids, typeof this.ids);
}
},
//
handleExport() {
if (process.env.NODE_ENV === "production") {
window.open(
`http://223.99.228.240:18081/bd-core/tenant/dailybill/export-excel?${
this.website.tokenHeader
}=${getToken()}`
);
} else {
window.open(
`/api/iot-sim/simcard/export-simCard?${
this.website.tokenHeader
}=${getToken()}`
);
}
},
//
handleImport() {
this.excelBox = true;
},
//
uploadAfter(res, done, loading, column) {
this.excelBox = false;
this.refreshChange();
done();
},
submit(res, done, loading, column) {
this.excelBox = false;
this.refreshChange();
done();
},
//
handleTemplate() {
window.open(
`/api/iot-system/user/export-template?${
this.website.tokenHeader
}=${getToken()}`
);
},
//
allocatelist() {
allocate().then((res) => {
if (res.data.code == 200) {
this.distributionlist = res.data.data;
}
});
},
//
tenantlists() {
tenant().then((res) => {
if (res.data.code == 200) {
this.tenantlist = res.data.data;
}
});
},
//
handleAllocate() {
this.dialogVisible = true;
},
//
handleClose() {
this.dialogVisible = false;
this.$refs.distribution.resetFields();
},
//
handleSubmit() {
this.$refs.distribution.validate((valid) => {
if (valid) {
simdeliver(this.distribution).then((res) => {
if (res.data.data == "") {
this.$message.success("操作成功");
this.$refs.distribution.resetFields();
this.dialogVisible = false;
} else {
const h = this.$createElement;
this.$notify.error({
title: "错误号码",
message: h(
"i",
{ style: "color: teal; word-break: break-all;" },
res.data.data
),
duration: 0,
});
this.$refs.distribution.resetFields();
this.dialogVisible = false;
}
});
} else {
}
});
},
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true; this.loading = true;
getList( getList(
@ -317,6 +671,7 @@ export default {
this.page.total = data.total; this.page.total = data.total;
this.data = data.records; this.data = data.records;
this.loading = false; this.loading = false;
this.selectionClear();
}); });
}, },
}, },

27
src/views/communicationmanage/device/device.vue

@ -19,6 +19,15 @@
@refresh-change="refreshChange" @refresh-change="refreshChange"
@on-load="onLoad" @on-load="onLoad"
> >
<template slot="menuLeft">
<el-button
size="small"
type="primary"
icon="el-icon-download"
@click="handleExport"
>导出
</el-button>
</template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
</template> </template>
@ -279,6 +288,24 @@ export default {
refreshChange() { refreshChange() {
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
}, },
//
handleExport() {
if (process.env.NODE_ENV === "production") {
window.open(
`http://223.99.228.240:18081/bd-core/tenant/dailybill/export-excel?${
this.website.tokenHeader
}=${getToken()}&tenantId=${this.exp.tenantId}&yyyyMMdd=${
this.exp.yyyyMMdd
}`
);
} else {
window.open(
`/api/iot-sim/simcard/export-simCard?${
this.website.tokenHeader
}=${getToken()}`
);
}
},
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true; this.loading = true;
getList( getList(

1808
src/views/system/user.vue

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save