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.
1859 lines
62 KiB
1859 lines
62 KiB
<!--未知总成管理页-->
|
|
<template>
|
|
<div class="cr-body-content">
|
|
<div ref="box">
|
|
<flexbox class="content-header">
|
|
<el-form
|
|
:model="listQuery"
|
|
ref="queryForm"
|
|
v-show="showSearch"
|
|
:inline="true"
|
|
>
|
|
<el-form-item label="KNR:" prop="KNRBegin">
|
|
<el-input
|
|
v-model="listQuery.KNRBegin"
|
|
placeholder=""
|
|
clearable
|
|
size="small"
|
|
style="width: 240px"
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="-" prop="KNREnd">
|
|
<el-input
|
|
v-model="listQuery.KNREnd"
|
|
placeholder=""
|
|
clearable
|
|
size="small"
|
|
style="width: 240px"
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="底盘号:" prop="VINBegin">
|
|
<el-input
|
|
v-model="listQuery.VINBegin"
|
|
placeholder=""
|
|
clearable
|
|
size="small"
|
|
style="width: 240px"
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="-" prop="VINEnd">
|
|
<el-input
|
|
v-model="listQuery.VINEnd"
|
|
placeholder=""
|
|
clearable
|
|
size="small"
|
|
style="width: 240px"
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="车型代码" prop="VehicleModelCode">
|
|
<el-select
|
|
v-model="listQuery.vehicleModelCode"
|
|
clearable
|
|
placeholder="请选择"
|
|
size="medium"
|
|
style="margin-right: 15px"
|
|
@change="valueselectChange"
|
|
>
|
|
<el-option
|
|
v-for="item in vehicleModelList"
|
|
:key="item.id"
|
|
:label="item.dicItemName"
|
|
:value="item.dicItemCode"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="版本" prop="Version">
|
|
<el-input
|
|
v-model="listQuery.Version"
|
|
placeholder="请输入版本"
|
|
clearable
|
|
size="small"
|
|
style="width: 240px"
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="上线日期">
|
|
<el-date-picker
|
|
v-model="OnlineTimeValue"
|
|
size="small"
|
|
style="width: 380px"
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
type="datetimerange"
|
|
:default-time="['00:00:00', '23:59:59']"
|
|
range-separator="-"
|
|
start-placeholder="开始日期"
|
|
end-placeholder="结束日期"
|
|
></el-date-picker>
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
<el-button
|
|
class="filter-item"
|
|
size="mini"
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
:loading="buttonLoading"
|
|
@click="handleUpdate()"
|
|
>重新解析(批量操作)
|
|
</el-button>
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
<el-button
|
|
class="addAssy"
|
|
size="mini"
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
@click="handleCreate"
|
|
>添加总成
|
|
</el-button>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="扫描点" prop="ScanPoint">
|
|
<el-select
|
|
v-model="listQuery.ScanPoint"
|
|
placeholder="请选择"
|
|
style="width: 200px"
|
|
clearable
|
|
>
|
|
<el-option
|
|
v-for="item in ScanPointList"
|
|
:key="item.id"
|
|
:label="item.label"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-search"
|
|
size="mini"
|
|
@click="handleFilter"
|
|
>搜索</el-button
|
|
>
|
|
<el-button
|
|
icon="el-icon-refresh"
|
|
size="mini"
|
|
@click="resetQuery('queryForm')"
|
|
>重置</el-button
|
|
>
|
|
<el-button
|
|
type="warning"
|
|
plain
|
|
icon="el-icon-download"
|
|
size="mini"
|
|
style="margin-left: 15px"
|
|
@click="handleDownload()"
|
|
>导出(Excel)
|
|
</el-button>
|
|
|
|
<el-button
|
|
type="warning"
|
|
plain
|
|
icon="el-icon-download"
|
|
size="mini"
|
|
style="margin-left: 15px"
|
|
@click="handleDownloadNotRepeat()"
|
|
>导出(不重复)
|
|
</el-button>
|
|
|
|
<el-button
|
|
class="filter-item"
|
|
plain
|
|
size="mini"
|
|
type="success"
|
|
icon="el-icon-check"
|
|
:loading="button2Loading"
|
|
@click="handleUpdateAll()"
|
|
>重新解析(执行全部)
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</flexbox>
|
|
</div>
|
|
<div class="l-table">
|
|
<!--表格渲染-->
|
|
<el-table
|
|
ref="multipleTable"
|
|
v-loading="listLoading"
|
|
element-loading-text="拼命加载中..."
|
|
element-loading-spinner="el-icon-loading"
|
|
class="cr-table"
|
|
:data="list"
|
|
:height="tableHeight"
|
|
:cell-style="cellStyle"
|
|
:header-cell-style="headerRowStyle"
|
|
size="small"
|
|
stripe
|
|
highlight-current-row
|
|
style="width: 100%; margin-top: -25px"
|
|
@sort-change="sortChange"
|
|
@selection-change="handleSelectionChange"
|
|
@row-click="handleRowClick"
|
|
>
|
|
<el-table-column type="selection" width="44px"></el-table-column>
|
|
<el-table-column
|
|
label="大众顺序号"
|
|
prop="hostSN"
|
|
sortable
|
|
align="center"
|
|
width="110px"
|
|
>
|
|
<template slot-scope="scope">
|
|
<span class="link-type" @click="handleDrawerOpen(scope.row)">{{
|
|
scope.row.hostSN
|
|
}}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
v-for="(item, index) in getDefaultField"
|
|
:key="index"
|
|
:prop="item.prop"
|
|
:label="item.label"
|
|
:min-width="item.width"
|
|
:formatter="fieldFormatter"
|
|
sortable
|
|
show-overflow-tooltip
|
|
:gutter="0"
|
|
>
|
|
<template slot="header" slot-scope="scope">
|
|
{{ scope.column.label }}
|
|
</template>
|
|
</el-table-column>
|
|
<!-- <el-table-column label="操作" align="center" width="128px">
|
|
<template slot-scope="{ row }">
|
|
<el-button
|
|
type="primary"
|
|
size="mini"
|
|
@click="handleUpdate(row)"
|
|
icon="el-icon-edit"
|
|
/>
|
|
</template>
|
|
</el-table-column> -->
|
|
</el-table>
|
|
</div>
|
|
|
|
<div class="table-footer">
|
|
<!-- 分页控件 style="margin-top: -25px;margin-bottom:-25px;float:right;"-->
|
|
<pagination
|
|
v-show="totalCount > 0"
|
|
:total="totalCount"
|
|
:page.sync="page"
|
|
:limit.sync="listQuery.MaxResultCount"
|
|
@pagination="getList"
|
|
/>
|
|
<!-- 抽屉控件 -->
|
|
<el-drawer
|
|
title="信息详细页"
|
|
size="75%"
|
|
direction="rtl"
|
|
:visible.sync="drawer"
|
|
:before-close="handleDrawerClose"
|
|
>
|
|
<div>
|
|
<Detail
|
|
v-bind:customerInfos="customerInfos"
|
|
style="margin-top: -35px"
|
|
></Detail>
|
|
</div>
|
|
</el-drawer>
|
|
</div>
|
|
|
|
<!--添加总成-->
|
|
<el-dialog
|
|
:visible.sync="dialogFormVisible"
|
|
:close-on-click-modal="false"
|
|
:title="formTitle"
|
|
append-to-body
|
|
width="1000px"
|
|
>
|
|
<div style="width: 980px; height: 600px">
|
|
<el-row>
|
|
<el-col :span="8">
|
|
<div style="border: 1px; width: 280px">
|
|
<el-row>
|
|
<div class="app">
|
|
<!-- handleCurrentChange -->
|
|
<el-table
|
|
border
|
|
style="margin: 0px; width: 280px"
|
|
height="260px"
|
|
ref="asTable"
|
|
:data="erpAssemblyCfgList"
|
|
highlight-current-row
|
|
@row-click="rowClickass"
|
|
@select="selectAss"
|
|
>
|
|
<el-table-column
|
|
type="selection"
|
|
width="40px"
|
|
></el-table-column>
|
|
<el-table-column
|
|
prop="erpAssemblyCode"
|
|
label="总成编号"
|
|
align="center"
|
|
width="178px"
|
|
></el-table-column>
|
|
<!-- 添加删除按钮 -->
|
|
<el-table-column align="center" width="61px">
|
|
<!-- type="button" :render-header="renderHeader" -->
|
|
<!-- <template slot="header" slot-scope="scope">
|
|
<el-button @click="addzc(scope.$index,scope.row)" icon="el-icon-plus">
|
|
</el-button>
|
|
</template> -->
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
@click="delzc(scope.$index, scope.row)"
|
|
icon="el-icon-minus"
|
|
size="mini"
|
|
align="left"
|
|
>
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
</el-row>
|
|
<el-row>
|
|
<div style="width: 280px; border: 1px">
|
|
<el-divider content-position="center">添加Erp总成</el-divider>
|
|
<el-form
|
|
style="border: 1px"
|
|
:label-position="labelPosition"
|
|
label-width="100px"
|
|
:model="assly"
|
|
ref="assly"
|
|
border
|
|
>
|
|
<el-form-item
|
|
label="Erp总成编码"
|
|
style="height: 40px; width: 280px"
|
|
>
|
|
<el-input
|
|
v-model="assly.erpAssemblyCode"
|
|
clearable
|
|
placeholder="请输入Erp总成编码"
|
|
></el-input>
|
|
</el-form-item>
|
|
<el-form-item
|
|
label="Erp总成名称"
|
|
style="height: 40px; width: 280px"
|
|
>
|
|
<el-input
|
|
v-model="assly.erpAssemblyName"
|
|
clearable
|
|
placeholder="请输入Erp总成名称"
|
|
></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="车型" style="height: 40px">
|
|
<!-- <el-input v-model="assly.carModel" clearable></el-input> -->
|
|
<el-select
|
|
v-model="assly.carModel"
|
|
clearable
|
|
placeholder="请选择车型"
|
|
>
|
|
<el-option
|
|
v-for="item in vehicleModelList"
|
|
:key="item.id"
|
|
:label="item.dicItemName"
|
|
:value="item.dicItemCode"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" @click="submitAssyForm('assly')"
|
|
>添加</el-button
|
|
>
|
|
</el-form-item>
|
|
</el-form>
|
|
</div>
|
|
</el-row>
|
|
</div>
|
|
</el-col>
|
|
<el-col :span="7">
|
|
<div style="border: 1px; height: 570px; width: 270px">
|
|
<el-table
|
|
:data="tempdetails"
|
|
ref="leftTable"
|
|
height="550"
|
|
stripe
|
|
border
|
|
highlight-current-row
|
|
@row-click="rowClickLeft"
|
|
@select="selectLeft"
|
|
@select-all="selectLeftAll"
|
|
>
|
|
<el-table-column
|
|
type="selection"
|
|
width="40px"
|
|
></el-table-column>
|
|
<el-table-column
|
|
prop="partCode"
|
|
label="结算件代码"
|
|
width="150px"
|
|
align="center"
|
|
></el-table-column>
|
|
<el-table-column
|
|
prop="partNum"
|
|
label="数量"
|
|
width="78px"
|
|
align="center"
|
|
></el-table-column>
|
|
</el-table>
|
|
</div>
|
|
</el-col>
|
|
<el-col :span="2">
|
|
<!-- 左右穿梭按钮 -->
|
|
<div align="center" style="height: 570px; width: 70px">
|
|
<el-row style="line-height: 300px">
|
|
<el-button
|
|
@click="btnleftclick()"
|
|
icon="el-icon-caret-left"
|
|
></el-button>
|
|
</el-row>
|
|
<el-row>
|
|
<el-button
|
|
@click="btnrightclick()"
|
|
icon="el-icon-caret-right"
|
|
></el-button>
|
|
</el-row>
|
|
</div>
|
|
</el-col>
|
|
<el-col :span="7">
|
|
<div style="border: 1px; height: 570px; width: 270px">
|
|
<el-table
|
|
:data="data2"
|
|
ref="rightTable"
|
|
height="550"
|
|
stripe
|
|
border
|
|
highlight-current-row
|
|
@row-click="rowClickRight"
|
|
@select="selectRight"
|
|
@select-all="selectRightAll"
|
|
>
|
|
<el-table-column
|
|
type="selection"
|
|
width="40px"
|
|
></el-table-column>
|
|
<el-table-column
|
|
prop="partCode"
|
|
label="结算件代码"
|
|
width="150px"
|
|
align="center"
|
|
></el-table-column>
|
|
<el-table-column
|
|
prop="partNum"
|
|
label="数量"
|
|
width="78px"
|
|
align="center"
|
|
></el-table-column>
|
|
</el-table>
|
|
</div>
|
|
</el-col>
|
|
<!-- <el-table-transfer
|
|
leftTitle="结算件"
|
|
rightTitle="未知总成"
|
|
:columns='columns'
|
|
:dataLeft="data1"
|
|
:dataRight="data2"
|
|
>
|
|
<template v-slot:default="{scope}">
|
|
<div>
|
|
{{scope.row[scope.col.value]}}
|
|
</div>
|
|
</template>
|
|
</el-table-transfer> -->
|
|
<!-- 可以使用插槽获取到列信息和行信息,从而进行数据的处理 -->
|
|
<!-- <el-col :span="17"></el-col> -->
|
|
</el-row>
|
|
|
|
<div
|
|
slot="footer"
|
|
class="dialog-footer"
|
|
align="right"
|
|
style="width: 950px"
|
|
>
|
|
<el-button :loading="formLoading" type="primary" @click="save"
|
|
>确认</el-button
|
|
>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
<!-- 移动数量窗体 -->
|
|
<el-dialog
|
|
:visible.sync="dialogNumVisible"
|
|
:close-on-click-modal="false"
|
|
:title="numTitle"
|
|
append-to-body
|
|
width="570px"
|
|
>
|
|
<div>
|
|
<el-form
|
|
:model="numFormData"
|
|
ref="numFormData"
|
|
label-width="100px"
|
|
class="num-ruleForm"
|
|
>
|
|
<el-form-item
|
|
label="数量"
|
|
prop="num"
|
|
:rules="[{ required: true, message: '数量不能为空且至少为1' }]"
|
|
>
|
|
<el-input type="text" v-model="numFormData.num"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
</div>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button :loading="formLoading" type="primary" @click="saveNum()"
|
|
>确认</el-button
|
|
>
|
|
<el-button type="text" @click="dialogNumVisible = false"
|
|
>取消</el-button
|
|
>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import Pagination from "@/components/Pagination";
|
|
import permission from "@/directive/permission/index.js";
|
|
import CRMTableHead from "../../components/CRMTableHead";
|
|
import importExcel from "@/components/ImportExcel-vw";
|
|
import moment from "moment";
|
|
import Detail from "./detail.vue";
|
|
import { downloadFile } from "@/utils/crmindex.js";
|
|
|
|
//组件计量单位
|
|
const bomUnit = [
|
|
{ key: 0, display_name: "PC" },
|
|
{ key: 1, display_name: "TON" },
|
|
{ key: 2, display_name: "Other" },
|
|
];
|
|
const projectTypeKeyValue = bomUnit.reduce((acc, cur) => {
|
|
acc[cur.key] = cur.display_name;
|
|
return acc;
|
|
}, {});
|
|
|
|
export default {
|
|
name: "UnknownAssembly",
|
|
components: { Pagination, CRMTableHead, importExcel, Detail },
|
|
directives: { permission },
|
|
filters: {
|
|
IsCustomerSignFilter(status) {
|
|
//翻译是否签字
|
|
const statusMap = {
|
|
true: "是",
|
|
false: "否",
|
|
};
|
|
return statusMap[status];
|
|
},
|
|
},
|
|
data() {
|
|
const validVersion = (rule, value, callback) => {
|
|
let numberReg = /^\d{6}$/;
|
|
if (!numberReg.test(value)) {
|
|
callback(new Error("只能为6位数字!"));
|
|
} else {
|
|
callback();
|
|
}
|
|
};
|
|
return {
|
|
crmType: "bomdatabase",
|
|
rules: {
|
|
erpAssemblyName: [
|
|
{ required: true, message: "必须输入!", trigger: "blur" },
|
|
],
|
|
},
|
|
valueSelect: "",
|
|
OnlineTimeValue: [], //上线时间
|
|
customerInfos: [],
|
|
dialogOptions: [],
|
|
versionValue: "",
|
|
asTemp: [], //总成编号点击缓存
|
|
rightRowTemp: [], //右侧移动点击缓存
|
|
leftRowTemp: [], //左侧移动点击缓存
|
|
selectioned: "", //单选中的值
|
|
carModels: [], //车型下拉框数据源
|
|
currentRow: "",
|
|
versionList: [], //版本列表
|
|
searchContent: "", // 输入内容
|
|
showExcelImport: false,
|
|
form: {},
|
|
drawer: false,
|
|
list: null,
|
|
totalCount: 0,
|
|
listLoading: true,
|
|
customerInfo: {
|
|
bomId: "",
|
|
},
|
|
// 高级搜索
|
|
filterObj: {
|
|
type: Object,
|
|
default: () => {
|
|
return {};
|
|
},
|
|
},
|
|
listQuery: {
|
|
SkipCount: 0,
|
|
MaxResultCount: 15,
|
|
OnlineTimeBegin: undefined,
|
|
OnlineTimeEnd: undefined,
|
|
KNR: undefined,
|
|
VIN: undefined,
|
|
ScanPoint: undefined,
|
|
BillDescription: undefined,
|
|
},
|
|
listUnknownAssemblyQuery: {
|
|
billId: "",
|
|
//apply:"",
|
|
vin: "",
|
|
},
|
|
page: 1,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
bomUnit,
|
|
multipleSelection: [],
|
|
drawer: false,
|
|
dialogFormVisible: false,
|
|
dialogNumVisible: false,
|
|
formTitle: "",
|
|
numTitle: "",
|
|
isEdit: false,
|
|
formLoading: false,
|
|
buttonLoading: false,
|
|
button2Loading: false,
|
|
//dialogFormVisible: false,
|
|
tableHeight: document.documentElement.clientHeight - 220,
|
|
//columns: [
|
|
// {name: '结算件代码', value: 'partCode', width: '180px'},
|
|
// {name: '数量', value: 'partNum',},
|
|
// ],
|
|
// data1: [
|
|
// ],
|
|
|
|
numFormData: {
|
|
num: 1,
|
|
},
|
|
zcCode: [],
|
|
/*最终提交缓存*/
|
|
tempAssCfgList: [],
|
|
/*右侧数据源*/
|
|
data2: [],
|
|
/*中间数据源*/
|
|
tempdetails: [
|
|
//{
|
|
// partCode: "1",
|
|
// partNum: 0,
|
|
// isKey: true
|
|
//}
|
|
],
|
|
/*左侧总成数据源*/
|
|
erpAssemblyCfgList: [],
|
|
// {
|
|
// erpAssemblyCode: "string",
|
|
// erpAssemblyName: "string",
|
|
// isCover: true,
|
|
// carModel: "",
|
|
// previousVersionId: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
|
// details: [
|
|
// {
|
|
// partCode: "string",
|
|
// partNum: 0,
|
|
// description: "string",
|
|
// isKey: true
|
|
// }
|
|
// ]
|
|
// }
|
|
labelPosition: "left",
|
|
assly: {
|
|
erpAssemblyCode: "",
|
|
erpAssemblyName: "",
|
|
carModel: "",
|
|
},
|
|
vehicleModelQuery: {
|
|
dicTypeName: "派格车型",
|
|
},
|
|
vehicleModelList: [], //车型list
|
|
ScanPointList: [
|
|
{ id: "0", label: " " },
|
|
{ id: "R100", label: "R100" },
|
|
{ id: "M100", label: "M100" },
|
|
],
|
|
};
|
|
},
|
|
mounted() {
|
|
this.$nextTick(() => {
|
|
var offsetHei = document.documentElement.clientHeight;
|
|
//console.log(offsetHei);
|
|
let boxH = this.$refs.box.offsetHeight;
|
|
this.tableHeight = offsetHei - boxH - 57 - 79; //57为footer高度,79为页面上部标签高度
|
|
});
|
|
},
|
|
created() {
|
|
this.getvehicleModel();
|
|
this.getList();
|
|
},
|
|
computed: {
|
|
getDefaultField() {
|
|
var tempsTabs = [];
|
|
// tempsTabs.push({
|
|
// label: "大众顺序号",
|
|
// prop: "hostSN",
|
|
// width: 150,
|
|
// });
|
|
tempsTabs.push({
|
|
label: "底盘号",
|
|
prop: "vin",
|
|
width: 180,
|
|
});
|
|
tempsTabs.push({
|
|
label: "KNR",
|
|
prop: "knr",
|
|
width: 120,
|
|
});
|
|
tempsTabs.push({
|
|
label: "上线时间",
|
|
prop: "onlineTime",
|
|
width: 150,
|
|
});
|
|
tempsTabs.push({
|
|
label: "扫描点",
|
|
prop: "scanPoint",
|
|
width: 150,
|
|
});
|
|
tempsTabs.push({
|
|
label: "车型代码",
|
|
prop: "vehicleModelCode",
|
|
width: 120,
|
|
});
|
|
tempsTabs.push({
|
|
label: "车型名称",
|
|
prop: "",
|
|
width: 150,
|
|
});
|
|
tempsTabs.push({
|
|
label: "版本",
|
|
prop: "version",
|
|
width: 150,
|
|
});
|
|
tempsTabs.push({
|
|
label: "单据描述",
|
|
prop: "billDescription",
|
|
width: 150,
|
|
});
|
|
tempsTabs.push({
|
|
label: "备注",
|
|
prop: "description",
|
|
width: 120,
|
|
});
|
|
// tempsTabs.push({
|
|
// label: "版本",
|
|
// prop: "version",
|
|
// width: 150,
|
|
// });
|
|
tempsTabs.push({ label: "客户零件数量", prop: "partNum", width: 135 });
|
|
return tempsTabs;
|
|
},
|
|
},
|
|
methods: {
|
|
//抽屉
|
|
handleDrawerOpen(param) {
|
|
this.drawer = true;
|
|
var parentId = param.id; //主键id
|
|
this.customerInfos = [
|
|
{
|
|
ParentId: parentId,
|
|
},
|
|
];
|
|
},
|
|
handleDrawerClose(done) {
|
|
done();
|
|
},
|
|
handleUpdateAll() {
|
|
var params = {
|
|
isSelectAll: true,
|
|
unknownAssemblyIdList: [],
|
|
};
|
|
this.$confirm("是否要全部进行解析?", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
}).then(() => {
|
|
this.button2Loading = true;
|
|
this.$axios
|
|
.posts("/api/newjit/unknown-assembly/to-parse", params)
|
|
.then((response) => {
|
|
if (response.status == true) {
|
|
this.$notify({
|
|
title: "成功",
|
|
message: "操作成功!",
|
|
type: "success",
|
|
duration: 2000,
|
|
});
|
|
this.button2Loading = false;
|
|
this.getList();
|
|
} else {
|
|
this.button2Loading = false;
|
|
this.$message({
|
|
type: "warning",
|
|
message: response.message,
|
|
});
|
|
}
|
|
})
|
|
.catch(() => {
|
|
this.button2Loading = false;
|
|
this.$message({
|
|
type: "warning",
|
|
message: response.message,
|
|
});
|
|
});
|
|
});
|
|
},
|
|
/** 重新计算总成 */
|
|
handleUpdate(row) {
|
|
if (this.multipleSelection.length == 0) {
|
|
this.$message({
|
|
message: "至少选择一行",
|
|
type: "warning",
|
|
});
|
|
return;
|
|
} else {
|
|
this.buttonLoading = true;
|
|
//批量操作
|
|
var params = {
|
|
isSelectAll: false,
|
|
unknownAssemblyIdList: [],
|
|
};
|
|
if (row) {
|
|
//单行
|
|
params.unknownAssemblyIdList.push(row.id);
|
|
} else {
|
|
//多选
|
|
this.multipleSelection.forEach((element) => {
|
|
let id = element.id;
|
|
params.unknownAssemblyIdList.push(id);
|
|
});
|
|
}
|
|
console.log("未知总成详表条件:" + JSON.stringify(params));
|
|
this.$axios
|
|
.posts("/api/newjit/unknown-assembly/to-parse", params)
|
|
.then((response) => {
|
|
if (response.status == true) {
|
|
this.$notify({
|
|
title: "成功",
|
|
message: "操作成功!",
|
|
type: "success",
|
|
duration: 2000,
|
|
});
|
|
this.buttonLoading = false;
|
|
this.getList();
|
|
} else {
|
|
this.buttonLoading = false;
|
|
this.$message({
|
|
type: "warning",
|
|
message: response.message,
|
|
});
|
|
}
|
|
})
|
|
.catch(() => {
|
|
this.buttonLoading = false;
|
|
this.$message({
|
|
type: "warning",
|
|
message: response.message,
|
|
});
|
|
});
|
|
}
|
|
},
|
|
fetchData(id) {
|
|
//循环动态
|
|
this.$axios
|
|
.gets("/api/newjit/unknown-assembly/" + id)
|
|
.then((response) => {
|
|
this.form = response.item;
|
|
});
|
|
},
|
|
/** 导出功能 */
|
|
handleDownload() {
|
|
this.listLoading = true;
|
|
this.$axios
|
|
.posts("/api/newjit/unknown-assembly/export", this.listQuery)
|
|
.then((res) => {
|
|
let filename = res.item;
|
|
this.$axios
|
|
.BolbGets("/api/newjit/exclude-part-cfg/download/" + filename)
|
|
.then((response) => {
|
|
if (filename.indexOf("_") != -1) {
|
|
let downName =
|
|
filename.slice(0, filename.lastIndexOf("_")) +
|
|
filename.slice(filename.lastIndexOf("."));
|
|
downloadFile(response, downName);
|
|
this.$notify({
|
|
title: "成功",
|
|
message: "数据-导出成功!",
|
|
type: "success",
|
|
duration: 2000,
|
|
});
|
|
} else {
|
|
downloadFile(response, filename);
|
|
this.$notify({
|
|
title: "成功",
|
|
message: "数据-导出成功!",
|
|
type: "success",
|
|
duration: 2000,
|
|
});
|
|
}
|
|
this.listLoading = false;
|
|
});
|
|
});
|
|
},
|
|
/** 不重复导出功能 */
|
|
handleDownloadNotRepeat() {
|
|
this.listLoading = true;
|
|
this.$axios
|
|
.posts("/api/newjit/unknown-assembly/export-not-repeat", this.listQuery)
|
|
.then((res) => {
|
|
let filename = res.item;
|
|
this.$axios
|
|
.BolbGets("/api/newjit/exclude-part-cfg/download/" + filename)
|
|
.then((response) => {
|
|
if (filename.indexOf("_") != -1) {
|
|
let downName =
|
|
filename.slice(0, filename.lastIndexOf("_")) +
|
|
filename.slice(filename.lastIndexOf("."));
|
|
downloadFile(response, downName);
|
|
this.$notify({
|
|
title: "成功",
|
|
message: "数据-导出成功!",
|
|
type: "success",
|
|
duration: 2000,
|
|
});
|
|
} else {
|
|
downloadFile(response, filename);
|
|
this.$notify({
|
|
title: "成功",
|
|
message: "数据-导出成功!",
|
|
type: "success",
|
|
duration: 2000,
|
|
});
|
|
}
|
|
this.listLoading = false;
|
|
});
|
|
});
|
|
},
|
|
/** 重置按钮操作 */
|
|
resetQuery(refName) {
|
|
this.OnlineTimeValue = [];
|
|
this.$refs[refName].resetFields();
|
|
this.handleQuery();
|
|
|
|
},
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
this.listQuery.SkipCount = 1;
|
|
this.getList();
|
|
},
|
|
selectValue(params) {
|
|
//版本下拉选择
|
|
this.versionValue = params.value;
|
|
this.getList();
|
|
},
|
|
selectOptionsChange(item) {
|
|
this.getList();
|
|
},
|
|
importExcelData() {
|
|
//关闭导入窗体时调用
|
|
this.showExcelImport = false;
|
|
//this.getList();
|
|
},
|
|
/* 主页面添加总成按钮事件 */
|
|
handleCreate() {
|
|
// this.$nextTick(() => {
|
|
// this.$refs["formCount"].resetFields();
|
|
// });
|
|
if (this.multipleSelection.length !== 1) {
|
|
this.$message({
|
|
message: "必须选择一行",
|
|
type: "warning",
|
|
});
|
|
return;
|
|
} else {
|
|
console.log(this.multipleSelection[0].id);
|
|
console.log(this.multipleSelection[0].vin);
|
|
this.formTitle = "添加总成";
|
|
this.isEdit = false;
|
|
this.form = {};
|
|
this.leftRowTemp = [];
|
|
this.rightRowTemp = [];
|
|
this.assly = {};
|
|
this.tempdetails = [];
|
|
this.erpAssemblyCfgList = [];
|
|
this.tempAssCfgList = [];
|
|
this.asTemp = [];
|
|
this.getUnknownAssemblyList();
|
|
this.getZcCode();
|
|
this.getvehicleModel();
|
|
this.dialogFormVisible = true;
|
|
}
|
|
},
|
|
/** 刷新列表 */
|
|
handleHandle(data) {
|
|
if (data.type !== "edit") {
|
|
this.getList();
|
|
}
|
|
},
|
|
/** 格式化字段 */
|
|
fieldFormatter(row, column) {
|
|
if (column.property === "billStatus") {
|
|
return { 0: "未生效", 2: "已生效", 3: "已发布" }[row[column.property]];
|
|
}
|
|
if (column.property == "onlineTime" || column.property == "receiveTime") {
|
|
var date = row[column.property];
|
|
if (date == undefined) {
|
|
return "";
|
|
}
|
|
return moment(date).format("YYYY-MM-DD HH:mm:ss");
|
|
}
|
|
return row[column.property] || "--";
|
|
},
|
|
roleFilter(type) {
|
|
return projectTypeKeyValue[type];
|
|
},
|
|
getList(data) {
|
|
this.listLoading = true;
|
|
if (data != undefined) {
|
|
this.listQuery.SkipCount = (this.page - 1) * data.limit;
|
|
} else {
|
|
this.listQuery.SkipCount = (this.page - 1) * 15;
|
|
}
|
|
if (this.OnlineTimeValue != []) {
|
|
this.listQuery.OnlineTimeBegin = this.OnlineTimeValue[0]; //this.OnlineTimeValue
|
|
// ? this.OnlineTimeValue[0] || ""
|
|
// : "";
|
|
this.listQuery.OnlineTimeEnd = this.OnlineTimeValue[1]; //this.OnlineTimeValue
|
|
// ? this.OnlineTimeValue[1] || ""
|
|
// : "";
|
|
}
|
|
this.$axios
|
|
.gets("/api/newjit/unknown-assembly/list", this.listQuery)
|
|
.then((response) => {
|
|
this.list = response.items;
|
|
this.totalCount = response.totalCount;
|
|
console.log("未知总成" + JSON.stringify(this.listQuery));
|
|
setTimeout(() => {
|
|
//大数据量加载时
|
|
this.listLoading = false;
|
|
}, 500);
|
|
})
|
|
.catch(() => {
|
|
this.listLoading = false;
|
|
});
|
|
},
|
|
handleFilter() {
|
|
this.page = 1;
|
|
this.getList();
|
|
},
|
|
sortChange(data) {
|
|
const { prop, order } = data;
|
|
if (!prop || !order) {
|
|
this.handleFilter();
|
|
return;
|
|
}
|
|
this.listQuery.Sorting = prop + " " + order;
|
|
this.handleFilter();
|
|
},
|
|
handleSelectionChange(val) {
|
|
this.multipleSelection = val;
|
|
},
|
|
/** 通过回调控制style */
|
|
cellStyle({ row, column, rowIndex, columnIndex }) {
|
|
if (column.property === "qty") {
|
|
return { textAlign: "right" };
|
|
} else {
|
|
return { textAlign: "left" };
|
|
}
|
|
},
|
|
/** 通过回调控制表头style */
|
|
headerRowStyle({ row, column, rowIndex, columnIndex }) {
|
|
if (column.property === "qty") {
|
|
return { textAlign: "right", background: "#FAFAFA" };
|
|
} else {
|
|
return { textAlign: "left", background: "#FAFAFA" };
|
|
}
|
|
},
|
|
handleRowClick(row, column, event) {
|
|
//this.$refs.multipleTable.clearSelection();
|
|
this.$refs.multipleTable.toggleRowSelection(row);
|
|
},
|
|
/* 获取车型数据源 */
|
|
getCarModel() {
|
|
this.$axios
|
|
.gets("/api/newjit/dic/list" + "?dicTypeName=车型")
|
|
.then((response) => {
|
|
console.log("this is response.items", response.item);
|
|
this.carModels = response.item;
|
|
setTimeout(() => {
|
|
//大数据量加载时
|
|
this.listLoading = false;
|
|
}, 500);
|
|
})
|
|
.catch(() => {
|
|
this.listLoading = false;
|
|
});
|
|
//console.log("this is carModels",this.carModels);
|
|
},
|
|
/* 加号按钮添加事件 */
|
|
addzc() {
|
|
//todo 添加总成左侧的 加号按钮 待做
|
|
alert("1");
|
|
},
|
|
/* 减号按钮删除事件 */
|
|
delzc(index) {
|
|
this.erpAssemblyCfgList.splice(index, 1);
|
|
console.log(this.erpAssemblyCfgList);
|
|
},
|
|
/* 添加总成最终提交的数据事件*/
|
|
save() {
|
|
//if(this.data2.length ===0){
|
|
if (this.data2.length !== 0) {
|
|
this.$message({
|
|
message: "还有结算价代码尚未匹配",
|
|
type: "error",
|
|
});
|
|
return;
|
|
}
|
|
this.formLoading = true;
|
|
|
|
var lastSubmit = {
|
|
billId: this.listUnknownAssemblyQuery.billId,
|
|
scanPoint: "M100",
|
|
erpAssemblyCfgList: [],
|
|
};
|
|
lastSubmit.erpAssemblyCfgList = this.tempAssCfgList;
|
|
|
|
//#region
|
|
// var lastSubmitt = [];
|
|
// console.log("flag")
|
|
// this.tempAssCfgList.forEach(element => {
|
|
// element.details.forEach(element1 => {
|
|
// lastSubmitt.push({
|
|
// erpAssemblyCode: element.erpAssemblyCode,
|
|
// erpAssemblyName: element.erpAssemblyName,
|
|
// isCover: false,
|
|
// previousVersionId:"f7d45dba-3164-4a91-b477-3c568c81e6a0",
|
|
// vehicleModel: element.vehicleModel,
|
|
// details:{
|
|
// partCode:element1.partCode,
|
|
// partNum:element1.partNum,
|
|
// description:element1.description,
|
|
// isKey: true,
|
|
// }
|
|
// })
|
|
// });
|
|
// });
|
|
// console.log("this is lastSubmitt:",lastSubmitt)
|
|
// var lastSubmit = [];
|
|
// lastSubmitt.forEach(element => {
|
|
// lastSubmit.push({
|
|
// billID:this.listUnknownAssemblyQuery.billId,
|
|
// scanPoint: "M100",
|
|
// erpAssemblyCfgList:[{
|
|
// erpAssemblyCode: element.erpAssemblyCode,
|
|
// erpAssemblyName: element.erpAssemblyName,
|
|
// isCover: false,
|
|
// previousVersionId: null,
|
|
// vehicleModel: element.vehicleModel,
|
|
// details:element.details
|
|
// }]
|
|
// })
|
|
// });
|
|
// console.log("this is lastSubmit:",lastSubmit)
|
|
//#endregion
|
|
|
|
this.$axios
|
|
.posts("/api/newjit/unknown-assembly/add-assembly", lastSubmit)
|
|
.then((response) => {
|
|
if (response.status === true) {
|
|
this.dialogFormVisible = false;
|
|
this.leftRowTemp = [];
|
|
this.rightRowTemp = [];
|
|
this.tempAssCfgList = [];
|
|
this.tempdetails = [];
|
|
this.erpAssemblyCfgList = [];
|
|
this.asTemp = [];
|
|
|
|
this.$notify({
|
|
title: "成功",
|
|
message: "添加总成成功!",
|
|
type: "success",
|
|
duration: 2000,
|
|
});
|
|
}
|
|
})
|
|
.catch(() => {
|
|
//this.listLoading = false;
|
|
});
|
|
// }
|
|
// else{
|
|
// alert("未知零件未分配完,请确认!")
|
|
// }
|
|
},
|
|
/* 获取未知总成零件数据源 */
|
|
getUnknownAssemblyList() {
|
|
this.listUnknownAssemblyQuery.billId = this.multipleSelection[0].id;
|
|
//console.log(this.listUnknownAssemblyQuery);
|
|
this.$axios
|
|
.gets(
|
|
"/api/newjit/unknown-assembly/" + this.listUnknownAssemblyQuery.billId
|
|
)
|
|
.then((response) => {
|
|
this.data2 = response.item.unknownAssemblyParts.filter(
|
|
(u) => u.partType === "1" || u.partType === null
|
|
);
|
|
setTimeout(() => {
|
|
//大数据量加载时
|
|
this.listLoading = false;
|
|
}, 500);
|
|
})
|
|
.catch(() => {
|
|
this.listLoading = false;
|
|
});
|
|
},
|
|
/* 获取总成零件数据源*/
|
|
getZcCode() {
|
|
this.zcCode = [];
|
|
this.listUnknownAssemblyQuery.vin = this.multipleSelection[0].vin;
|
|
//console.log(this.listUnknownAssemblyQuery.vin);
|
|
this.$axios
|
|
.gets(
|
|
"/api/newjit/unknown-assembly/get-erp-assembly-code" +
|
|
"?vin=" +
|
|
this.listUnknownAssemblyQuery.vin
|
|
)
|
|
.then((response) => {
|
|
console.log(response.item);
|
|
if (response.item.length !== 0) {
|
|
console.log("has no ASSCode");
|
|
} else {
|
|
response.item.forEach((zccode) => {
|
|
this.erpAssemblyCfgList.push({
|
|
erpAssemblyCode: zccode,
|
|
erpAssemblyName: [],
|
|
isCover: false,
|
|
carModel: "",
|
|
previousVersionId: null,
|
|
details: [
|
|
{
|
|
partCode: "",
|
|
partNum: 0,
|
|
description: "",
|
|
isKey: false,
|
|
},
|
|
],
|
|
});
|
|
});
|
|
}
|
|
setTimeout(() => {
|
|
//大数据量加载时
|
|
this.listLoading = false;
|
|
}, 500);
|
|
});
|
|
},
|
|
/* 添加总成提交方法 */
|
|
submitAssyForm(formName) {
|
|
this.$refs[formName].validate((valid) => {
|
|
if (valid) {
|
|
if (this.assly.erpAssemblyCode !== "") {
|
|
this.erpAssemblyCfgList.push({
|
|
erpAssemblyCode: this.assly.erpAssemblyCode,
|
|
erpAssemblyName: this.assly.erpAssemblyName,
|
|
carModel: this.assly.carModel,
|
|
isCover: false,
|
|
previousVersionId: null,
|
|
details: [],
|
|
});
|
|
console.log(this.erpAssemblyCfgList);
|
|
this.assly.erpAssemblyCode = "";
|
|
this.assly.erpAssemblyName = "";
|
|
this.assly.carModel = "";
|
|
} else {
|
|
alert("请先填写Erp总成信息!");
|
|
}
|
|
} else {
|
|
console.log("error submit!!");
|
|
return false;
|
|
}
|
|
});
|
|
},
|
|
btnleftclick() {
|
|
if (this.asTemp.length === 0) {
|
|
alert("请先选择总成编号!");
|
|
} else {
|
|
if (this.rightRowTemp.length === 0) {
|
|
alert("请先选择需移动的零件");
|
|
} else if (
|
|
this.rightRowTemp.length === 1 &&
|
|
parseInt(this.rightRowTemp[0].partNum) !== 1
|
|
) {
|
|
this.numFormData.num = parseInt(this.rightRowTemp[0].partNum);
|
|
this.dialogNumVisible = true;
|
|
this.numTitle = "输入移动结算件数量";
|
|
} else {
|
|
console.log("R->F");
|
|
this.rightRowTemp.forEach((item) => {
|
|
this.numFormData.num = item.partNum;
|
|
//if(this.numFormData.num <= item.partNum && this.numFormData.num > 0){
|
|
|
|
//数据插入最终缓存
|
|
if (this.tempAssCfgList.length !== 0) {
|
|
console.log("second");
|
|
var rfMove = this.tempAssCfgList.filter(
|
|
(u) => u.erpAssemblyCode === this.asTemp[0].erpAssemblyCode
|
|
);
|
|
if (rfMove.length !== 0) {
|
|
var sameDetail = rfMove[0].details.filter(
|
|
(u) => u.partCode === item.partCode
|
|
);
|
|
if (sameDetail.length !== 0) {
|
|
sameDetail[0].partNum =
|
|
parseInt(sameDetail[0].partNum) +
|
|
parseInt(this.numFormData.num);
|
|
} else {
|
|
rfMove[0].details.push({
|
|
description: item.description,
|
|
isKey: false,
|
|
partCode: item.partCode,
|
|
partNum: this.numFormData.num, //移动框输入的数量
|
|
});
|
|
}
|
|
} else {
|
|
console.log("加进去了");
|
|
this.tempAssCfgList.push({
|
|
erpAssemblyCode: this.asTemp[0].erpAssemblyCode,
|
|
erpAssemblyName: this.asTemp[0].erpAssemblyName,
|
|
isCover: false,
|
|
previousVersionId: this.asTemp[0].previousVersionId,
|
|
vehicleModel: this.asTemp[0].carModel,
|
|
details: [
|
|
{
|
|
description: item.description,
|
|
isKey: false,
|
|
partCode: item.partCode,
|
|
partNum: this.numFormData.num, //移动框输入的数量
|
|
},
|
|
],
|
|
});
|
|
}
|
|
} else {
|
|
console.log("first");
|
|
this.tempAssCfgList.push({
|
|
erpAssemblyCode: this.asTemp[0].erpAssemblyCode,
|
|
erpAssemblyName: this.asTemp[0].erpAssemblyName,
|
|
isCover: false,
|
|
previousVersionId: this.asTemp[0].previousVersionId,
|
|
details: [
|
|
{
|
|
description: item.description,
|
|
isKey: false,
|
|
partCode: item.partCode,
|
|
partNum: this.numFormData.num, //移动框输入的数量
|
|
},
|
|
],
|
|
});
|
|
}
|
|
|
|
console.log("this is tempAssCfgList 最终数据", this.tempAssCfgList);
|
|
//数据插入中间数据源
|
|
var judge = this.tempdetails.filter(
|
|
(u) => u.partCode === item.partCode
|
|
);
|
|
if (judge.length === 1) {
|
|
var t =
|
|
parseInt(judge[0].partNum) + parseInt(this.numFormData.num);
|
|
this.tempdetails.filter(
|
|
(u) => u.partCode === item.partCode
|
|
)[0].partNum = t;
|
|
} else {
|
|
this.tempdetails.push({
|
|
description: item.description,
|
|
isKey: false,
|
|
partCode: item.partCode,
|
|
partNum: parseInt(this.numFormData.num), //移动框输入的数量
|
|
});
|
|
}
|
|
/* 右侧数据移动 */
|
|
var delid = this.data2.filter(
|
|
(u) => u.partCode === item.partCode
|
|
)[0];
|
|
var n1 = parseInt(this.numFormData.num);
|
|
var n2 = parseInt(delid.partNum);
|
|
if (n1 === n2) {
|
|
this.data2 = this.data2.filter(
|
|
(u) => u.partCode !== item.partCode
|
|
);
|
|
this.rightRowTemp = [];
|
|
} else {
|
|
this.data2.filter(
|
|
(u) => u.partCode === item.partCode
|
|
)[0].partNum = delid.partNum - this.numFormData.num;
|
|
item.partNum = n2 - n1;
|
|
}
|
|
});
|
|
|
|
//}
|
|
}
|
|
}
|
|
},
|
|
btnrightclick() {
|
|
if (this.asTemp.length === 0) {
|
|
alert("请先选择总成编号!");
|
|
} else {
|
|
if (this.leftRowTemp.length === 0) {
|
|
alert("请先选择需移动的零件");
|
|
} else if (
|
|
this.leftRowTemp.length === 1 &&
|
|
parseInt(this.leftRowTemp[0].partNum) !== 1
|
|
) {
|
|
this.numFormData.num = parseInt(this.leftRowTempnpm[0].partNum);
|
|
this.dialogNumVisible = true;
|
|
this.numTitle = "输入移动结算件数量";
|
|
} else {
|
|
console.log("F->R");
|
|
this.leftRowTemp.forEach((item) => {
|
|
this.numFormData.num = item.partNum;
|
|
//if(this.numFormData.num <= this.leftRowTemp[0].partNum && this.numFormData.num > 0){
|
|
|
|
//数据插入最终缓存
|
|
console.log("移除或删除");
|
|
var frMove = this.tempAssCfgList.filter(
|
|
(u) => u.erpAssemblyCode === this.asTemp[0].erpAssemblyCode
|
|
);
|
|
var samedetail = frMove[0].details.filter(
|
|
(u) => u.partCode === item.partCode
|
|
);
|
|
if (samedetail.length !== 0) {
|
|
if (
|
|
parseInt(samedetail[0].partNum) ===
|
|
parseInt(this.numFormData.num)
|
|
) {
|
|
frMove[0].details = frMove[0].details.filter(
|
|
(u) => u.partCode !== item.partCode
|
|
);
|
|
} else {
|
|
samedetail[0].partNum =
|
|
parseInt(samedetail[0].partNum) -
|
|
parseInt(this.numFormData.num);
|
|
}
|
|
} else if (samedetail.length !== 0) {
|
|
alert("没有数据!");
|
|
}
|
|
|
|
console.log("this is tempAssCfgList 最终数据", this.tempAssCfgList);
|
|
|
|
//数据插入右侧数据源
|
|
var judge = this.data2.filter((u) => u.partCode === item.partCode);
|
|
if (judge.length === 1) {
|
|
var t =
|
|
parseInt(judge[0].partNum) + parseInt(this.numFormData.num);
|
|
this.data2.filter(
|
|
(u) => u.partCode === item.partCode
|
|
)[0].partNum = t;
|
|
} else {
|
|
this.data2.push({
|
|
description: item.description,
|
|
isKey: false,
|
|
partCode: item.partCode,
|
|
partNum: parseInt(this.numFormData.num), //移动框输入的数量
|
|
});
|
|
}
|
|
/* 中间数据移动 */
|
|
var delid = this.tempdetails.filter(
|
|
(u) => u.partCode === item.partCode
|
|
)[0];
|
|
console.log(this.tempdetails);
|
|
var n1 = parseInt(this.numFormData.num);
|
|
var n2 = parseInt(delid.partNum);
|
|
if (n1 === n2) {
|
|
this.tempdetails = this.tempdetails.filter(
|
|
(u) => u.partCode !== item.partCode
|
|
);
|
|
this.leftRowTemp = [];
|
|
} else {
|
|
this.tempdetails.filter(
|
|
(u) => u.partCode === item.partCode
|
|
)[0].partNum =
|
|
parseInt(delid.partNum) - parseInt(this.numFormData.num);
|
|
item.partNum = n2 - n1;
|
|
}
|
|
//}
|
|
});
|
|
}
|
|
}
|
|
},
|
|
/* 保存数量事件 */
|
|
saveNum() {
|
|
if (this.asTemp.length !== 0) {
|
|
//判断中间选中移动还是右侧选中移动
|
|
/* 左侧移动到右侧 */
|
|
if (this.leftRowTemp.length !== 0) {
|
|
console.log("F->R");
|
|
if (
|
|
this.numFormData.num <= this.leftRowTemp[0].partNum &&
|
|
this.numFormData.num > 0
|
|
) {
|
|
//数据插入最终缓存
|
|
console.log("移除或删除");
|
|
var frMove = this.tempAssCfgList.filter(
|
|
(u) => u.erpAssemblyCode === this.asTemp[0].erpAssemblyCode
|
|
);
|
|
var samedetail = frMove[0].details.filter(
|
|
(u) => u.partCode === this.leftRowTemp[0].partCode
|
|
);
|
|
if (samedetail.length !== 0) {
|
|
if (
|
|
parseInt(samedetail[0].partNum) ===
|
|
parseInt(this.numFormData.num)
|
|
) {
|
|
frMove[0].details = frMove[0].details.filter(
|
|
(u) => u.partCode !== this.leftRowTemp[0].partCode
|
|
);
|
|
} else {
|
|
samedetail[0].partNum =
|
|
parseInt(samedetail[0].partNum) -
|
|
parseInt(this.numFormData.num);
|
|
}
|
|
} else if (samedetail.length !== 0) {
|
|
alert("没有数据!");
|
|
}
|
|
|
|
console.log("this is tempAssCfgList 最终数据", this.tempAssCfgList);
|
|
|
|
//数据插入右侧数据源
|
|
var judge = this.data2.filter(
|
|
(u) => u.partCode === this.leftRowTemp[0].partCode
|
|
);
|
|
if (judge.length === 1) {
|
|
var t =
|
|
parseInt(judge[0].partNum) + parseInt(this.numFormData.num);
|
|
this.data2.filter(
|
|
(u) => u.partCode === this.leftRowTemp[0].partCode
|
|
)[0].partNum = t;
|
|
} else {
|
|
this.data2.push({
|
|
description: this.leftRowTemp[0].description,
|
|
isKey: false,
|
|
partCode: this.leftRowTemp[0].partCode,
|
|
partNum: parseInt(this.numFormData.num), //移动框输入的数量
|
|
});
|
|
}
|
|
/* 中间数据移动 */
|
|
var delid = this.tempdetails.filter(
|
|
(u) => u.partCode === this.leftRowTemp[0].partCode
|
|
)[0];
|
|
var n1 = parseInt(this.numFormData.num);
|
|
var n2 = parseInt(delid.partNum);
|
|
if (n1 === n2) {
|
|
this.tempdetails = this.tempdetails.filter(
|
|
(u) => u.partCode !== this.leftRowTemp[0].partCode
|
|
);
|
|
this.leftRowTemp = [];
|
|
} else {
|
|
this.tempdetails.filter(
|
|
(u) => u.partCode === this.leftRowTemp[0].partCode
|
|
)[0].partNum =
|
|
parseInt(delid.partNum) - parseInt(this.numFormData.num);
|
|
this.leftRowTemp[0].partNum = n2 - n1;
|
|
}
|
|
} else if (this.numFormData.num == 0) {
|
|
alert("输入数字不能为0!");
|
|
} else {
|
|
alert("输入不正确,请确认!");
|
|
}
|
|
} else if (this.rightRowTemp.length !== 0) {
|
|
/* 右侧移动到左侧 */
|
|
console.log("R->F");
|
|
if (
|
|
this.numFormData.num <= this.rightRowTemp[0].partNum &&
|
|
this.numFormData.num > 0
|
|
) {
|
|
//数据插入最终缓存
|
|
if (this.tempAssCfgList.length !== 0) {
|
|
console.log("second");
|
|
var rfMove = this.tempAssCfgList.filter(
|
|
(u) => u.erpAssemblyCode === this.asTemp[0].erpAssemblyCode
|
|
);
|
|
if (rfMove.length !== 0) {
|
|
var sameDetail = rfMove[0].details.filter(
|
|
(u) => u.partCode === this.rightRowTemp[0].partCode
|
|
);
|
|
if (sameDetail.length !== 0) {
|
|
sameDetail[0].partNum =
|
|
parseInt(sameDetail[0].partNum) +
|
|
parseInt(this.numFormData.num);
|
|
} else {
|
|
rfMove[0].details.push({
|
|
description: this.rightRowTemp[0].description,
|
|
isKey: false,
|
|
partCode: this.rightRowTemp[0].partCode,
|
|
partNum: this.numFormData.num, //移动框输入的数量
|
|
});
|
|
}
|
|
} else {
|
|
console.log("加进去了");
|
|
this.tempAssCfgList.push({
|
|
erpAssemblyCode: this.asTemp[0].erpAssemblyCode,
|
|
erpAssemblyName: this.asTemp[0].erpAssemblyName,
|
|
vehicleModel: this.asTemp[0].carModel,
|
|
isCover: false,
|
|
previousVersionId: this.asTemp[0].previousVersionId,
|
|
details: [
|
|
{
|
|
description: this.rightRowTemp[0].description,
|
|
isKey: false,
|
|
partCode: this.rightRowTemp[0].partCode,
|
|
partNum: this.numFormData.num, //移动框输入的数量
|
|
},
|
|
],
|
|
});
|
|
}
|
|
} else {
|
|
console.log("first");
|
|
this.tempAssCfgList.push({
|
|
erpAssemblyCode: this.asTemp[0].erpAssemblyCode,
|
|
erpAssemblyName: this.asTemp[0].erpAssemblyName,
|
|
isCover: false,
|
|
previousVersionId: this.asTemp[0].previousVersionId,
|
|
vehicleModel: this.asTemp[0].carModel,
|
|
details: [
|
|
{
|
|
description: this.rightRowTemp[0].description,
|
|
isKey: false,
|
|
partCode: this.rightRowTemp[0].partCode,
|
|
partNum: this.numFormData.num, //移动框输入的数量
|
|
},
|
|
],
|
|
});
|
|
}
|
|
|
|
console.log("this is tempAssCfgList 最终数据", this.tempAssCfgList);
|
|
//数据插入中间数据源
|
|
var judge = this.tempdetails.filter(
|
|
(u) => u.partCode === this.rightRowTemp[0].partCode
|
|
);
|
|
if (judge.length === 1) {
|
|
var t =
|
|
parseInt(judge[0].partNum) + parseInt(this.numFormData.num);
|
|
this.tempdetails.filter(
|
|
(u) => u.partCode === this.rightRowTemp[0].partCode
|
|
)[0].partNum = t;
|
|
} else {
|
|
this.tempdetails.push({
|
|
description: this.rightRowTemp[0].description,
|
|
isKey: false,
|
|
partCode: this.rightRowTemp[0].partCode,
|
|
partNum: parseInt(this.numFormData.num), //移动框输入的数量
|
|
});
|
|
}
|
|
/* 右侧数据移动 */
|
|
var delid = this.data2.filter(
|
|
(u) => u.id === this.rightRowTemp[0].id
|
|
)[0];
|
|
var n1 = parseInt(this.numFormData.num);
|
|
var n2 = parseInt(delid.partNum);
|
|
if (n1 === n2) {
|
|
this.data2 = this.data2.filter(
|
|
(u) => u.id !== this.rightRowTemp[0].id
|
|
);
|
|
this.rightRowTemp = [];
|
|
} else {
|
|
this.data2.filter(
|
|
(u) => u.id === this.rightRowTemp[0].id
|
|
)[0].partNum = delid.partNum - this.numFormData.num;
|
|
this.rightRowTemp[0].partNum = n2 - n1;
|
|
}
|
|
} else if (this.numFormData.num == 0) {
|
|
alert("输入数字不能为0!");
|
|
} else {
|
|
alert("输入不正确,请确认!");
|
|
}
|
|
}
|
|
this.dialogNumVisible = false;
|
|
} else {
|
|
alert("请先选择总成编号!");
|
|
}
|
|
this.dialogNumVisible = false;
|
|
},
|
|
/* 总成编号选中事件 */
|
|
rowClickass(row) {
|
|
this.asTemp = [];
|
|
this.tempdetails = [];
|
|
this.$refs.asTable.clearSelection();
|
|
this.$refs.asTable.toggleRowSelection(row);
|
|
this.asTemp.push(row);
|
|
|
|
if (this.asTemp[0].details.length !== 0) {
|
|
//选中插入中间数据源
|
|
this.tempdetails.push({
|
|
isKey: false,
|
|
partCode: this.asTemp[0].details[0].partCode,
|
|
partNum: this.asTemp[0].details[0].partNum,
|
|
vehicleModel: this.asTemp[0].details[0].carModel,
|
|
});
|
|
}
|
|
//二次选中插入最终提交中的details
|
|
var judgeSec = this.tempAssCfgList.filter(
|
|
(u) => u.erpAssemblyCode === this.asTemp[0].erpAssemblyCode
|
|
);
|
|
console.log("this is judgeSec:", judgeSec);
|
|
if (judgeSec.length !== 0) {
|
|
console.log("this is judgeSec[0].details:", judgeSec[0].details);
|
|
judgeSec[0].details.forEach((element) => {
|
|
this.tempdetails.push(element);
|
|
});
|
|
}
|
|
console.log("this is this.tempdetails", this.tempdetails);
|
|
console.log("this is asTemp", this.asTemp);
|
|
},
|
|
/* 总成编号复选框单选事件 */
|
|
selectAss(selection, row) {
|
|
this.asTemp = []; //清空已选
|
|
this.tempdetails = [];
|
|
console.log(
|
|
"当用户手动勾选数据行的 Checkbox 时触发的事件",
|
|
selection,
|
|
row
|
|
);
|
|
// 选择项大于1时
|
|
if (selection.length > 1) {
|
|
let del_row = selection.shift();
|
|
// console.log('把数组的第一个元素从其中删除后', selection);
|
|
this.$refs.asTable.toggleRowSelection(del_row, false); // 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中)
|
|
}
|
|
this.asTemp.push(selection[0]);
|
|
console.log("当用户手动勾选数据行", this.asTemp);
|
|
|
|
if (this.asTemp[0].details.length !== 0) {
|
|
//选中插入中间数据源
|
|
this.tempdetails.push({
|
|
isKey: false,
|
|
partCode: this.asTemp[0].details[0].partCode,
|
|
partNum: this.asTemp[0].details[0].partNum,
|
|
vehicleModel: this.asTemp[0].details[0].carModel,
|
|
});
|
|
}
|
|
|
|
//二次选中插入最终提交中的details
|
|
var judgeSec = this.tempAssCfgList.filter(
|
|
(u) => u.erpAssemblyCode === this.asTemp[0].erpAssemblyCode
|
|
);
|
|
console.log("this is judgeSec:", judgeSec);
|
|
if (judgeSec.length !== 0) {
|
|
console.log("this is judgeSec[0].details:", judgeSec[0].details);
|
|
judgeSec[0].details.forEach((element) => {
|
|
this.tempdetails.push(element);
|
|
});
|
|
}
|
|
console.log("this is this.tempdetails", this.tempdetails);
|
|
console.log("this is asTemp", this.asTemp);
|
|
},
|
|
/* 右侧数据选中事件 */
|
|
rowClickRight(row) {
|
|
this.rightRowTemp = [];
|
|
this.$refs.rightTable.clearSelection();
|
|
this.$refs.rightTable.toggleRowSelection(row);
|
|
this.rightRowTemp.push(row);
|
|
},
|
|
/* 左侧数据选中事件 */
|
|
rowClickLeft(row) {
|
|
this.leftRowTemp = [];
|
|
this.$refs.leftTable.clearSelection();
|
|
this.$refs.leftTable.toggleRowSelection(row);
|
|
this.leftRowTemp.push(row);
|
|
},
|
|
/* 右侧复选框单选事件 */
|
|
selectRight(selection, row) {
|
|
this.rightRowTemp = []; //清空已选
|
|
console.log(
|
|
"当用户手动勾选数据行的 Checkbox 时触发的事件",
|
|
selection,
|
|
row
|
|
);
|
|
// 选择项大于1时
|
|
// if (selection.length > 1) {
|
|
// let del_row = selection.shift();
|
|
// // console.log('把数组的第一个元素从其中删除后', selection);
|
|
// this.$refs.rightTable.toggleRowSelection(del_row, false); // 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中)
|
|
// }
|
|
selection.forEach((item) => {
|
|
this.rightRowTemp.push(item);
|
|
});
|
|
console.log("当用户手动勾选数据行", this.rightRowTemp);
|
|
},
|
|
/* 右侧复选框全选事件 */
|
|
selectRightAll(selection) {
|
|
this.rightRowTemp = []; //清空已选
|
|
console.log("当用户手动勾选全选 Checkbox 时触发的事件", selection);
|
|
selection.forEach((item) => {
|
|
this.rightRowTemp.push(item);
|
|
});
|
|
console.log("当用户手动勾选全选", this.rightRowTemp);
|
|
},
|
|
/* 左侧复选框单选事件 */
|
|
selectLeft(selection, row) {
|
|
this.leftRowTemp = []; //清空已选
|
|
console.log(
|
|
"当用户手动勾选数据行的 Checkbox 时触发的事件",
|
|
selection,
|
|
row
|
|
);
|
|
// // 选择项大于1时
|
|
// if (selection.length > 1) {
|
|
// let del_row = selection.shift();
|
|
// // console.log('把数组的第一个元素从其中删除后', selection);
|
|
// this.$refs.rightTable.toggleRowSelection(del_row, false); // 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中)
|
|
// }
|
|
selection.forEach((item) => {
|
|
this.leftRowTemp.push(item);
|
|
});
|
|
console.log("当用户手动勾选数据行", this.leftRowTemp);
|
|
},
|
|
/* 左侧复选框全选事件 */
|
|
selectLeftAll(selection) {
|
|
this.leftRowTemp = []; //清空已选
|
|
console.log("当用户手动勾选全选 Checkbox 时触发的事件", selection);
|
|
selection.forEach((item) => {
|
|
this.leftRowTemp.push(item);
|
|
});
|
|
console.log("当用户手动勾选全选", this.leftRowTemp);
|
|
},
|
|
getvehicleModel() {
|
|
this.$axios
|
|
.gets("/api/newjit/dic/list", this.vehicleModelQuery)
|
|
.then((response) => {
|
|
//console.log(response);
|
|
this.vehicleModelList = response.item;
|
|
//console.log()
|
|
})
|
|
.catch(() => {});
|
|
},
|
|
valueselectChange() {},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
@import "../../../pg-fis/styles/crmtable.scss";
|
|
</style>
|
|
|
|
|