|
@@ -14,15 +14,21 @@
|
|
|
{{ model[field] }}
|
|
|
</template>
|
|
|
<template #add>
|
|
|
- <Button @click="add" style="margin-left:20px">添加人工</Button>
|
|
|
+ <div>
|
|
|
+ <Button @click="add" style="margin-left:20px">添加人工</Button>
|
|
|
+ <Button @click="updataRepairInfo" style="margin-left:20px">重置</Button>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<template #del="{ field }">
|
|
|
<Button @click="del(field)">删除</Button>
|
|
|
</template>
|
|
|
+ <template #delList="{ field }">
|
|
|
+ <Button @click="del(field)">删除</Button>
|
|
|
+ </template>
|
|
|
</BasicForm>
|
|
|
<div class="priceCount">
|
|
|
- <Button @click="updataCount">更新总价</Button>
|
|
|
- <div class="label" v-if="fileFlow.priceCount">总价:{{ fileFlow.priceCount }}</div>
|
|
|
+ <span>合计:</span>
|
|
|
+ <div class="label">总价:{{ fileFlow.priceCount || 0 }}元 <Button :preIcon="'outline-refresh'" @click="updataCount"><RedoOutlined /></Button></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</BasicModal>
|
|
@@ -35,10 +41,10 @@
|
|
|
import { getPriceList, checkRegisterInfo, addOrUpdatePriceList, allList } from '/@/api/spares'
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
import { uploadApi } from '/@/api/product/index';
|
|
|
-
|
|
|
+ import { RedoOutlined, } from '@ant-design/icons-vue';
|
|
|
const { t } = useI18n();
|
|
|
export default defineComponent({
|
|
|
- components: { BasicModal, BasicForm },
|
|
|
+ components: { BasicModal, BasicForm, RedoOutlined },
|
|
|
props: {
|
|
|
userData: { type: Object },
|
|
|
},
|
|
@@ -79,7 +85,7 @@
|
|
|
span: 18,
|
|
|
},
|
|
|
},{
|
|
|
- field: 'noteContent',
|
|
|
+ field: 'checkResult',
|
|
|
component: 'Input',
|
|
|
label: '检测结果',
|
|
|
slot: 'text',
|
|
@@ -99,7 +105,8 @@
|
|
|
];
|
|
|
|
|
|
const [registerForm, { validate, getFieldsValue, resetFields, setFieldsValue, removeSchemaByFiled, appendSchemaByField, updateSchema }] = useForm({
|
|
|
- labelWidth: 180,
|
|
|
+ labelWidth: 100,
|
|
|
+ labelAlign:'left',
|
|
|
schemas:schemas,
|
|
|
showActionButtonGroup: false,
|
|
|
actionColOptions: {
|
|
@@ -118,6 +125,20 @@
|
|
|
const [register, { closeModal }] = useModalInner((data) => {
|
|
|
data && onDataReceive(data);
|
|
|
});
|
|
|
+ async function updataRepairInfo() {
|
|
|
+ let { repairId } = getFieldsValue()
|
|
|
+ console.log('20230228171427939',repairId)
|
|
|
+ const { priceLists, count } = await getPriceList({repairId})//
|
|
|
+ updateSchema({
|
|
|
+ field:'0',
|
|
|
+ label:`第${count || 1}次报价`,
|
|
|
+ })
|
|
|
+ addPriceItem(priceLists)
|
|
|
+ clearInfo(true)
|
|
|
+ setTimeout(() => {
|
|
|
+ updataCount()
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
async function onDataReceive(data) {
|
|
|
|
|
|
const { priceLists, count } = await getPriceList({repairId:data.repairId})//
|
|
@@ -135,7 +156,7 @@
|
|
|
}
|
|
|
function del(field) {
|
|
|
removeSchemaByFiled([`deviceType${field}`, `device_${field}`, `${field}`]);
|
|
|
- n.value--;
|
|
|
+ // n.value--;
|
|
|
}
|
|
|
function add() {
|
|
|
let list = addSchemas(n.value);
|
|
@@ -145,42 +166,62 @@
|
|
|
n.value++
|
|
|
}
|
|
|
function addPriceItem(list){
|
|
|
- fileFlow.priceLists = list
|
|
|
- let priceSchema = []
|
|
|
- let valueObj = {}
|
|
|
+ fileFlow.priceLists = list.reverse()
|
|
|
+ let priceSchema = [],valueObj = {},count=0
|
|
|
list.map(ele => {
|
|
|
valueObj[`priceList${ele.priceListId}`] = ele.count || 1
|
|
|
+ valueObj[`priceListText${ele.priceListId}`] = `${ele.name} ${ele.price} 元/次`
|
|
|
+ count = count + ele.count*ele.price
|
|
|
priceSchema.unshift({
|
|
|
+ field: 'priceListText' + ele.priceListId,
|
|
|
+ component: 'InputNumber',
|
|
|
+ label: ele.type == 0?'备件':'人工',
|
|
|
+ slot: 'text',
|
|
|
+ // labelWidth:300,
|
|
|
+ // subLabel:"数量",
|
|
|
+ colProps: {
|
|
|
+ span: 12,
|
|
|
+ }
|
|
|
+ },{
|
|
|
field: 'priceList' + ele.priceListId,
|
|
|
- label: ele.name+'次数',
|
|
|
+ label: '数量',//`${ele.type == 0?'备件':'人工'}: ${ele.name} ${ele.price} 元/次`,
|
|
|
+ // suffix:'数量',
|
|
|
component: 'InputNumber',
|
|
|
defaultValue:ele.count || 1,
|
|
|
- suffix:ele.price+"元/次",
|
|
|
+ // labelWidth:300,
|
|
|
+ // subLabel:"数量",
|
|
|
colProps: {
|
|
|
- span: 13,
|
|
|
+ span: 12,
|
|
|
},
|
|
|
required: true,
|
|
|
componentProps: {
|
|
|
disabled:ele.status == 1,
|
|
|
- min:1,
|
|
|
+ min:0,
|
|
|
max:999,
|
|
|
maxLength: 15,
|
|
|
+ onChange:(val)=>{
|
|
|
+ setTimeout(() => {
|
|
|
+ updataCount()
|
|
|
+ }, 100)
|
|
|
+ }
|
|
|
},
|
|
|
})
|
|
|
})
|
|
|
+ fileFlow.priceCount = count
|
|
|
priceSchema.map(item =>{
|
|
|
console.log('priceSchema',item)
|
|
|
appendSchemaByField(item,'')
|
|
|
})
|
|
|
+ console.log('addPriceItem',valueObj)
|
|
|
setTimeout(()=>{
|
|
|
setFieldsValue(valueObj)
|
|
|
- },100)
|
|
|
+ },10)
|
|
|
}
|
|
|
function addSchemas(number){
|
|
|
let parentList: FormSchema[] = [
|
|
|
{
|
|
|
field: 'deviceType' + number,
|
|
|
- label: '人工费'+ number,
|
|
|
+ label: '人工',
|
|
|
component: 'ApiSelect',
|
|
|
colProps: {
|
|
|
span: 12,
|
|
@@ -224,15 +265,39 @@
|
|
|
return parentList
|
|
|
}
|
|
|
const handleSubmit = async () => {
|
|
|
- loading.value = true
|
|
|
+ const params = await validate();
|
|
|
try {
|
|
|
createConfirm({
|
|
|
iconType: 'warning',
|
|
|
title: () => h('span', '温馨提示'),
|
|
|
- content: '确定要提交检测报告吗?',
|
|
|
+ content: '确定要提交报价吗?',
|
|
|
onOk: async () => {
|
|
|
- const params = await validate();
|
|
|
- await cameraIn(params)
|
|
|
+ loading.value = true
|
|
|
+ let priceListsparams = []
|
|
|
+ console.log('addOrUpdatePriceList',params,fileFlow.priceLists)
|
|
|
+ fileFlow.priceLists.map(ele => {
|
|
|
+ priceListsparams.push({
|
|
|
+ type:ele.type,
|
|
|
+ laborId:ele.laborId,
|
|
|
+ partId:ele.partId,
|
|
|
+ count:params[`priceList${ele.priceListId}`]
|
|
|
+ })
|
|
|
+ })
|
|
|
+ for (let index = 1; index < n.value; index++) {
|
|
|
+ if(params[`device_${index}`]){
|
|
|
+ priceListsparams.push({
|
|
|
+ // priceListId:params[`deviceType${index}`],
|
|
|
+ count:params[`device_${index}`],
|
|
|
+ laborId:params[`deviceType${index}`],
|
|
|
+ partId:params[`deviceType${index}`],
|
|
|
+ type:1,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ await addOrUpdatePriceList({
|
|
|
+ repairId:params.repairId,
|
|
|
+ priceLists:priceListsparams,
|
|
|
+ })
|
|
|
createMessage.success(t('common.optSuccess'));
|
|
|
closeModal();
|
|
|
emit('update');
|
|
@@ -247,7 +312,8 @@
|
|
|
};
|
|
|
function updataCount(){
|
|
|
let fromData = getFieldsValue() ,count = 0
|
|
|
- fileFlow.priceListsPrice
|
|
|
+ // fileFlow.priceListsPrice
|
|
|
+ console.log('fromData',fromData)
|
|
|
fileFlow.priceLists.map(ele => {
|
|
|
count = count + fromData[`priceList${ele.priceListId}`]*ele.price
|
|
|
})
|
|
@@ -259,16 +325,17 @@
|
|
|
}
|
|
|
}
|
|
|
fileFlow.priceCount = count
|
|
|
- console.log('fromData',fromData)
|
|
|
}
|
|
|
|
|
|
- function clearInfo(){
|
|
|
+ function clearInfo(val){
|
|
|
let indexa = n.value;
|
|
|
fileFlow.priceCount = 0
|
|
|
- resetFields()
|
|
|
+ if(!val){
|
|
|
+ resetFields()
|
|
|
+ }
|
|
|
let clearFiled = []
|
|
|
fileFlow.priceLists.map(ele =>{
|
|
|
- clearFiled.push(`priceList${ele.priceListId}`)
|
|
|
+ clearFiled.push(`priceList${ele.priceListId}`,`priceListText${ele.priceListId}`)
|
|
|
})
|
|
|
for (let index = 1; index < indexa; index++) {
|
|
|
clearFiled.push(`deviceType${index}`, `device_${index}`, `${index}`)
|
|
@@ -290,6 +357,7 @@
|
|
|
t,
|
|
|
del,
|
|
|
add,
|
|
|
+ updataRepairInfo,
|
|
|
};
|
|
|
},
|
|
|
});
|