| | |
| | | <template> |
| | | <div class="mod-config"> |
| | | <basic-container> |
| | | <ttable |
| | | :table="table" |
| | | :isShowHide="true" |
| | | :ajaxFun="ajaxFun" |
| | | :prelang="prelang" |
| | | :options="options" |
| | | ref="processconfiguration" |
| | | > |
| | | <template #toolbar></template> |
| | | </ttable> |
| | | <ttable |
| | | @handleSelectionChange="handleSelectionChange" |
| | | :table="table" |
| | | :ajaxFun="ajaxFun" |
| | | :prelang="prelang" |
| | | :options="options" |
| | | ref="mouldTable" |
| | | class="mouldTable" |
| | | > |
| | | <template #toolbar></template> |
| | | </ttable> |
| | | </basic-container> |
| | | <table-form |
| | | v-if="addOrUpdateVisible" |
| | | ></table-form> |
| | | <el-dialog |
| | | :title="editRow==null ? '新增':'修改'" |
| | | :visible.sync="dialogVisible" |
| | | width="40%"> |
| | | <el-form :model="editRow" label-position="right" label-width="100px" ref="editForm" :rules="editRules"> |
| | | <el-form-item prop="code" label="模具编码"> |
| | | <el-input v-model="editRow.code" placeholder="请输入模具编码称"></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="name" label="模具名称"> |
| | | <el-input v-model="editRow.name" placeholder="请输入模具名称"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="confirmSaveOrUpdateMould">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import ttable from '@/views/common/ztt-table.vue' |
| | | import { page, } from '@/api/equipment/mould' |
| | | import TableForm from './mould-from.vue' |
| | | import * as fecha from 'element-ui/lib/utils/date' |
| | | import { fetchList,addMould,updateMould,delById } from '@/api/equipment/moulde' |
| | | import { mapGetters } from 'vuex' |
| | | export default { |
| | | data(){ |
| | | return { |
| | | ajaxFun: page, |
| | | prelang: 'operation', |
| | | addOrUpdateVisible: false, |
| | | diaPrintTab: false, |
| | | editRules: { |
| | | code: [{required:true,message:'请输入模具编号',trigger:'blur'}], |
| | | name: [{required:true,message:'请输入模具名称',trigger:'blur'}] |
| | | }, |
| | | editRow: { |
| | | code: null, |
| | | name: null, |
| | | }, |
| | | dialogVisible: false, |
| | | ajaxFun: fetchList, |
| | | prelang: 'moudle', |
| | | multipleSelection: [], |
| | | dataListLoading: false, |
| | | options: { |
| | | height: 300, // 默认高度-为了表头固定 |
| | | stripe: true, // 是否为斑马纹 table |
| | |
| | | // 标题 |
| | | column: [ |
| | | { |
| | | minWidth: '140', |
| | | prop: 'packageNo', |
| | | label: '设备', |
| | | isTrue: true, |
| | | isSearch: true, |
| | | searchInfoType: 'text', |
| | | },{ |
| | | minWidth: '140', |
| | | prop: 'outBatchNo', |
| | | minWidth: '140px', |
| | | prop: 'code', |
| | | label: '模具编号', |
| | | isTrue: true, |
| | | isSearch: true, |
| | | searchInfoType: 'text', |
| | | |
| | | render: { fun: this.addOrUpdateHandle } |
| | | }, |
| | | { |
| | | minWidth: '140', |
| | | prop: 'partNo', |
| | | minWidth: '140px', |
| | | prop: 'name', |
| | | label: '模具名称', |
| | | isTrue: true, |
| | | isSearch: true, |
| | | searchInfoType: 'text', |
| | | }, |
| | | { |
| | | minWidth: '140', |
| | | prop: 'partName', |
| | | label: '工序', |
| | | minWidth: '140px', |
| | | prop: 'createUser', |
| | | label: '责任人', |
| | | isTrue: true, |
| | | isSearch: true, |
| | | searchInfoType: 'text', |
| | | }, |
| | | { |
| | | minWidth: '140', |
| | | prop: 'specs', |
| | | label: '工步', |
| | | minWidth: '140px', |
| | | prop: 'status', |
| | | label: '模具状态', |
| | | isTrue: true, |
| | | isSearch: true, |
| | | searchInfoType: 'text', |
| | | }, |
| | | { |
| | | minWidth: '140', |
| | | prop: 'unit', |
| | | label: '寿命转换系数', |
| | | minWidth: '140px', |
| | | prop: 'createTime', |
| | | label: '创建时间', |
| | | isTrue: true, |
| | | isSearch: true, |
| | | searchInfoType: 'text', |
| | | searchInfoType: 'date', |
| | | formatter: this.formatDateTime |
| | | }, |
| | | ], |
| | | toolbar: [{ |
| | | text: '新增', |
| | | type: 'primary', |
| | | fun: this.addOrUpdateHandle |
| | | }], |
| | | operator: [{ |
| | | text: '删除', |
| | | type: 'text', |
| | | size: 'small', |
| | | fun: this.deleteHandle |
| | | }], |
| | | toolbar: [], |
| | | operator: null, |
| | | operatorConfig: { |
| | | fixed: 'right', |
| | | label: '操作', |
| | | width: 100, |
| | | minWidth: 100 |
| | | }, |
| | | }, |
| | | }, |
| | | } |
| | | }, |
| | | // computed: { |
| | | // ...mapGetters(['permissions']) |
| | | // }, |
| | | computed: { |
| | | ...mapGetters(['permissions']) |
| | | }, |
| | | components: { |
| | | ttable, |
| | | TableForm |
| | | }, |
| | | watch: { |
| | | dialogVisible(newVal){ |
| | | if(!newVal){ |
| | | this.editRow = { |
| | | code: null, |
| | | name: null, |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | created(){ |
| | | if(this.permissions.equipment_mould_add){ |
| | | this.table.toolbar.push({ |
| | | text: '新增', |
| | | type: 'primary', |
| | | fun: this.addOrUpdateHandle |
| | | }) |
| | | } |
| | | if(this.permissions.equipment_mould_del){ |
| | | this.table.operator = [{ |
| | | text: '删除', |
| | | type: 'text', |
| | | fun: this.deleteHandle |
| | | }] |
| | | } |
| | | }, |
| | | mounted(){ |
| | | |
| | | }, |
| | | methods: { |
| | | addOrUpdateHandle() { |
| | | this.addOrUpdateVisible = true |
| | | console.log(this.addOrUpdateVisible,"--=--"); |
| | | }, |
| | | handleSelectionChange(val) { |
| | | this.multipleSelection = val |
| | | }, |
| | | deleteHandle(row){ |
| | | this.$confirm('是否确认删除模具名称为' + row.name, '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | closeOnClickModal: false, |
| | | type: 'warning' |
| | | }) |
| | | .then(function() { |
| | | return delById(row.id) |
| | | }).then((data) => { |
| | | this.$message.success('删除成功') |
| | | this.getData() |
| | | }) |
| | | }, |
| | | confirmSaveOrUpdateMould(){ |
| | | this.$refs.editForm.validate(valid=>{ |
| | | if(valid){ |
| | | if(this.editRow.id){ |
| | | updateMould(this.editRow).then(res=>{ |
| | | if(res.status===200){ |
| | | this.$message.success("修改成功") |
| | | this.getData() |
| | | } |
| | | }).catch(error=>{ |
| | | console.error(error) |
| | | }) |
| | | }else{ |
| | | addMould(this.editRow).then(res=>{ |
| | | if(res.status===200){ |
| | | this.$message.success("新增成功") |
| | | this.getData() |
| | | } |
| | | }).catch(error=>{ |
| | | console.error(error) |
| | | }) |
| | | } |
| | | this.dialogVisible = false |
| | | } |
| | | }) |
| | | }, |
| | | addOrUpdateHandle(row){ |
| | | if(row){ |
| | | this.editRow = row |
| | | } |
| | | this.dialogVisible = true |
| | | }, |
| | | formatDateTime(row, column, cellValue) { |
| | | return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd HH:mm:ss') : '' |
| | | }, |
| | | getData() { |
| | | this.$refs.mouldTable.getDataList() |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | </script> |
| | | <style scoped> |
| | | .mouldTable >>>.el-table__fixed-right .el-table__fixed-body-wrapper { |
| | | top: 74px !important; |
| | | } |
| | | </style> |