| | |
| | | <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" /> |
| | | 是 |
| | | </div> |
| | | <div v-if="row[item.prop]==='N'"> |
| | | <i class="el-icon-info" style="margin-right: 2px" /> |
| | | 否 |
| | | </div> |
| | | </div> |
| | | <div v-else-if="item.prop==='isdefaultbom'"> |
| | | <div v-if="row[item.prop]==='1'"> |
| | | <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> |
| | | 是 |
| | | </div> |
| | | <div v-if="row[item.prop]==='0'"> |
| | | <i class="el-icon-info" style="margin-right: 2px" /> |
| | | 否 |
| | | </div> |
| | |
| | | style="width: 490px" |
| | | placeholder="请选择" |
| | | :popper-append-to-body="false" |
| | | :disabled="operation!=='add'" |
| | | filterable |
| | | @change="partSelectChange" |
| | | > |
| | |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="版本号" prop="version"> |
| | | <el-input v-model="dialogForm.version" disabled style="width: 200px" /> |
| | | <el-input v-model="dialogForm.version" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="BOM层级"> |
| | | <el-input v-model="dialogForm.bomdepth" disabled style="width: 200px" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="默认BOM"> |
| | |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-select |
| | | v-if="row.isVisible===1" |
| | | v-model="row.SMATERIRL_CODE" |
| | | filterable |
| | | style="width: 100%;" |
| | |
| | | :value="item.partcode" |
| | | /> |
| | | </el-select> |
| | | <div v-if="row.isVisible===0">{{ row.SMATERIRL_CODE }}</div> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | |
| | | show-tooltip-when-overflow |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <!-- {{ row.idchildbom }}--> |
| | | <el-select |
| | | v-model="row.idchildbom" |
| | | style="width: 490px" |
| | |
| | | class="tableFixed" |
| | | highlight-current-row |
| | | :row-class-name="tableRowClassName" |
| | | style="width: 100%" |
| | | style="width: 400px" |
| | | height="200" |
| | | @row-click="rowClick" |
| | | @row-click="r=>rowClick(r,row)" |
| | | > |
| | | <el-table-column |
| | | prop="partcode" |
| | | prop="materiel_code" |
| | | label="产品编码" |
| | | width="180" |
| | | /> |
| | | <el-table-column |
| | | prop="partname" |
| | | prop="materiel_name" |
| | | label="产品名称" |
| | | width="180" |
| | | /> |
| | | <el-table-column |
| | | prop="unitcode" |
| | | label="其它" |
| | | prop="materiel_spec" |
| | | label="规格型号" |
| | | /> |
| | | <el-table-column |
| | | prop="version" |
| | | label="版本号" |
| | | /> |
| | | </el-table> |
| | | </template> |
| | |
| | | > |
| | | <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 |
| | |
| | | > |
| | | <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 |
| | |
| | | width="80" |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <template slot-scope="{row,$index}"> |
| | | <div class="operationClass"> |
| | | <el-button v-waves type="text" @click="delRow(row)">删除</el-button> |
| | | <el-button v-waves type="text" @click="delRow(row,$index)">删除</el-button> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | AddUpdateTBomUnitGroup, |
| | | BomMainData, |
| | | AddUpdateTBomParentData, |
| | | AddUpdateTBomDetailsData, AddUpdateTBomMaxVsion, AddUpdateTBomDetailsBomData, TBomAddUpdate |
| | | AddUpdateTBomDetailsData, AddUpdateTBomMaxVsion, AddUpdateTBomDetailsBomData, TBomAddUpdate, TBomDelete |
| | | } from '@/api/ProductModel' |
| | | |
| | | export default { |
| | |
| | | version: '', // 版本号 |
| | | createusername: '', // 创建人员 |
| | | createdate: '', // 创建日期 |
| | | prop: 'lm_date', // 排序字段 |
| | | prop: 'id', // 排序字段 |
| | | order: 'desc', // 排序字段 |
| | | page: 1, // 第几页 |
| | | rows: 20 // 每页多少条 |
| | |
| | | |
| | | tableColumnSettingsArray: [ |
| | | { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 隐藏列 show: false隐藏,true显示 |
| | | { minWidth: 25, width: 50, prop: 'RowNum', label: '序号', id: 2, show: true, fixed: 'left', sortable: false }, // custom |
| | | { minWidth: 25, width: 50, prop: 'rowNum', label: '序号', id: 2, show: true, fixed: 'left', sortable: false }, // custom |
| | | { |
| | | minWidth: 110, |
| | | width: false, |
| | | prop: 'partcode', |
| | | prop: 'materiel_code', |
| | | label: '母件编码', |
| | | id: 3, |
| | | show: true, |
| | |
| | | { |
| | | minWidth: 110, |
| | | width: false, |
| | | prop: 'partname', |
| | | prop: 'materiel_name', |
| | | label: '母件名称', |
| | | id: 4, |
| | | show: true, |
| | |
| | | { |
| | | minWidth: 110, |
| | | width: false, |
| | | prop: 'partspec', |
| | | prop: 'materiel_spec', |
| | | label: '母件规格', |
| | | id: 5, |
| | | show: true, |
| | |
| | | { |
| | | minWidth: 110, |
| | | width: false, |
| | | prop: 'stocktype_name', |
| | | prop: 'materiel_typename', |
| | | label: '存货类型', |
| | | id: 6, |
| | | show: true, |
| | |
| | | { |
| | | minWidth: 110, |
| | | width: false, |
| | | prop: 'uom_name', |
| | | prop: 'unitname', |
| | | label: '计量单位', |
| | | id: 7, |
| | | show: true, |
| | |
| | | minWidth: false, |
| | | width: 110, |
| | | prop: 'status', |
| | | label: '启动状态', |
| | | label: '启用状态', |
| | | id: 9, |
| | | show: true, |
| | | fixed: false, |
| | |
| | | show: true, |
| | | fixed: false, |
| | | sortable: true |
| | | }, { |
| | | minWidth: false, |
| | | width: 110, |
| | | prop: 'isdefaultbom', |
| | | label: '默认BOM', |
| | | id: 12, |
| | | show: true, |
| | | fixed: false, |
| | | sortable: true |
| | | }, |
| | | { |
| | | minWidth: false, |
| | | width: 110, |
| | | prop: 'username', |
| | | prop: 'lm_user', |
| | | label: '创建人员', |
| | | id: 12, |
| | | id: 13, |
| | | show: true, |
| | | fixed: false, |
| | | sortable: true |
| | |
| | | width: 160, |
| | | prop: 'lm_date', |
| | | label: '创建时间', |
| | | id: 13, |
| | | id: 14, |
| | | show: true, |
| | | fixed: false, |
| | | sortable: true |
| | |
| | | status: 'Y', |
| | | startdate: '', |
| | | version: '', |
| | | isdefaultbom: false |
| | | isdefaultbom: false, |
| | | bomdepth: '' |
| | | }, |
| | | operation: '', |
| | | dialogFormRules: { |
| | |
| | | // ], |
| | | startdate: [ |
| | | { required: true, message: '请选择启用日期', trigger: ['blur', 'change'] } |
| | | ], |
| | | version: [ |
| | | { required: true, message: '请选择版本号', trigger: ['blur', 'change'] } |
| | | ] |
| | | }, |
| | | PartSelectArrAll: [], // 产品所有值 |
| | | PartSelectArr: [], // 产品可选值 |
| | | PartSelectArrTemp: [], // 产品已选暂存值 |
| | | dialogTableDataArr: [], |
| | | UnitGroupArr: [], // 计量单位数组 |
| | | PartDetailSelectArr: [] |
| | |
| | | async getAddUpdateTBomParentData() { |
| | | const { data: res } = await AddUpdateTBomParentData() |
| | | this.PartSelectArr = res |
| | | this.PartSelectArrAll = res |
| | | }, |
| | | // 获取存货类型下拉接口 |
| | | async getAddUpdateTBomDetailsData() { |
| | |
| | | this.UnitGroupArr = r |
| | | } |
| | | |
| | | await this.getAddUpdateTBomMaxVsion(this.dialogForm.parentpartcode) |
| | | // await this.getAddUpdateTBomMaxVsion(this.dialogForm.parentpartcode) |
| | | }, |
| | | async getAddUpdateTBomMaxVsion(parentpartcode) { |
| | | const { data: res } = await AddUpdateTBomMaxVsion({ parentpartcode }) |
| | |
| | | this.dialogVisible = true |
| | | |
| | | this.dialogForm.startdate = handleDatetime(new Date()) |
| | | |
| | | // this.$refs.dialogTableDataArrRef.doLayout() |
| | | }, |
| | | // 修改按钮 |
| | | async edit(operation, row) { |
| | | const res = await BomMainDataView({ bomid: row.id }) |
| | | if (res.code === '200') { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | this.operation = operation |
| | | |
| | | 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({ |
| | | id: item.id, |
| | | SEQ: item.seq, |
| | | isVisible: 0, |
| | | number, |
| | | SMATERIRL_CODE: item.partcode, |
| | | SMATERIRL_NAME: item.partname, |
| | | SMATERIRL_SPEC: item.partspec, |
| | | uomcode: item.uom_code, |
| | | uomname: item.uom_name, |
| | | BASE_QUANTITY: item.base_quantity, |
| | | LOSS_QUANTITY: item.loss_quantity, |
| | | TOTAL_QUANTITY: item.total_quantity |
| | | |
| | | }) |
| | | 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.uomname = row.uom_name |
| | | 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) |
| | | }) |
| | | this.UnitGroupArr = [] |
| | | this.UnitGroupArr.push({ |
| | | unitcode: row.unitcode, |
| | | unitname: row.unitname |
| | | }) |
| | | const t = this.PartSelectArr.find(item => item.partcode === row.materiel_code).idunitgroup |
| | | if (t) { |
| | | const { data: r } = await AddUpdateTBomUnitGroup({ idunitgroup: t }) |
| | | this.UnitGroupArr = r |
| | | } |
| | | |
| | | this.dialogForm = { |
| | | bomid: row.id, |
| | | parentpartcode: row.materiel_code, |
| | | parentpartname: row.materiel_name, |
| | | parentpartspec: row.materiel_spec, |
| | | uomcode: row.unitcode, |
| | | uomname: row.unitname, |
| | | quantity: row.quantity, |
| | | status: row.status, |
| | | startdate: row.startdate, |
| | | version: row.version, |
| | | isdefaultbom: row.isdefaultbom === '1', |
| | | bomdepth: row.bomdepth |
| | | } |
| | | |
| | | const children = [] |
| | | |
| | | row.children.forEach((i, index) => { |
| | | let number = Math.random() * Math.random() // 作为删除时的标识符 |
| | | number = number === 0 ? (10 + Math.random()) : number |
| | | children.push({ |
| | | SEQ: (index + 1) + '0', |
| | | number, |
| | | SMATERIRL_CODE: i.materiel_code, |
| | | SMATERIRL_NAME: i.materiel_name, |
| | | SMATERIRL_SPEC: i.materiel_spec, |
| | | uomcode: i.unitcode, |
| | | uomname: '', |
| | | UnitGroupArr: [], |
| | | tableData2: [], |
| | | BASE_QUANTITY: i.base_quantity, |
| | | LOSS_QUANTITY: i.loss_quantity, |
| | | TOTAL_QUANTITY: i.total_quantity, |
| | | idchildbom: i.idchildbom |
| | | }) |
| | | this.tableChange(i.materiel_code, children[index]) |
| | | }) |
| | | |
| | | this.dialogTableDataArr = children |
| | | |
| | | this.dialogVisible = true |
| | | |
| | | this.$refs.dialogTableDataArrRef.doLayout() |
| | | }, |
| | | // 输入框值改变时触发 |
| | | inputChange(val, row) { |
| | |
| | | } |
| | | |
| | | const { data: r2 } = await AddUpdateTBomDetailsBomData({ materiel_code: val }) |
| | | row.tableData2 = r2 |
| | | if (r2.length > 0) { |
| | | row.idchildbom = row.idchildbom ? row.idchildbom : r2[0].id |
| | | row.tableData2 = r2 |
| | | row.idchildbom = row.tableData2.find(i => parseFloat(i.id) === parseFloat(row.idchildbom)).version |
| | | } |
| | | }, |
| | | |
| | | 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: '', |
| | | uomname: '', |
| | | idchildbom: '', |
| | | UnitGroupArr: [], |
| | | tableData2: [], |
| | | BASE_QUANTITY: '', |
| | | LOSS_QUANTITY: '', |
| | | TOTAL_QUANTITY: '' |
| | | BASE_QUANTITY: '1', |
| | | LOSS_QUANTITY: '0', |
| | | TOTAL_QUANTITY: '1' |
| | | }) |
| | | }, |
| | | delRow(row) { |
| | | delRow(row, index) { |
| | | 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.getBomMainData() |
| | | // } |
| | | // }) |
| | | // }).catch(() => { |
| | | // this.$message.info('已取消删除') |
| | | // }) |
| | | this.$confirm('是否确认删除?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | TBomDelete(row).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.status = 'Y' |
| | | this.dialogForm.startdate = '' |
| | | this.dialogForm.version = '' |
| | | this.dialogForm.bomdepth = '' |
| | | this.dialogForm.isdefaultbom = false |
| | | this.PartSelectArr = [] |
| | | this.PartSelectArrAll = [] |
| | | this.PartSelectArrTemp = [] |
| | | this.dialogTableDataArr = [] |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | |
| | | return this.$message.info('子件信息不能为空!') |
| | | } |
| | | |
| | | if (this.dialogTableDataArr.find(i => i.SMATERIRL_CODE === this.dialogForm.parentpartcode)) { |
| | | return this.$message.info('父件不能作为自己的子件!') |
| | | } |
| | | |
| | | 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 => { |
| | |
| | | 'base_quantity': i.BASE_QUANTITY, |
| | | 'loss_quantity': i.LOSS_QUANTITY, |
| | | 'total_quantity': i.TOTAL_QUANTITY, |
| | | 'idchildbom': '' |
| | | 'idchildbom': i.idchildbom ? i.tableData2.find(j => j.version === i.idchildbom).id : '' |
| | | }) |
| | | }) |
| | | |
| | | const data = { |
| | | 'id': '', |
| | | rowNum: '', |
| | | 'id': this.dialogForm.bomid, |
| | | 'materiel_code': this.dialogForm.parentpartcode, |
| | | 'materiel_name': this.dialogForm.parentpartname, |
| | | 'materiel_spec': this.dialogForm.parentpartspec, |
| | |
| | | 'startdate': this.dialogForm.startdate, |
| | | 'version': this.dialogForm.version, |
| | | 'isdefaultbom': this.dialogForm.isdefaultbom ? '1' : '0', |
| | | 'bomdepth': '', |
| | | 'bomdepth': this.dialogForm.bomdepth === '' ? '1' : this.dialogForm.bomdepth, |
| | | 'lm_user': '', |
| | | 'lm_date': '', |
| | | children |
| | |
| | | return 'custom-row' |
| | | }, |
| | | |
| | | rowClick(row, column, event) { |
| | | // this.dialogForm.parentpartcode = row.partcode |
| | | rowClick(r, row) { |
| | | row.idchildbom = r.version |
| | | } |
| | | |
| | | } |