|
|
|
@ -12,6 +12,7 @@
|
|
|
|
|
@row-update="rowUpdate" |
|
|
|
|
@row-save="rowSave" |
|
|
|
|
@row-del="rowDel" |
|
|
|
|
@selection-change="selectionChange" |
|
|
|
|
@search-change="searchChange" |
|
|
|
|
@search-reset="searchReset" |
|
|
|
|
@current-change="currentChange" |
|
|
|
@ -19,7 +20,117 @@
|
|
|
|
|
@refresh-change="refreshChange" |
|
|
|
|
@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" |
|
|
|
|
>出 库</el-button> --> |
|
|
|
|
</template> |
|
|
|
|
</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> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
@ -30,15 +141,115 @@ import {
|
|
|
|
|
getDetail, |
|
|
|
|
remove, |
|
|
|
|
update, |
|
|
|
|
allocate, |
|
|
|
|
tenant, |
|
|
|
|
simdeliver, |
|
|
|
|
channelfillData, |
|
|
|
|
} from "@/api/communication/basiccard"; |
|
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
|
|
|
|
|
|
import website from "@/config/website"; |
|
|
|
|
import { getToken } from "@/util/auth"; |
|
|
|
|
export default { |
|
|
|
|
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 { |
|
|
|
|
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: {}, |
|
|
|
|
selectionList: [], |
|
|
|
|
loading: false, |
|
|
|
|
excelBox: false, |
|
|
|
|
page: { |
|
|
|
|
pageSize: 10, |
|
|
|
|
currentPage: 1, |
|
|
|
@ -53,6 +264,7 @@ export default {
|
|
|
|
|
addBtn: true, |
|
|
|
|
viewBtn: true, |
|
|
|
|
delBtn: true, |
|
|
|
|
excelBtn: false, //导出 |
|
|
|
|
columnBtn: false, |
|
|
|
|
selection: false, |
|
|
|
|
dialogClickModal: false, |
|
|
|
@ -66,7 +278,7 @@ export default {
|
|
|
|
|
span: 12, |
|
|
|
|
labelWidth: 130, |
|
|
|
|
search: true, |
|
|
|
|
dicUrl: "/api/iot-sim/simcard/getChannel", |
|
|
|
|
dicUrl: "/api/iot-sim/channel/fillData", |
|
|
|
|
props: { |
|
|
|
|
label: "name", |
|
|
|
|
value: "id", |
|
|
|
@ -224,9 +436,34 @@ export default {
|
|
|
|
|
// 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: { |
|
|
|
|
//详情 |
|
|
|
|
beforeOpen(done, type) { |
|
|
|
|
if (["edit", "view"].includes(type)) { |
|
|
|
|
getDetail(this.form.id).then((res) => { |
|
|
|
@ -235,10 +472,12 @@ export default {
|
|
|
|
|
} |
|
|
|
|
done(); |
|
|
|
|
}, |
|
|
|
|
//重置搜索 |
|
|
|
|
searchReset() { |
|
|
|
|
this.query = {}; |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
}, |
|
|
|
|
//搜索 |
|
|
|
|
searchChange(params, done) { |
|
|
|
|
this.query = params; |
|
|
|
|
this.page.currentPage = 1; |
|
|
|
@ -297,15 +536,130 @@ export default {
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//多选框 |
|
|
|
|
selectionChange(list) { |
|
|
|
|
this.selectionList = list; |
|
|
|
|
}, |
|
|
|
|
//多选框清除 |
|
|
|
|
selectionClear() { |
|
|
|
|
this.selectionList = []; |
|
|
|
|
this.$refs.crud.toggleSelection(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//分页 |
|
|
|
|
currentChange(currentPage) { |
|
|
|
|
this.page.currentPage = currentPage; |
|
|
|
|
}, |
|
|
|
|
//页码规格 |
|
|
|
|
sizeChange(pageSize) { |
|
|
|
|
this.page.pageSize = pageSize; |
|
|
|
|
}, |
|
|
|
|
//刷新 |
|
|
|
|
refreshChange() { |
|
|
|
|
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 = {}) { |
|
|
|
|
this.loading = true; |
|
|
|
|
getList( |
|
|
|
@ -317,6 +671,7 @@ export default {
|
|
|
|
|
this.page.total = data.total; |
|
|
|
|
this.data = data.records; |
|
|
|
|
this.loading = false; |
|
|
|
|
this.selectionClear(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|