loulijun2021
2022-07-11 9b825939b7f0a7439d704b379812362dd95697fc
src/views/jcsz/yhqd.vue
@@ -23,13 +23,13 @@
                popper-class="elCascader"
                :options="StuOrgArr"
                :props="defaultProps"
                @focus="getUserOrganization"
                @change="cascaderChange"
              />
            </el-form-item>
            <el-form-item label="工资类型" style=" display: flex;">
              <el-select v-model="form.wagetype" :popper-append-to-body="false" filterable style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in wagetypeArr"
                  :key="item.value"
                  :label="item.label"
@@ -66,7 +66,7 @@
          :data="tableData"
          border
          stripe
          :height="tableHeight"
          :height="tableHeight+'px'"
          highlight-current-row
          :style="{width: 100+'%',height:tableHeight+'px'}"
          :header-cell-style="this.$headerCellStyle"
@@ -121,12 +121,22 @@
            prop="mobile"
            label="联系方式"
            sortable="custom"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.mobile===''">/</div>
              <div v-else>{{ row.mobile }}</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="email"
            label="电子邮箱"
            sortable="custom"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.email===''">/</div>
              <div v-else>{{ row.email }}</div>
            </template>
          </el-table-column>
          <el-table-column
            prop=""
            label="在职状态"
@@ -223,11 +233,27 @@
            key="cascaderKey"
            filterable
            popper-class="elCascader"
            :options="StuOrgArr"
            :options="StuOrgArr2"
            :props="defaultProps"
            style="width: 200px;"
            @change="dialogCascaderChange"
          />
        </el-form-item>
        <el-form-item label="所属班组" prop="groupcode">
          <el-select
            v-model="dialogForm.groupcode"
            :popper-append-to-body="false"
            filterable
            style="width: 200px"
            placeholder="请选择"
          >
            <el-option
              v-for="item in usergroupArr"
              :key="item.group_code"
              :label="item.group_name"
              :value="item.group_code"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="工资类型" prop="wagetype">
          <el-select
@@ -245,11 +271,10 @@
            />
          </el-select>
        </el-form-item>
        <el-form-item label="联系方式">
        <el-form-item label="联系方式" prop="Mobile">
          <el-input v-model="dialogForm.Mobile" style="width: 200px" />
        </el-form-item>
        <el-form-item label="电子邮箱">
        <el-form-item label="电子邮箱" prop="Email">
          <el-input v-model="dialogForm.Email" style="width: 200px" />
        </el-form-item>
      </el-form>
@@ -442,6 +467,8 @@
} from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import $ from 'jquery'
import clearAllChildren from '@/utils/global'
import { MesOrderStepReportSelectUserGroup } from '@/api/scgl'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
@@ -461,6 +488,36 @@
        }
      }
    }
    const validateMobile = (rule, value, callback) => {
      if (!value) {
        callback()
        // return callback(new Error('请输入电话号码'))
      } else {
        const mobile = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/ // 长号
        const mobile2 = /^[0-9]{6}$/ // 短号
        if (mobile.test(value) || mobile2.test(value)) {
          callback()
          // return callback(new Error('电话号码不符合规则'))
        } else {
          return callback(new Error('电话号码不符合规则'))
          // callback()
        }
      }
    }
    const validateEmail = (rule, value, callback) => {
      if (!value) {
        callback()
        // return callback(new Error('请输入电子邮箱'))
      } else {
        const email = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$/
        if (email.test(value)) {
          callback()
        } else {
          return callback(new Error('电子邮箱不符合规则'))
        }
      }
    }
    return {
      isFullscreen: false,
      mainHeight: 0,
@@ -477,6 +534,7 @@
        rows: 20 // 每页多少条
      },
      StuOrgArr: [], // 所属组织数组
      StuOrgArr2: [], // 所属组织数组  对话框
      defaultProps: {
        checkStrictly: true,
        value: 'code',
@@ -499,10 +557,12 @@
        StuOrg: '',
        Mobile: '',
        Email: '',
        groupcode: '',
        Operator: '',
        OperType: '',
        wagetype: ''
      },
      usergroupArr: [], // 生产班组数组
      wagetypeArr: [
        { value: '2', label: '计件制' },
        { value: '1', label: '计时制' }
@@ -526,7 +586,17 @@
        ],
        wagetype: [
          { required: true, message: '请选择工资类型', trigger: ['blur', 'change'] }
        ],
        groupcode: [
          { required: true, message: '请选择所属班组', trigger: ['blur', 'change'] }
        ],
        Mobile: [
          { required: false, validator: validateMobile, trigger: ['blur', 'change'] }
        ],
        Email: [
          { required: false, validator: validateEmail, trigger: ['blur', 'change'] }
        ]
      },
      dialogVisibleRoles: false,
      dialogFormRoles: {
@@ -556,7 +626,7 @@
  },
  created() {
    this.getUserSearch()
    this.getUserOrganization()
    // this.getUserOrganization()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
@@ -572,7 +642,12 @@
    // 获取所属组织
    async getUserOrganization() {
      const { data: res } = await UserOrganization()
      this.StuOrgArr = res
      this.StuOrgArr = clearAllChildren(res)
    },
    // 获取所属组织对话框
    async  getUserOrganization2() {
      const { data: res } = await UserOrganization()
      this.StuOrgArr2 = clearAllChildren(res)
    },
    // 导入按钮
    upload() {
@@ -612,10 +687,17 @@
    dialogCascaderChange(val) {
      this.dialogForm.StuOrg = val[val.length - 1]
    },
    // 获取下拉生产班组
    async  getMesOrderStepReportSelectUserGroup() {
      const { data: res } = await MesOrderStepReportSelectUserGroup()
      this.usergroupArr = res
    },
    // 新增按钮
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
      this.getUserOrganization2()
      this.getMesOrderStepReportSelectUserGroup()
    },
    // 修改按钮
    edit(operation, row) {
@@ -628,6 +710,7 @@
        this.dialogForm.UserCode = row.usercode
        this.dialogForm.UserName = row.username
        this.dialogForm.Password = row.password
        this.dialogForm.groupcode = row.group_code
        this.dialogForm.Enable = row.enable
        this.dialogForm.StuOrg = row.stu_torgcode
        this.$refs.dialogCascader.checkedValue = row.stu_torgcode
@@ -635,6 +718,8 @@
        this.dialogForm.Email = row.email
        this.dialogForm.wagetype = row.wagetype
      })
      this.getMesOrderStepReportSelectUserGroup()
      this.getUserOrganization2()
    },
    // 删除按钮
    async del(id) {
@@ -664,6 +749,7 @@
      this.dialogForm.StuOrg = ''
      this.dialogForm.Mobile = ''
      this.dialogForm.Email = ''
      this.dialogForm.groupcode = ''
      this.dialogForm.wagetype = ''
      this.$refs.dialogForm.clearValidate()
    },
@@ -685,6 +771,7 @@
            StuOrg: Array.isArray(this.$refs.dialogCascader.checkedValue) ? this.$refs.dialogCascader.checkedValue[this.$refs.dialogCascader.checkedValue.length - 1] : this.$refs.dialogCascader.checkedValue,
            Mobile: this.dialogForm.Mobile,
            Email: this.dialogForm.Email,
            groupcode: this.dialogForm.groupcode,
            wagetype: this.dialogForm.wagetype,
            OperType: this.operation === 'add' ? 'Add' : 'Update',
            Operator: getCookie('admin')
@@ -1010,7 +1097,7 @@
          this.workingTableData.splice(index, 1)
        }
      })
      // this.getUserGroupSearch()
      this.getMesOrderStepReportSelectUserGroup()
    },
    // 生产班组排序
    sortChangeOfWorking({ column, prop, order }) {