Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-system-vue
This commit is contained in:
commit
695ed397f2
@ -51,3 +51,11 @@ export function exportLevelExcel(params) {
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
// 查询所有会员
|
||||
export function getLevelAll(params) {
|
||||
return request({
|
||||
url: '/member/level/all',
|
||||
method: 'get',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
@ -1 +1,11 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
const preUrl = '/repair/tickets'
|
||||
|
||||
export function createTickets(data){
|
||||
return request({
|
||||
url: preUrl + "/create",
|
||||
method: "post",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ export default {
|
||||
if (isExternal(real_src)) {
|
||||
return real_src;
|
||||
}
|
||||
return process.env.VUE_APP_BASE_API + real_src;
|
||||
|
||||
return process.env.VUE_APP_IMAGE_URL + real_src;
|
||||
},
|
||||
realSrcList() {
|
||||
if (!this.src) {
|
||||
|
@ -69,6 +69,16 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="选择会员" prop="memberLevelId">
|
||||
<el-select v-model="formData.memberLevelId" placeholder="请选择会员">
|
||||
<el-option v-for="(item,index) in levelList" :key="item.id"
|
||||
:label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="联系地址" prop="address">
|
||||
@ -144,6 +154,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getLevelAll} from '@/api/member/level';
|
||||
import * as CustomerMainApi from '@/api/base/customer';
|
||||
import { getServicePackageList } from "@/api/system/servicePackage";
|
||||
import ImageUpload from '@/components/ImageUpload';
|
||||
@ -158,8 +169,28 @@ export default {
|
||||
Editor,
|
||||
FileUpload
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
//初始化会员下拉
|
||||
getLevelAll().then(
|
||||
res => {
|
||||
if (res.code==0)
|
||||
{
|
||||
this.levelList = res.data
|
||||
}
|
||||
else {
|
||||
this.$modal.msgError(res.msg)
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//会员下拉
|
||||
levelList:[],
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
@ -176,6 +207,7 @@ export default {
|
||||
serviceList: [],
|
||||
// 表单参数
|
||||
formData: {
|
||||
memberLevelId: undefined,
|
||||
id: undefined,
|
||||
userId: undefined,
|
||||
typeCode: '01',
|
||||
@ -219,6 +251,9 @@ export default {
|
||||
inviterType: [
|
||||
{ required: true, message: '请选择注册方式', trigger: 'change' },
|
||||
],
|
||||
memberLevelId:[
|
||||
{ required: true, message: '请选择会员', trigger: 'change' },
|
||||
],
|
||||
},
|
||||
// 性别数据字典
|
||||
sexDictDatas: getDictDatas(DICT_TYPE.DICT_SYS_USER_SEX),
|
||||
|
@ -40,6 +40,8 @@
|
||||
<dict-tag :type="DICT_TYPE.DICT_SYS_USER_SEX" :value="scope.row.sex" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="80" label="会员等级" align="center" prop="levelName">
|
||||
</el-table-column>
|
||||
<el-table-column width="110" label="联系方式" align="center" prop="phoneNumber"/>
|
||||
<el-table-column width="100" label="生日" align="center" prop="birthday">
|
||||
<template v-slot="scope">
|
||||
|
@ -216,11 +216,7 @@ export default {
|
||||
password: [
|
||||
{ required: true, message: '登录密码不能为空', trigger: 'blur' },
|
||||
{ min: 6, max: 20, message: '登录密码长度在6~20个字符', trigger: 'blur' },
|
||||
{
|
||||
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+{}\[\]:;<>,.?~\\-])\S{6,}$/,
|
||||
message: '登录密码必须由大小写字母、数字、特殊字符组成',
|
||||
trigger: 'blur'
|
||||
}
|
||||
|
||||
],
|
||||
workDate: [{ required: true, message: '工作日期不能为空', trigger: 'blur' }],
|
||||
joinedDate: [{ required: true, message: '入职日期不能为空', trigger: 'blur' }]
|
||||
|
@ -133,8 +133,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tenantCode:"lighting", // TODO 这里手动改还是不太合理
|
||||
// tenantCode:"lanan",
|
||||
tenantCode:"lanan",
|
||||
codeUrl: "",
|
||||
//是否开启图形验证码
|
||||
captchaEnable: false,
|
||||
|
@ -77,6 +77,17 @@
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否重复参与" prop="isParticipate">
|
||||
<el-switch
|
||||
v-model="formData.isParticipate"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
active-value="1"
|
||||
inactive-value="0">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="24">
|
||||
@ -120,6 +131,7 @@ export default {
|
||||
isRechRule: '0',
|
||||
isPack:'0',
|
||||
isCoupon:'0',
|
||||
isParticipate:'0'
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {},
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-select v-model="staffSelected" clearable filterable>
|
||||
<el-select v-model="staffSelected" clearable filterable @blur="$emit('input-blur', $event)">
|
||||
<el-option v-for="staff in staffList" :key="staff.id" :label="staff.name" :value="staff.id"/>
|
||||
</el-select>
|
||||
</template>
|
||||
|
@ -18,22 +18,74 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="规格" width="180" prop="model"/>
|
||||
<el-table-column align="center" label="编码" width="180" prop="code"/>
|
||||
<el-table-column align="center" label="数量" width="180" prop="count"/>
|
||||
<el-table-column align="center" label="数量" width="180" prop="count">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.count"/>
|
||||
<span class="item__txt">{{ scope.row.count }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="单位" width="180" prop="unit"/>
|
||||
<el-table-column align="center" label="折扣" width="180"/>
|
||||
<el-table-column align="center" label="金额" width="180"/>
|
||||
<el-table-column align="center" label="施工人员" width="180"/>
|
||||
<el-table-column align="center" label="销售人员" width="180"/>
|
||||
<el-table-column align="center" label="类型" width="180"/>
|
||||
<el-table-column align="center" label="账类" width="180"/>
|
||||
<el-table-column align="center" label="状态" width="180"/>
|
||||
<el-table-column align="center" label="备注" width="180"/>
|
||||
<el-table-column align="center" label="单价" width="180" prop="price">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.price"/>
|
||||
<span class="item__txt">{{ scope.row.price }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="折扣" width="180" prop="discount">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.discount"/>
|
||||
<span class="item__txt">{{ scope.row.discount }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="金额" width="180" prop="totalPrice">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.totalPrice"/>
|
||||
<span class="item__txt">{{ scope.row.totalPrice }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="施工人员" width="180" prop="repair">
|
||||
<div class="item" slot-scope="scope">
|
||||
<StaffChoose @input-blur="save(scope.row)" class="item__input" v-model="scope.row.repair"
|
||||
:select-width="'15rem'"/>
|
||||
<span class="item__txt">{{ scope.row.repair ? scope.row.repair.name : scope.row.repair }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="销售人员" width="180" prop="sale">
|
||||
<div class="item" slot-scope="scope">
|
||||
<StaffChoose @input-blur="save(scope.row)" class="item__input" v-model="scope.row.sale"
|
||||
:select-width="'15rem'"/>
|
||||
<span class="item__txt">{{ scope.row.sale ? scope.row.sale.name : scope.row.sale }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="类型" width="180" prop="type">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.type"/>
|
||||
<span class="item__txt">{{ scope.row.type }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="账类" width="180" prop="accountType">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.accountType"/>
|
||||
<span class="item__txt">{{ scope.row.accountType }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="状态" width="180" prop="itemStatus">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag v-if="scope.row.itemStatus" :type="DICT_TYPE.REPAIR_ITEM_STATUS" v-model="scope.row.itemStatus"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="备注" width="180" prop="remark">
|
||||
<div class="item" slot-scope="scope">
|
||||
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.remark"/>
|
||||
<span class="item__txt">{{ scope.row.remark }}</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="150">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-delete"
|
||||
<el-button size="mini" type="text" icon="el-icon-plus"
|
||||
>新增
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete"
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDeleteItem(scope.$index)"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
@ -44,12 +96,13 @@
|
||||
|
||||
<script>
|
||||
import PartChoose from "@/views/repair/Components/PartChoose.vue";
|
||||
import StaffChoose from "@/views/repair/Components/StaffChoose.vue";
|
||||
|
||||
export default {
|
||||
name: "TicketItem",
|
||||
components: {PartChoose},
|
||||
props:{
|
||||
itemType:{
|
||||
components: {StaffChoose, PartChoose},
|
||||
props: {
|
||||
itemType: {
|
||||
type: String,
|
||||
default: 'project',
|
||||
required: true
|
||||
@ -60,14 +113,28 @@ export default {
|
||||
loading: false,
|
||||
list: [{}],
|
||||
// 需要编辑的属性
|
||||
editProp: ["goods"],
|
||||
editProp: ["goods", 'count', 'price', 'discount', 'repair', 'sale', 'remark', 'type', 'accountType'],
|
||||
// 保存进入编辑的cell
|
||||
clickCellMap: {}
|
||||
clickCellMap: {},
|
||||
selectRepair: {},
|
||||
selectSale: {},
|
||||
formData: {
|
||||
repair: null,
|
||||
sale: null,
|
||||
}
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
getLabelName(){
|
||||
switch (this.itemType){
|
||||
watch:{
|
||||
list:{
|
||||
handler(val){
|
||||
this.$emit("tableData", val)
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getLabelName() {
|
||||
switch (this.itemType) {
|
||||
case "project":
|
||||
return "维修项目";
|
||||
case "part":
|
||||
@ -98,11 +165,13 @@ export default {
|
||||
handleCellClick(row, column, cell, event) {
|
||||
const property = column.property
|
||||
if (this.editProp.includes(property)) {
|
||||
// 保存cell
|
||||
this.saveCellClick(row, cell)
|
||||
cell.querySelector('.item__txt').style.display = 'none'
|
||||
cell.querySelector('.item__input').style.display = 'inline'
|
||||
cell.querySelector('input').focus()
|
||||
if (!row.id || property !== 'goods') {
|
||||
// 保存cell
|
||||
this.saveCellClick(row, cell)
|
||||
cell.querySelector('.item__txt').style.display = 'none'
|
||||
cell.querySelector('.item__input').style.display = 'inline'
|
||||
cell.querySelector('input').focus()
|
||||
}
|
||||
}
|
||||
},
|
||||
/** 取消编辑状态 */
|
||||
@ -122,7 +191,12 @@ export default {
|
||||
}
|
||||
},
|
||||
/** 保存数据 */
|
||||
save (row) {
|
||||
save(row) {
|
||||
// TODO 有BUG 更新表格
|
||||
if (row.id){
|
||||
row.itemStatus = row.repair ? "02" : "01"
|
||||
row.totalPrice = row.count * row.price * (row.discount / 10)
|
||||
}
|
||||
const id = row.id
|
||||
// 取消本行所有cell的编辑状态
|
||||
this.clickCellMap[id].forEach(cell => {
|
||||
@ -130,8 +204,21 @@ export default {
|
||||
})
|
||||
this.clickCellMap[id] = []
|
||||
},
|
||||
getPart(data){
|
||||
getPart(data) {
|
||||
data = {
|
||||
...data,
|
||||
count: 1,
|
||||
discount: 10,
|
||||
remark: null,
|
||||
itemStatus: '01',
|
||||
totalPrice: data.price
|
||||
}
|
||||
this.list.splice(this.list.length - 1, 0, data)
|
||||
},
|
||||
handleDeleteItem(index) {
|
||||
if (this.list[index].id) {
|
||||
this.list.splice(index, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,12 +92,12 @@
|
||||
</template>
|
||||
<el-input v-model="selectCar.newMaintenanceMileage"/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :span="3">
|
||||
<template slot="label">
|
||||
备注
|
||||
</template>
|
||||
<el-input v-model="formData.remark"/>
|
||||
</el-descriptions-item>
|
||||
<!-- <el-descriptions-item :span="3">-->
|
||||
<!-- <template slot="label">-->
|
||||
<!-- 备注-->
|
||||
<!-- </template>-->
|
||||
<!-- <el-input v-model="formData.remark"/>-->
|
||||
<!-- </el-descriptions-item>-->
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
服务顾问
|
||||
@ -129,9 +129,9 @@
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<TicketItem item-type="project"/>
|
||||
<TicketItem v-if="createTicketType" item-type="part"/>
|
||||
<TicketItem v-if="createTicketType" item-type="other"/>
|
||||
<TicketItem item-type="project" @tableData="projectData"/>
|
||||
<TicketItem v-if="createTicketType" item-type="part" @tableData="partData"/>
|
||||
<TicketItem v-if="createTicketType" item-type="other" @tableData="otherData"/>
|
||||
<el-row :gutter="createTicketType ? 2 : 3" style="margin-top: 1rem">
|
||||
<el-col :span="createTicketType ? 12 : 16">
|
||||
<el-descriptions class="margin-top" :column="createTicketType ? 2 : 3" border :size="'medium'"
|
||||
@ -164,11 +164,11 @@
|
||||
<el-col v-if="createTicketType" :span="12">
|
||||
<el-descriptions class="margin-top" :column="5" :size="'medium'"
|
||||
style="margin-left: 1rem;margin-top: 1rem">
|
||||
<el-descriptions-item label="数量">0</el-descriptions-item>
|
||||
<el-descriptions-item label="项目">0</el-descriptions-item>
|
||||
<el-descriptions-item label="配件">0</el-descriptions-item>
|
||||
<el-descriptions-item label="附加">0</el-descriptions-item>
|
||||
<el-descriptions-item label="合计">0</el-descriptions-item>
|
||||
<el-descriptions-item label="数量">{{ formData.count }}</el-descriptions-item>
|
||||
<el-descriptions-item label="项目">{{ formData.projectPrice }}</el-descriptions-item>
|
||||
<el-descriptions-item label="配件">{{ formData.partPrice }}</el-descriptions-item>
|
||||
<el-descriptions-item label="附加">{{ formData.otherPrice }}</el-descriptions-item>
|
||||
<el-descriptions-item label="合计">{{ formData.totalPrice }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-col>
|
||||
<el-col v-else :span="8" style="margin-top:1rem;display: flex;justify-content: right">
|
||||
@ -183,11 +183,12 @@
|
||||
<template slot="label">
|
||||
备注
|
||||
</template>
|
||||
<el-input/>
|
||||
<el-input v-model="formData.remark"/>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-col>
|
||||
<el-col :span="12" style="margin-top:1rem;display: flex;justify-content: right">
|
||||
<el-button type="success" @click="handleSave">登记保存</el-button>
|
||||
<el-button type="danger">结算</el-button>
|
||||
<el-button type="success">完成</el-button>
|
||||
<el-button type="primary">通知施工</el-button>
|
||||
@ -203,7 +204,8 @@ import UserChoose from "@/views/repair/Components/UserChoose.vue";
|
||||
import StaffChoose from "@/views/repair/Components/StaffChoose.vue";
|
||||
import TicketItem from "@/views/repair/tickets/Components/TicketItem.vue";
|
||||
import CarChoose from "@/views/repair/Components/CarChoose.vue";
|
||||
import {parseTime} from "../../../../utils/ruoyi";
|
||||
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
|
||||
import {createTickets} from "@/api/repair/tickets/Tickets";
|
||||
|
||||
export default {
|
||||
name: "UserInfo",
|
||||
@ -236,15 +238,212 @@ export default {
|
||||
remark: null,
|
||||
inTime: Date.now(),
|
||||
outTime: null,
|
||||
ticketTime: Date.now()
|
||||
ticketTime: Date.now(),
|
||||
projectPrice: 0,
|
||||
partPrice: 0,
|
||||
otherPrice: 0,
|
||||
totalPrice: 0,
|
||||
count: 0,
|
||||
userId: null,
|
||||
userName: null,
|
||||
userMobile: null,
|
||||
carId: null,
|
||||
carNo: null,
|
||||
carVin: null,
|
||||
carBrandId: null,
|
||||
carBrandName: null,
|
||||
carBrandType: null,
|
||||
adviserId: null,
|
||||
adviserName: null,
|
||||
payType: null,
|
||||
repairAdvice: null,
|
||||
qualityExplain: null,
|
||||
ticketType: null,
|
||||
itemList: [],
|
||||
},
|
||||
selectUser: {},
|
||||
selectCar: {},
|
||||
selectStaff: {},
|
||||
projectList: [],
|
||||
partList: [],
|
||||
otherList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
parseTime
|
||||
projectData(data) {
|
||||
// 去掉最后一行
|
||||
this.projectList = [...data]
|
||||
this.projectList.pop()
|
||||
// 通知计算
|
||||
this.computedData()
|
||||
},
|
||||
partData(data) {
|
||||
// 去掉最后一行
|
||||
this.partList = [...data]
|
||||
this.partList.pop()
|
||||
// 通知计算
|
||||
this.computedData()
|
||||
},
|
||||
otherData(data) {
|
||||
// 去掉最后一行
|
||||
this.otherList = [...data]
|
||||
this.otherList.pop()
|
||||
// 通知计算
|
||||
this.computedData()
|
||||
},
|
||||
computedData() {
|
||||
const data = this.formData
|
||||
this.formData = {
|
||||
...data,
|
||||
projectPrice: 0,
|
||||
partPrice: 0,
|
||||
otherPrice: 0,
|
||||
totalPrice: 0,
|
||||
count: 0
|
||||
}
|
||||
// 项目
|
||||
if (this.projectList) {
|
||||
this.formData.projectPrice = this.computeByItem(this.projectList)
|
||||
}
|
||||
// 配件
|
||||
if (this.partList) {
|
||||
this.formData.partPrice = this.computeByItem(this.partList)
|
||||
}
|
||||
// 其他
|
||||
if (this.otherList) {
|
||||
this.formData.otherPrice = this.computeByItem(this.otherList)
|
||||
}
|
||||
},
|
||||
computeByItem(item) {
|
||||
const count = item.reduce((x, y) => {
|
||||
return x + y.count
|
||||
}, 0)
|
||||
const totalPrice = item.reduce((x, y) => {
|
||||
return x + y.totalPrice
|
||||
}, 0)
|
||||
this.formData.count += parseInt(count)
|
||||
this.formData.totalPrice += parseFloat(totalPrice)
|
||||
return parseFloat(totalPrice)
|
||||
},
|
||||
// 登记保存
|
||||
async handleSave() {
|
||||
this.createInit()
|
||||
this.createItemInit()
|
||||
try {
|
||||
// await createTickets(this.formData)
|
||||
this.$modal.msgSuccess("新增成功")
|
||||
this.init()
|
||||
}catch{}
|
||||
},
|
||||
// 初始化
|
||||
init(){
|
||||
this.formData = {
|
||||
endCheck: 1,
|
||||
partDisposal: '01',
|
||||
repairType: '01',
|
||||
ticketNo: null,
|
||||
remark: null,
|
||||
inTime: Date.now(),
|
||||
outTime: null,
|
||||
ticketTime: Date.now(),
|
||||
projectPrice: 0,
|
||||
partPrice: 0,
|
||||
otherPrice: 0,
|
||||
totalPrice: 0,
|
||||
count: 0,
|
||||
userId: null,
|
||||
userName: null,
|
||||
userMobile: null,
|
||||
carId: null,
|
||||
carNo: null,
|
||||
carVin: null,
|
||||
carBrandId: null,
|
||||
carBrandName: null,
|
||||
carBrandType: null,
|
||||
adviserId: null,
|
||||
adviserName: null,
|
||||
payType: null,
|
||||
repairAdvice: null,
|
||||
qualityExplain: null,
|
||||
ticketType: null,
|
||||
itemList: [],
|
||||
}
|
||||
this.selectUser ={}
|
||||
this.selectCar = {}
|
||||
this.selectStaff = {}
|
||||
this.projectList = []
|
||||
this.partList = []
|
||||
this.otherList = []
|
||||
},
|
||||
// 新增基础信息init
|
||||
createInit() {
|
||||
// 生成工单号
|
||||
this.formData.ticketNo = createUniqueCodeByHead("GD")
|
||||
// 选择的用户
|
||||
this.formData.userId = this.selectUser?.userId
|
||||
this.formData.userName = this.selectUser?.cusName
|
||||
this.formData.userMobile = this.selectUser?.phoneNumber
|
||||
|
||||
// 选择的车辆
|
||||
this.formData.carId = this.selectCar?.id
|
||||
this.formData.carNo = this.selectCar?.licenseNumber
|
||||
this.formData.carVin = this.selectCar?.vin
|
||||
this.formData.carBrandId = this.selectCar?.carBrand
|
||||
this.formData.carBrandName = this.selectCar?.brandStr
|
||||
this.formData.carBrandType = this.selectCar?.brandType
|
||||
|
||||
// 服务顾问
|
||||
this.formData.adviserId = this.selectStaff?.id
|
||||
this.formData.adviserName = this.selectStaff?.name
|
||||
},
|
||||
// 新增子表信息init
|
||||
createItemInit() {
|
||||
// 项目
|
||||
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("project", this.projectList)]
|
||||
// 配件
|
||||
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("part", this.partList)]
|
||||
// 其他
|
||||
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("other", this.otherList)]
|
||||
},
|
||||
// 子表信息预处理
|
||||
formatItem(type, list) {
|
||||
if (!(list && list.length > 0)){
|
||||
return []
|
||||
}
|
||||
return list.map(item => {
|
||||
const temp = {
|
||||
...item,
|
||||
itemName: item.name,
|
||||
itemCount: item.count,
|
||||
itemUnit: item.unit,
|
||||
itemPrice: item.price,
|
||||
itemDiscount: item.discount,
|
||||
itemMoney: item.totalPrice,
|
||||
repairId: item?.repair?.id,
|
||||
repairName: item?.repair?.name,
|
||||
saleId: item?.sale?.id,
|
||||
saleName: item?.sale?.name,
|
||||
itemTypeId: item?.type?.id,
|
||||
remark: item.remark,
|
||||
itemStatus: item.itemStatus,
|
||||
}
|
||||
switch (type) {
|
||||
case 'project':
|
||||
temp['itemType'] = "01"
|
||||
break;
|
||||
case 'part':
|
||||
temp['itemType'] = "02"
|
||||
break;
|
||||
case 'other':
|
||||
temp['itemType'] = "03"
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
temp[type + 'Id'] = item.id
|
||||
return temp;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user