|
@@ -0,0 +1,1524 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <Modal
|
|
|
+ :width="1400"
|
|
|
+ class-name="vertical-center-modal"
|
|
|
+ title="新增产品"
|
|
|
+ :mask-closable="false"
|
|
|
+ v-model="showAddProduct"
|
|
|
+ >
|
|
|
+ <div style="max-height: 800px; overflow: hidden; overflow-y: auto">
|
|
|
+ <Tabs v-model="currentTabIndex" ref="tabsRef">
|
|
|
+ <Button
|
|
|
+ @click="handleAddProductCopy"
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ style="margin-right: 5px"
|
|
|
+ slot="extra"
|
|
|
+ >复制产品</Button
|
|
|
+ >
|
|
|
+ <Button
|
|
|
+ @click="handleAddProductAdd"
|
|
|
+ size="small"
|
|
|
+ type="warning"
|
|
|
+ style="margin-right: 5px"
|
|
|
+ slot="extra"
|
|
|
+ >添加</Button
|
|
|
+ >
|
|
|
+ <Button
|
|
|
+ @click="handleAddProductDele"
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ slot="extra"
|
|
|
+ >删除</Button
|
|
|
+ >
|
|
|
+ <TabPane
|
|
|
+ :label="
|
|
|
+ (item.position ? item.position : '位置') + '-' + item.type_name
|
|
|
+ "
|
|
|
+ v-for="(item, index) in addProductArray"
|
|
|
+ :key="item.id"
|
|
|
+ :name="item.index + ''"
|
|
|
+ >
|
|
|
+ <div class="modal_product_info">
|
|
|
+ <div class="modal_product_info_title">产品信息</div>
|
|
|
+ <div class="modal_product_info_content modal_product">
|
|
|
+ <Form :model="item" :label-width="100">
|
|
|
+ <FormItem label="选择产品:">
|
|
|
+ <Tooltip style="width: 120px" transfer>
|
|
|
+ <span slot="content">
|
|
|
+ <span
|
|
|
+ v-for="_item in productList"
|
|
|
+ :key="_item.id"
|
|
|
+ v-show="_item.id == item.product_id"
|
|
|
+ >{{ _item.title }}</span
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ <Select
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ filter-by-label
|
|
|
+ transfer
|
|
|
+ label-in-value
|
|
|
+ size="small"
|
|
|
+ v-model="item.product_id"
|
|
|
+ @on-change="handleAddProductSelect($event, index)"
|
|
|
+ style="width: 120px"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="item of productList"
|
|
|
+ :tag="item.img_url"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.title"
|
|
|
+ :value="item.id"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ </Tooltip>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="位置:">
|
|
|
+ <Tooltip style="width: 120px" transfer>
|
|
|
+ <span slot="content">
|
|
|
+ {{ item.position }}
|
|
|
+ </span>
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="item.position"
|
|
|
+ style="width: 120px"
|
|
|
+ placeholder="请输入位置"
|
|
|
+ />
|
|
|
+ </Tooltip>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="计量单位:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ disabled
|
|
|
+ style="width: 120px"
|
|
|
+ v-model="item.unit"
|
|
|
+ placeholder="自动带出"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <!-- 工艺属性 -->
|
|
|
+ <FormItem
|
|
|
+ v-for="(ele, idx) in item.process"
|
|
|
+ :key="ele.key + '' + item.id"
|
|
|
+ :label="ele.title + ':'"
|
|
|
+ >
|
|
|
+ <Tooltip style="width: 120px" transfer>
|
|
|
+ <span slot="content">
|
|
|
+ <span
|
|
|
+ v-for="_item in ele.processList"
|
|
|
+ :key="_item.id"
|
|
|
+ v-show="_item.id == ele.value"
|
|
|
+ >{{ _item.title }}</span
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ <Select
|
|
|
+ style="width: 120px"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ filter-by-label
|
|
|
+ transfer
|
|
|
+ label-in-value
|
|
|
+ @on-open-change="
|
|
|
+ (e) => handleGetProductMeasure(e, idx, item, ele)
|
|
|
+ "
|
|
|
+ @on-change="
|
|
|
+ (e) => handleProductProcessChange(e, idx, item, ele)
|
|
|
+ "
|
|
|
+ v-model="ele.value"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="option of ele.processList"
|
|
|
+ :key="option.id"
|
|
|
+ :disabled="option.isDisabled"
|
|
|
+ :label="option.title"
|
|
|
+ :value="option.id"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ </Tooltip>
|
|
|
+ </FormItem>
|
|
|
+ <!-- 测量字段 -->
|
|
|
+ <FormItem
|
|
|
+ v-for="ele in item.measure"
|
|
|
+ :key="ele.id"
|
|
|
+ :label="ele.title + ':'"
|
|
|
+ >
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ type="text"
|
|
|
+ clearable
|
|
|
+ :placeholder="ele.e_title"
|
|
|
+ v-model="ele.value"
|
|
|
+ @on-change="
|
|
|
+ (e) => handleProductMeasureChange(e, item, ele)
|
|
|
+ "
|
|
|
+ @on-blur="(e) => handleProductMeasureBlur(e, item, ele)"
|
|
|
+ style="width: 120px"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="数量:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ @on-change="(e) => handleProductNumChange(e, item)"
|
|
|
+ v-model="item.total_num"
|
|
|
+ style="width: 120px"
|
|
|
+ placeholder="请输入产品数量"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="核算数量:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="item.num"
|
|
|
+ disabled
|
|
|
+ style="width: 120px"
|
|
|
+ placeholder="自动带出"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="单价:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="item.unit_price"
|
|
|
+ @on-change="(e) => handleProductUnit_priceChange(e, item)"
|
|
|
+ style="width: 120px"
|
|
|
+ placeholder="自动带出"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="附加金额:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="item.ext_price"
|
|
|
+ @on-change="(e) => handleProductExt_priceChange(e, item)"
|
|
|
+ style="width: 120px"
|
|
|
+ placeholder="自动带出"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="超标金额:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ @on-change="(e) => handleProductOver_priceChange(e, item)"
|
|
|
+ v-model="item.over_price"
|
|
|
+ style="width: 120px"
|
|
|
+ placeholder="自动带出"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="金额:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="item.price"
|
|
|
+ style="width: 120px"
|
|
|
+ placeholder="自动带出"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="图号:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="item.url_number"
|
|
|
+ style="width: 120px"
|
|
|
+ placeholder="自动带出"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem
|
|
|
+ v-for="(_customize, customize_key) in item.customize"
|
|
|
+ :label="_customize.style + ':'"
|
|
|
+ :key="customize_key + 99"
|
|
|
+ >
|
|
|
+ <Input
|
|
|
+ v-show="_customize.type == 1"
|
|
|
+ size="small"
|
|
|
+ type="text"
|
|
|
+ v-model="_customize.value"
|
|
|
+ style="width: 120px"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+
|
|
|
+ <Select
|
|
|
+ v-show="_customize.type == 2"
|
|
|
+ style="width: 120px"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ v-model="_customize.value"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="option of _customize.explain"
|
|
|
+ :key="option.value"
|
|
|
+ :label="option.value"
|
|
|
+ :value="option.value"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem
|
|
|
+ v-for="(outh, outh_key) in item.outh"
|
|
|
+ :label="outh.title"
|
|
|
+ :key="outh_key + 21"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ v-if="outh.key == 'img' || outh.key == 'url'"
|
|
|
+ @click="showPreview(item, outh.key)"
|
|
|
+ style="
|
|
|
+ max-width: 30px;
|
|
|
+ max-height: 30px;
|
|
|
+ top: 5px;
|
|
|
+ position: relative;
|
|
|
+ cursor: pointer;
|
|
|
+ "
|
|
|
+ :src="$store.state.ip + outh.value"
|
|
|
+ />
|
|
|
+ <Input
|
|
|
+ v-if="
|
|
|
+ outh.key != 'img' &&
|
|
|
+ outh.key != 'url' &&
|
|
|
+ outh.key != 'lock'
|
|
|
+ "
|
|
|
+ disabled
|
|
|
+ placeholder="自动生成"
|
|
|
+ style="width: 120px"
|
|
|
+ size="small"
|
|
|
+ v-model="outh.value"
|
|
|
+ />
|
|
|
+ <Select
|
|
|
+ label-in-value
|
|
|
+ @on-change="changeLock($event, item, index)"
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ style="width: 120px"
|
|
|
+ v-if="outh.key == 'lock'"
|
|
|
+ v-model="item[outh.key]"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="luck of lock_list"
|
|
|
+ :key="luck.id"
|
|
|
+ :tag="luck.price"
|
|
|
+ :value="luck.id"
|
|
|
+ :label="luck.title"
|
|
|
+ ></Option>
|
|
|
+ <Option :value="0" label="无"></Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="备注:">
|
|
|
+ <Select
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ allow-create
|
|
|
+ @on-create="handleRemarkCreate"
|
|
|
+ style="width: 120px"
|
|
|
+ v-model="item.remark"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="_remark of support_remark"
|
|
|
+ :key="_remark"
|
|
|
+ :value="_remark"
|
|
|
+ :label="_remark"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ <!-- <Input
|
|
|
+ size="small"
|
|
|
+ type="textarea"
|
|
|
+ v-model="item.remark"
|
|
|
+ style="width: 120px"
|
|
|
+ placeholder="请输入备注"
|
|
|
+ /> -->
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="产品图:">
|
|
|
+ <!-- v-show="modalData.url && modalData.url.length > 0" -->
|
|
|
+ <div class="product-img">
|
|
|
+ <div class="product-add">
|
|
|
+ <div
|
|
|
+ class="items"
|
|
|
+ v-for="(item, index) of item.url"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ @click="looks(item)"
|
|
|
+ :src="$store.state.ip + item"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal_product_info">
|
|
|
+ <div class="modal_product_info_title">部件信息</div>
|
|
|
+ <div class="modal_product_info_content modal_parts">
|
|
|
+ <Form
|
|
|
+ :model="element"
|
|
|
+ v-for="(element, idx) in item.part"
|
|
|
+ :key="element.id + '111' + idx"
|
|
|
+ :label-width="50"
|
|
|
+ >
|
|
|
+ <FormItem
|
|
|
+ :label-width="element.isBP ? 1 : 50"
|
|
|
+ v-show="!element.is_metal"
|
|
|
+ >
|
|
|
+ <Radio
|
|
|
+ v-show="element.isBP"
|
|
|
+ @click.native.prevent="handleRadioClick(element)"
|
|
|
+ v-model="element.isChoosed"
|
|
|
+ ></Radio>
|
|
|
+ <!-- <span v-show="element.isBP">{{ element.part_title }} </span> -->
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="部件:" v-show="!element.is_metal">
|
|
|
+ <Select
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ transfer
|
|
|
+ label-in-value
|
|
|
+ size="small"
|
|
|
+ @on-change="
|
|
|
+ handlePartChange(
|
|
|
+ $event,
|
|
|
+ element,
|
|
|
+ item.measure,
|
|
|
+ item.total_num
|
|
|
+ )
|
|
|
+ "
|
|
|
+ v-model="element.change_id"
|
|
|
+ style="width: 180px"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="item of element.change"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.part_title"
|
|
|
+ :value="item.id"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem
|
|
|
+ label="高:"
|
|
|
+ v-show="
|
|
|
+ !element.is_metal &&
|
|
|
+ element.hide_measure &&
|
|
|
+ !element.hide_measure.filter((v) => v == 'H').length > 0
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ v-model="element.long"
|
|
|
+ style="width: 50px"
|
|
|
+ placeholder="请输入厚"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem
|
|
|
+ label="宽:"
|
|
|
+ v-show="
|
|
|
+ !element.is_metal &&
|
|
|
+ element.hide_measure &&
|
|
|
+ !element.hide_measure.filter((v) => v == 'W').length > 0
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ v-model="element.wide"
|
|
|
+ style="width: 50px"
|
|
|
+ placeholder="请输入宽"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem
|
|
|
+ label="厚:"
|
|
|
+ v-show="
|
|
|
+ !element.is_metal &&
|
|
|
+ element.hide_measure &&
|
|
|
+ !element.hide_measure.filter((v) => v == 'T').length > 0
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ v-model="element.high"
|
|
|
+ style="width: 50px"
|
|
|
+ placeholder="请输入高"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem
|
|
|
+ v-for="(process_detail, idx) in element.process"
|
|
|
+ :key="process_detail.name + '222' + element.part_id"
|
|
|
+ :label="process_detail.name + ':'"
|
|
|
+ v-show="
|
|
|
+ !element.is_metal &&
|
|
|
+ element.hide_process &&
|
|
|
+ !element.hide_process.filter(
|
|
|
+ (v) => v == process_detail.process_id
|
|
|
+ ).length > 0
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <Tooltip style="width: 120px" transfer>
|
|
|
+ <span slot="content">
|
|
|
+ <span
|
|
|
+ v-for="_item in process_detail.cld"
|
|
|
+ :key="_item.id"
|
|
|
+ v-show="_item.id == process_detail.procedure_property"
|
|
|
+ >{{ _item.title }}</span
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ <Select
|
|
|
+ style="width: 120px"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ transfer
|
|
|
+ label-in-value
|
|
|
+ @on-change="
|
|
|
+ (e) => handlePartProcessChange(e, idx, element)
|
|
|
+ "
|
|
|
+ v-model="process_detail.procedure_property"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="option of process_detail.cld"
|
|
|
+ :key="option.id"
|
|
|
+ :label="option.title"
|
|
|
+ :value="option.id"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ </Tooltip>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem v-show="!element.is_metal">
|
|
|
+ <Button
|
|
|
+ @click="handlePartsApart(element, idx, item.part)"
|
|
|
+ type="primary"
|
|
|
+ v-if="element.isBP"
|
|
|
+ style="margin-right: 5px"
|
|
|
+ size="small"
|
|
|
+ >拆分</Button
|
|
|
+ >
|
|
|
+ <Button
|
|
|
+ @click="handlePartsDele(element, idx, item.part)"
|
|
|
+ type="primary"
|
|
|
+ v-else
|
|
|
+ style="margin-right: 5px"
|
|
|
+ size="small"
|
|
|
+ >删除</Button
|
|
|
+ >
|
|
|
+ <Button
|
|
|
+ @click="handlePartDetailEdit(element, idx)"
|
|
|
+ type="primary"
|
|
|
+ style="margin-right: 5px"
|
|
|
+ size="small"
|
|
|
+ >{{
|
|
|
+ element.isShowPartDetail ? "收起" : "修改原材料"
|
|
|
+ }}</Button
|
|
|
+ >
|
|
|
+ </FormItem>
|
|
|
+ <div
|
|
|
+ :class="[
|
|
|
+ 'part_detail_form',
|
|
|
+ element.isShowPartDetail ? '' : 'hide_part_detail',
|
|
|
+ ]"
|
|
|
+ :data-index="idx"
|
|
|
+ >
|
|
|
+ <FormItem>
|
|
|
+ <div v-for="ele in element.part_detail" :key="ele.id">
|
|
|
+ <Form :model="ele">
|
|
|
+ <FormItem>
|
|
|
+ <div style="width: 200px">
|
|
|
+ {{ ele.title || ele.part_detail_title }}
|
|
|
+ </div>
|
|
|
+ </FormItem>
|
|
|
+ <!-- 原材料 -->
|
|
|
+ <Form>
|
|
|
+ <FormItem>
|
|
|
+ <div style="width: 200px">
|
|
|
+ {{ ele.material_detail_title || "请选择" }}
|
|
|
+ </div>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="高" :label-width="40">
|
|
|
+ <Select
|
|
|
+ style="width: 80px"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ transfer
|
|
|
+ v-model="ele.material_detail_id"
|
|
|
+ @on-change="(e) => handleMaterialChange(e, ele)"
|
|
|
+ placeholder="请选择高"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="option of ele.material_detail_list"
|
|
|
+ :key="option.material_detail_id"
|
|
|
+ :label="option.long"
|
|
|
+ :value="option.material_detail_id"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="宽" :label-width="40">
|
|
|
+ <Select
|
|
|
+ style="width: 80px"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ transfer
|
|
|
+ v-model="ele.material_detail_id"
|
|
|
+ placeholder="请选择宽"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="option of ele.material_detail_list"
|
|
|
+ :key="option.material_detail_id"
|
|
|
+ :label="option.wide"
|
|
|
+ :value="option.material_detail_id"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="厚" :label-width="40">
|
|
|
+ <Select
|
|
|
+ style="width: 80px"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ transfer
|
|
|
+ v-model="ele.material_detail_id"
|
|
|
+ placeholder="请选择厚"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="option of ele.material_detail_list"
|
|
|
+ :key="option.material_detail_id"
|
|
|
+ :label="option.high"
|
|
|
+ :value="option.material_detail_id"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="数量" :label-width="40">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="ele.material_detail_num"
|
|
|
+ style="width: 80px"
|
|
|
+ placeholder="请输入数量"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ </FormItem>
|
|
|
+ </div>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal_product_info">
|
|
|
+ <div class="modal_product_info_title">
|
|
|
+ 附加信息
|
|
|
+ <Button
|
|
|
+ @click="handleExtraAdd(item.metalArray, 1)"
|
|
|
+ type="primary"
|
|
|
+ style="margin-right: 5px"
|
|
|
+ size="small"
|
|
|
+ >新增五金</Button
|
|
|
+ >
|
|
|
+ <Button
|
|
|
+ @click="handleExtraAdd(item.extArray, 2)"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ >新增附加项目</Button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <div class="modal_product_info_content modal_extra">
|
|
|
+ <Form
|
|
|
+ :model="element"
|
|
|
+ v-for="(element, idx) in item.metalArray"
|
|
|
+ :key="element.id"
|
|
|
+ :label-width="80"
|
|
|
+ >
|
|
|
+ <FormItem label="五金:">
|
|
|
+ <Select
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ transfer
|
|
|
+ label-in-value
|
|
|
+ size="small"
|
|
|
+ @on-change="
|
|
|
+ (e) =>
|
|
|
+ handleMetalChange(e, element, idx, item.metalArray)
|
|
|
+ "
|
|
|
+ v-model="element.material_id"
|
|
|
+ style="width: 100px"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="item of metalList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.title"
|
|
|
+ :value="item.id"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="数量:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="element.num"
|
|
|
+ @on-change="handleTotalPriceCalc(element, item)"
|
|
|
+ style="width: 100px"
|
|
|
+ placeholder="请输入数量"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="单价:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="element.price"
|
|
|
+ @on-change="handleTotalPriceCalc(element, item)"
|
|
|
+ style="width: 100px"
|
|
|
+ placeholder="请输入单价"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="金额:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ @on-change="handleTotalPriceChange(element, item)"
|
|
|
+ v-model="element.total_price"
|
|
|
+ style="width: 100px"
|
|
|
+ placeholder="请输入金额"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="备注:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="element.remark"
|
|
|
+ style="width: 100px"
|
|
|
+ placeholder="请输入备注"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem>
|
|
|
+ <a
|
|
|
+ style="color: red"
|
|
|
+ @click="
|
|
|
+ handleExtraDele(item.metalArray, element, idx, item)
|
|
|
+ "
|
|
|
+ >删除</a
|
|
|
+ >
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ <Form
|
|
|
+ :model="element"
|
|
|
+ v-for="(element, idx) in item.extArray"
|
|
|
+ :key="element.id"
|
|
|
+ :label-width="80"
|
|
|
+ >
|
|
|
+ <FormItem label="附加项目:">
|
|
|
+ <Select
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ transfer
|
|
|
+ label-in-value
|
|
|
+ size="small"
|
|
|
+ v-model="element.id"
|
|
|
+ @on-change="(e) => handleExtChange(element, e, item)"
|
|
|
+ style="width: 100px"
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="item of extList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.title"
|
|
|
+ :value="item.id"
|
|
|
+ ></Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="数量:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="element.num"
|
|
|
+ @on-change="handleTotalPriceCalc(element, item)"
|
|
|
+ style="width: 100px"
|
|
|
+ placeholder="请输入数量"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="单价:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="element.price"
|
|
|
+ @on-change="handleTotalPriceCalc(element, item)"
|
|
|
+ style="width: 100px"
|
|
|
+ placeholder="请输入单价"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="金额:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ @on-change="handleTotalPriceChange(element, item)"
|
|
|
+ v-model="element.total_price"
|
|
|
+ style="width: 100px"
|
|
|
+ placeholder="请输入金额"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="备注:">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ v-model="element.remark"
|
|
|
+ style="width: 100px"
|
|
|
+ placeholder="请输入备注"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem>
|
|
|
+ <a
|
|
|
+ style="color: red"
|
|
|
+ @click="
|
|
|
+ handleExtraDele(item.extArray, element, idx, item)
|
|
|
+ "
|
|
|
+ >删除</a
|
|
|
+ >
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </TabPane>
|
|
|
+ </Tabs>
|
|
|
+ </div>
|
|
|
+ <div slot="footer">
|
|
|
+ <Button @click="cancel">取消</Button>
|
|
|
+ <Button @click="then" type="primary">确定</Button>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
|
+// 例如:import 《组件名称》 from '《组件路径》';
|
|
|
+export default {
|
|
|
+ name: "",
|
|
|
+ components: {},
|
|
|
+ props: {},
|
|
|
+ // import引入的组件需要注入到对象中才能使用
|
|
|
+ data() {
|
|
|
+ // 这里存放数据
|
|
|
+ return {
|
|
|
+ showAddProduct: false,
|
|
|
+ addProductArray: [
|
|
|
+ {
|
|
|
+ type_name: "产品1",
|
|
|
+ num: 1,
|
|
|
+ position: "位置",
|
|
|
+ index: "0",
|
|
|
+ metalArray: [],
|
|
|
+ extArray: [],
|
|
|
+ },
|
|
|
+ ], //新增产品列表
|
|
|
+ pre_bp_id: "", //产品分类ID,添加多个产品时判断是否与前一个产品分类一致
|
|
|
+ process_match_list: [], //当前产品所有工艺组合
|
|
|
+ process_all_list: [], //当前产品所有工艺
|
|
|
+ support_remark: [], //备注列表
|
|
|
+ bpp_list: [], //工艺属性列表
|
|
|
+ // route_id_at_copy: "", //复制产品的工艺路线ID
|
|
|
+ pre_process_obj: {}, //产品工艺属性,添加多个产品时判断是否与前一个工艺属性一致
|
|
|
+ currentTabIndex: "0", //当前分页面
|
|
|
+ productList: [], //产品列表
|
|
|
+ metalList: [], //五金列表
|
|
|
+ extList: [], //五金列表
|
|
|
+ };
|
|
|
+ },
|
|
|
+ // 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
+ created() {
|
|
|
+ // 获取工艺属性
|
|
|
+ this.axios({
|
|
|
+ method: "get",
|
|
|
+ url: "/api/bpp_list",
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.bpp_list = res.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 获取产品列表
|
|
|
+ this.axios("/api/product").then(
|
|
|
+ (res) => (this.productList = res.data.data)
|
|
|
+ );
|
|
|
+ // 获取五金列表
|
|
|
+ this.axios
|
|
|
+ .get("/api/material", { params: { sub_type_id: 5 } })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.metalList = res.data.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 获取附加列表
|
|
|
+ this.axios.get("/api/project_ext_list").then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.extList = res.data.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
+ mounted() {},
|
|
|
+ methods: {
|
|
|
+ handleAddProductCopy() {
|
|
|
+ let idx = this.$refs.tabsRef.activeKey;
|
|
|
+ let obj = this.deepClone(this.addProductArray[idx]);
|
|
|
+ obj.index = this.addProductArray.length;
|
|
|
+ this.pre_bp_id = this.addProductArray[idx].bp_id;
|
|
|
+ this.addProductArray.push(obj);
|
|
|
+ },
|
|
|
+ handleAddProductDele() {
|
|
|
+ let idx = this.$refs.tabsRef.activeKey;
|
|
|
+ this.addProductArray.splice(idx, 1);
|
|
|
+ },
|
|
|
+ handleAddProductAdd() {
|
|
|
+ let index = this.addProductArray.length;
|
|
|
+ this.addProductArray.push({
|
|
|
+ type_name: "产品" + (this.addProductArray.length + 1),
|
|
|
+ position: "",
|
|
|
+ index,
|
|
|
+ extArray: [{ type: 2 }],
|
|
|
+ metalArray: [{ type: 1 }],
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleAddProductSelect(row, n) {
|
|
|
+ if (row) {
|
|
|
+ let product_id = row.value;
|
|
|
+ this.addProductArray[n].type_name = row.label;
|
|
|
+ this.addProductArray[n].title = row.label;
|
|
|
+ this.axios("/api/order_get_product_detail_new", {
|
|
|
+ params: { product_id, custom_id: this.custom_id },
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ if (this.addProductArray.length == 1) {
|
|
|
+ let _temp_obj = {};
|
|
|
+ if (res.data.process.list.length > 1) {
|
|
|
+ for (const key in res.data.process.list[0].detail) {
|
|
|
+ res.data.process.list.reduce((pre, cur) => {
|
|
|
+ if (_temp_obj[key] == "") {
|
|
|
+ return pre;
|
|
|
+ } else {
|
|
|
+ if (pre.detail[key] == cur.detail[key]) {
|
|
|
+ _temp_obj[key] = pre.detail[key];
|
|
|
+ return pre;
|
|
|
+ } else {
|
|
|
+ _temp_obj[key] = "";
|
|
|
+ return pre;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ _temp_obj = res.data.process.list[0].detail;
|
|
|
+ }
|
|
|
+ this.pre_process_obj = this.deepClone(_temp_obj);
|
|
|
+ }
|
|
|
+ // this.process_match_list = res.data.process.list;
|
|
|
+ this.process_all_list = res.data.process.title;
|
|
|
+ this.support_remark = res.data.support_remark;
|
|
|
+ let modalData = this.addProductArray[n];
|
|
|
+ modalData.url = res.data.url;
|
|
|
+ modalData.total_num = res.data.total_num || 1;
|
|
|
+ modalData.ext_price = res.data.ext_price || 0;
|
|
|
+ modalData.unit_price = res.data.price || 0;
|
|
|
+ modalData.num = res.data.num || 1;
|
|
|
+ modalData.num_temp_save = modalData.num;
|
|
|
+ modalData.over_price = res.data.over_price || 0;
|
|
|
+ modalData.position = res.data.position || "";
|
|
|
+ modalData.unit = res.data.unit || "";
|
|
|
+ modalData.remark = res.data.remark || "";
|
|
|
+ modalData.url_number = res.data.url_number || "";
|
|
|
+ modalData.overdraft = res.data.overdraft;
|
|
|
+ modalData.num_formula = res.data.num_formula;
|
|
|
+ modalData.bp_id = res.data.bp_id;
|
|
|
+ // 金额=(产品单价)*核算数量 +附加金额 + 超标金额
|
|
|
+ modalData.price =
|
|
|
+ (modalData.unit_price * 1 || 0) * (modalData.num * 1 || 1) +
|
|
|
+ (modalData.over_price * 1 || 0) +
|
|
|
+ (modalData.ext_price * 1 || 0);
|
|
|
+ modalData.price = modalData.price.toFixed(2);
|
|
|
+ modalData.selected_ids = [];
|
|
|
+ modalData.part = res.data.part;
|
|
|
+ modalData.part.forEach((element) => {
|
|
|
+ // 选择不是附加项目的,
|
|
|
+ if (!element.is_metal) {
|
|
|
+ // 选择不是线条、或者基础档案中要默认为空的部件
|
|
|
+ element.isBP = true;
|
|
|
+ element.isChoosed = true;
|
|
|
+ if (element.is_null == 1) {
|
|
|
+ element.change_id = "";
|
|
|
+ } else {
|
|
|
+ element.part_detail = element.sub_part;
|
|
|
+ //展示非拆分部件
|
|
|
+ // 默认替换部件
|
|
|
+ element.change_id = element.change[0].id;
|
|
|
+ //存计算公式
|
|
|
+ element.long ? "" : (element.long = 0);
|
|
|
+ element.wide ? "" : (element.wide = 0);
|
|
|
+ element.high ? "" : (element.high = 0);
|
|
|
+ element.longCalc = element.long;
|
|
|
+ element.wideCalc = element.wide;
|
|
|
+ element.highCalc = element.high;
|
|
|
+ element.part_detail.forEach((elem) => {
|
|
|
+ elem.org_num = elem.num;
|
|
|
+ elem.material_detail_id = 0;
|
|
|
+ elem.material_detail_title =
|
|
|
+ elem.material_detail_list[0].title;
|
|
|
+ elem.material_detail_id =
|
|
|
+ elem.material_detail_list[0].material_detail_id;
|
|
|
+ elem.material_detail_num = elem.num || 0;
|
|
|
+ elem.material_detail_org_num = elem.num || 0;
|
|
|
+ elem.long ? "" : (elem.long = 0);
|
|
|
+ elem.wide ? "" : (elem.wide = 0);
|
|
|
+ elem.high ? "" : (elem.high = 0);
|
|
|
+ elem.longCalc = elem.long || "";
|
|
|
+ elem.wideCalc = elem.wide || "";
|
|
|
+ elem.highCalc = elem.high || "";
|
|
|
+ elem.material_detail_list.forEach((el) => {
|
|
|
+ el.long = el.long || "0";
|
|
|
+ el.wide = el.wide || "0";
|
|
|
+ el.high = el.high || "0";
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //测量字段
|
|
|
+ modalData.measure = res.data.measure;
|
|
|
+ modalData.measure.forEach((element) => {
|
|
|
+ element.value = "";
|
|
|
+ element.measureCalc = element.e_title;
|
|
|
+ });
|
|
|
+ //工艺属性
|
|
|
+ this.bpp_list.map((element) => {
|
|
|
+ for (const key in res.data.process.title) {
|
|
|
+ const ele = res.data.process.title[key];
|
|
|
+ if (element.name == ele) {
|
|
|
+ if (this.route_id_at_copy) {
|
|
|
+ const compare_copy = res.data.process.list.filter(
|
|
|
+ (item) => item.id == this.route_id_at_copy
|
|
|
+ );
|
|
|
+ if (compare_copy && compare_copy.length > 0) {
|
|
|
+ if (!modalData.procedure_properties) {
|
|
|
+ modalData.procedure_properties = [];
|
|
|
+ }
|
|
|
+ modalData.procedure_properties[
|
|
|
+ modalData.process.lenngth
|
|
|
+ ] = compare_copy[0].detail[key] * 1;
|
|
|
+ modalData.process.push({
|
|
|
+ key: key,
|
|
|
+ title: ele,
|
|
|
+ value: compare_copy[0].detail[key] * 1,
|
|
|
+ processList: element.cld,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ modalData.process.push({
|
|
|
+ key: key,
|
|
|
+ title: ele,
|
|
|
+ value: "",
|
|
|
+ processList: element.cld,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const compare = res.data.process.list.filter(
|
|
|
+ (item) => item.detail[key] == this.pre_process_obj[key]
|
|
|
+ );
|
|
|
+ if (compare.length > 0) {
|
|
|
+ modalData.procedure_properties = [];
|
|
|
+ modalData.procedure_properties.push(
|
|
|
+ this.pre_process_obj[key] * 1
|
|
|
+ );
|
|
|
+ modalData.process.push({
|
|
|
+ key: key,
|
|
|
+ title: ele,
|
|
|
+ value: this.pre_process_obj[key] * 1,
|
|
|
+ processList: element.cld,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ modalData.procedure_properties = [];
|
|
|
+ modalData.procedure_properties.push("");
|
|
|
+ modalData.process.push({
|
|
|
+ key: key,
|
|
|
+ title: ele,
|
|
|
+ value: "",
|
|
|
+ processList: element.cld,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ modalData.part.forEach((element) => {
|
|
|
+ if (!element.is_metal) {
|
|
|
+ //赋值默认工艺属性
|
|
|
+ element.process = this.deepClone(this.bpp_list);
|
|
|
+ element.process.forEach((elem, index) => {
|
|
|
+ for (const key in res.data.process.title) {
|
|
|
+ const ele = res.data.process.title[key];
|
|
|
+ if (elem.name == ele) {
|
|
|
+ elem.procedure_property = this.pre_process_obj[key] * 1;
|
|
|
+ elem.process_id = key;
|
|
|
+ if (!element.procedure_properties) {
|
|
|
+ element.procedure_properties = [];
|
|
|
+ }
|
|
|
+ element.procedure_properties[index] =
|
|
|
+ this.pre_process_obj[key] * 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleExtraAdd(array, type) {
|
|
|
+ array.push({
|
|
|
+ num: 0,
|
|
|
+ price: 0,
|
|
|
+ total_price: 0,
|
|
|
+ type,
|
|
|
+ remark: "",
|
|
|
+ title: "",
|
|
|
+ is_metal: true,
|
|
|
+ });
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ handleRemarkCreate(val) {
|
|
|
+ this.support_remark.push(val);
|
|
|
+ },
|
|
|
+ handleProductMeasureChange(e, product, measure_detail) {
|
|
|
+ if (e.target.value) {
|
|
|
+ let cur_measure = measure_detail.measureCalc;
|
|
|
+ let cur_value = measure_detail.value;
|
|
|
+ product.over_price = 0;
|
|
|
+ //当前测量字段 L W H 修改部件测量字段
|
|
|
+ product.part.forEach((element) => {
|
|
|
+ if (!element.is_metal) {
|
|
|
+ if (!element.is_null == 1) {
|
|
|
+ //处理公式
|
|
|
+ if (element.highCalc.indexOf(cur_measure) != -1) {
|
|
|
+ element.high = element.highCalc.replace(
|
|
|
+ new RegExp(cur_measure, "g"),
|
|
|
+ cur_value || ""
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (element.longCalc.indexOf(cur_measure) != -1) {
|
|
|
+ element.long = element.longCalc.replace(
|
|
|
+ new RegExp(cur_measure, "g"),
|
|
|
+ cur_value || ""
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (element.wideCalc.indexOf(cur_measure) != -1) {
|
|
|
+ element.wide = element.wideCalc.replace(
|
|
|
+ new RegExp(cur_measure, "g"),
|
|
|
+ cur_value || ""
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //判断测量字段公式中是否还含有字母
|
|
|
+ let flag_high = false;
|
|
|
+ let flag_long = false;
|
|
|
+ let flag_wide = false;
|
|
|
+ for (let index = 0; index < product.measure.length; index++) {
|
|
|
+ const item = product.measure[index];
|
|
|
+ if (element.high.indexOf(item.measureCalc) != -1) {
|
|
|
+ flag_high = true;
|
|
|
+ }
|
|
|
+ if (element.long.indexOf(item.measureCalc) != -1) {
|
|
|
+ flag_long = true;
|
|
|
+ }
|
|
|
+ if (element.wide.indexOf(item.measureCalc) != -1) {
|
|
|
+ flag_wide = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag_high) {
|
|
|
+ } else {
|
|
|
+ element.high = eval(element.high);
|
|
|
+ element.high += "";
|
|
|
+ }
|
|
|
+ if (flag_long) {
|
|
|
+ } else {
|
|
|
+ element.long = eval(element.long);
|
|
|
+ element.long += "";
|
|
|
+ }
|
|
|
+ if (flag_wide) {
|
|
|
+ } else {
|
|
|
+ element.wide = eval(element.wide);
|
|
|
+ element.wide += "";
|
|
|
+ }
|
|
|
+ element.part_detail.forEach((elem) => {
|
|
|
+ if (!elem.high) {
|
|
|
+ } else if (elem.highCalc.indexOf(cur_measure) != -1) {
|
|
|
+ elem.high = elem.highCalc.replace(
|
|
|
+ new RegExp(cur_measure, "g"),
|
|
|
+ cur_value || ""
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (!elem.long) {
|
|
|
+ } else if (elem.longCalc.indexOf(cur_measure) != -1) {
|
|
|
+ elem.long = elem.longCalc.replace(
|
|
|
+ new RegExp(cur_measure, "g"),
|
|
|
+ cur_value || ""
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (!elem.wide) {
|
|
|
+ } else if (elem.wideCalc.indexOf(cur_measure) != -1) {
|
|
|
+ elem.wide = elem.wideCalc.replace(
|
|
|
+ new RegExp(cur_measure, "g"),
|
|
|
+ cur_value || ""
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //判断测量字段公式中是否还含有字母
|
|
|
+ let _flag_high = false;
|
|
|
+ let _flag_long = false;
|
|
|
+ let _flag_wide = false;
|
|
|
+ // Number类型无法使用indexOf
|
|
|
+ elem.high += "";
|
|
|
+ elem.long += "";
|
|
|
+ elem.wide += "";
|
|
|
+ for (let index = 0; index < product.measure.length; index++) {
|
|
|
+ const item = product.measure[index];
|
|
|
+ if (!elem.high) {
|
|
|
+ } else if (elem.high.indexOf(item.measureCalc) != -1) {
|
|
|
+ _flag_high = true;
|
|
|
+ }
|
|
|
+ if (!elem.long) {
|
|
|
+ } else if (elem.long.indexOf(item.measureCalc) != -1) {
|
|
|
+ _flag_long = true;
|
|
|
+ }
|
|
|
+ if (!elem.wide) {
|
|
|
+ } else if (elem.wide.indexOf(item.measureCalc) != -1) {
|
|
|
+ _flag_wide = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (_flag_high) {
|
|
|
+ } else {
|
|
|
+ elem.high = eval(elem.high);
|
|
|
+ elem.high += "";
|
|
|
+ elem.high == "null" && (elem.high = 0);
|
|
|
+ }
|
|
|
+ if (_flag_long) {
|
|
|
+ } else {
|
|
|
+ elem.long = eval(elem.long);
|
|
|
+ elem.long += "";
|
|
|
+ elem.long == "null" && (elem.long = 0);
|
|
|
+ }
|
|
|
+ if (_flag_wide) {
|
|
|
+ } else {
|
|
|
+ elem.wide = eval(elem.wide);
|
|
|
+ elem.wide += "";
|
|
|
+ elem.wide == "null" && (elem.wide = 0);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ product.part.map((item) => {
|
|
|
+ const cur_part = product.overdraft.filter(
|
|
|
+ (v) => v.part_id == item.part_id
|
|
|
+ );
|
|
|
+ cur_part.length > 0 &&
|
|
|
+ cur_part.map((element) => {
|
|
|
+ // 1 高 2 宽 3 厚
|
|
|
+ if (
|
|
|
+ element.type == 1 &&
|
|
|
+ item.long > element.min &&
|
|
|
+ item.long < element.max
|
|
|
+ ) {
|
|
|
+ item.formula_temp = element.formula;
|
|
|
+ item.formula_temp = item.formula_temp.replace(/H/g, item.long);
|
|
|
+ item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
|
|
|
+ item.formula_temp = item.formula_temp.replace(/T/g, item.high);
|
|
|
+ item.formula_value = eval(item.formula_temp);
|
|
|
+ product.over_price += item.formula_value * 1 || 0;
|
|
|
+ product.over_price = product.over_price.toFixed(2);
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ element.type == 2 &&
|
|
|
+ item.wide > element.min &&
|
|
|
+ item.wide < element.max
|
|
|
+ ) {
|
|
|
+ item.formula_temp = element.formula;
|
|
|
+ item.formula_temp = item.formula_temp.replace(/H/g, item.long);
|
|
|
+ item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
|
|
|
+ item.formula_temp = item.formula_temp.replace(/T/g, item.high);
|
|
|
+ item.formula_value = eval(item.formula_temp);
|
|
|
+ product.over_price += item.formula_value * 1 || 0;
|
|
|
+ product.over_price = product.over_price.toFixed(2);
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ element.type == 3 &&
|
|
|
+ item.high > element.min &&
|
|
|
+ item.high < element.max
|
|
|
+ ) {
|
|
|
+ item.formula_temp = element.formula;
|
|
|
+ item.formula_temp = item.formula_temp.replace(/H/g, item.long);
|
|
|
+ item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
|
|
|
+ item.formula_temp = item.formula_temp.replace(/T/g, item.high);
|
|
|
+ item.formula_value = eval(item.formula_temp);
|
|
|
+ product.over_price += item.formula_value * 1 || 0;
|
|
|
+ product.over_price = product.over_price.toFixed(2);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //修改核算数量
|
|
|
+ // 如果没有核算数量公式,核算数量取产品数量
|
|
|
+ if (product.num_formula == "") {
|
|
|
+ product.total_num = product.num;
|
|
|
+ } else {
|
|
|
+ product.num_formula_temp = product.num_formula;
|
|
|
+ product.measure.forEach((element) => {
|
|
|
+ if (product.num_formula.indexOf(element.e_title) != -1) {
|
|
|
+ product.num_formula_temp = product.num_formula_temp.replace(
|
|
|
+ new RegExp(element.e_title, "g"),
|
|
|
+ element.value || 0
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+ product.num = eval(product.num_formula_temp);
|
|
|
+ product.num = product.num.toFixed(2);
|
|
|
+ product.over_price = product.over_price.toFixed(2);
|
|
|
+ product.num_temp_save = product.num;
|
|
|
+ product.price =
|
|
|
+ (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
|
|
|
+ (product.over_price * 1 || 0) +
|
|
|
+ (product.ext_price * 1 || 0);
|
|
|
+ product.price = product.price.toFixed(2);
|
|
|
+ }
|
|
|
+ this.$forceUpdate();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleProductMeasureBlur(e, product, measure_detail) {
|
|
|
+ try {
|
|
|
+ measure_detail.value = eval(e.target.value);
|
|
|
+ } catch (error) {
|
|
|
+ console.log("error :>> ", error);
|
|
|
+ }
|
|
|
+ product.part.map((part) => {
|
|
|
+ part.part_detail &&
|
|
|
+ part.part_detail.length > 0 &&
|
|
|
+ part.part_detail.map((part_detail) => {
|
|
|
+ part_detail._longCalc = this.handleCalcPartDetailLong(
|
|
|
+ part_detail,
|
|
|
+ product
|
|
|
+ );
|
|
|
+ if (part_detail.material_detail_list.length > 1) {
|
|
|
+ try {
|
|
|
+ part_detail.longCalcFinal = eval(part_detail._longCalc);
|
|
|
+ part_detail.material_detail_id = this.handleFindNearest(
|
|
|
+ part_detail.material_detail_list,
|
|
|
+ part_detail.longCalcFinal
|
|
|
+ );
|
|
|
+ } catch (error) {
|
|
|
+ console.log("error :>> ", error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ handleMaterialChange(val, row) {
|
|
|
+ if (val) {
|
|
|
+ let tempRow = row.material_detail_list.filter(
|
|
|
+ (item) => item.material_detail_id == val
|
|
|
+ );
|
|
|
+ row.material_detail_title = tempRow[0].title;
|
|
|
+ this.$forceUpdate();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleProductExt_priceChange(e, product) {
|
|
|
+ product.ext_price = e.target.value * 1;
|
|
|
+ product.price =
|
|
|
+ (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
|
|
|
+ (product.over_price * 1 || 0) +
|
|
|
+ (product.ext_price * 1 || 0);
|
|
|
+ product.price = product.price.toFixed(2);
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ handleProductOver_priceChange(e, product) {
|
|
|
+ product.over_price = e.target.value;
|
|
|
+ product.price =
|
|
|
+ (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
|
|
|
+ (product.over_price * 1 || 0) +
|
|
|
+ (product.ext_price * 1 || 0);
|
|
|
+ product.price = product.price.toFixed(2);
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ handleProductUnit_priceChange(e, product) {
|
|
|
+ product.unit_price = e.target.value * 1;
|
|
|
+ product.price =
|
|
|
+ (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
|
|
|
+ (product.over_price * 1 || 0) +
|
|
|
+ (product.ext_price * 1 || 0);
|
|
|
+ product.price = product.price.toFixed(2);
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ handleProductNumChange(e, product) {
|
|
|
+ product.part.map((element) => {
|
|
|
+ element.part_detail.map((elem) => {
|
|
|
+ elem.material_detail_num =
|
|
|
+ e.target.value * elem.material_detail_org_num;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ product.total_num = e.target.value;
|
|
|
+ product.num = (product.total_num * product.num_temp_save).toFixed(2);
|
|
|
+ product.price =
|
|
|
+ (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
|
|
|
+ (product.over_price * 1 || 0) +
|
|
|
+ (product.ext_price * 1 || 0);
|
|
|
+ product.price = product.price.toFixed(2);
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ handleCalcPartDetailLong(part_detail, product) {
|
|
|
+ for (const key in product.measure) {
|
|
|
+ const element = product.measure[key];
|
|
|
+ if (element.value) {
|
|
|
+ part_detail._longCalc = part_detail.longCalc.replace(
|
|
|
+ new RegExp(element.e_title, "g"),
|
|
|
+ element.value || ""
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ eval(part_detail._longCalc);
|
|
|
+ } catch (error) {
|
|
|
+ for (const key in product.measure) {
|
|
|
+ const element = product.measure[key];
|
|
|
+ part_detail._longCalc = part_detail._longCalc.replace(
|
|
|
+ new RegExp(element.e_title, "g"),
|
|
|
+ element.value || ""
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return part_detail._longCalc;
|
|
|
+ },
|
|
|
+ handleFindNearest(array, value) {
|
|
|
+ const temp = this.deepClone(array);
|
|
|
+ temp.sort((a, b) => {
|
|
|
+ return Math.abs(a.long - value) - Math.abs(b.long - value);
|
|
|
+ });
|
|
|
+ return temp[0].material_detail_id;
|
|
|
+ },
|
|
|
+ handleMetalChange(e, row, n, arr) {
|
|
|
+ arr[n].ext_id = e.value;
|
|
|
+ arr[n].title = e.label;
|
|
|
+ },
|
|
|
+ looks(img) {
|
|
|
+ const array = [{ img_url: img }];
|
|
|
+ this.$previewImg({
|
|
|
+ list: array,
|
|
|
+ baseUrl: this.$store.state.ip,
|
|
|
+ baseImgField: "img_url",
|
|
|
+ baseTitleField: "",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleExtChange(row, { value, label }, item) {
|
|
|
+ row.ext_id = value;
|
|
|
+ row.title = label;
|
|
|
+ const element = this.extList.filter((item) => item.id == value);
|
|
|
+ row.num = element[0].num;
|
|
|
+ row.price = element[0].price;
|
|
|
+ row.total_price = (row.num * row.price).toFixed(2);
|
|
|
+ this.handleTotalPriceCalc(row, item);
|
|
|
+ },
|
|
|
+ handleTotalPriceCalc(row, item) {
|
|
|
+ row.total_price = ((row.price || 0) * (row.num || 0)).toFixed(2);
|
|
|
+ let sum1 = 0;
|
|
|
+ item.metalArray &&
|
|
|
+ item.metalArray.length > 0 &&
|
|
|
+ item.metalArray.forEach((element) => {
|
|
|
+ sum1 += element.total_price * 1 || 0;
|
|
|
+ });
|
|
|
+ let sum2 = 0;
|
|
|
+ item.extArray &&
|
|
|
+ item.extArray.length > 0 &&
|
|
|
+ item.extArray.forEach((element) => {
|
|
|
+ sum2 += element.total_price * 1 || 0;
|
|
|
+ });
|
|
|
+ item.ext_price = sum1 * 1 + sum2 * 1;
|
|
|
+ item.price =
|
|
|
+ (item.unit_price * 1 || 0) * (item.num * 1 || 1) +
|
|
|
+ (item.over_price * 1 || 0) +
|
|
|
+ (item.ext_price * 1 || 0);
|
|
|
+ item.price = item.price.toFixed(2);
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ then() {
|
|
|
+ this.$emit("then");
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+ this.$emit("cancel");
|
|
|
+ },
|
|
|
+ deepClone(obj) {
|
|
|
+ //定义对象来判断当前的参数是数组还是对象
|
|
|
+ let objClone = Array.isArray(obj) ? [] : {};
|
|
|
+ //如果obj存在并且为对象
|
|
|
+ if (obj && typeof obj == "object") {
|
|
|
+ for (let key in obj) {
|
|
|
+ if (Object.hasOwnProperty.call(obj, key)) {
|
|
|
+ //如果obj的子元素为对象,那么递归(层级遍历)
|
|
|
+ if (obj[key] && typeof obj[key] == "object") {
|
|
|
+ objClone[key] = this.deepClone(obj[key]);
|
|
|
+ } else {
|
|
|
+ //如果不是,直接赋值
|
|
|
+ objClone[key] = obj[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return objClone;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // 监听属性 类似于data概念
|
|
|
+ computed: {},
|
|
|
+ // 监控data中的数据变化
|
|
|
+ watch: {},
|
|
|
+ beforeCreate() {}, // 生命周期 - 创建之前
|
|
|
+ beforeMount() {}, // 生命周期 - 挂载之前
|
|
|
+ beforeUpdate() {}, // 生命周期 - 更新之前
|
|
|
+ updated() {}, // 生命周期 - 更新之后
|
|
|
+ beforeDestroy() {}, // 生命周期 - 销毁之前
|
|
|
+ destroyed() {}, // 生命周期 - 销毁完成
|
|
|
+ activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.modal_product_info {
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ border-radius: 10px;
|
|
|
+ padding: 10px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ .modal_product_info_title {
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: 700;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ .modal_product_info_content {
|
|
|
+ .part_detail_form {
|
|
|
+ /deep/.ivu-form {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-start;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ }
|
|
|
+ /deep/ .ivu-form-item {
|
|
|
+ display: inline-block;
|
|
|
+ min-width: 150px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .modal_product {
|
|
|
+ /deep/.ivu-form {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-start;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ }
|
|
|
+ /deep/ .ivu-form-item {
|
|
|
+ display: inline-block;
|
|
|
+ min-width: 200px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .modal_parts {
|
|
|
+ /deep/.ivu-form {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-start;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ }
|
|
|
+ /deep/ .ivu-form-item {
|
|
|
+ display: inline-block;
|
|
|
+ min-width: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .modal_extra {
|
|
|
+ /deep/.ivu-form {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-start;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ }
|
|
|
+ /deep/ .ivu-form-item {
|
|
|
+ display: inline-block;
|
|
|
+ min-width: 100px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|