<template>
|
<div style="padding: 10px;position: relative;">
|
<el-card style="margin-bottom: 10px;">
|
<el-form :inline="true" :model="queryParams" ref="queryForm" class="mb8">
|
<el-form-item label="客户代码" prop="HNumber">
|
<el-input v-model="queryParams.HNumber" placeholder="请输入客户代码" style="width: 160px" />
|
</el-form-item>
|
<el-form-item label="客户名称" prop="HName">
|
<el-input v-model="queryParams.HName" placeholder="请输入客户名称" style="width: 160px" />
|
</el-form-item>
|
<el-form-item label="重新同步">
|
<el-input v-model="queryParams.HNumber2" placeholder="请输入客户代码" style="width: 160px" />
|
<el-button type="primary" size="mini" @click="handleResCnz" style="margin-left: 10px">重新同步</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button size="mini" @click="resetQuery">重置</el-button>
|
</el-form-item>
|
</el-form>
|
|
<el-form :model="queryParams" ref="filterForm">
|
<el-collapse v-model="activeCollapse" class="filter-collapse">
|
<el-collapse-item title="更多" name="more">
|
|
<el-card class="box-card" style="margin-top: 20px;">
|
<div slot="header" class="clearfix"><span>过滤</span></div>
|
<div>
|
<el-form-item label-width="0">
|
<el-row>
|
<el-col :span="7">
|
<el-select v-model="queryParams.ColName" placeholder="请选择" style="width: 100%">
|
<!-- <el-option value="0" label=""></el-option> -->
|
<el-option v-for="(item, index) in visibleColumns" :key="index" :label="item.title"
|
:value="item.field"></el-option>
|
</el-select>
|
</el-col>
|
<el-col :span="6" style="padding: 0 10px">
|
<el-select v-model="queryParams.Comparator" placeholder="请选择" style="width: 100%">
|
<!-- <el-option value="0" label=""></el-option> -->
|
<el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
|
:value="item.value"></el-option>
|
</el-select>
|
</el-col>
|
<el-col :span="11">
|
<el-input v-model="queryParams.ColContent" placeholder="请输入" clearable
|
@keyup.enter.native="handleQuery" />
|
</el-col>
|
</el-row>
|
</el-form-item>
|
<el-form-item label-width="0">
|
<el-row>
|
<el-col :span="7">
|
<el-select v-model="queryParams.ColName1" placeholder="请选择" style="width: 100%">
|
<!-- <el-option value="0" label=""></el-option> -->
|
<el-option v-for="(item, index) in visibleColumns" :key="index" :label="item.title"
|
:value="item.field"></el-option>
|
</el-select>
|
</el-col>
|
<el-col :span="6" style="padding: 0 10px">
|
<el-select v-model="queryParams.Comparator1" placeholder="请选择" style="width: 100%">
|
<!-- <el-option value="0" label=""></el-option> -->
|
<el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
|
:value="item.value"></el-option>
|
</el-select>
|
</el-col>
|
<el-col :span="11">
|
<el-input v-model="queryParams.ColContent1" placeholder="请输入" clearable
|
@keyup.enter.native="handleQuery" />
|
</el-col>
|
</el-row>
|
</el-form-item>
|
<el-form-item label-width="0">
|
<el-row>
|
<el-col :span="7">
|
<el-select v-model="queryParams.ColName2" placeholder="请选择" style="width: 100%">
|
<!-- <el-option value="0" label=""></el-option> -->
|
<el-option v-for="(item, index) in visibleColumns" :key="index" :label="item.title"
|
:value="item.field"></el-option>
|
</el-select>
|
</el-col>
|
<el-col :span="6" style="padding: 0 10px">
|
<el-select v-model="queryParams.Comparator2" placeholder="请选择" style="width: 100%">
|
<!-- <el-option value="0" label=""></el-option> -->
|
<el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
|
:value="item.value"></el-option>
|
</el-select>
|
</el-col>
|
<el-col :span="11">
|
<el-input v-model="queryParams.ColContent2" placeholder="请输入" clearable
|
@keyup.enter.native="handleQuery" />
|
</el-col>
|
</el-row>
|
</el-form-item>
|
</div>
|
</el-card>
|
</el-collapse-item>
|
</el-collapse>
|
</el-form>
|
|
|
<div style="text-align:center;font-size:15px;font-weight:bold;color:#fc9393;margin: 20px 0;">
|
{{ currentFilterScheme }}
|
</div>
|
</el-card>
|
|
<el-row :gutter="10" class="mb8">
|
<el-col :span="1.5">
|
<el-button type="primary" plain size="mini" @click="handleImport">导入</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" plain size="mini" @click="handleExport">导出</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" size="mini" @click="handleNumAdd">流水号新增</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" size="mini" @click="handleAdd">新增</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button size="mini" :disabled="single" @click="handleCopy">复制</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button size="mini" :disabled="single" @click="handleEdit">编辑</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="danger" size="mini" :disabled="single" @click="handleDelete">删除</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button size="mini" :disabled="single" @click="handleAudit(0)">审核</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button size="mini" :disabled="single" @click="handleAudit(1)">反审核</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button size="mini" :disabled="single" @click="handleStop(0)">禁用</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button size="mini" :disabled="single" @click="handleStop(1)">反禁用</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button size="mini" @click="handleColumnSetting">列设置</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button size="mini" @click="handleButtonSetting">按钮设置</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" size="mini" @click="handleSaveScheme">保存方案</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" size="mini" @click="handleReadScheme">读取方案</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button size="mini" @click="handleRefresh">刷新</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button size="mini" @click="handleExit">退出</el-button>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="10" style="margin-top: 10px">
|
<el-col :span="4">
|
<el-card style="height: 600px; overflow: auto">
|
<div slot="header">
|
<span>客户分类</span>
|
</div>
|
<el-tree :data="treeData" :props="treeProps" node-key="id" default-expand-all :expand-on-click-node="false"
|
@node-click="handleTreeNodeClick" :highlight-current="true">
|
<span class="custom-tree-node" slot-scope="{ node, data }">
|
<span>{{ node.label }}</span>
|
</span>
|
</el-tree>
|
</el-card>
|
</el-col>
|
|
|
<el-col :span="20">
|
<div class="tableBox" v-loading="loading">
|
<el-table :data="tableData" ref="tableData" height="600" @selection-change="handleSelectionChange" border
|
@row-click="handleRowClick" :row-style="rowStyle" @cell-dblclick="handleDblclick" v-if="tableShow">
|
<el-table-column type="selection" width="55" align="center" fixed="left" />
|
<el-table-column prop="hmainid" label="单据ID" v-if="false" />
|
<el-table-column v-for="(item, index) in btList" :key="index" :align="item.align" :prop="item.field"
|
:label="item.title" :width="item.width" v-if="!item.hide" :sortable="item.sort" show-overflow-tooltip
|
:fixed="item.fixed">
|
<template slot-scope="{ row, column }">
|
<div :style="item.style">
|
<el-button type="text" @click="handleCustomerCodeClick(row)" v-if="column.property === '客户代码'">{{
|
row[column.property] }}</el-button>
|
<span v-else-if="(column.property || '').includes('时间') || (column.property || '').includes('日期')">
|
{{ formatDate(row[column.property]) }}
|
</span>
|
<span v-else>{{ row[column.property] }}</span>
|
</div>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination v-show="total > 0" :total="total" :page.sync="page" :limit.sync="pageSize" :pageSizes="pageSizes"
|
@pagination="getList" />
|
</div>
|
</el-col>
|
</el-row>
|
|
|
<el-card v-if="selectedRow" style="margin-top: 20px">
|
<div slot="header">
|
<span>关联用户</span>
|
</div>
|
<el-table :data="relationUserData" height="300" border v-loading="relationLoading">
|
<el-table-column v-for="(item, index) in relationUserColumns" :key="index" :prop="item.field"
|
:label="item.title" :width="item.width" :align="item.align">
|
<template slot-scope="{ row, column }">
|
<span v-if="column.property.includes('时间') || column.property.includes('日期')">
|
{{ formatDate(row[column.property]) }}
|
</span>
|
<span v-else>{{ row[column.property] }}</span>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-card>
|
|
<el-dialog title="隐藏列设置" :visible.sync="openColumnSetting" width="816px" append-to-body>
|
<RowSettings :colName="btResList" :HModName="HModName" @rowEditClose="columnSettingClose"
|
v-if="columnSettingShow" />
|
</el-dialog>
|
|
<el-dialog title="编辑客户" :visible.sync="openEdit" width="1480px" append-to-body class="customerBox"
|
:before-close="closeEdit">
|
<CustomerEdit :OperationType="OperationType" :linterid="selectedRow ? selectedRow.HItemID : ''"
|
:HSouceBillType="''" :HCusTypeID="currentCusTypeID" :HCusClsName="currentCusClsName" @editClose="editClose"
|
v-if="editShow" />
|
</el-dialog>
|
|
<el-dialog :title="upload.title" :visible.sync="upload.open" width="1500px" append-to-body>
|
<div style="margin-top: -20px">
|
<el-button type="primary" size="mini" @click="handleImportSubmit">导入数据</el-button>
|
<el-button type="primary" size="mini" @click="upload.open = false">退 出</el-button>
|
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" style="display: inline-block; margin-left: 10px"
|
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess">
|
<el-button type="primary" size="mini">文件上传</el-button>
|
</el-upload>
|
</div>
|
<el-table :data="uploadData" v-loading="uploadTableLoading" border height="550">
|
<el-table-column type="index" label="序号" width="55" align="center" />
|
<el-table-column label="客户代码" prop="客户代码" align="center" width="120" />
|
<el-table-column label="客户名称" prop="客户名称" align="center" width="120" />
|
<el-table-column label="客户分类" prop="客户分类" align="center" width="120" />
|
<el-table-column label="操作" align="center">
|
<template slot-scope="scope">
|
<el-button size="mini" type="text" icon="el-icon-delete"
|
@click="uploadDataDelete(scope.$index)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import axios from "axios";
|
import RowSettings from "@/views/component/rowSettings";
|
import CustomerEdit from "@/views/GyCustomer/CustomerEdit";
|
|
export default {
|
name: "GyCustomer",
|
components: { RowSettings, CustomerEdit },
|
props: {
|
openPage: { type: String },
|
},
|
data() {
|
return {
|
|
activeCollapse: [],
|
|
HModName: "Gy_Customer",
|
HModuleName: "客户列表维护",
|
HClassTag: "ForFilteringSchemes",
|
|
|
|
treeData: [],
|
treeProps: {
|
children: 'children',
|
label: 'title'
|
},
|
currentCusTypeID: 0,
|
currentCusClsName: '',
|
|
|
editShow: false,
|
openEdit: false,
|
OperationType: null,
|
|
columnSettingShow: false,
|
openColumnSetting: false,
|
|
tableShow: true,
|
loading: true,
|
|
queryParams: {
|
HNumber: null,
|
HName: null,
|
HNumber2: null,
|
ColName: "",
|
ColName1: "",
|
ColName2: "",
|
Comparator: "",
|
Comparator1: "",
|
Comparator2: "",
|
ColContent: "",
|
ColContent1: "",
|
ColContent2: "",
|
},
|
|
currentFilterScheme: "",
|
HInterID_Choose: 0,
|
|
comparatorList: [
|
{ label: "=", value: "=" },
|
{ label: ">=", value: ">=" },
|
{ label: ">", value: ">" },
|
{ label: "<=", value: "<=" },
|
{ label: "<", value: "<" },
|
{ label: "<>", value: "<>" },
|
{ label: "包含", value: "7" },
|
{ label: "左包含", value: "8" },
|
{ label: "右包含", value: "9" },
|
{ label: "不包含", value: "10" },
|
],
|
|
sWhere: "",
|
selectedRow: null,
|
ids: [],
|
single: true,
|
multiple: true,
|
tyResList: [],
|
btList: [],
|
btResList: [],
|
tableData: [],
|
pageSizes: [50, 100, 500, 5000, 50000],
|
page: 1,
|
pageSize: 50,
|
total: 0,
|
|
relationUserData: [],
|
relationUserColumns: [],
|
relationLoading: false,
|
|
upload: {
|
open: false,
|
title: "导入",
|
isUploading: false,
|
updateSupport: 0,
|
url: "",
|
},
|
uploadData: [],
|
uploadTableLoading: false,
|
|
baseURL: process.env.VUE_APP_BASE_URL || "http://47.96.97.237/API/",
|
user: "admin",
|
};
|
},
|
computed: {
|
visibleColumns() {
|
return this.btList.filter(item => !item.hide && item.field);
|
}
|
},
|
created() {
|
this.upload.url = this.baseURL + "Gy_Customer/Gy_Customer_Excel";
|
this.fetchData();
|
},
|
methods: {
|
fetchData() {
|
axios
|
.get(this.baseURL + "Web/GetUser", {
|
params: {
|
UserName: sessionStorage.getItem("UserName") || "admin",
|
PassWord: "123456",
|
HOrgName: sessionStorage.getItem("OrganizationID") || "100038"
|
}
|
})
|
.then((response) => {
|
let data = response.data.data[0];
|
this.user = data.Czymc;
|
this.getTreeData();
|
this.getList();
|
this.getDefaultFilterScheme();
|
})
|
.catch((error) => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
getTreeData() {
|
axios
|
.get(this.baseURL + "/Gy_BadReason/Gy_CusTypeTreeListByLevel")
|
.then((response) => {
|
if (response.data.count == 1) {
|
this.treeData = JSON.parse(response.data.data);
|
}
|
})
|
.catch((error) => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
getList() {
|
this.tableShow = false;
|
this.loading = true;
|
console.log(this.sWhere);
|
console.log(this.user);
|
console.log(this.page);
|
console.log(this.pageSize);
|
axios
|
.get(this.baseURL + "/Gy_Customer/page", {
|
params: {
|
sWhere: this.sWhere,
|
user: this.user,
|
page: 1,
|
size: this.pageSize,
|
Organization: ''
|
},
|
})
|
.then((response) => {
|
let data1 = response.data;
|
console.log(response);
|
console.log(response.count);
|
if (data1.code == 1) {
|
this.tyResList = data1.data;
|
console.log(this.tyResList);
|
this.btResList = data1.data;
|
console.log(this.btResList);
|
this.total = data1.count;
|
this.setDefaultColumns();
|
this.tableData = data1.data;
|
this.tableShow = true;
|
this.loading = false;
|
}
|
})
|
.catch((error) => {
|
this.$modal.msgError("接口请求失败!");
|
this.loading = false;
|
});
|
},
|
|
setDefaultColumns() {
|
this.btList = [
|
{ type: 'checkbox', fixed: 'left' },
|
{ field: 'hmainid', title: '单据ID', hide: true },
|
{ field: '客户代码', title: '客户代码', align: 'center', width: 120 },
|
{ field: '客户名称', title: '客户名称', align: 'center', width: 120 },
|
{ field: '条码编号', title: '条码编号', align: 'center', width: 120 },
|
{ field: '组织名称', title: '组织名称', align: 'center', width: 120 },
|
{ field: '明细标记', title: '明细标记', align: 'center', width: 100 },
|
{ field: '禁用标记', title: '禁用标记', align: 'center', width: 100 },
|
{ field: '审核人', title: '审核人', align: 'center', width: 100 },
|
{ field: '创建人', title: '创建人', align: 'center', width: 100 },
|
{ field: '创建时间', title: '创建时间', align: 'center', width: 150 }
|
];
|
},
|
|
handleTreeNodeClick(data) {
|
this.currentCusTypeID = data.id;
|
this.currentCusClsName = data.title;
|
|
if (data.id == "100") {
|
this.sWhere = " and HCusTypeID= " + "0";
|
} else if (data.id == "0") {
|
this.sWhere = "";
|
} else {
|
this.sWhere = " and HCusTypeID='" + data.id + "' ";
|
}
|
this.getList();
|
},
|
|
|
async handleQuery() {
|
this.sWhere = "";
|
|
this.processFilterConditions();
|
|
|
if (this.queryParams.HNumber) {
|
this.sWhere += " and 客户代码 like '%" + this.queryParams.HNumber + "%'";
|
}
|
if (this.queryParams.HName) {
|
this.sWhere += " and 客户名称 like '%" + this.queryParams.HName + "%'";
|
}
|
|
this.getList();
|
},
|
|
processFilterConditions() {
|
const conditions = [
|
{ colName: this.queryParams.ColName, comparator: this.queryParams.Comparator, content: this.queryParams.ColContent },
|
{ colName: this.queryParams.ColName1, comparator: this.queryParams.Comparator1, content: this.queryParams.ColContent1 },
|
{ colName: this.queryParams.ColName2, comparator: this.queryParams.Comparator2, content: this.queryParams.ColContent2 }
|
];
|
|
conditions.forEach(condition => {
|
if (condition.colName && condition.colName !== "0" && condition.comparator && condition.comparator !== "0") {
|
let com = "";
|
switch (condition.comparator) {
|
case "7":
|
com = "like'%" + condition.content + "%'";
|
break;
|
case "8":
|
com = "like'%" + condition.content + "'";
|
break;
|
case "9":
|
com = "like'" + condition.content + "%'";
|
break;
|
case "10":
|
com = "not like'%" + condition.content + "%'";
|
break;
|
default:
|
com = "" + condition.comparator + "'" + condition.content + "'";
|
break;
|
}
|
this.sWhere += " and " + condition.colName + " " + com;
|
}
|
});
|
},
|
|
|
resetQuery() {
|
this.sWhere = "";
|
this.queryParams = {
|
HNumber: null,
|
HName: null,
|
HNumber2: null,
|
ColName: "0",
|
ColName1: "0",
|
ColName2: "0",
|
Comparator: "0",
|
Comparator1: "0",
|
Comparator2: "0",
|
ColContent: "",
|
ColContent1: "",
|
ColContent2: "",
|
};
|
this.getList();
|
},
|
|
handleResCnz() {
|
if (!this.queryParams.HNumber2) {
|
this.$modal.msgWarning("请输入客户代码");
|
return;
|
}
|
|
axios
|
.get(this.baseURL + "/Gy_Customer/Gy_CustomerViewApi", {
|
params: {
|
Number: this.queryParams.HNumber2,
|
Type: 'KH'
|
}
|
})
|
.then((response) => {
|
if (response.data.count == 1) {
|
this.$modal.msgSuccess(response.data.Message);
|
this.getList();
|
} else {
|
this.$modal.msgError(response.data.Message);
|
}
|
})
|
.catch((error) => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
|
|
handleImport() {
|
this.uploadData = [];
|
this.upload.isUploading = false;
|
this.upload.title = "导入";
|
this.upload.open = true;
|
},
|
|
handleExport() {
|
axios
|
.get(this.baseURL + "/LMES/getReportByModRightNameCheck", {
|
params: {
|
ModRightNameCheck: "Gy_Customer_ExportExcel",
|
user: this.user
|
}
|
})
|
.then((response) => {
|
if (response.data.count == 1) {
|
const ws = this.$XLSX.utils.json_to_sheet(this.tyResList);
|
const wb = this.$XLSX.utils.book_new();
|
this.$XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
|
this.$XLSX.writeFile(wb, `Gy_Customer_${new Date().getTime()}.xlsx`);
|
} else {
|
this.$modal.msgError("当前模块没有导出权限!");
|
}
|
})
|
.catch((error) => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
handleNumAdd() {
|
if ((this.currentCusTypeID == 0 || this.currentCusTypeID == null) && !this.judgeSkipTouchCusType()) {
|
this.$modal.msgWarning("请选择具体客户分类!");
|
return;
|
}
|
this.OperationType = 2;
|
this.openEdit = true;
|
this.editShow = true;
|
},
|
|
handleAdd() {
|
this.OperationType = 1;
|
this.openEdit = true;
|
this.editShow = true;
|
},
|
|
handleCopy() {
|
if (this.single) {
|
this.$modal.msgWarning("请选择一条数据");
|
return;
|
}
|
this.OperationType = 6;
|
this.openEdit = true;
|
this.editShow = true;
|
},
|
|
handleEdit() {
|
if (this.single) {
|
this.$modal.msgWarning("请选择一条数据");
|
return;
|
}
|
this.OperationType = 3;
|
this.openEdit = true;
|
this.editShow = true;
|
},
|
|
handleDelete() {
|
if (this.single) {
|
this.$modal.msgWarning("请选择一条数据");
|
return;
|
}
|
|
if (this.selectedRow.审核人 !== null && this.selectedRow.审核人 !== '') {
|
this.$modal.msgError("已被审核的用户不能被删除!");
|
return;
|
}
|
|
this.$modal
|
.confirm("确认要删除吗,删除后不能恢复")
|
.then(() => {
|
axios
|
.get(this.baseURL + "/Gy_Customer/Delete_Json", {
|
params: {
|
HItemID: this.selectedRow.HItemID,
|
User: this.user,
|
ModRightNameDelete: 'Crm_CustomerFile_Delete'
|
}
|
})
|
.then((response) => {
|
if (response.data.count == 1) {
|
this.getList();
|
this.$modal.msgSuccess("删除成功");
|
} else {
|
this.$modal.msgError("错误:" + response.data.code + response.data.Message);
|
}
|
})
|
.catch((error) => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
})
|
.catch(() => { });
|
},
|
|
handleAudit(isAudit) {
|
if (this.single) {
|
this.$modal.msgWarning("请选择一条数据");
|
return;
|
}
|
|
axios
|
.get(this.baseURL + "/Gy_Customer/AuditGy_Customer", {
|
params: {
|
HInterID: this.selectedRow.HItemID,
|
IsAudit: isAudit,
|
CurUserName: this.user
|
}
|
})
|
.then((response) => {
|
if (response.data.count == 1) {
|
this.getList();
|
this.$modal.msgSuccess(response.data.Message);
|
} else {
|
this.$modal.msgError(response.data.Message);
|
}
|
})
|
.catch((error) => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
handleStop(isStop) {
|
if (this.single) {
|
this.$modal.msgWarning("请选择一条数据");
|
return;
|
}
|
axios
|
.get(this.baseURL + "/Gy_Customer/StopGy_Customer", {
|
params: {
|
HInterID: this.selectedRow.HItemID,
|
IsStop: isStop,
|
CurUserName: this.user
|
}
|
})
|
.then((response) => {
|
if (response.data.count == 1) {
|
this.getList();
|
this.$modal.msgSuccess(response.data.Message);
|
} else {
|
this.$modal.msgError(response.data.Message);
|
}
|
})
|
.catch((error) => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
handleColumnSetting() {
|
this.columnSettingShow = true;
|
this.openColumnSetting = true;
|
},
|
|
handleButtonSetting() {
|
this.$modal.msgInfo("按钮设置功能");
|
},
|
|
handleSaveScheme() {
|
this.$modal.msgInfo("保存方案功能");
|
},
|
|
handleReadScheme() {
|
this.$modal.msgInfo("读取方案功能");
|
},
|
|
handleRefresh() {
|
if (this.$refs.tableData && this.$refs.tableData.clearSelection) {
|
this.$refs.tableData.clearSelection();
|
}
|
this.selectedRow = null;
|
this.ids = [];
|
this.single = true;
|
this.multiple = true;
|
this.getList();
|
},
|
|
handleExit() {
|
this.$router.go(-1);
|
},
|
|
handleCustomerCodeClick(row) {
|
this.selectedRow = row;
|
this.OperationType = 3;
|
this.openEdit = true;
|
this.editShow = true;
|
},
|
|
handleRowClick(row, column, event) {
|
this.$refs.tableData.toggleRowSelection(row);
|
this.selectedRow = row;
|
this.getRelationUserData(row.HItemID);
|
if (this.openPage) {
|
this.$emit('deptEmit', row, 7)
|
}
|
},
|
|
getRelationUserData(HCusID) {
|
this.relationLoading = true;
|
axios
|
.get(this.baseURL + "/Gy_Customer/RelationUserlist", {
|
params: { HCusID: HCusID }
|
})
|
.then((response) => {
|
if (response.data.count == 1) {
|
this.relationUserData = response.data.data;
|
this.setRelationUserColumns(response.data.list);
|
}
|
this.relationLoading = false;
|
})
|
.catch((error) => {
|
this.relationLoading = false;
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
|
setRelationUserColumns(list) {
|
this.relationUserColumns = [];
|
for (let key in list) {
|
if (list[key].ColmCols !== 'HCusID') {
|
this.relationUserColumns.push({
|
field: list[key].ColmCols,
|
title: list[key].ColmCols,
|
align: 'center',
|
width: 120
|
});
|
}
|
}
|
},
|
|
rowStyle({ row, rowIndex }) {
|
if (this.ids.includes(row.hmainid)) {
|
return { };
|
}
|
},
|
|
handleDblclick(row, column, cell, event) {
|
if (this.openPage) {
|
this.$emit('deptEmitDb', row, 7)
|
} else {
|
this.handleCustomerCodeClick(row);
|
}
|
},
|
|
handleSelectionChange(selection) {
|
if (this.openPage) {
|
//列表单选
|
if (selection.length > 1) {
|
const del_row = selection.shift()
|
this.$refs.tableData.toggleRowSelection(del_row, false) //设置这一行取消选中
|
}
|
this.rowForm = {}
|
this.ids = selection.map(item => item.HItemID)
|
this.rowForm = selection[0]
|
} else {
|
this.ids = selection.map((item) => item.hmainid);
|
this.single = selection.length != 1;
|
this.multiple = !selection.length;
|
if (!this.single) {
|
this.selectedRow = selection[0];
|
this.getRelationUserData(this.selectedRow.HItemID);
|
}
|
}
|
},
|
|
closeEdit() {
|
this.openEdit = false;
|
this.editShow = false;
|
},
|
|
editClose(val) {
|
this.openEdit = false;
|
this.editShow = false;
|
this.getList();
|
},
|
|
columnSettingClose(val) {
|
this.columnSettingShow = false;
|
this.openColumnSetting = val;
|
this.getList();
|
},
|
|
handleFileUploadProgress(event, file, fileList) {
|
this.upload.isUploading = true;
|
this.uploadTableLoading = true;
|
},
|
|
handleFileSuccess(response, file, fileList) {
|
this.upload.isUploading = true;
|
this.$refs.upload.clearFiles();
|
if (response.code == 1) {
|
this.uploadData = response.data;
|
this.uploadTableLoading = false;
|
} else {
|
this.$alert(
|
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
response.Message +
|
"</div>",
|
"导入结果",
|
{ dangerouslyUseHTMLString: true }
|
);
|
}
|
},
|
|
handleImportSubmit() {
|
if (this.uploadData.length === 0) {
|
this.$modal.msgWarning("请先上传文件");
|
return;
|
}
|
|
var sMainSub = JSON.stringify(this.uploadData) + "&和" + this.user;
|
axios({
|
method: "post",
|
url: this.baseURL + "/Gy_Customer/Gy_Customer_btnSave",
|
data: {
|
sMainSub: sMainSub,
|
},
|
})
|
.then((res) => {
|
this.$alert(
|
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
res.data.Message +
|
"</div>",
|
"导入结果",
|
{ dangerouslyUseHTMLString: true }
|
);
|
this.upload.open = false;
|
this.getList();
|
})
|
.catch((error) => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
uploadDataDelete(index) {
|
this.uploadData.splice(index, 1);
|
},
|
|
|
formatDate(dateString) {
|
if (!dateString) return '';
|
const date = new Date(dateString);
|
return date.toLocaleString('zh-CN');
|
},
|
|
judgeSkipTouchCusType() {
|
if (this.treeData.length > 0 && this.treeData[0].children &&
|
this.treeData[0].children.length == 1 &&
|
this.treeData[0].children[0].children.length == 0) {
|
return true;
|
} else {
|
return false;
|
}
|
},
|
|
getDefaultFilterScheme() {
|
this.currentFilterScheme = "当前过滤方案:默认方案";
|
}
|
},
|
};
|
</script>
|
|
<style>
|
.customerBox .el-date-editor.el-input {
|
width: 100%;
|
}
|
|
.custom-tree-node {
|
flex: 1;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
font-size: 14px;
|
padding-right: 8px;
|
}
|
|
.filter-collapse {
|
margin-top: 10px;
|
}
|
</style>
|