| | |
| | | <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="upload">导入</el-button> |
| | | <!-- <el-button v-waves icon="el-icon-download" @click="upload">导入</el-button>--> |
| | | </div> |
| | | |
| | | <div class="bodyTopFormGroup"> |
| | |
| | | <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="版本编号" style=" display: flex;"> |
| | | <el-form-item 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;"> |
| | |
| | | </div> |
| | | |
| | | <div class="elTableDiv"> |
| | | <TableColumnSettings |
| | | :list1="tableColumnSettingsArray" |
| | | @tableColumnUpdate="tableColumnUpdate" |
| | | /> |
| | | <!-- <TableColumnSettings--> |
| | | <!-- :list1="tableColumnSettingsArray"--> |
| | | <!-- @tableColumnUpdate="tableColumnUpdate"--> |
| | | <!-- />--> |
| | | <el-table |
| | | ref="tableDataRef" |
| | | :key="tableTimeStampKey" |
| | |
| | | <template slot-scope="{row}"> |
| | | <div v-if="!row[item.prop]">/</div> |
| | | |
| | | <div v-else-if="item.prop==='startdate'">{{ row.startdate.substring(0,11) }}</div> |
| | | <div v-else-if="item.prop==='startdate'">{{ row.startdate.substring(0, 11) }}</div> |
| | | <div v-else-if="item.prop==='status'"> |
| | | <div v-if="row[item.prop]==='Y'"> |
| | | <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> |
| | |
| | | align="right" |
| | | layout="total,prev, pager, next,sizes" |
| | | popper-class="select_bottom" |
| | | @pagination="getBoIventorySelect" |
| | | @pagination="getBomMainData" |
| | | /> |
| | | </div> |
| | | |
| | |
| | | label-width="80px" |
| | | style="margin-left: 20px;" |
| | | > |
| | | |
| | | <el-form-item label="母件编码" prop="parentpartcode"> |
| | | <el-select |
| | | v-model="dialogForm.parentpartcode" |
| | | style="width: 200px" |
| | | style="width: 490px" |
| | | placeholder="请选择" |
| | | :popper-append-to-body="false" |
| | | :disabled="operation!=='add'" |
| | |
| | | <el-option |
| | | v-for="item in PartSelectArr" |
| | | :key="item.partcode" |
| | | :label="item.partcode" |
| | | :label="item.partcode+' / '+item.partname" |
| | | :value="item.partcode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="母件名称" prop="parentpartname"> |
| | | <el-select |
| | | v-model="dialogForm.parentpartname" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :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="计量单位"> |
| | | <el-input v-model="dialogForm.uomname" disabled style="width: 200px" /> |
| | | <!-- <el-input v-model="dialogForm.uomname" style="width: 200px" />--> |
| | | |
| | | <el-select |
| | | v-model="dialogForm.uomcode" |
| | | :disabled="UnitGroupArr.length<2" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in UnitGroupArr" |
| | | :key="item.unitcode" |
| | | :label="item.unitname" |
| | | :value="item.unitcode" |
| | | /> |
| | | </el-select> |
| | | |
| | | </el-form-item> |
| | | <!-- <el-form-item label="存货类型">--> |
| | | <!-- <el-input v-model="dialogForm.chlx" readonly style="width: 200px" />--> |
| | |
| | | <el-form-item label="版本号" prop="version"> |
| | | <el-input v-model="dialogForm.version" disabled style="width: 200px" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="默认BOM"> |
| | | <el-checkbox v-model="dialogForm.isdefaultbom" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | |
| | |
| | | /> |
| | | <el-table-column |
| | | prop="SMATERIRL_CODE" |
| | | label="子件编码" |
| | | label="子件编码/名称" |
| | | show-tooltip-when-overflow |
| | | > |
| | | <template slot-scope="{row}"> |
| | |
| | | v-if="row.isVisible===1" |
| | | v-model="row.SMATERIRL_CODE" |
| | | filterable |
| | | style="width: 100%;" |
| | | placeholder="请选择" |
| | | @change="val=>tableChange(val,row)" |
| | | > |
| | | <el-option |
| | | v-for="item in PartSelectArr" |
| | | :key="item.partname" |
| | | :label="item.partcode" |
| | | :value="item.partname" |
| | | v-for="item in PartDetailSelectArr" |
| | | :key="item.partcode" |
| | | :label="item.partcode+' / '+item.partname" |
| | | :value="item.partcode" |
| | | /> |
| | | </el-select> |
| | | <div v-if="row.isVisible===0">{{ row.SMATERIRL_CODE }}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="SMATERIRL_NAME" |
| | | label="子件名称" |
| | | filterable |
| | | 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 |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.SMATERIRL_SPEC">{{ row.SMATERIRL_SPEC }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | <!-- <template slot-scope="{row}">--> |
| | | <!-- <div v-if="row.SMATERIRL_SPEC">{{ row.SMATERIRL_SPEC }}</div>--> |
| | | <!-- <div v-else>/</div>--> |
| | | <!-- </template>--> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="uomname" |
| | | label="计量单位" |
| | | width="110" |
| | | show-tooltip-when-overflow |
| | | /> |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-select |
| | | v-model="row.uomcode" |
| | | :disabled="row.UnitGroupArr.length<2" |
| | | placeholder="请选择" |
| | | > |
| | | <el-option |
| | | v-for="item in row.UnitGroupArr" |
| | | :key="item.unitcode" |
| | | :label="item.unitname" |
| | | :value="item.unitcode" |
| | | /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="idchildbom" |
| | | label="子件BOM" |
| | | width="110" |
| | | show-tooltip-when-overflow |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-select |
| | | v-model="row.idchildbom" |
| | | style="width: 490px" |
| | | placeholder="请选择" |
| | | > |
| | | <template slot="empty"> |
| | | <el-table |
| | | :data="row.tableData2" |
| | | border |
| | | stripe |
| | | class="tableFixed" |
| | | highlight-current-row |
| | | :row-class-name="tableRowClassName" |
| | | style="width: 100%" |
| | | height="200" |
| | | @row-click="rowClick" |
| | | > |
| | | <el-table-column |
| | | prop="partcode" |
| | | label="产品编码" |
| | | width="180" |
| | | /> |
| | | <el-table-column |
| | | prop="partname" |
| | | label="产品名称" |
| | | width="180" |
| | | /> |
| | | <el-table-column |
| | | prop="unitcode" |
| | | label="其它" |
| | | /> |
| | | </el-table> |
| | | </template> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column |
| | | prop="BASE_QUANTITY" |
| | | label="基本用量" |
| | |
| | | show-tooltip-when-overflow |
| | | width="110" |
| | | /> |
| | | <el-table-column |
| | | prop="PN_TYPE" |
| | | label="属性" |
| | | show-tooltip-when-overflow |
| | | width="110" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-select |
| | | v-if="row.isVisible===1" |
| | | v-model="row.PN_TYPE" |
| | | :disabled="row.PN_TYPE==='Z'" |
| | | placeholder="请选择" |
| | | @change="val=>changeType(val,row)" |
| | | > |
| | | <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" |
| | | width="80" |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div class="operationClass"> |
| | | <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveRow(row)">确定</el-button> |
| | | <el-button v-if="row.isVisible===1" v-waves type="text" @click="cancelRow(row)">取消</el-button> |
| | | <el-button v-if="row.isVisible===0" v-waves type="text" @click="editRow(row)">编辑</el-button> |
| | | <el-button v-if="row.isVisible===0" v-waves type="text" @click="delRow(row)">删除</el-button> |
| | | <el-button v-waves type="text" @click="delRow(row)">删除</el-button> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | </el-table> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | |
| | | <script> |
| | | import Pagination from '@/components/Pagination' |
| | | import { handleDatetime } from '@/utils/global' |
| | | // import { |
| | | // AddUpdateBoIventory, |
| | | // BoIventorySelect, |
| | | // BoIventorySelectView, |
| | | // DeleteBoIventory, MaterielDetailedVsion, |
| | | // PartSelect, |
| | | // StockTypeSelect |
| | | // } from '@/api/makeModel' |
| | | import elDragDialog from '@/directive/el-drag-dialog' |
| | | import waves from '@/directive/waves' |
| | | import TableColumnSettings from '@/components/TableColumnSettings' |
| | | import { |
| | | AddUpdateTBomUnitGroup, |
| | | BomMainData, |
| | | AddUpdateTBomParentData, |
| | | AddUpdateTBomDetailsData, AddUpdateTBomMaxVsion, AddUpdateTBomDetailsBomData, TBomAddUpdate |
| | | } from '@/api/ProductModel' |
| | | |
| | | export default { |
| | | name: 'Zzjg', |
| | |
| | | page: 1, // 第几页 |
| | | rows: 20 // 每页多少条 |
| | | }, |
| | | parttypeArr: [], // 存货类型 |
| | | |
| | | openTypeArr: [// 启用状态 |
| | | { label: '是', value: 'Y' }, |
| | | { label: '否', value: 'N' } |
| | |
| | | uomname: '', |
| | | // chlx: '', |
| | | quantity: '', |
| | | status: '', |
| | | status: 'Y', |
| | | startdate: '', |
| | | version: '' |
| | | version: '', |
| | | isdefaultbom: false |
| | | }, |
| | | operation: '', |
| | | dialogFormRules: { |
| | |
| | | PartSelectArr: [], // 产品可选值 |
| | | PartSelectArrTemp: [], // 产品已选暂存值 |
| | | dialogTableDataArr: [], |
| | | sxArr: [ |
| | | { code: 'Z', name: '主料' }, |
| | | { code: 'F', name: '辅料' } |
| | | ], |
| | | |
| | | title_value: '数据导入 / 物料清单', |
| | | code: '21', |
| | | shows: false |
| | | UnitGroupArr: [], // 计量单位数组 |
| | | PartDetailSelectArr: [] |
| | | |
| | | } |
| | | }, |
| | | |
| | | created() { |
| | | // this.handleRequest() |
| | | this.getBomMainData() |
| | | this.getAddUpdateTBomParentData() |
| | | this.getAddUpdateTBomDetailsData() |
| | | }, |
| | | mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | |
| | | this.tableTimeStampKey = new Date().getTime() |
| | | this.$refs.tableDataRef.doLayout() |
| | | }, |
| | | handleRequest() { |
| | | this.getBoIventorySelect().then(res => { |
| | | if (res.code === '200') { |
| | | this.getStockTypeSelect() |
| | | } |
| | | }) |
| | | }, |
| | | async getBoIventorySelect() { |
| | | async getBomMainData() { |
| | | let tempDate = this.form.createdate |
| | | if (tempDate.length > 0) { |
| | | tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1]) |
| | |
| | | rows: this.form.rows // 每页多少条 |
| | | } |
| | | |
| | | const res = await BoIventorySelect(data) |
| | | const res = await BomMainData(data) |
| | | this.tableData = res.data |
| | | this.total = res.count |
| | | return { code: res.code } |
| | | }, |
| | | // 获取母件编码名称等下拉接口 |
| | | async getPartSelect() { |
| | | const { data: res } = await PartSelect() |
| | | async getAddUpdateTBomParentData() { |
| | | const { data: res } = await AddUpdateTBomParentData() |
| | | this.PartSelectArr = res |
| | | this.PartSelectArrAll = res |
| | | }, |
| | | // 获取存货类型下拉接口 |
| | | async getStockTypeSelect() { |
| | | const { data: res } = await StockTypeSelect() |
| | | this.parttypeArr = res |
| | | async getAddUpdateTBomDetailsData() { |
| | | const { data: res } = await AddUpdateTBomDetailsData() |
| | | this.PartDetailSelectArr = res |
| | | }, |
| | | partSelectChange(val) { |
| | | async partSelectChange(val) { |
| | | const res = this.PartSelectArr.find(item => item.partcode === val) |
| | | this.dialogForm.parentpartcode = res.partcode |
| | | // this.dialogForm.parentpartcode = res.partcode |
| | | this.dialogForm.parentpartname = res.partname |
| | | this.dialogForm.parentpartspec = res.partspec |
| | | // this.dialogForm.uomcode = res.uom_code |
| | | this.dialogForm.uomname = res.uom_name |
| | | this.dialogForm.uomcode = res.unitcode |
| | | this.dialogForm.uomname = res.unitname |
| | | |
| | | if (this.PartSelectArrTemp.length > 0) { |
| | | this.PartSelectArr.unshift(this.PartSelectArrTemp[0]) |
| | | this.PartSelectArrTemp.splice(0, 1) |
| | | this.UnitGroupArr = [] |
| | | this.UnitGroupArr.push({ |
| | | unitcode: res.unitcode, |
| | | unitname: res.unitname |
| | | }) |
| | | |
| | | if (res.idunitgroup) { |
| | | const { data: r } = await AddUpdateTBomUnitGroup({ idunitgroup: res.idunitgroup }) |
| | | this.UnitGroupArr = r |
| | | } |
| | | |
| | | this.PartSelectArr.forEach((item, index) => { |
| | | if (item.partcode === val) { |
| | | this.PartSelectArrTemp.push(item) |
| | | this.PartSelectArr.splice(index, 1) |
| | | } |
| | | }) |
| | | this.getMaterielDetailedVsion(this.dialogForm.parentpartcode) |
| | | await this.getAddUpdateTBomMaxVsion(this.dialogForm.parentpartcode) |
| | | }, |
| | | async getMaterielDetailedVsion(parentpartcode) { |
| | | const { data: res } = await MaterielDetailedVsion({ parentpartcode }) |
| | | async getAddUpdateTBomMaxVsion(parentpartcode) { |
| | | const { data: res } = await AddUpdateTBomMaxVsion({ parentpartcode }) |
| | | this.dialogForm.version = res |
| | | }, |
| | | // 排序改变时 |
| | |
| | | } |
| | | this.form.order = order |
| | | this.form.prop = prop |
| | | this.getBoIventorySelect() |
| | | this.getBomMainData() |
| | | }, |
| | | // 查询 |
| | | search() { |
| | | this.getBoIventorySelect() |
| | | this.getBomMainData() |
| | | }, |
| | | // 导入按钮 |
| | | upload() { |
| | | this.shows = true |
| | | this.$refs.importPickerFunc.newDataFunc() |
| | | }, |
| | | colos() { |
| | | this.shows = false |
| | | }, |
| | | |
| | | // 重置 |
| | | reset() { |
| | | this.form.parentpartcode = '' |
| | |
| | | this.form.version = '' |
| | | this.form.createusername = '' |
| | | this.form.createdate = '' |
| | | this.getBoIventorySelect() |
| | | this.getBomMainData() |
| | | }, |
| | | |
| | | // 新增按钮 |
| | | add(operation) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | this.getPartSelect() |
| | | |
| | | this.dialogForm.startdate = handleDatetime(new Date()) |
| | | }, |
| | | // 修改按钮 |
| | | async edit(operation, row) { |
| | | const res = await BoIventorySelectView({ bomid: row.id }) |
| | | const res = await BomMainDataView({ bomid: row.id }) |
| | | if (res.code === '200') { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | await this.getPartSelect() |
| | | |
| | | const childrenArr = [] // 子集数组partcode |
| | | |
| | |
| | | // item.isVisible = 0 |
| | | // item.number = number |
| | | this.dialogTableDataArr.push({ |
| | | id: item.id, |
| | | SEQ: item.seq, |
| | | isVisible: 0, |
| | | number, |
| | |
| | | uomname: item.uom_name, |
| | | BASE_QUANTITY: item.base_quantity, |
| | | LOSS_QUANTITY: item.loss_quantity, |
| | | TOTAL_QUANTITY: item.total_quantity, |
| | | PN_TYPE: item.pn_type |
| | | TOTAL_QUANTITY: item.total_quantity |
| | | |
| | | }) |
| | | childrenArr.push(item.partcode) |
| | | }) |
| | |
| | | } |
| | | }, |
| | | // 对话框表格下拉选择值改变时 |
| | | tableChange(val, row) { |
| | | const res = this.PartSelectArr.find(item => item.partcode === val || item.partname === val) |
| | | async tableChange(val, row) { |
| | | const res = this.PartSelectArr.find(item => item.partcode === val) |
| | | row.SMATERIRL_CODE = res.partcode |
| | | row.SMATERIRL_NAME = res.partname |
| | | row.SMATERIRL_SPEC = res.partspec |
| | | row.uomcode = res.uom_code |
| | | row.uomname = res.uom_name |
| | | row.uomcode = res.unitcode |
| | | row.uomname = res.unitname |
| | | |
| | | // this.PartSelectArr.forEach((item, index) => { |
| | | // this.PartSelectArr.splice(index, 1) |
| | | // }) |
| | | }, |
| | | // 物料清单属性类型值改变时触发 |
| | | changeType(val, row) { |
| | | this.dialogTableDataArr.forEach(item => { |
| | | item.PN_TYPE = item.SMATERIRL_CODE === row.SMATERIRL_CODE ? 'Z' : 'F' |
| | | row.UnitGroupArr = [] |
| | | row.UnitGroupArr.push({ |
| | | unitcode: res.unitcode, |
| | | unitname: res.unitname |
| | | }) |
| | | }, |
| | | addDialog() { |
| | | if (this.dialogTableDataArr.find(item => item.isVisible === 1)) { |
| | | return this.$message.info('请先保存本条记录!') |
| | | |
| | | if (res.idunitgroup) { |
| | | const { data: r } = await AddUpdateTBomUnitGroup({ idunitgroup: res.idunitgroup }) |
| | | row.UnitGroupArr = r |
| | | } |
| | | |
| | | let number = Math.random() * Math.random()// 作为删除时的标识符 |
| | | const { data: r2 } = await AddUpdateTBomDetailsBomData({ materiel_code: val }) |
| | | row.tableData2 = r2 |
| | | }, |
| | | |
| | | 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', |
| | |
| | | SMATERIRL_SPEC: '', |
| | | uomcode: '', |
| | | uomname: '', |
| | | UnitGroupArr: [], |
| | | tableData2: [], |
| | | BASE_QUANTITY: '', |
| | | LOSS_QUANTITY: '', |
| | | TOTAL_QUANTITY: '', |
| | | PN_TYPE: this.dialogTableDataArr.length === 0 ? 'Z' : 'F' |
| | | }) |
| | | }, |
| | | 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) |
| | | } |
| | | TOTAL_QUANTITY: '' |
| | | }) |
| | | }, |
| | | delRow(row) { |
| | | if (row.PN_TYPE === 'Z') { |
| | | return this.$message.info('主料不可删除!') |
| | | } |
| | | |
| | | 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('已取消删除') |
| | | }) |
| | | // 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.getBomMainData() |
| | | // } |
| | | // }) |
| | | // }).catch(() => { |
| | | // this.$message.info('已取消删除') |
| | | // }) |
| | | }, |
| | | // 对话框关闭事件 |
| | | handleClose() { |
| | |
| | | this.dialogForm.uomname = '' |
| | | // this.dialogForm.chlx = '' |
| | | this.dialogForm.quantity = '' |
| | | this.dialogForm.status = '' |
| | | this.dialogForm.status = 'Y' |
| | | this.dialogForm.startdate = '' |
| | | this.dialogForm.version = '' |
| | | this.dialogForm.isdefaultbom = false |
| | | this.PartSelectArr = [] |
| | | this.PartSelectArrAll = [] |
| | | this.PartSelectArrTemp = [] |
| | |
| | | |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | // [ |
| | | // { |
| | | // 'id': 'string', |
| | | // 'm_id': 'string', |
| | | // 'seq': 'string', |
| | | // 'materiel_code': 'string', |
| | | // 'materiel_name': 'string', |
| | | // 'materiel_spec': 'string', |
| | | // 'unitcode': 'string', |
| | | // 'base_quantity': 'string', |
| | | // 'loss_quantity': 'string', |
| | | // 'total_quantity': 'string', |
| | | // 'idchildbom': 'string' |
| | | // } |
| | | // ] |
| | | const children = [] |
| | | |
| | | this.dialogTableDataArr.forEach(i => { |
| | | children.push({ |
| | | id: i.id, |
| | | m_id: this.dialogForm.bomid, |
| | | 'seq': i.SEQ, |
| | | 'materiel_code': i.SMATERIRL_CODE, |
| | | 'materiel_name': i.SMATERIRL_NAME, |
| | | 'materiel_spec': i.SMATERIRL_SPEC, |
| | | 'unitcode': i.uomcode, |
| | | 'base_quantity': i.BASE_QUANTITY, |
| | | 'loss_quantity': i.LOSS_QUANTITY, |
| | | 'total_quantity': i.TOTAL_QUANTITY, |
| | | 'idchildbom': '' |
| | | }) |
| | | }) |
| | | |
| | | const data = { |
| | | bomid: this.dialogForm.bomid, |
| | | parentpartcode: this.dialogForm.parentpartcode, |
| | | parentpartname: this.dialogForm.parentpartname, |
| | | parentpartspec: this.dialogForm.parentpartspec, |
| | | uomcode: this.PartSelectArrTemp.length > 0 ? this.PartSelectArrTemp[0].uom_code : 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' |
| | | 'id': '', |
| | | 'materiel_code': this.dialogForm.parentpartcode, |
| | | 'materiel_name': this.dialogForm.parentpartname, |
| | | 'materiel_spec': this.dialogForm.parentpartspec, |
| | | 'materiel_typecode': '', |
| | | 'materiel_typename': '', |
| | | 'unitcode': this.dialogForm.uomcode, |
| | | 'unitname': this.UnitGroupArr.find(i => i.unitcode === this.dialogForm.uomcode).unitname, |
| | | 'quantity': this.dialogForm.quantity, |
| | | 'status': this.dialogForm.status, |
| | | 'startdate': this.dialogForm.startdate, |
| | | 'version': this.dialogForm.version, |
| | | 'isdefaultbom': this.dialogForm.isdefaultbom ? '1' : '0', |
| | | 'bomdepth': '', |
| | | 'lm_user': '', |
| | | 'lm_date': '', |
| | | children |
| | | } |
| | | // console.log(data) |
| | | console.log(JSON.parse(JSON.stringify(data))) |
| | | |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | AddUpdateBoIventory(data).then(res => { |
| | | TBomAddUpdate(data, this.operation === 'add' ? 'Add' : 'Update').then(res => { |
| | | if (res.code === '200') { |
| | | this.dialogVisible = false |
| | | this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!') |
| | | this.getBoIventorySelect() |
| | | this.getBomMainData() |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | } else { |
| | | this.$message.error(this.operation === 'add' ? '添加失败!' : '修改失败!') |
| | |
| | | }, |
| | | tableRowClassName({ row, rowIndex }) { |
| | | return 'custom-row' |
| | | }, |
| | | |
| | | rowClick(row, column, event) { |
| | | // this.dialogForm.parentpartcode = row.partcode |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | ::v-deep .el-select__caret::before{ |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | height: 34px; |
| | | } |
| | | </style> |
| | | <!--公共页面样式--> |
| | | <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> |
| | | |