<template>
|
<div style="padding: 10px">
|
<el-card class="search-card" style="margin-bottom: 15px">
|
<el-button
|
type="text"
|
@click="toggleAdvancedSearch"
|
style="font-size: 12px; color: #409eff"
|
>
|
{{ showAdvancedSearch ? "收起" : "更多" }}
|
<i
|
:class="
|
showAdvancedSearch
|
? 'el-icon-arrow-up'
|
: 'el-icon-arrow-down'
|
"
|
></i>
|
</el-button>
|
<div style="margin-top: 15px">
|
<el-row :gutter="15">
|
<el-col :span="6">
|
<div style="display: flex; align-items: center">
|
<span style="width: 200px; text-align: right; margin-right: 10px"
|
>驾驶员代码:</span
|
>
|
<el-input
|
v-model="queryParams.HNumber"
|
placeholder="请输入驾驶员代码"
|
size="small"
|
@keyup.enter.native="handleQuery"
|
clearable
|
/>
|
</div>
|
</el-col>
|
<el-col :span="6">
|
<div style="display: flex; align-items: center">
|
<span style="width: 200px; text-align: right; margin-right: 10px"
|
>驾驶员名称:</span
|
>
|
<el-input
|
v-model="queryParams.HName"
|
placeholder="请输入驾驶员名称"
|
size="small"
|
@keyup.enter.native="handleQuery"
|
clearable
|
/>
|
</div>
|
</el-col>
|
<el-col :span="6">
|
<div style="display: flex; align-items: center">
|
<span style="width: 100px; text-align: right; margin-right: 10px"
|
>组织:</span
|
>
|
<el-select
|
v-model="queryParams.HUSEORGID"
|
placeholder="请选择组织"
|
size="small"
|
style="width: 100%"
|
>
|
<el-option
|
v-for="(item, index) in organizationList"
|
:key="index"
|
:label="item.Name"
|
:value="item.ID"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
</el-col>
|
<el-col :span="6">
|
<div style="display: flex; align-items: center">
|
<span style="width: 80px; text-align: right; margin-right: 10px"
|
>重新同步:</span
|
>
|
<el-input
|
v-model="queryParams.HSyncNumber"
|
placeholder="请输入驾驶员代码"
|
size="small"
|
@keyup.enter.native="handleSync"
|
clearable
|
style="flex: 1"
|
/>
|
<el-button
|
@click="handleSync"
|
size="small"
|
style="margin-left: 5px"
|
>同步</el-button
|
>
|
</div>
|
</el-col>
|
</el-row>
|
<div class="search-header">
|
<div style="display: flex; justify-content: space-between; align-items: center">
|
<div>
|
<el-button
|
type="primary"
|
icon="el-icon-search"
|
size="mini"
|
@click="handleQuery"
|
style="margin-right: 10px"
|
>搜索</el-button
|
>
|
<el-button
|
icon="el-icon-refresh"
|
size="mini"
|
@click="resetQuery"
|
style="margin-right: 10px"
|
>重置</el-button
|
>
|
<el-button
|
icon="el-icon-refresh"
|
size="mini"
|
@click="getList"
|
style="margin-right: 10px"
|
>刷新</el-button
|
>
|
|
</div>
|
</div>
|
</div>
|
<el-collapse-transition>
|
<div v-show="showAdvancedSearch">
|
<div style="margin-top: 15px">
|
<el-row :gutter="15">
|
<div style="margin-bottom: 50px">
|
<!-- 第一组过滤条件 -->
|
<el-col :span="24">
|
<div style="display: flex; align-items: center">
|
<el-select
|
v-model="queryParams.ColName"
|
placeholder="请选择"
|
size="small"
|
style="flex: 1"
|
>
|
<el-option label="" value="0"></el-option>
|
<el-option
|
v-for="(item, index) in filterColumnList"
|
:key="index"
|
:label="item.field"
|
:value="item.field"
|
v-if="!item.hide"
|
></el-option>
|
</el-select>
|
<el-select
|
v-model="queryParams.Comparator"
|
placeholder="请选择"
|
size="small"
|
style="width: 100px; margin: 0 10px"
|
>
|
<el-option label="" value="0"></el-option>
|
<el-option
|
v-for="(item, index) in comparatorList"
|
:key="index"
|
:label="item.label"
|
:value="item.value"
|
></el-option>
|
</el-select>
|
<el-input
|
v-model="queryParams.ColContent"
|
placeholder="请输入"
|
size="small"
|
@keyup.enter.native="handleQuery"
|
clearable
|
style="flex: 1"
|
/>
|
</div>
|
</el-col>
|
</div>
|
<div style="margin-bottom: 100px">
|
<!-- 第二组过滤条件 -->
|
<el-col :span="24">
|
<div style="display: flex; align-items: center">
|
|
<el-select
|
v-model="queryParams.ColName1"
|
placeholder="请选择"
|
size="small"
|
style="flex: 1"
|
>
|
<!-- <el-option label="" value="0"></el-option> -->
|
<el-option
|
v-for="(item, index) in filterColumnList"
|
:key="index"
|
:label="item.field"
|
:value="item.field"
|
v-if="!item.hide"
|
></el-option>
|
</el-select>
|
<el-select
|
v-model="queryParams.Comparator1"
|
placeholder="请选择"
|
size="small"
|
style="width: 100px; margin: 0 10px"
|
>
|
<!-- <el-option label="" value="0"></el-option> -->
|
<el-option
|
v-for="(item, index) in comparatorList"
|
:key="index"
|
:label="item.label"
|
:value="item.value"
|
></el-option>
|
</el-select>
|
<el-input
|
v-model="queryParams.ColContent1"
|
placeholder="请输入"
|
size="small"
|
@keyup.enter.native="handleQuery"
|
clearable
|
style="flex: 1"
|
/>
|
</div>
|
</el-col>
|
</div>
|
<div style="margin-bottom: 50px">
|
<!-- 第三组过滤条件 -->
|
<el-col :span="24">
|
<div style="display: flex; align-items: center">
|
<el-select
|
v-model="queryParams.ColName2"
|
placeholder="请选择"
|
size="small"
|
style="flex: 1"
|
>
|
<!-- <el-option label="" value="0"></el-option> -->
|
<el-option
|
v-for="(item, index) in filterColumnList"
|
:key="index"
|
:label="item.field"
|
:value="item.field"
|
v-if="!item.hide"
|
></el-option>
|
</el-select>
|
<el-select
|
v-model="queryParams.Comparator2"
|
placeholder="请选择"
|
size="big"
|
style="width: 100px; margin: 0 10px"
|
>
|
<el-option label="" value="0"></el-option>
|
<el-option
|
v-for="(item, index) in comparatorList"
|
:key="index"
|
:label="item.label"
|
:value="item.value"
|
></el-option>
|
</el-select>
|
<el-input
|
v-model="queryParams.ColContent2"
|
placeholder="请输入"
|
size="big"
|
@keyup.enter.native="handleQuery"
|
clearable
|
style="flex: 1"
|
/>
|
</div>
|
</el-col>
|
</div>
|
</el-row>
|
</div>
|
|
<div
|
v-if="currentFilterScheme"
|
style="
|
margin-top: 15px;
|
padding: 10px;
|
background-color: #f0f9ff;
|
border-radius: 4px;
|
border-left: 4px solid #409eff;
|
"
|
>
|
<span style="font-size: 14px; font-weight: bold; color: #fc9393">
|
当前过滤方案:{{ currentFilterScheme }}
|
</span>
|
<span
|
v-if="currentFilterRemark"
|
style="font-size: 13px; color: #7b90fb; margin-left: 10px"
|
>
|
({{ currentFilterRemark }})
|
</span>
|
<el-button
|
type="text"
|
@click="handleSaveScheme"
|
size="mini"
|
style="margin-left: 20px"
|
>保存方案</el-button
|
>
|
<el-button
|
type="text"
|
@click="handleReadScheme"
|
size="mini"
|
>读取方案</el-button
|
>
|
<el-button
|
type="text"
|
@click="clearFilterScheme"
|
size="mini"
|
style="color: #f56c6c"
|
>清除方案</el-button
|
>
|
</div>
|
</div>
|
</el-collapse-transition>
|
</div>
|
</el-card>
|
|
<el-row :gutter="10" class="mb8">
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-upload2"
|
size="mini"
|
@click="handleImport"
|
id="set_SouceExcel"
|
>导入</el-button
|
>
|
</el-col>
|
<!-- <el-col :span="1.5">
|
<el-button
|
type="warning"
|
plain
|
icon="el-icon-download"
|
size="mini"
|
@click="handleExport"
|
id="get_export"
|
>导出</el-button
|
>
|
</el-col> -->
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-plus"
|
size="mini"
|
@click="handleAddEdit((OperationType = 1))"
|
id="set_add"
|
>新增</el-button
|
>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-document-copy"
|
size="mini"
|
:disabled="single"
|
@click="handleCopy"
|
id="set_Copy"
|
>复制</el-button
|
>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-edit"
|
size="mini"
|
:disabled="single"
|
@click="handleEdit((row = rowForm), (OperationType = 3))"
|
id="set_show"
|
>编辑</el-button
|
>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-delete"
|
size="mini"
|
:disabled="single"
|
@click="handleDelete"
|
id="set_delete"
|
>删除</el-button
|
>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-check"
|
size="mini"
|
:disabled="single"
|
@click="handleAudit(0)"
|
id="btn_audit"
|
>审核</el-button
|
>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-close"
|
size="mini"
|
:disabled="single"
|
@click="handleAudit(1)"
|
id="btn_deaudit"
|
>反审核</el-button
|
>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-turn-off"
|
size="mini"
|
:disabled="single"
|
@click="handleStop(0)"
|
id="btn_stop"
|
>禁用</el-button
|
>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-open"
|
size="mini"
|
:disabled="single"
|
@click="handleStop(1)"
|
id="btn_destop"
|
>反禁用</el-button
|
>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-setting"
|
size="mini"
|
@click="handleRowHide"
|
id="set_hidecolumn"
|
>列设置</el-button
|
>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-s-operation"
|
size="mini"
|
@click="handleBtnHide"
|
id="HideButton"
|
>按钮设置</el-button
|
>
|
</el-col>
|
</el-row>
|
|
<div class="tableBox" v-loading="loading">
|
<el-table
|
:data="tableData"
|
ref="tableData"
|
max-height="650"
|
@selection-change="handleSelectionChange"
|
border
|
@row-click="handleRowClick"
|
:row-style="rowStyle"
|
@cell-dblclick="handleDblclick"
|
v-if="tableShow"
|
stripe
|
>
|
<el-table-column
|
type="selection"
|
width="55"
|
align="center"
|
fixed="left"
|
/>
|
<template v-for="(item, index) in btList">
|
<el-table-column
|
:align="item.align"
|
:prop="item.field"
|
:label="item.title"
|
:width="item.width"
|
:key="item.field"
|
v-if="!item.hide && item.field !== 'checkbox'"
|
:sortable="item.sort"
|
show-overflow-tooltip
|
:fixed="item.fixed"
|
>
|
<template slot-scope="{ row, column }">
|
<div :style="item.style">
|
<!-- 日期格式化 -->
|
<span
|
v-if="
|
column.property.includes('日期') ||
|
column.property.includes('Date')
|
"
|
>
|
{{ parseTime(row[column.property], "{y}-{m}-{d}") }}
|
</span>
|
<el-button
|
type="text"
|
@click="handleDriverCodeClick(row)"
|
v-else-if="column.property === '驾驶员代码'"
|
style="color: #409eff"
|
>{{ row[column.property] }}</el-button
|
>
|
<span
|
v-else-if="column.property === '禁用标记'"
|
:style="{
|
color: row[column.property] === 'Y' ? '#f56c6c' : '#67c23a',
|
fontWeight:
|
row[column.property] === 'Y' ? 'bold' : 'normal',
|
}"
|
>
|
{{ row[column.property] === "Y" ? "已禁用" : "正常" }}
|
</span>
|
<!-- 审核状态特殊样式 -->
|
<span
|
v-else-if="column.property === '审核人'"
|
:style="{
|
color: row[column.property] ? '#67c23a' : '#909399',
|
}"
|
>
|
{{ row[column.property] || "未审核" }}
|
</span>
|
<span v-else>{{ row[column.property] }}</span>
|
</div>
|
</template>
|
</el-table-column>
|
</template>
|
</el-table>
|
|
<pagination
|
v-show="total > 0"
|
:total="total"
|
:page.sync="page"
|
:limit.sync="pageSize"
|
:pageSizes="pageSizes"
|
@pagination="getList"
|
/>
|
|
<!-- 隐藏列设置弹窗 -->
|
<el-dialog
|
title="隐藏列设置"
|
:visible.sync="openRowHide"
|
width="816px"
|
append-to-body
|
>
|
<RowSettings
|
:colName="btResList"
|
:HModName="HModName"
|
@rowEditClose="rowSetClose"
|
v-if="rowHideShow"
|
/>
|
</el-dialog>
|
|
<!-- 编辑弹窗 -->
|
<el-dialog
|
:title="editDialogTitle"
|
:visible.sync="openEdit"
|
width="1480px"
|
append-to-body
|
class="driver-edit-dialog"
|
:before-close="closeEditDialog"
|
:close-on-click-modal="false"
|
>
|
<GyDriverEdit
|
:OperationType="OperationType"
|
:linterid="rowForm.HItemID"
|
:HSouceBillType="''"
|
@editCloseGy="editGyClose"
|
v-if="editShow"
|
ref="editComponent"
|
/>
|
<span slot="footer" class="dialog-footer" v-if="OperationType !== 4">
|
<!-- <el-button @click="closeEditDialog">取 消</el-button>
|
<el-button type="primary" @click="saveDriverData">保 存</el-button> -->
|
</span>
|
</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" @click="set_AddNew">导入数据</el-button>
|
<el-button type="primary" @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">文件上传</el-button>
|
</el-upload>
|
</div>
|
<el-table
|
:data="uploadData"
|
v-loading="uploadTableLoading"
|
:row-class-name="uploadDataIndex"
|
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="驾驶证号"
|
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.row)"
|
>删除</el-button
|
>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination
|
v-show="uploadTotal > 0"
|
:total="uploadTotal"
|
:page.sync="uploadPage"
|
:limit.sync="uploadPageSize"
|
:pageSizes="uploadPageSizes"
|
@pagination="currentPage"
|
/>
|
</el-dialog>
|
|
<!-- 过滤方案弹窗 -->
|
<el-dialog
|
title="过滤方案列表"
|
:visible.sync="openFilterScheme"
|
width="80%"
|
append-to-body
|
>
|
<div style="height: 500px; overflow: auto">
|
<el-table
|
:data="filterSchemeList"
|
border
|
style="width: 100%"
|
@row-click="selectFilterScheme"
|
>
|
<el-table-column
|
prop="方案名称"
|
label="方案名称"
|
width="200"
|
></el-table-column>
|
<el-table-column
|
prop="备注"
|
label="备注"
|
width="300"
|
></el-table-column>
|
<el-table-column prop="创建人" label="创建人" width="120"></el-table-column>
|
<el-table-column
|
prop="创建日期"
|
label="创建日期"
|
width="150"
|
></el-table-column>
|
<el-table-column label="操作" width="150" align="center">
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="mini"
|
@click="applyFilterScheme(scope.row)"
|
>应用</el-button
|
>
|
<el-button
|
type="text"
|
size="mini"
|
@click="deleteFilterScheme(scope.row)"
|
style="color: #f56c6c"
|
>删除</el-button
|
>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="confirmFilterScheme">确 定</el-button>
|
<el-button @click="openFilterScheme = false">取 消</el-button>
|
|
</span>
|
</el-dialog>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import axios from "axios";
|
import RowSettings from "@/views/component/rowSettings";
|
import GyDriverEdit from "@/views/system/user/GyDriverEdit.vue";
|
export default {
|
name: "GyDriverListNew",
|
components: { RowSettings, GyDriverEdit },
|
props: {
|
openPage: { type: String },
|
},
|
data() {
|
return {
|
HModName: "gy_driver",
|
HModuleName: "驾驶员设置",
|
|
showAdvancedSearch: false,
|
|
currentFilterScheme: "",
|
currentFilterRemark: "",
|
filterSchemeList: [],
|
openFilterScheme: false,
|
|
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: "",
|
organizationList: [],
|
filterColumnList: [],
|
|
user: "admin",
|
Organization: "",
|
currentRow: [],
|
rowForm: {},
|
editShow: false,
|
openEdit: false,
|
editDialogTitle: "驾驶员编辑",
|
tableShow: true,
|
openBtnHide: false,
|
btnHideShow: false,
|
rowHideShow: false,
|
openRowHide: false,
|
queryParams: {
|
HUSEORGID: null,
|
HName: null,
|
HNumber: null,
|
HSyncNumber: null,
|
Comparator: "",
|
Comparator1: "",
|
Comparator2: "",
|
ColContent: "",
|
ColContent1: "",
|
ColContent2: "",
|
ColName: "",
|
ColName1: "",
|
ColName2: "",
|
},
|
showSearch: true,
|
ids: [],
|
|
single: true,
|
|
multiple: true,
|
|
loading: true,
|
|
tyResList: [],
|
btList: [],
|
btResList: [],
|
tableData: [],
|
dataList: [],
|
titleData: ["HItemID", "HUSEORGID", "HEmpID", "负责人"],
|
|
pageSizes: [50, 100, 500, 5000, 50000],
|
page: 1,
|
pageSize: 50,
|
total: 0,
|
|
upload: {
|
open: false,
|
title: "导入驾驶员",
|
isUploading: false,
|
updateSupport: 0,
|
url: process.env.VUE_APP_BASE_API + "/Gy_Driver/Gy_Driver_Excel",
|
},
|
uploadData: [],
|
alluploadList: [],
|
uploadTableLoading: false,
|
uploadPageSizes: [50, 100, 500, 5000, 50000],
|
uploadPage: 1,
|
uploadPageSize: 50,
|
uploadTotal: 0,
|
|
OperationType: null,
|
copyType: 0,
|
|
baseURL: process.env.VUE_APP_BASE_API,
|
};
|
},
|
created() {
|
this.initData();
|
},
|
methods: {
|
async initData() {
|
try {
|
const userRes = await axios.get(
|
`${this.baseURL}/Web/GetUser?UserName=${
|
sessionStorage.getItem("UserName") || "001"
|
}&PassWord=123456&HOrgName=100038`
|
);
|
if (userRes.data.data && userRes.data.data[0]) {
|
const userData = userRes.data.data[0];
|
this.user = userData.Czymc || "admin";
|
this.Organization = userData.HUSEORGID;
|
this.queryParams.HUSEORGID = userData.HUSEORGID;
|
}
|
|
const orgRes = await axios.get(`${this.baseURL}/Web/GetOrganizations`);
|
if (orgRes.data.count == 1) {
|
this.organizationList = orgRes.data.data;
|
}
|
|
await this.getList();
|
} catch (error) {
|
this.$modal.msgError("初始化数据失败!");
|
}
|
},
|
|
toggleAdvancedSearch() {
|
this.showAdvancedSearch = !this.showAdvancedSearch;
|
},
|
|
async getList() {
|
this.tableShow = false;
|
this.loading = true;
|
console.log("获取列表数据...",this.sWhere );
|
try {
|
const params = {
|
sWhere: this.sWhere || "",
|
user: this.user,
|
Organization: this.Organization,
|
page: this.page,
|
size: this.pageSize,
|
};
|
|
const res = await axios.get(`${this.baseURL}/Gy_DriverController/list`, {
|
params,
|
});
|
|
if (res.data.count == 1) {
|
this.tyResList = res.data.data;
|
this.btResList = res.data.list;
|
this.total = res.data.count;
|
|
this.processTableHeader(res.data.list, res.data.data);
|
} else {
|
this.$modal.msgError(res.data.Message || "获取数据失败");
|
}
|
} catch (error) {
|
this.$modal.msgError("接口请求失败!");
|
} finally {
|
this.loading = false;
|
}
|
},
|
|
processTableHeader(headerList, data) {
|
const col = [];
|
col.push({ type: "checkbox", fixed: "left", field: "checkbox" });
|
|
headerList.forEach((item) => {
|
if (this.titleData.includes(item.ColmCols)) {
|
col.push({
|
field: item.ColmCols,
|
title: item.ColmCols,
|
align: "center",
|
hide: true,
|
});
|
} else {
|
const column = {
|
field: item.ColmCols,
|
title: item.ColmCols,
|
align: "center",
|
sort: true,
|
width: 200,
|
};
|
|
if (item.ColmType === "DateTime") {
|
column.templet = true; // 标记为日期类型
|
}
|
|
col.push(column);
|
}
|
});
|
|
this.btList = col;
|
this.tableData = data;
|
this.tableShow = true;
|
|
this.updateFilterColumns();
|
|
this.DisPlay_HideColumn();
|
},
|
|
updateFilterColumns() {
|
this.filterColumnList = this.btList.filter(
|
(item) => !item.hide && item.field !== "checkbox"
|
);
|
},
|
|
async DisPlay_HideColumn() {
|
try {
|
const res = await axios.get(
|
`${this.baseURL}/Xt_grdAlignment_WMES/grdAlignmentWMESList`,
|
{
|
params: {
|
HModName: this.HModName,
|
user: this.user,
|
},
|
}
|
);
|
|
if (res.data.data.length > 0) {
|
const config = res.data.data[0];
|
const dataCol = config.HGridString.split(",");
|
|
dataCol.forEach((colStr, index) => {
|
if (this.btList[index + 1]) {
|
const colParts = colStr.split("|");
|
|
// 隐藏列
|
if (colParts[1] == "1") {
|
this.btList[index + 1].hide = true;
|
}
|
|
// 列宽
|
if (colParts[3] > 0) {
|
this.btList[index + 1].width = colParts[3];
|
}
|
|
// 字体大小
|
if (config.HFontSize != 0) {
|
this.btList[index + 1].style = `font-size:${config.HFontSize}px;`;
|
}
|
|
// 显示列
|
if (
|
colParts[1] == "0" &&
|
!this.titleData.includes(this.btList[index + 1].title)
|
) {
|
this.btList[index + 1].hide = false;
|
}
|
|
// 对齐方式
|
switch (colParts[2]) {
|
case "L":
|
this.btList[index + 1].align = "left";
|
break;
|
case "M":
|
this.btList[index + 1].align = "center";
|
break;
|
case "R":
|
this.btList[index + 1].align = "right";
|
break;
|
}
|
|
// 列别名
|
if (colParts[4]) {
|
this.btList[index + 1].title = colParts[4];
|
}
|
}
|
});
|
|
// 冻结列
|
if (config.HFixCols > 0) {
|
for (
|
let i = 1;
|
i <= config.HFixCols && i < this.btList.length;
|
i++
|
) {
|
this.btList[i].fixed = "left";
|
}
|
}
|
|
this.tableShow = false;
|
this.$nextTick(() => {
|
this.tableShow = true;
|
});
|
}
|
} catch (error) {
|
console.error("加载列配置失败:", error);
|
}
|
},
|
|
handleQuery() {
|
this.sWhere = "";
|
const conditions = [];
|
|
if (this.queryParams.HNumber) {
|
conditions.push(`驾驶员代码 like '%${this.queryParams.HNumber}%'`);
|
}
|
if (this.queryParams.HName) {
|
conditions.push(`驾驶员名称 like '%${this.queryParams.HName}%'`);
|
}
|
// if (this.queryParams.HUSEORGID) {
|
// conditions.push(`HUSEORGID = '${this.queryParams.HUSEORGID}'`);
|
// }
|
|
|
if (this.queryParams.ColName !== "0" && this.queryParams.Comparator !== "0") {
|
const condition = this.buildCondition(
|
this.queryParams.ColName,
|
this.queryParams.Comparator,
|
this.queryParams.ColContent
|
);
|
if (condition) conditions.push(condition);
|
}
|
|
|
if (
|
this.queryParams.ColName1 !== "0" &&
|
this.queryParams.Comparator1 !== "0"
|
) {
|
const condition = this.buildCondition(
|
this.queryParams.ColName1,
|
this.queryParams.Comparator1,
|
this.queryParams.ColContent1
|
);
|
if (condition) conditions.push(condition);
|
}
|
|
if (
|
this.queryParams.ColName2 !== "0" &&
|
this.queryParams.Comparator2 !== "0"
|
) {
|
const condition = this.buildCondition(
|
this.queryParams.ColName2,
|
this.queryParams.Comparator2,
|
this.queryParams.ColContent2
|
);
|
if (condition) conditions.push(condition);
|
}
|
|
|
if (conditions.length > 0) {
|
this.sWhere ="and "+conditions;
|
}
|
console.log("查询条件:", this.sWhere);
|
//this.sWhere += this.addSWhereByOpenType();
|
|
this.page = 1;
|
this.getList();
|
},
|
|
buildCondition(colName, comparator, content) {
|
if (!content) return null;
|
|
switch (comparator) {
|
case "7":
|
return `${colName} like '%${content}%'`;
|
case "8":
|
return `${colName} like '%${content}'`;
|
case "9":
|
return `${colName} like '${content}%'`;
|
case "10":
|
return `${colName} not like '%${content}%'`;
|
default:
|
return `${colName} ${comparator} '${content}'`;
|
}
|
},
|
|
//
|
addSWhereByOpenType() {
|
// if (this.openPage) {
|
|
// return " and 禁用标记 = '' and ISNULL(审核人,'') <> ''";
|
// }
|
// // 直接打开的情况
|
// return " and 禁用标记 = ' '";
|
},
|
|
resetQuery() {
|
this.queryParams = {
|
HUSEORGID: this.Organization,
|
HName: "",
|
HNumber: "",
|
HSyncNumber: "",
|
Comparator: "0",
|
Comparator1: "0",
|
Comparator2: "0",
|
ColContent: "",
|
ColContent1: "",
|
ColContent2: "",
|
ColName: "0",
|
ColName1: "0",
|
ColName2: "0",
|
};
|
this.sWhere = "";
|
this.page = 1;
|
this.getList();
|
},
|
|
async handleSync() {
|
if (!this.queryParams.HSyncNumber) {
|
this.$modal.msgWarning("请输入要同步的驾驶员代码");
|
return;
|
}
|
|
try {
|
const res = await axios.get(`${this.baseURL}/Gy_Driver/Gy_DriverViewApi`, {
|
params: {
|
Number: this.queryParams.HSyncNumber,
|
Type: "JSY", // 驾驶员类型
|
HUseOrgID: this.queryParams.HUSEORGID,
|
},
|
});
|
|
if (res.data.count == 1) {
|
this.$modal.msgSuccess("同步成功");
|
this.getList();
|
} else {
|
this.$modal.msgError(res.data.Message || "同步失败");
|
}
|
} catch (error) {
|
this.$modal.msgError("同步失败");
|
}
|
},
|
|
// 点击行
|
handleRowClick(row) {
|
this.$refs.tableData.toggleRowSelection(row);
|
},
|
|
// 行样式
|
rowStyle({ row }) {
|
if (this.ids.includes(row.HItemID)) {
|
return { background: "#ecf5ff" };
|
}
|
return {};
|
},
|
|
// 双击行
|
handleDblclick(row) {
|
this.rowForm = row;
|
this.OperationType = 3;
|
this.editDialogTitle = "编辑驾驶员";
|
this.openEdit = true;
|
this.editShow = true;
|
},
|
|
handleDriverCodeClick(row) {
|
this.rowForm = row;
|
this.OperationType = 3;
|
this.editDialogTitle = "编辑驾驶员";
|
this.openEdit = true;
|
this.editShow = true;
|
},
|
|
handleSelectionChange(selection) {
|
this.ids = selection.map((item) => item.HItemID);
|
this.single = selection.length !== 1;
|
this.multiple = !selection.length;
|
if (!this.single) {
|
this.rowForm = selection[0];
|
}
|
},
|
|
// 新增
|
handleAddEdit() {
|
this.rowForm = { HItemID: 0 };
|
this.OperationType = 1;
|
this.editDialogTitle = "新增驾驶员";
|
this.openEdit = true;
|
this.editShow = true;
|
},
|
|
// 复制
|
handleCopy() {
|
if (this.single) {
|
this.$modal.msgWarning("请选择一条数据进行复制");
|
return;
|
}
|
this.OperationType = 2;
|
this.editDialogTitle = "复制驾驶员";
|
this.openEdit = true;
|
this.editShow = true;
|
},
|
|
// 编辑
|
handleEdit() {
|
if (this.single) {
|
this.$modal.msgWarning("请选择一条数据进行编辑");
|
return;
|
}
|
this.OperationType = 3;
|
this.editDialogTitle = "编辑驾驶员";
|
this.openEdit = true;
|
this.editShow = true;
|
},
|
|
// 关闭编辑弹窗
|
closeEditDialog() {
|
this.openEdit = false;
|
this.editShow = false;
|
setTimeout(() => {
|
this.getList();
|
}, 100);
|
},
|
|
// 保存
|
async saveDriverData() {
|
if (this.$refs.editComponent) {
|
await this.$refs.editComponent.handleSave();
|
|
this.closeEditDialog();
|
}
|
},
|
|
// 关闭编辑页面
|
editGyClose(val) {
|
this.editShow = false;
|
this.openEdit = false;
|
this.getList();
|
},
|
|
// 删除
|
async handleDelete() {
|
if (this.single) {
|
this.$modal.msgWarning("请选择一条数据进行删除");
|
return;
|
}
|
|
if (this.rowForm.审核人) {
|
this.$modal.msgError("已审核的数据不能删除");
|
return;
|
}
|
|
try {
|
await this.$modal.confirm("确认要删除吗,删除后不能恢复");
|
|
const res = await axios.get(`${this.baseURL}/DeltetGy_Driver`, {
|
params: {
|
HItemID: this.rowForm.HItemID.toString(),
|
user: this.user,
|
},
|
});
|
|
if (res.data.count == 1) {
|
this.$modal.msgSuccess("删除成功");
|
this.getList();
|
} else {
|
this.$modal.msgError(res.data.Message || "删除失败");
|
}
|
} catch (error) {
|
if (error !== "cancel") {
|
this.$modal.msgError("删除失败");
|
}
|
}
|
},
|
|
// 审核/反审核
|
async handleAudit(isAudit) {
|
if (this.single) {
|
this.$modal.msgWarning("请选择一条数据");
|
return;
|
}
|
|
try {
|
const action = isAudit ? "反审核" : "审核";
|
await this.$modal.confirm(`确认要${action}吗?`);
|
|
const res = await axios.get(`${this.baseURL}/Gy_Driver/AuditGy_Driver`, {
|
params: {
|
HInterID: this.rowForm.HItemID.toString(),
|
IsAudit: isAudit,
|
CurUserName: this.user,
|
},
|
});
|
|
if (res.data.count == 1) {
|
this.$modal.msgSuccess(`${action}成功`);
|
this.getList();
|
} else {
|
this.$modal.msgError(res.data.Message || `${action}失败`);
|
}
|
} catch (error) {
|
if (error !== "cancel") {
|
this.$modal.msgError("操作失败");
|
}
|
}
|
},
|
|
// 禁用/反禁用
|
async handleStop(isStop) {
|
if (this.single) {
|
this.$modal.msgWarning("请选择一条数据");
|
return;
|
}
|
|
try {
|
const action = isStop ? "反禁用" : "禁用";
|
await this.$modal.confirm(`确认要${action}吗?`);
|
|
const res = await axios.get(`${this.baseURL}/Gy_Driver/StopGy_Driver`, {
|
params: {
|
HInterID: this.rowForm.HItemID.toString(),
|
IsStop: isStop,
|
CurUserName: this.user,
|
},
|
});
|
|
if (res.data.count == 1) {
|
this.$modal.msgSuccess(`${action}成功`);
|
this.getList();
|
} else {
|
this.$modal.msgError(res.data.Message || `${action}失败`);
|
}
|
} catch (error) {
|
if (error !== "cancel") {
|
this.$modal.msgError("操作失败");
|
}
|
}
|
},
|
|
// // 导出
|
// handleExport() {
|
// import("@/vendor/Export2Excel").then((excel) => {
|
// const tHeader = this.btList
|
// .filter((item) => !item.hide && item.field !== "checkbox")
|
// .map((item) => item.title);
|
|
// const filterVal = this.btList
|
// .filter((item) => !item.hide && item.field !== "checkbox")
|
// .map((item) => item.field);
|
|
// const data = this.formatJson(filterVal, this.tyResList);
|
|
// excel.export_json_to_excel({
|
// header: tHeader,
|
// data,
|
// filename: `驾驶员设置_${new Date().getTime()}`,
|
// autoWidth: true,
|
// bookType: "xlsx",
|
// });
|
// });
|
// },
|
|
formatJson(filterVal, jsonData) {
|
return jsonData.map((v) =>
|
filterVal.map((j) => {
|
if (j.includes("日期") || j.includes("Date")) {
|
return this.parseTime(v[j], "{y}-{m}-{d}");
|
}
|
return v[j];
|
})
|
);
|
},
|
|
|
parseTime(time, cFormat) {
|
if (arguments.length === 0) {
|
return null;
|
}
|
const format = cFormat || "{y}-{m}-{d} {h}:{i}:{s}";
|
let date;
|
if (typeof time === "object") {
|
date = time;
|
} else {
|
if (typeof time === "string" && /^[0-9]+$/.test(time)) {
|
time = parseInt(time);
|
}
|
if (typeof time === "number" && time.toString().length === 10) {
|
time = time * 1000;
|
}
|
date = new Date(time);
|
}
|
const formatObj = {
|
y: date.getFullYear(),
|
m: date.getMonth() + 1,
|
d: date.getDate(),
|
h: date.getHours(),
|
i: date.getMinutes(),
|
s: date.getSeconds(),
|
a: date.getDay(),
|
};
|
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
|
const value = formatObj[key];
|
if (key === "a") {
|
return ["日", "一", "二", "三", "四", "五", "六"][value];
|
}
|
return value.toString().padStart(2, "0");
|
});
|
return time_str;
|
},
|
|
// 导入
|
handleImport() {
|
this.uploadData = [];
|
this.upload.title = "导入驾驶员";
|
this.upload.open = true;
|
},
|
|
// 文件上传中
|
handleFileUploadProgress(event, file, fileList) {
|
this.upload.isUploading = true;
|
this.uploadTableLoading = true;
|
},
|
|
// 文件上传成功
|
handleFileSuccess(response, file, fileList) {
|
this.upload.isUploading = false;
|
this.$refs.upload.clearFiles();
|
|
if (response.code == 1) {
|
this.alluploadList = response.data;
|
this.uploadData = this.getPage(this.uploadPage, this.alluploadList);
|
this.uploadTotal = this.alluploadList.length;
|
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 }
|
);
|
}
|
},
|
|
// 执行导入
|
async set_AddNew() {
|
const validData = this.uploadData.filter((item) => item);
|
|
if (validData.length === 0) {
|
this.$modal.msgWarning("没有可导入的数据");
|
return;
|
}
|
|
try {
|
const sSubStr = JSON.stringify(validData);
|
const sMainSub = sSubStr + "&和" + this.user;
|
|
const res = await axios.post(`${this.baseURL}/Gy_Driver/Gy_Process_Excel`, {
|
sMainSub: sMainSub,
|
});
|
|
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("导入失败");
|
}
|
},
|
|
// 获取分页数据
|
getPage(page, list) {
|
const sindex = (page - 1) * this.uploadPageSize;
|
const eindex = page * this.uploadPageSize;
|
return list.slice(sindex, eindex);
|
},
|
|
// 导入分页
|
currentPage(val) {
|
this.uploadPage = val.page;
|
this.uploadData = this.getPage(this.uploadPage, this.alluploadList);
|
},
|
|
// 导入数据序号
|
uploadDataIndex({ row, rowIndex }) {
|
row.index = rowIndex + 1 + (this.uploadPage - 1) * this.uploadPageSize;
|
},
|
|
// 删除导入数据
|
uploadDataDelete(row) {
|
this.$modal.confirm("确认要删除吗").then(() => {
|
const deleteIndex = row.index - 1 - (this.uploadPage - 1) * this.uploadPageSize;
|
this.uploadData.splice(deleteIndex, 1);
|
this.alluploadList.splice(row.index - 1, 1);
|
this.uploadTotal = this.alluploadList.length;
|
|
// 重新计算当前页数据
|
this.uploadData = this.getPage(this.uploadPage, this.alluploadList);
|
});
|
},
|
|
// 隐藏列设置
|
handleRowHide() {
|
this.rowHideShow = true;
|
this.openRowHide = true;
|
},
|
|
// 关闭列设置
|
rowSetClose(val) {
|
this.rowHideShow = false;
|
this.openRowHide = val;
|
this.getList();
|
},
|
|
// 按钮设置
|
handleBtnHide() {
|
this.$modal.msgInfo("按钮设置功能待开发");
|
},
|
|
// 保存方案
|
handleSaveScheme() {
|
this.$modal.msgInfo("保存方案功能待开发");
|
},
|
|
// 读取方案
|
handleReadScheme() {
|
this.loadFilterSchemes();
|
this.openFilterScheme = true;
|
},
|
|
// 加载过滤方案
|
async loadFilterSchemes() {
|
try {
|
const res = await axios.get(`${this.baseURL}/Xt_FastICScheme/list`, {
|
params: {
|
HModuleName: this.HModuleName,
|
user: this.user,
|
},
|
});
|
|
if (res.data.count == 1) {
|
this.filterSchemeList = res.data.data;
|
}
|
} catch (error) {
|
console.error("加载过滤方案失败:", error);
|
}
|
},
|
|
// 选择过滤方案
|
selectFilterScheme(row) {
|
this.selectedFilterScheme = row;
|
},
|
|
// 应用过滤方案
|
applyFilterScheme(row) {
|
this.currentFilterScheme = row.方案名称;
|
this.currentFilterRemark = row.备注;
|
|
// 这里应该根据方案内容设置查询条件
|
// 由于方案数据结构复杂,这里只做简单演示
|
this.$modal.msgSuccess(`已应用方案:${row.方案名称}`);
|
this.openFilterScheme = false;
|
},
|
|
// 删除过滤方案
|
async deleteFilterScheme(row) {
|
try {
|
await this.$modal.confirm(`确认要删除方案"${row.方案名称}"吗?`);
|
|
const res = await axios.post(`${this.baseURL}/Xt_FastICScheme/delete`, {
|
HInterID: row.hmainid,
|
});
|
|
if (res.data.count == 1) {
|
this.$modal.msgSuccess("删除成功");
|
this.loadFilterSchemes();
|
} else {
|
this.$modal.msgError("删除失败");
|
}
|
} catch (error) {
|
if (error !== "cancel") {
|
this.$modal.msgError("删除失败");
|
}
|
}
|
},
|
|
// 确认过滤方案
|
confirmFilterScheme() {
|
if (this.selectedFilterScheme) {
|
this.applyFilterScheme(this.selectedFilterScheme);
|
} else {
|
this.$modal.msgWarning("请选择一个过滤方案");
|
}
|
},
|
|
// 清除过滤方案
|
clearFilterScheme() {
|
this.currentFilterScheme = "";
|
this.currentFilterRemark = "";
|
this.resetQuery();
|
this.$modal.msgSuccess("已清除过滤方案");
|
},
|
},
|
};
|
</script>
|
|
<style scoped>
|
.search-card {
|
border-radius: 4px;
|
border: 1px solid #ebeef5;
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
}
|
|
.search-header {
|
border-bottom: 1px solid #ebeef5;
|
padding-bottom: 8px;
|
margin-bottom: 8px;
|
}
|
|
.mb8 {
|
margin-bottom: 15px;
|
}
|
|
.tableBox {
|
margin-top: 10px;
|
border: 1px solid #ebeef5;
|
border-radius: 4px;
|
padding: 15px;
|
background-color: #fff;
|
}
|
|
.driver-edit-dialog ::v-deep .el-dialog__body {
|
padding: 20px;
|
}
|
|
/* 响应式调整 */
|
@media (max-width: 1200px) {
|
.el-col {
|
margin-bottom: 10px;
|
}
|
}
|
|
/* 表格行样式优化 */
|
::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
|
background-color: #fafafa;
|
}
|
|
::v-deep .el-table th {
|
background-color: #f5f7fa;
|
color: #909399;
|
font-weight: bold;
|
}
|
|
/* 按钮组样式 */
|
::v-deep .el-button-group .el-button {
|
margin-right: 0;
|
}
|
|
/* 折叠过渡效果 */
|
.el-collapse-transition-enter-active,
|
.el-collapse-transition-leave-active {
|
transition: all 0.3s ease;
|
}
|
|
.el-collapse-transition-enter,
|
.el-collapse-transition-leave-to {
|
opacity: 0;
|
transform: translateY(-10px);
|
}
|
</style>
|