This commit is contained in:
parent
9e2c8933ed
commit
94b10b3fee
|
|
@ -50,7 +50,7 @@ export default {
|
|||
currentBeid: 0,
|
||||
|
||||
uploadDefaultImg: null,
|
||||
detailDataFieldName: "maintenance",
|
||||
detailDataFieldName: "maintenance_giornale_log",
|
||||
|
||||
actions: {
|
||||
// =============================== 接口地址 自动生成 Start ===============================
|
||||
|
|
@ -224,9 +224,9 @@ export default {
|
|||
|
||||
};
|
||||
|
||||
pageData.actions.get = pageData.actions.MaintenanceDetail;
|
||||
pageData.actions.create = pageData.actions.MaintenanceCreate;
|
||||
pageData.actions.update = pageData.actions.MaintenanceUpdate;
|
||||
pageData.actions.get = pageData.actions.MaintenanceGiornaleLogDetail;
|
||||
pageData.actions.create = pageData.actions.MaintenanceGiornaleLogCreate;
|
||||
pageData.actions.update = pageData.actions.MaintenanceGiornaleLogUpdate;
|
||||
|
||||
// 合并表单数据及配置
|
||||
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
|
||||
|
|
|
|||
|
|
@ -214,18 +214,14 @@ export default {
|
|||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // 车辆编码
|
||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // 车辆名称
|
||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||
{field: 'maintenance_name', sortable: true, title: '维修项目名称', width: 150}, // 维修项目名称
|
||||
{field: 'maintenance_code', sortable: true, title: '维修项目编码', width: 140}, // 维修项目编码
|
||||
{field: 'maintenance_name', sortable: true, title: '项目名称', width: 150}, // 维修项目名称
|
||||
{field: 'maintenance_code', sortable: true, title: '项目编码', width: 140}, // 维修项目编码
|
||||
{field: 'last_maintenance_date', sortable: true, title: '上次维修日期', width: 130}, // 上次维修日期
|
||||
{field: 'last_mileage', sortable: true, title: '上次维修公里数', width: 140}, // 上次维修公里数
|
||||
// {field: 'last_mileage', sortable: true, title: '上次维修公里数', width: 140}, // 上次维修公里数
|
||||
{field: 'mileage', sortable: true, title: '维修公里数记录', width: 140}, // 维修公里数记录
|
||||
{field: 'maintenance_interval', sortable: true, title: '维修时间间隔', width: 140}, // 维修时间间隔
|
||||
{field: 'mileage_interval', sortable: true, title: '维修公里数间隔', width: 140}, // 维修公里数间隔
|
||||
{field: 'maintenance_abolish_date', sortable: true, title: '维修作废日期', width: 140}, // 维修作废日期
|
||||
{field: 'maintenance_abolish_mileage', sortable: true, title: '维修作废公里数', width: 140}, // 维修作废公里数
|
||||
{field: 'maintenance_mileage', sortable: true, title: '维修公里数', width: 120}, // 维修公里数
|
||||
|
||||
|
||||
{
|
||||
field: 'maintenance_date',
|
||||
formatter: 'formatDate',
|
||||
|
|
@ -236,6 +232,10 @@ export default {
|
|||
}, // 维修日期
|
||||
|
||||
{field: 'maintenance_remark', sortable: true, title: '维修备注', width: 250}, // 维修备注
|
||||
// {field: 'maintenance_abolish_date', sortable: true, title: '维修作废日期', width: 140}, // 维修作废日期
|
||||
// {field: 'maintenance_abolish_mileage', sortable: true, title: '维修作废公里数', width: 140}, // 维修作废公里数
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export default {
|
|||
currentBeid: 0,
|
||||
|
||||
uploadDefaultImg: null,
|
||||
detailDataFieldName: "maintenance",
|
||||
detailDataFieldName: "other_expenses_log",
|
||||
|
||||
actions: {
|
||||
// =============================== 接口地址 自动生成 Start ===============================
|
||||
|
|
@ -190,9 +190,9 @@ export default {
|
|||
|
||||
};
|
||||
|
||||
pageData.actions.get = pageData.actions.MaintenanceDetail;
|
||||
pageData.actions.create = pageData.actions.MaintenanceCreate;
|
||||
pageData.actions.update = pageData.actions.MaintenanceUpdate;
|
||||
pageData.actions.get = pageData.actions.OtherExpensesLogDetail;
|
||||
pageData.actions.create = pageData.actions.OtherExpensesLogCreate;
|
||||
pageData.actions.update = pageData.actions.OtherExpensesLogUpdate;
|
||||
|
||||
// 合并表单数据及配置
|
||||
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
|
||||
|
|
|
|||
|
|
@ -168,11 +168,11 @@ export default {
|
|||
itemRender: {name: '$input', props: {type: "date"}}
|
||||
},
|
||||
{field: 'truck_number_before_mileage', title: '出车前总公里数', span: 6, itemRender: {name: '$input'}},
|
||||
{field: 'truck_number_after_mileage', title: '回车后总公里数', span: 6, itemRender: {name: '$input'}},
|
||||
{field: 'oil_consumption_number', title: '油耗数量', span: 12, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
{field: 'oil_consumption_price', title: '油耗单价', span: 12, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
{field: 'oil_consumption_total_price', title: '油耗总价', span: 12, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
{field: 'oil_consumption_hundred', title: '百公里油耗', span: 12, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
{field: 'truck_number_after_mileage', title: '车辆总公里数', span: 6, itemRender: {name: '$input'}},
|
||||
{field: 'oil_consumption_price', title: '油耗单价', span: 6, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
{field: 'oil_consumption_number', title: '油耗数量', span: 6, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
{field: 'oil_consumption_total_price', title: '油耗总价', span: 6, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
{field: 'oil_consumption_hundred', title: '百公里油耗', span: 6, itemRender: {name: '$input', props: { type: 'number'}}},
|
||||
|
||||
{field: 'oil_consumption_remark', title: '油耗备注', span: 24, itemRender: {name: '$textarea'}},
|
||||
|
||||
|
|
|
|||
|
|
@ -41,13 +41,20 @@
|
|||
<template #tire_type="{row}">
|
||||
{{row.tire_type == 1 ? '更换' : '补胎'}}
|
||||
</template>"
|
||||
<template #tire_change_date="{row}">
|
||||
{{ row.tire_change_date }} 天
|
||||
</template>
|
||||
<!-- =============================== 表格列 自动生成 End =============================== -->
|
||||
|
||||
<template #op="{ row }">
|
||||
<template #op1="{ row }">
|
||||
<div class="oplinks">
|
||||
<a @click.stop="pageEdit(row)" title="编辑">
|
||||
<a v-if="row.tire_abolish_date === 0" @click.stop="pageEdit(row)" title="轮胎作废">
|
||||
<a-button type="primary">轮胎作废</a-button>
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
<template #op="{ row }">
|
||||
<div class="oplinks">
|
||||
<a @click.stop="pageDelete(row)" title="删除">
|
||||
<a-icon type="delete"/>
|
||||
</a>
|
||||
|
|
@ -204,19 +211,20 @@ export default {
|
|||
{field: 'truck_code', sortable: true, title: '车辆编码', width: 120}, // 车辆编码
|
||||
{field: 'truck_name', sortable: true, title: '车辆名称', width: 120}, // 车辆名称
|
||||
{field: 'truck_number', sortable: true, title: '车牌号', width: 120}, // 车牌号
|
||||
{field: 'tire_type', sortable: true, title: '类型', width: 70 ,slots:{ default:"tire_type"}}, // 轮胎更换类型: 1.更换,2.补胎
|
||||
{field: 'tire_brand', sortable: true, title: '品牌', width: 100}, // 轮胎品牌
|
||||
{field: 'tire_model', sortable: true, title: '型号', width: 100}, // 轮胎型号
|
||||
// {field: 'tire_type', sortable: true, title: '类型', width: 70 ,slots:{ default:"tire_type"}}, // 轮胎更换类型: 1.更换,2.补胎
|
||||
// {field: 'tire_brand', sortable: true, title: '品牌', width: 100}, // 轮胎品牌
|
||||
// {field: 'tire_model', sortable: true, title: '型号', width: 100}, // 轮胎型号
|
||||
{field: 'tire_date', sortable: true, title: '更换日期', formatter: 'formatDate',width: 120}, // 轮胎更换日期
|
||||
{field: 'last_mileage', sortable: true, title: '更换时公里数', width: 130}, // 更换公里数
|
||||
{field: 'mileage', sortable: true, title: '使用公里数', width: 120}, // 轮胎使用公里数
|
||||
{field: 'tire_change_date', sortable: true, title: '更换日期间隔',width: 150,slots:{ default:"tire_change_date"}}, // 轮胎更换日期间隔
|
||||
{field: 'tire_change_mileage', sortable: true, title: '更换间隔(公里数)', width: 150}, // 轮胎更换公里数间隔
|
||||
{field: 'tire_abolish_date', sortable: true, title: '作废日期',formatter: 'formatDate', width: 120}, // 轮胎作废日期
|
||||
{field: 'tire_abolish_mileage', sortable: true, title: '作废公里数', width: 120}, // 轮胎作废公里数
|
||||
{field: 'tire_count', sortable: true, title: '更换数量', width: 100}, // 轮胎更换数量
|
||||
{field: 'tire_price', sortable: true, title: '价格(元)', width: 120}, // 轮胎更换价格
|
||||
{field: 'tire_number', sortable: true, title: '胎号', width: 150}, // 轮胎胎号
|
||||
{field: 'old_tire_number', sortable: true, title: '旧胎号', width: 150}, // 轮胎更换旧胎号
|
||||
{field: 'last_mileage', sortable: true, title: '更换时公里数', width: 130}, // 更换公里数
|
||||
{field: 'mileage', sortable: true, title: '使用公里数', width: 120}, // 轮胎使用公里数
|
||||
{field: 'tire_change_date', sortable: true, title: '更换日期间隔',formatter: 'formatDate', width: 150}, // 轮胎更换日期间隔
|
||||
{field: 'tire_change_mileage', sortable: true, title: '更换公里数间隔', width: 150}, // 轮胎更换公里数间隔
|
||||
{field: 'tire_abolish_date', sortable: true, title: '作废日期',formatter: 'formatDate', width: 120}, // 轮胎作废日期
|
||||
{field: 'tire_abolish_mileage', sortable: true, title: '作废公里数', width: 120}, // 轮胎作废公里数
|
||||
{field: 'tire_remark', sortable: true, title: '备注', width: 250}, // 轮胎更换备注
|
||||
|
||||
{
|
||||
|
|
@ -232,7 +240,8 @@ export default {
|
|||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{title: '操作', slots: {default: 'op'}, width: 120,fixed: 'right'}
|
||||
{title: '轮胎作废', slots: {default: 'op1'}, width: 110,fixed: 'right'},
|
||||
{title: '操作', slots: {default: 'op'}, width: 80,fixed: 'right'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -250,6 +259,10 @@ export default {
|
|||
// desc() {
|
||||
// return this.$t('pageDesc')
|
||||
// }
|
||||
currentTime() {
|
||||
// 当前时间的时间戵
|
||||
return Math.floor(Date.now() / 1000);
|
||||
}
|
||||
},
|
||||
|
||||
// 创建完成
|
||||
|
|
@ -334,11 +347,34 @@ export default {
|
|||
|
||||
// 编辑
|
||||
pageEdit(row) {
|
||||
if (!row) { // 如果没有选中行
|
||||
this.$mk.msg("请选择行"); // 提示
|
||||
return; // 返回
|
||||
}
|
||||
this.$openPage("/Tire/TireUpdate/" + row[this.keyName]); // 打开页面
|
||||
// let rows = row ? [row] : this.$refs.xGrid.getCheckboxRecords(); // 获取选中行
|
||||
// let ids = []; // 定义id数组
|
||||
// rows.forEach((row) => { // 遍历选中行
|
||||
// ids.push(row[this.keyName]); // 将选择行的id添加到id数组
|
||||
// });
|
||||
|
||||
// if (!ids.length) { // 如果没有选中行
|
||||
// this.$mk.error("请选择行"); // 提示
|
||||
// return;
|
||||
// }
|
||||
|
||||
this.$mk.confirm('您确定要将轮胎作废吗?').then(type => { // 确认删除
|
||||
if (type == 'confirm') { // 如果确认删除
|
||||
this.$mk.post({
|
||||
url: this.actions.TireAbolish, // 请求删除数据地址
|
||||
loading: "处理中...", // 加载提示
|
||||
data: {
|
||||
id: row.id // 传递id数组
|
||||
},
|
||||
useBigInt: true
|
||||
}).then(() => { // 成功
|
||||
this.$mk.success("轮胎作废成功"); // 提示成功
|
||||
this.onSearch(); // 重新加载数据
|
||||
}).catch((a) => { // 失败
|
||||
this.$mk.error(a.data.msg); // 提示错误信息
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 删除
|
||||
|
|
@ -357,7 +393,7 @@ export default {
|
|||
this.$mk.confirm('您确定要删除吗?').then(type => { // 确认删除
|
||||
if (type == 'confirm') { // 如果确认删除
|
||||
this.$mk.post({
|
||||
url: this.actions.delete, // 请求删除数据地址
|
||||
url: this.actions.TireBatchDelete, // 请求删除数据地址
|
||||
loading: "删除中...", // 加载提示
|
||||
data: {
|
||||
ids: ids // 传递id数组
|
||||
|
|
|
|||
|
|
@ -733,6 +733,8 @@ export default {
|
|||
|
||||
let save = () => {
|
||||
|
||||
// this.formOptions.data.outsourcing_driver_phone转换为字符串
|
||||
this.formOptions.data.outsourcing_driver_phone = String(this.formOptions.data.outsourcing_driver_phone)
|
||||
|
||||
// 如果是新增模式,提交新增接口 如果是编辑模式,提交编辑接口
|
||||
let action = !this.isEdit ? this.actions.create : this.actions.update;
|
||||
|
|
|
|||
|
|
@ -4,11 +4,7 @@
|
|||
<!-- <div class="header">-->
|
||||
<!-- <h1>详情</h1>-->
|
||||
<!-- </div>-->
|
||||
<a-descriptions
|
||||
size="small"
|
||||
:title="pageOptions.title"
|
||||
bordered
|
||||
>
|
||||
<a-descriptions size="small" :title="pageOptions.title" bordered>
|
||||
<a-descriptions-item label="编码">
|
||||
{{ data.code }}
|
||||
</a-descriptions-item>
|
||||
|
|
@ -54,14 +50,28 @@
|
|||
</a-descriptions>
|
||||
|
||||
|
||||
<div class="train-number">
|
||||
<h2>
|
||||
出车记录
|
||||
</h2>
|
||||
|
||||
<zkTableList :ListUrl="TrainNumberList" :ListUrlData="zkSelectData" :ListFieldName="zkSelectDataFieldName"
|
||||
:Columns="this.$data.columns">
|
||||
|
||||
</zkTableList>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// import ZkTable from "@/components/zk/zkTable.vue";
|
||||
import zkTableList from "./TrainNumberList.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
// ZkTable
|
||||
zkTableList
|
||||
},
|
||||
props: {
|
||||
dataId: {
|
||||
|
|
@ -80,6 +90,61 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
TrainNumberList: `${this.$BASE_URL}/TrainNumber/v1/train/number/list`, // 车次列表
|
||||
zkSelectData:{
|
||||
|
||||
},
|
||||
zkSelectDataFieldName:"TrainNumber",
|
||||
// 表格列配置
|
||||
columns: [
|
||||
{ type: 'seq', width: 60 },
|
||||
{ type: 'checkbox', width: 42 },
|
||||
|
||||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
|
||||
{ field: 'code', align: 'center', sortable: true, title: '车次单号', width: 120 }, // 车次单号
|
||||
{
|
||||
field: 'driver_id', align: 'center', sortable: true, title: '司机', width: 80,
|
||||
slots: { default: 'driver_id' }
|
||||
}, // 司机id
|
||||
// {field: 'custom_id', sortable: true, title: '客户id', width: 250}, // 客户id
|
||||
{ field: 'custom_name', align: 'center', sortable: true, title: '客户名称', width: 200 }, // 客户名称
|
||||
// {field: 'supplier_id', sortable: true, title: '供应商id', width: 250}, // 供应商id
|
||||
{ field: 'supplier_name', align: 'center', sortable: true, title: '供应商名称', width: 200 }, // 客户名称
|
||||
// {field: 'soil_quality_material_id', sortable: true, title: '物料品名id', width: 250}, // 物料品名id
|
||||
// {field: 'outbound_soil_quality_material_id', sortable: true, title: '出库物料土质id', width: 250}, // 出库物料土质id
|
||||
// {field: 'warehousing_soil_quality_material_id', sortable: true, title: '入库物料土质id', width: 250}, // 入库物料土质id
|
||||
|
||||
// {field: 'unit_price', sortable: true, title: '单价', width: 120}, // 单价
|
||||
// {field: 'total_price', sortable: true, title: '总价', width: 120}, // 总价
|
||||
{
|
||||
field: 'is_outsourcing', align: 'center', sortable: true, title: '类型', width: 80,
|
||||
slots: { default: 'is_outsourcing' }
|
||||
}, // 是否委外
|
||||
// {field: 'is_need_outbound', sortable: true, title: '出车', width: 70}, // 是否需要出车
|
||||
{ field: 'outbound_date', align: 'center', sortable: true, formatter: 'formatDate', title: '出车日期', width: 100 }, // 出车日期
|
||||
{ field: 'return_date', align: 'center', sortable: true, formatter: 'formatDate', title: '回车日期', width: 100 }, // 回车日期
|
||||
|
||||
|
||||
{ field: 'outbound_mileage', align: 'center', sortable: true, title: '出车公里数', width: 120 }, // 出车公里数
|
||||
{ field: 'outbound_remark', align: 'center', sortable: true, title: '出车备注', width: 250 }, // 出车备注
|
||||
// {
|
||||
// field: 'income', sortable: true, title: '收入', width: 80, fixed: 'right',
|
||||
// align: 'center',
|
||||
// }, // 收入
|
||||
// {
|
||||
// field: 'cost', sortable: true, title: '成本', width: 80, fixed: 'right',
|
||||
// align: 'center',
|
||||
// }, // 成本
|
||||
// {
|
||||
// field: 'profit', sortable: true, title: '利润', width: 80, fixed: 'right',
|
||||
// align: 'center',
|
||||
// }, // 利润
|
||||
|
||||
// =============================== 表格列 自动生成 Start ===============================
|
||||
|
||||
],
|
||||
data: {},
|
||||
}
|
||||
},
|
||||
|
|
@ -120,4 +185,9 @@ export default {
|
|||
margin: 10px;
|
||||
|
||||
}
|
||||
|
||||
.train-number {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,302 @@
|
|||
<template>
|
||||
<vxe-grid ref='xGrid' v-bind="gridOptions" @form-submit="initListData" @page-change="handlePageChange">
|
||||
<!-- 工具栏 -->
|
||||
<template #toolbar_buttons>
|
||||
<a-button @click="pageDelete()">批量删除</a-button>
|
||||
</template>
|
||||
<!-- 时间选择 -->
|
||||
<template #create_time_item>
|
||||
<a-range-picker @change="onChangeCreatTime"/>
|
||||
</template>
|
||||
<!-- 表单区操作 -->
|
||||
<template #operate_item>
|
||||
<a-button type="primary" status="primary">查询</a-button>
|
||||
<a-button
|
||||
@click="() => {
|
||||
gridOptions.formConfig.data.name = '';
|
||||
gridOptions.formConfig.data.code = '';
|
||||
gridOptions.formConfig.data.create_time = 0;
|
||||
gridOptions.formConfig.data.end_time = 0;
|
||||
}"
|
||||
>重置
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<template #driver_id="{ row }">
|
||||
{{ row.driver_name }}
|
||||
</template>
|
||||
<template #is_outsourcing="{ row }">
|
||||
<a-tag color="green" v-if="row.is_outsourcing === 1">
|
||||
委外出车
|
||||
</a-tag>
|
||||
<a-tag color="blue" v-if="row.is_need_outbound === 1">
|
||||
正常出车
|
||||
</a-tag>
|
||||
</template>
|
||||
|
||||
<template #is_change_tire="{ row }">
|
||||
<a-tag color="green" v-if="row.is_change_tire === 0">
|
||||
无
|
||||
</a-tag>
|
||||
<a-tag color="red" v-else>
|
||||
是
|
||||
</a-tag>
|
||||
</template>
|
||||
|
||||
<template #is_repair="{ row }">
|
||||
<a-tag color="green" v-if="row.is_repair === 0">
|
||||
无
|
||||
</a-tag>
|
||||
<a-tag color="red" v-else>
|
||||
是
|
||||
</a-tag>
|
||||
</template>
|
||||
|
||||
<template #is_oil="{ row }">
|
||||
<a-tag color="green" v-if="row.is_oil === 0">
|
||||
无
|
||||
</a-tag>
|
||||
<a-tag color="red" v-else>
|
||||
是
|
||||
</a-tag>
|
||||
</template>
|
||||
<template #empty>
|
||||
<a-empty/>
|
||||
</template>
|
||||
</vxe-grid>
|
||||
</template>
|
||||
<script>
|
||||
import ListMixin from "@/application/zk/mixins/ListComponents.js";
|
||||
|
||||
|
||||
export default {
|
||||
mixins: [ListMixin],
|
||||
props: {
|
||||
Columns: {
|
||||
type: Array
|
||||
},
|
||||
FormConfig: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
data: {
|
||||
name: '',
|
||||
code: '',
|
||||
create_time: 0
|
||||
},
|
||||
// items: [
|
||||
// {
|
||||
// field: 'name',
|
||||
// title: '名称',
|
||||
// slots: {default: 'name_item'} // 自定义插槽
|
||||
// },
|
||||
// {
|
||||
// field: 'code',
|
||||
// title: '编码',
|
||||
// slots: {default: 'code_item'} // 自定义插槽
|
||||
// },
|
||||
// {
|
||||
// field: 'create_time',
|
||||
// title: '时间',
|
||||
// slots: {default: 'create_time_item'} // 自定义插槽
|
||||
// },
|
||||
// {slots: {default: 'operate_item'}}
|
||||
// ]
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
DeleteIds: [], // 删除的id
|
||||
gridOptions: { // 表格配置
|
||||
resizable: true, // 是否允许拖动列宽调整大小
|
||||
border: true, // 是否带有纵向边框
|
||||
showOverflow: true, // 当内容过长时显示为省略号
|
||||
loading: false, // 是否显示加载中
|
||||
minHeight: '600', // 最小高度
|
||||
maxHeight: '1200', // 最大高度
|
||||
// 间隔条纹
|
||||
stripe: true,
|
||||
exportConfig: { // 导出配置
|
||||
|
||||
},
|
||||
|
||||
pagerConfig: {// 分页配置
|
||||
total: 0, // 总条数
|
||||
currentPage: this.ListUrlData.page, // 当前页
|
||||
pageSize: this.ListUrlData.limit, // 默认每页显示条数
|
||||
pageSizes: [10, 20, 30, 50, 100, 500, 1000, 2000] // 每页显示条数选项
|
||||
},
|
||||
checkboxConfig: { // 复选框配置
|
||||
// 设置复选框支持分页勾选,需要设置 rowId 行数据主键
|
||||
reserve: true,
|
||||
// 点击行选中复选框
|
||||
trigger: 'row',
|
||||
highlight: true
|
||||
},
|
||||
formConfig: this.FormConfig, // 表单配置
|
||||
toolbarConfig: { // 工具栏配置
|
||||
export: true, // 是否显示导出按钮
|
||||
custom: true, // 是否显示自定义列按钮
|
||||
slots: {
|
||||
buttons: 'toolbar_buttons' // 自定义插槽
|
||||
}
|
||||
},
|
||||
columns: this.Columns, // 表格列配置
|
||||
data: []
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 初始化列表数据
|
||||
this.initListData()
|
||||
},
|
||||
methods: {
|
||||
|
||||
// 初始化列表数据
|
||||
initListData() {
|
||||
this.ListUrlData.order_bys = []
|
||||
this.ListUrlData.order_bys.push({
|
||||
column: "create_time",
|
||||
order: "desc"
|
||||
})
|
||||
this.ListUrlData.search_rules = [];
|
||||
if (this.gridOptions.formConfig.data.name !== '') {
|
||||
this.ListUrlData.search_rules.push(
|
||||
{
|
||||
column: "name",
|
||||
mode: "like",
|
||||
value: this.gridOptions.formConfig.data.name
|
||||
}
|
||||
)
|
||||
}
|
||||
if (this.gridOptions.formConfig.data.code !== '') {
|
||||
this.ListUrlData.search_rules.push(
|
||||
{
|
||||
column: "code",
|
||||
mode: "like",
|
||||
value: this.gridOptions.formConfig.data.code
|
||||
}
|
||||
)
|
||||
}
|
||||
this.$zk.getPagedData({
|
||||
url: this.ListUrl,
|
||||
listFieldName: this.ListFieldName,
|
||||
data: this.ListUrlData,
|
||||
loading: "加载中...",
|
||||
config: {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
}).then(a => {
|
||||
if (a.total === 0) {
|
||||
this.gridOptions.pagerConfig.currentPage = this.ListUrlData.page;
|
||||
this.gridOptions.pagerConfig.pageSize = this.ListUrlData.limit;
|
||||
this.gridOptions.pagerConfig.total = a.total;
|
||||
this.gridOptions.data = a[this.ListFieldName];
|
||||
return
|
||||
}
|
||||
this.gridOptions.data = a[this.ListFieldName];
|
||||
// this.list中的id字段转换为字符串
|
||||
this.gridOptions.data.forEach(item => {
|
||||
item.id = item.id.toString();
|
||||
});
|
||||
this.gridOptions.pagerConfig.currentPage = this.ListUrlData.page;
|
||||
this.gridOptions.pagerConfig.pageSize = this.ListUrlData.limit;
|
||||
this.gridOptions.pagerConfig.total = a.total;
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.msg);
|
||||
});
|
||||
},
|
||||
|
||||
// 删除
|
||||
pageDelete: function (row) {
|
||||
let ids = [];
|
||||
if (row) {
|
||||
ids.push(row.id);
|
||||
}
|
||||
this.$refs.xGrid.getCheckboxRecords().forEach(item => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
console.log(ids);
|
||||
if (!ids.length) { // 如果没有选中行
|
||||
this.$mk.error("请选择行"); // 提示
|
||||
return;
|
||||
}
|
||||
this.$mk.confirm('您确定要删除吗?').then(type => { // 确认删除
|
||||
if (type === 'confirm') { // 如果确认删除
|
||||
this.DeleteUrlData.ids = ids;
|
||||
this.Delete()
|
||||
this.$message.success("删除成功")
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
// 分页
|
||||
handlePageChange({currentPage, pageSize}) {
|
||||
this.ListUrlData.page = currentPage
|
||||
this.ListUrlData.limit = pageSize
|
||||
this.initListData()
|
||||
},
|
||||
// 时间选择
|
||||
onChangeCreatTime(date, dateString) {
|
||||
console.log("dateString:", dateString)
|
||||
if (dateString[0] === '' && dateString[1] === '') {
|
||||
this.ListUrlData.start_time = 0;
|
||||
this.ListUrlData.end_time = 0;
|
||||
this.initListData()
|
||||
} else {
|
||||
this.ListUrlData.start_time = dateString[0];
|
||||
this.ListUrlData.end_time = dateString[1];
|
||||
this.initListData()
|
||||
}
|
||||
},
|
||||
// 新增
|
||||
Add() {
|
||||
this.$openPage(this.CreateRouter);
|
||||
},
|
||||
// 编辑
|
||||
pageEdit(row) {
|
||||
console.log(row)
|
||||
if (!row) { // 如果没有选中行
|
||||
this.$mk.msg("请选择行"); // 提示
|
||||
return; // 返回
|
||||
}
|
||||
this.$openPage(this.UpdateRouter + "/" + row.id); // 打开页面
|
||||
},
|
||||
// 详情
|
||||
pageDetail(row) {
|
||||
console.log(row)
|
||||
if (!row) { // 如果没有选中行
|
||||
this.$mk.msg("请选择行"); // 提示
|
||||
return; // 返回
|
||||
}
|
||||
this.$mk.dialog.open({
|
||||
height: 800,
|
||||
width: 1200,
|
||||
page: () => import(this.DetailVueComponent),
|
||||
title: "详情",
|
||||
dataId: row.id,
|
||||
pageOptions: {
|
||||
ApiUrl: this.DetailUrl,
|
||||
ApiData: this.DetailUrlData,
|
||||
FieldName: this.DetailFieldName,
|
||||
title: "详情",
|
||||
},
|
||||
callback: ({success}) => {
|
||||
success && this.initListData(); // 如果成功,初始化列表数据
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
.ant-btn {
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue