| | |
| | | <div class="body" :style="{height:mainHeight+'px'}"> |
| | | <div class="bodyTopButtonGroup" style="justify-content: space-between"> |
| | | <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button> |
| | | <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=12')">导入</el-button> |
| | | <el-button |
| | | v-waves |
| | | type="success" |
| | | icon="el-icon-download" |
| | | @click="$router.push('./../systemSetting/dataImport?fileCode=12')" |
| | | >导入 |
| | | </el-button> |
| | | <!-- <el-button v-waves type="primary" icon="el-icon-download" @click="download">导出</el-button>--> |
| | | |
| | | </div> |
| | |
| | | prop="warehousename" |
| | | label="仓库名称" |
| | | sortable="custom" |
| | | /> |
| | | > |
| | | <template slot-scope="{row}"> |
| | | {{ row.warehousename ? row.warehousename : '/' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="surp_life" |
| | | label="预计寿命" |
| | |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-tag v-if="row.is_part==='Y'" size="small" type="success">是</el-tag> |
| | | <el-tag v-if="row.is_part==='N'" size="small" type="danger">否</el-tag> |
| | | <!-- <el-tag v-if="row.is_part==='Y'" size="small" type="success">是</el-tag>--> |
| | | <!-- <el-tag v-if="row.is_part==='N'" size="small" type="danger">否</el-tag>--> |
| | | <i |
| | | v-if="row.is_part==='Y'" |
| | | :style="{color:$store.state.settings.theme}" |
| | | class="el-icon-share" |
| | | style="cursor: pointer" |
| | | @click="connectClick(row)" |
| | | /> |
| | | <i |
| | | v-if="row.is_part==='N'" |
| | | class="el-icon-share" |
| | | style="color: rgb(180 ,181, 185);cursor:pointer;" |
| | | @click="connectClick(row)" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | |
| | | <el-dialog |
| | | v-el-drag-dialog |
| | | :title="operation==='add'?'新增':'编辑'" |
| | | :title="operation==='add'?'新增':(operation==='edit'?'编辑':'产品关联')" |
| | | :visible.sync="dialogVisible" |
| | | width="800px" |
| | | :close-on-click-modal="false" |
| | | top="7vh" |
| | | :top="operation!=='connect'? '7vh':'15vh'" |
| | | class="dialogFormClass" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | |
| | | <el-form ref="dialogForm" class="" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> |
| | | <el-form |
| | | v-if="operation!=='connect'" |
| | | ref="dialogForm" |
| | | class="" |
| | | inline |
| | | :rules="dialogFormRules" |
| | | :model="dialogForm" |
| | | label-width="110px" |
| | | > |
| | | <el-divider content-position="left">基本信息</el-divider> |
| | | <el-form-item label="模具编码" prop="mouldcode"> |
| | | <el-input v-model="dialogForm.mouldcode" :disabled="operation!=='add'" style="width: 200px" /> |
| | |
| | | <el-input v-model="dialogForm.mouldspec" style="width: 200px" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="仓库信息" prop="warehousecode"> |
| | | <el-select |
| | | v-model="dialogForm.warehousecode" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in wareHouseArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | <el-form-item required label="使用状态"> |
| | | <el-radio-group v-model="dialogForm.status"> |
| | | <el-radio label="Y">正常</el-radio> |
| | | <el-radio label="N">故障</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | |
| | | <!-- <el-form-item label="仓库信息" prop="warehousecode">--> |
| | | <!-- <el-select--> |
| | | <!-- v-model="dialogForm.warehousecode"--> |
| | | <!-- style="width:200px"--> |
| | | <!-- placeholder="请选择"--> |
| | | <!-- filterable--> |
| | | <!-- :popper-append-to-body="false"--> |
| | | <!-- >--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in wareHouseArr"--> |
| | | <!-- :key="item.code"--> |
| | | <!-- :label="item.name"--> |
| | | <!-- :value="item.code"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | |
| | | <el-form-item label="预计寿命"> |
| | | <el-input v-model="dialogForm.surplife" style="width: 200px" /> |
| | |
| | | <el-input v-model="dialogForm.resilife" style="width: 200px" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item required label="使用状态"> |
| | | <el-radio-group v-model="dialogForm.status"> |
| | | <el-radio label="Y">正常</el-radio> |
| | | <el-radio label="N">故障</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-divider content-position="left">关联产品</el-divider> |
| | | <el-divider v-if="operation!=='connect'" content-position="left">关联产品</el-divider> |
| | | |
| | | <el-input |
| | | v-model="filterText" |
| | |
| | | { code: 1, name: '出库' }, |
| | | { code: 2, name: '上机' }, |
| | | { code: 3, name: '下机' }, |
| | | { code: 4, name: '维修' }, |
| | | { code: 5, name: '外借' } |
| | | { code: 4, name: '待维修' }, |
| | | { code: 5, name: '已维修' }, |
| | | { code: 6, name: '已验证' }, |
| | | { code: 7, name: '外借' }, |
| | | { code: 8, name: '归还' } |
| | | ], |
| | | |
| | | total: 10, |
| | |
| | | mouldcode: '', |
| | | mouldname: '', |
| | | mouldspec: '', |
| | | warehousecode: '', |
| | | // warehousecode: '', |
| | | surplife: '', |
| | | resilife: '', |
| | | status: 'Y', |
| | |
| | | ], |
| | | mouldname: [ |
| | | { required: true, message: '请输入模具名称', trigger: ['blur', 'change'] } |
| | | ], |
| | | warehousecode: [ |
| | | { required: true, message: '请输入选择仓库信息', trigger: ['blur', 'change'] } |
| | | ] |
| | | // warehousecode: [ |
| | | // { required: true, message: '请输入选择仓库信息', trigger: ['blur', 'change'] } |
| | | // ] |
| | | }, |
| | | filterText: '', |
| | | defaultProps: { |
| | |
| | | this.dialogForm.mouldcode = row.code |
| | | this.dialogForm.mouldname = row.name |
| | | this.dialogForm.mouldspec = row.spec |
| | | this.dialogForm.warehousecode = row.warehousecode |
| | | // this.dialogForm.warehousecode = row.warehousecode |
| | | this.dialogForm.surplife = row.surp_life |
| | | this.dialogForm.resilife = row.resi_life |
| | | this.dialogForm.status = row.status |
| | | this.dialogForm.mouldpart = row.partcode ? row.partcode.split(',') : [] |
| | | this.$refs.tree.setCheckedKeys(this.dialogForm.mouldpart) |
| | | }) |
| | | }, |
| | | connectClick(row) { |
| | | this.operation = 'connect' |
| | | this.dialogVisible = true |
| | | this.dialogForm.opertype = 'Update' |
| | | |
| | | this.$nextTick(() => { |
| | | this.dialogForm.mouldcode = row.code |
| | | this.dialogForm.mouldname = row.name |
| | | this.dialogForm.mouldspec = row.spec |
| | | // this.dialogForm.warehousecode = row.warehousecode |
| | | this.dialogForm.surplife = row.surp_life |
| | | this.dialogForm.resilife = row.resi_life |
| | | this.dialogForm.status = row.status |
| | |
| | | mouldcode: '', |
| | | mouldname: '', |
| | | mouldspec: '', |
| | | warehousecode: '', |
| | | // warehousecode: '', |
| | | surplife: '', |
| | | resilife: '', |
| | | status: 'Y', |
| | | mouldpart: '', |
| | | opertype: '' |
| | | } |
| | | this.$refs.dialogForm.clearValidate() |
| | | if (this.operation !== 'connect') { |
| | | this.$refs.dialogForm.clearValidate() |
| | | } |
| | | }, |
| | | dialogVisibleCancel() { |
| | | this.dialogVisible = false |
| | | }, |
| | | dialogVisibleConfirm() { |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | const checkData = this.$refs.tree.getCheckedNodes() |
| | | this.dialogForm.mouldpart = [] |
| | | checkData.forEach(item => { |
| | | if (!Object.keys(item).includes('children')) { |
| | | this.dialogForm.mouldpart.push(item.code) |
| | | } |
| | | }) |
| | | if (this.dialogForm.mouldpart.length === 0) { |
| | | return this.$message.info('关联产品不能为空!') |
| | | } |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | AddUpdateMouldManger(this.dialogForm).then(res => { |
| | | if (res.code === '200') { |
| | | this.$notify.success(this.operation === 'add' ? '添加成功!' : '修改成功!') |
| | | this.$refs.tree.setCheckedKeys([]) |
| | | if (this.operation !== 'connect') { |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | const checkData = this.$refs.tree.getCheckedNodes() |
| | | this.dialogForm.mouldpart = [] |
| | | checkData.forEach(item => { |
| | | if (!Object.keys(item).includes('children')) { |
| | | this.dialogForm.mouldpart.push(item.code) |
| | | } |
| | | }) |
| | | // if (this.dialogForm.mouldpart.length === 0) { |
| | | // return this.$message.info('关联产品不能为空!') |
| | | // } |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | AddUpdateMouldManger(this.dialogForm).then(res => { |
| | | if (res.code === '200') { |
| | | this.$notify.success(this.operation === 'add' ? '添加成功!' : '修改成功!') |
| | | this.$refs.tree.setCheckedKeys([]) |
| | | |
| | | this.dialogVisible = false |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.getMouldMangerSearch() |
| | | } else { |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!') |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | this.dialogVisible = false |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.getMouldMangerSearch() |
| | | } else { |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!') |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | const checkData = this.$refs.tree.getCheckedNodes() |
| | | this.dialogForm.mouldpart = [] |
| | | checkData.forEach(item => { |
| | | if (!Object.keys(item).includes('children')) { |
| | | this.dialogForm.mouldpart.push(item.code) |
| | | } |
| | | }) |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | AddUpdateMouldManger(this.dialogForm).then(res => { |
| | | if (res.code === '200') { |
| | | this.$notify.success('关联成功!') |
| | | this.$refs.tree.setCheckedKeys([]) |
| | | this.dialogVisible = false |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.getMouldMangerSearch() |
| | | } else { |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.$notify.error('关联失败!') |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | filterNode(value, data) { |
| | | if (!value) return true |