loulijun2021
2023-06-14 062175c7c625ef7763b694dd5dfba8bc7e5e76cd
src/views/basicSettings/userList.vue
@@ -29,12 +29,14 @@
            <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"
              />
              <!--              @focus="getUserOrganization"-->
            </el-form-item>
@@ -133,10 +135,27 @@
            <template slot-scope="{row}">
              <div v-if="row[item.prop]==='1'&&row.wagetype">计时制</div>
              <div v-else-if="row[item.prop]==='2'&&row.wagetype">计件制</div>
              <div v-else-if="row[item.prop]==='Y'&& item.prop==='enable'"><i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />在职</div>
              <div v-else-if="row[item.prop]==='N'&& item.prop==='enable'"><i class="el-icon-info" style="margin-right: 2px" />离职</div>
              <div v-else-if="row[item.prop]==='Y'&& item.prop==='is_role'"><i class="el-icon-share" :style="{color:$store.state.settings.theme}" @click="roleClick({row})" /></div>
              <div v-else-if="row[item.prop]==='N'&& item.prop==='is_role'"><i class="el-icon-share" style="color: rgb(180 ,181, 185)" @click="roleClick({row})" /></div>
              <div v-else-if="row[item.prop]==='Y'&& item.prop==='enable'"><i
                class="el-icon-success"
                :style="{color:$store.state.settings.theme}"
                style="margin-right: 2px"
              />在职
              </div>
              <div v-else-if="row[item.prop]==='N'&& item.prop==='enable'"><i
                class="el-icon-info"
                style="margin-right: 2px"
              />离职
              </div>
              <div v-else-if="row[item.prop]==='Y'&& item.prop==='is_role'"><i
                class="el-icon-share"
                :style="{color:$store.state.settings.theme}"
                @click="roleClick({row})"
              /></div>
              <div v-else-if="row[item.prop]==='N'&& item.prop==='is_role'"><i
                class="el-icon-share"
                style="color: rgb(180 ,181, 185)"
                @click="roleClick({row})"
              /></div>
              <div v-else-if="!row[item.prop]">/</div>
              <div v-else>{{ row[item.prop] }}</div>
            </template>
@@ -317,7 +336,7 @@
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="total ,prev, pager, next,sizes"
        layout="total ,prev, pager, next,sizes,jumper"
        popper-class="select_bottom"
        @pagination="getUserSearch"
      />
@@ -364,6 +383,7 @@
          <el-cascader
            ref="dialogCascader"
            key="cascaderKey"
            v-model="dialogForm.StuOrg"
            filterable
            popper-class="elCascader"
            :options="StuOrgArr2"
@@ -371,6 +391,7 @@
            style="width: 200px;"
            @change="dialogCascaderChange"
          />
        </el-form-item>
        <el-form-item label="所属班组" prop="groupcode">
          <el-select
@@ -518,7 +539,7 @@
      v-el-drag-dialog
      title="生产班组"
      :visible.sync="workingDialogVisible"
      width="800px"
      width="1000px"
      top="15vh"
      :close-on-click-modal="false"
      class="workingDialogVisible"
@@ -555,6 +576,29 @@
          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-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 +701,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 +748,8 @@
      form: {
        UserCode: '', // 用户编码
        UserName: '', // 用户名称
        StuOrg: '', // 所属组织
        StuOrg: getCookie('stu_torgcode'), // 所属组织
        description: getCookie('description'), // 组织类型
        wagetype: '', // 工资类型
        Enable: '', // 在职状态
        prop: 'lm_date', // 排序字段
@@ -717,7 +763,8 @@
        checkStrictly: true,
        value: 'code',
        label: 'name',
        children: 'children'
        children: 'children',
        emitPath: false
      },
      EnableArr: [
        { value: 'Y', label: '在职' },
@@ -749,13 +796,76 @@
          fixed: false,
          sortable: true
        },
        { minWidth: 110, width: false, prop: 'password', label: '用户密码', id: 5, show: true, fixed: false, sortable: 'custom' },
        { minWidth: 110, width: false, prop: 'stu_torgcode', label: '组织编码', id: 6, show: false, fixed: false, sortable: 'custom' },
        { minWidth: 110, width: false, prop: 'org_name', label: '所属组织', id: 7, show: true, fixed: false, sortable: 'custom' },
        { minWidth: 110, width: false, prop: 'group_code', label: '班组编码', id: 8, show: false, fixed: false, sortable: 'custom' },
        { minWidth: 110, width: false, prop: 'group_name', label: '生产班组', id: 9, show: true, fixed: false, sortable: 'custom' },
        { minWidth: 110, width: false, prop: 'wagetype', label: '工资类型', id: 10, show: true, fixed: false, sortable: 'custom' },
        { minWidth: 110, width: false, prop: 'mobile', label: '联系方式', id: 11, show: true, fixed: false, sortable: 'custom' },
        {
          minWidth: 110,
          width: false,
          prop: 'password',
          label: '用户密码',
          id: 5,
          show: true,
          fixed: false,
          sortable: 'custom'
        },
        {
          minWidth: 110,
          width: false,
          prop: 'stu_torgcode',
          label: '组织编码',
          id: 6,
          show: false,
          fixed: false,
          sortable: 'custom'
        },
        {
          minWidth: 110,
          width: false,
          prop: 'org_name',
          label: '所属组织',
          id: 7,
          show: true,
          fixed: false,
          sortable: 'custom'
        },
        {
          minWidth: 110,
          width: false,
          prop: 'group_code',
          label: '班组编码',
          id: 8,
          show: false,
          fixed: false,
          sortable: 'custom'
        },
        {
          minWidth: 110,
          width: false,
          prop: 'group_name',
          label: '生产班组',
          id: 9,
          show: true,
          fixed: false,
          sortable: 'custom'
        },
        {
          minWidth: 110,
          width: false,
          prop: 'wagetype',
          label: '工资类型',
          id: 10,
          show: true,
          fixed: false,
          sortable: 'custom'
        },
        {
          minWidth: 110,
          width: false,
          prop: 'mobile',
          label: '联系方式',
          id: 11,
          show: true,
          fixed: false,
          sortable: 'custom'
        },
        {
          minWidth: 110,
          width: false,
@@ -816,7 +926,7 @@
        UserName: '',
        Password: '123456',
        Enable: 'Y',
        StuOrg: '',
        StuOrg: getCookie('stu_torgcode'),
        Mobile: '',
        Email: '',
        groupcode: '',
@@ -862,6 +972,7 @@
      },
      dialogVisibleRoles: false,
      dialogFormRoles: {
        stu_torgcode: '', // 所属组织
        username: '', // 用户名称
        usercode: '', // 用户编码
        rolesArr: [], // 角色类型集合
@@ -931,6 +1042,7 @@
    // 获取所属组织
    async getUserOrganization() {
      const { data: res } = await UserOrganization()
      this.StuOrgArr = clearAllChildren(res)
    },
    // 获取所属组织对话框
@@ -967,30 +1079,48 @@
    reset() {
      this.form.UserCode = ''
      this.form.UserName = ''
      this.form.StuOrg = ''
      this.form.Enable = 'Y'
      this.form.Enable = ''
      this.form.wagetype = ''
      this.$refs.cascader.checkedValue = ''// 级联选择器的清空
      this.form.description = getCookie('description') === '' ? '' : getCookie('description')
      this.form.StuOrg = getCookie('stu_torgcode') === '' ? '' : getCookie('stu_torgcode')
      // console.log(getCookie('stu_torgcode') === '')
      // if (this.$store.state.settings.orgType === '') {
      //   this.$refs.cascader.checkedValue = ''
      // }
      this.getUserSearch()
    },
    // 级联选择器改变事件
    cascaderChange(val) {
      this.form.StuOrg = val[val.length - 1]
      this.form.description = this.StuOrgArr.find(i => i.code === val) ? 'D' : 'W'
    },
    dialogCascaderChange(val) {
      this.dialogForm.StuOrg = val[val.length - 1]
      this.dialogForm.groupcode = ''
      this.getStorgGroupSelect(val, this.StuOrgArr2.find(i => i.code === val) ? 'D' : 'W')
    },
    // 获取下拉生产班组
    async getMesOrderStepReportSelectUserGroup() {
      const { data: res } = await MesOrderStepReportSelectUserGroup()
    async getStorgGroupSelect(stu_torgcode, description) {
      const data = {
        stu_torgcode,
        description
      }
      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 +1141,7 @@
        this.dialogForm.Email = row.email
        this.dialogForm.wagetype = row.wagetype
      })
      this.getMesOrderStepReportSelectUserGroup()
      this.getStorgGroupSelect(row.stu_torgcode, this.StuOrgArr.find(i => i.code === row.stu_torgcode) ? 'D' : 'W')
      this.getUserOrganization2()
    },
    // 删除按钮
@@ -1041,12 +1171,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()
    },
    // 对话框取消
@@ -1116,7 +1247,8 @@
      this.dialogFormRoles.username = row.username
      this.dialogFormRoles.usercode = row.usercode
      UserAssociationRole({ usercode: row.usercode }).then(res => {
      this.dialogFormRoles.stu_torgcode = row.stu_torgcode
      UserAssociationRole({ usercode: row.usercode, stu_torgcode: row.stu_torgcode, description: row.description }).then(res => {
        if (res.code === '200') {
          setTimeout(() => {
            loading.close()
@@ -1179,7 +1311,7 @@
    // 用户关联对话框确认事件
    async rolesDialogVisibleConfirm() {
      this.$store.state.app.buttonIsDisabled = true
      const res = await SaveUserAssoctRole(this.dialogFormRoles.roleTreeSelectedArr, this.dialogFormRoles.usercode)
      const res = await SaveUserAssoctRole(this.dialogFormRoles.roleTreeSelectedArr, this.dialogFormRoles.usercode, this.dialogFormRoles.stu_torgcode)
      if (res.code === '200') {
        this.dialogVisibleRoles = false
        this.$message.success('保存成功!')
@@ -1409,6 +1541,7 @@
    workingTramClick() {
      this.workingDialogVisible = true
      this.getUserGroupSearch()
      this.getUserOrganization2()
      // 页面加载完后重新渲染表格
      this.$nextTick(() => {
        this.$refs.workingTableData.doLayout()
@@ -1421,7 +1554,6 @@
          this.workingTableData.splice(index, 1)
        }
      })
      this.getMesOrderStepReportSelectUserGroup()
    },
    // 生产班组排序
    sortChangeOfWorking({ column, prop, order }) {
@@ -1453,7 +1585,14 @@
      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 +1617,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 +1630,7 @@
      //   return this.$message.info('班组描述不能为空!')
      // }
      const data = {
        storg_code: row.storg_code,
        code: row.group_code,
        name: row.group_name,
        flag: row.description