cuijian
2025-06-26 694d882c7a27bc276d37f1c06d0c67a03146e086
src/views/base/FactoryManager.vue
ÎļþÃû´Ó src/views/system/ProductionManager.vue ÐÞ¸Ä
@@ -38,7 +38,7 @@
            <!--@rightClick="rightHandle"-->
            <!--:selectedKeys="selectedKeys"-->
            <!--:checkedKeys="checkedKeys"-->
            <!--:treeData="departTree"-->
            <!--:treeData="factoryTree"-->
            <!--:checkStrictly="checkStrictly"-->
            <!--:expandedKeys="iExpandedKeys"-->
            <!--:autoExpandParent="autoExpandParent"-->
@@ -61,7 +61,7 @@
              @rightClick="rightHandle"
              :selectedKeys="selectedKeys"
              :checkedKeys="checkedKeys"
              :treeData="departTree"
              :treeData="factoryTree"
              :checkStrictly="checkStrictly"
              :expandedKeys="iExpandedKeys"
              :autoExpandParent="autoExpandParent"
@@ -93,11 +93,11 @@
        <a-tab-pane tab="基本信息" key="1">
          <a-card :bordered="false" v-if="selectedKeys.length>0">
            <a-form-model ref="form" :model="model" :rules="validatorRules">
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productionCode" label="车间编号">
                <a-input placeholder="请输入产线/车间编号" v-model="model.productionCode"/>
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="factoryCode" label="车间编号">
                <a-input placeholder="请输入产线/车间编号" v-model="model.factoryCode"/>
              </a-form-model-item>
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productionName" label="车间名称">
                <a-input placeholder="请输入产线/车间名称" v-model="model.productionName"/>
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="factoryName" label="车间名称">
                <a-input placeholder="请输入产线/车间名称" v-model="model.factoryName"/>
              </a-form-model-item>
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级车间">
                <a-tree-select
@@ -110,10 +110,10 @@
                </a-tree-select>
              </a-form-model-item>
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="排序">
                <a-input-number v-model="model.productionOrder"/>
                <a-input-number v-model="model.sorter"/>
              </a-form-model-item>
              <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="备注">
                <a-textarea placeholder="请输入备注" v-model="model.memo"/>
                <a-textarea placeholder="请输入备注" v-model="model.remark"/>
              </a-form-model-item>
            </a-form-model>
            <div class="anty-form-btn">
@@ -127,32 +127,29 @@
            </a-empty>
          </a-card>
        </a-tab-pane>
        <!--<a-tab-pane tab="部门权限" key="2" forceRender>-->
        <!--<depart-auth-modal ref="departAuth"/>-->
        <!--</a-tab-pane>-->
        <a-tab-pane tab="设备列表" key="2" forceRender>
          <!--<depart-auth-modal/>-->
          <production-equipment ref="departAuth"></production-equipment>
        </a-tab-pane>
        <!-- <a-tab-pane tab="设备列表" key="2" forceRender>
          <factory-equipment ref="departAuth"></factory-equipment>
        </a-tab-pane> -->
      </a-tabs>
    </a-col>
    <production-modal ref="departModal" @ok="loadTree"></production-modal>
    <factory-modal ref="departModal" @ok="loadTree"></factory-modal>
  </a-row>
</template>
<script>
  import ProductionEquipment from './modules/ProductionManager/ProductionEquipment'
  import { queryProductionTreeList, searchByKeywords, deleteByProduction } from '@/api/api'
  import FactoryEquipment from './modules/FactoryManager/FactoryEquipment'
  import { queryFactoryTreeList, searchByKeywords, deleteByFactory } from '@/api/api'
  import { httpAction, deleteAction } from '@/api/manage'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ProductionModal from './modules/ProductionManager/ProductionModal'
  import FactoryModal from './modules/FactoryManager/FactoryModal'
  export default {
    name: 'ProductionManager',
    name: 'FactoryManager',
    mixins: [JeecgListMixin],
    components: {
      ProductionEquipment,
      ProductionModal
      FactoryEquipment,
      FactoryModal
    },
    data() {
      return {
@@ -164,7 +161,7 @@
        disable: true,
        treeData: [],
        visible: false,
        departTree: [],
        factoryTree: [],
        rightClickSelectedKey: '',
        rightClickSelectedOrgCode: '',
        hiding: true,
@@ -191,14 +188,14 @@
          edges: []
        },
        validatorRules: {
          productionName: [{ required: true, message: '请输入产线/车间名称!' }]
          factoryName: [{ required: true, message: '请输入产线/车间名称!' }]
        },
        url: {
          delete: '/mdc/mdcProduction/delete',
          edit: '/mdc/mdcProduction/edit',
          deleteBatch: '/mdc/mdcProduction/deleteBatch',
          exportXlsUrl: '/mdc/mdcProduction/exportXls',
          importExcelUrl: '/mdc/mdcProduction/importExcel'
          delete: '/base/factory/delete',
          edit: '/base/factory/edit',
          deleteBatch: '/base/factory/deleteBatch',
          exportXlsUrl: '/base/factory/exportXls',
          importExcelUrl: '/base/factory/importExcel'
        },
        orgCategoryDisabled: false,
        isIncludesNotLeaf: false
@@ -216,15 +213,15 @@
      loadTree() {
        var that = this
        that.treeData = []
        that.departTree = []
        queryProductionTreeList().then((res) => {
        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.treeData.push(temp)
              that.departTree.push(temp)
              that.factoryTree.push(temp)
              that.setThisExpandedKeys(temp)
              that.getAllKeys(temp)
              // console.log(temp.id)
@@ -277,7 +274,7 @@
      batchDel: function() {
        console.log(this.checkedKeys)
        this.isIncludesNotLeaf = false
        this.includesNotLeaf(this.departTree)
        this.includesNotLeaf(this.factoryTree)
        console.log('isIncludesNotLeaf', this.isIncludesNotLeaf)
        // ä¸ºtrue则表示选中项包含非叶子结点 false则表示选中项均为叶子结点
@@ -340,10 +337,10 @@
        if (value) {
          searchByKeywords({ keyWord: value }).then((res) => {
            if (res.success) {
              that.departTree = []
              that.factoryTree = []
              for (let i = 0; i < res.result.length; i++) {
                let temp = res.result[i]
                that.departTree.push(temp)
                that.factoryTree.push(temp)
              }
            } else {
              // that.$message.warning(res.message)
@@ -481,7 +478,7 @@
          this.$refs.departModal.add(this.selectedKeys)
          this.$refs.departModal.title = '新增'
        } else {
          this.$refs.departModal.add(this.rightClickSelectedKey)
          this.$refs.departModal.add(this.currSelected)
          this.$refs.departModal.title = '新增'
        }
      },
@@ -492,7 +489,7 @@
            title: '确认删除',
            content: `确定要删除 ${that.currSelected.productionName} å—?`,
            onOk: function() {
              deleteByProduction({ id: that.currSelected.id }).then((resp) => {
              deleteByFactory({ id: that.currSelected.id }).then((resp) => {
                if (resp.success) {
                  //删除成功后,去除已选中中的数据
                  // that.checkedKeys.splice(that.checkedKeys.findIndex(key => key === that.rightClickSelectedKey), 1)