loulijun2021
2023-06-13 3784cc5b9f62d0397c3036126c014fe4070e8a7d
1.组织架构和用户清单引入分车间概念
已修改8个文件
171 ■■■■ 文件已修改
src/api/basicInfo.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/permission.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/settings.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicSettings/organizationList.vue 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicSettings/roleList.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicSettings/userList.vue 89 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/index.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/basicInfo.js
@@ -49,3 +49,12 @@
    method: 'get'
  })
}
// 通过选择的所属组织查询所属班组
export function StorgGroupSelect(data) {
  return request({
    url: 'BaseDate/StorgGroupSelect',
    method: 'get',
    params: data
  })
}
src/permission.js
@@ -38,6 +38,9 @@
          // 生成可访问的路由表
          await store.dispatch('permission/generateRoutes', menu)
          // eslint-disable-next-line require-atomic-updates
          store.state.settings.orgType = getCookie('description')
          // 动态添加可访问路由表
          router.addRoutes(store.getters.addRouters)
src/settings.js
@@ -32,6 +32,8 @@
  leftBackgroundColorValue: true, // 左侧栏背景颜色
  animationType: 'fade-transform'// 动画类型     初始类型:fade-transform
  animationType: 'fade-transform', // 动画类型     初始类型:fade-transform
  orgType: ''// 组织类型  D 部门   W 车间  '' 管理员
}
src/store/modules/user.js
@@ -48,6 +48,8 @@
        setCookie('userid', res.data.userid)
        setCookie('rediskey', res.data.rediskey)
        setCookie('guid', res.data.guid)
        setCookie('stu_torgcode', res.data.stu_torgcode)
        setCookie('description', res.data.description)
        // }
        // console.log(res.code === '302', 8989)
        // if (res.code === '302') {
@@ -119,11 +121,13 @@
      const username = getCookie('admin')
      const usertype = getCookie('usertype')
      const userid = getCookie('userid')
      const stu_torgcode = getCookie('stu_torgcode')
      const data = {
        usercode,
        username,
        usertype,
        userid
        userid,
        stu_torgcode
      }
      logout(data).then(res => {
@@ -139,6 +143,8 @@
          removeCookie('userid')
          removeCookie('rediskey')
          removeCookie('code')
          removeCookie('stu_torgcode')
          removeCookie('description')
          removeCookie('guid')
src/views/basicSettings/organizationList.vue
@@ -201,11 +201,10 @@
      @close="handleClose"
    >
      <el-form ref="dialogForm" :rules="dialogFormRules" :model="dialogForm" label-width="80px">
        <el-form-item label="组织类型" prop="OrgType">
        <el-form-item v-if="$store.state.settings.orgType===''" label="组织类型" prop="OrgType">
          <el-radio-group
            v-model="dialogForm.OrgType"
            :disabled="operation==='edit'"
            @change="changeRadio"
          >
            <el-radio
              v-for="item in OrgTypeArr"
@@ -232,7 +231,7 @@
            <el-option
              v-for="item in SupUnitArr"
              :key="item.id"
              :label="item.org_name"
              :label="item.org_name+' / '+item.org_code"
              :value="item.id"
            />
          </el-select>
@@ -442,7 +441,7 @@
  //   }
  // },
  created() {
    this.getOrganizationSearch()
    this.handleRequest()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
@@ -472,10 +471,24 @@
      this.tableTimeStampKey = new Date().getTime()
      this.$refs.tableDataRef.doLayout()
    },
    handleRequest() {
      this.getOrganizationSearch().then(res => {
        if (res.code === '200') {
          this.getPrentOrganization()
        }
      })
    },
    async getOrganizationSearch() {
      const res = await OrganizationSearch(this.form)
      this.tableData = res.data
      this.total = res.count
      return { code: res.code }
    },
    async getPrentOrganization() {
      const { data: res } = await PrentOrganization({ orgcode: 'W' })
      this.SupUnitArr = res
    },
    // 排序改变时
    sortChange({ column, prop, order }) {
@@ -502,15 +515,14 @@
      this.form.UserName = ''
      this.getOrganizationSearch()
    },
    // 单选框改变时
    async changeRadio(val) {
      if (this.dialogForm.OrgType !== '部门') {
        const { data: res } = await PrentOrganization({ orgcode: this.OrgTypeArr.find(item => item.label === this.dialogForm.OrgType).value })
        this.SupUnitArr = res
      }
    },
    // 新增按钮
    async add(operation) {
      console.log(this.$store.state.settings.orgType, 987)
      if (this.$store.state.settings.orgType === 'W') {
        return this.$message.info('当前用户无新增权限!')
      }
      this.operation = operation
      this.dialogVisible = true
@@ -520,6 +532,10 @@
    },
    // 修改按钮
    edit(operation, row) {
      if (this.$store.state.settings.orgType === 'W') {
        return this.$message.info('当前用户无修改权限!')
      }
      this.operation = operation
      this.dialogVisible = true
      // if (row.description === 'F') {
@@ -544,6 +560,10 @@
    },
    // 删除按钮
    async del(id) {
      if (this.$store.state.settings.orgType === 'W') {
        return this.$message.info('当前用户无删除权限!')
      }
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
@@ -580,14 +600,14 @@
        if (valid) {
          this.$store.state.app.buttonIsDisabled = true
          const data = {
            OrganType: this.dialogForm.OrgType === '部门' ? 'D' : 'W',
            OrganType: this.$store.state.settings.orgType !== '' ? 'W' : (this.dialogForm.OrgType === '部门' ? 'D' : 'W'),
            OrganCode: this.dialogForm.OrgCode,
            OrganName: this.dialogForm.OrgName,
            RightCode: '',
            numvalue: '',
            // RightCode: this.operation === 'add' ? getCookie('ruleCode') : '',
            // numvalue: this.operation === 'add' ? this.numvalue : '',
            SupUnit: this.dialogForm.OrgType === '部门' ? '0' : this.dialogForm.SupUnit,
            SupUnit: this.$store.state.settings.orgType !== '' ? this.SupUnitArr.find(i => i.org_code === getCookie('stu_torgcode')).id : (this.dialogForm.OrgType === '部门' ? '0' : this.dialogForm.SupUnit),
            OperType: this.operation === 'add' ? 'Add' : 'Update',
            Operator: getCookie('admin')
          }
src/views/basicSettings/roleList.vue
@@ -706,7 +706,7 @@
          prop: 'is_user',
          label: '关联用户',
          id: 8,
          show: true,
          show: false,
          fixed: false,
          sortable: true
        },
src/views/basicSettings/userList.vue
@@ -29,12 +29,13 @@
            <el-form-item label="所属组织" style=" display: flex;">
              <el-cascader
                ref="cascader"
                v-model="form.StuOrg"
                filterable
                popper-class="elCascader"
                :options="StuOrgArr"
                :props="defaultProps"
                @change="cascaderChange"
              />
              <!--              @change="cascaderChange"-->
              <!--              @focus="getUserOrganization"-->
            </el-form-item>
@@ -364,6 +365,7 @@
          <el-cascader
            ref="dialogCascader"
            key="cascaderKey"
            v-model="dialogForm.StuOrg"
            filterable
            popper-class="elCascader"
            :options="StuOrgArr2"
@@ -371,6 +373,7 @@
            style="width: 200px;"
            @change="dialogCascaderChange"
          />
        </el-form-item>
        <el-form-item label="所属班组" prop="groupcode">
          <el-select
@@ -518,7 +521,7 @@
      v-el-drag-dialog
      title="生产班组"
      :visible.sync="workingDialogVisible"
      width="800px"
      width="1000px"
      top="15vh"
      :close-on-click-modal="false"
      class="workingDialogVisible"
@@ -555,6 +558,36 @@
          label="序号"
          prop="RowNum"
        />
        <el-table-column
          v-if="$store.state.settings.orgType!=='W'"
          prop="stu_torgcode"
          label="车间名称"
          sortable="custom"
          show-tooltip-when-overflow
        >
          <template slot-scope="{row}">
            <!--            <el-input-->
            <!--              v-if="row.isVisible===1"-->
            <!--              v-model="row.group_code"-->
            <!--              oninput="value=value.replace(/[^0-9a-zA-Z]/g,'')"-->
            <!--              placeholder="请输入"-->
            <!--            />-->
            <el-cascader
              v-if="row.isVisible===1"
              ref="dialogCascader"
              key="cascaderKey"
              v-model="row.storg_code"
              filterable
              popper-class="elCascader"
              :options="StuOrgArr2"
              :props="defaultProps"
              style="width: 200px;"
            />
            <div v-else> {{ row.org_name }}</div>
          </template>
        </el-table-column>
        <el-table-column
          prop="group_code"
          label="班组编码"
@@ -657,6 +690,7 @@
import { MesOrderStepReportSelectUserGroup } from '@/api/produceManager'
import elDragDialog from '@/directive/el-drag-dialog'
import TableColumnSettings from '@/components/TableColumnSettings'
import { StorgGroupSelect } from '@/api/basicInfo'
export default {
  name: 'YYQD',
@@ -703,7 +737,7 @@
      form: {
        UserCode: '', // 用户编码
        UserName: '', // 用户名称
        StuOrg: '', // 所属组织
        StuOrg: getCookie('stu_torgcode'), // 所属组织
        wagetype: '', // 工资类型
        Enable: '', // 在职状态
        prop: 'lm_date', // 排序字段
@@ -717,7 +751,8 @@
        checkStrictly: true,
        value: 'code',
        label: 'name',
        children: 'children'
        children: 'children',
        emitPath: false
      },
      EnableArr: [
        { value: 'Y', label: '在职' },
@@ -816,7 +851,7 @@
        UserName: '',
        Password: '123456',
        Enable: 'Y',
        StuOrg: '',
        StuOrg: getCookie('stu_torgcode'),
        Mobile: '',
        Email: '',
        groupcode: '',
@@ -931,6 +966,7 @@
    // 获取所属组织
    async getUserOrganization() {
      const { data: res } = await UserOrganization()
      this.StuOrgArr = clearAllChildren(res)
    },
    // 获取所属组织对话框
@@ -967,30 +1003,45 @@
    reset() {
      this.form.UserCode = ''
      this.form.UserName = ''
      this.form.StuOrg = ''
      this.form.Enable = 'Y'
      this.form.Enable = ''
      this.form.wagetype = ''
      this.form.StuOrg = getCookie('stu_torgcode')
      this.$refs.cascader.checkedValue = ''// 级联选择器的清空
      this.getUserSearch()
    },
    // 级联选择器改变事件
    cascaderChange(val) {
      console.log(val)
      this.form.StuOrg = val[val.length - 1]
      // this.$refs.cascader.checkValue
    },
    dialogCascaderChange(val) {
      this.dialogForm.StuOrg = val[val.length - 1]
      console.log(val)
      this.dialogForm.groupcode = ''
      this.getStorgGroupSelect(val)
    },
    // 获取下拉生产班组
    async getMesOrderStepReportSelectUserGroup() {
      const { data: res } = await MesOrderStepReportSelectUserGroup()
    async getStorgGroupSelect(stu_torgcode) {
      const data = {
        stu_torgcode,
        description: this.StuOrgArr2.find(i => i.code === stu_torgcode) ? 'D' : 'W'
      }
      const { data: res } = await StorgGroupSelect(data)
      this.usergroupArr = res
    },
    // 新增按钮
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
      // this.dialogForm.StuOrg = getCookie('stu_torgcode')
      // this.$refs.dialogCascader.checkedValue = [getCookie('stu_torgcode')]
      this.getUserOrganization2()
      this.getMesOrderStepReportSelectUserGroup()
      if (this.$store.state.settings.orgType !== '') {
        this.getStorgGroupSelect(getCookie('stu_torgcode'), this.StuOrgArr2.find(i => i.code === getCookie('stu_torgcode')) ? 'D' : 'W')
      }
    },
    // 修改按钮
    edit(operation, row) {
@@ -1011,7 +1062,7 @@
        this.dialogForm.Email = row.email
        this.dialogForm.wagetype = row.wagetype
      })
      this.getMesOrderStepReportSelectUserGroup()
      this.getStorgGroupSelect()
      this.getUserOrganization2()
    },
    // 删除按钮
@@ -1041,12 +1092,13 @@
      this.dialogForm.UserName = ''
      this.dialogForm.Password = '123456'
      this.dialogForm.Enable = 'Y'
      this.$refs.dialogCascader.checkedValue = ''
      this.dialogForm.StuOrg = ''
      this.$refs.dialogCascader.checkedValue = getCookie('stu_torgcode')
      this.dialogForm.StuOrg = getCookie('stu_torgcode')
      this.dialogForm.Mobile = ''
      this.dialogForm.Email = ''
      this.dialogForm.groupcode = ''
      this.dialogForm.wagetype = '2'
      this.usergroupArr = []
      this.$refs.dialogForm.clearValidate()
    },
    // 对话框取消
@@ -1409,6 +1461,7 @@
    workingTramClick() {
      this.workingDialogVisible = true
      this.getUserGroupSearch()
      this.getUserOrganization2()
      // 页面加载完后重新渲染表格
      this.$nextTick(() => {
        this.$refs.workingTableData.doLayout()
@@ -1421,7 +1474,7 @@
          this.workingTableData.splice(index, 1)
        }
      })
      this.getMesOrderStepReportSelectUserGroup()
      // this.getStorgGroupSelect()
    },
    // 生产班组排序
    sortChangeOfWorking({ column, prop, order }) {
@@ -1453,7 +1506,7 @@
      let number = Math.random() * Math.random()// 作为删除时的标识符
      number = number === 0 ? (10 + Math.random()) : number
      const data = { group_code: '', group_name: '', description: '', isVisible: 1, number: number }
      const data = { storg_code: getCookie('stu_torgcode'), group_code: '', group_name: '', description: '', isVisible: 1, number: number }
      this.workingTableData.unshift(data)
    },
    // 删除
@@ -1478,6 +1531,9 @@
    },
    // 保存
    async saveWorking(row) {
      if (row.storg_code.trim().length < 1) {
        return this.$message.info('车间不能为空!')
      }
      if (row.group_code.trim().length < 1) {
        return this.$message.info('班组编码不能为空!')
      }
@@ -1488,6 +1544,7 @@
      //   return this.$message.info('班组描述不能为空!')
      // }
      const data = {
        storg_code: row.storg_code,
        code: row.group_code,
        name: row.group_name,
        flag: row.description
src/views/login/index.vue
@@ -221,6 +221,10 @@
            if (getCookie('code') === '302') {
              this.dialogVisible = true
            } else {
              // console.log(typeof getCookie('description'))
              // console.log(getCookie('description') === '')
              // this.$store.state.settings.orgType = getCookie('description')// 组织类型
              // console.log(this.$store.state.settings.orgType, 88)
              this.$router.push({ path: this.redirect || '/' })
            }
            this.loading = false
@@ -241,6 +245,8 @@
      removeCookie('usertype')
      removeCookie('userid')
      removeCookie('code')
      removeCookie('stu_torgcode')
      removeCookie('description')
      this.dialogVisible = false
    },
    async dialogVisibleConfirm() {
@@ -248,12 +254,14 @@
      const username = getCookie('admin')
      const usertype = getCookie('usertype')
      const userid = getCookie('userid')
      const stu_torgcode = getCookie('stu_torgcode')
      const data = {
        usercode,
        username,
        usertype,
        userid,
        rid: ''
        rid: '',
        stu_torgcode
      }
      const res = await ForcedOffline(data)
      if (res.code === '200') {