<template>
|
<div>
|
<div class="body" :style="{height:mainHeight+'px'}">
|
|
<div class="bodyTopButtonGroup" style="justify-content: space-between">
|
<el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
|
<!-- <el-button v-waves icon="el-icon-download" @click=" ">导入</el-button>-->
|
</div>
|
|
<div class="bodyTopFormGroup">
|
<el-form
|
ref="form"
|
:model="form"
|
label-width="100px"
|
inline
|
style="display: flex;"
|
>
|
<div class="elForm">
|
<el-form-item label="产品编码" style=" display: flex;">
|
|
<el-input v-model="form.partcode" placeholder="请输入" style="width: 200px" />
|
|
<!-- <el-select-->
|
<!-- v-model="form.partcode"-->
|
<!-- filterable-->
|
<!-- :popper-append-to-body="false"-->
|
<!-- style="width: 200px"-->
|
<!-- placeholder="请选择"-->
|
<!-- @change="partChange"-->
|
<!-- >-->
|
<!-- <el-option-->
|
<!-- v-for="item in partArr"-->
|
<!-- :key="item.partcode"-->
|
<!-- :label="item.partname+'/'+item.partcode"-->
|
<!-- :value="item.partcode"-->
|
<!-- />-->
|
<!-- </el-select>-->
|
|
</el-form-item>
|
<el-form-item label="产品名称" style=" display: flex;">
|
<el-input v-model="form.partname" placeholder="请输入" style="width: 200px" />
|
</el-form-item>
|
<el-form-item label="规格型号" style=" display: flex;">
|
<el-input v-model="form.partspec" placeholder="请输入" style="width: 200px" />
|
</el-form-item>
|
<el-form-item
|
v-if="mesSetting.route"
|
label="工艺路线"
|
style="display: flex;"
|
>
|
<el-input v-model="form.routename" placeholder="请输入" style="width: 200px" />
|
<!-- <el-select-->
|
<!-- v-model="form.routecode"-->
|
<!-- filterable-->
|
<!-- :disabled="form.partcode===''"-->
|
<!-- :popper-append-to-body="false"-->
|
<!-- style="width: 200px"-->
|
<!-- placeholder="请选择"-->
|
<!-- @change="routeChange"-->
|
<!-- >-->
|
<!-- <el-option-->
|
<!-- v-for="item in routeArr"-->
|
<!-- :key="item.route_code"-->
|
<!-- :label="item.route_name"-->
|
<!-- :value="item.route_code"-->
|
<!-- />-->
|
<!-- </el-select>-->
|
</el-form-item>
|
<el-form-item v-show="isExpandForm" label="工序名称" style=" display: flex;">
|
<el-input v-model="form.stepname" placeholder="请输入" style="width: 200px" />
|
<!-- <el-select-->
|
<!-- v-model="form.stepcode"-->
|
<!-- :disabled="mesSetting.route?form.routecode==='':form.partcode===''"-->
|
<!-- :popper-append-to-body="false"-->
|
<!-- style="width: 200px"-->
|
<!-- placeholder="请选择"-->
|
<!-- >-->
|
<!-- <el-option-->
|
<!-- v-for="item in stepArr"-->
|
<!-- :key="item.step_code"-->
|
<!-- :label="item.step_name"-->
|
<!-- :value="item.step_code"-->
|
<!-- />-->
|
<!-- </el-select>-->
|
</el-form-item>
|
|
<!--按工序-->
|
<!-- <el-form-item-->
|
<!-- v-if="!mesSetting.route"-->
|
<!-- label="工艺路线"-->
|
<!-- style="display: flex;"-->
|
<!-- >-->
|
<!-- <el-select-->
|
<!-- v-model="form.routecode"-->
|
<!-- filterable-->
|
<!-- :disabled="form.partcode===''"-->
|
<!-- :popper-append-to-body="false"-->
|
<!-- style="width: 200px"-->
|
<!-- placeholder="请选择"-->
|
<!-- @change="routeChange"-->
|
<!-- >-->
|
<!-- <el-option-->
|
<!-- v-for="item in routeArr"-->
|
<!-- :key="item.route_code"-->
|
<!-- :label="item.route_name"-->
|
<!-- :value="item.route_code"-->
|
<!-- />-->
|
<!-- </el-select>-->
|
<!-- </el-form-item>-->
|
|
</div>
|
<div
|
class="bodySearchReset"
|
:style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
|
>
|
<el-button v-waves type="primary" icon="el-icon-search" @click="search">查询</el-button>
|
<el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
|
</div>
|
</el-form>
|
<div
|
class="bodyTopFormExpand"
|
>
|
<svg-icon
|
v-show="mouseHoverType==='mouseout'"
|
style="cursor: pointer"
|
:icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"
|
@mouseenter="mouseHoverType=$event.type"
|
/>
|
<svg-icon
|
v-show="mouseHoverType==='mouseenter'"
|
style="cursor: pointer"
|
:icon-class="!isExpandForm?'doubleDown':'doubleUp'"
|
@click="isExpandForm=!isExpandForm"
|
@mouseout="mouseHoverType=$event.type"
|
/>
|
</div>
|
</div>
|
|
<div class="elTableDiv">
|
<!-- <TableColumnSettings-->
|
<!-- :list1="tableColumnSettingsArray"-->
|
<!-- @tableColumnUpdate="tableColumnUpdate"-->
|
<!-- />-->
|
<el-table
|
ref="tableDataRef"
|
:key="tableTimeStampArrayKey"
|
class="tableFixed"
|
:data="tableData"
|
:style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
|
border
|
:row-class-name="tableRowClassName"
|
:height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
|
highlight-current-row
|
:header-cell-style="this.$headerCellStyle"
|
:cell-style="this.$cellStyle"
|
@sort-change="sortChange"
|
>
|
|
<el-table-column
|
v-for="item in tableColumnSettingsArray"
|
v-if="item.show"
|
:key="item.id"
|
:sortable="item.sortable"
|
:prop="item.prop"
|
:min-width="item.minWidth"
|
:label="item.label"
|
:width="item.width"
|
show-tooltip-when-overflow
|
:fixed="item.fixed?(item.fixed==='left'?'left':'right'):false"
|
>
|
<template slot-scope="{row}">
|
<div v-if="!row[item.prop]">/</div>
|
<div v-else-if="item.prop==='eqp_value'||item.prop==='stand_value'">
|
{{ row[item.prop] }} 秒
|
</div>
|
<div v-else-if="item.prop==='unprice'">{{ row[item.prop] }}</div>
|
<div v-else>{{ row[item.prop] }}</div>
|
</template>
|
</el-table-column>
|
|
<el-table-column
|
label="操作"
|
fixed="right"
|
width="120"
|
>
|
<template slot-scope="{row}">
|
<div class="operationClass">
|
<el-tooltip class="item" effect="dark" content="编辑" placement="top">
|
<i
|
:style="{color:$store.state.settings.theme}"
|
class="el-icon-edit-outline"
|
@click="edit('edit',row)"
|
/>
|
</el-tooltip>
|
<el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
|
<i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" />
|
</el-tooltip>
|
</div>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<!--分页-->
|
<pagination
|
:total="total"
|
:page.sync="form.page"
|
:limit.sync="form.rows"
|
align="right"
|
layout="total,prev, pager, next,sizes"
|
popper-class="select_bottom"
|
@pagination="getBeatRateSearch"
|
/>
|
</div>
|
|
<el-dialog
|
v-el-drag-dialog
|
:title="operation==='add'?'新增':'编辑'"
|
:visible.sync="dialogVisible"
|
width="1100px"
|
top="15vh"
|
:close-on-click-modal="false"
|
@closed="handleClose"
|
@close="handleClose"
|
>
|
|
<el-form ref="dialogForm" inline :model="dialogForm" label-width="100px">
|
<div style="display: flex;align-items: center">
|
<i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" style="margin-top: -20px" />
|
<el-form-item prop="partcode" label="产品名称/编码">
|
<el-button
|
v-if="operation==='add'"
|
v-waves
|
type="primary"
|
style="width: 200px"
|
icon="el-icon-circle-plus-outline"
|
@click="selectSuitpart"
|
>选择物料
|
</el-button>
|
|
<!-- <el-select-->
|
<!-- v-show="operation==='add'"-->
|
<!-- v-model="dialogForm.partcode"-->
|
<!-- filterable-->
|
<!-- style="width: 220px"-->
|
<!-- placeholder="请选择"-->
|
<!-- :popper-append-to-body="false"-->
|
<!-- @change="partDialogChange"-->
|
<!-- >-->
|
<!-- <!– @focus="getPartSelect2"–>-->
|
<!-- <el-option-->
|
<!-- v-for="item in partArr2"-->
|
<!-- :key="item.partcode"-->
|
<!-- :label="item.partname+'/'+item.partcode"-->
|
<!-- :value="item.partcode"-->
|
<!-- />-->
|
<!-- </el-select>-->
|
<!-- <el-input-->
|
<!-- v-show="operation!=='add'"-->
|
<!-- v-model="editPartName"-->
|
<!-- disabled-->
|
<!-- style="width: 220px"-->
|
<!-- />-->
|
</el-form-item>
|
<div v-if="dialogForm.partcode.toString().trim().length>0" style="height: 34px;">
|
{{ operation=='add'?"已选择":"" }} {{ dialogForm.partcode }} {{ dialogForm.partname }}
|
</div>
|
<el-form-item v-if="mesSetting.route" prop="routecode" label="工艺路线">
|
<el-select
|
v-show="operation==='add'"
|
v-model="dialogForm.routecode"
|
style="width: 220px"
|
filterable
|
:disabled="dialogForm.partcode===''"
|
placeholder="请选择"
|
:popper-append-to-body="false"
|
@change="routeDialogChange"
|
>
|
<el-option
|
v-for="item in routeDialogArr"
|
:key="item.route_code"
|
:label="item.route_name"
|
:value="item.route_code"
|
/>
|
</el-select>
|
<el-input
|
v-show="operation!=='add'"
|
v-model="editRouteName"
|
disabled
|
style="width: 220px"
|
/>
|
</el-form-item>
|
</div>
|
</el-form>
|
|
<el-table
|
:data="stepDialogArr"
|
style="width: 100%"
|
height="300"
|
border
|
:header-cell-style="this.$headerCellStyle"
|
:cell-style="this.$cellStyle"
|
:row-class-name="tableRowClassName"
|
>
|
<el-table-column
|
prop="step_seq"
|
label="工序顺序"
|
width="100"
|
/>
|
<el-table-column
|
prop="step_code"
|
label="工序编码"
|
width="200"
|
/>
|
<el-table-column
|
prop="step_name"
|
label="工序名称"
|
width="200"
|
/>
|
<el-table-column
|
prop="unprice"
|
label="工序工价"
|
>
|
<template slot-scope="{row}">
|
<el-input v-model="row.unprice" oninput="value=value.replace(/[^0-9.]/g,'')" />
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<span slot="footer" class="dialog-footer">
|
<div class="footerButton">
|
<el-button v-waves @click="dialogVisibleCancel">返 回</el-button>
|
<el-button v-waves type="primary" @click="dialogVisibleConfirm">确 定</el-button>
|
</div>
|
</span>
|
</el-dialog>
|
|
<!--选择物料-->
|
<el-dialog
|
v-el-drag-dialog
|
:title="dialogForm.suitobject==='P'?'选择物料':'选择物料类别'"
|
:visible.sync="dialogVisibleSuitobject"
|
width="1460px"
|
:close-on-click-modal="false"
|
top="5vh"
|
@closed="handleCloseSuitobject"
|
@close="handleCloseSuitobject"
|
>
|
|
<div style="display: flex">
|
<div style="width: 300px;margin-right: 20px;background:#fff">
|
|
<div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;">
|
<div style="display: flex;">
|
<div
|
style="width: 5px;height: 100%;border-radius: 5px;"
|
:style="{background:$store.state.settings.theme}"
|
/>
|
<div style="margin-left: 8px;">存货档案</div>
|
</div>
|
</div>
|
|
<el-tree
|
ref="treeLeftRef"
|
style="padding: 10px;overflow: auto;height: 600px;"
|
:data="treeLeft"
|
node-key="code"
|
highlight-current
|
:props="defaultPropsLeft"
|
:default-expand-all="true"
|
:expand-on-click-node="false"
|
@node-click="getTMaterielData"
|
/>
|
</div>
|
<div
|
style=" width:calc(100% - 300px);"
|
>
|
<div class="bodyTopFormGroup">
|
<el-form
|
ref="suitobjectForm"
|
:model="suitobjectForm"
|
label-width="80px"
|
inline
|
style="display: flex;"
|
>
|
<div class="elForm">
|
<el-form-item label="存货编码" style=" display: flex;">
|
<el-input
|
v-model="suitobjectForm.partcode"
|
placeholder="请输入"
|
:style="{minWidth:'100px',width:150+'px'}"
|
/>
|
</el-form-item>
|
<el-form-item label="存货名称" style=" display: flex;">
|
<el-input
|
v-model="suitobjectForm.partname"
|
placeholder="请输入"
|
:style="{minWidth:'100px',width:150+'px'}"
|
/>
|
</el-form-item>
|
<el-form-item label="存货规格" style=" display: flex;">
|
<el-input
|
v-model="suitobjectForm.partspec"
|
placeholder="请输入"
|
:style="{minWidth:'100px',width:150+'px'}"
|
/>
|
</el-form-item>
|
|
</div>
|
<div class="bodySearchReset">
|
<el-button
|
v-waves
|
type="primary"
|
icon="el-icon-search"
|
@click="getTMaterielData($refs.treeLeftRef.getCurrentNode())"
|
>查询
|
</el-button>
|
<el-button
|
v-waves
|
type="info"
|
icon="el-icon-refresh"
|
@click="resetSuitobject"
|
>重置
|
</el-button>
|
</div>
|
</el-form>
|
</div>
|
|
<div class="elTableDiv">
|
<el-table
|
ref="tableDataRef3"
|
class="tableFixed"
|
:data="suitobjectTableData"
|
height="520"
|
border
|
row-class-name="custom-row"
|
highlight-current-row
|
:header-cell-style="this.$headerCellStyle"
|
:cell-style="this.$cellStyle"
|
row-key="partcode"
|
@row-click="rowClick2"
|
>
|
|
<el-table-column
|
width="50"
|
fixed
|
>
|
<template slot-scope="{row}">
|
<el-radio
|
v-model="dialogForm.partcode"
|
:label="row.partcode"
|
style="color: transparent;padding-left: 10px;"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="rowNum"
|
width="70"
|
fixed
|
label="序号"
|
/>
|
<el-table-column
|
prop="partcode"
|
label="存货编码"
|
/>
|
<el-table-column
|
prop="partname"
|
label="存货名称"
|
show-tooltip-when-overflow
|
min-width="200"
|
/>
|
<el-table-column
|
prop="partspec"
|
label="规格型号"
|
>
|
<template slot-scope="{row}">
|
{{ row.partspec ? row.partspec : '/' }}
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="idinventoryclassname"
|
label="所属类别"
|
/>
|
</el-table>
|
</div>
|
|
<!--分页-->
|
<pagination
|
:total="suitobjectTotal"
|
:page.sync="suitobjectForm.page"
|
:limit.sync="suitobjectForm.rows"
|
align="right"
|
layout="total,prev, pager, next,sizes,jumper"
|
popper-class="select_bottom"
|
@pagination="getTMaterielData($refs.treeLeftRef.getCurrentNode())"
|
/>
|
|
</div>
|
</div>
|
|
<span slot="footer" class="dialog-footer">
|
<div class="footerButton">
|
<el-button v-waves @click="dialogVisibleCancelSuitobject">返 回</el-button>
|
<el-button
|
v-waves
|
:loading="$store.state.app.buttonIsDisabled"
|
:disabled="$store.state.app.buttonIsDisabled"
|
type="primary"
|
@click="dialogVisibleConfirmSuitobject"
|
>确 认</el-button>
|
</div>
|
</span>
|
</el-dialog>
|
|
</div>
|
</template>
|
|
<script>
|
import Pagination from '@/components/Pagination'
|
import {
|
BeatRateSearch, DeleteBeatRate,
|
PartSelect,
|
PartSelectRpute,
|
RouteSelectStep, SaveBeatRate
|
} from '@/api/basicSettings'
|
import elDragDialog from '@/directive/el-drag-dialog'
|
import waves from '@/directive/waves'
|
import TableColumnSettings from '@/components/TableColumnSettings'
|
import { TMaterielClassTree, TMaterielData } from '@/api/ProductModel'
|
import arrayToTree from 'array-to-tree'
|
export default {
|
name: 'MeterPrice',
|
components: {
|
Pagination, TableColumnSettings
|
},
|
directives: { elDragDialog, waves },
|
data() {
|
return {
|
mouseHoverType: 'mouseout',
|
isExpandForm: false,
|
mesSetting: JSON.parse(localStorage.getItem('mesSetting')),
|
mainHeight: 0,
|
tableHeight: 0,
|
form: {
|
partcode: '', // 产品编码
|
partname: '',
|
partspec: '',
|
routename: '', // 工艺路线编码
|
stepname: '', // 工序编码
|
|
prop: 'partcode', // 排序字段
|
order: 'desc', // 排序字段
|
page: 1, // 第几页
|
rows: 20 // 每页多少条
|
},
|
partArr: [], // 产品集合
|
partArr2: [], // 产品集合对话框
|
routeArr: [], // 工艺路线
|
stepArr: [], // 工序
|
|
total: 10,
|
tableData: [],
|
tableColumnSettingsArray: [
|
// { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 隐藏列 show: false隐藏,true显示
|
{ minWidth: 25, width: 50, prop: 'rowNum', label: '序号', id: 2, show: true, fixed: 'left', sortable: false }, // custom
|
{
|
minWidth: 110,
|
width: false,
|
prop: 'partcode',
|
label: '产品编码',
|
id: 3,
|
show: true,
|
fixed: false,
|
sortable: true
|
},
|
{
|
minWidth: 110,
|
width: false,
|
prop: 'partname',
|
label: '产品名称',
|
id: 4,
|
show: true,
|
fixed: false,
|
sortable: true
|
},
|
{
|
minWidth: 110,
|
width: false,
|
prop: 'partspec',
|
label: '产品规格',
|
id: 5,
|
show: true,
|
fixed: false,
|
sortable: true
|
},
|
// {
|
// minWidth: 110,
|
// width: false,
|
// prop: 'wksp_code',
|
// label: '生产车间编码',
|
// id: 6,
|
// show: false,
|
// fixed: false,
|
// sortable: true
|
// },
|
// {
|
// minWidth: false,
|
// width: 110,
|
// prop: 'wksp_name',
|
// label: '生产车间',
|
// id: 7,
|
// show: true,
|
// fixed: false,
|
// sortable: true
|
// },
|
{
|
minWidth: 110,
|
width: false,
|
prop: 'route_code',
|
label: '工艺路线编码',
|
id: 8,
|
show: false,
|
fixed: false,
|
sortable: true
|
}, {
|
minWidth: 110,
|
width: false,
|
prop: 'route_name',
|
label: '工艺路线',
|
id: 9,
|
show: true,
|
fixed: false,
|
sortable: true
|
}, {
|
minWidth: 110,
|
width: false,
|
prop: 'stepcode',
|
label: '工序编码',
|
id: 10,
|
show: false,
|
fixed: false,
|
sortable: true
|
}, {
|
minWidth: 110,
|
width: false,
|
prop: 'stepname',
|
label: '工序名称',
|
id: 11,
|
show: true,
|
fixed: false,
|
sortable: true
|
},
|
{
|
minWidth: 110,
|
width: false,
|
prop: 'unprice',
|
label: '计件单价',
|
id: 12,
|
show: true,
|
fixed: false,
|
sortable: true
|
},
|
{
|
minWidth: false,
|
width: 110,
|
prop: 'lm_user',
|
label: '创建人员',
|
id: 13,
|
show: true,
|
fixed: false,
|
sortable: true
|
},
|
{
|
minWidth: false,
|
width: 160,
|
prop: 'lm_date',
|
label: '创建时间',
|
id: 14,
|
show: true,
|
fixed: false,
|
sortable: true
|
}
|
|
],
|
tableTimeStampArrayKey: new Date().getTime(), // 表格key
|
dialogVisible: false,
|
dialogForm: {
|
partcode: '', // 产品编码
|
routecode: '', // 工艺路线编码
|
stepcode: '', // 工序编码
|
|
wkshopcode: '', // 生产车间编码
|
eqp_value: '', // 设备节拍
|
stand_value: '', // 生产节拍
|
cavity_qty: '', // 型腔数
|
unprice: ''// 计件单价
|
},
|
routeDialogArr: [], // 工艺路线
|
stepDialogArr: [], // 工序集合
|
|
editPartName: '', // 编辑时产品名称
|
editRouteName: '', // 编辑时工艺路线名称
|
editStepName: '', // 编辑时加工工序名称
|
operation: '',
|
|
dialogVisibleSuitobject: false,
|
treeLeft: [
|
{
|
code: '-1',
|
name: '全部'
|
}
|
], // 左侧树
|
treeLeftArr: [],
|
defaultPropsLeft: {
|
children: 'children',
|
label: 'name'
|
},
|
|
suitobjectTableData: [],
|
suitobjectForm: {
|
inventoryclasscode: '',
|
partcode: '',
|
partname: '',
|
partspec: '',
|
page: 1,
|
rows: 20,
|
prop: 'lm_date', // 排序字段
|
order: 'desc' // 排序字段
|
},
|
suitobjectTotal: 0
|
|
}
|
},
|
|
activated() {
|
window.addEventListener('resize', this.getHeight)
|
this.getHeight()
|
this.handleRequest()
|
},
|
created() {
|
this.handleRequest()
|
},
|
mounted() {
|
window.addEventListener('resize', this.getHeight)
|
this.getHeight()
|
|
if (!this.mesSetting.route) {
|
this.tableColumnSettingsArray = this.tableColumnSettingsArray.filter(i => i.prop !== 'route_name')
|
}
|
},
|
methods: {
|
selectSuitpart() {
|
this.dialogVisibleSuitobject = true
|
this.$nextTick(() => {
|
this.$refs.treeLeftRef.setCurrentKey('-1')
|
this.getTMaterielData(this.$refs.treeLeftRef.getCurrentNode())
|
})
|
},
|
handleCloseSuitobject() {
|
this.suitobjectForm = {
|
inventoryclasscode: '',
|
partcode: '',
|
partname: '',
|
partspec: '',
|
page: 1,
|
rows: 20,
|
prop: 'lm_date', // 排序字段
|
order: 'desc' // 排序字段
|
}
|
},
|
dialogVisibleCancelSuitobject() {
|
this.dialogVisibleSuitobject = false
|
},
|
|
async dialogVisibleConfirmSuitobject() {
|
await this.partDialogChange(this.dialogForm.partcode)
|
this.dialogVisibleSuitobject = false
|
},
|
|
rowClick2(row, event, column) {
|
this.dialogForm.partcode = row.partcode
|
this.dialogForm.partname = this.suitobjectTableData.find(i => i.partcode === row.partcode).partname
|
// this.dialogForm.partspec = this.partcodeArr.find(i => i.partcode === row.partcode).partspec
|
},
|
|
resetSuitobject() {
|
this.suitobjectForm.inventoryclasscode = ''
|
this.suitobjectForm.partcode = ''
|
this.suitobjectForm.partname = ''
|
this.suitobjectForm.partspec = ''
|
this.$refs.treeLeftRef.setCurrentKey('-1')
|
this.getTMaterielData(this.$refs.treeLeftRef.getCurrentNode())
|
},
|
async getTMaterielClassTree() {
|
const res = await TMaterielClassTree()
|
res.data.forEach(i => {
|
i.idparent = i.idparent ? i.idparent : '-1'
|
})
|
this.treeLeftArr = res.data
|
this.treeLeftArr.forEach(e => {
|
e.name = e.code + ' ' + e.name
|
})
|
this.treeLeft = arrayToTree(this.treeLeft.concat(res.data), {
|
parentProperty: 'idparent',
|
customID: 'code',
|
childrenProperty: 'children'
|
})
|
},
|
async getTMaterielData(node) {
|
const result = this.getChildrenCodeMethod(node, [])
|
if (result.includes('-1')) {
|
result.shift()
|
}
|
this.suitobjectForm.inventoryclasscode = result.join(',')
|
const res = await TMaterielData(this.suitobjectForm)
|
|
this.suitobjectTableData = res.data
|
this.suitobjectTotal = res.count
|
|
this.$nextTick(() => {
|
this.$refs.tableDataRef3.doLayout()
|
})
|
},
|
// 递归取子集的所有code
|
getChildrenCodeMethod(node, result) {
|
result.push(node.code)
|
if (node.children && node.children.length > 0) {
|
node.children.forEach(i => {
|
this.getChildrenCodeMethod(i, result)
|
})
|
}
|
return result
|
},
|
|
tableColumnUpdate(val, isCopyTrue) {
|
if (isCopyTrue) {
|
this.tableColumnSettingsArray = val
|
}
|
this.tableTimeStampArrayKey = new Date().getTime()
|
this.$refs.tableDataRef.doLayout()
|
},
|
tableRowClassName({ row, rowIndex }) {
|
return 'custom-row'
|
},
|
handleRequest() {
|
this.getBeatRateSearch().then(res => {
|
if (res.code === '200') {
|
this.getPartSelect()
|
this.getTMaterielClassTree()
|
}
|
})
|
},
|
|
async getBeatRateSearch() {
|
const res = await BeatRateSearch(this.form)
|
this.tableData = res.data
|
this.total = res.count
|
return { code: res.code }
|
},
|
// 排序改变时
|
sortChange({ column, prop, order }) {
|
if (order === 'descending') {
|
order = 'desc'
|
} else if (order === 'ascending') {
|
order = 'asc'
|
} else {
|
order = 'desc'
|
}
|
this.form.order = order
|
this.form.prop = prop
|
this.getBeatRateSearch()
|
},
|
// 查询
|
search() {
|
this.getBeatRateSearch()
|
},
|
async getPartSelect() {
|
const { data: res } = await PartSelect()
|
this.partArr = res
|
},
|
async getPartSelect2() {
|
const { data: res } = await PartSelect()
|
this.partArr2 = res
|
},
|
async partChange(val) {
|
const { data: res } = await PartSelectRpute({ partcode: val })
|
if (this.mesSetting.route) {
|
this.routeArr = res
|
this.form.routecode = ''
|
} else {
|
this.stepArr = res
|
}
|
this.form.stepcode = ''
|
},
|
async routeChange(val) {
|
const { data: res } = await RouteSelectStep({ partcode: this.form.partcode, routecode: val })
|
this.stepArr = res
|
this.form.stepcode = ''
|
},
|
|
// 重置
|
reset() {
|
this.form.partcode = ''
|
this.form.partname = ''
|
this.form.partspec = ''
|
this.form.routename = ''
|
this.form.stepname = ''
|
|
this.getBeatRateSearch()
|
},
|
async partDialogChange(val) {
|
const { data: res } = await PartSelectRpute({ partcode: val })
|
if (this.mesSetting.route) {
|
this.routeDialogArr = res
|
this.stepDialogArr = []
|
this.dialogForm.routecode = ''
|
} else {
|
this.stepDialogArr = res
|
}
|
},
|
async routeDialogChange(val) {
|
const { data: res } = await RouteSelectStep({ partcode: this.dialogForm.partcode, routecode: val })
|
this.stepDialogArr = res
|
},
|
|
// 新增按钮
|
add(operation) {
|
this.operation = operation
|
this.dialogVisible = true
|
this.getPartSelect2()
|
},
|
// 修改按钮
|
async edit(operation, row) {
|
this.operation = operation
|
this.dialogVisible = true
|
|
this.dialogForm.partname = row.partname
|
this.editRouteName = row.route_name
|
this.editStepName = row.stepname
|
|
await this.partDialogChange(row.partcode)
|
|
this.dialogForm.partcode = row.partcode
|
if (this.mesSetting.route) {
|
await this.routeDialogChange(row.route_code)
|
}
|
this.dialogForm.routecode = row.route_code
|
this.dialogForm.stepcode = row.stepcode
|
},
|
// 删除按钮
|
async del(row) {
|
this.$confirm('是否确认删除?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
DeleteBeatRate({ id: row.id }).then(res => {
|
if (res.code === '200') {
|
this.$message.success('删除成功!')
|
if (this.form.page > 1 && this.tableData.length === 1) {
|
this.form.page--
|
}
|
this.getBeatRateSearch()
|
}
|
})
|
}).catch(() => {
|
this.$message.info('已取消删除')
|
})
|
},
|
// 对话框关闭事件
|
handleClose() {
|
this.dialogForm.partcode = ''
|
this.dialogForm.routecode = ''
|
this.dialogForm.stepcode = ''
|
|
this.dialogForm.wkshopcode = ''
|
this.dialogForm.eqp_value = ''
|
this.dialogForm.stand_value = ''
|
this.dialogForm.cavity_qty = ''
|
this.dialogForm.unprice = ''
|
this.eqpTableLength = 0
|
this.routeDialogArr = []
|
this.stepDialogArr = []
|
|
this.$refs.dialogForm.clearValidate()
|
// this.getBeatRateSearch()
|
},
|
// 对话框取消
|
dialogVisibleCancel() {
|
this.dialogVisible = false
|
},
|
// 对话框确认
|
dialogVisibleConfirm() {
|
this.$refs.dialogForm.validate(valid => {
|
if (valid) {
|
const children = []
|
this.stepDialogArr.forEach(i => {
|
children.push({
|
'code': i.step_code,
|
'name': i.step_name,
|
'seq': i.step_seq,
|
'isbott': i.isbott,
|
'isend': i.isend,
|
'unprice': i.unprice
|
})
|
})
|
|
const data = [
|
{
|
'partcode': this.dialogForm.partcode,
|
'defaultroute_code': this.dialogForm.routecode,
|
'children': children
|
}
|
]
|
SaveBeatRate(data).then(res => {
|
if (res.code === '200') {
|
this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
|
this.dialogVisible = false
|
this.getBeatRateSearch()
|
} else {
|
this.$message.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
|
}
|
})
|
}
|
})
|
},
|
|
// 获取页面高度
|
getHeight() {
|
this.$nextTick(() => {
|
this.mainHeight = window.innerHeight - 85
|
this.tableHeight = this.mainHeight - 255
|
if (window.innerHeight < 769) {
|
this.tableHeight = this.tableHeight - 40
|
}
|
this.$refs.tableDataRef.doLayout()
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.elTableDiv {
|
::v-deep .el-radio__label {
|
display: none !important;
|
}
|
}
|
</style>
|
|
<style>
|
.el-table .custom-row {
|
background: #f8f8fa;
|
}
|
</style>
|