cuilei
5 天以前 ba77fdc6a30c9ad0941e40319f8c4f6fe6fdf9f1
src/views/system/modules/UserModal.vue
@@ -136,40 +136,55 @@
        </a-form-model-item>
        <!--车间分配-->
<!--        <a-form-model-item-->
<!--          label="车间分配"-->
<!--          :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="车间分配"
          label="中心分配"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          v-show="!productionDisabled"
          v-show="!factoryDisabled"
        >
          <j-select-production
            v-model="model.selectedProduction"
          <j-select-factory
            v-model="model.selectedFactorys"
            :multi="true"
            @back="backProductionInfo"
            :backProduction="true"
            :treeProductOpera="true"
          ></j-select-production>
            @back="backFactoryInfo"
            :backFactory="true"
            :treeFactoryOpera="true"
          ></j-select-factory>
        </a-form-model-item>
        <a-form-model-item
          label="选择设备"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          v-show="!productionDisabled"
        >
          <a-tooltip title="选择设备后,用户就只有这些设备的权限!不选择设备,则会根据车间分配控制设备的权限!"
                     placement="topRight">
            <a-input-search
              :readOnly="true"
              v-model="model.equipmentIds"
              @search="deviceSearch"
              enter-button
              placeholder="请选择设备"
              :disabled="!model.selectedProduction"
            />
          </a-tooltip>
        </a-form-model-item>
<!--        <a-form-model-item-->
<!--          label="选择设备"-->
<!--          :labelCol="labelCol"-->
<!--          :wrapperCol="wrapperCol"-->
<!--          v-show="!productionDisabled"-->
<!--        >-->
<!--          <a-tooltip title="选择设备后,用户就只有这些设备的权限!不选择设备,则会根据车间分配控制设备的权限!"-->
<!--                     placement="topRight">-->
<!--            <a-input-search-->
<!--              :readOnly="true"-->
<!--              v-model="model.equipmentIds"-->
<!--              @search="deviceSearch"-->
<!--              enter-button-->
<!--              placeholder="请选择设备"-->
<!--              :disabled="!model.selectedProduction"-->
<!--            />-->
<!--          </a-tooltip>-->
<!--        </a-form-model-item>-->
        <!--<a-form-model-item-->
@@ -356,7 +371,7 @@
import { addUser, editUser, queryUserRole, queryall } from '@/api/api'
import { disabledAuthFilter } from '@/utils/authFilter'
import { duplicateCheck } from '@/api/api'
import JSelectProduction from '../../../components/jeecgbiz/JSelectProduction'
import JSelectFactory from '../../../components/jeecgbiz/JSelectFactory'
import { mapActions } from 'vuex'
import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
import SelectDeviceModal from './SelectDeviceModal'
@@ -365,12 +380,12 @@
  name: 'UserModal',
  components: {
    SelectDeviceModal,
    JSelectProduction
    JSelectFactory
  },
  data() {
    return {
      departDisabled: false, //是否是我的部门调用该页面
      productionDisabled: false, //是否是我的车间调用该页面
      factoryDisabled: false, //是否是我的车间调用该页面
      roleDisabled: false, //是否是角色维护调用该页面
      modalWidth: 800,
      drawerWidth: 700,
@@ -404,7 +419,6 @@
      departIdShow: false,
      title: '操作',
      visible: false,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
@@ -420,7 +434,7 @@
        fileUpload: window._CONFIG['domianURL'] + 'sys/common/upload',
        userWithDepart: '/sys/user/userDepartList', // 引入为指定用户查看部门信息需要的url
        //引入为指定用户查看车间信息需要的url
        userProductionList: '/sys/user/userProductionList',
        userFactoryList: '/sys/user/userFactorysList',
        userId: '/sys/user/generateUserId', // 引入生成添加用户情况下的url
        syncUserByUserName: '/act/process/extActProcess/doSyncUserByUserName',//同步用户到工作流
        queryTenantList: '/sys/tenant/queryList'
@@ -428,10 +442,10 @@
      tenantsOptions: [],
      rolesOptions: [],
      nextDepartOptions: [],
      nextProductionOptions: [],
      nextFactoryOptions: [],
      isDepartType: '',
      model: {
        selectedProduction: ''
        selectedFactorys: ''
      }
    }
  },
@@ -441,7 +455,7 @@
        if (value) this.initDictData('password_length')
      }
    },
    'model.selectedProduction': {
    'model.selectedFactorys': {
      handler(newVal, oldVal) {
        if (newVal && this.$refs.selectDeviceModal) {
          // 如果车间选择前后不一致则重置选择设备
@@ -489,7 +503,7 @@
        userIdentity: 1,
        selectedroles: '',
        selecteddeparts: '',
        selectedProduction: ''
        selectedFactorys: ''
      })
    },
    edit(record) {
@@ -510,6 +524,7 @@
      if (record.hasOwnProperty('id')) {
        that.getUserRoles(record.id)
        that.getUserDeparts(record.id)
        that.getUserFactorys(record.id)
      }
    },
    isDisabledAuth(code) {
@@ -582,26 +597,27 @@
          that.nextDepartOptions = departOptions
        }
      })
    },
    getUserFactorys(userid) {
      let that = this
      // 获取车间分配
      getAction(that.url.userProductionList, { userId: userid }).then((res) => {
      getAction(that.url.userFactoryList, { userId: userid }).then((res) => {
        if (res.success) {
          let ProductionOptions = []
          let selectProductKeys = []
          let factoryOptions = []
          let selectFactoryKeys = []
          for (let i = 0; i < res.result.length; i++) {
            selectProductKeys.push(res.result[i].key)
            selectFactoryKeys.push(res.result[i].key)
            //新增负责部门选择下拉框
            ProductionOptions.push({
            factoryOptions.push({
              value: res.result[i].key,
              label: res.result[i].title
            })
          }
          this.$set(this.model, 'selectedProduction', selectProductKeys.join(','))
          that.nextProductionOptions = ProductionOptions
          this.$set(this.model, 'selectedFactorys', selectFactoryKeys.join(','))
          that.nextFactoryOptions = factoryOptions
        }
      })
      //车间的url
    },
    backDepartInfo(info) {
      this.model.departIds = this.model.selecteddeparts
@@ -610,9 +626,9 @@
        return c
      })
    },
    backProductionInfo(info) {
      this.model.productionIds = this.model.selectedProduction
      this.nextProductionOptions = info.map((item, index, arr) => {
    backFactoryInfo(info) {
      this.model.productionIds = this.model.selectedFactorys
      this.nextFactoryOptions = info.map((item, index, arr) => {
        let c = { label: item.text, value: item.value + '' }
        return c
      })
@@ -621,7 +637,7 @@
    refresh() {
      this.userId = ''
      this.nextDepartOptions = []
      this.nextProductionOptions = []
      this.nextFactoryOptions = []
      this.departIdShow = false
    },
    close() {
@@ -629,7 +645,7 @@
      this.visible = false
      this.disableSubmit = false
      this.nextDepartOptions = []
      this.nextProductionOptions = []
      this.nextFactoryOptions = []
      this.departIdShow = false
      this.$refs.form.resetFields()
    },