设备管理模块设备车间管理页面新增机构类型字段以及限制条件
| | |
| | | <!-- 按钮操作区域 --> |
| | | <a-row style="margin-left: 14px"> |
| | | <a-button @click="handleAdd(1)" type="primary">添加机构</a-button> |
| | | <a-button @click="handleAdd(2)" type="primary">添加下级</a-button> |
| | | <!--<a-button type="primary" icon="download" @click="handleExportXls('车间信息')">导出</a-button>--> |
| | | <!--<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"--> |
| | | <!--:action="importExcelUrl" @change="handleImportExcel">--> |
| | | <!--<a-button type="primary" icon="import">导入</a-button>--> |
| | | <!--</a-upload>--> |
| | | <a-button @click="handleAdd(2)" type="primary" v-if="currSelected.factoryCategory!=3">添加下级</a-button> |
| | | <a-button @click="handleDelete" v-if="selectedKeys.length>0">删除</a-button> |
| | | <a-button title="删除多条数据" @click="batchDel" v-if="checkedKeys.length>0">批量删除</a-button> |
| | | </a-row> |
| | |
| | | sm: { span: 16 } |
| | | }, |
| | | validatorRules: { |
| | | factoryName: [{ required: true, message: '请输入机构名称!' }] |
| | | factoryName: [{ required: true, message: '请输入机构名称!', trigger: 'change' }] |
| | | }, |
| | | url: { |
| | | getProductionTreeList: '/eam/BaseFactory/queryTreeList', |
| | | delete: '/eam/BaseFactory/delete', |
| | | edit: '/eam/BaseFactory/edit', |
| | | deleteBatch: '/eam/BaseFactory/deleteBatch', |
| | | exportXlsUrl: '/eam/BaseFactory/exportXls', |
| | | importExcelUrl: '/eam/BaseFactory/importExcel' |
| | | deleteBatch: '/eam/BaseFactory/deleteBatch' |
| | | }, |
| | | isIncludesNotLeaf: false, |
| | | confirmLoading: false |
| | |
| | | this.model = this.currSelected |
| | | this.selectedKeys = [record.key] |
| | | this.$refs.userList.show(record.id) |
| | | if (this.$refs.form) this.$refs.form.clearValidate() |
| | | }, |
| | | |
| | | onClearSelected() { |
| | |
| | | }, |
| | | |
| | | emptyCurrForm() { |
| | | this.$refs.form.resetFields() |
| | | this.model = {} |
| | | this.model = { parentId: this.model.parentId } |
| | | }, |
| | | |
| | | handleAdd(num) { |
| | |
| | | v-model="model.parentId" placeholder="请选择上级机构" disabled> |
| | | </a-tree-select> |
| | | </a-form-model-item> |
| | | <a-form-model-item v-if="!seen" label="机构类型" hasFeedback prop="factoryCategory"> |
| | | <j-dict-select-tag dict-code="eam_production_type" placeholder="请选择机构类型" v-model="model.factoryCategory"/> |
| | | <a-form-model-item v-if="!seen&&(model.parentFactoryCategory==1||model.parentFactoryCategory==2)" label="机构类型" |
| | | hasFeedback |
| | | prop="factoryCategory"> |
| | | <a-select v-model="model.factoryCategory" placeholder="请选择机构类型"> |
| | | <a-select-option :value="2" v-if="model.parentFactoryCategory!=2">工区</a-select-option> |
| | | <a-select-option :value="3">工段</a-select-option> |
| | | </a-select> |
| | | </a-form-model-item> |
| | | <a-form-model-item label="排序"> |
| | | <a-input-number v-model="model.sorter"/> |
| | |
| | | }, |
| | | confirmLoading: false, |
| | | validatorRules: { |
| | | factoryName: [{ required: true, message: '请输入机构名称!' }], |
| | | factoryCategory: [{ required: true, message: '请选择机构类型!' }] |
| | | factoryName: [{ required: true, message: '请输入机构名称!', trigger: 'change' }], |
| | | factoryCategory: [{ required: true, message: '请选择机构类型!', trigger: 'change' }] |
| | | }, |
| | | url: { |
| | | queryById: '/eam/BaseFactory/queryIdTree', |
| | |
| | | }, |
| | | |
| | | add(record) { |
| | | const factoryCategory = record ? record.factoryCategory : '' |
| | | const parentId = record ? record.parentId : factoryCategory |
| | | if (this.$refs.form) this.$refs.form.clearValidate() |
| | | const parentFactoryCategory = record ? record.factoryCategory : '' |
| | | const parentId = record ? record.id : '' |
| | | if (parentId) this.seen = false |
| | | else this.seen = true |
| | | this.visible = true |
| | | this.model = Object.assign({}, { parentId }) |
| | | this.model = Object.assign({}, { parentId, parentFactoryCategory }) |
| | | if (parentFactoryCategory == 2) this.model.factoryCategory = +parentFactoryCategory + 1 |
| | | this.loadTreeData() |
| | | }, |
| | | |
| | |
| | | |
| | | close() { |
| | | this.$emit('close') |
| | | if (this.$refs.form) this.$refs.form.clearValidate() |
| | | this.visible = false |
| | | }, |
| | | |
| | |
| | | <template> |
| | | <a-card :bordered="false"> |
| | | <template v-if="queryParam.baseFactoryId"> |
| | | <template v-if="queryParam.factoryId"> |
| | | <div class="table-page-search-wrapper"> |
| | | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
| | | <a-row :gutter="24"> |
| | |
| | | visible: false, |
| | | url: { |
| | | list: '/eam/BaseFactoryUser/BaseFactoryUserList', |
| | | add: '/eam/BaseFactory/add', |
| | | delete: '/eam/BaseFactory/delete', |
| | | deleteBatch: '/eam/BaseFactory/deleteBatch' |
| | | add: '/eam/BaseFactoryUser/add', |
| | | delete: '/eam/BaseFactoryUser/delete', |
| | | deleteBatch: '/eam/BaseFactoryUser/deleteBatch' |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | show(baseFactoryId) { |
| | | this.$set(this.queryParam, 'baseFactoryId', baseFactoryId) |
| | | show(factoryId) { |
| | | this.$set(this.queryParam, 'factoryId', factoryId) |
| | | this.loadData(1) |
| | | }, |
| | | |
| | |
| | | |
| | | handleDelete(id) { |
| | | const that = this |
| | | deleteAction(that.url.delete, { id, baseFactoryId: this.queryParam.baseFactoryId }) |
| | | deleteAction(that.url.delete, { id, factoryId: this.queryParam.factoryId }) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | //重新计算分页问题 |
| | |
| | | that.loading = true |
| | | deleteAction(that.url.deleteBatch, { |
| | | ids, |
| | | baseFactoryId: that.queryParam.baseFactoryId |
| | | factoryId: that.queryParam.factoryId |
| | | }) |
| | | .then((res) => { |
| | | if (res.success) { |
| | |
| | | const that = this |
| | | const params = { |
| | | userId: selectedUserIdsArray.join(), |
| | | baseFactoryId: this.queryParam.baseFactoryId |
| | | factoryId: this.queryParam.factoryId |
| | | } |
| | | that.loading = true |
| | | postAction(that.url.add, params) |
| | |
| | | }, |
| | | |
| | | searchReset() { |
| | | this.queryParam = { baseFactoryId: this.queryParam.baseFactoryId } |
| | | this.queryParam = { factoryId: this.queryParam.factoryId } |
| | | this.loadData(1) |
| | | } |
| | | |