# Conflicts:
#	src/pages/Middle/Mes/MesStaff/MesStaff/Edit.vue
This commit is contained in:
zxx 2024-03-26 16:56:46 +08:00
commit cf0fd156b1
4 changed files with 323 additions and 30 deletions

View File

@ -172,15 +172,10 @@ export default {
//
items: [
// =============================== Start ===============================
{field:'',title:'',span:24,isTitle:true,Htitle:'员工信息',itemRender:{}},//线
{ field: 'name', title: '员工姓名', span: 12, itemRender: { name: '$input' } },
{ field: 'code', title: '员工工号', span: 12, itemRender: { name: '$input' } },
{
title: '左侧',
span: 19,
children: [
{ field: 'name', title: '员工姓名', span: 12, itemRender: { name: '$input' } },
{ field: 'code', title: '员工工号', span: 12, itemRender: { name: '$input' } },
{
title: '部门', span: 12,
field: 'base_department',
dataRule: {
@ -212,17 +207,26 @@ export default {
{ field: 'is_piecework', title: '是否计件', span: 12, itemRender: { name: '$select', props: { options: settings.options_yesorno } } },
{ field: 'status', title: '状态', span: 12, itemRender: { name: '$select', props: { options: settings.options_status_staff } } },
{ field: 'avatar',title: '头像', span: 12, itemRender: { name: 'MkFormCropper' } },
{ field: 'remark', title: '备注', span: 24, itemRender: { name: '$input' } },
]
},
{
title: '右侧',
span: 5,
children: [
{ field: 'avatar', span: 12, itemRender: { name: 'MkFormCropper' } },
]
},
// {
// title: '',
// span: 19,
// children: [
// ]
// },
// {
// title: '',
// span: 5,
// children: [
// ]
// },
@ -289,7 +293,7 @@ export default {
this.$forceUpdate()
} else {
console.log( this.addModeItems)
// id
this.addModeItems.forEach(item => {
this.pageOptions.formOptions.items.push(item);

View File

@ -0,0 +1,293 @@
<template>
<div class="detail">
<!-- <div class="header">-->
<!-- <h1>详情</h1>-->
<!-- </div>-->
<a-descriptions size="small" :title="pageOptions.title" bordered>
<a-descriptions-item label="编码">
{{ data.code }}
</a-descriptions-item>
<a-descriptions-item label="名称">
{{ data.name }}
</a-descriptions-item>
<a-descriptions-item label="类型">
{{ data.type }}
</a-descriptions-item>
<a-descriptions-item label="行业">
{{ data.industry }}
</a-descriptions-item>
<a-descriptions-item label="联系人">
{{ data.contact }}
</a-descriptions-item>
<a-descriptions-item label="联系人电话">
{{ data.contact_phone }}
</a-descriptions-item>
<a-descriptions-item label="总计交易吨数">
{{ data.total_ton }}
</a-descriptions-item>
<a-descriptions-item label="总计交易次数">
{{ data.total_count }}
</a-descriptions-item>
<a-descriptions-item label="最后交易时间">
{{ data.last_time }}
</a-descriptions-item>
<a-descriptions-item label="总结余">
{{ data.total_balance }}
</a-descriptions-item>
<a-descriptions-item label="总交易金额">
{{ data.total_amount }}
</a-descriptions-item>
<a-descriptions-item label="状态">
{{ data.status | formatStatus }}
</a-descriptions-item>
<a-descriptions-item label="创建时间">
{{ data.create_time | formatDate }}
</a-descriptions-item>
<a-descriptions-item label="备注">
{{ data.remark }}
</a-descriptions-item>
</a-descriptions>
<div class="amount">
<h3>
修改结余
</h3>
<li>
<span>操作金额</span>
<a-input id="inputNumber" style="width: 200px;margin-right: 10px;" prefix="¥" suffix="RMB" v-model="amount"
:min="1" :max="1000000000" placeholder="请输入要操作的金额" />
</li>
<li>
<span>操作备注</span>
<a-textarea v-model="remark" placeholder="请输入要操作的备注" :auto-size="{ minRows: 3, maxRows: 5 }"
style="width: 200px;margin-right: 10px;" />
</li>
<li>
<div class="btns">
<!-- 增加结余按钮 -->
<a-popconfirm title="是否增加结余?" ok-text="确认" cancel-text="取消" @confirm="addBalance" @cancel="cancel">
<a-button class="btn-add-balance" type="primary">增加结余</a-button>
</a-popconfirm>
<!-- 减少结余按钮 -->
<a-popconfirm title="是否减少结余?" ok-text="确认" cancel-text="取消" @confirm="reduceBalance" @cancel="cancel">
<a-button class="btn-reduce-balance" type="primary"> 减少结余</a-button>
</a-popconfirm>
</div>
</li>
</div>
</div>
</template>
<script>
import BASE_URL from '@/services/Middle/transport/Custom/api.js';
// import ZkTable from "@/components/zk/zkTable.vue";
export default {
components: {
// ZkTable
},
props: {
dataId: {
},
pageOptions: {
type: Object
},
ApiUrl: {
type: String
},
ApiData: {
type: Object
},
},
data() {
return {
BalanceAdd: `${BASE_URL.BASE_URL}/Custom/v1/balance/add`, //
BalanceReduce: `${BASE_URL.BASE_URL}/Custom/v1/balance/reduce`, //
amount: 0,
remark: "",
data: {
},
}
},
created() {
this.initDetailData();
},
filters: {
formatDate: function (value) {
if (value) {
//
return new Date(value).toLocaleString().replace(/:\d{1,2}$/, ' ');
} else {
return "";
}
},
//
formatStatus: function (value) {
if (value === 1) {
return "正常";
// return "success";
} else if (value === 0) {
return "停用";
// return "error";
} else {
return "未知";
// return "warning";
}
},
},
methods: {
initDetailData() {
console.log("this.pageOptions.FieldName:", this.pageOptions.FieldName)
console.log("this.pageOptions.ApiUrl:", this.pageOptions.ApiUrl);
console.log("this.pageOptions.ApiData:", this.pageOptions.ApiData);
// this.dataId bigint
// this.dataId
this.$zk.post({
url: this.pageOptions.ApiUrl,
data: this.pageOptions.ApiData,
loading: "加载中...",
useBigInt: true,
config: {
headers: {
'Content-Type': 'application/json'
}
}
}).then(a => {
console.log("a", a)
console.log("this.pageOptions.ApiUrl", this.pageOptions.ApiUrl)
this.data = a.data[this.pageOptions.FieldName];
}).catch((a) => {
this.$mk.error(a.msg, "aaa");
});
},
addBalance() {
this.addBalanceApi();
},
reduceBalance() {
this.reduceBalanceApi();
},
addBalanceApi() {
// this.amount
this.amount = Number(this.amount);
if (this.amount <= 0) {
this.$mk.error("请输入正确的金额");
return
}
//
this.$zk.post({
url: this.BalanceAdd,
data: {
id: this.pageOptions.ApiData.id,
amount: this.amount,
remark: this.remark
},
loading: "加载中...",
useBigInt: true,
config: {
headers: {
'Content-Type': 'application/json'
}
}
}).then(a => {
console.log("a", a);
//
this.$mk.success("增加结余成功");
//
this.initDetailData() //
}).catch((a) => {
this.$mk.error(a.msg, "aaa");
});
},
reduceBalanceApi() {
// this.amount
this.amount = Number(this.amount);
if (this.amount <= 0) {
this.$mk.error("请输入正确的金额");
return
}
//
this.$zk.post({
url: this.BalanceReduce,
data: {
id: this.pageOptions.ApiData.id,
amount: this.amount,
remark: this.remark
},
loading: "加载中...",
useBigInt: true,
config: {
headers: {
'Content-Type': 'application/json'
}
}
}).then(a => {
console.log("a", a);
//
this.$mk.success("减少结余成功");
//
this.initDetailData() //
}).catch((a) => {
this.$mk.error(a.msg, "aaa");
});
},
cancel() {
console.log('cancel');
},
confirm() {
console.log('confirm');
}
},
}
</script>
<style scoped lang="less">
.detail {
margin: 10px;
}
.btns {
margin-top: 10px;
.btn-add-balance {}
.btn-reduce-balance {
margin-left: 10px;
}
}
.amount {
margin-top: 10px;
li {
margin-top: 10px;
list-style: none;
span {
display: inline-block;
width: 80px;
}
}
}
</style>

View File

@ -114,13 +114,13 @@ export default {
},
//
searchRules: [
{key: "title", mode: "like"},
{key: "desc", mode: "like"}
{key: "code", mode: "like"},
{key: "name", mode: "like"}
],
//
searchFormItems: [ //
{field: 'title', title: '标题', span: 5, itemRender: {name: '$input', props: {placeholder: '请输入标题'}}},
{field: 'desc', title: '描述', span: 5, itemRender: {name: '$input', props: {placeholder: '请输入描述'}}},
{field: 'code', title: '编码', span: 5, itemRender: {name: '$input', props: {placeholder: '请输入描述'}}},
{field: 'name', title: '品名', span: 5, itemRender: {name: '$input', props: {placeholder: '请输入标题'}}},
{span: 8, slots: {default: 'date'}}, //
{
align: 'right', span: 4, itemRender: { //

View File

@ -194,6 +194,7 @@ export default {
is_need_outbound: 0,
truck_name: "",
truck_id: 0,
driver_name:'',
driver_id: 0,
outbound_date: new Date(2100, 1, 1).getTime() / 10000,
return_date: new Date(2100, 1, 1).getTime() / 10000,
@ -386,11 +387,8 @@ export default {
}
}
}},
{ field: 'driver_id',title: '司机', span: 6,
dataRule: {
fromField: "id",
saveField: "driver_id"
},
{ field: 'driver_name',title: '司机', span: 6,
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
@ -716,9 +714,7 @@ export default {
this.formOptions.data.other_expenses_log.forEach(item => {
console.log(item)
item.other_expenses_amount = Number(item.other_expenses_amount)
console.log("item.driver_id",item.driver_id)
})
let postdata = Object.assign({}, this.formOptions.data);
//