v-for="(item,index) in ledgerList" :label="item.name" :value="item.code" :key="index" @click.native="getItemId(item)" >
v-model.trim="condition.company" @click.native="syndiCate()" icon="search" readonly class="chooseInput" >
v-for="(item,index) in costTypeOption" :label="item.segment3Type" :value="item.segment3Type" :key="index" >
v-model.trim="condition.economicItemOne" @click.native="openEconomicDialog()" icon="search" readonly class="chooseInput" >
v-for="(item,index) in economicTwoList" :label="item.name" :value="item.id" :key="index" >
v-model.trim="condition.check" @click.native="openSubject()" icon="search" readonly class="chooseInput" >
查询结果
新增
编辑
启用
禁用
导入
导出
:data="tableData" @select="selectItem" @select-all="selectItemAll" border style="width:100%" > label="经济事项一级" width="100" prop="economic1Name" align="center" :show-overflow-tooltip="true" > label="经济事项二级" width="100" prop="economic2Name" align="center" :show-overflow-tooltip="true" > label="是否关联方" width="100" prop="isRelatedPartyMean" align="center" :show-overflow-tooltip="true" > label="核算科目编码/名称" width="130" prop="segment5Name" align="center" :show-overflow-tooltip="true" > {{scope.row.statusMean}} {{scope.row.statusMean}} label="创建人" prop="createdBy" align="center" :show-overflow-tooltip="true" > label="创建时间" prop="createdDate" align="center" :show-overflow-tooltip="true" > label="更新人" prop="updatedBy" align="center" :show-overflow-tooltip="true" > label="更新时间" prop="updatedDate" align="center" :show-overflow-tooltip="true" >
共{{ (mainData.total / condition.pageSize) === 0 ? 0 : Math.ceil(mainData.total / condition.pageSize) }}页/
{{mainData.total}}条数据
@size-change="handleSizeChange" @current-change="handleCurrentChange" :page-sizes="[10,20,50,100]" :page-size="mainData.pageSize" layout="sizes, prev, pager, next, jumper" :total="mainData.total" >
:visible.sync="addEditDialog" title="经济事项与核算科目匹配" :close-on-click-modal="false" custom-class="commonDialog3" >
title="导入excel文件管理" custom-class="dialogFile" :modal-append-to-body="false" :visible.sync="fileDialog" size >
:visible.sync="companyDialog" custom-class="commonDialog" :modal-append-to-body="false" title="公司段" :close-on-click-modal="false" :close-on-press-escape="false" > :ledgerCode="condition.ledgerCode" @saveCompanyData="saveCompanyData" @closeCompany="closeCompany" >
:visible.sync="subjectDialog" custom-class="commonDialog" :modal-append-to-body="false" title="核算科目编码/名称" :close-on-click-modal="false" :close-on-press-escape="false" > :ledgerCode="condition.ledgerCode" @saveSubjectData="saveSubjectData" @closeSubject="closeSubject" >
:visible.sync="economicDialog" custom-class="commonDialog" :modal-append-to-body="false" title="经济事项一级" :close-on-click-modal="false" :close-on-press-escape="false" >
import SegmentCompany from "./segmentCompany.vue";
import Subject from "./Subject.vue";
import AddEdit from "./addEdit.vue";
import FileDialog from "./fileDialog.vue";
import TableCommon from "./commonTable.vue";
import {
tipMsg,
justOne,
downLoadFile,
} from "../../js/common.js";
export default {
components: {
AddEdit, // 新增/编辑
FileDialog, //导入弹窗
TableCommon, //经济事项一级弹窗
SegmentCompany,
Subject
},
data() {
return {
uploadUrl: "",
condition: {
ledgerCode: "",
ledgerId: "", //账套id
company: "",
companyId: "",
costType: "",
costId: "",
status: "",
economicItemOne: "",
economicItemOneId:'',
economicItemOneCode:'',
economicItemTwo: "",
check: "",//核算科目
checkId: "",//核算id
pageNum: 1,
pageSize: 10
},
// nodeIdListcheck: [], //公司段用
btnListData:'',
multipleSelection: [], // 当前页选中的数据
multipleSelectionAll: [], // 所有选中的数据包含跨页数据
editData: "", //编辑数据
forItem: [], //选择的item
idList: [], //id集合
tableData: [],
IdKey: "id", //设定行数据key
ledgerList: [], //账套list
checkOption: [], //预算科目option
costTypeOption: [], //成本中心类型option
economicTwoList: [], //经济事项二级的列表
companyDialog: false, //公司段弹窗
subjectDialog: false, //科目弹窗
economicDialog: false, //经济事项弹窗开关
addEditDialog: false, //新增编辑弹窗开关
fileDialog: false, //导入弹窗
managementCaliberId: "", //管理口径id
mainData: {
total: 0
}
};
},
created() {
//this.URL = `${this.$root.loadUrl}/mdm-service`; //部署环境
this.uploadUrl = `${this.$root.loadUrl}`; //后台链接测试环境
this.getledger();
},
mounted() {
this.search();
},
methods: {
getledger() {
let url = `${this.$root.loadUrl}/ledger/queryLedger`;
this.$Http.post(url, {}).then(rsp => {
if (rsp.body.code == "000000") {
this.ledgerList = rsp.body.data;
}
});
},
//更新相关联动项
changeEffectItem() {
this.condition.company = "";
this.condition.costType = "";
this.condition.check = "";
let params = { ledgerCode: this.condition.ledgerCode };
let url2 = `${this.$root.loadUrl}/economicAccountRelation/querySegment3Type`;
this.$Http.post(url2, params).then(rsp => {
if (rsp.body.code == "000000") {
this.costTypeOption = rsp.body.data;
}
});
},
getItemId(item) {
this.condition.ledgerId = item.id;
},
getEconomicTwoList() {
console.log("2级");
let url = `${
this.$root.loadUrl
}/economicAccountRelation/queryEconomicEvent`;
let params = {
pcode: this.condition.economicItemOneCode,
managementCaliberId: this.managementCaliberId
};
this.$Http.post(url, params).then(rsp => {
if (rsp.body.code == "000000") {
this.economicTwoList = rsp.body.data.list;
}
});
},
//选中一条数据
selectItem(val) {
console.log(val);
this.multipleSelection = val;
let aList = [];
this.forItem = val;
val.forEach(it => {
aList.push(it.id);
});
setTimeout(this.idListckeck(aList), 100);
},
idListckeck(arr) {
this.idList = [];
for (var i = 0; i < arr.length; i++) {
if (this.idList.indexOf(arr[i]) == -1) {
this.idList.push(arr[i]);
}
}
return this.idList;
},
//选中多条数据
selectItemAll(val) {
this.multipleSelection = val;
let aList = [];
this.forItem = val;
val.forEach(it => {
aList.push(it.id);
});
setTimeout(this.idListckeck(aList), 100);
},
//打开公司段数据
syndiCate() {
if (
this.condition.ledgerCode == "" ||
this.condition.ledgerCode == undefined
) {
this.$message({ type: "warning", message: "请先选择账套" });
return;
} else {
this.companyDialog = true;
}
},
//公司段保存
saveCompanyData(val) {
var arrId = "";
var arrName = "";
val.ids.forEach(item => {
arrId += item + ",";
});
val.names.forEach(item => {
arrName += item + ",";
});
// this.condition.delegationContent=arrId.slice(0,arrId.length-1);
this.condition.companyId = arrId.slice(0, arrId.length - 1);
this.condition.company = arrName.slice(0, arrName.length - 1);
this.companyDialog = false;
},
closeCompany() {
this.companyDialog = false;
},
//打开科目数据
openSubject() {
if (
this.condition.ledgerCode == "" ||
this.condition.ledgerCode == undefined
) {
this.$message({ type: "warning", message: "请先选择账套" });
return;
} else {
this.subjectDialog = true;
}
},
//科目保存
saveSubjectData(val) {
var arrId = "";
var arrName = "";
val.ids.forEach(item => {
arrId += item + ",";
});
val.names.forEach(item => {
arrName += item + ",";
});
// this.condition.delegationContent=arrId.slice(0,arrId.length-1);
this.condition.checkId = arrId.slice(0, arrId.length - 1);
this.condition.check = arrName.slice(0, arrName.length - 1);
this.subjectDialog = false;
},
closeSubject() {
this.subjectDialog = false;
},
clearAll() {
for (var prop in this.condition) {
this.condition[prop] = "";
}
this.condition.pageNum = 1;
this.condition.pageSize = 10;
},
search() {
// 分页查询数据方法,在成功返回数据方法里调用setSelectRow方法,使每次分页查询都能勾选中
let params = {
economic1: this.condition.economicItemOneId, //经济事项一级id
economic2: this.condition.economicItemTwo, //经济事项二级id
ledgerId: this.condition.ledgerId, //账套id
segment1: this.condition.companyId, //公司id
segment3Type: this.condition.costType, //部分3,成本中心类型
segment5: this.condition.checkId, //核算科目id
status: this.condition.status,
pageNum: this.condition.pageNum, //第几页
pageSize: this.condition.pageSize
};
this.$Http
.post(this.uploadUrl + "/economicAccountRelation/listPage", params)
.then(data => {
var result = data.body;
if (result.code == "000000") {
this.tableData = result.data.list;
this.mainData = result.data;
} else {
this.$message({
showClose: true,
message: result.message,
type: "error",
duration: 5000
});
}
});
},
// //选中一条数据
// handleSelectionChange(val) {
// // table组件选中事件,记得加上@selection-change="handleSelectionChange"
// this.multipleSelection = val;
// },
handleCurrentChange(val) {
this.condition.pageNum = val;
this.search();
},
handleSizeChange(val) {
this.condition.pageSize = val;
this.search();
},
//经济事项一级弹窗
openEconomicDialog() {
this.condition.economicItemTwo = "";
this.economicDialog = true;
},
//经济事项二级
isOpenTwo() {
if (
this.condition.economicItemOne == "" ||
this.condition.economicItemOne == undefined
) {
this.$message({ type: "warning", message: "请先选择一级经济事项" });
return;
}
},
//成本中心类型提示
isOpenCostType() {
if (
this.condition.ledgerCode == "" ||
this.condition.ledgerCode == undefined
) {
this.$message({ type: "warning", message: "请先选择账套" });
return;
}
},
//预算科目
isOpenCheck() {
if (
this.condition.ledgerCode == "" ||
this.condition.ledgerCode == undefined
) {
this.$message({ type: "warning", message: "请先选择账套" });
return;
}
},
//关闭经济事项对话框
closeEconomic() {
this.economicDialog = false;
},
//经济对话框的保存
saveEconomicData(val) {
this.economicDialog = false;
this.condition.economicItemOne = val.name; //
this.condition.economicItemOneId = val.id; //传入经济项目一级id
this.condition.economicItemOneCode = val.code; //传入经济项目一级code
this.managementCaliberId = val.managementCaliberId; //传入经济项目一级id
this.getEconomicTwoList();
},
//新增
addEcono() {
this.forItem = [];
this.addEditDialog = true;
},
//编辑
edit() {
if (this.forItem.length == 1) {
this.addEditDialog = true;
} else if (this.forItem.length == 0) {
tipMsg("请先选择一条数据!", "warning");
} else {
tipMsg("不能选择多条,只能选择一条!", "warning");
}
},
//保存新增/编辑
saveAE() {
this.addEditDialog = false;
this.search();
},
//关闭新增/编辑弹窗
closeAE() {
this.addEditDialog = false;
},
// //检查状态
// checkStatus(staVal, act, mean) {
// for (var i = 0; i < this.forItem.length; i++) {
// if (this.forItem[i].status == staVal) {
// tipMsg("不能" + act + mean + "数据", "warning");
// return false;
// }
// }
// return true;
// },
//启用
enable() {
let sData = {
idList: JSON.parse(JSON.stringify(this.idList)),
status: 1
};
let params = new FormData();
this.$Http
.post(
this.uploadUrl + "/economicAccountRelation/updateStatusBatch",
sData,
{
headers: {
"Content-Type": "multipart/form-data" //hearder 很重要,Content-Type 要写对
}
}
)
.then(data => {
var result = data.body;
if (result.code == "000000") {
this.idList = [];
this.forItem = [];
tipMsg(result.message, "success");
this.search();
} else {
tipMsg(result.message, "error");
}
});
},
//禁用
disable() {
//form-data post请求
let sData = {
idList: JSON.parse(JSON.stringify(this.idList)),
status: 0
};
let params = new FormData();
// params.append('appName', this.search.appName);//这里是要传的参数
// for( let it in sData){
// params.append(it,sData[it])
// }
this.$Http
.post(
this.uploadUrl + "/economicAccountRelation/updateStatusBatch",
sData,
{
headers: {
"Content-Type": "multipart/form-data" //hearder 很重要,Content-Type 要写对
}
}
)
.then(data => {
var result = data.body;
if (result.code == "000000") {
this.idList = [];
this.forItem = [];
tipMsg(result.message, "success");
this.search();
} else {
tipMsg(result.message, "error");
}
});
},
getIn() {
this.fileDialog = true;
console.log(this.multipleSelectionAll, "all");
},
cancelImportFile() {
this.fileDialog = false;
},
closeImportFile() {
this.fileDialog = false;
},
getOut() {
var option = {
url: this.uploadUrl + '/economicAccountRelation/export',
data: {
requestData: {
"economic1": this.condition.economicItemOneId,
"economic2": this.condition.economicItemTwo,
"ledgerId": this.condition.ledgerId,
"segment1": this.condition.companyId,
"segment3Type": this.condition.costId,
"segment5": this.condition.checkId,
"status": this.condition.status,
"pageNum": this.condition.pageNum,
"pageSize": this.condition.pageSize
}
},
method: 'post'
};
downLoadFile(option);
}
}
};