Commit f24e7fec by 前端

平板

1 parent db74d73e
import request from "./request" /*
const path = "dj.api.smartcarlife.inspection.badge.management." * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-09-03 10:10:08
// 获取练习列表 * @LastEditors: 前端 qianduan01@didihu.com.cn
export function getList(data) { * @LastEditTime: 2024-12-20 16:56:27
data.method = `${path}page` * @FilePath: \dj-car-life-system\src\api\tablet.js
return request(data) * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
} */
// 获取车辆品牌 import request from "./request"
export function getBrandList(data = {}) { const path = "dj.api.smartcarlife.inspection.badge.management."
data.method = 'merchants.api.merchantCommon.getCarbrandTree'
return request(data) // 获取练习列表
} export function getList(data) {
// 新增 data.method = `${path}page`
export function addOrUpdate(data) { return request(data)
data.method = `${path}addOrUpdate` }
return request(data) // 获取车辆品牌
} export function getBrandList(data = {}) {
// 导出 data.method = "merchants.api.merchantCommon.getCarbrandTree"
export function exportTable(data) { return request(data)
data.method = `${path}page.export` }
return request(data) // 新增
} export function addOrUpdate(data) {
data.method = `${path}addOrUpdate`
return request(data)
}
// 查询平板资产修改记录
export function findAllRecord(data) {
data.method = `dj.api.smartcarlife.inspection.badge.management.findAllRecord`
return request(data)
}
<template> <template>
<el-dialog <el-dialog title="新增信息" :visible.sync="dialogVisible" width="50%" :before-close="handleClose">
title="新增信息"
:visible.sync="dialogVisible"
width="50%"
:before-close="handleClose"
>
<div class="dialog-body"> <div class="dialog-body">
<el-timeline> <el-timeline v-if="lineList.length">
<el-timeline-item timestamp="2018/4/12" placement="top" v-for="(line,index) in lineList"> <el-timeline-item :timestamp="line.disDate" placement="top" v-for="(line, index) in lineList" :key="index"">
<div class="card-box"> <div class="card-box">
<div class="card-item" v-for="(card,cardIndex) in line.cardList""> <div class="card-item" v-for="(card, cardIndex) in line.list"" :key="cardIndex">
<div class="card-content">运营{{ card }}</div> <div class=" card-content">运营{{ card.createdBy }}</div>
<div class="card-content">原保管人:</div> <div class="card-content">原保管人:{{ card.oldCustodian }}</div>
<div class="card-content"> <div class="card-content">
现保管人:&nbsp;&nbsp;&nbsp;&nbsp;派发时间: 现保管人:{{ card.newCustodian }}<span>派发时间:{{ line.disDate }}</span>
</div> </div>
<div class="card-content">备注:</div> <div class="card-content">备注:{{ card.remark }}</div>
<div class="card-btn"> <div class="card-btn">
变更 {{index == lineList.length-1&& cardIndex == line.list.length -1 ? '新增' : '变更'}}
</div>
</div> </div>
</div> </div>
</el-timeline-item> </div>
</el-timeline> </el-timeline-item>
</el-timeline>
<div class="empty-box" v-else>
<img src="@/assets/empty.png">
<div class="empty-text">暂无记录</div>
</div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button> <el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="dialogVisible = false">确 定</el-button> <el-button type="primary" @click="handleClose">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import { Util } from "@/common/util"
import { findAllRecord } from "@api/tablet"
export default { export default {
name: 'Timeline', name: 'Timeline',
props: { props: {
dialogVisible: { dialogVisible: {
type: Boolean, type: Boolean,
default: true default: true
} },
recordId: [Number, String]
}, },
data () { data() {
return { return {
lineList: [{ lineList: [{
time: '2020-10-02', time: '2020-10-02',
cardList: [1,2,3] cardList: [1, 2, 3]
},{ }, {
time: '2020-10-02', time: '2020-10-02',
cardList: [1,2,3] cardList: [1, 2, 3]
}] }]
} }
}, },
mounted () { watch: {
dialogVisible(val) {
if (val) {
this.findAllRecord()
}
}
},
mounted() {
}, },
methods: { methods: {
findAllRecord() {
findAllRecord({ id: this.recordId }).then((res) => {
const groupedByDisDate = res.reduce((acc, current) => {
current.disDate = Util.dateFormate(current.disDate, "YYYY-MM-DD")
if (!acc[current.disDate]) {
acc[current.disDate] = [];
}
acc[current.disDate].push(current);
return acc;
}, {});
const result = Object.values(groupedByDisDate);
console.log(result);
const resultWithListField = Object.keys(groupedByDisDate).map(disDate => ({
disDate: disDate,
list: groupedByDisDate[disDate]
}));
this.lineList = resultWithListField
})
},
handleClose() {
this.$emit('close')
}
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.dialog-body { .dialog-body {
height: calc(100vh - 400px); max-height: calc(100vh - 400px);
overflow-y: auto; overflow-y: auto;
.card-box { .card-box {
.card-item { .card-item {
width: 90%; width: 90%;
padding: 12px; padding: 12px;
opacity: 1; opacity: 1;
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
background: #ffffff6b; background: #ffffff6b;
margin-bottom: 8px; margin-bottom: 8px;
position: relative; position: relative;
.card-btn { .card-btn {
background: #e7eefe; background: #e7eefe;
line-height: 20px; line-height: 20px;
text-align: center; text-align: center;
position: absolute; position: absolute;
width: 40px; width: 40px;
height: 20px; height: 20px;
border-radius: 2px; border-radius: 2px;
opacity: 1; opacity: 1;
background: #e7eefe; background: #e7eefe;
color: #185efe; color: #185efe;
font-size: 12px; font-size: 12px;
right: 0px; right: 0px;
top: 0px; top: 0px;
} }
.card-content { .card-content {
color: #666666; color: #666666;
font-size: 12px; font-size: 12px;
line-height: 26px; line-height: 26px;
span {
margin-left: 20px;
}
} }
} }
} }
} }
.empty-box {
text-align: center;
img {
width: 64px;
height: 40px;
margin-top: 100px;
}
.empty-text {
color: #666666;
}
}
</style> </style>
...@@ -54,7 +54,10 @@ ...@@ -54,7 +54,10 @@
> >
<div slot="auth-button" slot-scope="scope"> <div slot="auth-button" slot-scope="scope">
<auth-button :data="scope.scope" :show-btn-ids="['9121103']" /> <auth-button :data="scope.scope" :show-btn-ids="['9121103']" />
<el-button type="text" style="margin-left: 10px" @click="showTime" <el-button
type="text"
style="margin-left: 10px"
@click="showTime(scope.scope)"
>变更记录</el-button >变更记录</el-button
> >
</div> </div>
...@@ -82,11 +85,13 @@ ...@@ -82,11 +85,13 @@
<el-form-item label="保管人:" prop="custodian"> <el-form-item label="保管人:" prop="custodian">
<el-input v-model="dialogForm.custodian" maxlength="20"></el-input> <el-input v-model="dialogForm.custodian" maxlength="20"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="派发日期:" prop="custodian"> <el-form-item label="派发日期:" prop="disDate">
<el-date-picker <el-date-picker
v-model="dialogForm.value1" v-model="dialogForm.disDate"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
format="yyyy/MM/dd"
value-format="yyyy/MM/dd"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
...@@ -136,9 +141,9 @@ ...@@ -136,9 +141,9 @@
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<el-form-item label="备注:" prop="custodian"> <el-form-item label="备注:">
<el-input <el-input
v-model="dialogForm.custodian" v-model="dialogForm.remark"
type="textarea" type="textarea"
:rows="3" :rows="3"
maxlength="200" maxlength="200"
...@@ -150,7 +155,11 @@ ...@@ -150,7 +155,11 @@
<el-button type="primary" @click="handleSubmit">确 定</el-button> <el-button type="primary" @click="handleSubmit">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<Timeline :dialogVisible="timeVisible" @close="closeDialog"></Timeline> <Timeline
:dialogVisible="timeVisible"
:recordId="recordId"
@close="closeDialog"
></Timeline>
</d2-container> </d2-container>
</template> </template>
...@@ -196,6 +205,7 @@ export default { ...@@ -196,6 +205,7 @@ export default {
} }
return { return {
timeVisible: false, timeVisible: false,
recordId: "",
searchForm: { searchForm: {
businessScene: ["1"] businessScene: ["1"]
}, },
...@@ -346,7 +356,7 @@ export default { ...@@ -346,7 +356,7 @@ export default {
}, },
{ {
label: "APP编号", label: "APP编号",
prop: "appCode", prop: "appVersion",
width: "200px" width: "200px"
}, },
{ {
...@@ -387,8 +397,13 @@ export default { ...@@ -387,8 +397,13 @@ export default {
}, },
{ {
label: "派发日期", label: "派发日期",
prop: "supervision", prop: "disDate",
width: "160px" width: "160px",
formatter: (cellValue) => {
return cellValue.disDate
? Util.dateFormate(cellValue.disDate, "YYYY-MM-DD")
: "-"
}
}, },
{ {
label: "最近使用时间", label: "最近使用时间",
...@@ -443,6 +458,13 @@ export default { ...@@ -443,6 +458,13 @@ export default {
{ required: true, message: "请输入设备编号", trigger: "blur" }, { required: true, message: "请输入设备编号", trigger: "blur" },
{ validator: numberOrEng, trigger: "blur" } { validator: numberOrEng, trigger: "blur" }
], ],
disDate: [
{
required: true,
message: "请选择disDate",
trigger: "change"
}
],
appCode: [ appCode: [
{ required: true, message: "请输入APP编号", trigger: "blur" }, { required: true, message: "请输入APP编号", trigger: "blur" },
{ validator: numberOrEng, trigger: "blur" } { validator: numberOrEng, trigger: "blur" }
...@@ -467,8 +489,9 @@ export default { ...@@ -467,8 +489,9 @@ export default {
closeDialog() { closeDialog() {
this.timeVisible = false this.timeVisible = false
}, },
showTime() { showTime(row) {
this.timeVisible = true this.timeVisible = true
this.recordId = row.id
}, },
handleSearch() { handleSearch() {
this.$refs.tabletTable.refreshTable(true, true) this.$refs.tabletTable.refreshTable(true, true)
...@@ -491,15 +514,20 @@ export default { ...@@ -491,15 +514,20 @@ export default {
custodianPhone, custodianPhone,
supervision, supervision,
brandId, brandId,
disDate,
remark,
directSalesFlag directSalesFlag
} = scope } = scope
// if (businessScene) scope.business = businessScene.split(',') // if (businessScene) scope.business = businessScene.split(',')
this.dialogForm = { this.dialogForm = {
id, id,
badgeCode, badgeCode,
appCode, appCode,
disDate: Util.dateFormate(disDate, "YYYY/MM/DD"),
business: businessScene ? businessScene.split(",") : [], business: businessScene ? businessScene.split(",") : [],
custodian, custodian,
remark,
custodianPhone, custodianPhone,
supervision, supervision,
brandId: brandId ? Number(brandId) : null, brandId: brandId ? Number(brandId) : null,
...@@ -538,7 +566,7 @@ export default { ...@@ -538,7 +566,7 @@ export default {
(item) => item.id == this.dialogForm.brandId (item) => item.id == this.dialogForm.brandId
).label ).label
} }
console.log(params) params.disDate = params.disDate
delete params.business delete params.business
this.$refs.dialogForm.validate((valid) => { this.$refs.dialogForm.validate((valid) => {
if (valid) { if (valid) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!