You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2096 lines
69 KiB
2096 lines
69 KiB
<template> |
|
<div class="pageContent" v-loading="form.Pageloading" element-loading-text="正在加载中..."> |
|
<!-- 菜单 --> |
|
<div class="placeholder"> |
|
<el-tabs |
|
class="tablemun" |
|
v-model="form.basis.TabactiveName" |
|
type="border-card" |
|
@tab-click="TabactiveClick" |
|
> |
|
<el-tab-pane label="订单填写" :name="1"></el-tab-pane> |
|
<el-tab-pane label="零担填写" :name="2"> </el-tab-pane> |
|
</el-tabs> |
|
</div> |
|
<!-- 主体内容 --> |
|
<div class="content"> |
|
<el-form |
|
ref="ruleFormRef" |
|
:rules="ruleForm" |
|
:model="form" |
|
label-width="30%" |
|
style="width: 100%" |
|
label-position="top" |
|
> |
|
<!-- 头部类型选择 --> |
|
<div class="tablemunTop"> |
|
<!-- 异常类型 --> |
|
<el-form-item label="异常类型" prop="basis.workOrderType"> |
|
<el-select |
|
v-model="form.basis.workOrderType" |
|
placeholder="请选择异常类型" |
|
style="width: 100%" |
|
clearable |
|
@change="workOrderTypeChange" |
|
> |
|
<el-option |
|
v-for="item in Exceptionoptions" |
|
:key="item.value" |
|
:label="item.label" |
|
:value="item.value" |
|
/> |
|
</el-select> |
|
</el-form-item> |
|
|
|
<!-- 发现节点 --> |
|
<el-form-item label="发现节点" prop="basis.discoveryNode"> |
|
<el-select |
|
v-model="form.basis.discoveryNode" |
|
placeholder="请选择发现节点" |
|
style="width: 100%" |
|
@change="DiscoveringNodesChange" |
|
clearable |
|
> |
|
<el-option |
|
v-for="item in Discoveringoptions" |
|
:key="item.value" |
|
:label="item.label" |
|
:value="item.value" |
|
clearable |
|
/> |
|
</el-select> |
|
</el-form-item> |
|
|
|
<el-form-item label="异常工单号"> |
|
<el-input v-model="form.basis.name" disabled placeholder="异常工单号(自动生成)" /> |
|
</el-form-item> |
|
</div> |
|
|
|
<!-- 包件信息 --> |
|
<el-tabs |
|
v-model="form.activPackage" |
|
class="demo-tabs Packagebox" |
|
@tab-click="handleClick" |
|
v-loading="form.Packageloading" |
|
> |
|
<el-tab-pane label="包件信息" name="0"> |
|
<template v-for="(item, index) in form.PackageList" :key="index"> |
|
<div class="el_Package"> |
|
<div class="Package"> |
|
<span class="Number"> {{ index + 1 }}</span> |
|
<el-form-item |
|
v-if="form.basis.TabactiveName == 1" |
|
:prop="`PackageList[${index}.packageCode]`" |
|
:rules="ruleForm.packageCode" |
|
label="包条码" |
|
> |
|
<el-input |
|
@change="ChangePackageInfo(item)" |
|
v-model.trim="item.packageCode" |
|
placeholder="请输入包条码" |
|
clearable |
|
/> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="运单号" |
|
:prop="`PackageList[${index}.waybillNumber]`" |
|
:rules="ruleForm.waybillNumber" |
|
> |
|
<el-input v-model="item.waybillNumber" placeholder="请输入运单号" clearable /> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="订单自编号" |
|
:prop="`PackageList[${index}.orderCode]`" |
|
:rules="ruleForm.orderCode" |
|
> |
|
<el-input v-model="item.orderCode" placeholder="请输入订单自编号" clearable /> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="一级品" |
|
:prop="`PackageList[${index}.first]`" |
|
:rules="ruleForm.first" |
|
> |
|
<el-input v-model="item.first" placeholder="请输入一级品" clearable /> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="二级品" |
|
:prop="`PackageList[${index}.secondary]`" |
|
:rules="ruleForm.secondary" |
|
> |
|
<el-input v-model="item.secondary" placeholder="请输入二级品" clearable /> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="品牌" |
|
:prop="`PackageList[${index}.brandName]`" |
|
:rules="ruleForm.brandName" |
|
> |
|
<el-input |
|
v-model="item.brandName" |
|
placeholder="品牌(有则自动带出)" |
|
disabled |
|
clearable |
|
/> |
|
</el-form-item> |
|
<div |
|
v-if="['3', '5', '6'].includes(form.basis.discoveryNode)" |
|
style="width: 20%; display: flex" |
|
> |
|
<el-button |
|
v-if="!index" |
|
type="primary" |
|
class="el_addPackage" |
|
@click="Addpackages" |
|
style="margin-top: 2px" |
|
> |
|
<el-icon><Plus /></el-icon>新增包件</el-button |
|
> |
|
<el-button |
|
v-if="index" |
|
type="primary" |
|
class="el_addPackage" |
|
style="margin-top: 2px" |
|
@click="Removepackage(index)" |
|
> |
|
<el-icon><DeleteFilled /></el-icon>移除包件</el-button |
|
> |
|
<div class="el_activPackage_btton" v-if="item.history"> |
|
<el-button @click="ViewhistoricalPackages(item)">查看历史包件</el-button> |
|
</div> |
|
</div> |
|
</div> |
|
<!-- 按钮 --> |
|
</div> |
|
</template> |
|
<!-- <div class="el_top"> |
|
<div class="el_Package_num"> |
|
<span>共计包件:{{ form.PackageList.length }}</span> |
|
</div> |
|
</div> --> |
|
</el-tab-pane> |
|
</el-tabs> |
|
|
|
<!-- 基础信息 --> |
|
<el-tabs |
|
v-model="form.activPackage" |
|
class="demo-tabs Packagebox" |
|
@tab-click="handleClick" |
|
v-loading="form.Packageloading" |
|
> |
|
<el-tab-pane label="基础信息" name="0"> |
|
<div class="Basicinformation" style="padding-left: 26px; box-sizing: border-box"> |
|
<el-form-item |
|
label="车次号" |
|
prop="basis.trainNumber" |
|
v-if="displaySettings.trainNumber" |
|
> |
|
<el-select |
|
v-model="form.basis.trainNumber" |
|
filterable |
|
allow-create |
|
default-first-option |
|
:reserve-keyword="false" |
|
placeholder="请选择车次号" |
|
style="width: 100%" |
|
clearable |
|
@change="DeliveryTrainnumber" |
|
> |
|
<template v-if="form.basis.discoveryNode == 3"> |
|
<el-option |
|
v-for="(item, index) in form.Trainoptions" |
|
:key="index" |
|
:label="item.trainNumber" |
|
:value="item.trainNumber" |
|
/> |
|
</template> |
|
|
|
<!-- driverName: itemChid.driverName, // 主司机 |
|
taskTime: itemChid.taskTime, // 配送时间 |
|
trainNumber: itemChid.trainNumber, //车次号 --> |
|
|
|
<template v-else> |
|
<el-option |
|
v-for="(item, index) in form.deliver" |
|
:key="index" |
|
:label="item.trainNumber" |
|
:value="item.trainNumber" |
|
/> |
|
</template> |
|
</el-select> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="配送时间" |
|
prop="basis.deliveryTime" |
|
v-if="displaySettings.deliveryTime" |
|
> |
|
<el-date-picker |
|
v-model="form.basis.deliveryTime" |
|
style="width: 100%" |
|
type="datetime" |
|
format="YYYY-MM-DD" |
|
value-format="YYYY-MM-DD HH:mm:ss" |
|
placeholder="请选择配送时间" |
|
/> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="配送司机" |
|
prop="basis.deliveryDriver" |
|
v-if="displaySettings.deliveryDriver" |
|
> |
|
<el-input |
|
v-model="form.basis.deliveryDriver" |
|
placeholder="请输配送司机" |
|
clearable |
|
/> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="车辆线路" |
|
prop="basis.vehicleRoute" |
|
v-if="displaySettings.vehicleRoute" |
|
> |
|
<el-input |
|
v-model="form.basis.vehicleRoute" |
|
placeholder="请输入车辆线路" |
|
clearable |
|
/> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="发货时间" |
|
prop="basis.deliverGoodsTime" |
|
v-if="displaySettings.deliverGoodsTime" |
|
> |
|
<el-date-picker |
|
v-model="form.basis.deliverGoodsTime" |
|
style="width: 100%" |
|
type="datetime" |
|
format="YYYY-MM-DD" |
|
value-format="YYYY-MM-DD HH:mm:ss" |
|
placeholder="请选择发货时间" |
|
/> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="入库时间" |
|
prop="basis.warehousingTime" |
|
v-if="displaySettings.warehousingTime" |
|
> |
|
<el-date-picker |
|
v-model="form.basis.warehousingTime" |
|
style="width: 100%" |
|
type="datetime" |
|
format="YYYY-MM-DD" |
|
value-format="YYYY-MM-DD HH:mm:ss" |
|
placeholder="请选择入库时间" |
|
/> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="发现时间" |
|
prop="basis.discoveryTime" |
|
v-if="displaySettings.discoveryTime" |
|
> |
|
<el-date-picker |
|
v-model="form.basis.discoveryTime" |
|
style="width: 100%" |
|
type="datetime" |
|
format="YYYY-MM-DD" |
|
value-format="YYYY-MM-DD HH:mm:ss" |
|
placeholder="请选择发现时间" |
|
/> |
|
</el-form-item> |
|
<!-- 初始必填 --> |
|
<el-form-item |
|
label="运单商场" |
|
prop="basis.waybillMall" |
|
v-if="displaySettings.waybillMall" |
|
> |
|
<el-input v-model="form.basis.waybillMall" placeholder="请输入运单商场" clearable /> |
|
</el-form-item> |
|
<!-- 初始必填 --> |
|
<el-form-item |
|
label="合作模式" |
|
prop="basis.typeServiceName" |
|
v-if="displaySettings.typeServiceName" |
|
> |
|
<el-input |
|
v-model="form.basis.typeServiceName" |
|
placeholder="合作模式(有则自动带出)" |
|
disabled |
|
clearable |
|
/> |
|
</el-form-item> |
|
|
|
<!-- 干线卸车 --> |
|
<el-form-item |
|
label="责任方" |
|
class="el_Processing" |
|
prop="basis.processorEntityList" |
|
v-if="displaySettings.processorEntityList" |
|
style="width: 18%" |
|
> |
|
<el-select |
|
v-model="form.basis.processorEntityList" |
|
placeholder="请选择责任方" |
|
style="width: 100% !important" |
|
multiple |
|
filterable |
|
clearable |
|
> |
|
<el-option |
|
v-for="item in Responsibleline" |
|
:key="item.value" |
|
:label="item.label" |
|
:value="item.value" |
|
/> |
|
</el-select> |
|
</el-form-item> |
|
|
|
<!-- 初始必填 --> |
|
|
|
<el-form-item |
|
label="处理方" |
|
prop="basis.processor" |
|
class="el_Processing" |
|
v-if="displaySettings.processor" |
|
style="width: 34.3%" |
|
> |
|
<el-select |
|
v-model="form.basis.processor" |
|
placeholder="请选择处理方" |
|
style="width: 100%" |
|
multiple |
|
filterable |
|
clearable |
|
> |
|
<el-option |
|
v-for="item in Processingoptions" |
|
:key="item.value" |
|
:label="item.label" |
|
:value="item.value" |
|
/> |
|
</el-select> |
|
</el-form-item> |
|
|
|
<!-- 初始必填 --> |
|
<el-form-item |
|
label="调查经过" |
|
prop="basis.investigationProcess" |
|
class="el_Investigation_process" |
|
clearable |
|
v-if="displaySettings.investigationProcess" |
|
> |
|
<el-input |
|
v-model="form.basis.investigationProcess" |
|
placeholder="请输调查经过" |
|
type="textarea" |
|
:autosize="{ minRows: 2, maxRows: 10 }" |
|
clearable |
|
/> |
|
</el-form-item> |
|
</div> |
|
</el-tab-pane> |
|
</el-tabs> |
|
<!-- 内部责任划分 --> |
|
<el-tabs |
|
v-model="form.responsibilities" |
|
class="demo-tabs responsibilities" |
|
@tab-click="handleClick" |
|
v-loading="form.Packageloading" |
|
v-if="form.basis.discoveryNode != 3" |
|
> |
|
<el-tab-pane label="内部责任划分" name="0"> |
|
<div class="el_responsibilities"> |
|
<template v-for="(item, index) in form.responsibilitiesList" :key="index"> |
|
<div class="el_responsibilities_box"> |
|
<span class="Number"> {{ index + 1 }}</span> |
|
<el-form-item |
|
label="责任方" |
|
class="el_Processing" |
|
:prop="`responsibilitiesList[${index}.businessId]`" |
|
:rules="ruleForm.businessId" |
|
> |
|
<el-select |
|
v-if="form.groundlineType == '1'" |
|
v-model="item.businessId" |
|
placeholder="请选择提货责任方" |
|
style="width: 100%" |
|
clearable |
|
filterable |
|
> |
|
<el-option |
|
v-for="items in item.Processingoptions" |
|
:key="items.value" |
|
:label="items.label" |
|
:value="items.value" |
|
/> |
|
</el-select> |
|
<el-select |
|
v-else |
|
v-model="item.businessId" |
|
placeholder="请选择责任方" |
|
style="width: 100%" |
|
clearable |
|
filterable |
|
@change="ResponsiblePartychange(item)" |
|
> |
|
<el-option |
|
v-for="items in item.Responsibleoptions" |
|
:key="items.value" |
|
:label="items.label" |
|
:value="items.value" |
|
/> |
|
</el-select> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="责任人" |
|
class="el_Processing" |
|
:prop="`responsibilitiesList[${index}.personResponsibleId]`" |
|
:rules="ruleForm.personResponsibleId" |
|
> |
|
<el-input |
|
v-if="form.groundlineType == '1'" |
|
v-model="item.personResponsibleId" |
|
placeholder="请输入责任人" |
|
clearable |
|
/> |
|
<el-select |
|
v-else |
|
v-model="item.personResponsibleId" |
|
style="width: 100%" |
|
filterable |
|
clearable |
|
allow-create |
|
default-first-option |
|
> |
|
<el-option |
|
v-for="items in item.ResponsibleoNameptions" |
|
:key="items.value" |
|
:label="items.name" |
|
:value="items.id" |
|
/> |
|
</el-select> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="金额(元)" |
|
:prop="`responsibilitiesList[${index}.responsibilityRatio]`" |
|
:rules="ruleForm.responsibilityRatio" |
|
> |
|
<el-input-number |
|
v-model="item.responsibilityRatio" |
|
:min="0" |
|
:max="item.ProportionMax" |
|
:controls="false" |
|
:precision="2" |
|
:value-on-clear="0" |
|
/> |
|
</el-form-item> |
|
<el-form-item |
|
label="三方责任人" |
|
:prop="`responsibilitiesList[${index}.tripartite]`" |
|
:rules="ruleForm.tripartite" |
|
> |
|
<el-input v-model="item.tripartite" placeholder="请输入三方责任人" clearable /> |
|
</el-form-item> |
|
<el-form-item |
|
label="说明" |
|
class="el_Investigation" |
|
clearable |
|
:prop="`responsibilitiesList[${index}.description]`" |
|
:rules="ruleForm.description" |
|
> |
|
<el-input |
|
v-model="item.description" |
|
placeholder="请输入说明" |
|
type="textarea" |
|
:autosize="{ minRows: 1, maxRows: 1 }" |
|
clearable |
|
/> |
|
</el-form-item> |
|
|
|
<el-button |
|
v-if="!index" |
|
type="primary" |
|
class="el_addPackage" |
|
@click="AddResponsible" |
|
style="margin-top: 2px" |
|
> |
|
<el-icon><Plus /></el-icon>新增责任</el-button |
|
> |
|
<el-button |
|
style="margin-top: 2px" |
|
v-if="index" |
|
type="primary" |
|
@click="Responsemoval(index)" |
|
> |
|
<el-icon><DeleteFilled /></el-icon>移除责任</el-button |
|
> |
|
</div> |
|
<div></div> |
|
</template> |
|
</div> |
|
<!-- <div class="el_top"> |
|
<div class="el_Package_num"> |
|
<span>公司占比:{{ form.Proportion }}(%)</span> |
|
</div> |
|
</div> --> |
|
</el-tab-pane> |
|
</el-tabs> |
|
|
|
<!-- 处理结果-理赔金额 --> |
|
<el-tabs |
|
v-model="form.ProcessingTab" |
|
class="demo-tabs Processingresults" |
|
v-loading="form.Packageloading" |
|
v-if="ProcessingState" |
|
> |
|
<el-tab-pane label="处理结果-理赔金额" name="0"> |
|
<el-form-item label="" prop="basis.result"> |
|
<el-select |
|
v-model="form.basis.result" |
|
placeholder="请选择处理结果类型" |
|
style="width: 100%" |
|
clearable |
|
multiple |
|
@change="Claimssettlement" |
|
> |
|
<el-option |
|
v-for="item in Processingresultsoptions" |
|
:key="item.value" |
|
:label="item.label" |
|
:value="item.value" |
|
/> |
|
</el-select> |
|
</el-form-item> |
|
<!-- 处理结果循环列表 --> |
|
<div class="el_Processingresults"> |
|
<template v-for="(item, index) in form.Claimamount" :key="index + item.title"> |
|
<div class="el_Processingresults_box"> |
|
<span class="el_title">{{ item.title }}</span> |
|
<div class="el_Processingresults_box_list"> |
|
<el-form-item |
|
label="金额" |
|
:prop="`Claimamount[${index}.money]`" |
|
:rules="ruleForm.money" |
|
> |
|
<el-input-number |
|
v-model="item.money" |
|
:min="0" |
|
:max="9999999" |
|
:controls="false" |
|
:value-on-clear="0" |
|
:precision="2" |
|
@change="Totalamount" |
|
/> |
|
</el-form-item> |
|
|
|
<el-form-item |
|
label="支付单位" |
|
:prop="`Claimamount[${index}.paymentUnit]`" |
|
:rules="ruleForm.paymentUnit" |
|
> |
|
<el-input v-model="item.paymentUnit" placeholder="请输入支付单位" clearable /> |
|
</el-form-item> |
|
<el-form-item |
|
label="理赔支付时间" |
|
:prop="`Claimamount[${index}.compensationTime]`" |
|
:rules="ruleForm.compensationTime" |
|
> |
|
<el-date-picker |
|
v-model="item.compensationTime" |
|
type="datetime" |
|
format="YYYY-MM-DD" |
|
value-format="YYYY-MM-DD HH:mm:ss" |
|
placeholder="理赔支付时间" |
|
size="default" |
|
/> |
|
</el-form-item> |
|
<el-form-item |
|
label="支付方式" |
|
:prop="`Claimamount[${index}.compensationMethod]`" |
|
:rules="ruleForm.compensationMethod" |
|
> |
|
<el-select |
|
v-model="item.compensationMethod" |
|
placeholder="请选择支付方式" |
|
style="width: 100%" |
|
clearable |
|
> |
|
<el-option |
|
v-for="items in item.Paymentmethod" |
|
:key="items.value" |
|
:label="items.label" |
|
:value="items.value" |
|
/> |
|
</el-select> |
|
</el-form-item> |
|
</div> |
|
</div> |
|
</template> |
|
</div> |
|
<el-form-item label="处理结果说明"> |
|
<el-input |
|
v-model="form.basis.resultDescription" |
|
placeholder="请输入处理结果说明" |
|
type="textarea" |
|
:autosize="{ minRows: 1, maxRows: 4 }" |
|
clearable |
|
/> |
|
</el-form-item> |
|
<div class="el_top"> |
|
<div class="el_Package_num"> |
|
<span>总计金额:{{ form.Totalamount }}(元)</span> |
|
</div> |
|
</div> |
|
</el-tab-pane> |
|
</el-tabs> |
|
|
|
<!-- 照片上传 --> |
|
<el-tabs |
|
v-model="form.responsibilities" |
|
class="demo-tabs responsibilities" |
|
@tab-click="handleClick" |
|
v-loading="form.Packageloading" |
|
v-if="['1', '3'].includes(form.basis.workOrderType)" |
|
> |
|
<el-form-item label=""> |
|
<el-tab-pane label="照片" name="0"> |
|
<el-upload |
|
v-model:file-list="form.fileList" |
|
:action="action" |
|
:headers="headers" |
|
:on-success="ImgSuccess" |
|
:before-upload="beforeAvatarUpload" |
|
:on-preview="Imgpreview" |
|
drag |
|
multiple |
|
list-type="picture-card" |
|
> |
|
<el-icon><Plus /></el-icon> |
|
</el-upload> |
|
<!-- 图片预览 --> |
|
<el-dialog v-model="form.dialogVisible"> |
|
<img w-full :src="form.url" /> |
|
</el-dialog> |
|
</el-tab-pane> |
|
</el-form-item> |
|
</el-tabs> |
|
<!-- 操作按钮 --> |
|
<div class="flex-c-c"> |
|
<el-button type="primary" icon="Refresh" @click="resetFormData">重置</el-button> |
|
<el-button type="primary" icon="Position" @click="onSubmit">提交</el-button> |
|
<el-button v-if="allFieldsFilled" type="primary" icon="Position" @click="onSubmit" |
|
>处理完毕</el-button |
|
> |
|
</div> |
|
</el-form> |
|
</div> |
|
</div> |
|
<!-- 历史包件弹窗 --> |
|
<el-dialog v-model="form.historydialog" title="查看历史包件" width="500"> |
|
<div class="el_details"> |
|
<el-form-item label="历史包件"> |
|
<el-select v-model="form.discoveryNode" placeholder="历史包件选择" style="width: 100%"> |
|
<el-option |
|
v-for="item in form.Historicalpackage" |
|
:key="item.workOrderId" |
|
:label="item.workOrderNumber" |
|
:value="item.workOrderId" |
|
/> |
|
</el-select> |
|
</el-form-item> |
|
<el-button @click="Viewdetails(form.discoveryNode)">查看详情</el-button> |
|
</div> |
|
|
|
<!-- <template #footer> |
|
<div class="dialog-footer"> |
|
<el-button @click="form.historydialog = false"> 取消</el-button> |
|
<el-button type="primary" @click="historyPush">查看</el-button> |
|
</div> |
|
</template> --> |
|
</el-dialog> |
|
</template> |
|
<script> |
|
// 缓存要引入当前页面地址 |
|
export default { |
|
name: '/aftersales/aftersalesWorkOrderAdd', |
|
}; |
|
</script> |
|
<script setup> |
|
import { ref, reactive, computed, onActivated } from 'vue'; |
|
import { ElMessage, ElMessageBox } from 'element-plus'; |
|
import { getDictionaryBiz } from '@/api/system/dict'; //字典 |
|
import { useStore } from 'vuex'; |
|
import { |
|
$_getList, |
|
$_submit, |
|
$_getDetail, |
|
$_remove, |
|
$_getBusinessDepartmentUser, |
|
$_getAbnormalPackage, |
|
$_shippingInformation, |
|
$_getAdvanceAbnormalPackage, |
|
} from '@/api/aftersales/aftersalesWorkOrder'; |
|
import { useRouter, useRoute } from 'vue-router'; |
|
import { getDetailWarehouse, getDeptWarehouse } from '@/api/basicdata/basicdataWarehouse'; //处理方 |
|
import { compressImageBlob } from '@/components/IMGcompressor/imgcompressor.js'; |
|
import { deepClone } from '@/utils/util'; |
|
import { getToken } from '@/utils/auth'; |
|
const $router = useRouter(); |
|
const $useStore = useStore(); //权限 |
|
const formCopy = ref({}); //用于重置表单 |
|
const form = ref({ |
|
basis: { |
|
TabactiveName: 1, //工单类型菜单 |
|
}, //基础信息 |
|
Totalamount: 0, //总金额 |
|
activPackage: '0', //包件信息菜单 |
|
responsibilities: '0', //内部责任菜单 |
|
ProcessingTab: '0', //处理结果菜单 |
|
Pageloading: false, //页面加载 |
|
Packageloading: false, //包件加载 |
|
historydialog: false, //历史包件弹窗 |
|
groundlineType: 0, //发现节点 |
|
Proportion: 100, //公司占比 |
|
totalMax: 100, //公司占比最大值 |
|
Processed: false, //是可以填写处理结果 |
|
dialogVisible: false, //图片展示 |
|
url: '', //预览图片地址 |
|
srcList: [], //预览图片循环列表 |
|
// 包件列表 |
|
PackageList: [ |
|
{ |
|
packageCode: '', //包条码 |
|
waybillNumber: '', //运单号 |
|
orderCode: '', //订单自编号 |
|
first: '', //一级品 |
|
secondary: '', //二级品 |
|
brandName: '', //品牌 |
|
history: true, //是否有历史包间 |
|
}, |
|
], //历史包件列表 |
|
Historicalpackage: [], |
|
// 内部责任划分 |
|
responsibilitiesList: [ |
|
{ |
|
businessId: '', //责任方 |
|
personResponsibleId: '', //责任人 |
|
responsibilityRatio: 0, //占比 |
|
description: '', //三方责任人 |
|
tripartite: '', //说明 |
|
ProportionMax: 99999999999999999, //最大值校验 |
|
Processingoptions: [ |
|
//提货责任方列表 |
|
], |
|
Responsibleoptions: [ |
|
// 责任方 |
|
], |
|
ResponsibleoNameptions: [ |
|
// 责任人列表 |
|
], |
|
}, |
|
], |
|
Trainoptions: [], //干线车次号 |
|
deliver: [], //配送车次号 |
|
// 理赔金额 |
|
Claimamount: [], |
|
fileList: [], //照片 |
|
}); |
|
const myData = ref({}); //用户信息记录 |
|
const ruleForm = reactive({ |
|
basis: { |
|
workOrderType: [{ required: true, message: '请选择异常类型', trigger: ['blur', 'change'] }], |
|
discoveryNode: [{ required: true, message: '请选择发现节点', trigger: ['blur', 'change'] }], |
|
trainNumber: [{ required: true, message: '请选择车次号', trigger: ['blur', 'change'] }], |
|
deliveryTime: [{ required: true, message: '请输入配送时间', trigger: ['blur', 'change'] }], |
|
deliveryDriver: [{ required: true, message: '请输入配送司机', trigger: ['blur', 'change'] }], |
|
vehicleRoute: [{ required: true, message: '请输入车辆线路', trigger: ['blur', 'change'] }], |
|
deliverGoodsTime: [{ required: true, message: '请输入发货时间', trigger: ['blur', 'change'] }], |
|
warehousingTime: [{ required: true, message: '请选择入库时间', trigger: ['blur', 'change'] }], |
|
discoveryTime: [{ required: true, message: '请选择发现时间', trigger: ['blur', 'change'] }], |
|
waybillMall: [ |
|
{ required: true, message: '请输入运单商场', trigger: ['blur'] }, |
|
{ max: 20, message: '运单商场最多20位', trigger: 'change' }, |
|
], |
|
typeServiceName: [{ required: false, message: '请输入合作模式', trigger: ['blur', 'change'] }], |
|
investigationProcess: [ |
|
{ required: true, message: '请输入调查经过', trigger: ['blur', 'change'] }, |
|
{ max: 200, message: '调查经过最多200位', trigger: 'change' }, |
|
], |
|
result: [{ required: false, message: '请输选择处理结果', trigger: ['blur'] }], |
|
processor: [{ required: true, message: '请选择处理方', trigger: ['blur'] }], |
|
processorEntityList: [{ required: true, message: '请选择责任方', trigger: ['blur'] }], |
|
}, |
|
packageCode: [ |
|
{ required: true, message: '请输入包条码', trigger: ['blur', 'change'] }, |
|
{ max: 64, message: '包条码最多64位', trigger: 'change' }, |
|
], |
|
waybillNumber: [ |
|
{ required: true, message: '请输入运单号', trigger: ['blur', 'change'] }, |
|
{ max: 30, message: '运单号最多30位', trigger: 'change' }, |
|
], |
|
orderCode: [ |
|
{ required: true, message: '请输入订单自编号', trigger: ['blur', 'change'] }, |
|
{ max: 70, message: '订单自编号最多70位', trigger: 'change' }, |
|
], |
|
first: [ |
|
{ required: false, message: '请输入一级品', trigger: ['blur', 'change'] }, |
|
{ max: 20, message: '一级品最多10位', trigger: 'change' }, |
|
], |
|
secondary: [ |
|
{ required: false, message: '请输入二级品', trigger: ['blur', 'change'] }, |
|
{ max: 20, message: '二级品最多10位', trigger: 'change' }, |
|
], |
|
brandName: [{ required: false, message: '请输入品牌', trigger: ['blur', 'change'] }], |
|
businessId: [{ required: true, message: '请选择责任方', trigger: ['blur', 'change'] }], |
|
personResponsibleId: [{ required: true, message: '请输入责任人', trigger: ['blur', 'change'] }], |
|
responsibilityRatio: [{ required: false, message: '请输入占比', trigger: ['blur', 'change'] }], |
|
tripartite: [{ required: false, message: '请输入三方责任人', trigger: ['blur', 'change'] }], |
|
description: [{ required: true, message: '请输入说明', trigger: ['blur', 'change'] }], |
|
money: [{ required: true, message: '请输入金额', trigger: ['blur', 'change'] }], |
|
paymentUnit: [{ required: false, message: '请输入支付单位', trigger: ['blur', 'change'] }], |
|
compensationTime: [ |
|
{ required: false, message: '请选择理赔支付时间', trigger: ['blur', 'change'] }, |
|
], |
|
compensationMethod: [{ required: false, message: '请选择支付方式', trigger: ['blur', 'change'] }], |
|
}); |
|
const ResponsibleParty = ref([]); //提货责任方 |
|
const ruleFormRef = ref(); //表单示例 |
|
// 异常类型 |
|
const Exceptionoptions = ref([]); |
|
// 发现节点 |
|
const Discoveringoptions = ref([]); |
|
// 处理方/责任方 |
|
const Processingoptions = ref([]); |
|
// 干线责任方 |
|
const Responsibleline = ref([]); |
|
// 支付方式 |
|
const Paymentmethodoptions = ref([]); |
|
// 处理结果 |
|
const Processingresultsoptions = ref([]); |
|
|
|
onActivated(() => { |
|
console.log($useStore, '$useStore'); |
|
console.log('进入缓存'); |
|
// if ($useStore.state.isRefresh.refreshObj.aftersalesWorkOrderAdd) { |
|
// // 重新请求数据 |
|
// $useStore.commit('EDIT_REFRESHITEM', { title: 'aftersalesWorkOrderAdd', status: false }); |
|
// } |
|
}); |
|
|
|
// 字典公共函数 |
|
async function updateDictionary(targetArray, dictionaryType) { |
|
await getDictionaryBiz(dictionaryType).then(res => { |
|
res.data.data.forEach(item => { |
|
targetArray.push({ |
|
value: item.dictKey, |
|
label: item.dictValue, |
|
}); |
|
}); |
|
}); |
|
} |
|
// 获取处理方和责任方 |
|
const Handling = async () => { |
|
await getDeptWarehouse().then(res => { |
|
let data = []; |
|
if (res.data.code == 200) { |
|
if (res.data && res.data.data.length) { |
|
res.data.data.forEach(item => { |
|
data.push({ |
|
value: item.id, |
|
label: item.name, |
|
}); |
|
}); |
|
} |
|
Processingoptions.value = deepClone(data); |
|
Responsibleline.value = deepClone(data); |
|
} |
|
}); |
|
}; |
|
// 内部责任划分初始化 |
|
const responsibilities = async () => { |
|
// 内部责任划分处理 |
|
form.value.responsibilitiesList = await [ |
|
{ |
|
businessId: '', //责任方 |
|
personResponsibleId: '', //责任人 |
|
responsibilityRatio: 0, //占比 |
|
description: '', //三方责任人 |
|
tripartite: '', //说明 |
|
ProportionMax: 99999999999999999, //最大值校验 |
|
Processingoptions: [ |
|
//提货责任方列表 |
|
...ResponsibleParty.value, |
|
], |
|
Responsibleoptions: [ |
|
// 责任方 |
|
...Processingoptions.value, |
|
], |
|
ResponsibleoNameptions: [ |
|
// 责任人列表 |
|
], |
|
id: 1, |
|
}, |
|
]; |
|
}; |
|
// 包件列表重置 |
|
const PackageListReset = async () => { |
|
//包件列表 |
|
form.value.PackageList = await [ |
|
{ |
|
packageCode: '', //包条码 |
|
waybillNumber: '', //运单号 |
|
orderCode: '', //订单自编号 |
|
first: '', //一级品 |
|
secondary: '', //二级品 |
|
thirdProduct: '', //三级品 |
|
brandName: '', //品牌 |
|
history: false, //是否有历史包间 |
|
id: 1, |
|
}, |
|
]; |
|
}; |
|
// 页面初始化数据处理 |
|
const PageState = () => { |
|
if (localStorage.getItem('my_data')) { |
|
myData.value = JSON.parse(localStorage.getItem('my_data')); //获取本地仓库信息 |
|
} |
|
// 内部责任划分初始化 |
|
responsibilities(); |
|
//包件列表初始化 |
|
PackageListReset(); |
|
formCopy.value = deepClone(form.value); //用于拷贝一份重置数据 |
|
}; |
|
// 页面必要初始化请求 |
|
const onLoad = async () => { |
|
form.value.Pageloading = true; //开启页面加载 |
|
await updateDictionary(Exceptionoptions.value, 'pc_work_order'); //异常类型 |
|
await updateDictionary(Discoveringoptions.value, 'pc_discovery_node'); //发现环节 |
|
await updateDictionary(ResponsibleParty.value, 'Responsible_party'); //责任方 |
|
await updateDictionary(Paymentmethodoptions.value, 'payment_method'); //支付方式 |
|
await updateDictionary(Processingresultsoptions.value, 'result_handling'); //理赔选择 |
|
await Handling(); //获取处理方和责任方 |
|
await PageState(); //页面基础数据处理 |
|
form.value.Pageloading = false; //关闭页面加载 |
|
}; |
|
onLoad(); |
|
const ProcessingState = computed(() => { |
|
if (form.value.basis.processor && form.value.basis.processor.length) { |
|
let data = form.value.basis.processor.find(res => res == myData.value.id); |
|
if (data) { |
|
return true; |
|
} else { |
|
// 如果选择的没有自己就重置数据 |
|
form.value.Claimamount = []; |
|
form.value.basis.result = []; |
|
return false; |
|
} |
|
} |
|
}); |
|
// 菜单切换 |
|
const handleClick = (tab, event) => { |
|
console.log(tab, event); |
|
}; |
|
// 发现节点事件 |
|
const DiscoveringNodesChange = async value => { |
|
console.log(value, 'value'); |
|
form.value.groundlineType = value; |
|
form.value.basis = { |
|
workOrderType: form.value.basis.workOrderType, //异常类型 |
|
discoveryNode: form.value.basis.discoveryNode, //发现节点 |
|
typeServiceName: form.value.basis.typeServiceName, //合作模式 |
|
TabactiveName: form.value.basis.TabactiveName, //订单类型 |
|
}; |
|
form.value.deliver = []; |
|
if (value == '3') { |
|
form.value.basis.processorEntityList = []; |
|
} else { |
|
delete form.value.basis.processorEntityList; |
|
} |
|
if (value == '5' || value == '7') { |
|
form.value.deliver = []; |
|
} |
|
console.log(form.value.basis, 'form.value.basis'); |
|
// 公司占比重置 |
|
form.value.Proportion = 0; |
|
// 内部责任化初始值 |
|
await responsibilities(); |
|
// 包件重置 |
|
await PackageListReset(); |
|
ruleFormRef.value.clearValidate(); |
|
}; |
|
// 异常类型 |
|
const workOrderTypeChange = value => { |
|
console.log(value); |
|
}; |
|
// 菜单切换显示输入框 |
|
const displaySettings = computed(() => { |
|
return { |
|
trainNumber: ['3', '5', '6', '7'].includes(form.value.groundlineType), //车次号 |
|
deliveryTime: ['5', '6', '7'].includes(form.value.groundlineType), //配送时间 |
|
deliveryDriver: ['5', '6', '7'].includes(form.value.groundlineType), //配送司机 |
|
vehicleRoute: ['3'].includes(form.value.groundlineType), //车辆线路 |
|
deliverGoodsTime: ['2'].includes(form.value.groundlineType), //发货时间 |
|
warehousingTime: ['4'].includes(form.value.groundlineType), //入库时间 |
|
discoveryTime: ['4', '5', '6', '7'].includes(form.value.groundlineType), //发现时间 |
|
processorEntityList: ['3'].includes(form.value.groundlineType), //干线卸车责任方 |
|
waybillMall: true, //运单商场 |
|
typeServiceName: true, //合作模式 |
|
processor: true, //处理方 |
|
investigationProcess: true, //调查经过 |
|
}; |
|
}); |
|
// 新增包件 |
|
const Addpackages = () => { |
|
let data = { |
|
packageCode: '', //包条码 |
|
waybillNumber: '', //运单号 |
|
orderCode: '', //订单自编号 |
|
first: '', //一级品 |
|
secondary: '', //二级品 |
|
thirdProduct: '', //三级品 |
|
brandName: '', //品牌 |
|
history: false, //是否有历史包件 |
|
HistoricalPackageList: [], //历史包件存储 |
|
id: form.value.PackageList.length + 1, |
|
}; |
|
form.value.PackageList.push(data); |
|
}; |
|
|
|
// 移除包件 |
|
const Removepackage = index => { |
|
console.log(index, 'index'); |
|
ElMessageBox.confirm('是否移除当前包件信息?', '提示', { |
|
confirmButtonText: '确定', |
|
cancelButtonText: '取消', |
|
type: 'warning', |
|
}).then(async () => { |
|
await form.value.PackageList.splice(index, 1); //移除当前点击的按钮 |
|
form.value.PackageList.forEach((item, index) => { |
|
item.id = index + 1; |
|
}); |
|
console.log(form.value.PackageList, 'form.value.PackageList'); |
|
ElMessage({ |
|
message: '移除成功.', |
|
type: 'success', |
|
plain: true, |
|
}); |
|
}); |
|
}; |
|
|
|
// 历史包件查看 |
|
const ViewhistoricalPackages = item => { |
|
form.value.Historicalpackage = item.HistoricalPackageList; |
|
form.value.historydialog = true; //打开弹窗 |
|
}; |
|
// 新增责任方 |
|
const AddResponsible = () => { |
|
let data = { |
|
businessId: '', //责任方 |
|
personResponsibleId: '', //责任人 |
|
responsibilityRatio: 0, //占比 |
|
description: '', //三方责任人 |
|
tripartite: '', //说明 |
|
ProportionMax: 99999999999999999, //最大值校验 |
|
Processingoptions: [ |
|
//提货责任方列表 |
|
...ResponsibleParty.value, |
|
], |
|
Responsibleoptions: [ |
|
// 责任方 |
|
...Processingoptions.value, |
|
], |
|
ResponsibleoNameptions: [ |
|
// 责任人列表 |
|
], |
|
id: form.value.responsibilitiesList.length + 1, |
|
}; |
|
form.value.responsibilitiesList.push(data); |
|
// calculateMaxValues(); |
|
}; |
|
// 责任方移除 |
|
const Responsemoval = index => { |
|
console.log(index, 'index===>'); |
|
ElMessageBox.confirm('是否移除当前责任信息?', '提示', { |
|
confirmButtonText: '确定', |
|
cancelButtonText: '取消', |
|
type: 'warning', |
|
}).then(async () => { |
|
await form.value.responsibilitiesList.splice(index, 1); //移除当前点击的按钮 |
|
form.value.responsibilitiesList.forEach((item, index) => { |
|
item.id = index + 1; |
|
}); |
|
// calculateMaxValues(); //调用占比计算 |
|
ElMessage({ |
|
message: '移除成功.', |
|
type: 'success', |
|
plain: true, |
|
}); |
|
}); |
|
}; |
|
|
|
const calculateMaxValues = () => { |
|
return; |
|
// 计算每个输入框剩余最大值 |
|
let data = form.value.responsibilitiesList; |
|
let totalUsed = data.reduce((acc, item) => acc + item.responsibilityRatio, 0); |
|
data.forEach(item => { |
|
item.ProportionMax = Math.min(100, form.value.totalMax - totalUsed + item.responsibilityRatio); |
|
}); |
|
|
|
// 计算公司占比 |
|
let totasum = data.reduce((acc, item) => acc + item.responsibilityRatio, 0); |
|
form.value.Proportion = form.value.totalMax - totasum; |
|
}; |
|
|
|
// 公司占比计算 |
|
const CompanyProportionInput = value => { |
|
calculateMaxValues(); |
|
}; |
|
|
|
// 理赔总金额计算 |
|
const Totalamount = () => { |
|
console.log(form.value.Claimamount); |
|
form.value.Totalamount = form.value.Claimamount.map(res => res.money).reduce( |
|
(accumulator, currentValue) => accumulator + currentValue, |
|
0 |
|
); |
|
}; |
|
|
|
const Claimssettlement = value => { |
|
form.value.Claimamount = []; |
|
if (value.length) { |
|
let data = []; |
|
value.forEach(item => { |
|
let _data = Processingresultsoptions.value.find(res => res.value == item); |
|
if (_data) { |
|
data.push(_data); |
|
} |
|
}); |
|
if (data && data.length) { |
|
data.forEach(item => { |
|
form.value.Claimamount.push({ |
|
title: item.label, //标题 |
|
money: 0, //金额 |
|
paymentUnit: '', //支付单位 |
|
compensationTime: '', //理赔支付时间 |
|
compensationMethod: '', //支付方式 |
|
Paymentmethod: [...JSON.parse(JSON.stringify(Paymentmethodoptions.value))], |
|
}); |
|
}); |
|
} |
|
} |
|
}; |
|
// 图片上传必须携带TOKEN |
|
const headers = computed(() => { |
|
return { 'Blade-Auth': 'Bearer ' + getToken() }; |
|
}); |
|
// 图片上传接口 |
|
const action = computed(() => { |
|
return '/api/blade-resource/oss/endpoint/put-file'; |
|
}); |
|
// 上传图片规则 |
|
const beforeAvatarUpload = async rawFile => { |
|
console.log(rawFile, '图片上传前回调'); |
|
if (rawFile.type !== 'image/png' && rawFile.type !== 'image/jpeg') { |
|
ElMessage.error('只能上传格式为PNG/JPG的图片!'); |
|
return false; |
|
} else if (rawFile.size / 1024 / 1024 > 4) { |
|
ElMessage.error('图片大小不能大于4MB!'); |
|
return false; |
|
} |
|
const res = await compressImageBlob(rawFile); |
|
return res; |
|
}; |
|
// // 查看图片 |
|
const Imgpreview = value => { |
|
console.log(value, '查看图片'); |
|
|
|
form.value.dialogVisible = true; |
|
form.value.url = value.response.data.link; |
|
}; |
|
// 图片上传成功回调函数 |
|
const ImgSuccess = (response, uploadFile) => { |
|
if (response.success === true) { |
|
console.log(response); |
|
console.log(form.value); |
|
} |
|
}; |
|
const historyPush = () => {}; |
|
// 重置 |
|
const resetFormData = () => { |
|
// 尝试使用 HTML 字符串 |
|
const message = `重置表单会造成<span style="color: red;">数据丢失!</span>是否继续?`; |
|
ElMessageBox.confirm(message, '警告', { |
|
dangerouslyUseHTMLString: true, // 如果组件支持,启用此选项以解析 HTML |
|
confirmButtonText: '确认', |
|
cancelButtonText: '取消', |
|
type: 'warning', |
|
}).then(async () => { |
|
form.value.Pageloading = true; //开启页面加载 |
|
form.value = await deepClone(formCopy.value); //重置数据 |
|
ruleFormRef.value.resetFields(); |
|
let _time = setTimeout(() => { |
|
form.value.Pageloading = false; //开启页面加载 |
|
clearTimeout(_time); |
|
}, 300); |
|
}); |
|
}; |
|
|
|
// 包条码查询信息 |
|
const ChangePackageInfo = async item => { |
|
if (!form.value.basis.workOrderType || !form.value.basis.discoveryNode) { |
|
const messages = []; |
|
|
|
if (!form.value.basis.workOrderType) { |
|
messages.push('【异常类型】'); |
|
} |
|
|
|
if (!form.value.basis.discoveryNode) { |
|
messages.push('【发现节点】'); |
|
} |
|
|
|
ElMessage({ |
|
message: `请先选择${messages.join('和')}`, |
|
type: 'warning', |
|
plain: true, |
|
}); |
|
item.packageCode = ''; |
|
return; |
|
} |
|
console.log(item, 'item'); |
|
if (!item.packageCode) { |
|
item.waybillNumber = ''; //运单号 |
|
item.orderCode = ''; //订单自编码 |
|
item.first = ''; //一级品 |
|
item.secondary = ''; //二级品 |
|
(item.thirdProduct = ''), //三级品 |
|
(item.brandName = ''); //品牌 |
|
let data = form.value.PackageList.find(res => res.packageCode); //判断是否已经查询了运单商场 |
|
if (!data) { |
|
form.value.basis.waybillMall = ''; //运单商场 |
|
form.value.basis.typeServiceName = ''; //合作模式 |
|
} |
|
return; |
|
} else if (item.packageCode) { |
|
item.waybillNumber = ''; //运单号 |
|
item.orderCode = ''; //订单自编码 |
|
item.first = ''; //一级品 |
|
item.secondary = ''; //二级品 |
|
(item.thirdProduct = ''), //三级品 |
|
(item.brandName = ''); //品牌 |
|
if (form.value.PackageList == 1) { |
|
form.value.basis.waybillMall = ''; //运单商场 |
|
form.value.basis.typeServiceName = ''; //合作模式 |
|
} |
|
} |
|
// 判断输入的包条码是否一样 |
|
if (form.value.PackageList.length > 1) { |
|
let packageCodeState = await form.value.PackageList.find(res => { |
|
// 排除当前项,只匹配其他项的包条码 |
|
return res.packageCode === item.packageCode && res !== item; |
|
}); |
|
|
|
// 查找是否已经存在相同包条码 |
|
if (packageCodeState) { |
|
item.packageCode = ''; |
|
ElMessage({ |
|
message: '已经存在相同包条码,请勿重复添加!', |
|
type: 'warning', |
|
}); |
|
return; |
|
} |
|
} |
|
|
|
let data = { |
|
packageCode: item.packageCode, //输入框参数 |
|
}; |
|
form.value.Pageloading = true; //开启页面加载 |
|
let res = null; |
|
try { |
|
if (form.value.basis.discoveryNode == 3) { |
|
res = await $_getAdvanceAbnormalPackage(data); |
|
console.log(res, '干线查询包条'); |
|
} else { |
|
res = await $_getAbnormalPackage(data); |
|
} |
|
} catch (e) { |
|
console.log(e, 'error'); |
|
} finally { |
|
form.value.Pageloading = false; //关闭页面加载 |
|
} |
|
|
|
console.log(res, '查询包条'); |
|
let packageData = {}; |
|
if (res.data.code == 200 && res.data && res.data.data?.length) { |
|
form.value.Pageloading = false; //关闭页面加载 |
|
packageData = res.data.data[0]; //取第一个值,内容相同 |
|
// 判断输入的是否为同一批货 |
|
let state = await form.value.PackageList.find(res => res.orderCode || res.brandName); |
|
if (state) { |
|
if ( |
|
state.orderCode != packageData.orderCode || |
|
state.waybillNumber != packageData.waybillNumber |
|
) { |
|
ElMessage({ |
|
message: '请选择相同订单自编和运单号的包条码', |
|
type: 'warning', |
|
}); |
|
return; |
|
} |
|
} |
|
ElMessage({ |
|
message: '查询成功', |
|
type: 'success', |
|
}); |
|
item.waybillNumber = packageData.waybillNumber || ''; //运单号 |
|
item.orderCode = packageData.orderCode || ''; //订单自编码 |
|
item.first = packageData.firsts || ''; //一级品 |
|
item.secondary = packageData.second || ''; //二级品 |
|
item.thirdProduct = packageData.thirdProduct || ''; //三级品 |
|
item.brandName = packageData.brandName || ''; //品牌 |
|
form.value.basis.waybillMall = packageData.mallName || ''; //运单商场 |
|
form.value.basis.typeServiceName = packageData.typeServiceName || ''; //合作模式 |
|
// 是否显示历史包件按钮,存在多个包件则展示 |
|
const results = res.data.data.filter(item => { |
|
return item.workOrderId && item.workOrderNumber; |
|
}); |
|
// 存储历史订单 |
|
if (results.length) { |
|
item.history = true; |
|
item.HistoricalPackageList = results; |
|
} else { |
|
item.history = false; |
|
} |
|
console.log(form.value.basis.discoveryNode, 'form.value.discoveryNode'); |
|
// 判断发现节点(干线车次号、车辆线路处理) |
|
if (['3'].includes(form.value.basis.discoveryNode)) { |
|
let addedTrainNumbers = []; // 临时变量存储已经添加过的车次号 |
|
form.value.Trainoptions = []; |
|
res.data.data.forEach(item => { |
|
if (item.trunklines && item.trunklines.length) { |
|
item.trunklines.forEach(itemChid => { |
|
if (!addedTrainNumbers.includes(itemChid.trainNumber)) { |
|
form.value.Trainoptions.push({ |
|
trainNumber: itemChid.trainNumber, // 车次号 |
|
vehicleRoute: itemChid.vehicleRoute, // 车辆线路 |
|
}); |
|
addedTrainNumbers.push(itemChid.trainNumber); |
|
} |
|
}); |
|
} |
|
}); |
|
console.log(form.value.Trainoptions, 'form.value.Trainoptions'); |
|
} |
|
// 配送环节车次号处理 |
|
if (['5', '7'].includes(form.value.basis.discoveryNode)) { |
|
let addedTrainNumbers = []; // 临时变量存储已经添加过的车次号 |
|
res.data.data.forEach(item => { |
|
if (item.deliver && item.deliver.length) { |
|
form.value.deliver = []; |
|
item.deliver.forEach(itemChid => { |
|
if (!addedTrainNumbers.includes(itemChid.trainNumber)) { |
|
form.value.deliver.push({ |
|
driverName: itemChid.driverName, // 主司机 |
|
taskTime: itemChid.taskTime, // 配送时间 |
|
trainNumber: itemChid.trainNumber, //车次号 |
|
}); |
|
addedTrainNumbers.push(itemChid.trainNumber); |
|
} |
|
}); |
|
} |
|
}); |
|
console.log(form.value.Trainoptions, 'form.value.Trainoptions'); |
|
} |
|
} else { |
|
form.value.Pageloading = false; //关闭页面加载 |
|
ElMessage({ |
|
message: '暂无查询内容,请检查参数是否正确!或【手动录入信息】', |
|
type: 'warning', |
|
}); |
|
} |
|
}; |
|
// 查看历史包件详情 |
|
const Viewdetails = value => { |
|
if (!value) { |
|
ElMessage({ |
|
message: '请选择要查看的数据', |
|
type: 'warning', |
|
}); |
|
return; |
|
} |
|
// 筛选出来输入框值 |
|
let data = form.value.Historicalpackage.find(res => res.workOrderId == value); |
|
$router.push({ |
|
path: '/aftersales/aftersalesWorkOrderInfo', |
|
query: { |
|
id: data.workOrderId, |
|
name: data.workOrderId + '-信息查看', |
|
routerState: 'view', |
|
}, |
|
}); |
|
}; |
|
// 责任人查询>获取当前责任方的责任人 |
|
const ResponsiblePartychange = item => { |
|
item.personResponsibleId = ''; |
|
if (!item.businessId) { |
|
return; |
|
} |
|
let data = { |
|
warehouseId: item.businessId, |
|
}; |
|
// 清空责任人 |
|
|
|
$_getBusinessDepartmentUser(data).then(res => { |
|
console.log(res, '获取责任人列表'); |
|
if (res.data.code == 200 && res.data.data && res.data.data.length) { |
|
ElMessage({ |
|
message: '查询成功', |
|
type: 'success', |
|
}); |
|
item.ResponsibleoNameptions = res.data.data; |
|
} else { |
|
ElMessage({ |
|
message: '暂未查询到责任人', |
|
type: 'warning', |
|
}); |
|
item.ResponsibleoNameptions = []; |
|
} |
|
}); |
|
}; |
|
|
|
// 车次号带出车辆线路 |
|
const DeliveryTrainnumber = value => { |
|
console.log(value, '接收的参数值'); |
|
if (value) { |
|
if (form.value.basis.discoveryNode == '3') { |
|
if (form.value.Trainoptions && form.value.Trainoptions.length) { |
|
let data = form.value.Trainoptions.find(res => res.trainNumber == value); |
|
if (data) { |
|
form.value.basis.vehicleRoute = data.vehicleRoute; //车辆线路 |
|
} |
|
} |
|
} else if (['5', '6', '7'].includes(form.value.basis.discoveryNode)) { |
|
if (form.value.deliver && form.value.deliver.length) { |
|
let data = form.value.deliver.find(res => res.trainNumber == value); |
|
if (data) { |
|
form.value.basis.deliveryDriver = data.driverName; //司机 |
|
form.value.basis.deliveryTime = data.taskTime; //配送时间 |
|
} |
|
} |
|
} |
|
} |
|
}; |
|
|
|
// 是否显示处理完毕按钮 |
|
const allFieldsFilled = computed(() => { |
|
const claimAmount = form.value.Claimamount; |
|
if (!claimAmount.length) { |
|
form.value.Processed = false; |
|
return false; |
|
} |
|
const allFilled = claimAmount.every( |
|
item => item.compensationMethod && item.compensationTime && item.paymentUnit |
|
); |
|
|
|
form.value.Processed = allFilled; |
|
return allFilled; |
|
}); |
|
// 结果提交 |
|
const onSubmit = () => { |
|
console.log(form.value); |
|
ruleFormRef.value.validate(valid => { |
|
console.log(ruleFormRef.value, 'ruleFormRef.value'); |
|
console.log(valid, 'valid'); |
|
if (!valid) { |
|
ElMessage({ |
|
message: '息未填写完整,请根据提示填写完整!', |
|
type: 'warning', |
|
}); |
|
return; |
|
} |
|
// 货损照片上传判断 |
|
if (form.value.basis.workOrderType == '1') { |
|
console.log(form.value.fileList.length, ''); |
|
if (form.value.fileList.length < 2) { |
|
ElMessage({ |
|
message: '请上传最低2张货损图片', |
|
type: 'warning', |
|
}); |
|
return; |
|
} |
|
} |
|
// 串货图片附件 |
|
if (form.value.basis.workOrderType == '3') { |
|
if (!form.value.fileList.length) { |
|
ElMessage({ |
|
message: '请上传窜货图片', |
|
type: 'warning', |
|
}); |
|
return; |
|
} |
|
} |
|
|
|
const message = `注意信息填写正确!点击确定将<span style="color: red;">提交工单</span>是否继续?`; |
|
ElMessageBox.confirm(message, '提示', { |
|
dangerouslyUseHTMLString: true, // 如果组件支持,启用此选项以解析 HTML |
|
confirmButtonText: '确认', |
|
cancelButtonText: '取消', |
|
type: 'warning', |
|
}).then(async () => { |
|
form.value.Pageloading = true; //开启页面加载 |
|
|
|
let submitData = { |
|
...form.value.basis, |
|
identifying: form.value.basis.TabactiveName, //1订单2零担3库存品 |
|
}; |
|
// 包件处理 |
|
if (form.value.PackageList.length) { |
|
submitData.packageEntityList = []; |
|
form.value.PackageList.forEach(item => { |
|
submitData['packageEntityList'].push({ |
|
packageCode: item.packageCode, //包条码 |
|
waybillNumber: item.waybillNumber, //运单号 |
|
orderCode: item.orderCode, //订单自编号 |
|
first: item.first, //一级品 |
|
secondary: item.secondary, //二级品 |
|
thirdProduct: item.thirdProduct, //三级品 |
|
brandName: item.brandName, //品牌 |
|
}); |
|
}); |
|
// 订单自编号 |
|
submitData.orderCode = form.value.PackageList[0].orderCode; |
|
// 运单号 |
|
submitData.waybillNumber = form.value.PackageList[0].waybillNumber; |
|
} |
|
submitData.processorEntityList = []; |
|
// 处理方处理 |
|
if (form.value.basis.processor.length) { |
|
form.value.basis.processor.forEach(item => { |
|
submitData['processorEntityList'].push({ |
|
businessName: Processingoptions.value.find(res => res.value == item).label, //仓库名称 |
|
businessId: item, //仓库ID |
|
conditions: 1, //固定参数 |
|
typesOf: 2, //1责任方 ,2处理方 |
|
}); |
|
}); |
|
} |
|
|
|
// 责任方处理 |
|
if (form.value.groundlineType == '1') { |
|
form.value.responsibilitiesList.forEach(item => { |
|
let businesTemp = item.Responsibleoptions.find(res => res.value == item.businessId); //仓库名称 |
|
submitData['processorEntityList'].push({ |
|
businessName: businesTemp ? businesTemp.label : item.businessId, //仓库名称 |
|
businessId: item.businessId, //仓库ID |
|
conditions: 1, //固定参数 |
|
typesOf: 1, //1责任方 ,2处理方 |
|
}); |
|
}); |
|
} |
|
|
|
// 干线卸车责任方处理 |
|
if (form.value.groundlineType == '3') { |
|
if (form.value.basis.processorEntityList && form.value.basis.processorEntityList.length) { |
|
form.value.basis.processorEntityList.forEach(item => { |
|
console.log(item, '干线卸车'); |
|
submitData['processorEntityList'].push({ |
|
businessName: Responsibleline.value.find(res => res.value == item).label, //仓库名称 |
|
businessId: item, //仓库ID |
|
conditions: 1, //固定参数 |
|
typesOf: 1, //1责任方 ,2处理方 |
|
}); |
|
}); |
|
} |
|
} |
|
|
|
// 内部责任划分 |
|
if (form.value.basis.discoveryNode != 3) { |
|
// 干线卸车环节不需要内部责任划分 |
|
if (form.value.responsibilitiesList.length) { |
|
submitData.personResponsibleDTO = []; |
|
let Responsibleperson = ''; |
|
form.value.responsibilitiesList.forEach(item => { |
|
console.log(item); |
|
let data = { |
|
responsibilityRatio: item.responsibilityRatio, //责任占比 |
|
tripartite: item.tripartite, //三方责任人 |
|
description: item.description, //说明 |
|
}; |
|
// 责任人查询 |
|
Responsibleperson = item.ResponsibleoNameptions.find( |
|
res => res.id == item.personResponsibleId |
|
); |
|
|
|
if (form.value.groundlineType == '1') { |
|
data.personResponsibleName = item.personResponsibleId; //责任人名称 |
|
data.businessName = item.Processingoptions.find( |
|
res => res.value == item.businessId |
|
).label; //责任方 |
|
data.businessId = item.businessId; //责任方id |
|
} else { |
|
data.personResponsibleId = Responsibleperson ? Responsibleperson.id : null; //责任人id |
|
data.personResponsibleName = Responsibleperson |
|
? Responsibleperson.name |
|
: item.personResponsibleId; //责任人名称 |
|
data.businessName = |
|
item.Responsibleoptions.find(res => res.value == item.businessId)?.label || ''; //责任方 |
|
data.businessId = item.businessId; //责任方id |
|
} |
|
// 如果是自定义责任人就删除ID |
|
if (!data.personResponsibleId) { |
|
delete data.personResponsibleId; |
|
} |
|
submitData['personResponsibleDTO'].push(data); |
|
}); |
|
} |
|
} |
|
|
|
// 图片处理 |
|
if ( |
|
form.value.fileList.length && |
|
(form.value.basis.workOrderType == '1' || form.value.basis.workOrderType == '3') |
|
) { |
|
submitData.decreaseImageEntityList = []; |
|
form.value.fileList.forEach(item => { |
|
if (item.response) { |
|
submitData['decreaseImageEntityList'].push({ |
|
imageName: item.response.data.originalName, //图片名称 |
|
imagePath: item.response.data.link, //图片地址 |
|
imageType: form.value.basis.workOrderType == 1 ? 10 : 20, //图片类型 |
|
}); |
|
} |
|
}); |
|
} |
|
console.log(form.value, '表单内容'); |
|
|
|
// 处理结果 |
|
if (form.value.basis.result?.length) { |
|
submitData.aftersalesProcessingResultsDTO = { |
|
money: 0, //金额总和 |
|
resultType: [], //处理结果名称 |
|
processingMoneyEntityList: [], |
|
}; |
|
let PlayName = []; //赔付方式名称 |
|
if (form.value.Claimamount.length) { |
|
form.value.Claimamount.forEach(item => { |
|
let resultTypeValue = Processingresultsoptions.value.find( |
|
res => res.label == item.title |
|
).value; |
|
if (item.compensationMethod) { |
|
PlayName.push( |
|
item.Paymentmethod.find(res => res.value == item.compensationMethod).label |
|
); |
|
} |
|
submitData.aftersalesProcessingResultsDTO['processingMoneyEntityList'].push({ |
|
compensationMethodName: |
|
item.Paymentmethod.find(res => res.value == item.compensationMethod)?.label || '', //支付方式名称 |
|
compensationMethod: item.compensationMethod, //支付方式value |
|
compensationTime: item.compensationTime, //支付时间 |
|
money: item.money, //支付金额 |
|
paymentUnit: item.paymentUnit, //支付单位 |
|
resultName: item.title, //处理结果方式 下补单 |
|
resultType: resultTypeValue ? resultTypeValue : null, //处理结果方式 value |
|
typesOf: 1, //固定参数 |
|
}); |
|
}); |
|
submitData.aftersalesProcessingResultsDTO.resultType = form.value.Claimamount.map( |
|
res => res.title |
|
).join(','); //处理结果名称 |
|
|
|
let filteredArray = form.value.Claimamount.map(res => res.money); //金额总和 |
|
|
|
submitData.aftersalesProcessingResultsDTO.money = filteredArray.reduce( |
|
(accumulator, currentValue) => accumulator + currentValue, |
|
0 |
|
); |
|
// 支付方式名称 |
|
submitData.aftersalesProcessingResultsDTO.compensationMethod = PlayName.join(','); |
|
submitData.aftersalesProcessingResultsDTO.resultDescription = |
|
form.value.basis.resultDescription; //处理结果说明 |
|
delete form.value.basis.resultDescription; //删除无用信息 |
|
} |
|
} |
|
form.value.Pageloading = true; //关闭页面加载 |
|
//是否直接提交到处理结果(处理完毕) |
|
if (form.value.Processed) { |
|
submitData.workOrderStatus = 30; |
|
submitData.resultIdentification = 1; |
|
} else { |
|
submitData.resultIdentification = 2; |
|
} |
|
|
|
delete submitData.result; //删除处理结果字段 |
|
//移除责任方表单(必须) |
|
delete submitData.processor; |
|
console.log(submitData, '处理好的参数'); |
|
$_submit(submitData) |
|
.then(res => { |
|
ElMessage({ |
|
message: res.data.msg || '创建成功', |
|
type: 'success', |
|
}); |
|
if (res.data.code == 200) { |
|
form.value.Pageloading = false; //关闭页面加载 |
|
ElMessageBox.confirm('当前工单创建成功,是否继续创建?', '提示', { |
|
confirmButtonText: '确定', |
|
cancelButtonText: '返回', |
|
type: 'warning', |
|
}) |
|
.then(async () => { |
|
form.value = await deepClone(formCopy.value); //用于拷贝一份重置数据 |
|
await PageState(); |
|
await ruleFormRef.value.resetFields(); |
|
form.value.Pageloading = false; //关闭页面加载 |
|
}) |
|
.catch(() => { |
|
$useStore.commit('EDIT_REFRESHITEM', { |
|
title: 'aftersalesWorkOrder', |
|
status: true, |
|
}); //要刷新的页面 |
|
$useStore.commit('Customer_Menu', 0); //要刷新的菜单 |
|
$useStore.commit('DEL_TAG_CURRENT'); //关闭当前页面 |
|
$router.push({ |
|
path: '/aftersales/aftersalesWorkOrder', |
|
}); |
|
}); |
|
} |
|
}) |
|
.catch(error => { |
|
console.log(error, 'error'); |
|
form.value.Pageloading = false; //关闭页面加载 |
|
}); |
|
}); |
|
}); |
|
}; |
|
const TabactiveClick = (a, b) => { |
|
console.log(a, b); |
|
}; |
|
</script> |
|
|
|
<style scoped lang="scss"> |
|
.pageContent { |
|
padding: 10px; |
|
width: 100%; |
|
height: 100%; |
|
box-sizing: border-box; |
|
} |
|
:deep(.tablemun) { |
|
padding: 0; |
|
.el-tabs__nav-scroll { |
|
// border-left: 1px solid #dcdfe6; |
|
// border-right: 1px solid #dcdfe6; |
|
} |
|
.el-tabs__content { |
|
display: none; |
|
} |
|
} |
|
.placeholder { |
|
width: 100%; |
|
height: 40px; |
|
box-sizing: border-box; |
|
border-left: 1px solid #dcdfe6; |
|
border-right: 1px solid #dcdfe6; |
|
} |
|
|
|
// 主体内容 |
|
.content { |
|
padding: 10px; |
|
width: 100%; |
|
border: 1px solid #dcdfe6; |
|
box-sizing: border-box; |
|
border-radius: 2px; |
|
.tablemunTop { |
|
display: flex; |
|
justify-content: space-between; |
|
|
|
.el-form-item { |
|
width: 26%; |
|
display: flex; |
|
align-items: center; |
|
:deep(.el-form-item__label) { |
|
margin-bottom: 0 !important; |
|
} |
|
} |
|
} |
|
} |
|
// 包件列表 |
|
.Packagebox { |
|
.el_Package { |
|
display: flex; |
|
align-items: center; |
|
border-bottom: 1px solid #afbdc3; |
|
margin-bottom: 10px; |
|
.el_activPackage_btton { |
|
flex: 1; |
|
display: flex; |
|
justify-content: space-between; |
|
margin: 0px 2px; |
|
} |
|
} |
|
:deep(.is-active) { |
|
font-weight: bold; |
|
} |
|
:deep(.Package) { |
|
width: 83%; |
|
display: flex; |
|
align-items: center; |
|
.el-form-item { |
|
width: 14%; |
|
margin-right: 6px; |
|
.el-form-item__label { |
|
margin-bottom: 0; |
|
} |
|
} |
|
.Number { |
|
width: 20px; |
|
height: 20px; |
|
// background-color: #409eff; |
|
color: #409eff; |
|
text-align: center; |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
border-radius: 50%; |
|
margin-right: 10px; |
|
} |
|
} |
|
.el_addPackage { |
|
border: none; |
|
color: #ffffff; |
|
} |
|
.el_top { |
|
display: flex; |
|
align-items: center; |
|
margin-bottom: 10px; |
|
height: 40px; |
|
.el_Package_num { |
|
font-size: 14px; |
|
height: 80%; |
|
border-bottom: 1px solid #409eff; |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
padding: 2px; |
|
box-sizing: border-box; |
|
span { |
|
color: #666; |
|
font-weight: 500; |
|
} |
|
} |
|
} |
|
} |
|
.el_details { |
|
display: flex; |
|
align-items: flex-start; |
|
justify-content: space-between; |
|
.el-form-item { |
|
width: 78%; |
|
} |
|
} |
|
.Basicinformation { |
|
width: 100%; |
|
display: flex; |
|
flex-wrap: wrap; |
|
:deep(.el-form-item) { |
|
width: 10.5%; |
|
margin-right: 6px; |
|
.el-form-item__content { |
|
.el-input { |
|
height: 100% !important; |
|
.el-input__wrapper { |
|
height: 100%; |
|
} |
|
} |
|
} |
|
.el-form-item__label { |
|
margin-bottom: 0; |
|
} |
|
} |
|
} |
|
.responsibilities { |
|
width: 100%; |
|
:deep(.el-tabs__content) { |
|
width: 100%; |
|
} |
|
|
|
:deep(.el-upload-dragger) { |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
} |
|
:deep(.el-tab-pane) { |
|
width: 100%; |
|
} |
|
// .el-dialog{ |
|
// height: 40% !important; |
|
// img{ |
|
// height: 100% !important; |
|
// } |
|
// } |
|
.el_responsibilities { |
|
width: 100%; |
|
display: flex; |
|
flex-wrap: wrap; |
|
align-items: center; |
|
.el-form-item { |
|
width: 14%; |
|
margin-right: 6px; |
|
.el-input-number { |
|
width: 100%; |
|
} |
|
} |
|
:deep(.el_responsibilities_box) { |
|
width: 80%; |
|
display: flex; |
|
align-items: center; |
|
border-bottom: 1px solid #afbdc3; |
|
margin-bottom: 10px; |
|
.el-form-item { |
|
.el-form-item__label { |
|
margin-bottom: 0; |
|
} |
|
} |
|
.el_Investigation { |
|
flex: 1; |
|
} |
|
.Number { |
|
width: 20px; |
|
height: 20px; |
|
// background-color: #409eff; |
|
color: #409eff; |
|
text-align: center; |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
border-radius: 50%; |
|
margin-right: 10px; |
|
} |
|
} |
|
} |
|
.el_top { |
|
display: flex; |
|
align-items: center; |
|
margin-bottom: 10px; |
|
height: 40px; |
|
.el_addPackage { |
|
border: none; |
|
} |
|
.el_Package_num { |
|
font-size: 14px; |
|
height: 80%; |
|
border-bottom: 1px solid #409eff; |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
padding: 2px; |
|
box-sizing: border-box; |
|
span { |
|
color: #666; |
|
font-weight: 500; |
|
} |
|
} |
|
} |
|
:deep(.is-active) { |
|
font-weight: bold; |
|
} |
|
} |
|
// 处理结果 |
|
:deep(.Processingresults) { |
|
.is-active { |
|
font-weight: bold; |
|
} |
|
.el_top { |
|
display: flex; |
|
align-items: center; |
|
margin-bottom: 10px; |
|
height: 40px; |
|
.el_addPackage { |
|
border: none; |
|
} |
|
.el_Package_num { |
|
font-size: 14px; |
|
height: 80%; |
|
border-bottom: 1px solid #409eff; |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
padding: 2px; |
|
box-sizing: border-box; |
|
span { |
|
color: #666; |
|
font-weight: 500; |
|
} |
|
} |
|
} |
|
.el_Processingresults { |
|
display: flex; |
|
flex-wrap: wrap; |
|
.el_Processingresults_box { |
|
display: flex; |
|
flex-direction: column; |
|
width: 48%; |
|
.el_title { |
|
display: flex; |
|
width: fit-content; |
|
padding: 0 10px; |
|
margin-bottom: 4px; |
|
// border-left: 3px solid #172e60; |
|
position: relative; |
|
} |
|
.el_title::after { |
|
position: absolute; |
|
content: ''; |
|
width: 6px; |
|
height: 6px; |
|
border-radius: 50%; |
|
left: 0; |
|
top: 50%; |
|
transform: translate(0, -50%); |
|
background-color: #172e60; |
|
} |
|
.el_Processingresults_box_list { |
|
display: flex; |
|
justify-content: space-between; |
|
align-items: center; |
|
margin-right: 11px; |
|
.el-form-item { |
|
width: 24%; |
|
.el-input-number { |
|
width: 100% !important; |
|
} |
|
.el-form-item__label { |
|
margin-bottom: 0; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
.pageContent { |
|
height: 100vh; |
|
} |
|
.flex-c-c { |
|
position: fixed; |
|
bottom: 20px; |
|
left: 50%; |
|
} |
|
:deep(.el-loading-mask) { |
|
position: fixed; |
|
left: 12%; |
|
top: 10%; |
|
background-color: #ffffffc2; |
|
} |
|
.el_Investigation_process { |
|
min-width: 100%; |
|
} |
|
</style>
|
|
|