This commit is contained in:
ljx 2024-05-16 10:19:51 +08:00
parent 39fee5e0b3
commit 207dd06b49
2 changed files with 140 additions and 9 deletions

View File

@ -38,14 +38,14 @@
</a-row> </a-row>
<vxe-toolbar ref="xToolbar" custom> <vxe-toolbar ref="xToolbar" custom export>
<template #buttons> <template #buttons>
<a-button type="primary" icon="delete" @click="pageDelete()">批量删除</a-button> <a-button type="primary" icon="delete" @click="pageDelete()">批量删除</a-button>
</template> </template>
</vxe-toolbar> </vxe-toolbar>
<!-- 表格区 --> <!-- 表格区 -->
<div class="gridPanel"> <div class="gridPanel">
<vxe-grid ref='xGrid' v-bind="gridOptions"> <vxe-grid ref='xGrid' v-bind="gridOptions" :export-config="{}">
<!-- =============================== 表格列 自动生成 Start =============================== --> <!-- =============================== 表格列 自动生成 Start =============================== -->
<template #truck_id="{ row }"> <template #truck_id="{ row }">

View File

@ -1,15 +1,33 @@
<template> <template>
<div>
<vxe-form :data="searchFormData" :items="searchFormItems" titleColon @submit="onSearch" @reset="onReset">
<template #driver_id="{ }">
<ZkSelectSearch :ListTitle="'请选择司机'" :IsListShowCode="true"
:ListUrl="zkSelectSearch2.Search"
:ListUrlData="zkSelectSearch2.zkSelectData"
:ListFieldName="zkSelectSearch2.zkSelectDataFieldName"
:BackFieldNames="zkSelectSearch2.zkBackFieldNames" @zkSelectSearch="StaffhandleChange">
</ZkSelectSearch>
</template>
<template #date="{ }">
<a-form-item label="创建时间" :style="{ display: 'inline-block', width: 120 }">
</a-form-item>
<a-form-item :style="{ display: 'inline-block', width: 'calc(100% - 120px )' }">
<a-range-picker @change="onDateChange" />
</a-form-item>
</template>
</vxe-form>
<vxe-grid ref='xGrid' v-bind="gridOptions" @form-submit="initListData" @page-change="handlePageChange"> <vxe-grid ref='xGrid' v-bind="gridOptions" @form-submit="initListData" @page-change="handlePageChange">
<!-- 工具栏 --> <!-- 工具栏 -->
<template #toolbar_buttons> <template #toolbar_buttons>
<a-button @click="pageDelete()">批量删除</a-button> <a-button @click="pageDelete()">批量删除</a-button>
</template> </template>
<!-- 时间选择 --> <!-- 时间选择 -->
<template #create_time_item> <!-- <template #create_time_item>
<a-range-picker @change="onChangeCreatTime"/> <a-range-picker @change="onChangeCreatTime"/>
</template> </template> -->
<!-- 表单区操作 --> <!-- 表单区操作 -->
<template #operate_item> <!-- <template #operate_item>
<a-button type="primary" status="primary">查询</a-button> <a-button type="primary" status="primary">查询</a-button>
<a-button <a-button
@click="() => { @click="() => {
@ -20,7 +38,7 @@
}" }"
>重置 >重置
</a-button> </a-button>
</template> </template> -->
<template #driver_id="{ row }"> <template #driver_id="{ row }">
{{ row.driver_name }} {{ row.driver_name }}
@ -64,13 +82,16 @@
<a-empty/> <a-empty/>
</template> </template>
</vxe-grid> </vxe-grid>
</div>
</template> </template>
<script> <script>
import ListMixin from "@/application/zk/mixins/ListComponents.js"; import ListMixin from "@/application/zk/mixins/ListComponents.js";
import BASE_URL from '@/services/Middle/transport/TrainNumber/api.js';
import ZkSelectSearch from '@/components/zk/zkSelectSearch.vue';
export default { export default {
mixins: [ListMixin], mixins: [ListMixin],
components: { ZkSelectSearch },
props: { props: {
Columns: { Columns: {
type: Array type: Array
@ -110,6 +131,54 @@ export default {
data() { data() {
return { return {
DeleteIds: [], // id DeleteIds: [], // id
zkSelectSearch2: {
Search: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
zkSelectData: {
page: 1,
limit: 50,
order_bys: [
{
column: "create_time",
order: "desc"
},
],
},
zkSelectDataFieldName: 'MesStaff',
zkBackFieldNames: ['id', 'name', 'code', 'create_time'],
},
//
searchFormData: {
code: '',
truck_id: '',
driver_id: '',
},
//
searchRules: [
{ key: "code", mode: "like" },
{ key: "driver_id", mode: "like" }
],
//
searchFormItems: [ //
{
field: 'code',
title: '车次单号',
span: 4,
itemRender: { name: '$input', props: { placeholder: '请输入车次单号' } }
},
{
field: 'driver_id',
title: '司机',
span: 4,
slots: { default: 'driver_id' }
},
{ span: 8, slots: { default: 'date' } }, //
{
align: 'left', span: 4, itemRender: { //
name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, //
{ props: { type: 'reset', content: '重置' } }]
}
}
],
gridOptions: { // gridOptions: { //
resizable: true, // resizable: true, //
border: true, // border: true, //
@ -186,6 +255,9 @@ export default {
mode: "=", mode: "=",
value: this.truckID value: this.truckID
}) })
this.ListUrlData.start_time = this.start_time;
this.ListUrlData.end_time = this.end_time;
this.ListUrlData.search_rules = this.ListUrlData.search_rules.concat(this.getSearchParms());
this.$zk.getPagedData({ this.$zk.getPagedData({
url: this.ListUrl, url: this.ListUrl,
listFieldName: this.ListFieldName, listFieldName: this.ListFieldName,
@ -259,6 +331,16 @@ export default {
this.ListUrlData.end_time = dateString[1]; this.ListUrlData.end_time = dateString[1];
this.initListData() this.initListData()
} }
},
//
onDateChange(date) { //
if (date && date.length) { //
this.start_time = parseInt(date[0]._d.getTime() / 1000); //
this.end_time = parseInt(date[1]._d.getTime() / 1000); //
} else { //
this.start_time = 0; //
this.end_time = 0; //
}
}, },
// //
Add() { Add() {
@ -296,6 +378,55 @@ export default {
success && this.initListData(); // success && this.initListData(); //
} }
}) })
},
//
StaffhandleChange(value) {
this.searchFormData.driver_id = value.id;
// this.$refs.xGrid.commitProxy('query') //
},
//
getSearchParms() { //
var rules = []; //
let findMode = k => { //
for (let i in this.searchRules) { //
if (this.searchRules[i].key == k) return this.searchRules[i].mode; //
}
return "="; //
};
for (let key in this.searchFormData) { //
let value = this.searchFormData[key]; //
if (value) { //
let mode = findMode(key); //
if (mode == "like") { //
value = "%" + value + "%"; // %
}
rules.push({ //
column: key, //
mode: mode, //
value: value //
});
}
}
return rules; //
},
//
onSearch() {
this.initListData()
// console.log(this.$refs.xGrid)
// this.$refs.xGrid.commitProxy('query') //
},
onReset(){
this.start_time = null;
this.end_time = null;
this.searchFormData = {
code: '',
driver_id:'',
}
this.initListData();
} }
} }
} }