| | |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | :height="tableHeight" |
| | | stripe |
| | | highlight-current-row |
| | | :style="{width: 100+'%',height:tableHeight+'px'}" |
| | | :style="{width: 100+'%',height:(tableHeight-50)+'px'}" |
| | | :header-cell-style="this.$headerCellStyle" |
| | | :cell-style="this.$cellStyle" |
| | | @sort-change="sortChange" |
| | |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="input_date" |
| | | label="投入时间" |
| | | label="投入日期" |
| | | sortable="custom" |
| | | width="120" |
| | | > |
| | |
| | | <template slot-scope="{row}"> |
| | | <div class="operationClass"> |
| | | <el-button type="text" @click="edit('edit',row)">修改</el-button> |
| | | <el-button type="text" @click="del(row.id)">删除</el-button> |
| | | <el-button type="text" @click="del(row)">删除</el-button> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </div> |
| | | <!--设备清单新增编辑--> |
| | | <el-dialog |
| | | :title="operation==='add'?'添加':'修改'" |
| | | :title="operation==='add'?'新增':'修改'" |
| | | :visible.sync="dialogVisible" |
| | | width="50%" |
| | | top="15vh" |
| | |
| | | @close="handleClose" |
| | | > |
| | | <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> |
| | | <el-form-item label="设备编码" prop="OrgCode"> |
| | | <el-input v-model="dialogForm.OrgCode" :disabled="operation!=='add'" style="width: 220px" /> |
| | | <el-form-item label="设备编码" prop="devicecode"> |
| | | <el-input v-model="dialogForm.devicecode" :disabled="operation!=='add'" style="width: 220px" /> |
| | | </el-form-item> |
| | | <el-form-item label="设备名称" prop="OrgName"> |
| | | <el-input v-model="dialogForm.OrgName" style="width: 220px" /> |
| | | <el-form-item label="设备名称" prop="devicename"> |
| | | <el-input v-model="dialogForm.devicename" style="width: 220px" /> |
| | | </el-form-item> |
| | | <el-form-item label="设备类型" prop="OrgName"> |
| | | <el-input v-model="dialogForm.OrgName" style="width: 220px" /> |
| | | <el-form-item label="设备类型" prop="devicetypecode"> |
| | | <el-select v-model="dialogForm.devicetypecode" style="width: 220px" placeholder="请选择" @change="devicetypecodeChange"> |
| | | <el-option |
| | | v-for="item in DeviceTypeArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="设备组" prop="OrgName"> |
| | | <el-input v-model="dialogForm.OrgName" style="width: 220px" /> |
| | | <el-form-item label="设备组" prop="devicegroupcode"> |
| | | <el-select v-model="dialogForm.devicegroupcode" :disabled="dialogForm.devicetypecode===''" style="width: 220px" placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in DeviceGroupArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="投入日期" prop="OrgName"> |
| | | <el-form-item label="投入日期" prop="importdate"> |
| | | <el-date-picker |
| | | v-model="dialogForm.OrgCode" |
| | | v-model="dialogForm.importdate" |
| | | style="width: 220px" |
| | | type="date" |
| | | placeholder="选择日期" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="所属车间" prop="OrgName"> |
| | | <el-input v-model="dialogForm.OrgName" style="width: 220px" /> |
| | | <el-form-item label="所属车间" prop="workshopcode"> |
| | | <el-select v-model="dialogForm.workshopcode" style="width: 220px" placeholder="请选择" @change="workshopcodeChange"> |
| | | <el-option |
| | | v-for="item in WorkShopArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属产线" prop="OrgName"> |
| | | <el-input v-model="dialogForm.OrgName" style="width: 220px" /> |
| | | <el-form-item label="所属产线" prop="linecode"> |
| | | <el-select v-model="dialogForm.linecode" :disabled="dialogForm.workshopcode===''" style="width: 220px" placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in WorkLineArr" |
| | | :key="item.linecode" |
| | | :label="item.linename" |
| | | :value="item.linecode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="使用状态" prop="OrgName"> |
| | | <el-select v-model="form.Status" placeholder="请选择"> |
| | | <el-form-item label="使用状态" prop="status"> |
| | | <el-select v-model="dialogForm.status" style="width: 220px" placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in StatusArr" |
| | | :key="item.value" |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="稼动率" prop="OrgName"> |
| | | <el-input v-model="dialogForm.OrgName" style="width: 220px" /> |
| | | <el-form-item label="稼动率" prop="ratio"> |
| | | <el-input v-model="dialogForm.ratio" style="width: 195px" /><span style="margin-left: 10px">%</span> |
| | | </el-form-item> |
| | | |
| | | </el-form> |
| | |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <!-- <el-input v-if="row.isVisible===1" v-model="row.eqptype_code" placeholder="请输入" />--> |
| | | <el-select v-if="row.isVisible===1" v-model="row.eqptype_code" placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in DeviceTypeArr" |
| | |
| | | |
| | | <script> |
| | | import Pagination from '@/components/Pagination' |
| | | import { |
| | | AddUpdateOrganization, |
| | | DeleteOrganization, |
| | | OrganizationSearch, |
| | | PrentOrganization, |
| | | RoleTypeDelete |
| | | } from '@/api/jcsz' |
| | | import { getCookie } from '@/utils/auth' |
| | | import { |
| | | AddUpdateDeviceGroup, |
| | | AddUpdateDeviceType, DeleteDeviceType, |
| | | AddUpdateDeviceGroup, AddUpdateDeviceManger, |
| | | AddUpdateDeviceType, DeleteDeviceManger, DeleteDeviceType, |
| | | DeviceGroupSearch, |
| | | DeviceMangerSearch, |
| | | DeviceTypeSearch, |
| | | DeviceTypeSelect, |
| | | DeviceTypeSelectGroup, |
| | | WorkShopSelect |
| | | WorkShopSelect, WorkShopSelectLine |
| | | } from '@/api/sbgl' |
| | | import { handleDatatime } from '@/utils/global' |
| | | |
| | | const SER_HZ = /^[\u4e00-\u9fa5]+$/ |
| | | export default { |
| | |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } |
| | | const validateTypeCode = (rule, value, callback) => { |
| | | if (!value) { |
| | | return callback(new Error('请选择上级')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | |
| | | tableData: [], |
| | | dialogVisible: false, |
| | | dialogForm: { |
| | | OrgType: '', |
| | | OrgCode: '', |
| | | OrgName: '', |
| | | SupUnit: ''// 上级单位 |
| | | id: '', |
| | | devicecode: '', |
| | | devicename: '', |
| | | devicetypecode: '', |
| | | devicegroupcode: '', |
| | | importdate: '', |
| | | workshopcode: '', |
| | | linecode: '', |
| | | status: '', |
| | | ratio: '' |
| | | }, |
| | | WorkLineArr: [], // 所属产线数组 |
| | | operation: '', |
| | | dialogFormRules: { |
| | | OrgType: [ |
| | | { required: true, message: '请输入选择类型', trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgCode: [ |
| | | devicecode: [ |
| | | { required: true, validator: validateName, trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgName: [ |
| | | devicename: [ |
| | | { required: true, message: '请输入名称', trigger: ['blur', 'change'] } |
| | | ], |
| | | SupUnit: [ |
| | | { required: true, validator: validateTypeCode, trigger: ['blur', 'change'] } |
| | | devicetypecode: [ |
| | | { required: true, message: '请选择设备类型', trigger: ['blur', 'change'] } |
| | | ], |
| | | devicegroupcode: [ |
| | | { required: true, message: '请选择设备组', trigger: ['blur', 'change'] } |
| | | ], |
| | | importdate: [ |
| | | { required: true, message: '请选择投入日期', trigger: ['blur', 'change'] } |
| | | ], |
| | | workshopcode: [ |
| | | { required: true, message: '请选择所属车间', trigger: ['blur', 'change'] } |
| | | ], |
| | | linecode: [ |
| | | { required: true, message: '请选择所属产线', trigger: ['blur', 'change'] } |
| | | ], |
| | | status: [ |
| | | { required: true, message: '请选择使用状态', trigger: ['blur', 'change'] } |
| | | ] |
| | | }, |
| | | DeviceTypeDialogVisible: false, |
| | |
| | | edit(operation, row) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | |
| | | // console.log(row) |
| | | this.$nextTick(() => { |
| | | this.dialogForm.OrgCode = row.org_code |
| | | this.dialogForm.OrgName = row.org_name |
| | | this.dialogForm.SupUnit = row.parent_id |
| | | this.dialogForm.id = row.id |
| | | this.dialogForm.devicecode = row.code |
| | | this.dialogForm.devicename = row.name |
| | | this.dialogForm.devicetypecode = row.eqptype_code |
| | | this.dialogForm.devicegroupcode = row.eqpgroup_code |
| | | this.dialogForm.importdate = row.input_date |
| | | this.dialogForm.workshopcode = row.wksp_code |
| | | this.dialogForm.linecode = row.Line_code |
| | | this.dialogForm.status = row.enable |
| | | this.dialogForm.ratio = row.operation_ration |
| | | }) |
| | | }, |
| | | // 删除按钮 |
| | | async del(id) { |
| | | async del(row) { |
| | | this.$confirm('是否确认删除?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | // DeleteOrganization({ orgid: id }).then(res => { |
| | | // if (res.code === '200') { |
| | | // this.$message.success('删除成功!') |
| | | // this.getDeviceMangerSearch() |
| | | // } |
| | | // }) |
| | | DeleteDeviceManger({ devicecode: row.code }).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success('删除成功!') |
| | | this.getDeviceMangerSearch() |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message.info('已取消删除') |
| | | }) |
| | | }, |
| | | // 对话框关闭事件 |
| | | handleClose() { |
| | | this.dialogForm.OrgType = '' |
| | | this.dialogForm.OrgCode = '' |
| | | this.dialogForm.OrgName = '' |
| | | this.dialogForm.SupUnit = '' |
| | | this.dialogForm.id = '' |
| | | this.dialogForm.devicecode = '' |
| | | this.dialogForm.devicename = '' |
| | | this.dialogForm.devicetypecode = '' |
| | | this.dialogForm.devicegroupcode = '' |
| | | this.dialogForm.importdate = '' |
| | | this.dialogForm.workshopcode = '' |
| | | this.dialogForm.linecode = '' |
| | | this.dialogForm.status = '' |
| | | this.dialogForm.ratio = '' |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // 对话框所属车间下拉选择改变时 |
| | | async workshopcodeChange(val) { |
| | | const { data: res } = await WorkShopSelectLine({ workshopcode: val }) |
| | | this.WorkLineArr = res |
| | | this.dialogForm.linecode = '' |
| | | }, |
| | | // 对话框设备类型下拉选择改变时 |
| | | async devicetypecodeChange(val) { |
| | | const { data: res } = await DeviceTypeSelectGroup({ eqptypecode: val }) |
| | | this.DeviceGroupArr = res |
| | | this.dialogForm.devicegroupcode = '' |
| | | }, |
| | | // 对话框取消 |
| | | dialogVisibleCancel() { |
| | |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | const data = { |
| | | OrganCode: this.dialogForm.OrgCode, |
| | | OrganName: this.dialogForm.OrgName, |
| | | OperType: this.operation === 'add' ? 'Add' : 'Update', |
| | | Operator: getCookie('admin') |
| | | id: this.dialogForm.id, |
| | | devicecode: this.dialogForm.devicecode, |
| | | devicename: this.dialogForm.devicename, |
| | | devicetypecode: this.dialogForm.devicetypecode, |
| | | devicegroupcode: this.dialogForm.devicegroupcode, |
| | | importdate: handleDatatime(this.dialogForm.importdate), |
| | | workshopcode: this.dialogForm.workshopcode, |
| | | linecode: this.dialogForm.linecode, |
| | | status: this.dialogForm.status, |
| | | ratio: this.dialogForm.ratio, |
| | | OperType: this.operation === 'add' ? 'Add' : 'Update' |
| | | } |
| | | AddUpdateOrganization(data).then(res => { |
| | | AddUpdateDeviceManger(data).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!') |
| | | this.dialogVisible = false |
| | |
| | | // 获取页面高度 |
| | | getHeight() { |
| | | this.$nextTick(() => { |
| | | this.mainHeight = window.innerHeight - 200 |
| | | this.mainHeight = window.innerHeight - 250 |
| | | this.tableHeight = this.mainHeight - 100 |
| | | }) |
| | | }, |
| | |
| | | width: 99%; |
| | | margin: 10px auto; |
| | | } |
| | | ::v-deep .el-form-item{ |
| | | .body ::v-deep .el-form-item{ |
| | | margin-bottom: 0; |
| | | } |
| | | </style> |