更新
This commit is contained in:
parent
9762746eef
commit
5398a129dc
132
components/commonTimeSelect.vue
Normal file
132
components/commonTimeSelect.vue
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<template>
|
||||||
|
<view class="date-range-selector">
|
||||||
|
<u-subsection :list="dateRangeList" keyName="label" :current="selected" @change="handleSubsectionChange" />
|
||||||
|
<uni-datetime-picker :value="internalDateRange" type="daterange" @change="handleDatePickerChange" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
// Vue2 中使用 value 作为 v-model 的 prop
|
||||||
|
value: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
dateRangeList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [{
|
||||||
|
label: "今日",
|
||||||
|
value: "day"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "本周",
|
||||||
|
value: "week"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "本月",
|
||||||
|
value: "month"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selected: 0,
|
||||||
|
internalDateRange: this.value
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(newVal) {
|
||||||
|
if (JSON.stringify(newVal) !== JSON.stringify(this.internalDateRange)) {
|
||||||
|
this.internalDateRange = newVal;
|
||||||
|
this.resetSelectedIndex();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
internalDateRange(newVal) {
|
||||||
|
this.$emit('input', newVal); // Vue2 中使用 input 事件
|
||||||
|
this.$emit('subsection-change', newVal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 获取日期范围
|
||||||
|
getDateRange(type) {
|
||||||
|
const now = new Date()
|
||||||
|
let start, end
|
||||||
|
|
||||||
|
if (type === 'week') {
|
||||||
|
// 获取本周的开始(周一)和结束(周日)
|
||||||
|
const day = now.getDay() || 7 // Sunday 为 0,设为 7
|
||||||
|
start = new Date(now)
|
||||||
|
start.setDate(now.getDate() - day + 1)
|
||||||
|
|
||||||
|
end = new Date(start)
|
||||||
|
end.setDate(start.getDate() + 6)
|
||||||
|
} else if (type === 'month') {
|
||||||
|
// 获取本月的开始和结束
|
||||||
|
start = new Date(now.getFullYear(), now.getMonth(), 1)
|
||||||
|
end = new Date(now.getFullYear(), now.getMonth() + 1, 0) // 本月最后一天
|
||||||
|
} else if (type === 'day') {
|
||||||
|
// 获取当天的开始和结束(00:00:00 到 23:59:59)
|
||||||
|
start = new Date(now)
|
||||||
|
start.setHours(0, 0, 0, 0)
|
||||||
|
|
||||||
|
end = new Date(now)
|
||||||
|
end.setHours(23, 59, 59, 999)
|
||||||
|
} else {
|
||||||
|
console.warn('不支持的类型:', type)
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
this.formatDateCus(start),
|
||||||
|
this.formatDateCus(end)
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// 格式化日期
|
||||||
|
formatDateCus(date) {
|
||||||
|
const y = date.getFullYear()
|
||||||
|
const m = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||||
|
const d = date.getDate().toString().padStart(2, '0')
|
||||||
|
return `${y}-${m}-${d}`
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSubsectionChange(index) {
|
||||||
|
this.selected = index;
|
||||||
|
const {
|
||||||
|
value
|
||||||
|
} = this.dateRangeList[index];
|
||||||
|
this.internalDateRange = this.getDateRange(value);
|
||||||
|
},
|
||||||
|
handleDatePickerChange(newRange) {
|
||||||
|
this.internalDateRange = newRange;
|
||||||
|
this.resetSelectedIndex();
|
||||||
|
},
|
||||||
|
resetSelectedIndex() {
|
||||||
|
const isPreset = this.dateRangeList.some((item, index) => {
|
||||||
|
const range = this.getDateRange(item.value);
|
||||||
|
return JSON.stringify(range) === JSON.stringify(this.internalDateRange);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isPreset) {
|
||||||
|
this.selected = -1; // 如果日期范围不匹配任何预设,取消选中状态
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// 默认选择今日
|
||||||
|
if (!this.value || this.value.length === 0) {
|
||||||
|
this.internalDateRange = this.getDateRange('day');
|
||||||
|
} else {
|
||||||
|
this.resetSelectedIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.date-range-selector {
|
||||||
|
/* 可以写样式 */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -55,11 +55,11 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="finance" v-if="checkPermi(['repair:tick:profit'])">
|
<view class="finance" v-if="checkPermi(['repair:tick:profit'])">
|
||||||
<view class="fin-card receivable" @click.self="goListByPayStatus('receivable')">
|
<view class="fin-card receivable" @click="goListByPayStatus('receivable')">
|
||||||
<view class="fin-top">
|
<view class="fin-top">
|
||||||
<text class="fin-title">应收款</text>
|
<text class="fin-title">应收款</text>
|
||||||
<uni-icons :type="financeVisibility.receivable ? 'eye' : 'eye-slash'" color="#7aa6ff" size="20"
|
<uni-icons :type="financeVisibility.receivable ? 'eye' : 'eye-slash'" color="#7aa6ff" size="20"
|
||||||
@click="toggleFinance('receivable')" />
|
@click.native.stop="toggleFinance('receivable')" />
|
||||||
</view>
|
</view>
|
||||||
<!-- 已收款金额 -->
|
<!-- 已收款金额 -->
|
||||||
<text
|
<text
|
||||||
@ -69,11 +69,11 @@
|
|||||||
<image src="../images/money_one.png" mode="widthFix" class="tap_icon"></image>
|
<image src="../images/money_one.png" mode="widthFix" class="tap_icon"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="fin-card collected" @click.self="goListByPayStatus('receivedAmount')">
|
<view class="fin-card collected" @click="goListByPayStatus('receivedAmount')">
|
||||||
<view class="fin-top">
|
<view class="fin-top">
|
||||||
<text class="fin-title">已收款</text>
|
<text class="fin-title">已收款</text>
|
||||||
<uni-icons :type="financeVisibility.collected ? 'eye' : 'eye-slash'" color="#a896ff" size="20"
|
<uni-icons :type="financeVisibility.collected ? 'eye' : 'eye-slash'" color="#a896ff" size="20"
|
||||||
@click="toggleFinance('collected')" />
|
@click.native.stop="toggleFinance('collected')" />
|
||||||
</view>
|
</view>
|
||||||
<text
|
<text
|
||||||
class="fin-amount">{{ financeVisibility.collected ? formatCurrency(otherInfo.receivedAmount) : '*****' }}</text>
|
class="fin-amount">{{ financeVisibility.collected ? formatCurrency(otherInfo.receivedAmount) : '*****' }}</text>
|
||||||
@ -82,11 +82,11 @@
|
|||||||
<image src="../images/money_two.png" mode="widthFix" class="tap_icon"></image>
|
<image src="../images/money_two.png" mode="widthFix" class="tap_icon"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="fin-card pending" @click.self="goListByPayStatus('pendingAmount')">
|
<view class="fin-card pending" @click="goListByPayStatus('pendingAmount')">
|
||||||
<view class="fin-top">
|
<view class="fin-top">
|
||||||
<text class="fin-title">待收款</text>
|
<text class="fin-title">待收款</text>
|
||||||
<uni-icons :type="financeVisibility.pending ? 'eye' : 'eye-slash'" color="#ffcf7a" size="20"
|
<uni-icons :type="financeVisibility.pending ? 'eye' : 'eye-slash'" color="#ffcf7a" size="20"
|
||||||
@click="toggleFinance('pending')" />
|
@click.native.stop="toggleFinance('pending')" />
|
||||||
</view>
|
</view>
|
||||||
<text
|
<text
|
||||||
class="fin-amount">{{ financeVisibility.pending ? formatCurrency(otherInfo.pendingAmount) : '*****' }}</text>
|
class="fin-amount">{{ financeVisibility.pending ? formatCurrency(otherInfo.pendingAmount) : '*****' }}</text>
|
||||||
@ -123,16 +123,6 @@
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
},
|
},
|
||||||
sectionOrder: ['orders', 'repairing', 'completed', 'settled', 'unsettled', 'delivered', 'inFactory'],
|
|
||||||
sectionTitle: {
|
|
||||||
orders: '订单(进厂)数',
|
|
||||||
repairing: '维修中',
|
|
||||||
completed: '已竣工',
|
|
||||||
settled: '竣工已结算',
|
|
||||||
unsettled: '竣工未结算',
|
|
||||||
delivered: '已交车',
|
|
||||||
inFactory: '在厂数'
|
|
||||||
},
|
|
||||||
tapList: [{
|
tapList: [{
|
||||||
label: "本日",
|
label: "本日",
|
||||||
value: "day",
|
value: "day",
|
||||||
|
|||||||
@ -877,16 +877,16 @@
|
|||||||
|
|
||||||
getCarList(carId) {
|
getCarList(carId) {
|
||||||
const params = {
|
const params = {
|
||||||
userId: this.userInfo.userId,
|
id: this.userInfo.id,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 100000
|
pageSize: 100000
|
||||||
}
|
}
|
||||||
request({
|
request({
|
||||||
url: '/admin-api/base/carMain/page',
|
url: '/admin-api/base/custom/get',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: params
|
params: params
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.carList = res.data.records
|
this.carList = res.data.carList
|
||||||
for (let i = 0; i < this.carList.length; i++) {
|
for (let i = 0; i < this.carList.length; i++) {
|
||||||
if (this.carList[i].licenseNumber.toLowerCase() == this.phone.toLowerCase()) {
|
if (this.carList[i].licenseNumber.toLowerCase() == this.phone.toLowerCase()) {
|
||||||
this.activeCarIndex = i
|
this.activeCarIndex = i
|
||||||
|
|||||||
@ -19,17 +19,21 @@
|
|||||||
<view class="list">
|
<view class="list">
|
||||||
<scroll-view style="height: 100%" scroll-y="true" class="itemContent" @scrolltolower="onReachBottomCus"
|
<scroll-view style="height: 100%" scroll-y="true" class="itemContent" @scrolltolower="onReachBottomCus"
|
||||||
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
|
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
|
||||||
<view v-for="(item, index) in repairList" :key="index" class="listItem">
|
<view v-for="(item, index) in repairList" :key="index" class="listItem"
|
||||||
|
@click="addNewWaresFun(item.id)">
|
||||||
<view class="repairName">{{ item.name }}</view>
|
<view class="repairName">{{ item.name }}</view>
|
||||||
<view class="repairBottom">
|
<view class="repairBottom">
|
||||||
<text class="repairDesc">单位:
|
<text class="repairDesc">单位:
|
||||||
<text class="repairUnit">{{ item.unitText }}</text>
|
<text class="repairUnit">{{ item.unitText }}</text>
|
||||||
</text>
|
</text>
|
||||||
|
<text class="repairDesc">当前库存:
|
||||||
|
<text class="repairUnit">{{ item.stock }}</text>
|
||||||
|
</text>
|
||||||
<view class="repairBtns">
|
<view class="repairBtns">
|
||||||
<u-icon name="minus-circle-fill" size="24" @click="delNum(item)"></u-icon>
|
<u-icon name="minus-circle-fill" size="24" @click.native.stop="delNum(item)"></u-icon>
|
||||||
<text class="repairNum">{{ item.num }}</text>
|
<text class="repairNum">{{ item.num }}</text>
|
||||||
<u-icon color="#0174F6" name="plus-circle-fill" size="24"
|
<u-icon color="#0174F6" name="plus-circle-fill" size="24"
|
||||||
@click="addNum(item)"></u-icon>
|
@click.native.stop="addNum(item)"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -481,10 +485,16 @@
|
|||||||
/**
|
/**
|
||||||
* 添加新的配件
|
* 添加新的配件
|
||||||
*/
|
*/
|
||||||
addNewWaresFun() {
|
addNewWaresFun(id) {
|
||||||
|
if (id) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages-repair/apply/newWare'
|
url: `/pages-repair/apply/newWare?id=${id}`
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages-repair/apply/newWare`
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<VNavigationBar background-color="#fff" title="新增配件" title-color="#333"></VNavigationBar>
|
<VNavigationBar background-color="#fff" :title="title" title-color="#333"></VNavigationBar>
|
||||||
<view class="listBox">
|
<view class="listBox">
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<view class="formItem">
|
<view class="formItem">
|
||||||
<text class="formLabel require">配件名称</text>
|
<text class="formLabel require">配件名称</text>
|
||||||
<input type="text" style="text-align: right" v-model="formData.name" placeholder="请输入配件名称" />
|
<input type="text" style="text-align: right" v-model="formData.name" placeholder="请输入配件名称" />
|
||||||
</view>
|
</view>
|
||||||
|
<view class="formItem">
|
||||||
|
<text class="formLabel require">进价</text>
|
||||||
|
<input type="text" style="text-align: right" v-model="formData.purPrice" placeholder="请输入配件名称" />
|
||||||
|
</view>
|
||||||
|
<view class="formItem">
|
||||||
|
<text class="formLabel require">销售价格</text>
|
||||||
|
<input type="text" style="text-align: right" v-model="formData.price" placeholder="请输入配件名称" />
|
||||||
|
</view>
|
||||||
<view class="formItem">
|
<view class="formItem">
|
||||||
<text class="formLabel require">所属分类</text>
|
<text class="formLabel require">所属分类</text>
|
||||||
<picker @change="typePickerChange" :value="typeIndex" :range="allTypeNameList">
|
<picker @change="typePickerChange" :value="typeIndex" :range="allTypeNameList">
|
||||||
@ -59,7 +67,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view style="padding-bottom: 60rpx;border-bottom: 1px solid #ddd;" class="formItem">
|
<view style="padding-bottom: 60rpx;border-bottom: 1px solid #ddd;" class="formItem">
|
||||||
<checkbox-group v-model="checkedCorpIdList" @change="cs">
|
<checkbox-group v-model="checkedCorpIdList" @change="cs">
|
||||||
<checkbox v-for="(item, index) in allCompanyList" :key="index" :value="item.id" :checked="item.checked">{{ item.corpName }}</checkbox>
|
<checkbox v-for="(item, index) in allCompanyList" :key="index" :value="item.id"
|
||||||
|
:checked="item.checked">{{ item.corpName }}</checkbox>
|
||||||
</checkbox-group>
|
</checkbox-group>
|
||||||
</view>
|
</view>
|
||||||
<view class="formItem">
|
<view class="formItem">
|
||||||
@ -89,11 +98,19 @@
|
|||||||
<script>
|
<script>
|
||||||
import VNavigationBar from "@/components/VNavigationBar.vue";
|
import VNavigationBar from "@/components/VNavigationBar.vue";
|
||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import {getDictTextByCodeAndValue,createUniqueCodeByHead} from "@/utils/utils";
|
import {
|
||||||
import {getUserInfo,getJSONData} from '@/utils/auth.js'
|
getDictTextByCodeAndValue,
|
||||||
|
createUniqueCodeByHead
|
||||||
|
} from "@/utils/utils";
|
||||||
|
import {
|
||||||
|
getUserInfo,
|
||||||
|
getJSONData
|
||||||
|
} from '@/utils/auth.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {VNavigationBar},
|
components: {
|
||||||
|
VNavigationBar
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
//父组件传入的数据
|
//父组件传入的数据
|
||||||
@ -112,9 +129,16 @@ export default {
|
|||||||
remark: "",
|
remark: "",
|
||||||
},
|
},
|
||||||
// 状态单选按钮的选项数组
|
// 状态单选按钮的选项数组
|
||||||
radioOptions: [
|
radioOptions: [{
|
||||||
{ label: '启用', value: '01' ,checked:true},
|
label: '启用',
|
||||||
{ label: '禁用', value: '02' ,checked:false}
|
value: '01',
|
||||||
|
checked: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '禁用',
|
||||||
|
value: '02',
|
||||||
|
checked: false
|
||||||
|
}
|
||||||
],
|
],
|
||||||
//所有可选分类
|
//所有可选分类
|
||||||
allTypeList: [],
|
allTypeList: [],
|
||||||
@ -144,10 +168,20 @@ export default {
|
|||||||
allCompanyList: [],
|
allCompanyList: [],
|
||||||
//选中的子公司id
|
//选中的子公司id
|
||||||
checkedCorpIdList: [],
|
checkedCorpIdList: [],
|
||||||
|
//页面标题
|
||||||
|
title: '新增配件',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad(options) {
|
||||||
|
if (options.id) {
|
||||||
|
this.title = '修改配件'
|
||||||
|
// 初始化完成后查询配件信息
|
||||||
|
this.init().then(() => {
|
||||||
|
this.selectWares(options.id)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
this.init()
|
this.init()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
@ -159,17 +193,19 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* 初始化配件数据
|
* 初始化配件数据
|
||||||
*/
|
*/
|
||||||
init() {
|
async init() {
|
||||||
//查所有可选分类
|
try {
|
||||||
this.selectBaseType()
|
// 等待所有数据加载完成
|
||||||
//查所有可选计量单位
|
await Promise.all([
|
||||||
this.selectBaseUnit()
|
this.selectBaseType(),
|
||||||
//查所有可选来源
|
this.selectBaseUnit(),
|
||||||
this.selectDataFrom()
|
this.selectDataFrom(),
|
||||||
//查所有可选属性
|
this.selectAttribute(),
|
||||||
this.selectAttribute()
|
|
||||||
//查所有可选子公司
|
|
||||||
this.selectCompany()
|
this.selectCompany()
|
||||||
|
])
|
||||||
|
} catch (error) {
|
||||||
|
console.error('初始化数据失败:', error)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 查所有可选分类
|
* 查所有可选分类
|
||||||
@ -178,12 +214,16 @@ export default {
|
|||||||
request({
|
request({
|
||||||
url: '/admin-api/conf/baseType/list',
|
url: '/admin-api/conf/baseType/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {type:"02"}
|
params: {
|
||||||
|
type: "02"
|
||||||
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.code == 200 && res.data.length > 0) {
|
if (res.code == 200 && res.data.length > 0) {
|
||||||
this.allTypeList = res.data
|
this.allTypeList = res.data
|
||||||
this.allTypeNameList = res.data.map((item)=>{return item.name})
|
this.allTypeNameList = res.data.map((item) => {
|
||||||
|
return item.name
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -194,28 +234,81 @@ export default {
|
|||||||
request({
|
request({
|
||||||
url: '/admin-api/system/dict-data/type',
|
url: '/admin-api/system/dict-data/type',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params:{type:"repair_unit"}
|
params: {
|
||||||
|
type: "repair_unit"
|
||||||
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.allUnitList = res.data
|
this.allUnitList = res.data
|
||||||
this.allUnitNameList = res.data.map((item)=>{return item.label})
|
this.allUnitNameList = res.data.map((item) => {
|
||||||
|
return item.label
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 查所有可选来源
|
* 查询配件信息
|
||||||
*/
|
*/
|
||||||
selectDataFrom(){
|
selectWares(id) {
|
||||||
request({
|
request({
|
||||||
url: '/admin-api/system/dict-data/type',
|
url: `/admin-api/repair/wares/get`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params:{type:"wares_data_form"}
|
params: {
|
||||||
|
id
|
||||||
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(res)
|
if (res.code === 200 && res.data) {
|
||||||
if (res.code == 200) {
|
this.formData = res.data
|
||||||
this.allFromList = res.data
|
|
||||||
this.allFromNameList = res.data.map((item)=>{return item.label})
|
// 设置分类选中项
|
||||||
|
if (this.allTypeList.length > 0 && res.data.type) {
|
||||||
|
const typeIndex = this.allTypeList.findIndex(item => item.id === res.data.type)
|
||||||
|
if (typeIndex !== -1) {
|
||||||
|
this.typeIndex = typeIndex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置计量单位选中项
|
||||||
|
if (this.allUnitList.length > 0 && res.data.unit) {
|
||||||
|
const unitIndex = this.allUnitList.findIndex(item => item.value === res.data.unit)
|
||||||
|
if (unitIndex !== -1) {
|
||||||
|
this.unitIndex = unitIndex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置来源选中项
|
||||||
|
if (this.allFromList.length > 0 && res.data.dataForm) {
|
||||||
|
const fromIndex = this.allFromList.findIndex(item => item.value === res.data.dataForm)
|
||||||
|
if (fromIndex !== -1) {
|
||||||
|
this.fromIndex = fromIndex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置配件属性选中项
|
||||||
|
if (this.allAttributeList.length > 0 && res.data.attribute) {
|
||||||
|
const attributeIndex = this.allAttributeList.findIndex(item => item.value === res.data
|
||||||
|
.attribute)
|
||||||
|
if (attributeIndex !== -1) {
|
||||||
|
this.attributeIndex = attributeIndex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置子公司选中项
|
||||||
|
if (res.data.corpIds && res.data.corpIds.length > 0) {
|
||||||
|
this.checkedCorpIdList = res.data.corpIds
|
||||||
|
// 同时更新checkbox的选中状态
|
||||||
|
this.allCompanyList.forEach(item => {
|
||||||
|
item.checked = res.data.corpIds.includes(item.id)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置状态单选按钮
|
||||||
|
if (res.data.status) {
|
||||||
|
this.radioOptions.forEach(item => {
|
||||||
|
item.checked = item.value === res.data.status
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -226,12 +319,16 @@ export default {
|
|||||||
request({
|
request({
|
||||||
url: '/admin-api/system/dict-data/type',
|
url: '/admin-api/system/dict-data/type',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params:{type:"wares_attribute"}
|
params: {
|
||||||
|
type: "wares_attribute"
|
||||||
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.allAttributeList = res.data
|
this.allAttributeList = res.data
|
||||||
this.allAttributeNameList = res.data.map((item)=>{return item.label})
|
this.allAttributeNameList = res.data.map((item) => {
|
||||||
|
return item.label
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -252,6 +349,26 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 查所有可选来源
|
||||||
|
*/
|
||||||
|
selectDataFrom() {
|
||||||
|
request({
|
||||||
|
url: '/admin-api/system/dict-data/type',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
type: "wares_data_form"
|
||||||
|
}
|
||||||
|
}).then((res) => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.allFromList = res.data
|
||||||
|
this.allFromNameList = res.data.map((item) => {
|
||||||
|
return item.label
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 选分类
|
* 选分类
|
||||||
*/
|
*/
|
||||||
@ -281,7 +398,7 @@ export default {
|
|||||||
this.attributeIndex = e.detail.value
|
this.attributeIndex = e.detail.value
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 新增配件
|
* 新增/修改配件
|
||||||
*/
|
*/
|
||||||
submit() {
|
submit() {
|
||||||
// 校验必填
|
// 校验必填
|
||||||
@ -292,26 +409,32 @@ export default {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//组装可用的子公司
|
|
||||||
|
|
||||||
console.log(this.allCompanyList,"this.checkedCorpIdList")
|
// 组装可用的子公司
|
||||||
if (this.checkedCorpIdList.length > 0) {
|
if (this.checkedCorpIdList.length > 0) {
|
||||||
this.formData.corpId = this.checkedCorpIdList.join()
|
this.formData.corpId = this.checkedCorpIdList.join()
|
||||||
}
|
}
|
||||||
//组装所属分类
|
|
||||||
this.formData.status = "01"
|
// 组装其他字段
|
||||||
this.formData.type = this.allTypeList[this.typeIndex].id
|
this.formData.type = this.allTypeList[this.typeIndex].id
|
||||||
this.formData.unit = this.allUnitList[this.unitIndex].value
|
this.formData.unit = this.allUnitList[this.unitIndex].value
|
||||||
this.formData.dataForm = this.allFromList[this.fromIndex].value
|
this.formData.dataForm = this.allFromList[this.fromIndex].value
|
||||||
this.formData.attribute = this.allAttributeList[this.attributeIndex].value
|
this.formData.attribute = this.allAttributeList[this.attributeIndex].value
|
||||||
|
|
||||||
|
// 判断是新增还是修改
|
||||||
|
const isEdit = !!this.formData.id
|
||||||
|
const url = isEdit ? '/admin-api/repair/wares/update' : '/admin-api/repair/wares/create'
|
||||||
|
const method = isEdit ? 'put' : 'post'
|
||||||
|
const successMsg = isEdit ? '修改成功!' : '新增成功!'
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: '/admin-api/repair/wares/create',
|
url: url,
|
||||||
method: 'post',
|
method: method,
|
||||||
data: this.formData
|
data: this.formData
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '新增成功!',
|
title: successMsg,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -337,17 +460,20 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.listBox {
|
.listBox {
|
||||||
padding: 30 rpx 32 rpx;
|
padding: 30 rpx 32 rpx;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 0;
|
height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 0 30rpx;
|
padding: 0 30rpx;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.formItem {
|
.formItem {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
@ -360,10 +486,12 @@ export default {
|
|||||||
|
|
||||||
border-bottom: 1rpx solid #DDDDDD;
|
border-bottom: 1rpx solid #DDDDDD;
|
||||||
}
|
}
|
||||||
|
|
||||||
.require::before {
|
.require::before {
|
||||||
content: "*";
|
content: "*";
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.formLabel {
|
.formLabel {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
@ -376,6 +504,7 @@ export default {
|
|||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.repairBottom {
|
.repairBottom {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@ -8,68 +8,42 @@
|
|||||||
<u-input v-model="userInfo.cusName" border="none" placeholder="请输入客户姓名"></u-input>
|
<u-input v-model="userInfo.cusName" border="none" placeholder="请输入客户姓名"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item borderBottom label="客户性别" label-width="200">
|
<u-form-item borderBottom label="客户性别" label-width="200">
|
||||||
<u-radio-group
|
<u-radio-group v-model="userInfo.sex" placement="row">
|
||||||
v-model="userInfo.sex"
|
|
||||||
placement="row"
|
|
||||||
>
|
|
||||||
<u-radio key="0" label="男" name="0" style="margin-right: 100rpx"></u-radio>
|
<u-radio key="0" label="男" name="0" style="margin-right: 100rpx"></u-radio>
|
||||||
<u-radio key="1" label="女" name="1"></u-radio>
|
<u-radio key="1" label="女" name="1"></u-radio>
|
||||||
</u-radio-group>
|
</u-radio-group>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item borderBottom label="客户联系方式" label-width="200">
|
<u-form-item borderBottom label="客户联系方式" label-width="200">
|
||||||
<u-input v-model="userInfo.phoneNumber" border="none" placeholder="请输入客户手机号" type="number"></u-input>
|
<u-input v-model="userInfo.phoneNumber" border="none" placeholder="请输入客户手机号"
|
||||||
|
type="number"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="card">
|
<view class="card">
|
||||||
<u-form-item borderBottom label="上传行驶证自动识别" labelWidth="200">
|
<u-form-item borderBottom label="上传行驶证自动识别" labelWidth="200">
|
||||||
<u-upload
|
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1"
|
||||||
:fileList="fileList1"
|
:maxCount="1" multiple></u-upload>
|
||||||
@afterRead="afterRead"
|
|
||||||
@delete="deletePic"
|
|
||||||
name="1"
|
|
||||||
:maxCount="1"
|
|
||||||
multiple
|
|
||||||
></u-upload>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item borderBottom label="车牌号" labelWidth="200" @click="carInputClick();">
|
<u-form-item borderBottom label="车牌号" labelWidth="200" @click="carInputClick();">
|
||||||
<u-input
|
<u-input @click="carInputClick();" v-model="car.licenseNumber" border="none" disabled
|
||||||
@click="carInputClick();"
|
disabledColor="#ffffff" placeholder="请输入车牌号"></u-input>
|
||||||
v-model="car.licenseNumber"
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
||||||
border="none"
|
|
||||||
disabled
|
|
||||||
disabledColor="#ffffff"
|
|
||||||
placeholder="请输入车牌号"
|
|
||||||
></u-input>
|
|
||||||
<u-icon
|
|
||||||
slot="right"
|
|
||||||
name="arrow-right"
|
|
||||||
></u-icon>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<!-- @click="brandType = true;"-->
|
<!-- @click="brandType = true;"-->
|
||||||
<u-form-item label="车辆品牌" labelWidth="200">
|
<u-form-item label="车辆品牌" labelWidth="200">
|
||||||
<song-data-picker
|
<song-data-picker ref="songpicker" style=" width: 100%;" :localdata="brandList"
|
||||||
ref="songpicker"
|
popup-title="请选择品牌" :openSearch="true" @change="onchange"
|
||||||
style=" width: 100%;"
|
@nodeclick="onnodeclick"></song-data-picker>
|
||||||
:localdata="brandList"
|
|
||||||
popup-title="请选择品牌"
|
|
||||||
:openSearch="true"
|
|
||||||
@change="onchange"
|
|
||||||
@nodeclick="onnodeclick"
|
|
||||||
></song-data-picker>
|
|
||||||
<!-- <picker @change="picker($event)" :value="arrayIndex" :range="brandList" range-key="brandName" v-if="brandList">-->
|
<!-- <picker @change="picker($event)" :value="arrayIndex" :range="brandList" range-key="brandName" v-if="brandList">-->
|
||||||
<!-- <view class="uni-input">{{ brandList && brandList[arrayIndex] ? brandList[arrayIndex].brandName : '' }}</view>-->
|
<!-- <view class="uni-input">{{ brandList && brandList[arrayIndex] ? brandList[arrayIndex].brandName : '' }}</view>-->
|
||||||
<!-- </picker>-->
|
<!-- </picker>-->
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="车辆型号" labelWidth="200">
|
<u-form-item label="车辆型号" labelWidth="200">
|
||||||
<u-input
|
<u-input v-model="car.carModel" border="none" placeholder="请输入车辆型号"></u-input>
|
||||||
v-model="car.carModel"
|
|
||||||
border="none"
|
|
||||||
placeholder="请输入车辆型号"
|
|
||||||
></u-input>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item v-if="natureList.length>0" class="formItem" label="车辆性质" labelWidth="200">
|
<u-form-item v-if="natureList.length>0" class="formItem" label="车辆性质" labelWidth="200">
|
||||||
<picker @change="natureChange" :value="natureIndex" :range="natureList" range-key="value" v-if="natureList">
|
<picker @change="natureChange" :value="natureIndex" :range="natureList" range-key="value"
|
||||||
|
v-if="natureList">
|
||||||
<view class="uni-input">{{ natureList[natureIndex].value}}</view>
|
<view class="uni-input">{{ natureList[natureIndex].value}}</view>
|
||||||
</picker>
|
</picker>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
@ -83,43 +57,20 @@
|
|||||||
<u-input v-model="car.engineNumber" border="none" placeholder="请输入发动机号"></u-input>
|
<u-input v-model="car.engineNumber" border="none" placeholder="请输入发动机号"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item borderBottom label="年检到期时间" labelWidth="200" @click="openDatePicker('nj'); ">
|
<u-form-item borderBottom label="年检到期时间" labelWidth="200" @click="openDatePicker('nj'); ">
|
||||||
<u-input
|
<u-input v-model="car.nextInspectionDate" border="none" disabled disabledColor="#ffffff"
|
||||||
v-model="car.nextInspectionDate"
|
placeholder="请选择年检到期时间"></u-input>
|
||||||
border="none"
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
||||||
disabled
|
|
||||||
disabledColor="#ffffff"
|
|
||||||
placeholder="请选择年检到期时间"
|
|
||||||
></u-input>
|
|
||||||
<u-icon
|
|
||||||
slot="right"
|
|
||||||
name="arrow-right"
|
|
||||||
></u-icon>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item borderBottom label="保险到期时间" labelWidth="200" @click="openDatePicker('bx'); hideKeyboard()">
|
<u-form-item borderBottom label="保险到期时间" labelWidth="200"
|
||||||
<u-input
|
@click="openDatePicker('bx'); hideKeyboard()">
|
||||||
v-model="car.insuranceExpiryDate"
|
<u-input v-model="car.insuranceExpiryDate" border="none" disabled disabledColor="#ffffff"
|
||||||
border="none"
|
placeholder="请选择保险到期时间"></u-input>
|
||||||
disabled
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
||||||
disabledColor="#ffffff"
|
|
||||||
placeholder="请选择保险到期时间"
|
|
||||||
></u-input>
|
|
||||||
<u-icon
|
|
||||||
slot="right"
|
|
||||||
name="arrow-right"
|
|
||||||
></u-icon>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="注册日期时间" labelWidth="200" @click="openDatePicker('zcrq'); hideKeyboard()">
|
<u-form-item label="注册日期时间" labelWidth="200" @click="openDatePicker('zcrq'); hideKeyboard()">
|
||||||
<u-input
|
<u-input v-model="car.carRegisterDate" border="none" disabled disabledColor="#ffffff"
|
||||||
v-model="car.carRegisterDate"
|
placeholder="请选择注册日期时间"></u-input>
|
||||||
border="none"
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
||||||
disabled
|
|
||||||
disabledColor="#ffffff"
|
|
||||||
placeholder="请选择注册日期时间"
|
|
||||||
></u-input>
|
|
||||||
<u-icon
|
|
||||||
slot="right"
|
|
||||||
name="arrow-right"
|
|
||||||
></u-icon>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</view>
|
</view>
|
||||||
</u-form>
|
</u-form>
|
||||||
@ -127,15 +78,9 @@
|
|||||||
|
|
||||||
<keyboard-plate ref="plateNumber" :plateNum.sync='car.licenseNumber' isShow
|
<keyboard-plate ref="plateNumber" :plateNum.sync='car.licenseNumber' isShow
|
||||||
@change="getPlateNum"></keyboard-plate>
|
@change="getPlateNum"></keyboard-plate>
|
||||||
<u-datetime-picker
|
<u-datetime-picker v-model="datePickerValue" :formatter="formatter" :show="datePickerShow"
|
||||||
v-model="datePickerValue"
|
:minDate="minDate" mode="date" @cancel="datePickerCancel"
|
||||||
:formatter="formatter"
|
@confirm="datePickerConfirm"></u-datetime-picker>
|
||||||
:show="datePickerShow"
|
|
||||||
:minDate="minDate"
|
|
||||||
mode="date"
|
|
||||||
@cancel="datePickerCancel"
|
|
||||||
@confirm="datePickerConfirm"
|
|
||||||
></u-datetime-picker>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="footer">
|
<view class="footer">
|
||||||
<view class="btnItem edit" @click="submit">
|
<view class="btnItem edit" @click="submit">
|
||||||
@ -150,7 +95,10 @@ import VNavigationBar from '@/components/VNavigationBar.vue';
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
import upload from "@/utils/upload";
|
import upload from "@/utils/upload";
|
||||||
import {getDictByCode,formatDate} from "@/utils/utils";
|
import {
|
||||||
|
getDictByCode,
|
||||||
|
formatDate
|
||||||
|
} from "@/utils/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -231,8 +179,7 @@ export default {
|
|||||||
onnodeclick(node) {
|
onnodeclick(node) {
|
||||||
console.log(node, "node")
|
console.log(node, "node")
|
||||||
},
|
},
|
||||||
typeSelect(e) {
|
typeSelect(e) {},
|
||||||
},
|
|
||||||
// 车辆性质选择事件
|
// 车辆性质选择事件
|
||||||
natureChange(event) {
|
natureChange(event) {
|
||||||
const newIndex = event.detail.value;
|
const newIndex = event.detail.value;
|
||||||
@ -282,7 +229,9 @@ export default {
|
|||||||
}
|
}
|
||||||
this.datePickerShow = true
|
this.datePickerShow = true
|
||||||
},
|
},
|
||||||
datePickerConfirm({value}, field, picker) {
|
datePickerConfirm({
|
||||||
|
value
|
||||||
|
}, field, picker) {
|
||||||
let date;
|
let date;
|
||||||
|
|
||||||
// 检查 value 是否为时间戳
|
// 检查 value 是否为时间戳
|
||||||
@ -299,7 +248,8 @@ export default {
|
|||||||
console.error('Invalid date:', value);
|
console.error('Invalid date:', value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.car[this.pickerConfirmField] = date.getFullYear() + '-' + (Number(date.getMonth()) + 1 + '').padStart(2, '0') + '-' + (date.getDate() + '').padStart(2, '0')
|
this.car[this.pickerConfirmField] = date.getFullYear() + '-' + (Number(date.getMonth()) + 1 + '').padStart(
|
||||||
|
2, '0') + '-' + (date.getDate() + '').padStart(2, '0')
|
||||||
this.datePickerCancel(picker)
|
this.datePickerCancel(picker)
|
||||||
},
|
},
|
||||||
datePickerCancel(picker) {
|
datePickerCancel(picker) {
|
||||||
@ -389,7 +339,9 @@ export default {
|
|||||||
request({
|
request({
|
||||||
url: '/admin-api/system/dict-data/type',
|
url: '/admin-api/system/dict-data/type',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params:{type:"car_nature"}
|
params: {
|
||||||
|
type: "car_nature"
|
||||||
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
@ -462,15 +414,22 @@ export default {
|
|||||||
data: this.imageUrl,
|
data: this.imageUrl,
|
||||||
tenantIdFlag: false
|
tenantIdFlag: false
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
// 如果客户名称为空 赋值
|
||||||
|
if (this.userInfo.cusName == '' || this.userInfo.cusName ==
|
||||||
|
undefined) {
|
||||||
|
this.userInfo.cusName = res.data.owner
|
||||||
|
}
|
||||||
this.car.vin = res.data.vin
|
this.car.vin = res.data.vin
|
||||||
this.car.licenseNumber = res.data.plateNo
|
this.car.licenseNumber = res.data.plateNo
|
||||||
this.car.carRegisterDate = res.data.issueDate
|
this.car.carRegisterDate = res.data.issueDate
|
||||||
this.car.engineNumber = res.data.engineNo
|
this.car.engineNumber = res.data.engineNo
|
||||||
if (this.car.insuranceExpiryDate) {
|
if (this.car.insuranceExpiryDate) {
|
||||||
this.car.insuranceExpiryDate= formatDate(this.car.insuranceExpiryDate)
|
this.car.insuranceExpiryDate = formatDate(this.car
|
||||||
|
.insuranceExpiryDate)
|
||||||
}
|
}
|
||||||
if (this.car.nextInspectionDate) {
|
if (this.car.nextInspectionDate) {
|
||||||
this.car.nextInspectionDate= formatDate(this.car.nextInspectionDate)
|
this.car.nextInspectionDate = formatDate(this.car
|
||||||
|
.nextInspectionDate)
|
||||||
}
|
}
|
||||||
//车辆品牌自动定位
|
//车辆品牌自动定位
|
||||||
this.brandList.forEach((item, index) => {
|
this.brandList.forEach((item, index) => {
|
||||||
@ -499,7 +458,10 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.brandId = id
|
this.brandId = id
|
||||||
this.brandName = name
|
this.brandName = name
|
||||||
this.$refs.songpicker.inputSelected=[{text:name,value:id}]
|
this.$refs.songpicker.inputSelected = [{
|
||||||
|
text: name,
|
||||||
|
value: id
|
||||||
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -507,8 +469,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@ -5,53 +5,29 @@
|
|||||||
<u-form labelPosition="top">
|
<u-form labelPosition="top">
|
||||||
<view class="card">
|
<view class="card">
|
||||||
<u-form-item borderBottom label="上传图片" labelWidth="200">
|
<u-form-item borderBottom label="上传图片" labelWidth="200">
|
||||||
<u-upload
|
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1"
|
||||||
:fileList="fileList1"
|
:maxCount="1" multiple></u-upload>
|
||||||
@afterRead="afterRead"
|
|
||||||
@delete="deletePic"
|
|
||||||
name="1"
|
|
||||||
:maxCount="1"
|
|
||||||
multiple
|
|
||||||
></u-upload>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item borderBottom label="车牌号" labelWidth="200" @click="carInputClick();">
|
<u-form-item borderBottom label="车牌号" labelWidth="200" @click="carInputClick();">
|
||||||
<u-input
|
<u-input @click="carInputClick();" v-model="car.licenseNumber" border="none" disabled
|
||||||
@click="carInputClick();"
|
disabledColor="#ffffff" placeholder="请输入车牌号"></u-input>
|
||||||
v-model="car.licenseNumber"
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
||||||
border="none"
|
|
||||||
disabled
|
|
||||||
disabledColor="#ffffff"
|
|
||||||
placeholder="请输入车牌号"
|
|
||||||
></u-input>
|
|
||||||
<u-icon
|
|
||||||
slot="right"
|
|
||||||
name="arrow-right"
|
|
||||||
></u-icon>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<!-- @click="brandType = true;"-->
|
<!-- @click="brandType = true;"-->
|
||||||
<u-form-item label="车辆品牌" labelWidth="200">
|
<u-form-item label="车辆品牌" labelWidth="200">
|
||||||
<song-data-picker
|
<song-data-picker ref="songpicker" style=" width: 100%;" :localdata="brandList"
|
||||||
ref="songpicker"
|
popup-title="请选择品牌" :openSearch="true" @change="onchange"
|
||||||
style=" width: 100%;"
|
@nodeclick="onnodeclick"></song-data-picker>
|
||||||
:localdata="brandList"
|
|
||||||
popup-title="请选择品牌"
|
|
||||||
:openSearch="true"
|
|
||||||
@change="onchange"
|
|
||||||
@nodeclick="onnodeclick"
|
|
||||||
></song-data-picker>
|
|
||||||
<!-- <picker @change="picker($event)" :value="arrayIndex" :range="brandList" range-key="brandName" v-if="brandList">-->
|
<!-- <picker @change="picker($event)" :value="arrayIndex" :range="brandList" range-key="brandName" v-if="brandList">-->
|
||||||
<!-- <view class="uni-input">{{ brandList && brandList[arrayIndex] ? brandList[arrayIndex].brandName : '' }}</view>-->
|
<!-- <view class="uni-input">{{ brandList && brandList[arrayIndex] ? brandList[arrayIndex].brandName : '' }}</view>-->
|
||||||
<!-- </picker>-->
|
<!-- </picker>-->
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="车辆型号" labelWidth="200">
|
<u-form-item label="车辆型号" labelWidth="200">
|
||||||
<u-input
|
<u-input v-model="car.carModel" border="none" placeholder="请输入车辆型号"></u-input>
|
||||||
v-model="car.carModel"
|
|
||||||
border="none"
|
|
||||||
placeholder="请输入车辆型号"
|
|
||||||
></u-input>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item class="formItem" label="车辆性质" labelWidth="200">
|
<u-form-item class="formItem" label="车辆性质" labelWidth="200">
|
||||||
<picker @change="natureChange" :value="natureIndex" :range="natureList" range-key="value" v-if="natureList">
|
<picker @change="natureChange" :value="natureIndex" :range="natureList" range-key="value"
|
||||||
|
v-if="natureList">
|
||||||
<view class="uni-input">{{ natureList[natureIndex].value}}</view>
|
<view class="uni-input">{{ natureList[natureIndex].value}}</view>
|
||||||
</picker>
|
</picker>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
@ -65,43 +41,20 @@
|
|||||||
<u-input v-model="car.engineNumber" border="none" placeholder="请输入发动机号"></u-input>
|
<u-input v-model="car.engineNumber" border="none" placeholder="请输入发动机号"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item borderBottom label="年检到期时间" labelWidth="200" @click="openDatePicker('nj'); ">
|
<u-form-item borderBottom label="年检到期时间" labelWidth="200" @click="openDatePicker('nj'); ">
|
||||||
<u-input
|
<u-input v-model="car.nextInspectionDate" border="none" disabled disabledColor="#ffffff"
|
||||||
v-model="car.nextInspectionDate"
|
placeholder="请选择年检到期时间"></u-input>
|
||||||
border="none"
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
||||||
disabled
|
|
||||||
disabledColor="#ffffff"
|
|
||||||
placeholder="请选择年检到期时间"
|
|
||||||
></u-input>
|
|
||||||
<u-icon
|
|
||||||
slot="right"
|
|
||||||
name="arrow-right"
|
|
||||||
></u-icon>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item borderBottom label="保险到期时间" labelWidth="200" @click="openDatePicker('bx'); hideKeyboard()">
|
<u-form-item borderBottom label="保险到期时间" labelWidth="200"
|
||||||
<u-input
|
@click="openDatePicker('bx'); hideKeyboard()">
|
||||||
v-model="car.insuranceExpiryDate"
|
<u-input v-model="car.insuranceExpiryDate" border="none" disabled disabledColor="#ffffff"
|
||||||
border="none"
|
placeholder="请选择保险到期时间"></u-input>
|
||||||
disabled
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
||||||
disabledColor="#ffffff"
|
|
||||||
placeholder="请选择保险到期时间"
|
|
||||||
></u-input>
|
|
||||||
<u-icon
|
|
||||||
slot="right"
|
|
||||||
name="arrow-right"
|
|
||||||
></u-icon>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="注册日期时间" labelWidth="200" @click="openDatePicker('zcrq'); hideKeyboard()">
|
<u-form-item label="注册日期时间" labelWidth="200" @click="openDatePicker('zcrq'); hideKeyboard()">
|
||||||
<u-input
|
<u-input v-model="car.carRegisterDate" border="none" disabled disabledColor="#ffffff"
|
||||||
v-model="car.carRegisterDate"
|
placeholder="请选择注册日期时间"></u-input>
|
||||||
border="none"
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
||||||
disabled
|
|
||||||
disabledColor="#ffffff"
|
|
||||||
placeholder="请选择注册日期时间"
|
|
||||||
></u-input>
|
|
||||||
<u-icon
|
|
||||||
slot="right"
|
|
||||||
name="arrow-right"
|
|
||||||
></u-icon>
|
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</view>
|
</view>
|
||||||
</u-form>
|
</u-form>
|
||||||
@ -109,15 +62,8 @@
|
|||||||
|
|
||||||
<keyboard-plate ref="plateNumber" :plateNum.sync='car.licenseNumber' isShow
|
<keyboard-plate ref="plateNumber" :plateNum.sync='car.licenseNumber' isShow
|
||||||
@change="getPlateNum"></keyboard-plate>
|
@change="getPlateNum"></keyboard-plate>
|
||||||
<u-datetime-picker
|
<u-datetime-picker v-model="datePickerValue" :formatter="formatter" :show="datePickerShow" mode="date"
|
||||||
v-model="datePickerValue"
|
:minDate="minDate" @cancel="datePickerCancel" @confirm="datePickerConfirm"></u-datetime-picker>
|
||||||
:formatter="formatter"
|
|
||||||
:show="datePickerShow"
|
|
||||||
mode="date"
|
|
||||||
:minDate="minDate"
|
|
||||||
@cancel="datePickerCancel"
|
|
||||||
@confirm="datePickerConfirm"
|
|
||||||
></u-datetime-picker>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="footer">
|
<view class="footer">
|
||||||
<view class="btnItem edit" @click="submit">
|
<view class="btnItem edit" @click="submit">
|
||||||
@ -131,9 +77,14 @@
|
|||||||
import VNavigationBar from '@/components/VNavigationBar.vue';
|
import VNavigationBar from '@/components/VNavigationBar.vue';
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
import {bus} from "@/utils/eventBus";
|
import {
|
||||||
|
bus
|
||||||
|
} from "@/utils/eventBus";
|
||||||
import upload from "@/utils/upload";
|
import upload from "@/utils/upload";
|
||||||
import {getDictByCode,formatDate} from "@/utils/utils";
|
import {
|
||||||
|
getDictByCode,
|
||||||
|
formatDate
|
||||||
|
} from "@/utils/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -233,8 +184,7 @@ export default {
|
|||||||
onnodeclick(node) {
|
onnodeclick(node) {
|
||||||
console.log(node, "node")
|
console.log(node, "node")
|
||||||
},
|
},
|
||||||
typeSelect(e) {
|
typeSelect(e) {},
|
||||||
},
|
|
||||||
// 车辆性质选择事件
|
// 车辆性质选择事件
|
||||||
natureChange(event) {
|
natureChange(event) {
|
||||||
const newIndex = event.detail.value;
|
const newIndex = event.detail.value;
|
||||||
@ -284,7 +234,9 @@ export default {
|
|||||||
}
|
}
|
||||||
this.datePickerShow = true
|
this.datePickerShow = true
|
||||||
},
|
},
|
||||||
datePickerConfirm({value}, field, picker) {
|
datePickerConfirm({
|
||||||
|
value
|
||||||
|
}, field, picker) {
|
||||||
let date;
|
let date;
|
||||||
|
|
||||||
// 检查 value 是否为时间戳
|
// 检查 value 是否为时间戳
|
||||||
@ -301,7 +253,8 @@ export default {
|
|||||||
console.error('Invalid date:', value);
|
console.error('Invalid date:', value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.car[this.pickerConfirmField] = date.getFullYear() + '-' + (Number(date.getMonth()) + 1 + '').padStart(2, '0') + '-' + (date.getDate() + '').padStart(2, '0')
|
this.car[this.pickerConfirmField] = date.getFullYear() + '-' + (Number(date.getMonth()) + 1 + '').padStart(
|
||||||
|
2, '0') + '-' + (date.getDate() + '').padStart(2, '0')
|
||||||
this.datePickerCancel(picker)
|
this.datePickerCancel(picker)
|
||||||
},
|
},
|
||||||
datePickerCancel(picker) {
|
datePickerCancel(picker) {
|
||||||
@ -323,6 +276,8 @@ export default {
|
|||||||
// 新增
|
// 新增
|
||||||
async submit() {
|
async submit() {
|
||||||
this.car.brandAndModel = [this.brandId, this.car.carModel]
|
this.car.brandAndModel = [this.brandId, this.car.carModel]
|
||||||
|
this.car.carBrand = this.brandId
|
||||||
|
this.car.carModel = this.carModel
|
||||||
//将日期转为时间戳
|
//将日期转为时间戳
|
||||||
if (this.car.nextInspectionDate) {
|
if (this.car.nextInspectionDate) {
|
||||||
this.car.nextInspectionDate = new Date(this.car.nextInspectionDate).getTime()
|
this.car.nextInspectionDate = new Date(this.car.nextInspectionDate).getTime()
|
||||||
@ -339,44 +294,52 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.car.carRegisterDate = undefined
|
this.car.carRegisterDate = undefined
|
||||||
}
|
}
|
||||||
console.log(this.car,"car")
|
this.userInfo.car = this.car
|
||||||
if (this.car.id != null) {
|
|
||||||
request({
|
request({
|
||||||
url: '/admin-api/base/carMain/update',
|
url: '/admin-api/base/custom/saveCustomerAndCar',
|
||||||
method: 'PUT',
|
method: 'post',
|
||||||
data: this.car,
|
data: this.userInfo
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
bus.$emit('updateCarInfo', this.car.id)
|
bus.$emit('updateCarInfo', this.car.id)
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
})
|
})
|
||||||
} else {
|
// if (this.car.id != null) {
|
||||||
request({
|
// request({
|
||||||
url: '/admin-api/base/carMain/create',
|
// url: '/admin-api/base/carMain/update',
|
||||||
method: 'POST',
|
// method: 'PUT',
|
||||||
data: this.car,
|
// data: this.car,
|
||||||
}).then(res => {
|
// }).then(res => {
|
||||||
request({
|
// bus.$emit('updateCarInfo', this.car.id)
|
||||||
url: '/admin-api/base/carMain/page',
|
// uni.navigateBack();
|
||||||
method: 'GET',
|
// })
|
||||||
params: {
|
// } else {
|
||||||
licenseNumber: this.car.licenseNumber
|
// request({
|
||||||
}
|
// url: '/admin-api/base/custom/saveCustomerAndCar',
|
||||||
}).then(res => {
|
// method: 'POST',
|
||||||
this.car = res.data.records[0]
|
// data: this.car,
|
||||||
request({
|
// }).then(res => {
|
||||||
url: '/admin-api/base/custom/bindCustomerCar',
|
// request({
|
||||||
method: 'post',
|
// url: '/admin-api/base/carMain/page',
|
||||||
data: {
|
// method: 'GET',
|
||||||
carList: [this.car],
|
// params: {
|
||||||
id: this.userInfo.id
|
// licenseNumber: this.car.licenseNumber
|
||||||
}
|
// }
|
||||||
}).then(res => {
|
// }).then(res => {
|
||||||
uni.navigateBack();
|
// this.car = res.data.records[0]
|
||||||
})
|
// request({
|
||||||
})
|
// url: '/admin-api/base/custom/bindCustomerCar',
|
||||||
|
// method: 'post',
|
||||||
|
// data: {
|
||||||
|
// carList: [this.car],
|
||||||
|
// id: this.userInfo.id
|
||||||
|
// }
|
||||||
|
// }).then(res => {
|
||||||
|
// uni.navigateBack();
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
// 查询下拉 车辆性质
|
// 查询下拉 车辆性质
|
||||||
async getNatureList() {
|
async getNatureList() {
|
||||||
@ -480,7 +443,10 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.brandId = id
|
this.brandId = id
|
||||||
this.brandName = name
|
this.brandName = name
|
||||||
this.$refs.songpicker.inputSelected=[{text:name,value:id}]
|
this.$refs.songpicker.inputSelected = [{
|
||||||
|
text: name,
|
||||||
|
value: id
|
||||||
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -488,8 +454,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user