| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371 |
- <template>
- <ele-modal
- width="80vw"
- :visible.sync="visible"
- v-if="visible"
- :close-on-click-modal="false"
- row-key="code"
- custom-class="ele-dialog-form"
- :title="'计划分解'"
- >
- <div class="form-wrapper">
- <el-form :model="requestData" label-width="0" :show-message="false">
- <el-descriptions title="" :column="2" border>
- <el-descriptions-item label="计划编号">
- {{ formData.code }}</el-descriptions-item
- >
- <el-descriptions-item label="产品编码">{{
- formData.productCode
- }}</el-descriptions-item>
- <el-descriptions-item label="产品名称">{{
- formData.productName
- }}</el-descriptions-item>
- <el-descriptions-item label="牌号|型号">
- {{ formData.brandNo }}|{{ formData.model }}</el-descriptions-item
- >
- <el-descriptions-item label="批次号">{{
- formData.batchNo
- }}</el-descriptions-item>
- <el-descriptions-item label="工艺路线">{{
- formData.produceRoutingName
- }}</el-descriptions-item>
- <el-descriptions-item label="要求生产数量">{{
- formData.requiredFormingNum
- }}</el-descriptions-item>
- <el-descriptions-item label="要求完成日期">{{
- formData.reqMoldTime
- }}</el-descriptions-item>
- <el-descriptions-item label="生产方式">{{
- formData.produceType == 2 ? '加工' : '装配'
- }}</el-descriptions-item>
- </el-descriptions>
- <headerTitle title="BOM信息" class="mt20"> </headerTitle>
- <ele-pro-table
- ref="table"
- :needPage="false"
- :columns="columns"
- :datasource="bomList"
- :selection.sync="selection"
- @update:selection="handleSelectionChange"
- tool-class="ele-toolbar-actions"
- max-height="360px"
- >
- <template v-slot:toolbar>
- <div class="toolbar_box">
- <div
- ><span>基本数量</span>
- <el-input placeholder="请输入" v-model.number="baseCount">
- </el-input>
- <DictSelection dictName="计量单位" v-model="unit"
- /></div>
- <el-button type="primary" size="mini" @click="handleAdd"
- >新增</el-button
- >
- </div>
- </template>
- </ele-pro-table>
- <headerTitle title="计划列表" class="mt20"> </headerTitle>
- <ele-pro-table
- ref="table2"
- :needPage="false"
- :columns="jsColumns"
- :datasource="jhList"
- tool-class="ele-toolbar-actions"
- max-height="360px"
- >
- </ele-pro-table>
- </el-form>
- </div>
- <div slot="footer">
- <el-button plain @click="cancel">取消</el-button>
- <el-button type="primary" @click="confirm">确定</el-button>
- </div>
- <EquipmentDialog ref="equipmentRefs" @choose="choose"></EquipmentDialog>
- </ele-modal>
- </template>
- <script>
- import { deepClone } from '@/utils';
- import { getBom } from '@/api/productionPlan/index.js';
- import EquipmentDialog from './EquipmentDialog.vue';
- export default {
- components: {
- EquipmentDialog
- },
- data() {
- return {
- visible: false,
- formData: {},
- requestData: {},
- bomList: [],
- baseCount: '',
- unit: '',
- selection: [],
- jhList: [],
- rules: {},
- columns: [
- {
- columnKey: 'selection',
- type: 'selection',
- width: 45,
- align: 'center'
- },
- {
- prop: 'code',
- label: '编码',
- showOverflowTooltip: true
- },
- {
- prop: 'name',
- label: '名称',
- showOverflowTooltip: true
- },
- {
- prop: 'dosage',
- label: '用量',
- showOverflowTooltip: true
- },
-
- {
- prop: 'unit',
- label: '计量单位',
- showOverflowTooltip: true
- },
-
- {
- prop: 'brandNo',
- label: '牌号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- minWidth: 150,
- showOverflowTooltip: true
- },
- {
- prop: 'model',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'versions',
- label: '版本'
- },
- {
- prop: 'status ',
- label: '状态',
- formatter: (row) => {
- return this.statusOpt[+row.status];
- }
- },
- {
- prop: 'createName',
- label: '创建人',
- showOverflowTooltip: true
- },
- {
- prop: 'createTime',
- label: '创建日期',
- showOverflowTooltip: true
- }
- ],
- statusOpt: {
- '': '全部',
- 0: '已停用',
- 1: '已发布'
- },
-
- jsColumns: [
- {
- prop: 'productCode',
- label: '产品编码',
- align: 'center',
- minWidth: 140
- },
- {
- prop: 'productName',
- label: '产品名称',
- align: 'center',
- minWidth: 140
- },
- {
- prop: 'brandNo',
- label: '牌号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- minWidth: 150,
- showOverflowTooltip: true
- },
- {
- prop: 'model',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true
- },
-
- {
- prop: 'produceRoutingName',
- label: '工艺路线',
- align: 'center',
- minWidth: 120
- },
- {
- prop: 'requiredFormingNum',
- label: '要求生产数量',
- align: 'center',
- slot: 'requiredFormingNum'
- },
- {
- prop: 'unit',
- label: '计量单位',
- showOverflowTooltip: true
- },
- ],
- };
- },
- methods: {
- open(row) {
- this.formData = deepClone(row);
- this.getBomList();
- },
- getBomList() {
- let params = {
- categoryId: this.formData.categoryId,
- bomType: this.formData.produceType,
- pageNum: 1,
- size: -1
- };
- getBom(params).then((res) => {
- this.bomList = res?.bomList || [];
- (this.baseCount = res.baseCount),
- (this.unit = res.unit),
- (this.visible = true);
- });
- },
- handleSelectionChange() {
- console.log(this.selection);
- let _arr = []
- _arr = this.selection.map(m => {
- let _num = this.formData.requiredFormingNum / this.baseCount * m.dosage;
- _num = _num.toFixed(3);
- return {
- productCode: m.code,
- productName: m.name,
- brandNo: m.brandNo,
- specification: m.specification,
- model: m.model,
- produceRoutingId: '',
- produceRoutingName: '',
- requiredFormingNum: _num,
- unit: this.unit,
-
- }
- })
- this.jhList = _arr;
-
- },
- handleAdd() {
- this.$refs.equipmentRefs.open();
- },
- choose(list) {
- console.log(list);
- },
- cancel() {
- this.formData = {};
- this.visible = false;
- },
- confirm() {
- this.$refs.form.validate(async (value) => {});
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .mt20 {
- margin-top: 20px;
- }
- .el-form-item {
- margin-bottom: 0 !important;
- }
- .toolbar_box {
- display: flex;
- justify-content: space-between;
- margin-right: 10px;
- > div {
- display: flex;
- align-items: center;
- justify-content: center;
- > span {
- width: 150px;
- }
- > div {
- margin-left: 10px;
- }
- }
- }
- </style>
|