|
|
<template> <div class="mod-config"> <el-form :inline="true" label-position="top" :model="searchData"> <el-form-item :label="'BU'"> <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 80px"> <el-option v-for = "i in userBuList" :key = "i.buNo" :label = "i.buDesc" :value = "i.buDesc"> </el-option> </el-select> </el-form-item> <el-form-item :label="'商品组编码'"> <el-input v-model="searchData.productGroupId" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'商品组名称'"> <el-input v-model="searchData.productGroupName" clearable style="width: 200px"></el-input> </el-form-item> <el-form-item :label="'是否在用'"> <el-select clearable v-model="searchData.active" style="width: 80px"> <el-option label="是" value="Y"></el-option> <el-option label="否" value="N"></el-option> </el-select> </el-form-item> <el-form-item :label="'商品组'"> <el-select clearable v-model="searchData.type" style="width: 80px"> <el-option label="商品组1" value="1"></el-option> <el-option label="商品组2" value="2"></el-option> <el-option label="商品组3" value="3"></el-option> <el-option label="商品组4" value="4"></el-option> </el-select> </el-form-item> <el-form-item :label="' '"> <el-button v-if="!authSearch" @click="getDataList">查询</el-button> <el-button v-if="!authSave" type="primary" @click="addModal">新增</el-button> <download-excel :fields="fields()" :data="exportData" type="xls" :name="exportName" :header="exportHeader" :footer="exportFooter" :fetch="createExportData" :before-generate="startDownload" :before-finish="finishDownload" worksheet="导出信息" class="el-button el-button--primary el-button--medium"> {{ "导出" }} </download-excel> </el-form-item> </el-form>
<el-table @header-dragend="handleColumnResize" :height="height" :data="dataList" border style="width: 100%;"> <el-table-column v-for="(item,index) in columnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> <span v-if="columnsProp.includes(item.columnProp)">{{ scope.row[`${item.columnProp}Desc`] }}</span> <span v-else> {{ scope.row[item.columnProp] }} </span> </span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column fixed="right" header-align="center" align="center" width="230" label="操作"> <template slot-scope="scope"> <el-link v-if="!authUpdate" style="cursor: pointer" @click="updateModal(scope.row)">修改</el-link> <el-link v-if="!authDelete" style="cursor: pointer" @click="delModal(scope.row)">删除</el-link> <el-link v-if="scope.row.type === '1'" style="cursor: pointer" @click="stdProcessModal(scope.row)">标准工序</el-link> <el-link v-if="scope.row.type === '1'" style="cursor: pointer" @click="ProcessTimeMatrixModal(scope.row)">ProcessTimeMatrix</el-link> </template> </el-table-column> </el-table>
<!-- 分页栏 --> <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" :page-sizes="[20, 50, 100, 200, 500]" :page-size="pageSize" :total="totalPage" layout="total, sizes, prev, pager, next, jumper"> </el-pagination>
<el-dialog :title="modalData.title" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="495px"> <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;"> <el-form-item label="BU" prop="bu" :rules="rules.bu"> <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 140px"> <el-option v-for = "i in userBuList" :key = "i.buNo" :label = "i.buDesc" :value = "i.buNo"> </el-option> </el-select> </el-form-item> <el-form-item label="是否在用" prop="active" :rules="rules.active"> <el-select v-model="modalData.active" style="width: 70px"> <el-option label="是" value="Y"></el-option> <el-option label="否" value="N"></el-option> </el-select> </el-form-item> <el-form-item label="商品组" prop="type" :rules="rules.type"> <el-select v-model="modalData.type" style="width: 103px"> <el-option label="商品组1" value="1"></el-option> <el-option label="商品组2" value="2"></el-option> <el-option label="商品组3" value="3"></el-option> </el-select> </el-form-item> <el-form-item label="Yield Rate(%)" prop="yieldRate"> <el-input v-model="modalData.yieldRate" :disabled="this.modalData.type !== '2'" style="width: 103px" placeholder="0.00" class="inlineNumber numInput" ></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;"> <el-form-item label="商品组编码" prop="productGroupId" :rules="rules.productGroupId"> <el-input v-model="modalData.productGroupId" :disabled="modalDisableFlag" style="width: 140px"></el-input> </el-form-item> <el-form-item label="商品组名称" prop="productGroupName" :rules="rules.productGroupName"> <el-input v-model="modalData.productGroupName" style="width: 304px"></el-input> </el-form-item> </el-form> <el-footer style="height:30px;margin-top: 20px;text-align:center"> <el-button type="primary" @click="saveData">保存</el-button> <el-button type="primary" @click="modalFlag = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog :title="'商品组:' + productGroupCurrentRow.productGroupName + ' - 标准工序'" :close-on-click-modal="false" v-drag :visible.sync="stdProcessFlag" @close="closeStdProcessDialog" width="1200px"> <el-form :inline="true" label-position="top" :model="searchData1" @keyup.enter.native="searchProductGroupStdProcess"> <el-form-item :label="'工序号'"> <el-input v-model="searchData1.operationNo" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'工序名称'"> <el-input v-model="searchData1.operationName" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item :label="' '"> <el-button @click="searchProductGroupStdProcess">查询</el-button> <el-button type="primary" @click="addStdProcessModal">新增</el-button> </el-form-item> </el-form> <el-table @header-dragend="handleColumnResize" :height="height - 200" :data="stdProcessList" border style="width: 100%;"> <el-table-column v-for="(item,index) in stdProcessColumnList" :key="index" v-if="item.isVisible === true ?item.isVisible:isVisible1" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column fixed="right" header-align="center" align="center" width="70" label="操作"> <template slot-scope="scope"> <el-link v-if="!authDelete" style="cursor: pointer" @click="delProductGroupStdProcessModal(scope.row)">删除</el-link> </template> </el-table-column> </el-table> <el-footer style="height:30px;margin-top: 20px;text-align:center"> <el-button type="primary" @click="stdProcessFlag = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="商品组 - 标准工序(新增)" :close-on-click-modal="false" v-drag :visible.sync="stdProcessFlag1" @close="closeStdProcess1Dialog" width="1100px"> <el-table @header-dragend="handleColumnResize" :height="height - 200" :data="stdProcessList1" border @selection-change="selectionChangeHandle" style="width: 100%;"> <el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column> <el-table-column v-for="(item,index) in stdProcessColumnList" :key="index" v-if="item.isVisible === true ?item.isVisible:isVisible1" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> </el-table> <el-footer style="height:30px;margin-top: 20px;text-align:center"> <el-button type="primary" @click="saveStdProcessData">确定</el-button> <el-button type="primary" @click="stdProcessFlag1 = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="商品组 - Process Time Matrix" :close-on-click-modal="false" v-drag :visible.sync="productGroupPtmFlag" @close="closeProductGroupPtmDialog" width="1073px" style="margin-top: -20px"> <div class="table-container" style="height: 100%;margin-top: -5px;padding: 0px !important;"> <el-form :inline="true" label-position="top" style="margin-top: -10px"> <el-form-item :label="' '"> <p type="text" size="small" style="margin-top: -5px;margin-left: 5px;">条件</p> </el-form-item> <el-form-item :label="' '" style="margin-top: -5px"> <el-button type="primary" @click="saveProductGroupPtmModal">新增</el-button> </el-form-item> </el-form> <el-table @header-dragend="handleColumnResize" title="条件" height="205px" ref="conditionTable" :data="productGroupPtmConditionList" @current-change="currentConditionChangeHandle" highlight-current-row border style="width: 100%;margin-top: -8px;"> <el-table-column label="序号" prop="seqNo" align="center" width="50px"></el-table-column> <el-table-column label="条件描述" prop="conditionDesc" align="center"></el-table-column> <el-table-column label="创建时间" prop="createDate" align="center"></el-table-column> <el-table-column label="创建人" prop="createBy" align="center"></el-table-column> <el-table-column fixed="right" header-align="center" align="center" width="70" label="操作"> <template slot-scope="scope"> <el-link v-if="!authDelete" style="cursor: pointer" @click="delProductGroupPtmModal(scope.row)">删除</el-link> </template> </el-table-column> </el-table> </div> <el-tabs style="margin-top: -7px; width: 100%; height: 100%;" v-model="activeName" class="customer-tab" type="border-card" @tab-click="tabClick"> <el-tab-pane label="参数" name="first"> <el-button type="primary" @click="updatePtmConditionItemModal" style="margin-top: 5px">编辑</el-button> <el-table @header-dragend="handleColumnResize" height="255px" :data="productGroupPtmConditionItemList" border style="width: 100%"> <el-table-column v-for="(item,index) in columnItemList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </div> <div v-else> {{ scope.row.textValue ? scope.row.textValue : scope.row.numValue }} </div> </template> </el-table-column> </el-table> </el-tab-pane> <el-tab-pane label="工序Process Time" name="second"> <el-button type="primary" @click="updatePtmConditionProcessModal" style="margin-top: 5px">编辑</el-button> <el-table @header-dragend="handleColumnResize" height="205px" :data="productGroupPtmConditionProcessList" border style="width: 100%;"> <el-table-column v-for="(item,index) in stdProcessColumnList" :key="index" v-if="item.isVisible === true ?item.isVisible:isVisible1" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> </el-table> </el-tab-pane> </el-tabs> <el-footer style="height:30px;margin-top: 10px;text-align:center"> <el-button type="primary" @click="productGroupPtmFlag = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="Process Time Matrix - 新增" :close-on-click-modal="false" v-drag :visible.sync="ptmSaveFlag" @close="closeProductGroupPtmSaveDialog" width="444px"> <el-form :inline="true" label-position="top" :model="ptmModalData" :rules="rules" style="margin-top: -5px;"> <el-form-item label="序号" prop="seqNo" :rules="rules.seqNo"> <el-input v-model="ptmModalData.seqNo" disabled style="width: 100px"></el-input> </el-form-item> <el-form-item label="条件描述" prop="conditionDesc" :rules="rules.conditionDesc"> <el-input v-model="ptmModalData.conditionDesc" style="width: 300px"></el-input> </el-form-item> <el-form-item prop="itemNo" :rules="rules.itemNo"> <span style="cursor: pointer" slot="label" @click="getBaseList(219)"><a herf="#">属性模板</a></span> <el-input v-model="ptmModalData.itemNo" @blur="modelBlur(219)" style="width: 110px"></el-input> <el-input v-model="ptmModalData.itemDesc" disabled style="width: 300px"></el-input> </el-form-item> </el-form> <el-footer style="height:35px;margin-top: 20px;text-align:center"> <el-button type="primary" @click="saveProductGroupPtm()">保存</el-button> <el-button type="primary" @click="ptmSaveFlag = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="属性值编辑" :close-on-click-modal="false" v-drag :visible.sync="ptmConditionItemUpdateFlag" @close="closePtmConditionItemUpdateDialog" width="888px"> <el-table @header-dragend="handleColumnResize" :height="height - 149" :data="copyItemAttributeList" border style="width: 100%"> <el-table-column v-for="(item,index) in columnItemList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed===''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel" > <template slot-scope="scope"> <div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </div> <div v-else> <div v-if="scope.row.valueChooseFlag !== 'Y'"> <el-input-number v-model="scope.row.numValue" style="padding: 0;width: 100%" v-if="scope.row.valueTypeDb === 'N'" :controls="false"></el-input-number> <el-input v-model="scope.row.textValue" v-else></el-input> </div> <div v-else> <el-select style="width: 100%;" v-if="scope.row.valueTypeDb === 'T'" v-model="scope.row.textValue"> <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.availableValueList" :key="key"></el-option> </el-select> <el-select style="width: 100%;" v-else v-model="scope.row.numValue"> <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.availableValueList" :key="key"></el-option> </el-select> </div> </div> </template> </el-table-column> </el-table> <el-footer style="height:35px;margin-top: 20px;text-align:center"> <el-button type="primary" @click="updatePtmConditionItemValue()">保存</el-button> <el-button type="primary" @click="ptmConditionItemUpdateFlag = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="工序Process Time编辑" :close-on-click-modal="false" v-drag :visible.sync="ptmConditionProcessUpdateFlag" @close="closePtmConditionProcessUpdateDialog" width="888px"> <el-table @header-dragend="handleColumnResize" height="215px" :data="copyProcessAttributeList" border style="width: 100%"> <el-table-column v-for="(item,index) in stdProcessColumnList1" :key="index" v-if="item.isVisible === true ? item.isVisible : isVisible1" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <div v-if="item.columnProp !== 'laborRunFactor' && item.columnProp !== 'laborCycleTime' && item.columnProp !== 'machRunFactor' && item.columnProp !== 'machCycleTime'"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </div> <div v-else> <el-input v-model="scope.row.machCycleTime" v-if="item.columnProp === 'machCycleTime'" @change="changeMachCycleTime(scope.row)" class="inlineNumber numInput"></el-input> <el-input v-model="scope.row.machRunFactor" v-if="item.columnProp === 'machRunFactor'" @change="changeMachRunFactor(scope.row)" placeholder="将保留2位小数" class="inlineNumber numInput"></el-input> <el-input v-model="scope.row.laborCycleTime" v-if="item.columnProp === 'laborCycleTime'" @change="changeLaborCycleTime(scope.row)" class="inlineNumber numInput"></el-input> <el-input v-model="scope.row.laborRunFactor" v-if="item.columnProp === 'laborRunFactor'" placeholder="将保留2位小数" class="inlineNumber numInput"></el-input> </div> </template> </el-table-column> </el-table> <el-footer style="height:30px;margin-top: 20px;text-align:center"> <el-button type="primary" @click="updatePtmConditionProcessValue()">保存</el-button> <el-button type="primary" @click="ptmConditionProcessUpdateFlag = false">关闭</el-button> </el-footer> </el-dialog>
<!-- chooseList模态框 --> <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> </div></template>
<script>import { productGroupInformationSearch, // 商品信息列表查询
productGroupInformationSave, // 商品信息新增
productGroupInformationEdit, // 商品信息编辑
productGroupInformationDelete // 商品信息删除
} from '@/api/part/partProductGroupInformation.js'import {searchProductGroupStdProcess,saveStdProcessData,delProductGroupStdProcess} from '@/api/part/partProductGroupStdProcess.js'import {getSiteAndBuByUserName} from "@/api/eam/eam.js"import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"import Chooselist from '@/views/modules/common/Chooselist_eam'import {searchStandardRoutingOperationList} from "../../../api/part/standardRoutingOperation";import {delProductGroupPtm, saveProductGroupPtm, searchProductGroupPtmCondition, searchProductGroupPtmConditionItemProcess,updatePtmConditionItemValue,updatePtmConditionProcessValue} from "../../../api/part/partProductGroupPtm";import {verifyData} from "../../../api/part/partInformation";import {updateColumnSize} from "../../../api/table";export default { components: { Chooselist }, watch: { searchData: { deep: true, handler: function (newV, oldV) { this.searchData.productGroupId = this.searchData.productGroupId.toUpperCase() } }, modalData: { deep: true, handler: function (newV, oldV) { this.modalData.productGroupId = this.modalData.productGroupId.toUpperCase() } }, ptmModalData: { deep: true, handler: function (newV, oldV) { this.ptmModalData.itemNo = this.ptmModalData.itemNo.toUpperCase() } } }, data () { return { columnsProp:['createBy', 'active', 'updateBy'], isVisible1: false, // 导出
exportData: [], exportName: '商品组' + this.dayjs().format('YYYYMMDDHHmmss'), exportHeader: ['商品组'], exportFooter: [], resultList: [], userBuList: [], stdProcessList: [], stdProcessList1: [], productGroupCurrentRow: {}, productGroupConditionCurrentRow: {}, // 多选
stdProcessList1Selections: [], // ======== 行高 ========
height: 200, // ======== 分页 ========
pageIndex: 1, pageSize: 50, totalPage: 0, activeName: 'first', // 条件查询
searchData: { site: '', userName: this.$store.state.user.name, buDesc: '', productGroupId: '', productGroupName: '', active: '', type: '', operationNo: '', operationName: '', page: 1, limit: 10 }, searchData1: { site: '', userName: this.$store.state.user.name, buNo: '', productGroupId: '', productGroupName: '', active: '', type: '', operationNo: '', operationName: '', page: 1, limit: 10 }, searchData2: { site: '', userName: this.$store.state.user.name, buNo: '', page: 1, limit: 10 }, modalData: { flag: '', title: '', bu: '', site: this.$store.state.user.site, buNo: '', yieldRate: '', productGroupId: '', productGroupName: '', active: '', type: '' }, ptmModalData: { bu: '', site: this.$store.state.user.site, buNo: '', seqNo: '', conditionDesc: '', recordType: '', itemNo: '', itemDesc: '', productGroupId: '', }, // ======== 数据列表 ========
dataList: [], productGroupPtmConditionList: [], productGroupPtmConditionItemList: [], copyItemAttributeList: [], productGroupPtmConditionProcessList: [], copyProcessAttributeList: [], // 展示列集
columnList: [ { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table1BuDesc', tableId: "601006Table1", tableName: "商品组信息表", columnProp: 'buDesc', headerAlign: "center", align: "center", columnLabel: 'BU', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table1ProductGroupId', tableId: "601006Table1", tableName: "商品组信息表", columnProp: 'productGroupId', headerAlign: "center", align: "center", columnLabel: '商品组编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 }, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table1ProductGroupName', tableId: "601006Table1", tableName: "商品组信息表", columnProp: 'productGroupName', headerAlign: "center", align: "center", columnLabel: '商品组名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 300 }, { functionId: 601006, serialNumber: '601006Table1Active', tableId: '601006Table1', tableName: '商品组信息表', columnProp: 'active', headerAlign: 'center', align: 'center', columnLabel: '是否在用', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, { functionId: 601006, serialNumber: '601006Table1Type', tableId: "601006Table1", tableName: "商品组信息表", columnProp: "type", headerAlign: "center", align: "center", columnLabel: '商品组', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 }, // yieldRate
{ functionId: 601006, serialNumber: '601006Table1YieldRate', tableId: '601006Table1', tableName: '商品组信息表', columnProp: 'yieldRate', headerAlign: 'center', align: 'right', columnLabel: 'Yield Rate(%)', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 90 }, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table1CreateDate', tableId: '601006Table1', tableName: '商品组信息表', columnProp: 'createDate', headerAlign: 'center', align: 'center', columnLabel: '创建时间', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 170 }, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table1CreateBy', tableId: "601006Table1", tableName: "商品组信息表", columnProp: 'createBy', headerAlign: "center", align: "center", columnLabel: '创建人', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table1UpdateDate', tableId: "601006Table1", tableName: "商品组信息表", columnProp: 'updateDate', headerAlign: "center", align: "center", columnLabel: '更新时间', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 170 }, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table1UpdateBy', tableId: "601006Table1", tableName: "商品组信息表", columnProp: 'updateBy', headerAlign: "center", align: "center", columnLabel: '更新人', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, ], stdProcessColumnList: [ { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2OperationNo', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'operationNo', headerAlign: "center", align: "center", columnLabel: '工序号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2OperationName', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'operationName', headerAlign: "center", align: "center", columnLabel: '工序名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 170, isVisible: true // 控制显示的属性
}, { functionId: 601006, serialNumber: '601006Table2WorkCenterNo', tableId: '601006Table2', tableName: '标准工序表', columnProp: 'setupCrewSize', headerAlign: 'center', align: 'right', columnLabel: '调机过程人数', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2SetupLaborClassDesc', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'setupLaborClassNo', headerAlign: "center", align: "center", columnLabel: '调机时人员等级编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 118, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2SetupLaborClassDesc', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'setupLaborClassDesc', headerAlign: "center", align: "left", columnLabel: '调机时人员等级描述', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 118, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2MachCycleTime', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'machCycleTime', headerAlign: "center", align: "right", columnLabel: '机器处理时间', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: false // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2MachRunFactor', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'machRunFactor', headerAlign: "center", align: "right", columnLabel: '机器单位产出', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: false // 控制显示的属性
}, { functionId: 601006, serialNumber: '601006Table2WorkCenterNo', tableId: '601006Table2', tableName: '标准工序表', columnProp: 'crewSize', headerAlign: 'center', align: 'right', columnLabel: '生产过程人数', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2LaborClassDesc', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'laborClassNo', headerAlign: "center", align: "center", columnLabel: '人员等级编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2LaborClassDesc', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'laborClassDesc', headerAlign: "center", align: "center", columnLabel: '人员等级描述', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2LaborCycleTime', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'laborCycleTime', headerAlign: "center", align: "right", columnLabel: '人工处理时间', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: false // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2LaborRunFactor', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'laborRunFactor', headerAlign: "center", align: "right", columnLabel: '人工单位产出', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: false // 控制显示的属性
}, { functionId: 601006, serialNumber: '601006Table2WorkCenterNo', tableId: '601006Table2', tableName: '标准工序表', columnProp: 'workCenterNo', headerAlign: 'center', align: 'center', columnLabel: '加工中心编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: true // 控制显示的属性
}, { functionId: 601006, serialNumber: '601006Table2WorkCenterDesc', tableId: '601006Table2', tableName: '标准工序表', columnProp: 'workCenterDesc', headerAlign: 'center', align: 'center', columnLabel: '加工中心名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 170, isVisible: true // 控制显示的属性
}, ], stdProcessColumnList1: [ { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2OperationNo', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'operationNo', headerAlign: "center", align: "center", columnLabel: '工序号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 50, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2OperationName', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'operationName', headerAlign: "center", align: "center", columnLabel: '工序名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 170, isVisible: true // 控制显示的属性
}, { functionId: 601006, serialNumber: '601006Table2WorkCenterNo', tableId: '601006Table2', tableName: '标准工序表', columnProp: 'setupCrewSize', headerAlign: 'center', align: 'right', columnLabel: '调机过程人数', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2SetupLaborClassDesc', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'setupLaborClassNo', headerAlign: "center", align: "center", columnLabel: '调机时人员等级编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 118, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2SetupLaborClassDesc', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'setupLaborClassDesc', headerAlign: "center", align: "center", columnLabel: '调机时人员等级描述', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 118, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2MachCycleTime', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'machCycleTime', headerAlign: "center", align: "right", columnLabel: '机器处理时间', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: false // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2MachRunFactor', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'machRunFactor', headerAlign: "center", align: "right", columnLabel: '机器单位产出', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: false // 控制显示的属性
}, { functionId: 601006, serialNumber: '601006Table2WorkCenterNo', tableId: '601006Table2', tableName: '标准工序表', columnProp: 'crewSize', headerAlign: 'center', align: 'right', columnLabel: '生产过程人数', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2LaborClassDesc', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'laborClassNo', headerAlign: "center", align: "center", columnLabel: '人员等级编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2LaborClassDesc', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'laborClassDesc', headerAlign: "center", align: "center", columnLabel: '人员等级描述', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: true // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2LaborCycleTime', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'laborCycleTime', headerAlign: "center", align: "right", columnLabel: '人工处理时间', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: false // 控制显示的属性
}, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table2LaborRunFactor', tableId: "601006Table2", tableName: "标准工序表", columnProp: 'laborRunFactor', headerAlign: "center", align: "right", columnLabel: '人工单位产出', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: false // 控制显示的属性
}, { functionId: 601006, serialNumber: '601006Table2WorkCenterNo', tableId: '601006Table2', tableName: '标准工序表', columnProp: 'workCenterNo', headerAlign: 'center', align: 'center', columnLabel: '加工中心编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, isVisible: true // 控制显示的属性
}, { functionId: 601006, serialNumber: '601006Table2WorkCenterDesc', tableId: '601006Table2', tableName: '标准工序表', columnProp: 'workCenterDesc', headerAlign: 'center', align: 'center', columnLabel: '加工中心名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 170, isVisible: true // 控制显示的属性
}, ], columnItemList: [ { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table3ItemID', tableId: "601006Table3", tableName: "物料属性表", columnProp: 'itemNo', headerAlign: "center", align: "center", columnLabel: '属性编码', columnHidden: false, columnImage: false, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table3PropertiesItemDesc', tableId: "601006Table3", tableName: "物料属性表", columnProp: 'itemDesc', headerAlign: "center", align: "center", columnLabel: '属性名称', columnHidden: false, columnImage: false, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table3ValueType', tableId: "601006Table3", tableName: "物料属性表", columnProp: 'valueType', headerAlign: "center", align: "center", columnLabel: '属性类型', columnHidden: false, columnImage: false, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 601006, serialNumber: '601006Table3ValueChooseFlag', tableId: "601006Table3", tableName: "物料属性表", columnProp: 'textValue', headerAlign: "center", align: "center", columnLabel: '属性值', columnHidden: false, columnImage: false, status: true, fixed: '', columnWidth: 100, }, // {
// userId: this.$store.state.user.name,
// functionId: 601006,
// serialNumber: '601006Table3ValueChooseFlag',
// tableId: "601006Table3",
// tableName: "物料属性表",
// columnProp: 'numValue',
// headerAlign: "center",
// align: "center",
// columnLabel: '数字值',
// columnHidden: false,
// columnImage: false,
// status: true,
// fixed: '',
// columnWidth: 70,
// },
], rules: { bu: [ { required: true, message: ' ', trigger: ['blur', 'change'] } ], productGroupId: [ { required: true, message: ' ', trigger: 'change' } ], productGroupName: [ { required: true, message: ' ', trigger: 'change' } ], active:[ { required: true, message: ' ', trigger: 'change' } ], type:[ { required: true, message: ' ', trigger: 'change' } ], seqNo:[ { required: true, message: ' ', trigger: 'change' } ], conditionDesc:[ { required: true, message: ' ', trigger: 'change' } ], itemNo:[ { required: true, message: ' ', trigger: 'change' } ] }, // ======== 模态框开关控制 ========
authSearch: false, authSave: false, authUpdate: false, authDelete: false, modalFlag: false, stdProcessFlag: false, stdProcessFlag1: false, productGroupPtmFlag: false, ptmSaveFlag: false, ptmConditionItemUpdateFlag: false, ptmConditionProcessUpdateFlag: false, modalDisableFlag: false, menuId: this.$route.meta.menuId, } },
mounted () { this.$nextTick(() => { this.height = window.innerHeight - 180 }) },
created () { // 按钮控制
this.getButtonAuthData() // 获取用户的 site 和 bu
this.getSiteAndBuByUserName() // 动态列
this.getTableUserColumn(this.$route.meta.menuId+'table1',1) if (!this.authSearch) { // 获取数据列表
this.getDataList() } },
methods: { handleColumnResize(newWidth, oldWidth, column, event){ let inData= this.columnList.filter(item => item.columnProp === column.property)[0] inData.columnWidth=newWidth updateColumnSize(inData).then(({data}) => { if (data.code === 0) { console.log("栏位宽度保存成功!") } }) }, // 获取用户的bu
getSiteAndBuByUserName () { let tempData = { username: this.$store.state.user.name, } getSiteAndBuByUserName(tempData).then(({data}) => { if (data.code === 0) { this.userBuList = data.rows } }) },
// 每页数
sizeChangeHandle (val) { this.pageSize = val this.pageIndex = 1 this.getDataList() },
// 当前页
currentChangeHandle (val) { this.pageIndex = val this.getDataList() },
//导出excel
async createExportData () { this.searchData.limit = -1 this.searchData.page = 1 await productGroupInformationSearch(this.searchData).then(({data}) => { this.exportList = data.page.list }) return this.exportList },
startDownload() { },
finishDownload() { },
fields () { let json = "{" this.columnList.forEach((item, index) => { if (index == this.columnList.length - 1) { json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" } else { json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + "," } }) json += "}" let s = eval("(" + json + ")") return s },
// ======== chooseList相关方法 ========
/** * 获取基础数据列表S * @param val * @param type */ getBaseList (val, type) { this.tagNo = val // this.tempCodeNo = this.ptmModalData.itemNo
this.$nextTick(() => { let strVal = '' let conSql = '' if (val === 219) { strVal = this.ptmModalData.itemNo } if (this.ptmModalData.bu !== null && this.ptmModalData.bu !== '' && this.ptmModalData.bu !== undefined) { conSql = " and site = '" + this.ptmModalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.ptmModalData.bu.split('_')[1] + "'" this.$refs.baseList.init(val, strVal, conSql) } else { this.$refs.baseList.init(val, strVal) } }) }, /** * 列表方法的回调 * @param val */ getBaseData (val) { console.log(val) if (this.tagNo === 219) { // if (this.modalData.flag === '2') {
// if (val.code_no != this.tempCodeNo) {
// this.$confirm(`更换属性模板将替换下方物料属性数据,请确认?`, '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// this.ptmModalData.itemNo = val.code_no
// }).catch(() => {
// })
// }
// } else {
this.ptmModalData.itemNo = val.code_no this.ptmModalData.itemDesc = val.code_desc // }
} },
// 获取数据列表
getDataList () { this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex productGroupInformationSearch(this.searchData).then(({data}) => { if (data.code === 0) { this.dataList = data.page.list this.pageIndex = data.page.currPage this.pageSize = data.page.pageSize this.totalPage = data.page.totalCount this.dataList.forEach((item) => { if (item.type !== '2'){ item.yieldRate = '0' } }) } }) },
addModal () { this.modalData = { flag: '1', title: '商品组新增', bu: this.userBuList[0].buNo, buNo: '', site: '', productGroupId: '', productGroupName: '', active: 'Y', type: '', yieldRate: '', createBy: this.$store.state.user.name, } this.modalDisableFlag = false this.modalFlag = true },
/** * 商品信息编辑模态框 * @param row */ updateModal (row) { this.modalData = { flag: '2', title: '商品组编辑', site: row.site, bu: row.site + '_' + row.buNo, buNo: row.buNo, productGroupId: row.productGroupId, productGroupName: row.productGroupName, active: row.active, type: row.type, yieldRate: row.yieldRate, updateBy: this.$store.state.user.name, } this.modalDisableFlag = true this.modalFlag = true },
// ======== 新增/编辑/删除方法 ========
/** * 商品信息新增/编辑 */ saveData () { if (this.modalData.bu === '' || this.modalData.bu == null) { this.$message.warning('请选择BU!') return } if (this.modalData.productGroupId === '' || this.modalData.productGroupId == null) { this.$message.warning('请填写商品组编码!') return } if (this.modalData.productGroupName === '' || this.modalData.productGroupName == null) { this.$message.warning('请填写商品组名称!') return } if (this.modalData.active === '' || this.modalData.active == null) { this.$message.warning('请选择是否可用!') return } if (this.modalData.type === '' || this.modalData.type == null) { this.$message.warning('请选择商品组!') return } // yieldRate 0 – 100(包含100),而且需要支持小数,保留2位小数
if (this.modalData.type === '2') { if (this.modalData.yieldRate === '' || this.modalData.yieldRate == null) { this.$message.warning('请填写Yield Rate!') return } if (this.modalData.yieldRate <= 0 || this.modalData.yieldRate >= 100) { this.$message.warning('Yield Rate范围为0-100!') return } if (!/^\d+(\.\d{1,2})?$/.test(this.modalData.yieldRate)) { this.$message.warning('Yield Rate最多保留两位小数!') return } } if (this.modalData.flag === '1') { productGroupInformationSave(this.modalData).then(({data}) => { if (data && data.code === 0) { this.getDataList() this.modalFlag = false this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) } else { productGroupInformationEdit(this.modalData).then(({data}) => { if (data && data.code === 0) { this.getDataList() this.modalFlag = false this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) } },
/** * 商品信息删除 */ delModal (row) { this.$confirm(`是否删除这条商品组信息?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { productGroupInformationDelete(row).then(({data}) => { if (data && data.code === 0) { this.getDataList() this.partSelections = [] this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }).catch(() => { }) },
stdProcessModal (row) { this.productGroupCurrentRow = JSON.parse(JSON.stringify(row)); this.searchProductGroupStdProcess() this.isVisible1 = false this.stdProcessFlag = true },
addStdProcessModal () { this.searchData2.limit = -1 this.searchData2.page = 1 this.searchData2.buNo = this.productGroupCurrentRow.buNo this.searchData2.site = this.productGroupCurrentRow.site searchStandardRoutingOperationList(this.searchData2).then(({data}) => { if (data.code === 0) { let operationIds = [] this.stdProcessList.forEach((item) => { operationIds.push(item.operationId) }) data.page.list.forEach((item) => { if (!operationIds.includes(item.id)) { this.stdProcessList1.push(item) } }) this.pageIndex = data.page.currPage this.pageSize = data.page.pageSize this.totalPage = data.page.totalCount } }) this.stdProcessFlag1 = true },
closeStdProcessDialog () { this.searchData1 = { site: '', userName: this.$store.state.user.name, buDesc: '', productGroupId: '', productGroupName: '', active: '', type: '', operationNo: '', operationName: '', page: 1, limit: 10 } this.stdProcessList = [] },
closeStdProcess1Dialog () { this.stdProcessList1 = [] },
// 多选
selectionChangeHandle (val) { this.stdProcessList1Selections = val },
searchProductGroupStdProcess () { this.productGroupCurrentRow.userName = this.$store.state.user.name this.productGroupCurrentRow.operationNo = this.searchData1.operationNo this.productGroupCurrentRow.operationName = this.searchData1.operationName searchProductGroupStdProcess(this.productGroupCurrentRow).then(({data}) => { if (data.code === 0) { this.stdProcessList = data.rows } }) },
saveStdProcessData () { if (this.stdProcessList1Selections.length === 0) { this.$message.warning('请选择工序!') return } let tempData = { productGroupId: this.productGroupCurrentRow.productGroupId, stdProcessAddList: this.stdProcessList1Selections, createBy: this.$store.state.user.name } saveStdProcessData(tempData).then(({data}) => { if (data.code === 0) { this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) this.searchProductGroupStdProcess() this.stdProcessFlag1 = false } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) },
delProductGroupStdProcessModal (row) { this.$confirm(`是否删除这条标准工序信息?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { delProductGroupStdProcess(row).then(({data}) => { if (data.code === 0) { this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) this.searchProductGroupStdProcess() } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }).catch(() => { }) },
ProcessTimeMatrixModal (row) { this.productGroupCurrentRow = JSON.parse(JSON.stringify(row)); this.searchProductGroupPtmCondition() this.isVisible1 = true this.productGroupPtmFlag = true },
currentConditionChangeHandle (row) { this.productGroupConditionCurrentRow = { conditionId: row.conditionId, site: row.site, buNo: row.buNo, bu: row.site + '_' + row.buNo, } this.searchProductGroupPtmConditionItemProcess() },
searchProductGroupPtmCondition (seqNo) { searchProductGroupPtmCondition(this.productGroupCurrentRow).then(({data}) => { if (data.code === 0) { this.productGroupPtmConditionList = data.rows1 this.activeName = 'first' // this.productGroupPtmConditionItemList = data.rows2
// this.productGroupPtmConditionProcessList = data.rows3
} let length = this.productGroupPtmConditionList.length; if (length > 0) { if (seqNo) { this.$refs.conditionTable.setCurrentRow(this.productGroupPtmConditionList[length-1]) this.currentConditionChangeHandle(this.productGroupPtmConditionList[length-1]) } else { this.$refs.conditionTable.setCurrentRow(this.productGroupPtmConditionList[0]) this.currentConditionChangeHandle(this.productGroupPtmConditionList[0]) } } else { this.productGroupPtmConditionItemList = [] this.productGroupPtmConditionProcessList = [] } }) },
searchProductGroupPtmConditionItemProcess(){ let inData = { conditionId: this.productGroupConditionCurrentRow.conditionId, site: this.productGroupConditionCurrentRow.site, buNo: this.productGroupConditionCurrentRow.buNo, recordType : 'IP', } searchProductGroupPtmConditionItemProcess(inData).then(({data}) => { if (data.code === 0) { this.productGroupPtmConditionItemList = data.rows1 this.productGroupPtmConditionProcessList = data.rows2 } }) },
saveProductGroupPtmModal () { if (this.productGroupPtmConditionList.length > 0) { let seqNos = [] this.productGroupPtmConditionList.forEach((item) => { seqNos.push(item.seqNo) }) this.ptmModalData.seqNo = Math.max.apply(null, seqNos) + 1 } else { this.ptmModalData.seqNo = 1 } this.ptmModalData.buNo = this.productGroupCurrentRow.buNo this.ptmModalData.site = this.productGroupCurrentRow.site this.ptmModalData.bu = this.ptmModalData.site + '_' + this.ptmModalData.buNo this.ptmSaveFlag = true },
async saveProductGroupPtm () { console.log(this.ptmModalData) // 确保 modelBlur 完成
await this.modelBlur(219); if (this.ptmModalData.conditionDesc === '' || this.ptmModalData.conditionDesc == null) { this.$message.warning('请填写条件描述!') return } if (this.ptmModalData.itemNo === '' || this.ptmModalData.itemNo == null) { this.$message.warning('请选择属性模板!') return } if (this.ptmModalData.itemDesc === '' || this.ptmModalData.itemDesc == null) { this.$alert('该属性模板不存在!', '错误', { confirmButtonText: '确定' }) return } let tempData = { site: this.productGroupCurrentRow.site, buNo: this.productGroupCurrentRow.buNo, recordType : 'IP', productGroupId: this.productGroupCurrentRow.productGroupId, seqNo: this.ptmModalData.seqNo, conditionDesc: this.ptmModalData.conditionDesc, createBy: this.$store.state.user.name, userName: this.$store.state.user.name } saveProductGroupPtm(tempData).then(({data}) => { if (data.code === 0) { this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) this.searchProductGroupPtmCondition(tempData.seqNo) this.ptmSaveFlag = false } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) },
delProductGroupPtmModal (row) { this.$confirm(`是否删除这条信息?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { delProductGroupPtm(row).then(({data}) => { if (data.code === 0) { this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) this.searchProductGroupPtmCondition() } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }).catch(() => { }) },
closeProductGroupPtmDialog (){ this.productGroupPtmConditionList = [] this.productGroupPtmConditionItemList = [] this.productGroupPtmConditionProcessList = [] this.productGroupPtmFlag = false this.activeName = 'first' },
closeProductGroupPtmSaveDialog () { this.ptmModalData = { conditionDesc: '', itemNo: '', itemDesc: '', createBy: this.$store.state.user.name, } },
updatePtmConditionItemModal () { this.copyItemAttributeList = JSON.parse(JSON.stringify(this.productGroupPtmConditionItemList)) this.ptmConditionItemUpdateFlag = true },
/** * 编辑属性值 */ updatePtmConditionItemValue () { let tempData = { ptmItemAddList: JSON.parse(JSON.stringify(this.copyItemAttributeList)) } updatePtmConditionItemValue(tempData).then(({data}) => { if (data && data.code === 0) { this.searchProductGroupPtmConditionItemProcess() this.closePtmConditionItemUpdateDialog() this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } this.loading = false }).catch((error) => { this.$message.error(error) this.loading = false }) },
closePtmConditionItemUpdateDialog () { this.copyItemAttributeList = [] this.ptmConditionItemUpdateFlag = false },
updatePtmConditionProcessModal () { this.copyProcessAttributeList = JSON.parse(JSON.stringify(this.productGroupPtmConditionProcessList)) this.ptmConditionProcessUpdateFlag = true },
updatePtmConditionProcessValue () { let tempData = { updateBy: this.$store.state.user.name, ptmProcessAddList: JSON.parse(JSON.stringify(this.copyProcessAttributeList)) } updatePtmConditionProcessValue(tempData).then(({data}) => { if (data && data.code === 0) { this.searchProductGroupPtmConditionItemProcess() this.closePtmConditionProcessUpdateDialog() this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } this.loading = false }).catch((error) => { this.$message.error(error) this.loading = false }) },
closePtmConditionProcessUpdateDialog () { this.copyProcessAttributeList = [] this.ptmConditionProcessUpdateFlag = false },
// 机器单位产出改变
changeMachRunFactor (row) { row.laborRunFactor = row.machRunFactor },
// 机器处理时间改变
changeMachCycleTime (row) { // 人工处理时间赋值
row.laborCycleTime = row.machCycleTime // 计算机器单位产出
if (row.machCycleTime === 0 || row.machCycleTime === '0') { row.machRunFactor = 0 } else if(row.machCycleTime === '' || row.machCycleTime === null) { row.machRunFactor = '' } else { row.machRunFactor = (1/row.machCycleTime).toFixed(2) } // 人工单位产出赋值
row.laborRunFactor = row.machRunFactor },
// 人工处理时间改变
changeLaborCycleTime (row) { // 计算人工单位产出
if (row.laborCycleTime === 0 || row.laborCycleTime === '0') { row.laborRunFactor = 0 } else if(row.laborCycleTime === '' || row.laborCycleTime === null) { row.laborRunFactor = '' } else { row.laborRunFactor = (1/row.laborCycleTime).toFixed(2) } },
// 属性输入校验
async modelBlur(tagNo) { if (this.ptmModalData.itemNo != null && this.ptmModalData.itemNo !== '') { let tempData = { tagno: tagNo, conditionSql: " and code_no = '" + this.ptmModalData.itemNo + "'" + " and site = '" + this.ptmModalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.ptmModalData.bu.split('_')[1] + "'" };
// 返回 Promise
return verifyData(tempData).then(({ data }) => { if (data && data.code === 0) { if (data.baseListData.length > 0) { this.ptmModalData.itemDesc = data.baseListData[0].code_desc; } else { this.ptmModalData.itemDesc = ''; } } else { this.$message.warning(data.msg); this.ptmModalData.itemDesc = ''; } }).catch(error => { console.error(error); this.$message.error('校验失败,请重试'); this.ptmModalData.itemDesc = ''; }); } else { this.ptmModalData.itemDesc = ''; return Promise.resolve(); // 如果 itemNo 为空,直接返回 resolved Promise
} },
// 列表表格选择替换
tabClick (tab, event) { // 刷新列表数据
this.searchProductGroupPtmConditionItemProcess() },
// 动态列开始 获取 用户保存的 格式列
async getTableUserColumn(tableId, columnId) { let queryTableUser = { userId: this.$store.state.user.name, functionId: this.$route.meta.menuId, tableId: tableId, status: true, languageCode: this.$i18n.locale } await getTableUserListLanguage(queryTableUser).then(({data}) => { if (data.rows.length > 0) { switch (columnId) { case 1: this.columnList = data.rows break; } } else { this.getColumnList(tableId, columnId) } }) },
// 获取 tableDefault 列
async getColumnList (tableId, columnId) { let queryTable= { functionId: this.$route.meta.menuId, tableId: tableId, languageCode: this.$i18n.locale } await getTableDefaultListLanguage(queryTable).then(({data}) => { if (!data.rows.length === 0) { switch (columnId) { case 1: this.columnList = data.rows break; } } }) },
//获取按钮的权限数据
getButtonAuthData () { let searchFlag = this.isAuth(this.menuId+":search") let saveFlag = this.isAuth(this.menuId+":save") let updateFlag = this.isAuth(this.menuId+":update") let deleteFlag = this.isAuth(this.menuId+":delete") //处理页面的权限数据
this.authSearch = !searchFlag this.authSave = !saveFlag this.authUpdate = !updateFlag this.authDelete = !deleteFlag }, }}</script>
<style scoped lang="scss">/deep/ .customer-tab .el-tabs__content { padding: 0px !important; height: 100%;}
/deep/ .table-container { border: 1px solid #e0e0e0; border-radius: 4px; padding: 10px; margin-bottom: 10px;}
.el-table /deep/ .cell{ height: auto; line-height: 1.5;}
.numInput /deep/ .el-input__inner{ text-align: right;}/deep/ .inlineNumber input::-webkit-outer-spin-button,/deep/ .inlineNumber input::-webkit-inner-spin-button { -webkit-appearance: none;
}/deep/ .inlineNumber input[type="number"]{ -moz-appearance: textfield; padding-right: 5px !important;}</style>
|