Merge branch 'main' of https://git.positivepole.cn/Mes/middle-admin-ant
# Conflicts: # src/pages/Middle/Mes/MesStaff/MesStaff/Edit.vue
This commit is contained in:
commit
cf0fd156b1
|
|
@ -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: [
|
||||
|
||||
// ]
|
||||
// },
|
||||
|
||||
|
||||
|
||||
|
|
@ -231,7 +235,7 @@ export default {
|
|||
},
|
||||
// 新增模式表单项
|
||||
addModeItems: [
|
||||
|
||||
|
||||
],
|
||||
|
||||
|
||||
|
|
@ -289,7 +293,7 @@ export default {
|
|||
|
||||
this.$forceUpdate()
|
||||
} else {
|
||||
|
||||
console.log( this.addModeItems)
|
||||
// 如果没有id参数,说明是新增模式
|
||||
this.addModeItems.forEach(item => {
|
||||
this.pageOptions.formOptions.items.push(item);
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -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: { // 按钮列
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
// 如果是编辑模式
|
||||
|
|
|
|||
Loading…
Reference in New Issue