| | |
| | | <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-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-upload> --> |
| | | <a-button @click="handleDelete" v-if="selectedKeys.length>0">删除</a-button> |
| | | <a-button title="删除多条数据" @click="batchDel" v-if="checkedKeys.length>0">批量删除</a-button> |
| | | <!--<a-button @click="refresh" type="default" icon="reload" :loading="loading">刷新</a-button>--> |
| | |
| | | <a-input-search @search="onSearch" style="width:100%;margin-top: 10px" placeholder="请输入车间名称"/> |
| | | <!-- 树--> |
| | | <a-col :md="10" :sm="24"> |
| | | <!--<template>--> |
| | | <!--<a-dropdown :trigger="[this.dropTrigger]" @visibleChange="dropStatus">--> |
| | | <!--<span style="user-select: none">--> |
| | | <!--<a-tree--> |
| | | <!--checkable--> |
| | | <!--multiple--> |
| | | <!--@select="onSelect"--> |
| | | <!--@check="onCheck"--> |
| | | <!--@rightClick="rightHandle"--> |
| | | <!--:selectedKeys="selectedKeys"--> |
| | | <!--:checkedKeys="checkedKeys"--> |
| | | <!--:treeData="factoryTree"--> |
| | | <!--:checkStrictly="checkStrictly"--> |
| | | <!--:expandedKeys="iExpandedKeys"--> |
| | | <!--:autoExpandParent="autoExpandParent"--> |
| | | <!--@expand="onExpand"/>--> |
| | | <!--</span>--> |
| | | <!--<!–新增右键点击事件,和增加添加和删除功能–>--> |
| | | |
| | | <!--<a-menu slot="overlay">--> |
| | | <!--<a-menu-item @click="handleAdd(3)" key="1">添加</a-menu-item>--> |
| | | <!--<a-menu-item @click="handleDelete" key="2">删除</a-menu-item>--> |
| | | <!--<a-menu-item @click="closeDrop" key="3">取消</a-menu-item>--> |
| | | <!--</a-menu>--> |
| | | <!--</a-dropdown>--> |
| | | <!--</template>--> |
| | | <a-tree |
| | | checkable |
| | | multiple |
| | | @select="onSelect" |
| | | @check="onCheck" |
| | | @rightClick="rightHandle" |
| | | :selectedKeys="selectedKeys" |
| | | :checkedKeys="checkedKeys" |
| | | :treeData="factoryTree" |
| | |
| | | </a-card> |
| | | </a-tab-pane> |
| | | |
| | | <!-- <a-tab-pane tab="设备列表" key="2" forceRender> |
| | | <factory-equipment ref="departAuth"></factory-equipment> |
| | | </a-tab-pane> --> |
| | | <a-tab-pane tab="人员列表" key="2" forceRender> |
| | | <user-factory ref="userFactory"></user-factory> |
| | | <!-- <a-card v-if="factoryCategory == '3'"> |
| | | <user-factory ref="userFactory"></user-factory> |
| | | </a-card> |
| | | <a-card v-else> |
| | | <a-empty> |
| | | <span slot="description"> 请先选择一个产线! </span> |
| | | </a-empty> |
| | | </a-card> --> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | |
| | | </a-col> |
| | |
| | | </a-row> |
| | | </template> |
| | | <script> |
| | | import FactoryEquipment from './modules/FactoryManager/FactoryEquipment' |
| | | import UserFactory from './modules/factoryManager/UserFactory' |
| | | import { queryFactoryTreeList, searchByKeywords, deleteByFactory } from '@/api/api' |
| | | import { httpAction, deleteAction } from '@/api/manage' |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | import FactoryModal from './modules/FactoryManager/FactoryModal' |
| | | import FactoryModal from './modules/factoryManager/FactoryModal' |
| | | |
| | | export default { |
| | | name: 'FactoryManager', |
| | | mixins: [JeecgListMixin], |
| | | components: { |
| | | FactoryEquipment, |
| | | UserFactory, |
| | | FactoryModal |
| | | }, |
| | | data() { |
| | |
| | | treeData: [], |
| | | visible: false, |
| | | factoryTree: [], |
| | | rightClickSelectedKey: '', |
| | | rightClickSelectedOrgCode: '', |
| | | hiding: true, |
| | | model: {}, |
| | | dropTrigger: '', |
| | | depart: {}, |
| | | disableSubmit: false, |
| | | checkedKeys: [], |
| | | selectedKeys: [], |
| | | autoIncr: 1, |
| | | currSelected: {}, |
| | | allTreeKeys: [], |
| | | checkStrictly: true, |
| | |
| | | importExcelUrl: '/base/factory/importExcel' |
| | | }, |
| | | orgCategoryDisabled: false, |
| | | isIncludesNotLeaf: false |
| | | isIncludesNotLeaf: false, |
| | | factoryCategory:'' |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | that.factoryTree = [] |
| | | queryFactoryTreeList().then((res) => { |
| | | if (res.success) { |
| | | //部门全选后,再添加部门,选中数量增多 |
| | | this.allTreeKeys = [] |
| | | for (let i = 0; i < res.result.length; i++) { |
| | | let temp = res.result[i] |
| | |
| | | that.factoryTree.push(temp) |
| | | that.setThisExpandedKeys(temp) |
| | | that.getAllKeys(temp) |
| | | // console.log(temp.id) |
| | | } |
| | | this.loading = false |
| | | } |
| | |
| | | this.loading = true |
| | | this.loadTree() |
| | | }, |
| | | // 右键操作方法 |
| | | rightHandle({ event, node }) { |
| | | this.dropTrigger = 'contextmenu' |
| | | const record = node.dataRef |
| | | this.rightClickSelectedKey = record.id |
| | | this.rightClickSelected = record |
| | | this.rightClickSelectedOrgCode = record.orgCode |
| | | }, |
| | | onExpand(expandedKeys) { |
| | | console.log('onExpand', expandedKeys) |
| | | this.iExpandedKeys = expandedKeys |
| | | this.autoExpandParent = false |
| | | }, |
| | | backFlowList() { |
| | | this.$router.back(-1) |
| | | }, |
| | | // 右键点击下拉框改变事件 |
| | | dropStatus(visible) { |
| | | if (visible == false) { |
| | | this.dropTrigger = '' |
| | | } |
| | | }, |
| | | // 右键下拉关闭下拉框 |
| | | closeDrop() { |
| | | this.dropTrigger = '' |
| | | }, |
| | | addRootNode() { |
| | | this.$refs.nodeModal.add(this.currFlowId, '') |
| | | }, |
| | | |
| | | batchDel: function() { |
| | | console.log(this.checkedKeys) |
| | | this.isIncludesNotLeaf = false |
| | | this.includesNotLeaf(this.factoryTree) |
| | | console.log('isIncludesNotLeaf', this.isIncludesNotLeaf) |
| | | |
| | | // 为true则表示选中项包含非叶子结点 false则表示选中项均为叶子结点 |
| | | if (!this.isIncludesNotLeaf) { |
| | |
| | | } |
| | | |
| | | }, |
| | | nodeModalOk() { |
| | | this.loadTree() |
| | | }, |
| | | nodeModalClose() { |
| | | }, |
| | | hide() { |
| | | console.log(111) |
| | | this.visible = false |
| | | }, |
| | | onCheck(checkedKeys, info) { |
| | | console.log('onCheck', checkedKeys, info) |
| | | this.hiding = false |
| | | //---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------ |
| | | if (this.checkStrictly) { |
| | |
| | | //---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------ |
| | | }, |
| | | onSelect(selectedKeys, e) { |
| | | console.log('selected', selectedKeys, e) |
| | | this.hiding = false |
| | | this.deleteTrigger = 'leftClick' |
| | | let record = e.node.dataRef |
| | | console.log('onSelect-record', record) |
| | | this.factoryCategory = record.factoryCategory |
| | | this.currSelected = Object.assign({}, record) |
| | | this.model = this.currSelected |
| | | this.selectedKeys = [record.key] |
| | | this.model.parentId = record.parentId |
| | | this.setValuesToForm(record) |
| | | this.$refs.departAuth.show(record.id) |
| | | if(record.factoryCategory == '3'){ |
| | | this.$refs.userFactory.show(record.id) |
| | | }else{ |
| | | this.$refs.userFactory.factoryId = '' |
| | | } |
| | | }, |
| | | // 触发onSelect事件时,为部门树右侧的form表单赋值 |
| | | setValuesToForm(record) { |
| | |
| | | this.checkedKeys = [] |
| | | this.currSelected = {} |
| | | this.selectedKeys = [] |
| | | this.$refs.departAuth.departId = '' |
| | | }, |
| | | handleNodeTypeChange(val) { |
| | | this.currSelected.nodeType = val |
| | | }, |
| | | notifyTriggerTypeChange(value) { |
| | | this.currSelected.notifyTriggerType = value |
| | | }, |
| | | receiptTriggerTypeChange(value) { |
| | | this.currSelected.receiptTriggerType = value |
| | | this.$refs.userFactory.departId = '' |
| | | }, |
| | | submitCurrForm() { |
| | | this.$refs.form.validate(valid => { |
| | |
| | | this.$refs.form.resetFields() |
| | | this.model = {} |
| | | }, |
| | | nodeSettingFormSubmit() { |
| | | this.$refs.form.validate(valid => { |
| | | if (valid) { |
| | | console.log('Received values of form: ', this.model) |
| | | } |
| | | }) |
| | | }, |
| | | openSelect() { |
| | | this.$refs.sysDirectiveModal.show() |
| | | }, |
| | | handleAdd(num) { |
| | | if (num == 1) { |
| | | this.$refs.departModal.add() |
| | | this.$refs.departModal.title = '新增' |
| | | } else if (num == 2) { |
| | | console.log(this.currSelected) |
| | | let key = this.currSelected.key |
| | | if (!key) { |
| | | // this.$message.warning('请先点击选中上级车间!') |
| | |
| | | if (this.currSelected.leaf) { |
| | | this.$confirm({ |
| | | title: '确认删除', |
| | | content: `确定要删除 ${that.currSelected.productionName} 吗?`, |
| | | content: `确定要删除 ${that.currSelected.factoryName} 吗?`, |
| | | onOk: function() { |
| | | deleteByFactory({ id: that.currSelected.id }).then((resp) => { |
| | | if (resp.success) { |
| | |
| | | description: '删除成功' |
| | | }) |
| | | that.loadTree() |
| | | //删除后同步清空右侧基本信息内容 |
| | | // let orgCode=that.model.orgCode; |
| | | // if(orgCode && orgCode === that.rightClickSelectedOrgCode){ |
| | | that.onClearSelected() |
| | | // } |
| | | } else { |
| | | // that.$message.warning('删除失败!') |
| | | that.$notification.warning({ |
| | | message: '消息', |
| | | description: '删除失败' |
| | |
| | | message: '消息', |
| | | description: '此车间已挂载子节点' |
| | | }) |
| | | } |
| | | console.log('deletedRecord', deletedRecord) |
| | | }, |
| | | selectDirectiveOk(record) { |
| | | console.log('选中指令数据', record) |
| | | this.nodeSettingForm.setFieldsValue({ directiveCode: record.directiveCode }) |
| | | this.currSelected.sysCode = record.sysCode |
| | | }, |
| | | getFlowGraphData(node) { |
| | | this.graphDatasource.nodes.push({ |
| | | id: node.id, |
| | | text: node.flowNodeName |
| | | }) |
| | | if (node.children.length > 0) { |
| | | for (let a = 0; a < node.children.length; a++) { |
| | | let temp = node.children[a] |
| | | this.graphDatasource.edges.push({ |
| | | source: node.id, |
| | | target: temp.id |
| | | }) |
| | | this.getFlowGraphData(temp) |
| | | } |
| | | } |
| | | }, |
| | | //---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------ |
| | |
| | | } |
| | | }, |
| | | getAllKeys(node) { |
| | | // console.log('node',node); |
| | | this.allTreeKeys.push(node.key) |
| | | if (node.children && node.children.length > 0) { |
| | | for (let a = 0; a < node.children.length; a++) { |