You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spms-vue/src/views/basic/CorpRelevance.vue

288 lines
10 KiB
Vue

3 years ago
<template>
<div>
<el-card class="el-card" v-if="checked">
<div>
<el-form :inline="true" :model="erpQuery" style="display: flex" size="mini">
<el-form-item class="query-form-item">
<el-input
v-model="erpQuery.unitId"
placeholder="往来单位ID"
clearable
></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-input
v-model="erpQuery.name"
placeholder="往来单位"
clearable
></el-input>
</el-form-item>
<el-form-item style="display: flex">
<el-button type="primary" icon="search" @click="getErpList"></el-button>
</el-form-item>
</el-form>
<el-table
:data="erpList"
style="width: 100%"
highlight-current-row="true"
@current-change="handleCurrentChange"
>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column
label="第三方往来单位ID"
prop="customid"
width="200"
></el-table-column>
<el-table-column
label="往来单位名称"
prop="customname"
width="400"
></el-table-column>
</el-table>
<el-pagination
:page-size="erpQuery.limit"
@current-change="handleErppageChange"
layout="prev, pager, next"
:total="erpTotal"
:current-page="erpQuery.page"
3 years ago
></el-pagination>
</div>
</el-card>
<el-card class="el-card">
<div>
<el-form :inline="true" :model="unitQuery" style="display: flex" size="mini">
<el-form-item class="query-form-item">
<el-input
v-model="unitQuery.name"
placeholder="往来单位"
clearable
></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-select v-model="thirdSysFk" placeholder="请设置主系统" disabled>
3 years ago
<el-option
v-for="item in thirdSys"
:key="item.value"
:label="item.thirdName"
:value="item.thirdId">
<span style="float: left">{{ item.thirdName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.thirdId }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item style="display: flex">
<el-button-group>
2 years ago
<el-button type="primary" icon="search" @click="reSearch"></el-button>
3 years ago
<el-button type="primary" size="mini" icon="search" @click="combine"
>选入
</el-button>
<el-button type="primary" size="mini" icon="search" @click="combineAll"
>结果全部选入
</el-button>
</el-button-group>
</el-form-item>
</el-form>
<el-table
:data="unitlList"
style="width: 100%"
@selection-change="handleSelectionUdiChange"
>
<el-table-column type="selection" width="55"
:selectable="checkSelectable"></el-table-column>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="往来单位编码" prop="id"></el-table-column>
<el-table-column
label="往来单位名称"
prop="name"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="往来单位简写"
show-overflow-tooltip
prop="spell"
></el-table-column>
<el-table-column
label="地址"
prop="addr"
show-overflow-tooltip
></el-table-column>
</el-table>
</div>
</el-card>
<el-pagination
:page-size="unitQuery.limit"
@current-change="handlepageChange"
layout="prev, pager, next"
:total="total"
:current-page="unitQuery.page"
3 years ago
></el-pagination>
</div>
</template>
<script>
3 years ago
import {combine, ucloudUnit, combineAll} from "../../api/basic/basicUnitMaintain";
import {getBasicThirdSys} from "../../api/basic/basicThirdSys";
import {addAllErp} from "@/api/basic/udiRelevance";
3 years ago
3 years ago
export default {
data() {
return {
unitQuery: {
page: 1,
limit: 10,
key: "",
thirdSys: null,
3 years ago
},
3 years ago
combineQuery: {
thirdSys: "",
keys: [],
custmandocResponses: [],
3 years ago
},
3 years ago
total: 0,
erpTotal: 0,
checked: false,
unitlList: [],
erpList: [],
currentRow: null,
multipleUdiSelection: [],
thirdSys: [],
thirdSysFk: null,
};
},
methods: {
handlepageChange(val) {
this.unitQuery.page = val;
this.getList();
},
handleErppageChange(val) {
2 years ago
this.erpQuery.page = 1;
3 years ago
this.getErpList();
},
checkSelectable(row) {
return !row.checked;
},
2 years ago
reSearch(){
this.unitQuery.page=1
this.getList();
},
3 years ago
getList() {
this.loading = true;
this.unitQuery.thirdSys = this.thirdSysFk;
ucloudUnit(this.unitQuery)
.then((response) => {
console.log(response);
this.loading = false;
3 years ago
3 years ago
if (response.code == 20000) {
this.unitlList = response.data.list || [];
this.total = response.data.total || 0;
} else {
this.$message.error(response.message);
3 years ago
this.unitlList = [];
this.total = 0;
3 years ago
}
3 years ago
3 years ago
})
.catch(() => {
this.loading = false;
this.unitlList = [];
this.total = 0;
});
},
intentBack() {
this.$router.go(-1);
},
getBasicThirdSys() {
let query = {
enabled: true,
mainSys: true,
};
getBasicThirdSys(query)
.then((response) => {
this.thirdSys = response.data.list || [];
this.thirdSysFk = this.thirdSys[0].thirdId;
this.getList();
3 years ago
})
.catch(() => {
this.loading = false;
this.list = [];
3 years ago
});
3 years ago
},
combine() {
let selectData = this.multipleUdiSelection;
var ids = [];
selectData.forEach((obj) => {
ids.push(obj);
});
if (ids.length == 0) {
this.$message.warning("请选择往来单位信息!");
return;
}
this.combineQuery.thirdSys = this.thirdSysFk;
this.combineQuery.custmandocResponses = ids;
console.log(ids);
combine(this.combineQuery)
.then((response) => {
if (response.code == 20000) {
this.$emit("closeMain", true);
} else {
3 years ago
this.$emit("closeMain", false);
3 years ago
}
})
.catch(() => {
this.$emit("closeMain", false);
});
},
combineAll() {
this.$confirm("此操作将在后台自动选入所有查询结果, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.unitQuery.thirdSys = this.thirdSysFk;
combineAll(this.unitQuery)
.then((response) => {
if (response.code == 20000) {
this.$emit("closeMain", true);
} else {
this.$emit("closeMain", false);
}
})
.catch(() => {
this.$emit("closeMain", false);
});
3 years ago
})
.catch(() => {
});
3 years ago
},
handleCurrentChange(val) {
console.log(val);
this.currentRow = val;
this.unitQuery.key = this.currentRow.name;
3 years ago
},
3 years ago
handleSelectionUdiChange(val) {
console.log("----" + val[0].id);
this.multipleUdiSelection = val;
3 years ago
},
3 years ago
},
created() {
this.getBasicThirdSys();
},
};
3 years ago
</script>