添加批量

jc
fanluyan 1 year ago
parent b666acee9c
commit b831f47089

@ -979,3 +979,13 @@ export function getRolechangePermissionApi(data) {
data,
});
}
//批量添加装置
export function importTermsApi(data) {
return request({
url: "/xymanager/terminal/importTerminal",
method: "post",
data,
});
}

@ -0,0 +1,271 @@
<template>
<div class="termsBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>批量添加装置台账</span>
</div>
<div class="deviceList">
<div class="searchBox">
<el-form
:inline="true"
:model="formdata"
label-position="right"
label-width="62px"
class="demo-form-inline"
>
<div class="dyxl">
<el-form-item label="电压等级" class="dybox">
<el-select v-model="formdata.dyId" @change="getSearchxl">
<el-option
v-for="item in dyOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="线路名称" class="xlbox">
<el-select v-model="formdata.lineId" filterable>
<el-option
v-for="item in xlOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</div>
<div class="gytd">
<el-form-item label="规约" class="gyClass">
<el-select v-model="formdata.protocol" filterable>
<el-option
v-for="item in protocolOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
{{ item.name }}{{ item.id }}
</el-option>
</el-select>
</el-form-item>
<el-form-item label="通道" class="tdClass">
<el-select v-model="formdata.channel" filterable>
<el-option
v-for="item in channelOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</div>
<el-form-item label="装置编号(一行一个)" class="termClass">
<el-input
type="textarea"
:rows="20"
placeholder="请输入装置列表"
v-model="formdata.cmdidArr"
>
</el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm()"> </el-button>
</div>
</div>
</div>
</el-card>
</div>
</template>
<script>
import {
getSearchInfo,
getProtocolList,
importTermsApi,
} from "@/utils/api/index";
export default {
name: "globalTools",
components: {},
data() {
return {
formdata: {
dyId: "",
lineId: "",
protocol: "",
channel: 2,
cmdidArr: "",
},
dyOptions: [], //
xlOptions: [], //线
protocolOptions: [], //
channelOptions: [
{
id: 1,
name: "单目",
},
{
id: 2,
name: "双目",
},
{
id: 3,
name: "三目",
},
{
id: 4,
name: "四目",
},
],
};
},
computed: {
// cmdidArr
cmdidArrList() {
// 使 split
return this.formdata.cmdidArr.split(/\r\n|\n|\r/).filter(Boolean);
},
},
created() {
this.getProtocol();
this.getSearchdy();
},
watch: {},
methods: {
getProtocol() {
//
getProtocolList()
.then((res) => {
console.log(res);
this.protocolOptions = res.data.list;
console.log(this.protocolOptions);
})
.catch((err) => {});
},
//
getSearchdy() {
getSearchInfo({ type: 1 })
.then((res) => {
this.dyOptions = res.data.list;
this.getSearchxl();
})
.catch((err) => {});
},
//线
getSearchxl() {
getSearchInfo({ type: 2, id: this.formdata.dyId })
.then((res) => {
this.xlOptions = res.data.list;
})
.catch((err) => {});
},
submitForm() {
if (
!this.formdata.dyId ||
!this.formdata.lineId ||
!this.formdata.protocol
) {
this.$message({
duration: 1500,
showClose: true,
message: "请先选择电压、线路、和规约",
type: "error",
});
return;
}
if (this.formdata.cmdidArr.length == 0) {
this.$message({
duration: 1500,
showClose: true,
message: "请输入装置编号",
type: "error",
});
return;
}
console.log(this.cmdidArrList);
console.log(
this.formdata.dyId,
this.formdata.lineId,
this.formdata.protocol,
this.formdata.channel
);
let params = {
channelCount: this.formdata.channel,
cmdidList: this.cmdidArrList,
lineId: this.formdata.lineId,
protocol: this.formdata.protocol,
};
console.log(params);
importTermsApi(params)
.then((res) => {
console.log(res);
if (res.code == 200) {
this.$message({
duration: 1500,
showClose: true,
message: "批量添加装置成功",
type: "success",
});
} else {
this.$message({
duration: 1500,
showClose: true,
message: res.msg,
type: "error",
});
}
})
.catch((err) => {});
},
},
};
</script>
<style lang="less">
.termsBox {
width: 500px;
margin-right: 24px;
height: 100%;
.el-card {
height: 100%;
.el-card__body {
padding: 12px 8px;
.deviceList {
.searchBox {
.dyxl {
display: flex;
.dybox,
.xlbox {
.el-select {
width: 160px;
}
}
}
.gytd {
display: flex;
.gyClass,
.tdClass {
.el-select {
width: 160px;
}
}
}
.termClass {
display: flex;
flex-direction: column;
.el-form-item__label {
width: 140px !important;
}
}
}
.dialog-footer {
display: flex;
margin-left: auto;
justify-content: end;
}
}
}
}
}
</style>

@ -1,6 +1,7 @@
<template>
<div class="globalBox">
<div class="setBox">
<termsAdd></termsAdd>
<el-card class="box-card globalDrawLine">
<div slot="header" class="clearfix">
<span>线缆开启关闭</span>
@ -60,10 +61,10 @@ import {
updateMarkEnableStatus,
updateAlarmChannel,
} from "@/utils/api/index";
import termsAdd from "./components/termsAdd";
export default {
name: "globalTools",
components: {},
components: { termsAdd },
data() {
return {
lineValue: false,
@ -172,6 +173,7 @@ export default {
padding: 12px;
border-radius: 4px;
display: flex;
.globalDrawLine {
width: 200px;
height: max-content;

@ -17,14 +17,14 @@ module.exports = defineConfig({
transpileDependencies: true,
lintOnSave: false,
devServer: {
port: 8080, // 端口号的配置
port: 9527, // 端口号的配置
proxy: {
"/api": {
//表示拦截以/api开头的请求路径
//target: "http://localhost:8080", // 使用本地端口,这个端口是 PuTTY SSH 隧道映射的本地端口
//target: "http://192.168.1.190:8080", //liu 本机ip 需要去掉/Api
//target: "http://192.168.1.190:8080", //190 需要去掉/Api
//target: "http://192.168.50.7:8093", //liu 本机ip 需要去掉/Api
target: "http://61.169.135.146:40080/", //东视
target: "http://61.169.135.146:40080/", //dell
changOrigin: true, //是否开启跨域
pathRewrite: {
"^/api": "/api", //重写api把api变成空字符因为我们真正请求的路径是没有api的

Loading…
Cancel
Save