You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
716 lines
20 KiB
716 lines
20 KiB
<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" |
|
@selection-change="selectionChange" |
|
@search-reset="searchReset" |
|
@current-change="currentChange" |
|
@size-change="sizeChange" |
|
@refresh-change="refreshChange" |
|
@on-load="onLoad" |
|
> |
|
<template slot="menuLeft"> |
|
<el-button |
|
size="small" |
|
type="primary" |
|
icon="el-icon-download" |
|
@click="handleAllocate" |
|
>导出 |
|
</el-button> |
|
<!-- <el-button |
|
type="danger" |
|
size="small" |
|
icon="el-icon-delete" |
|
plain |
|
@click="handleDelete" |
|
>删 除 |
|
</el-button> --> |
|
</template> |
|
<template slot-scope="scope" slot="menuBtn"> |
|
<el-dropdown-item> |
|
<el-popconfirm |
|
confirm-button-text="确定" |
|
cancel-button-text="取消" |
|
@confirm="handleRealname(scope.row.id)" |
|
icon-color="red" |
|
title="您确认要同步实名吗?" |
|
placement="top-start" |
|
> |
|
<div class="el-icon-refresh" slot="reference"> 同步实名</div> |
|
</el-popconfirm> |
|
</el-dropdown-item> |
|
<el-dropdown-item> |
|
<el-popconfirm |
|
confirm-button-text="确定" |
|
cancel-button-text="取消" |
|
@confirm="handleSimStatus(scope.row.id, scope.row.lifecycleStatus)" |
|
icon-color="red" |
|
:title=" |
|
scope.row.lifecycleStatus != 4 |
|
? '您确认要停机吗?' |
|
: '您确认要复机吗?' |
|
" |
|
placement="top-start" |
|
> |
|
<div |
|
v-if="scope.row.lifecycleStatus != 4" |
|
class="el-icon-phone" |
|
slot="reference" |
|
> |
|
申请停机 |
|
</div> |
|
<div |
|
v-if="scope.row.lifecycleStatus == 4" |
|
class="el-icon-phone-outline" |
|
slot="reference" |
|
> |
|
申请复机 |
|
</div> |
|
</el-popconfirm> |
|
</el-dropdown-item> |
|
</template> |
|
</avue-crud> |
|
|
|
<!-- 导出弹窗 --> |
|
<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="exportType"> |
|
<el-select |
|
v-model="distribution.exportType" |
|
placeholder="请选择导出类型" |
|
size="mini" |
|
style="width: 90%" |
|
> |
|
<el-option |
|
v-for="(item, index) in exportTypelist" |
|
:label="item.dictValue" |
|
:value="item.dictKey" |
|
:key="item.dictKey" |
|
></el-option> |
|
</el-select> |
|
</el-form-item> |
|
|
|
<el-form-item label="开始/结束号码" prop="numbers"> |
|
<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="onSubmit" size="small"> |
|
<i class="el-icon-circle-plus-outline" style="padding-right: 5px"></i> |
|
导 出</el-button |
|
> |
|
<el-button @click="handleClose" size="small"> |
|
<i class="el-icon-circle-close" style="padding-right: 5px"></i> 取 |
|
消</el-button |
|
> |
|
</span> |
|
</el-dialog> |
|
</basic-container> |
|
</template> |
|
|
|
<script> |
|
import { getList, getDetail, exporttype } from "@/api/informationmanage/sim.js"; |
|
import { |
|
syncRealNameStatus, |
|
updateSimStatus, |
|
} from "@/api/communication/outbound"; |
|
import { mapGetters } from "vuex"; |
|
import { getToken } from "@/util/auth"; |
|
export default { |
|
data() { |
|
var reg = /[A-Za-z]/i; |
|
var starts = (rule, value, callback) => { |
|
if (this.distribution.numEnd == "" || this.distribution.numStart == "") { |
|
callback(new Error("开始号码结束号码均不能为空")); |
|
} else if ( |
|
this.distribution.numEnd < 0 || |
|
this.distribution.numStart < 0 |
|
) { |
|
callback(new Error("开始号码结束号码均不能为负数")); |
|
} else if ( |
|
Number(this.distribution.numStart) > Number(this.distribution.numEnd) |
|
) { |
|
callback(new Error("开始号码必须小于结束号码")); |
|
} else if ( |
|
reg.test(this.distribution.numStart) == true || |
|
reg.test(this.distribution.numEnd) == true |
|
) { |
|
callback(new Error("开始结束号码中包含字母,请选择其他导出类型")); |
|
} else { |
|
callback(); |
|
} |
|
}; |
|
return { |
|
form: {}, |
|
query: {}, |
|
iform: { |
|
type: null, //租户/客户 |
|
tenantId: null, //租户 |
|
userId: null, //客户 |
|
}, |
|
dialogVisible: false, //分拨弹窗布尔 |
|
selectionList: [], |
|
exportTypelist: [], //租户下拉 |
|
// userlist: [], //用户下拉 |
|
|
|
//导出 |
|
distribution: { |
|
exportType: "", //导出类型 |
|
numStart: "", //开始号码 |
|
numEnd: "", //结束号码 |
|
}, |
|
loading: true, |
|
distrules: { |
|
exportType: [ |
|
{ required: true, message: "请选择导出类型", trigger: "change" }, |
|
], |
|
numbers: [{ required: true, validator: starts, trigger: "blur" }], |
|
}, |
|
page: { |
|
pageSize: 10, |
|
currentPage: 1, |
|
total: 0, |
|
}, |
|
option: { |
|
tip: false, |
|
searchShow: true, |
|
searchMenuSpan: 6, |
|
border: true, |
|
index: true, |
|
addBtn: false, |
|
editBtn: false, |
|
viewBtn: true, |
|
delBtn: false, |
|
searchIcon: true, |
|
dialogDrag: true, |
|
columnBtn: false, |
|
selection: false, |
|
dialogClickModal: false, |
|
dialogWidth: "60%", |
|
menuType: "menu", |
|
menuWidth: "120", |
|
rowKey: "xx", |
|
column: [ |
|
{ |
|
label: "id", |
|
prop: "id", |
|
search: true, |
|
addDisplay: false, |
|
editDisplay: false, |
|
width: 150, |
|
labelWidth: 130, |
|
}, |
|
{ |
|
label: "iccid", |
|
prop: "iccid", |
|
width: 150, |
|
span: 12, |
|
labelWidth: 130, |
|
search: true, |
|
rules: [ |
|
{ |
|
required: true, |
|
message: "请输入iccid", |
|
trigger: "blur", |
|
}, |
|
], |
|
}, |
|
|
|
{ |
|
label: "msisdn", |
|
prop: "msisdn", |
|
span: 12, |
|
width: 150, |
|
labelWidth: 130, |
|
addDisplay: false, |
|
search: true, |
|
rules: [ |
|
{ |
|
required: true, |
|
message: "请输入msisdn", |
|
trigger: "blur", |
|
}, |
|
], |
|
}, |
|
{ |
|
label: "基础套餐", |
|
prop: "dataPlanId", |
|
type: "select", |
|
dicUrl: "/api/iot-sim/dataplan/fillData?isSource=" + 2, |
|
props: { |
|
label: "name", |
|
value: "id", |
|
}, |
|
dataType: "String", |
|
span: 12, |
|
labelWidth: 130, |
|
searchLabelWidth: 110, |
|
search: true, |
|
rules: [ |
|
{ |
|
required: true, |
|
message: "请选择基础套餐", |
|
trigger: "change", |
|
}, |
|
], |
|
}, |
|
{ |
|
label: "生命周期状态", |
|
prop: "lifecycleStatus", |
|
type: "select", |
|
dicUrl: "/api/iot-system/dict/dictionary?code=lifecycleStatus", |
|
props: { |
|
label: "dictValue", |
|
value: "dictKey", |
|
}, |
|
dataType: "number", |
|
span: 12, |
|
labelWidth: 130, |
|
searchLabelWidth: 110, |
|
|
|
search: true, |
|
rules: [ |
|
{ |
|
required: true, |
|
message: "请选择生命周期状态", |
|
trigger: "change", |
|
}, |
|
], |
|
}, |
|
// { |
|
// label: "卡类型", |
|
// prop: "cardType", |
|
// type: "select", |
|
// dicUrl: "/api/iot-system/dict/dictionary?code=card_type", |
|
// props: { |
|
// label: "dictValue", |
|
// value: "dictKey", |
|
// }, |
|
// dataType: "number", |
|
// span: 12, |
|
// labelWidth: 130, |
|
|
|
// search: true, |
|
// rules: [ |
|
// { required: true, message: "请选择卡类型", trigger: "change" }, |
|
// ], |
|
// }, |
|
{ |
|
label: "是否断网", |
|
prop: "offNetStatus", |
|
type: "select", |
|
dicUrl: "/api/iot-system/dict/dictionary?code=off_netStatus", |
|
props: { |
|
label: "dictValue", |
|
value: "dictKey", |
|
}, |
|
dataType: "number", |
|
span: 12, |
|
labelWidth: 130, |
|
|
|
search: false, |
|
rules: [ |
|
{ required: true, message: "请选择是否断网", trigger: "change" }, |
|
], |
|
}, |
|
// { |
|
// label: "断网类型", |
|
// prop: "offNetType", |
|
// type: "select", |
|
// dicUrl: "/api/iot-system/dict/dictionary?code=off_netType", |
|
// props: { |
|
// label: "dictValue", |
|
// value: "dictKey", |
|
// }, |
|
// dataType: "number", |
|
// display: true, |
|
// span: 12, |
|
// formatter: (val, value, label) => { |
|
// if (value == -1) { |
|
// return "-"; |
|
// } else { |
|
// return `${label}`; |
|
// } |
|
// }, |
|
// labelWidth: 130, |
|
|
|
// search: false, |
|
// rules: [ |
|
// { required: true, message: "请选择断网类型", trigger: "change" }, |
|
// ], |
|
// }, |
|
{ |
|
label: "实名状态", |
|
prop: "realNameStats", |
|
type: "select", |
|
dicUrl: "/api/iot-system/dict/dictionary?code=real_nameStats", |
|
props: { |
|
label: "dictValue", |
|
value: "dictKey", |
|
}, |
|
dataType: "number", |
|
span: 12, |
|
labelWidth: 130, |
|
|
|
search: false, |
|
rules: [ |
|
{ required: true, message: "请选择实名状态", trigger: "change" }, |
|
], |
|
}, |
|
// { |
|
// label: "达量断网阙值(M)", |
|
// prop: "offNetThreshold", |
|
// span: 12, |
|
// labelWidth: 130, |
|
// searchLabelWidth: 124, |
|
// search: false, |
|
// rules: [ |
|
// { |
|
// required: true, |
|
// message: "请输入达量断网阙值", |
|
// trigger: "blur", |
|
// }, |
|
// { |
|
// pattern: /^\d+(\.\d+)?$/, |
|
// message: "请输入正确的阙值", |
|
// trigger: "blur", |
|
// }, |
|
// ], |
|
// }, |
|
{ |
|
label: "批次号", |
|
prop: "batchNum", |
|
span: 12, |
|
labelWidth: 130, |
|
search: true, |
|
hide: true, |
|
addDisplay: false, |
|
rules: [ |
|
{ |
|
required: true, |
|
message: "请输入批次号", |
|
trigger: "blur", |
|
}, |
|
], |
|
}, |
|
{ |
|
label: "总量(M)", |
|
prop: "total", |
|
span: 12, |
|
labelWidth: 130, |
|
type: "number", |
|
hide: true, |
|
rules: [ |
|
{ required: true, message: "请输入总量", trigger: "blur" }, |
|
{ |
|
pattern: /^\d+(\.\d+)?$/, |
|
message: "请输入正确的总量", |
|
trigger: "blur", |
|
}, |
|
], |
|
}, |
|
{ |
|
label: "剩余流量(M)", |
|
prop: "surplus", |
|
span: 12, |
|
type: "number", |
|
labelWidth: 130, |
|
hide: true, |
|
rules: [ |
|
{ required: true, message: "请输入剩余流量", trigger: "blur" }, |
|
{ |
|
pattern: /^\d+(\.\d+)?$/, |
|
message: "请输入正确的剩余流量", |
|
trigger: "blur", |
|
}, |
|
], |
|
}, |
|
{ |
|
label: "使用量(M)", |
|
prop: "usage", |
|
span: 12, |
|
labelWidth: 130, |
|
type: "number", |
|
hide: true, |
|
rules: [ |
|
{ required: true, message: "请输入使用量", trigger: "blur" }, |
|
{ |
|
pattern: /^\d+(\.\d+)?$/, |
|
message: "请输入正确的使用量", |
|
trigger: "blur", |
|
}, |
|
], |
|
}, |
|
], |
|
}, |
|
data: [], |
|
}; |
|
}, |
|
watch: { |
|
"form.$channelId"() { |
|
const columns = this.findObject(this.option.column, "flowPoolId"); |
|
if (this.form.$channelId != undefined) { |
|
if (this.form.$channelId.indexOf("电信") != -1) { |
|
columns.display = false; |
|
this.form.flowPoolId = ""; |
|
} else { |
|
columns.display = true; |
|
} |
|
} |
|
}, |
|
"form.$offNetStatus"() { |
|
const columns = this.findObject(this.option.column, "offNetType"); |
|
if (this.form.$offNetStatus != undefined) { |
|
if (this.form.$offNetStatus == "未断网") { |
|
columns.display = false; |
|
this.form.offNetType = ""; |
|
} else { |
|
columns.display = true; |
|
} |
|
} |
|
}, |
|
}, |
|
created() { |
|
this.exportTypelistlists(); //导出类型 |
|
}, |
|
|
|
methods: { |
|
beforeOpen(done, type) { |
|
if (["edit", "view"].includes(type)) { |
|
getDetail(this.form.id).then((res) => { |
|
this.form = res.data.data; |
|
}); |
|
} |
|
done(); |
|
}, |
|
searchReset() { |
|
this.query = {}; |
|
console.log(this.query, "this.query999"); |
|
this.onLoad(this.page); |
|
}, |
|
searchChange(params, done) { |
|
this.query = params; |
|
this.page.currentPage = 1; |
|
this.onLoad(this.page, params); |
|
done(); |
|
}, |
|
//新增 |
|
rowSave(row, done, loading) { |
|
console.log(this.form); |
|
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: "操作成功!", |
|
}); |
|
}); |
|
}, |
|
//批量删除 |
|
handleDelete() { |
|
if (this.selectionList.length === 0) { |
|
this.$message.warning("请选择至少一条数据"); |
|
return; |
|
} |
|
this.$confirm("确定将选择数据删除?", { |
|
confirmButtonText: "确定", |
|
cancelButtonText: "取消", |
|
type: "warning", |
|
}) |
|
.then(() => { |
|
return remove(this.ids); |
|
}) |
|
.then(() => { |
|
this.onLoad(this.page); |
|
this.$message({ |
|
type: "success", |
|
message: "操作成功!", |
|
}); |
|
this.$refs.crud.toggleSelection(); |
|
}); |
|
}, |
|
//多选框 |
|
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); |
|
}, |
|
//导出弹窗开启 |
|
handleAllocate() { |
|
this.dialogVisible = true; |
|
}, |
|
//导出弹窗关闭 |
|
handleClose() { |
|
this.dialogVisible = false; |
|
this.$refs.distribution.resetFields(); |
|
}, |
|
//确认导出 |
|
onSubmit() { |
|
this.$refs.distribution.validate((valid) => { |
|
if (valid) { |
|
// |
|
window.open( |
|
`${this.baseUrl}/${this.apis}iot-sim/sim/export-sim?${ |
|
this.website.tokenHeader |
|
}=${getToken()}&numStart=${this.distribution.numStart}&numEnd=${ |
|
this.distribution.numEnd |
|
}&exportType=${this.distribution.exportType}` |
|
); |
|
this.dialogVisible = false; |
|
this.$refs.distribution.resetFields(); |
|
} |
|
}); |
|
}, |
|
|
|
//导出类型 |
|
exportTypelistlists() { |
|
exporttype().then((res) => { |
|
if (res.data.code == 200) { |
|
this.exportTypelist = res.data.data; |
|
} |
|
}); |
|
}, |
|
//同步实名 |
|
handleRealname(id) { |
|
syncRealNameStatus(id).then((res) => { |
|
if (res.data.code == 200) { |
|
this.$message.success("同步成功"); |
|
this.onLoad(this.page, this.query); |
|
} else { |
|
this.$message.error("同步失败"); |
|
} |
|
}); |
|
}, |
|
//停机复机 |
|
handleSimStatus(id, type) { |
|
if (type == 4) { |
|
updateSimStatus({ id: id, operType: 1 }).then((res) => { |
|
if (res.data.code == 200) { |
|
this.$message.success("复机成功"); |
|
this.onLoad(this.page, this.query); |
|
} else { |
|
this.$message.error("复机失败"); |
|
} |
|
}); |
|
} else { |
|
updateSimStatus({ id: id, operType: 0 }).then((res) => { |
|
if (res.data.code == 200) { |
|
this.$message.success("停机成功"); |
|
this.onLoad(this.page, this.query); |
|
} else { |
|
this.$message.error("停机失败"); |
|
} |
|
}); |
|
} |
|
}, |
|
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>
|
|
|