| | |
| | | <template /> |
| | | <template> |
| | | <div> |
| | | <div class="body" :style="{height:mainHeight+'px'}"> |
| | | <div class="bodyTopButtonGroup" style="justify-content: space-between"> |
| | | <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button> |
| | | <!-- <el-button icon="el-icon-download" @click="upload">导入</el-button>--> |
| | | </div> |
| | | |
| | | <div class="bodyTopFormGroup"> |
| | | <el-form |
| | | ref="form" |
| | | :model="form" |
| | | label-width="100px" |
| | | inline |
| | | style="display: flex;justify-content: space-between" |
| | | > |
| | | <div class="elForm"> |
| | | <el-form-item label-width="70px" label="母件编码" style=" display: flex;"> |
| | | <el-input v-model="form.parentpartcode" placeholder="请输入" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="母件名称" style=" display: flex;"> |
| | | <el-input v-model="form.parentpartname" placeholder="请输入" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="母件规格" style=" display: flex;"> |
| | | <el-input v-model="form.parentpartspec" placeholder="请输入" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="存货类型" style=" display: flex;"> |
| | | <el-select v-model="form.parttype" style="width: 200px" placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in parttypeArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-show="isExpandForm" label-width="70px" label="版本编号" style=" display: flex;"> |
| | | <el-input v-model="form.version" placeholder="请输入" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item v-show="isExpandForm" label="创建人员" style=" display: flex;"> |
| | | <el-input v-model="form.createusername" style="width: 200px" placeholder="请输入" /> |
| | | </el-form-item> |
| | | <el-form-item v-show="isExpandForm" label="创建日期" style=" display: flex;align-items: center"> |
| | | <el-date-picker |
| | | v-model="form.createdate" |
| | | type="daterange" |
| | | :clearable="false" |
| | | class="timeMini" |
| | | range-separator="~" |
| | | start-placeholder="开始日期" |
| | | style="width: 200px;display: flex;line-height: 34px ;height: 34px ;" |
| | | end-placeholder="结束日期" |
| | | size="mini" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item v-show="isExpandForm" label="启用状态" style=" display: flex;"> |
| | | <el-select v-model="form.status" style="width: 200px" placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in openTypeArr" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened?'5%':'10%'}"> |
| | | <el-button type="primary" icon="el-icon-search" @click="search">查询</el-button> |
| | | <el-button 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"> |
| | | <el-table |
| | | ref="tableDataRef" |
| | | class="tableFixed" |
| | | :data="tableData" |
| | | :height="isExpandForm?tableHeight:(tableHeight+40)+'px'" |
| | | border |
| | | :row-class-name="tableRowClassName" |
| | | :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}" |
| | | highlight-current-row |
| | | :header-cell-style="this.$headerCellStyle" |
| | | :cell-style="this.$cellStyle" |
| | | @sort-change="sortChange" |
| | | > |
| | | <el-table-column |
| | | prop="RowNum" |
| | | width="50" |
| | | fixed |
| | | label="序号" |
| | | /> |
| | | <el-table-column |
| | | prop="partcode" |
| | | label="母件编码" |
| | | min-width="160" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="partname" |
| | | label="母件名称" |
| | | min-width="160" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="partspec" |
| | | label="母件规格" |
| | | min-width="160" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="stocktype_name" |
| | | label="存货类型" |
| | | width="110" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="uom_name" |
| | | label="计量单位" |
| | | width="110" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="quantity" |
| | | label="基础数量" |
| | | width="110" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="status" |
| | | width="110" |
| | | show-tooltip-when-overflow |
| | | label="启用状态" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.status==='Y'"> |
| | | <svg-icon icon-class="circleYes" style="margin-right: 2px" /> |
| | | 是 |
| | | </div> |
| | | <div v-if="row.status==='N'"> |
| | | <svg-icon icon-class="circleNo" style="margin-right: 2px" /> |
| | | 否 |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="startdate" |
| | | label="启用日期" |
| | | width="110" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.startdate">{{ row.startdate.substring(0, 11) }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="version" |
| | | label="版本号" |
| | | width="110" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="username" |
| | | label="创建人员" |
| | | width="110" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="lm_date" |
| | | label="创建时间" |
| | | width="110" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.lm_date">{{ row.lm_date.substring(0, 11) }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="操作" |
| | | width="120" |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div class="operationClass"> |
| | | <el-tooltip class="item" effect="dark" content="编辑" placement="top"> |
| | | <i 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 class="el-icon-delete" @click="del(row)" /> |
| | | </el-tooltip> |
| | | <el-tooltip class="item" effect="dark" content="预览" placement="top"> |
| | | <i |
| | | class="el-icon-view" |
| | | style="margin-left:15px;cursor: pointer;color:#42b983 " |
| | | @click="edit('preview',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="getBoIventorySelect" |
| | | /> |
| | | </div> |
| | | |
| | | <el-dialog |
| | | :title="operation==='add'?'新增':(operation==='edit'?'编辑':'预览')" |
| | | :visible.sync="dialogVisible" |
| | | width="1100px" |
| | | :close-on-click-modal="false" |
| | | top="5vh" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | <div> |
| | | <i class="el-icon-s-operation" style="color:#42b983;margin: -20px 10px 20px 0" />母件信息: |
| | | </div> |
| | | <div style="width: 800px;"> |
| | | <el-form |
| | | ref="dialogForm" |
| | | inline |
| | | :rules="dialogFormRules" |
| | | :model="dialogForm" |
| | | label-width="80px" |
| | | style="margin-left: 20px;" |
| | | > |
| | | <el-form-item label="母件编码" prop="parentpartcode"> |
| | | <el-select |
| | | v-model="dialogForm.parentpartcode" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | :popper-append-to-body="false" |
| | | :disabled="operation!=='add'" |
| | | @change="partSelectChange" |
| | | > |
| | | <el-option |
| | | v-for="item in PartSelectArr" |
| | | :key="item.partcode" |
| | | :label="item.partcode" |
| | | :value="item.partcode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="母件名称" prop="parentpartname"> |
| | | <el-select |
| | | v-model="dialogForm.parentpartname" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | :disabled="operation!=='add'" |
| | | :popper-append-to-body="false" |
| | | @change="partSelectChange" |
| | | > |
| | | <el-option |
| | | v-for="item in PartSelectArr" |
| | | :key="item.partcode" |
| | | :label="item.partname" |
| | | :value="item.partcode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="母件规格" prop="parentpartspec"> |
| | | <el-input v-model="dialogForm.parentpartspec" disabled style="width: 200px" /> |
| | | <!-- <el-select--> |
| | | <!-- v-model="dialogForm.parentpartspec"--> |
| | | <!-- style="width: 200px"--> |
| | | <!-- placeholder="请选择"--> |
| | | <!-- :popper-append-to-body="false"--> |
| | | <!-- >--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in PartSelectArr"--> |
| | | <!-- :key="item.partcode"--> |
| | | <!-- :label="item.partcode"--> |
| | | <!-- :value="item.partcode"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | </el-form-item> |
| | | <el-form-item label="计量单位" prop="uomcode"> |
| | | <el-select |
| | | v-model="dialogForm.uomcode" |
| | | disabled |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in openTypeArr" |
| | | :key="item.partcode" |
| | | :label="item.uom_code" |
| | | :value="item.partcode" |
| | | /> |
| | | </el-select> |
| | | <!-- <el-input v-model="dialogForm.uomcode" readonly style="width: 200px" />--> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="存货类型" prop="uomcode">--> |
| | | <!-- <el-input v-model="dialogForm.chlx" readonly style="width: 200px" />--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item label="基础数量" prop="quantity"> |
| | | <el-input |
| | | v-model="dialogForm.quantity" |
| | | :disabled="operation==='preview'" |
| | | oninput="value=value.replace(/[^0-9.]/g,'')" |
| | | style="width: 200px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item prop="status" label="启用状态"> |
| | | <el-select |
| | | v-model="dialogForm.status" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | :disabled="operation==='preview'" |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in openTypeArr" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="启用日期" prop="startdate"> |
| | | <el-date-picker |
| | | v-model="dialogForm.startdate" |
| | | style="width: 200px" |
| | | type="date" |
| | | :disabled="operation!=='add'" |
| | | value-format="yyyy-MM-dd" |
| | | :clearable="false" |
| | | placeholder="选择日期" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="版本号" prop="version"> |
| | | <el-input v-model="dialogForm.version" disabled style="width: 200px" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <div> |
| | | <i class="el-icon-s-operation" style="color:#42b983;margin: -20px 10px 10px 0" />子件信息: |
| | | </div> |
| | | <el-button |
| | | v-if="operation!=='preview'" |
| | | type="primary" |
| | | style="margin-left: 20px;margin-bottom: 10px;" |
| | | icon="el-icon-circle-plus-outline" |
| | | :disabled="dialogForm.parentpartcode===''" |
| | | @click="addDialog()" |
| | | >新增 |
| | | </el-button> |
| | | <el-table |
| | | ref="dialogTableDataArrRef" |
| | | class="tableFixed" |
| | | :data="dialogTableDataArr" |
| | | :height="tableHeight-300" |
| | | :style="{width: 100+'%',height:tableHeight-300+'px',}" |
| | | border |
| | | :row-class-name="tableRowClassName" |
| | | highlight-current-row |
| | | :header-cell-style="this.$headerCellStyle" |
| | | :cell-style="this.$cellStyle" |
| | | > |
| | | <el-table-column |
| | | width="50" |
| | | label="行号" |
| | | prop="SEQ" |
| | | fixed |
| | | /> |
| | | <el-table-column |
| | | prop="SMATERIRL_CODE" |
| | | label="子件编码" |
| | | show-tooltip-when-overflow |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-select |
| | | v-if="row.isVisible===1" |
| | | v-model="row.SMATERIRL_CODE" |
| | | placeholder="请选择" |
| | | @change="val=>tableChange(val,row)" |
| | | > |
| | | <el-option |
| | | v-for="item in PartSelectArr" |
| | | :key="item.partname" |
| | | :label="item.partcode" |
| | | :value="item.partname" |
| | | /> |
| | | </el-select> |
| | | <div v-if="row.isVisible===0">{{ row.SMATERIRL_CODE }}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="SMATERIRL_NAME" |
| | | label="子件名称" |
| | | |
| | | show-tooltip-when-overflow |
| | | > |
| | | |
| | | <template slot-scope="{row}"> |
| | | <el-select |
| | | v-if="row.isVisible===1" |
| | | v-model="row.SMATERIRL_NAME" |
| | | placeholder="请选择" |
| | | @change="val=>tableChange(val,row)" |
| | | > |
| | | <el-option |
| | | v-for="item in PartSelectArr" |
| | | :key="item.partcode" |
| | | :label="item.partname" |
| | | :value="item.partcode" |
| | | /> |
| | | </el-select> |
| | | <div v-if="row.isVisible===0">{{ row.SMATERIRL_NAME }}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="SMATERIRL_SPEC" |
| | | label="子件规格" |
| | | width="110" |
| | | show-tooltip-when-overflow |
| | | /> |
| | | <el-table-column |
| | | prop="uomcode" |
| | | label="计量单位" |
| | | width="110" |
| | | /> |
| | | <el-table-column |
| | | prop="BASE_QUANTITY" |
| | | label="基本用量" |
| | | width="110" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-input |
| | | v-if="row.isVisible===1" |
| | | v-model="row.BASE_QUANTITY" |
| | | oninput="value=value.replace(/[^0-9.]/g,'')" |
| | | placeholder="请输入" |
| | | @input="val=>inputChange(val,row)" |
| | | /> |
| | | <div v-if="row.isVisible===0">{{ row.BASE_QUANTITY }}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="LOSS_QUANTITY" |
| | | label="损耗率%" |
| | | width="110" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-input |
| | | v-if="row.isVisible===1" |
| | | v-model="row.LOSS_QUANTITY" |
| | | oninput="value=value.replace(/[^0-9.]/g,'')" |
| | | placeholder="请输入" |
| | | @input="val=>inputChange(val,row)" |
| | | /> |
| | | <div v-if="row.isVisible===0">{{ row.LOSS_QUANTITY }}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="TOTAL_QUANTITY" |
| | | label="实际用量" |
| | | width="110" |
| | | /> |
| | | <el-table-column |
| | | prop="PN_TYPE" |
| | | label="属性" |
| | | width="110" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-select v-if="row.isVisible===1" v-model="row.PN_TYPE" placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in sxArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | <div v-if="row.isVisible===0">{{ row.PN_TYPE === 'Z' ? '主料' : '辅料' }}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="operation!=='preview'" |
| | | label="操作" |
| | | width="120" |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div class="operationClass"> |
| | | <el-button v-if="row.isVisible===1" type="text" @click="saveRow(row)">保存</el-button> |
| | | <el-button v-if="row.isVisible===1" type="text" @click="cancelRow(row)">取消</el-button> |
| | | <el-button v-if="row.isVisible===0" type="text" @click="editRow(row)">编辑</el-button> |
| | | <el-button v-if="row.isVisible===0" type="text" @click="delRow(row)">删除</el-button> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <div class="footerButton"> |
| | | <el-button v-if="operation==='preview'" @click="dialogVisibleCancel">返 回</el-button> |
| | | <el-button v-if="operation!=='preview'" @click="dialogVisibleCancel">取 消</el-button> |
| | | <el-button |
| | | v-if="operation!=='preview'" |
| | | :loading="$store.state.app.buttonIsDisabled" |
| | | :disabled="$store.state.app.buttonIsDisabled" |
| | | type="primary" |
| | | @click="dialogVisibleConfirm" |
| | | >确 定</el-button> |
| | | </div> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <!--导入组件--> |
| | | <import-picker |
| | | ref="importPickerFunc" |
| | | class="importPickerClass" |
| | | :shows.sync="shows" |
| | | :title="title_value" |
| | | :colos="colos" |
| | | :code="code" |
| | | /> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import Pagination from '@/components/Pagination' |
| | | import ImportPicker from '@/components/ImportPicker' |
| | | import { handleDatetime } from '@/utils/global' |
| | | import { |
| | | AddUpdateBoIventory, |
| | | BoIventorySelect, |
| | | BoIventorySelectView, |
| | | DeleteBoIventory, MaterielDetailedVsion, |
| | | PartSelect, |
| | | StockTypeSelect |
| | | } from '@/api/zzmx' |
| | | |
| | | export default { |
| | | name: 'Wlqd' |
| | | name: 'Zzjg', |
| | | components: { |
| | | Pagination, ImportPicker |
| | | }, |
| | | data() { |
| | | return { |
| | | mouseHoverType: 'mouseout', |
| | | isExpandForm: false, |
| | | mainHeight: 0, |
| | | tableHeight: 0, |
| | | form: { |
| | | parentpartcode: '', // 母件编码 |
| | | parentpartname: '', // 母件名称 |
| | | parentpartspec: '', // 母件规格 |
| | | parttype: '', // 存货类型 |
| | | status: '', // 启用状态 |
| | | version: '', // 版本号 |
| | | createusername: '', // 创建人员 |
| | | createdate: '', // 创建日期 |
| | | prop: 'lm_date', // 排序字段 |
| | | order: 'desc', // 排序字段 |
| | | page: 1, // 第几页 |
| | | rows: 20 // 每页多少条 |
| | | }, |
| | | parttypeArr: [], // 存货类型 |
| | | openTypeArr: [// 启用状态 |
| | | { label: '是', value: 'Y' }, |
| | | { label: '否', value: 'N' } |
| | | ], |
| | | |
| | | total: 10, |
| | | tableData: [], |
| | | dialogVisible: false, |
| | | dialogForm: { |
| | | bomid: '', |
| | | parentpartcode: '', |
| | | parentpartname: '', |
| | | parentpartspec: '', |
| | | uomcode: '', |
| | | // chlx: '', |
| | | quantity: '', |
| | | status: '', |
| | | startdate: '', |
| | | version: '' |
| | | }, |
| | | operation: '', |
| | | dialogFormRules: { |
| | | parentpartcode: [ |
| | | { required: true, message: '请选择母件编码', trigger: ['blur', 'change'] } |
| | | ], |
| | | parentpartname: [ |
| | | { required: true, message: '请选择母件名称', trigger: ['blur', 'change'] } |
| | | ], |
| | | // parentpartspec: [ |
| | | // { required: true, message: '请选择母件规格', trigger: ['blur', 'change'] } |
| | | // ], |
| | | status: [ |
| | | { required: true, message: '请选择启用状态', trigger: ['blur', 'change'] } |
| | | ], |
| | | quantity: [ |
| | | { required: true, message: '请输入基础数量', trigger: ['blur', 'change'] } |
| | | ], |
| | | // uomcode: [ |
| | | // { required: true, message: '请输入计量单位', trigger: ['blur', 'change'] } |
| | | // ], |
| | | // version: [ |
| | | // { required: true, message: '请输入版本号', trigger: ['blur', 'change'] } |
| | | // ], |
| | | startdate: [ |
| | | { required: true, message: '请选择启用日期', trigger: ['blur', 'change'] } |
| | | ] |
| | | }, |
| | | PartSelectArrAll: [], // 产品所有值 |
| | | PartSelectArr: [], // 产品可选值 |
| | | PartSelectArrTemp: [], // 产品已选暂存值 |
| | | dialogTableDataArr: [], |
| | | sxArr: [ |
| | | { code: 'Z', name: '主料' }, |
| | | { code: 'F', name: '辅料' } |
| | | ], |
| | | |
| | | title_value: '数据导入 / 点检部位', |
| | | code: '4', |
| | | shows: false |
| | | |
| | | } |
| | | }, |
| | | watch: { |
| | | shows() { |
| | | if (!this.shows) { |
| | | this.getBoIventorySelect() |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.handleRequest() |
| | | }, |
| | | mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | }, |
| | | methods: { |
| | | handleRequest() { |
| | | this.getBoIventorySelect().then(res => { |
| | | if (res.code === '200') { |
| | | // this.getPartSelect() |
| | | this.getStockTypeSelect() |
| | | } |
| | | }) |
| | | }, |
| | | async getBoIventorySelect() { |
| | | let tempDate = this.form.createdate |
| | | if (tempDate.length > 0) { |
| | | tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) |
| | | } |
| | | |
| | | const data = { |
| | | parentpartcode: this.form.parentpartcode, |
| | | parentpartname: this.form.parentpartname, |
| | | parentpartspec: this.form.parentpartspec, |
| | | parttype: this.form.parttype, |
| | | status: this.form.status, |
| | | version: this.form.version, |
| | | createusername: this.form.createusername, |
| | | createdate: tempDate, |
| | | |
| | | prop: this.form.prop, // 排序字段 |
| | | order: this.form.order, // 排序字段 |
| | | page: this.form.page, // 第几页 |
| | | rows: this.form.rows // 每页多少条 |
| | | } |
| | | |
| | | const res = await BoIventorySelect(data) |
| | | this.tableData = res.data |
| | | this.total = res.count |
| | | return { code: res.code } |
| | | }, |
| | | // 获取母件编码名称等下拉接口 |
| | | async getPartSelect() { |
| | | const { data: res } = await PartSelect() |
| | | this.PartSelectArr = res |
| | | this.PartSelectArrAll = res |
| | | }, |
| | | // 获取存货类型下拉接口 |
| | | async getStockTypeSelect() { |
| | | const { data: res } = await StockTypeSelect() |
| | | this.parttypeArr = res |
| | | }, |
| | | partSelectChange(val) { |
| | | const res = this.PartSelectArr.find(item => item.partcode === val) |
| | | this.dialogForm.parentpartcode = res.partcode |
| | | this.dialogForm.parentpartname = res.partname |
| | | this.dialogForm.parentpartspec = res.partspec |
| | | this.dialogForm.uomcode = res.uom_code |
| | | |
| | | if (this.PartSelectArrTemp.length > 0) { |
| | | this.PartSelectArr.unshift(this.PartSelectArrTemp[0]) |
| | | this.PartSelectArrTemp.splice(0, 1) |
| | | } |
| | | |
| | | this.PartSelectArr.forEach((item, index) => { |
| | | if (item.partcode === val) { |
| | | this.PartSelectArrTemp.push(item) |
| | | this.PartSelectArr.splice(index, 1) |
| | | } |
| | | }) |
| | | this.getMaterielDetailedVsion(this.dialogForm.parentpartcode) |
| | | }, |
| | | async getMaterielDetailedVsion(parentpartcode) { |
| | | const { data: res } = await MaterielDetailedVsion({ parentpartcode }) |
| | | this.dialogForm.version = res |
| | | }, |
| | | // 排序改变时 |
| | | 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.getBoIventorySelect() |
| | | }, |
| | | // 查询 |
| | | search() { |
| | | this.getBoIventorySelect() |
| | | }, |
| | | // 导入按钮 |
| | | upload() { |
| | | this.shows = true |
| | | this.$refs.importPickerFunc.newDataFunc() |
| | | }, |
| | | colos() { |
| | | this.shows = false |
| | | }, |
| | | // 重置 |
| | | reset() { |
| | | this.form.parentpartcode = '' |
| | | this.form.parentpartname = '' |
| | | this.form.parentpartspec = '' |
| | | this.form.parttype = '' |
| | | this.form.status = '' |
| | | this.form.version = '' |
| | | this.form.createusername = '' |
| | | this.form.createdate = '' |
| | | this.getBoIventorySelect() |
| | | }, |
| | | |
| | | // 新增按钮 |
| | | add(operation) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | this.getPartSelect() |
| | | |
| | | this.dialogForm.startdate = handleDatetime(new Date()) |
| | | console.log(this.dialogForm.startdate, 7) |
| | | }, |
| | | // 修改按钮 |
| | | async edit(operation, row) { |
| | | const res = await BoIventorySelectView({ bomid: row.id }) |
| | | if (res.code === '200') { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | await this.getPartSelect() |
| | | |
| | | const childrenArr = [] // 子集数组partcode |
| | | |
| | | res.data.forEach((item, index) => { |
| | | let number = Math.random() * Math.random()// 作为删除时的标识符 |
| | | number = number === 0 ? (10 + Math.random()) : number |
| | | |
| | | // item.SEQ = (index + 1) + '0' |
| | | // item.isVisible = 0 |
| | | // item.number = number |
| | | this.dialogTableDataArr.push({ |
| | | SEQ: item.seq, |
| | | isVisible: 0, |
| | | number, |
| | | SMATERIRL_CODE: item.partcode, |
| | | SMATERIRL_NAME: item.partname, |
| | | SMATERIRL_SPEC: item.partspec, |
| | | uomcode: item.uom_name, |
| | | BASE_QUANTITY: item.base_quantity, |
| | | LOSS_QUANTITY: item.loss_quantity, |
| | | TOTAL_QUANTITY: item.total_quantity, |
| | | PN_TYPE: item.pn_type |
| | | }) |
| | | childrenArr.push(item.partcode) |
| | | }) |
| | | |
| | | this.$nextTick(() => { |
| | | this.dialogForm.bomid = row.id |
| | | this.dialogForm.parentpartcode = row.partcode |
| | | this.dialogForm.parentpartname = row.partname |
| | | this.dialogForm.parentpartspec = row.partspec |
| | | this.dialogForm.uomcode = row.uom_code |
| | | this.dialogForm.startdate = row.startdate |
| | | this.dialogForm.status = row.status |
| | | this.dialogForm.quantity = row.quantity |
| | | this.dialogForm.version = row.version |
| | | |
| | | this.PartSelectArr = this.PartSelectArr.filter(item => !childrenArr.includes(item.partcode) && item.partcode !== this.dialogForm.parentpartcode) |
| | | }) |
| | | } |
| | | }, |
| | | // 输入框值改变时触发 |
| | | inputChange(val, row) { |
| | | row.TOTAL_QUANTITY = (parseFloat(row.BASE_QUANTITY) * (parseFloat(row.LOSS_QUANTITY) + 100)) / 100 |
| | | if (!Number.isFinite(row.TOTAL_QUANTITY)) { // 检验是否是数字 |
| | | row.TOTAL_QUANTITY = '' |
| | | } |
| | | }, |
| | | // 对话框表格下拉选择值改变时 |
| | | tableChange(val, row) { |
| | | const res = this.PartSelectArr.find(item => item.partcode === val || item.partname === val) |
| | | row.SMATERIRL_CODE = res.partcode |
| | | row.SMATERIRL_NAME = res.partname |
| | | row.SMATERIRL_SPEC = res.partspec |
| | | row.uomcode = res.uom_code |
| | | |
| | | // this.PartSelectArr.forEach((item, index) => { |
| | | // this.PartSelectArr.splice(index, 1) |
| | | // }) |
| | | }, |
| | | addDialog() { |
| | | if (this.dialogTableDataArr.find(item => item.isVisible === 1)) { |
| | | return this.$message.info('请先保存本条记录!') |
| | | } |
| | | |
| | | let number = Math.random() * Math.random()// 作为删除时的标识符 |
| | | number = number === 0 ? (10 + Math.random()) : number |
| | | this.dialogTableDataArr.push({ |
| | | SEQ: (this.dialogTableDataArr.length + 1) + '0', |
| | | isVisible: 1, |
| | | number, |
| | | SMATERIRL_CODE: '', |
| | | SMATERIRL_NAME: '', |
| | | SMATERIRL_SPEC: '', |
| | | uomcode: '', |
| | | BASE_QUANTITY: '', |
| | | LOSS_QUANTITY: '', |
| | | TOTAL_QUANTITY: '', |
| | | PN_TYPE: '' |
| | | }) |
| | | }, |
| | | saveRow(row) { |
| | | if (row.SMATERIRL_CODE === '' || row.BASE_QUANTITY === '' || row.LOSS_QUANTITY === '' || row.PN_TYPE === '') { |
| | | return this.$message.info('保存失败,该行内容未填全!') |
| | | } |
| | | |
| | | row.isVisible = 0 |
| | | this.PartSelectArr = this.PartSelectArr.filter(i => i.partcode !== row.SMATERIRL_CODE) |
| | | }, |
| | | cancelRow(row) { |
| | | row.isVisible = 0 |
| | | this.dialogTableDataArr = this.dialogTableDataArr.filter(i => i.number !== row.number) |
| | | }, |
| | | editRow(row) { |
| | | if (this.dialogTableDataArr.find(item => item.isVisible === 1)) { |
| | | return this.$message.info('请先保存其它行记录!') |
| | | } |
| | | |
| | | row.isVisible = 1 |
| | | |
| | | this.PartSelectArrAll.forEach(item => { |
| | | if (item.partcode === row.SMATERIRL_CODE) { |
| | | this.PartSelectArr.unshift(item) |
| | | } |
| | | }) |
| | | }, |
| | | delRow(row) { |
| | | this.PartSelectArrAll.forEach(item => { |
| | | if (item.partcode === row.SMATERIRL_CODE) { |
| | | this.PartSelectArr.unshift(item) |
| | | } |
| | | }) |
| | | this.dialogTableDataArr.forEach((item, index) => { |
| | | if (item.SMATERIRL_CODE === row.SMATERIRL_CODE) { |
| | | this.dialogTableDataArr.splice(index, 1) |
| | | } |
| | | }) |
| | | this.dialogTableDataArr.forEach((item, index) => { |
| | | item.SEQ = (index + 1) + '0' |
| | | }) |
| | | }, |
| | | // 删除按钮 |
| | | async del(row) { |
| | | this.$confirm('是否确认删除?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | DeleteBoIventory({ bomid: row.id }).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success('删除成功!') |
| | | if (this.form.page > 1 && this.tableData.length === 1) { |
| | | this.form.page-- |
| | | } |
| | | this.getBoIventorySelect() |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message.info('已取消删除') |
| | | }) |
| | | }, |
| | | // 对话框关闭事件 |
| | | handleClose() { |
| | | this.dialogForm.parentpartcode = '' |
| | | this.dialogForm.parentpartname = '' |
| | | this.dialogForm.parentpartspec = '' |
| | | this.dialogForm.uomcode = '' |
| | | // this.dialogForm.chlx = '' |
| | | this.dialogForm.quantity = '' |
| | | this.dialogForm.status = '' |
| | | this.dialogForm.startdate = '' |
| | | this.dialogForm.version = '' |
| | | this.PartSelectArr = [] |
| | | this.PartSelectArrAll = [] |
| | | this.PartSelectArrTemp = [] |
| | | this.dialogTableDataArr = [] |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // 对话框取消 |
| | | dialogVisibleCancel() { |
| | | this.dialogVisible = false |
| | | }, |
| | | // 对话框确认 |
| | | dialogVisibleConfirm() { |
| | | if (this.dialogTableDataArr.length === 0) { |
| | | return this.$message.info('子件信息不能为空!') |
| | | } |
| | | |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | const data = { |
| | | bomid: this.dialogForm.bomid, |
| | | parentpartcode: this.dialogForm.parentpartcode, |
| | | parentpartname: this.dialogForm.parentpartname, |
| | | parentpartspec: this.dialogForm.parentpartspec, |
| | | uomcode: this.dialogForm.uomcode, |
| | | quantity: this.dialogForm.quantity, |
| | | status: this.dialogForm.status, |
| | | startdate: this.dialogForm.startdate, |
| | | version: this.dialogForm.version, |
| | | worklist: this.dialogTableDataArr, |
| | | opertype: this.operation === 'add' ? 'Add' : 'Update' |
| | | } |
| | | console.log(data, 89) |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | AddUpdateBoIventory(data).then(res => { |
| | | if (res.code === '200') { |
| | | this.dialogVisible = false |
| | | this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!') |
| | | this.getBoIventorySelect() |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | } else { |
| | | this.$message.error(this.operation === 'add' ? '添加失败!' : '修改失败!') |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 获取页面高度 |
| | | getHeight() { |
| | | this.$nextTick(() => { |
| | | this.mainHeight = window.innerHeight - 85 |
| | | this.tableHeight = this.mainHeight - 255 |
| | | this.$refs.tableDataRef.doLayout() |
| | | }) |
| | | }, |
| | | tableRowClassName({ row, rowIndex }) { |
| | | return 'custom-row' |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | <!--公共页面样式--> |
| | | <style lang="scss" scoped> |
| | | $main_color: #42b983; |
| | | ::v-deep .el-button--text { |
| | | font-size: 14px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .el-icon-share, .el-icon-delete, .el-icon-edit-outline { |
| | | color: $main_color; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .el-icon-edit-outline { |
| | | margin-right: 15px; |
| | | } |
| | | |
| | | ::v-deep .el-button--primary, .el-button--default, .el-button--info { |
| | | height: 34px; |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 0 15px; |
| | | } |
| | | |
| | | ::v-deep .el-button--primary { |
| | | //background-color: $main_color !important; |
| | | } |
| | | |
| | | ::v-deep .el-button--default { |
| | | background-color: #f8f8fa; |
| | | border: none; |
| | | } |
| | | |
| | | ::v-deep .el-input__inner { |
| | | height: 34px; |
| | | line-height: 34px; |
| | | //color: #a7a7a7; |
| | | } |
| | | |
| | | ::v-deep .el-dialog__body { |
| | | //padding: 20px 100px !important; |
| | | padding: 20px !important; |
| | | } |
| | | |
| | | ::v-deep .dialogVisibleRoles .el-dialog__body { |
| | | padding: 20px 20px !important; |
| | | } |
| | | |
| | | ::v-deep .importPickerClass .el-dialog__body { |
| | | padding: 20px 20px !important; |
| | | } |
| | | |
| | | ::v-deep .el-dialog__footer { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | ::v-deep .el-table .caret-wrapper { |
| | | transform: scale(0.8); |
| | | } |
| | | |
| | | ::v-deep .cell { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | ::v-deep .el-table::before { |
| | | height: 0; |
| | | } |
| | | |
| | | ::v-deep .el-table__body-wrapper { |
| | | background-color: #f8f8fa; |
| | | } |
| | | |
| | | ::v-deep .el-table__body .el-table__row.hover-row td { |
| | | background-color: #eaecef; |
| | | } |
| | | |
| | | ::v-deep .el-form--inline .el-form-item__label { |
| | | color: #a7a7a7; |
| | | } |
| | | |
| | | .body ::v-deep .el-divider { |
| | | border: 1px solid #eee; |
| | | width: 99%; |
| | | margin: 10px auto; |
| | | } |
| | | |
| | | .body ::v-deep .el-form-item { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | .userDialogVisible ::v-deep .el-form-item { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | ::v-deep .el-select__caret { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .tableFixed { |
| | | ::v-deep .el-table__fixed-right { |
| | | height: 100% !important; |
| | | } |
| | | |
| | | ::v-deep .el-table__fixed { |
| | | height: 100% !important; |
| | | } |
| | | } |
| | | |
| | | ::v-deep .el-range__icon{ |
| | | line-height: 28px !important; |
| | | } |
| | | ::v-deep .el-range-separator{ |
| | | line-height: 28px !important; |
| | | } |
| | | ::v-deep .el-range-input{ |
| | | font-size: 14px; |
| | | } |
| | | ::v-deep .el-range-separator{ |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | </style> |
| | | <style> |
| | | |
| | | .el-table .custom-row { |
| | | background: #f8f8fa; |
| | | } |
| | | </style> |