|
@@ -11,25 +11,29 @@
|
|
<div class="pt-2px pr-3px">
|
|
<div class="pt-2px pr-3px">
|
|
<BasicForm @register="registerForm">
|
|
<BasicForm @register="registerForm">
|
|
<template #text="{ model, field }">
|
|
<template #text="{ model, field }">
|
|
- {{ model[field] }}
|
|
|
|
|
|
+ {{ model[field] || '明细' }}
|
|
</template>
|
|
</template>
|
|
<template #add>
|
|
<template #add>
|
|
<div>
|
|
<div>
|
|
- <!-- <Button @click="add" style="margin-left:20px">添加人工</Button> -->
|
|
|
|
- <Button @click="updataRepairInfo">重置</Button>
|
|
|
|
|
|
+ <Button @click="updataRepairInfo">重置</Button>
|
|
|
|
+ <Button @click="add" style="margin-left:20px">添加明细</Button>
|
|
</div>
|
|
</div>
|
|
- </template>
|
|
|
|
|
|
+ </template>
|
|
<template #del="{ field }">
|
|
<template #del="{ field }">
|
|
- <Button @click="del(field)">删除</Button>
|
|
|
|
|
|
+ <Icon v-if="(n - 1) == field" @click="del(field)" icon="ant-design:close-circle-outlined" :size="18" :class="`mr-2`" />
|
|
|
|
+ <!-- <Button v-if="(n - 1) == field" @click="del(field)">删除</Button> -->
|
|
</template>
|
|
</template>
|
|
<template #delList="{ field }">
|
|
<template #delList="{ field }">
|
|
- <Button @click="del(field)">删除</Button>
|
|
|
|
|
|
+ <Button @click="del(field)"><close-circle-outlined /></Button>
|
|
</template>
|
|
</template>
|
|
</BasicForm>
|
|
</BasicForm>
|
|
<div class="priceCount">
|
|
<div class="priceCount">
|
|
<span>合计:</span>
|
|
<span>合计:</span>
|
|
- <div class="label">总价:{{ fileFlow.priceCount || 0 }}元 <Button :preIcon="'outline-refresh'" @click="updataCount"><RedoOutlined /></Button></div>
|
|
|
|
- <p style="padding-top:15px">注:提交报价后,需等待报修人确认后再进行维修</p>
|
|
|
|
|
|
+ <div class="label"
|
|
|
|
+ >总价:{{ fileFlow.priceCount || 0 }}元
|
|
|
|
+ <Button :preIcon="'outline-refresh'" @click="updataCount"><RedoOutlined /></Button
|
|
|
|
+ ></div>
|
|
|
|
+ <p style="padding-top: 15px">注:提交报价后,需等待报修人确认后再进行维修</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</BasicModal>
|
|
</BasicModal>
|
|
@@ -39,388 +43,467 @@
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
|
|
import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
- import { getPriceList, checkRegisterInfo, addOrUpdatePriceList, allList } from '/@/api/spares'
|
|
|
|
- import { Checkbox, Button } from 'ant-design-vue';
|
|
|
|
|
|
+ import { getPriceList, addOrUpdatePriceList, allList } from '/@/api/spares';
|
|
|
|
+ import { Button } from 'ant-design-vue';
|
|
|
|
+ import Icon from '/@/components/Icon/index';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
- import { uploadApi } from '/@/api/product/index';
|
|
|
|
- import { RedoOutlined, } from '@ant-design/icons-vue';
|
|
|
|
|
|
+ import { RedoOutlined } from '@ant-design/icons-vue';
|
|
const { t } = useI18n();
|
|
const { t } = useI18n();
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
- components: { BasicModal, BasicForm, RedoOutlined, Checkbox, Button },
|
|
|
|
|
|
+ components: { BasicModal, BasicForm, RedoOutlined, Button, Icon },
|
|
props: {
|
|
props: {
|
|
userData: { type: Object },
|
|
userData: { type: Object },
|
|
},
|
|
},
|
|
emits: ['update', 'register'],
|
|
emits: ['update', 'register'],
|
|
- setup(props, { emit }) {
|
|
|
|
|
|
+ setup(_, { emit }) {
|
|
const n = ref(1);
|
|
const n = ref(1);
|
|
const fileFlow = reactive({
|
|
const fileFlow = reactive({
|
|
- file:null,
|
|
|
|
- type:2,//2-普通发票,3-专用发票
|
|
|
|
- count:1,//第一次报价
|
|
|
|
- priceCount:0,//总价
|
|
|
|
- priceLists:[],
|
|
|
|
- priceListsPrice:{},
|
|
|
|
- manMadeList:[],
|
|
|
|
- })
|
|
|
|
- const loading = ref(false)
|
|
|
|
- const { createMessage,createConfirm } = useMessage();
|
|
|
|
|
|
+ file: null,
|
|
|
|
+ type: 2, //2-普通发票,3-专用发票
|
|
|
|
+ count: 1, //第一次报价
|
|
|
|
+ priceCount: 0, //总价
|
|
|
|
+ priceLists: [],
|
|
|
|
+ priceListsPrice: {},
|
|
|
|
+ manMadeList: [],
|
|
|
|
+ });
|
|
|
|
+ const loading = ref(false);
|
|
|
|
+ const { createMessage, createConfirm } = useMessage();
|
|
const schemas: FormSchema[] = [
|
|
const schemas: FormSchema[] = [
|
|
- {
|
|
|
|
- field: 'id',
|
|
|
|
- component: 'Input',
|
|
|
|
- show:false,
|
|
|
|
- label: '发票编号',
|
|
|
|
|
|
+ {
|
|
|
|
+ field: 'id',
|
|
|
|
+ component: 'Input',
|
|
|
|
+ show: false,
|
|
|
|
+ label: '发票编号',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'repairId',
|
|
|
|
+ component: 'Input',
|
|
|
|
+ label: '维修单号',
|
|
|
|
+ slot: 'text',
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 24,
|
|
},
|
|
},
|
|
- {
|
|
|
|
- field: 'repairId',
|
|
|
|
- component: 'Input',
|
|
|
|
- label: '维修单号',
|
|
|
|
- slot: 'text',
|
|
|
|
- colProps: {
|
|
|
|
- span: 24,
|
|
|
|
- },
|
|
|
|
- },{
|
|
|
|
- field: 'deviceInfo',
|
|
|
|
- component: 'Input',
|
|
|
|
- label: '设备信息',
|
|
|
|
- slot: 'text',
|
|
|
|
- colProps: {
|
|
|
|
- span: 18,
|
|
|
|
- },
|
|
|
|
- },{
|
|
|
|
- field: 'warrantyExpirationDateText',
|
|
|
|
- component: 'Input',
|
|
|
|
- slot: 'text',
|
|
|
|
- label: '保修届满日期',
|
|
|
|
- },{
|
|
|
|
- field: 'checkResult',
|
|
|
|
- component: 'Input',
|
|
|
|
- label: '检测结果',
|
|
|
|
- slot: 'text',
|
|
|
|
- colProps: {
|
|
|
|
- span: 18,
|
|
|
|
- },
|
|
|
|
- },{
|
|
|
|
- field: '0',
|
|
|
|
- component: 'Input',
|
|
|
|
- label: '报价明细',
|
|
|
|
- labelWidth:0,
|
|
|
|
- colProps: {
|
|
|
|
- span: 24,
|
|
|
|
- },
|
|
|
|
- slot: 'add',
|
|
|
|
- },{
|
|
|
|
- field: 'manMade',
|
|
|
|
- component: 'CheckboxGroup',
|
|
|
|
- label: '人工费',
|
|
|
|
- labelWidth:0,
|
|
|
|
- componentProps: {
|
|
|
|
- options: fileFlow.manMadeList,
|
|
|
|
- maxLength: 50,
|
|
|
|
- onChange:(val)=>{
|
|
|
|
- setTimeout(() => {
|
|
|
|
- updataCount()
|
|
|
|
- }, 100)
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- colProps: {
|
|
|
|
- span: 24,
|
|
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'deviceInfo',
|
|
|
|
+ component: 'Input',
|
|
|
|
+ label: '设备信息',
|
|
|
|
+ slot: 'text',
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 18,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'warrantyExpirationDateText',
|
|
|
|
+ component: 'Input',
|
|
|
|
+ slot: 'text',
|
|
|
|
+ label: '保修届满日期',
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 14,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'convertWarranty',
|
|
|
|
+ component: 'Checkbox',
|
|
|
|
+ labelWidth: 0,
|
|
|
|
+ label: '',
|
|
|
|
+ suffix: '保外转包内',
|
|
|
|
+ componentProps: {
|
|
|
|
+ name: 'wodeces',
|
|
|
|
+ label: 'wodeces',
|
|
|
|
+ },
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 4,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'checkResult',
|
|
|
|
+ component: 'Input',
|
|
|
|
+ label: '检测结果',
|
|
|
|
+ slot: 'text',
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 18,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: '0',
|
|
|
|
+ component: 'Input',
|
|
|
|
+ label: '报价明细',
|
|
|
|
+ labelWidth: 0,
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 24,
|
|
|
|
+ },
|
|
|
|
+ slot: 'add',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'manMade',
|
|
|
|
+ component: 'CheckboxGroup',
|
|
|
|
+ label: '人工费',
|
|
|
|
+ labelWidth: 0,
|
|
|
|
+ componentProps: {
|
|
|
|
+ options: fileFlow.manMadeList,
|
|
|
|
+ maxLength: 50,
|
|
|
|
+ onChange: () => {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ updataCount();
|
|
|
|
+ }, 100);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 24,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
];
|
|
];
|
|
|
|
|
|
- const [registerForm, { validate, getFieldsValue, resetFields, setFieldsValue, removeSchemaByFiled, appendSchemaByField, updateSchema }] = useForm({
|
|
|
|
|
|
+ const [
|
|
|
|
+ registerForm,
|
|
|
|
+ {
|
|
|
|
+ validate,
|
|
|
|
+ getFieldsValue,
|
|
|
|
+ resetFields,
|
|
|
|
+ setFieldsValue,
|
|
|
|
+ removeSchemaByFiled,
|
|
|
|
+ appendSchemaByField,
|
|
|
|
+ },
|
|
|
|
+ ] = useForm({
|
|
labelWidth: 100,
|
|
labelWidth: 100,
|
|
- labelAlign:'left',
|
|
|
|
- schemas:schemas,
|
|
|
|
|
|
+ labelAlign: 'left',
|
|
|
|
+ schemas: schemas,
|
|
showActionButtonGroup: false,
|
|
showActionButtonGroup: false,
|
|
actionColOptions: {
|
|
actionColOptions: {
|
|
span: 24,
|
|
span: 24,
|
|
},
|
|
},
|
|
});
|
|
});
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
- let allListOption = await allList()//获取价格
|
|
|
|
- console.log('allList',allListOption)
|
|
|
|
- fileFlow.priceListsPrice
|
|
|
|
- allListOption.map(ele => {
|
|
|
|
|
|
+ let allListOption = await allList({}); //获取价格
|
|
|
|
+ fileFlow.priceListsPrice;
|
|
|
|
+ allListOption.map((ele) => {
|
|
fileFlow.manMadeList.push({
|
|
fileFlow.manMadeList.push({
|
|
...ele,
|
|
...ele,
|
|
label: `${ele.name} ${ele.price}元`,
|
|
label: `${ele.name} ${ele.price}元`,
|
|
value: ele.laborCostId,
|
|
value: ele.laborCostId,
|
|
- })
|
|
|
|
- fileFlow.priceListsPrice[ele.laborCostId] = ele.price
|
|
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
+ fileFlow.priceListsPrice[ele.laborCostId] = ele.price;
|
|
|
|
+ });
|
|
});
|
|
});
|
|
let addListFunc = () => {};
|
|
let addListFunc = () => {};
|
|
const [register, { closeModal }] = useModalInner((data) => {
|
|
const [register, { closeModal }] = useModalInner((data) => {
|
|
data && onDataReceive(data);
|
|
data && onDataReceive(data);
|
|
});
|
|
});
|
|
async function updataRepairInfo() {
|
|
async function updataRepairInfo() {
|
|
- let { repairId } = getFieldsValue()
|
|
|
|
- console.log('20230228171427939',repairId)
|
|
|
|
- const { priceLists, count } = await getPriceList({repairId})//
|
|
|
|
- addPriceItem(priceLists)
|
|
|
|
- clearInfo(true)
|
|
|
|
|
|
+ let { repairId } = getFieldsValue();
|
|
|
|
+ const { priceLists, count } = await getPriceList({ repairId }); //
|
|
|
|
+ addPriceItem(priceLists);
|
|
|
|
+ clearInfo(true);
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
- updataCount()
|
|
|
|
|
|
+ updataCount();
|
|
}, 100);
|
|
}, 100);
|
|
}
|
|
}
|
|
async function onDataReceive(data) {
|
|
async function onDataReceive(data) {
|
|
-
|
|
|
|
- const { priceLists, count } = await getPriceList({repairId:data.repairId})//
|
|
|
|
- addPriceItem(priceLists)
|
|
|
|
|
|
+ const { priceLists, count } = await getPriceList({ repairId: data.repairId }); //
|
|
|
|
+ addPriceItem(priceLists);
|
|
resetFields();
|
|
resetFields();
|
|
- fileFlow.type = data.type
|
|
|
|
|
|
+ fileFlow.type = data.type;
|
|
setFieldsValue({
|
|
setFieldsValue({
|
|
...data,
|
|
...data,
|
|
- warrantyExpirationDateText: `${data.warrantyDate} (${data.warrantyType==0?'保内维修':data.warrantyType==1?'保内转保外':'保外维修'})`,
|
|
|
|
- deviceInfo:t(`routes.scene.tableType.${data.cameraType}`)+data.cameraSnCode
|
|
|
|
|
|
+ warrantyExpirationDateText: `${data.warrantyDate} (${
|
|
|
|
+ data.warrantyType == 0 ? '保内维修' : data.warrantyType == 1 ? '保内转保外' : '保外维修'
|
|
|
|
+ })`,
|
|
|
|
+ deviceInfo: t(`routes.scene.tableType.${data.cameraType}`) + data.cameraSnCode,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
function del(field) {
|
|
function del(field) {
|
|
- removeSchemaByFiled([`deviceType${field}`, `device_${field}`, `${field}`]);
|
|
|
|
- // n.value--;
|
|
|
|
|
|
+ removeSchemaByFiled([`deviceTypeId${field}`, `deviceType${field}`, `device_${field}`, `${field}`]);
|
|
|
|
+ n.value--;
|
|
}
|
|
}
|
|
function add() {
|
|
function add() {
|
|
let list = addSchemas(n.value);
|
|
let list = addSchemas(n.value);
|
|
- list.map(ele => {
|
|
|
|
- appendSchemaByField(ele,'')
|
|
|
|
- })
|
|
|
|
- n.value++
|
|
|
|
|
|
+ list.map((ele) => {
|
|
|
|
+ appendSchemaByField(ele, '');
|
|
|
|
+ });
|
|
|
|
+ n.value++;
|
|
}
|
|
}
|
|
- function addPriceItem(list){
|
|
|
|
- fileFlow.priceLists = list
|
|
|
|
- let priceSchema = [],valueObj = {},count=0
|
|
|
|
- let manMade = [],countIndex = 0
|
|
|
|
- console.log('addPriceItem',fileFlow.priceLists)
|
|
|
|
- fileFlow.priceLists.map((ele,index) => {
|
|
|
|
- if(ele.type == 1){//人工费
|
|
|
|
- manMade.push(ele.partId)
|
|
|
|
- count = count + ele.count*ele.price
|
|
|
|
- }else{//备件
|
|
|
|
- countIndex++
|
|
|
|
- let price = ele.discount == 1?ele.priceDiscount:ele.price
|
|
|
|
- valueObj[`priceList${ele.priceListId}`] = ele.count || 0
|
|
|
|
- valueObj[`priceListText${ele.priceListId}`] = `${ele.name} ${ele.price} 元/${ele.type == 0?ele.partUnit:''}`
|
|
|
|
- valueObj[`discount${ele.priceListId}`] = ele.discount == 1?[0]:[]
|
|
|
|
- count = count + ele.count*price
|
|
|
|
- priceSchema.push({
|
|
|
|
- // priceSchema.unshift({
|
|
|
|
- field: 'priceListText' + ele.priceListId,
|
|
|
|
- component: 'InputNumber',
|
|
|
|
- label: countIndex,
|
|
|
|
- labelWidth:20,
|
|
|
|
- slot: 'text',
|
|
|
|
- // labelWidth:300,
|
|
|
|
- // subLabel:"数量",
|
|
|
|
- colProps: {
|
|
|
|
- span: Boolean(ele.priceDiscount)?8:16,
|
|
|
|
- }
|
|
|
|
- },{
|
|
|
|
- field: 'discount' + ele.priceListId,
|
|
|
|
- component: 'CheckboxGroup',
|
|
|
|
- ifShow:Boolean(ele.priceDiscount),
|
|
|
|
- componentProps: {
|
|
|
|
- onChange:(val)=>{
|
|
|
|
- setTimeout(() => {
|
|
|
|
- updataCount()
|
|
|
|
- }, 100)
|
|
|
|
|
|
+ function addPriceItem(list) {
|
|
|
|
+ fileFlow.priceLists = list;
|
|
|
|
+ let priceSchema = [],
|
|
|
|
+ valueObj = {},
|
|
|
|
+ count = 0;
|
|
|
|
+ let manMade = [],
|
|
|
|
+ countIndex = 0;
|
|
|
|
+ fileFlow.priceLists.map((ele, index) => {
|
|
|
|
+ if (ele.type == 1) {
|
|
|
|
+ //人工费
|
|
|
|
+ manMade.push(ele.partId);
|
|
|
|
+ count = count + ele.count * ele.price;
|
|
|
|
+ } else if (ele.type == 2) {
|
|
|
|
+ //人工费
|
|
|
|
+ let addName = addSchemas(n.value)
|
|
|
|
+ priceSchema.push(...addName)
|
|
|
|
+ valueObj[`deviceTypeId${n.value}`] = ele.name;
|
|
|
|
+ valueObj[`device_${n.value}`] = Number(ele.price);
|
|
|
|
+ count = count + Number(ele.price);
|
|
|
|
+ n.value++
|
|
|
|
+ } else {
|
|
|
|
+ //备件
|
|
|
|
+ countIndex++;
|
|
|
|
+ let price = ele.discount == 1 ? ele.priceDiscount : ele.price;
|
|
|
|
+ valueObj[`priceList${ele.priceListId}`] = ele.count || 0;
|
|
|
|
+ valueObj[`priceListText${ele.priceListId}`] = `${ele.name} ${ele.price} 元/${
|
|
|
|
+ ele.type == 0 ? ele.partUnit : ''
|
|
|
|
+ }`;
|
|
|
|
+ valueObj[`discount${ele.priceListId}`] = ele.discount == 1 ? [0] : [];
|
|
|
|
+ count = count + ele.count * price;
|
|
|
|
+ priceSchema.push(
|
|
|
|
+ {
|
|
|
|
+ // priceSchema.unshift({
|
|
|
|
+ field: 'priceListText' + ele.priceListId,
|
|
|
|
+ component: 'InputNumber',
|
|
|
|
+ label: countIndex,
|
|
|
|
+ labelWidth: 40,
|
|
|
|
+ slot: 'text',
|
|
|
|
+ // labelWidth:300,
|
|
|
|
+ // subLabel:"数量",
|
|
|
|
+ colProps: {
|
|
|
|
+ span: Boolean(ele.priceDiscount) ? 8 : 16,
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- options: [
|
|
|
|
{
|
|
{
|
|
- label: `折扣价 ${ele.priceDiscount}元`,
|
|
|
|
- value: 0,
|
|
|
|
|
|
+ field: 'discount' + ele.priceListId,
|
|
|
|
+ component: 'CheckboxGroup',
|
|
|
|
+ ifShow: Boolean(ele.priceDiscount),
|
|
|
|
+ componentProps: {
|
|
|
|
+ onChange: (val) => {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ updataCount();
|
|
|
|
+ }, 100);
|
|
|
|
+ },
|
|
|
|
+ options: [
|
|
|
|
+ {
|
|
|
|
+ label: `折扣价 ${ele.priceDiscount}元`,
|
|
|
|
+ value: 0,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 8,
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- ]
|
|
|
|
- },
|
|
|
|
- colProps: {
|
|
|
|
- span: 8,
|
|
|
|
- }
|
|
|
|
- },{
|
|
|
|
- field: 'priceList' + ele.priceListId,
|
|
|
|
- label: '数量',//`${ele.type == 0?'备件':'人工'}: ${ele.name} ${ele.price} 元/次`,
|
|
|
|
- // suffix:'数量',
|
|
|
|
- component: 'InputNumber',
|
|
|
|
- defaultValue:ele.count || 0,
|
|
|
|
- labelWidth:50,
|
|
|
|
- // labelWidth:300,
|
|
|
|
- // subLabel:"数量",
|
|
|
|
- colProps: {
|
|
|
|
- span: 8,
|
|
|
|
- },
|
|
|
|
- required: true,
|
|
|
|
- componentProps: {
|
|
|
|
- disabled:ele.status == 1,
|
|
|
|
- min:0,
|
|
|
|
- max:999,
|
|
|
|
- maxLength: 15,
|
|
|
|
- onChange:(val)=>{
|
|
|
|
- setTimeout(() => {
|
|
|
|
- updataCount()
|
|
|
|
- }, 100)
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
|
|
+ {
|
|
|
|
+ field: 'priceList' + ele.priceListId,
|
|
|
|
+ label: '数量', //`${ele.type == 0?'备件':'人工'}: ${ele.name} ${ele.price} 元/次`,
|
|
|
|
+ // suffix:'数量',
|
|
|
|
+ component: 'InputNumber',
|
|
|
|
+ defaultValue: ele.count || 0,
|
|
|
|
+ labelWidth: 50,
|
|
|
|
+ // labelWidth:300,
|
|
|
|
+ // subLabel:"数量",
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 8,
|
|
|
|
+ },
|
|
|
|
+ required: true,
|
|
|
|
+ componentProps: {
|
|
|
|
+ disabled: ele.status == 1,
|
|
|
|
+ min: 0,
|
|
|
|
+ max: 999,
|
|
|
|
+ maxLength: 15,
|
|
|
|
+ onChange: (val) => {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ updataCount();
|
|
|
|
+ }, 100);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ );
|
|
}
|
|
}
|
|
- })
|
|
|
|
- fileFlow.priceCount = count.toFixed(2)
|
|
|
|
- valueObj.manMade = manMade
|
|
|
|
- priceSchema.map(item =>{
|
|
|
|
- console.log('priceSchema',item)
|
|
|
|
- appendSchemaByField(item,'')
|
|
|
|
- })
|
|
|
|
- console.log('addPriceItem',valueObj)
|
|
|
|
- setTimeout(()=>{
|
|
|
|
- setFieldsValue(valueObj)
|
|
|
|
- },10)
|
|
|
|
|
|
+ });
|
|
|
|
+ fileFlow.priceCount = count.toFixed(2);
|
|
|
|
+ valueObj.manMade = manMade;
|
|
|
|
+ priceSchema.map((item) => {
|
|
|
|
+ appendSchemaByField(item, '');
|
|
|
|
+ });
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ setFieldsValue(valueObj);
|
|
|
|
+ }, 10);
|
|
}
|
|
}
|
|
- function addSchemas(number){
|
|
|
|
|
|
+ function addSchemas(number) {
|
|
|
|
+ let priceListsLength = fileFlow.priceLists.filter(ele => ele.type == 0).length;
|
|
let parentList: FormSchema[] = [
|
|
let parentList: FormSchema[] = [
|
|
{
|
|
{
|
|
field: 'deviceType' + number,
|
|
field: 'deviceType' + number,
|
|
- label: '人工',
|
|
|
|
- component: 'ApiSelect',
|
|
|
|
|
|
+ label: (number + priceListsLength),
|
|
|
|
+ labelWidth: 40,
|
|
|
|
+ component: 'Input',
|
|
|
|
+ slot: 'text',
|
|
|
|
+ required: false,
|
|
colProps: {
|
|
colProps: {
|
|
- span: 12,
|
|
|
|
|
|
+ span: 3,
|
|
},
|
|
},
|
|
- required: true,
|
|
|
|
|
|
+ },{
|
|
|
|
+ field: 'deviceTypeId' + number,
|
|
|
|
+ label: '',
|
|
|
|
+ labelWidth: 0,
|
|
|
|
+ component: 'Input',
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 8,
|
|
|
|
+ },
|
|
|
|
+ rules: [{ required: true }],
|
|
componentProps: {
|
|
componentProps: {
|
|
api: allList,
|
|
api: allList,
|
|
labelField: 'name',
|
|
labelField: 'name',
|
|
valueField: 'laborCostId',
|
|
valueField: 'laborCostId',
|
|
- showSearch:true,
|
|
|
|
- onChange:(value)=>{
|
|
|
|
- console.log('onchange',value,arguments)
|
|
|
|
- }
|
|
|
|
|
|
+ showSearch: true,
|
|
|
|
+ placeholder: '请输入明细名称',
|
|
|
|
+ onChange: (value) => {
|
|
|
|
+ console.log('onchange', value, arguments);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
field: 'device_' + number,
|
|
field: 'device_' + number,
|
|
- label: '数量',
|
|
|
|
|
|
+ label: '价格',
|
|
component: 'InputNumber',
|
|
component: 'InputNumber',
|
|
required: true,
|
|
required: true,
|
|
defaultValue: 1,
|
|
defaultValue: 1,
|
|
- labelWidth:50,
|
|
|
|
|
|
+ labelWidth: 80,
|
|
componentProps: {
|
|
componentProps: {
|
|
max: 999,
|
|
max: 999,
|
|
- min:1,
|
|
|
|
|
|
+ min: 1,
|
|
|
|
+ onChange: () => {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ updataCount();
|
|
|
|
+ }, 100);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
colProps: {
|
|
colProps: {
|
|
- span: 6,
|
|
|
|
|
|
+ span: 7,
|
|
},
|
|
},
|
|
- },{
|
|
|
|
|
|
+ },
|
|
|
|
+ {
|
|
field: number.toString(),
|
|
field: number.toString(),
|
|
component: 'Input',
|
|
component: 'Input',
|
|
label: '',
|
|
label: '',
|
|
- labelWidth:0,
|
|
|
|
|
|
+ labelWidth: 0,
|
|
colProps: {
|
|
colProps: {
|
|
span: 6,
|
|
span: 6,
|
|
},
|
|
},
|
|
slot: 'del',
|
|
slot: 'del',
|
|
- }
|
|
|
|
|
|
+ },
|
|
];
|
|
];
|
|
- return parentList
|
|
|
|
|
|
+ return parentList;
|
|
}
|
|
}
|
|
const handleSubmit = async () => {
|
|
const handleSubmit = async () => {
|
|
- const params = await validate();
|
|
|
|
|
|
+ const params = await validate();
|
|
try {
|
|
try {
|
|
createConfirm({
|
|
createConfirm({
|
|
- iconType: 'warning',
|
|
|
|
- title: () => h('span', '温馨提示'),
|
|
|
|
- content: '确定要提交报价吗?',
|
|
|
|
- onOk: async () => {
|
|
|
|
- loading.value = true
|
|
|
|
- let priceListsparams = []
|
|
|
|
- console.log('params',n.value,fileFlow.priceLists)
|
|
|
|
- fileFlow.priceLists.map(ele => {
|
|
|
|
- if(ele.type == 1){
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- let discount = params[`discount${ele.priceListId}`]?.length?1:0;
|
|
|
|
- console.log('discount',discount)
|
|
|
|
- priceListsparams.push({
|
|
|
|
- priceListId:ele.priceListId,
|
|
|
|
- type:ele.type,
|
|
|
|
- laborId:ele.laborId,
|
|
|
|
- partId:ele.partId,
|
|
|
|
- discount,
|
|
|
|
- count:params[`priceList${ele.priceListId}`],
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
- let manMade = params.manMade
|
|
|
|
- fileFlow.manMadeList.map(ele => {
|
|
|
|
- if(manMade.includes(ele.laborCostId)){
|
|
|
|
|
|
+ iconType: 'warning',
|
|
|
|
+ title: () => h('span', '温馨提示'),
|
|
|
|
+ content: '确定要提交报价吗?',
|
|
|
|
+ onOk: async () => {
|
|
|
|
+ loading.value = true;
|
|
|
|
+ let priceListsparams = [];
|
|
|
|
+ fileFlow.priceLists.map((ele) => {
|
|
|
|
+ if (ele.type == 1 || ele.type == 2) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let discount = params[`discount${ele.priceListId}`]?.length ? 1 : 0;
|
|
priceListsparams.push({
|
|
priceListsparams.push({
|
|
- count:1,
|
|
|
|
- priceListId:ele.priceListId,
|
|
|
|
- laborId:ele.laborCostId,
|
|
|
|
- partId:ele.laborCostId,
|
|
|
|
- type:1,
|
|
|
|
- })
|
|
|
|
|
|
+ priceListId: ele.priceListId,
|
|
|
|
+ type: ele.type,
|
|
|
|
+ laborId: ele.laborId,
|
|
|
|
+ partId: ele.partId,
|
|
|
|
+ discount,
|
|
|
|
+ count: params[`priceList${ele.priceListId}`],
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ let manMade = params.manMade;
|
|
|
|
+ fileFlow.manMadeList.map((ele) => {
|
|
|
|
+ if (manMade.includes(ele.laborCostId)) {
|
|
|
|
+ priceListsparams.push({
|
|
|
|
+ count: 1,
|
|
|
|
+ priceListId: ele.priceListId,
|
|
|
|
+ laborId: ele.laborCostId,
|
|
|
|
+ partId: ele.laborCostId,
|
|
|
|
+ type: 1,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ for (let index = 1; index < n.value; index++) {
|
|
|
|
+ if(params[`deviceTypeId${index}`]){
|
|
|
|
+ priceListsparams.push({
|
|
|
|
+ count: 1,
|
|
|
|
+ name: params[`deviceTypeId${index}`],
|
|
|
|
+ price : params[`device_${index}`],
|
|
|
|
+ type: 2,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- })
|
|
|
|
- let res = await addOrUpdatePriceList({
|
|
|
|
- repairId:params.repairId,
|
|
|
|
- priceLists:priceListsparams,
|
|
|
|
- })
|
|
|
|
- console.log('res',res)
|
|
|
|
- createMessage.success(t('common.optSuccess'));
|
|
|
|
- closeModal();
|
|
|
|
- emit('update');
|
|
|
|
- loading.value = false
|
|
|
|
- clearInfo()
|
|
|
|
- },
|
|
|
|
- onCancel: () => {
|
|
|
|
- loading.value = false
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ await addOrUpdatePriceList({
|
|
|
|
+ repairId: params.repairId,
|
|
|
|
+ convertWarranty: params.convertWarranty ? 1 : 0,
|
|
|
|
+ priceLists: priceListsparams,
|
|
|
|
+ });
|
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
|
+ closeModal();
|
|
|
|
+ emit('update');
|
|
|
|
+ loading.value = false;
|
|
|
|
+ clearInfo();
|
|
|
|
+ },
|
|
|
|
+ onCancel: () => {
|
|
|
|
+ loading.value = false;
|
|
|
|
+ },
|
|
|
|
+ });
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- loading.value = false
|
|
|
|
|
|
+ loading.value = false;
|
|
console.log('not passing', error);
|
|
console.log('not passing', error);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- function updataCount(){
|
|
|
|
- let fromData = getFieldsValue() ,count = 0
|
|
|
|
|
|
+ function updataCount() {
|
|
|
|
+ let fromData = getFieldsValue(),
|
|
|
|
+ // let priceListsLength = fileFlow.priceLists.filter(ele => ele.type == 0).length;
|
|
|
|
+ count = 0;
|
|
// fileFlow.priceListsPrice
|
|
// fileFlow.priceListsPrice
|
|
- console.log('fromData',fromData,fileFlow.priceLists)
|
|
|
|
- fileFlow.priceLists.map(ele => {
|
|
|
|
- let price = Number(fromData[`discount${ele.priceListId}`]?.length?ele.priceDiscount:ele.price);
|
|
|
|
- console.log('count',price, count)
|
|
|
|
- if(fromData[`priceList${ele.priceListId}`]){
|
|
|
|
- count = count + fromData[`priceList${ele.priceListId}`]*price
|
|
|
|
|
|
+ fileFlow.priceLists.map((ele) => {
|
|
|
|
+ let price = Number(
|
|
|
|
+ fromData[`discount${ele.priceListId}`]?.length ? ele.priceDiscount : ele.price,
|
|
|
|
+ );
|
|
|
|
+ if (fromData[`priceList${ele.priceListId}`]) {
|
|
|
|
+ count = count + fromData[`priceList${ele.priceListId}`] * price;
|
|
}
|
|
}
|
|
- })
|
|
|
|
- let manMade = fromData.manMade
|
|
|
|
- fileFlow.manMadeList.map(ele => {
|
|
|
|
- if(manMade?.includes(ele.laborCostId)){
|
|
|
|
- count = count + Number(ele.price)
|
|
|
|
|
|
+ });
|
|
|
|
+ let manMade = fromData.manMade;
|
|
|
|
+ fileFlow.manMadeList.map((ele) => {
|
|
|
|
+ if (manMade?.includes(ele.laborCostId)) {
|
|
|
|
+ count = count + Number(ele.price);
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
for (let index = 1; index < n.value; index++) {
|
|
for (let index = 1; index < n.value; index++) {
|
|
- if(fromData[`deviceType${index}`] && fromData[`device_${index}`]){
|
|
|
|
- let priceId = fromData[`deviceType${index}`]
|
|
|
|
- let fromPrice = fromData[`device_${index}`] * fileFlow.priceListsPrice[priceId]
|
|
|
|
- count = count +fromPrice
|
|
|
|
|
|
+ if (fromData[`device_${index}`]) {
|
|
|
|
+ let fromPrice = fromData[`device_${index}`];
|
|
|
|
+ count = count + Number(fromPrice);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- fileFlow.priceCount = count.toFixed(2)
|
|
|
|
|
|
+ fileFlow.priceCount = count.toFixed(2);
|
|
}
|
|
}
|
|
|
|
|
|
- function clearInfo(val){
|
|
|
|
|
|
+ function clearInfo(val) {
|
|
let indexa = n.value;
|
|
let indexa = n.value;
|
|
- fileFlow.priceCount = 0
|
|
|
|
- if(!val){
|
|
|
|
- resetFields()
|
|
|
|
|
|
+ fileFlow.priceCount = 0;
|
|
|
|
+ if (!val) {
|
|
|
|
+ resetFields();
|
|
}
|
|
}
|
|
- let clearFiled = []
|
|
|
|
- fileFlow.priceLists.map(ele =>{
|
|
|
|
- clearFiled.push(`priceList${ele.priceListId}`,`priceListText${ele.priceListId}`,`discount${ele.priceListId}`)
|
|
|
|
- })
|
|
|
|
|
|
+ let clearFiled = [];
|
|
|
|
+ fileFlow.priceLists.map((ele) => {
|
|
|
|
+ clearFiled.push(
|
|
|
|
+ `priceList${ele.priceListId}`,
|
|
|
|
+ `priceListText${ele.priceListId}`,
|
|
|
|
+ `discount${ele.priceListId}`,
|
|
|
|
+ );
|
|
|
|
+ });
|
|
for (let index = 1; index < indexa; index++) {
|
|
for (let index = 1; index < indexa; index++) {
|
|
- clearFiled.push(`deviceType${index}`, `device_${index}`, `${index}`)
|
|
|
|
|
|
+ clearFiled.push(`deviceTypeId${index}`,`deviceType${index}`, `device_${index}`, `${index}`);
|
|
}
|
|
}
|
|
removeSchemaByFiled(clearFiled);
|
|
removeSchemaByFiled(clearFiled);
|
|
- n.value = 1
|
|
|
|
|
|
+ n.value = 1;
|
|
}
|
|
}
|
|
|
|
|
|
return {
|
|
return {
|
|
@@ -434,6 +517,7 @@
|
|
clearInfo,
|
|
clearInfo,
|
|
updataCount,
|
|
updataCount,
|
|
t,
|
|
t,
|
|
|
|
+ n,
|
|
del,
|
|
del,
|
|
add,
|
|
add,
|
|
updataRepairInfo,
|
|
updataRepairInfo,
|
|
@@ -443,11 +527,11 @@
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
-.priceCount{
|
|
|
|
- // padding: 20px 180px;
|
|
|
|
- line-height: 32px;
|
|
|
|
- .label{
|
|
|
|
- display: inline-block;
|
|
|
|
|
|
+ .priceCount {
|
|
|
|
+ // padding: 20px 180px;
|
|
|
|
+ line-height: 32px;
|
|
|
|
+ .label {
|
|
|
|
+ display: inline-block;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
</style>
|
|
</style>
|