This commit is contained in:
ljx 2024-04-27 23:11:03 +08:00
parent 349cb5b8dc
commit a680cd72d0
5 changed files with 653 additions and 9 deletions

View File

@ -80,7 +80,31 @@
</div> </div>
</li> </li>
</div> </div>
<!-- 销售记录 -->
<div class="sale-list" style="margin-top: 20px">
<h2>销售记录</h2>
<!-- 搜索区 -->
<vxe-form :data="searchFormData" :items="searchFormItems" titleColon @submit="onSearch">
<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>
<!-- 表格区 -->
<div class="gridPanel">
<vxe-grid ref='xGrid' v-bind="gridOptions">
<!-- =============================== 表格列 自动生成 Start =============================== -->
<template #status="{ row }"><!-- 这里是自定义列 -->
{{ row.status == 1 ? '正常' : '禁用'}}
</template>
</vxe-grid>
</div>
<!-- 表格 -->
</div>
<!-- 结余日志列表 --> <!-- 结余日志列表 -->
<div class="balance-log"> <div class="balance-log">
<h2> <h2>
@ -125,14 +149,15 @@ export default {
}, },
data() { data() {
return { const listFieldName = 'train_number';
var pageData = {
BalanceAdd: `${BASE_URL.BASE_URL}/Custom/v1/balance/add`, // BalanceAdd: `${BASE_URL.BASE_URL}/Custom/v1/balance/add`, //
BalanceReduce: `${BASE_URL.BASE_URL}/Custom/v1/balance/reduce`, // BalanceLogList: `${BASE_URL.BASE_URL}/Custom/v1/balance/log/list`, // BalanceReduce: `${BASE_URL.BASE_URL}/Custom/v1/balance/reduce`, // BalanceLogList: `${BASE_URL.BASE_URL}/Custom/v1/balance/log/list`, //
BalanceLogSearch: `${BASE_URL.BASE_URL}/Custom/v1/balance/log/search`, // BalanceLogSearch: `${BASE_URL.BASE_URL}/Custom/v1/balance/log/search`, //
BalanceLogDetail: `${BASE_URL.BASE_URL}/Custom/v1/balance/log/detail`, // BalanceLogDetail: `${BASE_URL.BASE_URL}/Custom/v1/balance/log/detail`, //
BalanceLogDelete: `${BASE_URL.BASE_URL}/Custom/v1/balance/log/detele`, // BalanceLogDelete: `${BASE_URL.BASE_URL}/Custom/v1/balance/log/detele`, //
BalanceLogBatchDelete: `${BASE_URL.BASE_URL}/Custom/v1/balance/log/batchDelete`, // BalanceLogBatchDelete: `${BASE_URL.BASE_URL}/Custom/v1/balance/log/batchDelete`, //
getTradeLIst:`${BASE_URL.BASE_URL}/Custom/v1/custom/trade/list`,
zkSelectData: { zkSelectData: {
page: 1, page: 1,
end_time: 0, end_time: 0,
@ -175,7 +200,118 @@ export default {
data: { data: {
}, },
start_time: 0, //
end_time: 0, //
//
searchFormData: {},
searchFormItems: [ //
{span: 8, slots: {default: 'date'}}, //
{
align: 'right', span: 8, itemRender: { //
name: '$buttons', children: [{props: {type: 'submit', content: '搜索', status: 'primary'}}, //
{props: {type: 'reset', content: '重置'}},
{props: {type: 'reset', content: '打印'}}
]
}
}
],
//
gridOptions: { //
height: '100%', // 100%
stripe: true, //
id: 'datagrid_1', //
//
proxyConfig: { //
sort: true, // query
filter: true, // query
props: {
result: listFieldName, //
total: 'total' //
},
// Promise
ajax: {
// queryreload
query: (options) => { // options
const {page,sorts} = options; //
var params = {}; //
params.page = page.currentPage; //
params.limit = page.pageSize; //
params.order_bys = []; //
params.search_rules = this.getSearchParms(); //
if (sorts) { //
sorts.forEach((v) => { //
params.order_bys.push({ //
column: v.property, //
order: v.order //
})
});
}
return this.loadData({params}); //
}
}
},
//
columns: [
{ type: 'checkbox', width: 50 }, //
{ type: 'seq', width: 40 }, //
// =============================== Start ===============================
{ field: 'code', align: 'center', sortable: true, title: '车次单号', width: 120 }, //
{
field: 'truck_id', align: 'center', sortable: true, title: '车辆', width: 150,
slots: { default: 'truck_id' }
}, // id
{
field: 'driver_id', align: 'center', sortable: true, title: '司机', width: 150,
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: 'outbound_date', align: 'center', sortable: true, formatter: 'formatDate', title: '出车日期', width: 100 }, //
{ field: 'return_date', align: 'center', sortable: true, formatter: 'formatDate', title: '回车日期', width: 100 }, //
{
field: 'is_oil', align: 'center', sortable: true, title: '加油', width: 70,
slots: { default: 'is_oil' }
}, //
// {
// field: 'create_time',
// formatter: 'formatDate',
// width: 100,
// sortable: true,
// title: '',
// showHeaderOverflow: true
// }, //
{ 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',
}, //
]
}
} }
pageData.gridOptions = Object.assign({}, this.$mk.config.defaults.gridOptions, pageData.gridOptions); //
return pageData;
}, },
created() { created() {
this.initDetailData(); this.initDetailData();
@ -240,7 +376,54 @@ export default {
reduceBalance() { reduceBalance() {
this.reduceBalanceApi(); this.reduceBalanceApi();
}, },
//
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; //
}
},
//
onSearch() {
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; //
},
//
loadData({params}) {
params.id = Number(this.dataId); //
params.last_time = Number(params.last_time)
params.start_time = this.start_time; //
params.end_time = this.end_time; //
return this.$mk.getPagedData({url: this.getTradeLIst, data: params}); //
},
addBalanceApi() { addBalanceApi() {
// this.amount // this.amount
this.amount = Number(this.amount); this.amount = Number(this.amount);

View File

@ -58,6 +58,9 @@
<a-button @click="grant(row)" v-if="row.wages_status === 0" type="primary">发放工资</a-button> <a-button @click="grant(row)" v-if="row.wages_status === 0" type="primary">发放工资</a-button>
</div> </div>
</template> </template>
<template #bottom>
<div class="bottom-box">总计工资{{ total_wages }}</div>
</template>
</vxe-grid> </vxe-grid>
</div> </div>
@ -125,7 +128,7 @@ export default {
keyName: 'id', // keyName: 'id', //
total_wages:0, //
// //
actions: { // Api actions: { // Api
// =============================== Start =============================== // =============================== Start ===============================
@ -206,7 +209,8 @@ export default {
filter: true, // query filter: true, // query
props: { props: {
result: listFieldName, // result: listFieldName, //
total: 'total' // total: 'total', //
total_wages:'total_wages', //
}, },
// Promise // Promise
ajax: { ajax: {
@ -360,6 +364,9 @@ export default {
loadData({ params }) { loadData({ params }) {
params.start_time = this.start_time; // params.start_time = this.start_time; //
params.end_time = this.end_time; // params.end_time = this.end_time; //
this.$mk.post({ url: this.actions.getList, data: params }).then(res=>{
this.total_wages = res.data.total_wages;
})
return this.$mk.getPagedData({ url: this.actions.getList, data: params }); // return this.$mk.getPagedData({ url: this.actions.getList, data: params }); //
}, },
@ -469,8 +476,8 @@ export default {
} }
}); });
}, },
// //
StaffhandleChange(value) { StaffhandleChange(value) {
this.$data.searchFormData.staff_uid = value.id; this.$data.searchFormData.staff_uid = value.id;
console.log("this.$data.searchFormData.driver_id:",this.$data.searchFormData.staff_uid); console.log("this.$data.searchFormData.driver_id:",this.$data.searchFormData.staff_uid);
@ -498,10 +505,15 @@ export default {
} }
</style> </style>
<style> <style scoped>
.oplinks svg { .oplinks svg {
width: 22px; width: 22px;
height: 22px; height: 22px;
margin: 0 5px 0 0; margin: 0 5px 0 0;
} }
.bottom-box{
font-size: 25px;
font-weight: bold;
/* text-align: center; */
}
</style> </style>

View File

@ -0,0 +1,449 @@
<template>
<div class="page-body">
<a-row type="flex">
<a-col :flex="$mk.config.ui.searchFlex">
<!-- 搜索区 -->
<vxe-form :data="searchFormData" :items="searchFormItems" titleColon @submit="onSearch">
<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>
</a-col>
<a-col :flex="$mk.config.ui.toolbarFlex">
<!-- 工具条 -->
<mk-toolbar :isShowLog="false" :isShowSetting="false" :isShowAdd="false" @toolbarClick="toolbarClick"></mk-toolbar>
</a-col>
</a-row>
<!-- 表格区 -->
<div class="gridPanel">
<vxe-grid ref='xGrid' :export-config="{}" v-bind="gridOptions">
<!-- =============================== 表格列 自动生成 Start =============================== -->
<!-- =============================== 表格列 自动生成 End =============================== -->
<template #wages_status="{ row }">
<a-tag color="orange" v-if="row.wages_status === 0">
未发放
</a-tag>
<a-tag color="green" v-if="row.wages_status === 1">
已发放
</a-tag>
</template>
<template #op="{ row }">
<div class="oplinks">
<a-button @click="grant(row)" v-if="row.wages_status === 0" type="primary">发放工资</a-button>
</div>
</template>
<template #bottom>
</template>
</vxe-grid>
</div>
</div>
</template>
<script>
import BASE_URL from '@/services/Middle/transport/DriverWages/api.js';
import ZkSelectSearch from '@/components/zk/zkSelectSearch.vue';
export default {
name: 'DriverWagesList',
i18n: require('./i18n'), //
components: { ZkSelectSearch },
props: {
pageMode: {
type: String,
default: "edit"
}
},
data() {
const listFieldName = 'mes_staff_wages_total';
const year=[
{label: '2024', value: 2024},
{label: '2025', value: 2025},
{label: '2026', value: 2026},
{label: '2027', value: 2027},
]
const month=[
{label: '1月', value: 1},
{label: '2月', value: 2},
{label: '3月', value: 3},
{label: '4月', value: 4},
{label: '5月', value: 5},
{label: '6月', value: 6},
{label: '7月', value: 7},
{label: '8月', value: 8},
{label: '9月', value: 9},
{label: '10月', value: 10},
{label: '11月', value: 11},
{label: '12月', value: 12},
]
//
var pageData = { //
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'],
},
keyName: 'id', //
//
actions: { // Api
// =============================== Start ===============================
DriverWagesTotal: `${BASE_URL.BASE_URL}/DriverWages/v1/driver/wages/total`, //
DriverWagesPay: `${BASE_URL.BASE_URL}/DriverWages/v1/driver/wages/pay`
// =============================== End ===============================
},
start_time: 0, //
end_time: 0, //
//
searchFormData: {
wages_year:'',
wages_month: '',
staff_uid: '',
},
//
searchRules: [
{ key: "wages_year", mode: "=" },
{ key: "wages_month", mode: "=" },
{ key: "staff_uid", mode: "=" }
],
//
searchFormItems: [ //
{field: 'wages_year', title: '年份', span: 3, itemRender: {name: '$select',props: { options: year,placeholder: '请选择年份' }}},
{field: 'wages_month', title: '月份', span: 3, itemRender: {name: '$select',props: { options: month,placeholder: '请选择月份' }}},
{
field: 'staff_uid',
title: '司机',
span: 4,
slots: { default: 'driver_id' }
},
{ span: 8, slots: { default: 'date' } }, //
{
align: 'right', span: 6, itemRender: { //
name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, //
{ props: { type: 'reset', content: '重置' } },
{ props: { type: 'reset', content: '打印' } }
]
}
}
],
//
gridOptions: { //
export: true,
exportConfig: { //
},
height: '100%', // 100%
stripe: true, //
id: 'datagrid_1', //
//
proxyConfig: { //
sort: true, // query
filter: true, // query
props: {
result: listFieldName, //
total: 'total', //
},
// Promise
ajax: {
// queryreload
query: (options) => { // options
const { page, sorts } = options; //
var params = {}; //
params.page = page.currentPage; //
params.limit = page.pageSize; //
params.order_bys = []; //
params.search_rules = this.getSearchParms(); //
if (sorts) { //
sorts.forEach((v) => { //
params.order_bys.push({ //
column: v.property, //
order: v.order //
})
});
}
return this.loadData({ params }); //
}
}
},
//
columns: [
{ type: 'checkbox', width: 50 }, //
{ type: 'seq', width: 30 }, //
// =============================== Start ===============================
// { field: "mes_staff['wages_year']", sortable: true, title: '', width: 80 }, //
// { field: 'wages_month', sortable: true, title: '', width: 70 }, //
{ field: 'staff_name', sortable: true, title: '司机姓名', width: 120 }, //
{ field: 'staff_code', sortable: true, title: '司机编号', width: 120 }, //
{ field: 'staff_phone', sortable: true, title: '司机手机', width: 120 }, //
{ field: 'total', sortable: true, title: '总工资', width: 100 }, //
{
field: 'wages_status', sortable: true, title: '状态', width: 120,
slots: { default: 'wages_status' }
}, //
{ field: 'wages_date', sortable: true, title: '日期', formatter: 'formatDate', width: 120 }, //
// { field: 'wages_balance', sortable: true, title: '', width: 120 }, //
{ field: 'wages_remark', sortable: true, title: '备注', width: 250 }, //
]
}
};
pageData.actions.getList = pageData.actions.DriverWagesTotal;
pageData.gridOptions = Object.assign({}, this.$mk.config.defaults.gridOptions, pageData.gridOptions); //
return pageData; //
},
//
computed: {
//
// desc() {
// return this.$t('pageDesc')
// }
},
//
created() {
this.$nextTick(() => { // DOM
//
this.$refs.xGrid.connect(this.$refs.xToolbar) //
});
},
//
activated() {
this.onSearch();
//
},
//
onLoad() {
},
//
methods: {
// =============================== status Start ===============================
// =============================== status End ===============================
//
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; //
}
},
//
getSearchParms() { //
var rules = []; //
let findMode = k => { //
for (let i in this.searchRules) { //
if (this.searchRules[i].key == k) return this.searchRules[i].mode; //
}
return "equal"; //
};
for (let key in this.searchFormData) { //
let value = this.searchFormData[key]; //
if (value) { //
let mode = findMode(key); //
if (mode == "like") { //
value = "%" + value + "%"; // %
}
// value
if (typeof value == "number") {
value = value.toString();
}
rules.push({ //
column: key, //
mode: mode, //
value: value //
});
}
}
return rules; //
},
//
getSelectdRow() { //
let row = this.$refs.xGrid.getCurrentRecord(); //
if (!row) { //
let rows = this.$refs.xGrid.getCheckboxRecords(); //
if (rows && rows.length) {
row = rows[0];
} //
}
return row; //
},
//
loadData({ params }) {
params.start_time = this.start_time; //
params.end_time = this.end_time; //
return this.$mk.getPagedData({ url: this.actions.getList, data: params }); //
},
// add / log / setting
toolbarClick(e) {
if (e.name == "add") { //
this.$openPage("/DriverWages/DriverWagesCreate"); //
}
},
//
pageEdit(row) {
if (!row) { //
this.$mk.msg("请选择行"); //
return; //
}
this.$openPage("/DriverWages/DriverWagesUpdate/" + row[this.keyName]); //
},
//
pageDelete(row) {
let rows = row ? [row] : this.$refs.xGrid.getCheckboxRecords(); //
let ids = []; // id
rows.forEach((row) => { //
ids.push(row[this.keyName]); // idid
});
if (!ids.length) { //
this.$mk.error("请选择行"); //
return;
}
this.$mk.confirm('您确定要删除吗?').then(type => { //
if (type == 'confirm') { //
this.$mk.post({
url: this.actions.delete, //
loading: "删除中...", //
data: {
ids: ids // id
},
useBigInt: true
}).then(() => { //
this.$mk.success("删除成功"); //
this.onSearch(); //
}).catch((a) => { //
this.$mk.error(a.data.msg); //
});
}
});
},
//
onSearch() {
this.$refs.xGrid.commitProxy('query') //
},
//
grant(row){
console.log("row",row);
let ids = [row.id]; // id
this.$mk.confirm('您确定要发放吗?').then(type => { //
if (type == 'confirm') { //
this.$mk.post({
url: this.actions.DriverWagesPay, //
loading: "发放中...", //
data: {
ids: ids // id
},
useBigInt: true
}).then(() => { //
this.$mk.success("发放成功"); //
this.onSearch(); //
}).catch((a) => { //
this.$mk.error(a.data.msg); //
});
}
});
},
//
StaffhandleChange(value) {
this.$data.searchFormData.staff_uid = value.id;
console.log("this.$data.searchFormData.driver_id:",this.$data.searchFormData.staff_uid);
this.$refs.xGrid.commitProxy('query') //
},
},
//
watch: {}
};
</script>
<style scoped lang="less">
.page-body {
padding: 30px;
background: @base-bg-color;
}
.gridPanel {
height: calc(100vh - 400px);
}
.btns{
margin-left:10px;
}
</style>
<style scoped>
.oplinks svg {
width: 22px;
height: 22px;
margin: 0 5px 0 0;
}
.bottom-box{
font-size: 25px;
font-weight: bold;
/* text-align: center; */
}
</style>

View File

@ -296,7 +296,7 @@ export default {
// {field: 'unit_price', sortable: true, title: '', width: 120}, // // {field: 'unit_price', sortable: true, title: '', width: 120}, //
// {field: 'total_price', sortable: true, title: '', width: 120}, // // {field: 'total_price', sortable: true, title: '', width: 120}, //
{ {
field: 'is_outsourcing', align: 'center', sortable: true, title: '类型', width: 80, field: 'is_outsourcing', align: 'center', sortable: true, title: '是否委外', width: 80,
slots: { default: 'is_outsourcing' } slots: { default: 'is_outsourcing' }
}, // }, //
// {field: 'is_need_outbound', sortable: true, title: '', width: 70}, // // {field: 'is_need_outbound', sortable: true, title: '', width: 70}, //

View File

@ -70,7 +70,7 @@ const DriverWagesRouterMap = {
icon: 'idcard', icon: 'idcard',
path: '/DriverWages/DriverWagesTotal', path: '/DriverWages/DriverWagesTotal',
meta: { meta: {
invisible: true, // 不在菜单中显示 invisible: false, // 不在菜单中显示
}, },
component: () => import('@/pages/Middle/transport/DriverWages/DriverWages/Total'), component: () => import('@/pages/Middle/transport/DriverWages/DriverWages/Total'),
authority: { authority: {