Lius
2025-07-28 9d67939cb72ce57e3717b45b48c28655adc628a7
src/views/system/modules/UserModal.vue
@@ -150,6 +150,22 @@
          ></j-select-factory>
        </a-form-model-item>
        <!--车间分配-->
        <a-form-model-item
          label="MDC车间分配"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          v-show="!productionDisabled"
        >
          <j-select-production
            v-model="model.selectedProduction"
            :multi="true"
            @back="backProductionInfo"
            :backProduction="true"
            :treeProductOpera="true"
          ></j-select-production>
        </a-form-model-item>
        <!--<a-form-model-item-->
          <!--label="选择设备"-->
          <!--:labelCol="labelCol"-->
@@ -353,18 +369,21 @@
  import JSelectFactory from '../../../components/jeecgbiz/JSelectFactory'
  import { mapActions } from 'vuex'
  import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
  import JSelectProduction from '../../../components/jeecgbiz/JSelectProduction'
  // import SelectDeviceModal from './SelectDeviceModal'
  export default {
    name: 'UserModal',
    components: {
      // SelectDeviceModal,
      JSelectFactory
      JSelectFactory,
      JSelectProduction
    },
    data() {
      return {
        departDisabled: false, //是否是我的部门调用该页面
        factoryDisabled: false, //是否是我的车间调用该页面
        productionDisabled: false, //是否是我的车间调用该页面
        roleDisabled: false, //是否是角色维护调用该页面
        modalWidth: 800,
        drawerWidth: 700,
@@ -421,9 +440,11 @@
        rolesOptions: [],
        nextDepartOptions: [],
        nextFactoryOptions: [],
        nextProductionOptions: [],
        isDepartType: '',
        model: {
          selectedFactory: ''
          selectedFactory: '',
          selectedProduction: ''
        }
      }
    },
@@ -439,6 +460,17 @@
            // 如果车间选择前后不一致则重置选择设备
            if ((oldVal && newVal !== oldVal)) this.model.equipmentIds = ''
            //this.$refs.selectDeviceModal.queryTreeData(newVal)
          }
          // 如果清空车间值则重置选择设备
          if (newVal === '') this.model.equipmentIds = ''
        }
      },
      'model.selectedProduction': {
        handler(newVal, oldVal) {
          if (newVal && this.$refs.selectDeviceModal) {
            // 如果车间选择前后不一致则重置选择设备
            if ((oldVal && newVal !== oldVal)) this.model.equipmentIds = ''
            this.$refs.selectDeviceModal.queryTreeData(newVal)
          }
          // 如果清空车间值则重置选择设备
          if (newVal === '') this.model.equipmentIds = ''
@@ -481,7 +513,8 @@
          userIdentity: 1,
          selectedroles: '',
          selecteddeparts: '',
          selectedFactory: ''
          selectedFactory: '',
          selectedProduction: ''
        })
      },
      edit(record) {
@@ -593,6 +626,24 @@
            that.nextFactoryOptions = FactoryOptions
          }
        })
        getAction(that.url.userProductionList, { userId: userid }).then((res) => {
          if (res.success) {
            let ProductionOptions = []
            let selectProductKeys = []
            for (let i = 0; i < res.result.length; i++) {
              selectProductKeys.push(res.result[i].key)
              //新增负责部门选择下拉框
              ProductionOptions.push({
                value: res.result[i].key,
                label: res.result[i].title
              })
            }
            this.$set(this.model, 'selectedProduction', selectProductKeys.join(','))
            that.nextProductionOptions = ProductionOptions
          }
        })
        //车间的url
      },
      backDepartInfo(info) {
@@ -610,10 +661,19 @@
        })
      },
      backProductionInfo(info) {
        this.model.productionIds = this.model.selectedProduction
        this.nextProductionOptions = info.map((item, index, arr) => {
          let c = { label: item.text, value: item.value + '' }
          return c
        })
      },
      refresh() {
        this.userId = ''
        this.nextDepartOptions = []
        this.nextFactoryOptions = []
        this.nextProductionOptions = []
        this.departIdShow = false
      },
      close() {
@@ -622,6 +682,7 @@
        this.disableSubmit = false
        this.nextDepartOptions = []
        this.nextFactoryOptions = []
        this.nextProductionOptions = []
        this.departIdShow = false
        this.$refs.form.resetFields()
      },