This commit is contained in:
binbin_pan 2025-01-17 19:35:38 +08:00
parent f8e8dd339b
commit eec42076e8
10 changed files with 465 additions and 346 deletions

View File

@ -3,8 +3,8 @@ import request from '@/utils/request';
// 到货确认单-列表
export function getOutPageList(data) {
return request({
url: '/app/aapController/getOutPageList',
method: 'post',
url: '/gz_car/app/aapController/getOutPageList',
method: 'get',
data
});
}
@ -12,7 +12,7 @@ export function getOutPageList(data) {
// 到货确认单-上传
export function uploadFile(data) {
return request({
url: '/app/aapController/uploadFile',
url: '/gz_car/app/aapController/uploadFile',
method: 'post',
data
});
@ -21,7 +21,7 @@ export function uploadFile(data) {
// 到货确认单-计划详情
export function getDispatchCarListData(data) {
return request({
url: '/app/aapController/getDispatchCarListData',
url: '/gz_car/app/aapController/getDispatchCarListData',
method: 'post',
data
});
@ -30,7 +30,7 @@ export function getDispatchCarListData(data) {
// 到货确认单-派车详情
export function getDispatchCarData(data) {
return request({
url: '/app/aapController/getDispatchCarData',
url: '/gz_car/app/aapController/getDispatchCarData',
method: 'post',
data
});
@ -39,8 +39,8 @@ export function getDispatchCarData(data) {
// 派车分配-列表
export function getPlanList(data) {
return request({
url: '/app/aapController/getPlanList',
method: 'post',
url: '/gz_car/app/aapController/getPlanList',
method: 'get',
data
});
}
@ -48,7 +48,7 @@ export function getPlanList(data) {
// 派车分配-供应商-列表
export function getContractSupList(data) {
return request({
url: '/app/aapController/getContractSupList',
url: '/gz_car/app/aapController/getContractSupList',
method: 'post',
data
});
@ -57,7 +57,7 @@ export function getContractSupList(data) {
// 派车分配-供应商-分配
export function addPlanSupInfo(data) {
return request({
url: '/app/aapController/addPlanSupInfo',
url: '/gz_car/app/aapController/addPlanSupInfo',
method: 'post',
data
});
@ -66,7 +66,7 @@ export function addPlanSupInfo(data) {
// 派车分配-详情
export function getPlanDetails(data) {
return request({
url: '/app/aapController/getPlanDetails',
url: '/gz_car/app/aapController/getPlanDetails',
method: 'post',
data
});
@ -75,8 +75,8 @@ export function getPlanDetails(data) {
// 派车审核-列表
export function getAuditList(data) {
return request({
url: '/app/aapController/getAuditList',
method: 'post',
url: '/gz_car/app/aapController/getAuditList',
method: 'get',
data
});
}
@ -84,7 +84,7 @@ export function getAuditList(data) {
// 派车审核-审核
export function dispatchAudit(data) {
return request({
url: '/app/aapController/dispatchAudit',
url: '/gz_car/app/aapController/dispatchAudit',
method: 'post',
data
});
@ -93,16 +93,16 @@ export function dispatchAudit(data) {
// 派车审核-详情
export function getOutDetails(data) {
return request({
url: '/app/aapController/getOutDetails',
url: '/gz_car/app/aapController/getOutDetails',
method: 'post',
data
});
}
// 派车审核-审核记录
export function getAuditRecord(data) {
export function getAuditDetails(data) {
return request({
url: '/app/aapController/getAuditRecord',
url: '/gz_car/app/aapController/getAuditDetails',
method: 'post',
data
});

View File

@ -3,7 +3,7 @@ import request from '@/utils/request';
// 登录方法
export function login(data) {
return request({
url: '/login/appUserLogin', // login - ruoyi
url: '/gz_car/login/appUserLogin', // login - ruoyi
headers: {
isToken: false,
'Content-Type': 'application/x-www-form-urlencoded'

View File

@ -1,12 +1,14 @@
// 应用全局配置
module.exports = {
// baseUrl: 'https://vue.ruoyi.vip/prod-api',
baseUrl: 'http://192.168.0.39:21522/gz_car', // 车辆
baseUrl: 'http://192.168.0.38:21522', // 车辆
// baseUrl: 'http://192.168.0.14:21520',
// baseUrl: 'http://localhost:8080',
uploadFileUrl: '/app/common/appUploadFile',
uploadFileUrlGzCar: '/app/aapController/appUploadFile',
// fileUrl: 'http://192.168.0.39:21995/statics', // 图片预览
fileUrl: 'http://192.168.0.14:21520/statics', // 图片预览
fileUrlGzCar: 'http://192.168.0.38:21522/gz_car/statics', // 图片预览
// 应用信息
appInfo: {
// 应用名称

View File

@ -15,11 +15,11 @@
<div class="list-cont" v-for="(item, index) in tableList" :key="index" @click="handleDetail(item)">
<u-row justify="space-between" customStyle="margin-bottom: 10px; padding: 0 15px;">
<u-col span="6">
<div>{{ item.name }}</div>
<div>{{ item.code }}</div>
</u-col>
<u-col span="6">
<div style="display: flex; justify-content: flex-end">
<u-tag text="已上传" type="success" v-if="item.imgList && item.imgList.length > 0"></u-tag>
<u-tag text="已上传" type="success" v-if="item.fileList && item.fileList.length > 0"></u-tag>
<u-tag text="待上传" type="warning" v-else></u-tag>
</div>
</u-col>
@ -32,21 +32,21 @@
<div class="list-item df-item">
<div>
<span>派车数量</span>
<span style="color: #5ae725">{{ item.pcNum }}</span>
<span style="color: #5ae725">{{ item.dispatchNum }}</span>
</div>
<div>
<u-tag
v-if="item.imgList && item.imgList.length > 0"
v-if="item.fileList && item.fileList.length > 0"
text="查看到货确认单"
type="info"
@click="openImgModal(item)"
@click="openImgModal(item, 1)"
></u-tag>
<u-tag v-else type="primary" text="上传到货确认单" @click="openImgModal"></u-tag>
<u-tag v-else type="primary" text="上传到货确认单" @click="openImgModal(item, 2)"></u-tag>
</div>
</div>
<div class="list-item">
<span>派车时间</span>
<span style="color: #f9ae3d">{{ item.time }}</span>
<span style="color: #f9ae3d">{{ item.outTime }}</span>
</div>
</div>
@ -70,16 +70,23 @@
<!-- 空状态 -->
<u-empty v-if="tableList.length == 0" mode="data"></u-empty>
<u-loading-page bg-color="#e8e8e8" :loading="isLoading"></u-loading-page>
</view>
</template>
<script>
import { pathToBase64, base64ToPath } from 'image-tools'
import { getOutPageList, uploadFile } from '@/api/carManage'
import config from '@/config'
export default {
data() {
return {
isLoading: false,
actionUrl: config.baseUrl + '/gz_car' + config.uploadFileUrlGzCar,
token: uni.getStorageSync('App-Token'),
row: {},
imgModal: false,
readonly: false,
imgModelTitle: '',
@ -90,26 +97,7 @@ export default {
pageNum: 1,
pageSize: 10,
total: 0,
tableList: [
{
name: '张三',
proName: '项目名称',
pcNum: 10,
time: '2021-08-01',
imgList: []
},
{
name: '李四',
proName: '项目名称',
pcNum: 20,
time: '2021-08-01',
imgList: [
{
url: 'https://img.yzcdn.cn/vant/cat.jpeg'
}
]
}
]
tableList: []
}
},
onLoad() {
@ -123,15 +111,15 @@ export default {
async getList() {
try {
const params = {
encryptedData: JSON.stringify({ keyWord: this.keyWord }),
encryptedData: JSON.stringify({ keyWord: this.keyWord.trim() }),
pageNum: this.pageNum,
pageSize: this.pageSize
}
console.log('🚀 ~ getList ~ params', params)
const res = await getOutPageList(params)
console.log('🚀 ~ getList ~ res', res)
this.tableList = res.data.list
this.total = res.data.total
this.tableList = res.list
this.total = res.total
} catch (error) {
console.log('🚀 ~ getList ~ error', error)
}
@ -152,12 +140,18 @@ export default {
console.log('加载..', this.pageSize)
},
//
openImgModal(item) {
openImgModal(item, type) {
this.row = item
console.log('🚀 ~ openImgModal ~ this.row:', this.row)
this.imgModal = true
if (item) {
if (type == 1) {
this.readonly = true
this.imgModelTitle = '查看到货确认单照片'
this.imgList = item.imgList
this.imgList = item.fileList
this.imgList.forEach((img, index) => {
img.url = config.fileUrlGzCar + img.fileUrl + '?token=' + this.token
})
console.log('🚀 ~ openImgModal ~ this.imgList', this.imgList)
} else {
this.readonly = false
this.imgModelTitle = '上传到货确认单照片'
@ -170,6 +164,7 @@ export default {
this.imgList.push(file)
})
console.log('🚀 ~ selectImg ~ this.imgList:', this.imgList)
// this.upload(e.tempFiles[0].path)
},
deleteImg(e) {
console.log('🚀 ~ deleteImg ~ e:', e)
@ -178,46 +173,75 @@ export default {
},
uploadImg() {
console.log('🚀 ~ uploadImg ~ this.imgList:', this.imgList)
this.imgModal = false
if (this.imgList.length == 0) {
uni.showToast({
title: '请上传图片',
icon: 'none'
})
return
}
this.isLoading = true
console.log('🚀 ~ uploadImg ~ this.imgList:', this.imgList)
const uploadPromises = this.imgList.map(img => {
const path = img.path
console.log('🚀 ~ uploadImg ~ path:', path)
return this.upload(path) // this.upload Promise
})
Promise.all(uploadPromises)
.then(() => {
this.isLoading = false
console.log('所有图片上传成功')
uni.showToast({
title: '上传成功',
icon: 'success'
})
setTimeout(() => {
this.imgModal = false
this.getList()
}, 1000)
})
.catch(error => {
this.isLoading = false
console.error('图片上传失败', error)
uni.showToast({
title: '上传失败,请重试',
icon: 'none'
})
})
},
upload(path) {
uni.uploadFile({
url: this.actionUrl,
filePath: path,
name: 'file',
header: {
Authorization: this.token
},
success: res => {
console.log('🚀 ~ selectImg ~ res:', res)
console.log('🚀 ~ selectImg ~ res--data:', JSON.parse(res.data).data)
this.uploadPaths.push(JSON.parse(res.data).data)
},
fail: err => {
console.log('🚀 ~ selectImg ~ err:', err)
}
})
},
// base64
imgToBase64(data) {
return new Promise((resolve, reject) => {
pathToBase64(data)
.then(base64 => {
resolve(base64)
})
.catch(error => {
console.error(error)
reject(error)
})
uni.uploadFile({
url: this.actionUrl,
filePath: path,
name: 'file',
header: {
Authorization: this.token
},
formData: {
id: this.row.id
},
success: res => {
console.log('🚀 ~ selectImg ~ res:', res)
console.log('🚀 ~ selectImg ~ res--data:', JSON.parse(res.data))
resolve(res)
},
fail: err => {
console.log('🚀 ~ selectImg ~ err:', err)
reject(err)
}
})
})
},
handleDetail(item) {
console.log('🚀 ~ handleDetail ~ item', item)
const params = {
...item,
isDetail: true,
//
isArrival: true,
active: 1
active: 1,
}
uni.navigateTo({
url: `/pages/sendACarSystem/details?params=${JSON.stringify(params)}`

View File

@ -17,12 +17,12 @@
<div class="item-cont">
<div><u-icon name="/static/images/user.png" size="36" style="margin-right: 5px"></u-icon></div>
<div>
<div style="margin-bottom: 15px;">
<div style="margin-bottom: 15px">
<span>{{ item.name }}</span>
<span style="margin-right: 10px">{{ item.phone }}</span>
<span style="color: #bbb;">{{ item.company }}</span>
<span style="color: #bbb">{{ item.supName }}</span>
</div>
<div style="margin-bottom: 6px;">{{ item.content }}</div>
<div style="margin-bottom: 6px">{{ item.content }}</div>
<div>备注{{ item.remark }}</div>
</div>
</div>
@ -32,6 +32,8 @@
</template>
<script>
import { getAuditDetails } from '@/api/carManage'
export default {
props: {
opt: {
@ -42,47 +44,36 @@ export default {
data() {
return {
tableList: [
{
date: '08-01',
time: '2021-08-01 08:00',
content: '审核通过',
remark: '这是备注111',
name: '张三',
phone: '13888888888',
company: '机具公司'
},
{
date: '08-01',
time: '2021-08-01 08:00',
content: '审核通过',
remark: '这是备注222',
name: '李四',
phone: '13888888888',
company: '机具公司'
},
{
date: '08-01',
time: '2021-08-01 08:00',
content: '审核通过',
remark: '这是备注333',
name: '王五',
phone: '13888888888',
company: '机具公司'
},
{
date: '08-01',
time: '2021-08-01 08:00',
content: '审核通过',
remark: '这是备注444',
name: '赵六',
phone: '13888888888',
company: '机具公司'
}
// {
// date: '08-01',
// time: '2021-08-01 08:00',
// content: '',
// remark: '111',
// name: '',
// phone: '13888888888',
// company: ''
// },
]
}
},
mounted() {
console.log('🚀 ~ 详情 ~ this.opt', this.opt)
this.getAuditDetails()
},
methods: {
//
async getAuditDetails() {
try {
const params = {
encryptedData: JSON.stringify({ id: this.opt.planId })
}
const res = await getAuditDetails(params)
console.log('🚀 ~ 审核记录 ~ res', res)
this.tableList = res.data
} catch (error) {
console.log('🚀 ~ 审核记录 ~ error', error)
}
}
}
}
</script>

View File

@ -5,43 +5,46 @@
class="list-cont"
v-for="(item, index) in tableList"
:key="index"
:style="{ background: index == 0 ? '#E3EDF5' : '#E4EAF5' }"
:style="{ background: item.planType == 1 ? '#E3EDF5' : '#E4EAF5' }"
>
<div
class="list-item top-item"
:style="{ background: index == 0 ? '#71BFF0' : '#7D9FF3', color: '#fff', borderRadius: '8px 8px 0 0' }"
:style="{ background: item.planType == 1 ? '#71BFF0' : '#7D9FF3', color: '#fff', borderRadius: '8px 8px 0 0' }"
>
<span class="mr-15" style="font-size: 21px; font-weight: 800">{{ index + 1 }}</span>
<u-icon
class="mr-15"
:color="index == 0 ? '#71BFF0' : '#7D9FF3'"
:name="index == 0 ? '/static/images/car.png' : '/static/images/car2.png'"
:color="item.planType == 1 ? '#71BFF0' : '#7D9FF3'"
:name="item.planType == 1 ? '/static/images/car.png' : '/static/images/car2.png'"
size="21"
></u-icon>
<span class="mr-15">{{ item.carName }}</span>
<span>{{ item.carType }}</span>
<span class="mr-15">{{ item.name }}</span>
<span>{{ item.model }}</span>
</div>
<div style="padding-left: 20px">
<div class="list-item">
<span>{{ item.name }}</span>
<span>{{ item.supName }}</span>
</div>
<div style="padding-left: 20px">
<div class="list-item">
<span class="mr-15">{{ item.carNum }}</span>
<span class="mr-15">{{ item.carType }}</span>
<span>{{ item.carLoad }}</span>
<span class="mr-15">{{ item.planType == 1 ? item.carType : item.type }}</span>
<span>{{ item.planType == 1 ? item.ton : item.model }}</span>
</div>
<div class="list-item" v-if="item.planType == 1">
<span>{{ item.goodsName }}</span>
</div>
<div class="list-item">
<span>{{ item.tool }}</span>
<span>{{ item.planType == 1 ? item.gls : item.planDay }}</span>
</div>
<div class="list-item">
<span>{{ item.distance }}</span>
<div class="list-item" v-if="item.planType == 2">
<span>{{ item.useAddress }}</span>
</div>
<div class="list-item">
<span>{{ item.company }}</span>
<div class="list-item" v-if="item.planType == 1">
<span>{{ item.startAddress }}</span>
</div>
<div class="list-item">
<span>{{ item.address }}</span>
<div class="list-item" v-if="item.planType == 1">
<span>{{ item.endAddress }}</span>
</div>
<div class="list-item">
<span class="mr-15">附件数量</span>
@ -59,7 +62,7 @@
</div>
</div>
<u-modal :show="showModal" title="派车审核" showCancelButton @cancel="showModal = false" @confirm="submit">
<u-modal :show="showModal" title="派车审核" showCancelButton @cancel="showModal = false" @confirm="dispatchAudit">
<view class="slot-content">
<div>
<div class="item-wrap">
@ -82,7 +85,13 @@
<div class="uPopup">
<div class="pop-title">{{ imgList && imgList.length > 0 ? imgList[current].title : '' }}</div>
<div class="content">
<u-swiper v-if="imgList.length > 0" :list="imgList" @change="e => (current = e.current)" :autoplay="false" @click="handleSwiper">
<u-swiper
v-if="imgList.length > 0"
:list="imgList"
@change="e => (current = e.current)"
:autoplay="false"
@click="handleSwiper"
>
<view slot="indicator" class="indicator">
<view
class="indicator__dot"
@ -106,6 +115,8 @@
</template>
<script>
import { getDispatchCarData, getOutDetails, dispatchAudit } from '@/api/carManage'
import config from '@/config'
export default {
props: {
opt: {
@ -115,6 +126,7 @@ export default {
},
data() {
return {
token: uni.getStorageSync('App-Token'),
showModal: false,
isPass: true,
opinion: '', //
@ -123,68 +135,43 @@ export default {
pageSize: 10,
total: 0,
tableList: [
{
carName: '车辆名称',
carType: '车辆类型',
name: '姓名',
carNum: '车牌号',
carLoad: '车辆载重',
tool: '工具',
distance: '距离',
company: '公司',
address: '地址',
fileList: []
},
{
carName: '车辆名称',
carType: '车辆类型',
name: '姓名',
carNum: '车牌号',
carLoad: '车辆载重',
tool: '工具',
distance: '距离',
company: '公司',
address: '地址',
fileList: [
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
},
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
title: '身无彩凤双飞翼,心有灵犀一点通'
},
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
}
]
},
{
carName: '车辆名称',
carType: '车辆类型',
name: '姓名',
carNum: '车牌号',
carLoad: '车辆载重',
tool: '工具',
distance: '距离',
company: '公司',
address: '地址',
fileList: [
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
},
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
title: '身无彩凤双飞翼,心有灵犀一点通'
},
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
}
]
}
// {
// carName: '',
// carType: '',
// name: '',
// carNum: '',
// carLoad: '',
// tool: '',
// distance: '',
// company: '',
// address: '',
// fileList: []
// },
// {
// carName: '',
// carType: '',
// name: '',
// carNum: '',
// carLoad: '',
// tool: '',
// distance: '',
// company: '',
// address: '',
// fileList: [
// {
// url: 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
// title: '西'
// },
// {
// url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
// title: ''
// },
// {
// url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
// title: '西'
// }
// ]
// },
],
showPop: false,
imgList: [],
@ -193,11 +180,60 @@ export default {
},
mounted() {
console.log('🚀 ~ 计划审核 ~ this.opt', this.opt)
if (this.opt.isArrival) {
this.getDispatchCarData()
} else {
this.getOutDetails()
}
},
methods: {
// -
async getDispatchCarData() {
try {
const params = {
encryptedData: JSON.stringify({ planId: this.opt.planId })
}
const res = await getOutDetails(params)
console.log('🚀 ~ getDispatchCarData ~ res', res)
this.tableList = res.data
} catch (error) {
console.log('🚀 ~ getDispatchCarData ~ error', error)
}
},
// -
async getOutDetails() {
try {
let params = {}
if (this.isAudit) {
params = {
encryptedData: JSON.stringify({ outId: this.opt.outId })
}
} else {
params = {
encryptedData: JSON.stringify({ planId: this.opt.planId })
}
}
const res = await getOutDetails(params)
console.log('🚀 ~ 派车详情-派车管理 ~ res', res)
this.tableList = res.data
} catch (error) {
console.log('🚀 ~ getOutDetails ~ error', error)
}
},
//
handleFile(item) {
if (!item.fileList || item.fileList.length == 0) {
uni.showToast({
title: '暂无附件',
icon: 'none'
})
return
}
this.imgList = item.fileList
this.imgList.forEach((item, index) => {
item.url = config.fileUrlGzCar + item.fileUrl + '?token=' + this.token
})
console.log('🚀 ~ 查看附件 ~ this.imgList', this.imgList)
this.showPop = true
this.current = 0
console.log('🚀 ~ 查看附件 ~ item', item)
@ -206,12 +242,37 @@ export default {
//
uni.previewImage({
current: this.imgList[this.current].url,
urls: this.imgList.map((item) => item.url)
urls: this.imgList.map(item => item.url)
})
},
submit() {
console.log('🚀 ~ 提交 ~ submit ~ this.isPass', this.isPass)
console.log('🚀 ~ 提交 ~ submit ~ this.opinion', this.opinion)
},
//
async dispatchAudit() {
const params = {
encryptedData: JSON.stringify({
id: this.opt.outId,
planId: this.opt.planId,
status: this.isPass ? 1 : 2,
remark: this.remark
})
}
try {
const res = await dispatchAudit(params)
console.log('🚀 ~ dispatchAudit ~ res', res)
uni.showToast({
title: '审核成功',
icon: 'success'
})
setTimeout(() => {
this.showModal = false
uni.navigateBack()
}, 1000)
} catch (error) {
console.log('🚀 ~ dispatchAudit ~ error', error)
}
}
}
}

View File

@ -4,7 +4,7 @@
<div class="list-cont">
<div class="list-item">
<div class="title">计划类型</div>
<div>{{ formData.planType }}</div>
<div>{{ formData.typeName }}</div>
</div>
<div class="list-item">
<div class="title">项目名称</div>
@ -12,19 +12,19 @@
</div>
<div class="list-item">
<div class="title">项目部分</div>
<div>{{ formData.proPart }}</div>
<div>{{ formData.projectPart }}</div>
</div>
<div class="list-item">
<div class="title">工作内容</div>
<div>{{ formData.jobContent }}</div>
<div class="title">施工地点</div>
<div>{{ formData.projectContent }}</div>
</div>
<div class="list-item">
<div class="title">需要日期</div>
<div>{{ formData.needDate }}</div>
<div>{{ formData.needDay }}</div>
</div>
<div class="list-item">
<div class="title">计划说明</div>
<div>{{ formData.explain }}</div>
<div>{{ formData.remark }}</div>
</div>
</div>
<uni-section title="申请明细" type="line"></uni-section>
@ -39,7 +39,7 @@
</div>
<div class="list-item">
<span class="title"> &nbsp; &nbsp;</span>
<span>{{ item.specification }}</span>
<span>{{ item.model }}</span>
</div>
<div class="list-item">
<span class="title"> &nbsp; &nbsp;</span>
@ -47,11 +47,11 @@
</div>
<div class="list-item">
<span class="title"> </span>
<span>{{ item.num }}</span>
<span>{{ item.needNum }}</span>
</div>
<div class="list-item">
<span class="title">需要天数</span>
<span>{{ item.date }}</span>
<span>{{ item.needDay }}</span>
</div>
<div class="list-item">
<span class="title"> &nbsp; &nbsp;</span>
@ -62,7 +62,7 @@
<!-- btn -->
<div class="btn-wrap" v-if="opt.isPlan">
<div style="margin: 0 15px">
<u-button type="primary" @click="showModal = true"> </u-button>
<u-button type="primary" @click="openModal"> </u-button>
</div>
</div>
@ -70,13 +70,13 @@
<u-modal :show="showModal" title="指定派车供应商" showCancelButton @cancel="showModal = false" @confirm="submit">
<view class="slot-content">
<div>
<u-radio-group v-model="radioValue" placement="column">
<u-radio-group v-model="supId" placement="column" @change="groupChange">
<u-radio
:customStyle="{ marginBottom: '8px' }"
v-for="(item, index) in radioList"
:key="index"
:label="item.name"
:name="item.value"
:name="item.id"
></u-radio>
</u-radio-group>
</div>
@ -89,6 +89,8 @@
</template>
<script>
import { getDispatchCarListData, getPlanDetails, getContractSupList, addPlanSupInfo } from '@/api/carManage'
export default {
props: {
opt: {
@ -99,14 +101,13 @@ export default {
data() {
return {
showModal: false,
radioValue: '',
formData: {
planType: '计划类型', //
proName: '项目名称', //
proPart: '项目部分', //
jobContent: '工作内容', //
needDate: '2025-01-01', //
explain: '这是计划说明' //
planType: '', //
proName: '', //
proPart: '', //
jobContent: '', //
needDate: '', //
explain: '' //
},
pageNum: 1,
pageSize: 10,
@ -131,36 +132,102 @@ export default {
remark: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
}
],
radioList: [
{
name: '苹果',
value: '1',
disabled: false
},
{
name: '香蕉',
value: '2',
disabled: false
},
{
name: '橙子',
value: '3',
disabled: false
},
{
name: '榴莲',
value: '4',
disabled: false
}
]
radioList: [],
supId: '', // id
supName: '', //
contractId: '' // id
}
},
mounted() {
console.log('🚀 ~ 计划详情 ~ this.opt', this.opt)
this.getPlanDetails()
},
methods: {
// -
async getDispatchCarListData() {
try {
const params = {
encryptedData: JSON.stringify({ id: this.opt.id })
}
const res = await getDispatchCarListData(params)
console.log('🚀 ~ getDispatchCarListData ~ res', res)
this.formData = res.data
this.tableList = res.data.detailsList || []
} catch (error) {
console.log('🚀 ~ getDispatchCarListData ~ error', error)
}
},
// -
async getPlanDetails() {
try {
const params = {
encryptedData: JSON.stringify({ planId: this.opt.planId })
}
const res = await getPlanDetails(params)
console.log('🚀 ~ 计划详情-派车管理 ~ res', res)
this.formData = res.data
this.tableList = res.data.detailsList || []
} catch (error) {
console.log('🚀 ~ getPlanDetails ~ error', error)
}
},
//
async openModal() {
this.showModal = true
console.log('🚀 ~ 供应商-列表 ~ item:', this.opt)
const params = {
encryptedData: JSON.stringify({ type: this.opt.type })
}
try {
const res = await getContractSupList(params)
console.log('🚀 ~ getContractSupList ~ res', res)
this.radioList = res.data
} catch (error) {
console.log('🚀 ~ openModal ~ error', error)
}
},
groupChange() {
console.log('🚀 ~ supId', this.supId)
this.supName = this.radioList.find(item => item.id == this.supId).name
this.contractId = this.radioList.find(item => item.id == this.supId).contractId
console.log('🚀 ~ supName', this.supName, this.contractId)
},
submit() {
console.log('🚀 ~ submit ~ this.radioValue', this.radioValue)
console.log('🚀 ~ submit ~ this.supId', this.supId)
if (!this.supId) {
uni.showToast({
title: '请选择派车供应商',
icon: 'none'
})
return
}
this.addPlanSupInfo()
},
//
async addPlanSupInfo() {
const params = {
encryptedData: JSON.stringify({
type: this.opt.type,
id: this.opt.planId,
supId: this.supId,
supName: this.supName,
contractId: this.contractId
})
}
try {
const res = await addPlanSupInfo(params)
console.log('🚀 ~ addPlanSupInfo ~ res', res)
uni.showToast({
title: '分配成功',
icon: 'success'
})
setTimeout(() => {
this.showModal = false
uni.navigateBack()
}, 1000)
} catch (error) {
console.log('🚀 ~ addPlanSupInfo ~ error', error)
}
}
}
}

View File

@ -16,7 +16,6 @@
</template>
<script>
import { getDispatchCarListData, getDispatchCarData } from '@/api/carManage'
import AuditRecord from './components/AuditRecord'
import PlanDetails from './components/PlanDetails'
import PlanAuditDetails from './components/PlanAuditDetails'
@ -46,24 +45,6 @@ export default {
handleTab(index) {
this.active = index
},
//
getDispatchCarDetails() {
if (this.opt.isArrival) {
this.getDispatchCarListData()
this.getDispatchCarData()
} else {
}
},
//
async getDispatchCarData() {
const res = await getDispatchCarData({ id: this.opt.id })
console.log('🚀 ~ getDispatchCarData ~ res', res)
},
//
async getDispatchCarListData() {
const res = await getDispatchCarListData({ id: this.opt.id })
console.log('🚀 ~ getDispatchCarListData ~ res', res)
}
}
}
</script>

View File

@ -30,8 +30,8 @@
</u-col>
<u-col span="6" v-if="active == 1">
<div style="display: flex; justify-content: flex-end">
<u-tag text="已派车" type="success" v-if="item.isSend"></u-tag>
<u-tag text="待派车" type="warning" v-else></u-tag>
<u-tag :text="item.status" type="success" v-if="item.supId && item.status == '已派车'"></u-tag>
<u-tag :text="item.status" type="warning" v-else></u-tag>
</div>
</u-col>
</u-row>
@ -43,22 +43,23 @@
<div class="list-item df-item">
<div>
<span>计划类型</span>
<span>{{ item.plan }}</span>
<span>{{ item.typeName }}</span>
</div>
<div>
<u-tag v-if="active == 1 && !item.isSend" type="primary" text="派车分配" @click="openModal(item)"></u-tag>
<u-tag v-if="active == 1 && !item.supId" type="primary" text="派车分配" @click="openModal(item)"></u-tag>
<u-tag
v-else-if="active == 2 && item.status == 0"
type="warning"
text="审核"
@click="openModal(item)"
></u-tag>
<u-tag text="已通过" type="success" v-else-if="active == 2 && item.status == 1"></u-tag>
<u-tag :text="item.statusName" type="success" v-else-if="active == 2 && item.status == 1"></u-tag>
<u-tag :text="item.statusName" type="error" v-else-if="active == 2"></u-tag>
</div>
</div>
<div class="list-item">
<span> </span>
<span>{{ item.sub }}</span>
<span>{{ item.supName }}</span>
</div>
</div>
<!-- 空状态 -->
@ -74,8 +75,8 @@
:customStyle="{ marginBottom: '8px' }"
v-for="(item, index) in radioList"
:key="index"
:label="item.supName"
:name="item.supId"
:label="item.name"
:name="item.id"
></u-radio>
</u-radio-group>
</div>
@ -129,28 +130,21 @@ export default {
checkStatusId: '', // id
showPicker: false,
columns: [
{
label: '全部',
value: ''
},
{
label: '已审核',
value: 1
value: '1'
},
{
label: '待审核',
value: 0
value: '0'
}
],
//
radioList: [
{
supId: 1,
supName: '供应商1',
contractId: 1
},
{
supId: 2,
supName: '供应商2',
contractId: 2
}
],
radioList: [],
supId: '', // id
supName: '', //
contractId: '', // id
@ -164,7 +158,7 @@ export default {
return this.active == 1 ? 'flex-start' : 'center'
}
},
onLoad() {
onShow() {
this.getList()
},
methods: {
@ -172,44 +166,12 @@ export default {
this.active = index
this.pageNum = 1
this.pageSize = 10
this.tableList = []
this.total = 0
this.checkStatus = ''
this.checkStatusId = ''
this.keyWord = ''
this.getList()
if (index == 1) {
this.tableList = [
{
code: '20210801',
proName: '项目名称',
plan: '计划1',
sub: '供应商1',
//
isSend: true
},
{
code: '20210802',
proName: '项目名称',
plan: '计划2',
sub: '供应商2',
//
isSend: false
}
]
} else {
this.tableList = [
{
code: '20210803',
proName: '项目名称',
plan: '计划1',
sub: '供应商1',
status: 1
},
{
code: '20210804',
proName: '项目名称',
plan: '计划2',
sub: '供应商2',
status: 0
}
]
}
},
handleSearch() {
console.log('搜索', this.keyWord.trim())
@ -219,20 +181,29 @@ export default {
async getList() {
try {
const params = {
encryptedData: JSON.stringify({ keyWord: this.keyWord.trim() }),
encryptedData: JSON.stringify({
keyWord: this.keyWord.trim(),
status: this.checkStatusId
}),
pageNum: this.pageNum,
pageSize: this.pageSize
}
console.log('🚀 ~ getList ~ params', params)
let res = null
if (this.active == 1) {
res = await getPlanList(params)
} else {
res = await getAuditList(params)
try {
let res = null
if (this.active == 1) {
// -
res = await getPlanList(params)
} else {
// -
res = await getAuditList(params)
}
console.log('🚀 ~ getList ~ res', res)
this.tableList = res.list
this.total = res.total
} catch (error) {
console.log('🚀 ~ getList ~ error', error)
}
console.log('🚀 ~ getList ~ res', res)
this.tableList = res.data.list
this.total = res.data.total
} catch (error) {
console.log('🚀 ~ getList ~ error', error)
}
@ -273,20 +244,25 @@ export default {
const params = {
encryptedData: JSON.stringify({ type: item.type })
}
const res = await getContractSupList(params)
console.log('🚀 ~ getContractSupList ~ res', res)
try {
const res = await getContractSupList(params)
console.log('🚀 ~ getContractSupList ~ res', res)
this.radioList = res.data
} catch (error) {
console.log('🚀 ~ getContractSupList ~ error', error)
}
},
confirm(e) {
console.log('🚀 ~ confirm ~ e', e)
this.checkStatus = e.value[0].label
this.checkStatusId = e.value[0].value
this.getList()
this.showPicker = false
},
groupChange(e) {
console.log('🚀 ~ supId', e)
this.supId = e
this.supName = this.radioList.find((item) => item.supId == e).supName
this.contractId = this.radioList.find((item) => item.supId == e).contractId
groupChange() {
console.log('🚀 ~ supId', this.supId)
this.supName = this.radioList.find(item => item.id == this.supId).name
this.contractId = this.radioList.find(item => item.id == this.supId).contractId
console.log('🚀 ~ supName', this.supName, this.contractId)
},
//
@ -296,13 +272,13 @@ export default {
let isAudit = false
let isDetail = false
let active = null
if (this.active == 1 && !item.isSend) {
if (this.active == 1 && !item.supId) {
isPlan = true
active = 1
} else if (this.active == 2 && item.status == 0) {
isAudit = true
active = 2
} else if (item.isSend || item.status == 1) {
} else {
isDetail = true
active = 1
}
@ -342,33 +318,50 @@ export default {
this.dispatchAudit()
}
this.showModal = false
this.getList()
},
//
async addPlanSupInfo() {
const params = {
encryptedData: JSON.stringify({
type: this.row.type,
id: this.row.id,
id: this.row.planId,
supId: this.supId,
supName: this.supName,
contractId: this.contractId
})
}
const res = await addPlanSupInfo(params)
console.log('🚀 ~ addPlanSupInfo ~ res', res)
try {
const res = await addPlanSupInfo(params)
console.log('🚀 ~ addPlanSupInfo ~ res', res)
uni.showToast({
title: '分配成功',
icon: 'success'
})
} catch (error) {
console.log('🚀 ~ addPlanSupInfo ~ error', error)
}
},
//
async dispatchAudit() {
const params = {
encryptedData: JSON.stringify({
id: this.row.id,
id: this.row.outId,
planId: this.row.planId,
status: this.isPass ? 1 : 2,
remark: this.remark
})
}
const res = await dispatchAudit(params)
console.log('🚀 ~ dispatchAudit ~ res', res)
try {
const res = await dispatchAudit(params)
console.log('🚀 ~ dispatchAudit ~ res', res)
uni.showToast({
title: '审核成功',
icon: 'success'
})
} catch (error) {
console.log('🚀 ~ dispatchAudit ~ error', error)
}
}
}
}

View File

@ -99,7 +99,7 @@ const request = config => {
// res = JSON.parse(decryptCBC(res.data))
// console.log('🚀 ~ request.js ~ line 100 ~ res', res)
const code = res.data.code || 200
console.log('🚀 ~ ~ code', code)
// console.log('🚀 ~ ~ code', code)
const msg = errorCode[code] || res.data.msg || errorCode['default']
// console.log('🚀 ~ ~ msg', msg)
if (code === 401) {