| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <template>
- <el-dialog
- title="问题对象"
- :visible.sync="equipmentdialog"
- :before-close="handleClose"
- :close-on-click-modal="true"
- :close-on-press-escape="false"
- append-to-body
- width="60%"
- >
- <el-row>
- <el-col :span="6">
- <el-form
- label-width="90px"
- style="padding: 10px"
- class="ele-form-search"
- @keyup.enter.native="search"
- @submit.native.prevent
- >
- <el-row>
- <el-col :span="24">
- <el-form-item label="批号:">
- <el-input
- v-model="where.batchNo"
- placeholder="请输入"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="编号:">
- <el-input v-model="where.code" placeholder="请输入"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="名称:">
- <el-input v-model="where.name" placeholder="请输入"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="产品编码:">
- <el-input
- v-model="where.productCode"
- placeholder="请输入"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="产品名称:">
- <el-input
- v-model="where.productName"
- placeholder="请输入"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="牌号:">
- <el-input
- v-model="where.brandNo"
- placeholder="请输入"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="型号:">
- <el-input v-model="where.model" placeholder="请输入"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="规格:">
- <el-input v-model="where.specification" placeholder="请输入"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <div class="ele-form-actions" style="display:flex;justify-content: end;margin-top: 15px;" >
- <el-button
- type="primary"
- icon="el-icon-search"
- class="ele-btn-icon"
- @click="search"
- >
- 查询
- </el-button>
- <el-button
- @click="reset"
- icon="el-icon-refresh-left"
- type="primary"
- >重置</el-button
- >
- </div>
- </el-col>
- </el-row> </el-form
- ></el-col>
- <el-col :span="18"
- ><div>
- <div class="switch">
- <div class="switch_left">
- <ul>
- <li
- v-for="item in tabOptions"
- :key="item.key"
- :class="{ active: activeComp == item.key }"
- @click="activeComp = item.key"
- >
- {{ item.name }}
- </li>
- </ul>
- </div>
- </div>
- </div>
- <productionPlan
- v-if="activeComp == 'productionPlan'"
- ref="productionPlan"
- />
- <workOrder v-if="activeComp == 'workOrder'" ref="workOrder" />
- <produceOrder v-if="activeComp == 'produceOrder'" ref="produceOrder" />
- <div>
- <ele-pro-table
- ref="table"
- :columns="objColumns"
- :datasource="tableList"
- :selection.sync="selection"
- row-key="id"
- height="20vh"
- :needPage="false"
- >
- <template v-slot:toolbar>
- <el-button type="primary" size="small" @click="add"
- >添加</el-button
- >
- <el-button size="small" @click="del">移除</el-button></template
- >
- </ele-pro-table>
- </div></el-col
- >
- </el-row>
- <template v-slot:footer>
- <el-button type="primary" size="small" @click="selected">确认</el-button>
- <el-button size="small" @click="handleClose">关闭</el-button>
- </template>
- </el-dialog>
- </template>
- <script>
- // 默认表单数据
- const defaultWhere = {
- code: '',
- name: '',
- productCode: '',
- productName: '',
- brandNo: '',
- model: '',
- batchNo:"",
- specification:''
- };
- import { objColumns } from './data.js';
- import dictMixins from '@/mixins/dictMixins';
- import productionPlan from './productionPlan';
- import workOrder from './workOrder';
- import produceOrder from './produceOrder';
- export default {
- components: { productionPlan, workOrder, produceOrder },
- mixins: [dictMixins],
- data() {
- return {
- activeComp: 'productionPlan',
- where: {...defaultWhere},
- tabOptions: [
- { key: 'productionPlan', name: '生产计划' },
- { key: 'workOrder', name: '生产订单' },
- { key: 'produceOrder', name: '生产工单' }
- ],
- objColumns: objColumns,
- equipmentdialog: false,
- tableList: [],
- selection: []
- };
- },
- watch: {},
- methods: {
- open(data) {
- this.tableList = (data && JSON.parse(JSON.stringify(data))) || [];
- this.equipmentdialog = true;
- },
- reload() {
- this.$refs.equiTable.reload();
- },
- handleClose() {
- this.equipmentdialog = false;
- },
- reset() {
- this.reload();
- },
- add() {
- const planStatus = [
- { label: '待发布', value: '2' },
- { label: '发布失败', value: '3' },
- { label: '待生产', value: '4' },
- { label: '生产中', value: '5' },
- { label: '已完成', value: '6' },
- { label: '已延期', value: '7' },
- { label: '待下达', value: '8' }
- ];
- if (this.$refs[this.activeComp].getValue().length == 0) {
- return;
- }
- let ids = this.tableList.map((item) => item.id);
- let getValue = this.$refs[this.activeComp]
- .getValue()
- .filter((item) => !ids.includes(item.id)); //去重
- getValue.forEach((element) => {
- element.status = planStatus.find(
- (item) => item.value == element.status
- ).label;
- });
- this.tableList.push(...getValue);
- },
- del() {
- let ids = this.selection.map((item) => item.id);
- this.tableList = this.tableList.filter((item) => !ids.includes(item.id));
- },
- // 选择
- selected() {
- this.$emit('choose', JSON.parse(JSON.stringify(this.tableList)));
- this.handleClose();
- },
- /* 搜索 */
- search() {
- this.$refs[this.activeComp].reload(this.where)
- },
- /* 重置 */
- reset() {
- this.where = { ...defaultWhere };
- this.search();
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- :deep(.el-row) {
- margin-bottom: 20px;
- &:last-child {
- margin-bottom: 0;
- }
- }
- </style>
|