| | |
| | | "core-js": "3.6.5", |
| | | "echarts": "^5.3.2", |
| | | "element-ui": "2.13.2", |
| | | "jquery": "^3.6.0", |
| | | "js-cookie": "2.2.0", |
| | | "normalize.css": "7.0.0", |
| | | "nprogress": "0.2.0", |
| | |
| | | params: data |
| | | }) |
| | | } |
| | | // ç¨æ·æ¸
åå
³èè§è²ä¿å |
| | | export function SaveUserAssoctRole(data, usercode) { |
| | | return request({ |
| | | url: 'BasicSetting/SaveUserAssoctRole?usercode=' + usercode, |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | // è§è²ç±»åæ¥è¯¢ |
| | | export function RoleTypeSearch(data) { |
| | | return request({ |
| | | url: 'BasicSetting/RoleTypeSearch', |
| | | method: 'get', |
| | | params: data |
| | | }) |
| | | } |
| | | // è§è²ç±»åæ°å¢ |
| | | export function RoleTypeAdd(data) { |
| | | return request({ |
| | | url: 'BasicSetting/RoleTypeAdd', |
| | | method: 'post', |
| | | params: data |
| | | }) |
| | | } |
| | | // è§è²ç±»åæ°å¢ |
| | | export function RoleTypeDelete(data) { |
| | | return request({ |
| | | url: 'BasicSetting/RoleTypeDelete', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | // è§è²æ¸
åæ¥è¯¢ |
| | | export function RoleSearch(data) { |
| | | return request({ |
| | | url: 'BasicSetting/RoleSearch', |
| | | method: 'get', |
| | | params: data |
| | | }) |
| | | } |
| | | // è§è²æ¸
åæ°å¢ç¼è¾ |
| | | export function AddUpdateRole(data) { |
| | | return request({ |
| | | url: 'BasicSetting/AddUpdateRole', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | // è§è²æ¸
åå é¤ |
| | | export function DeleteRole(data) { |
| | | return request({ |
| | | url: 'BasicSetting/DeleteRole', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | // è§è²æ¸
åå
³èç¨æ·æ¥è¯¢ |
| | | export function RoleAssociationUser(data) { |
| | | return request({ |
| | | url: 'BasicSetting/RoleAssociationUser', |
| | | method: 'get', |
| | | params: data |
| | | }) |
| | | } |
| | | // è§è²æ¸
åå
³èç¨æ·æ¥è¯¢ä¿å |
| | | export function SaveRoleAssoctUser(data) { |
| | | return request({ |
| | | url: 'BasicSetting/SaveRoleAssoctUser', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | // ç¨æ·æ¸
åå
³èåè½æ¥è¯¢ |
| | | export function RoleAssociationRight(data) { |
| | | return request({ |
| | | url: 'BasicSetting/RoleAssociationRight', |
| | | method: 'get', |
| | | params: data |
| | | }) |
| | | } |
| | | // è§è²æ¸
åå
³èåè½ä¿å |
| | | export function SaveUserAssoctRight(data) { |
| | | return request({ |
| | | url: 'BasicSetting/SaveUserAssoctRight', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | // 徿¥å使¥è¯¢ |
| | | export function CurrentUnitSearch(data) { |
| | | return request({ |
| | | url: 'BasicSetting/CurrentUnitSearch', |
| | | method: 'get', |
| | | params: data |
| | | }) |
| | | } |
| | | // 徿¥å使°å¢ç¼è¾ |
| | | export function AddUpdateCurrentUnit(data) { |
| | | return request({ |
| | | url: 'BasicSetting/AddUpdateCurrentUnit', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | // 徿¥åä½å é¤ |
| | | export function DeleteCurrentUnit(data) { |
| | | return request({ |
| | | url: 'BasicSetting/DeleteCurrentUnit', |
| | | method: 'get', |
| | | params: data |
| | | }) |
| | | } |
| | |
| | | } |
| | | }) |
| | | return arr2 |
| | | // return arr |
| | | }, |
| | | activeMenu() { |
| | | const route = this.$route |
| | |
| | | Message({ |
| | | message: res.Message || 'Error', |
| | | type: 'error', |
| | | duration: 5 * 1000 |
| | | duration: 10 * 1000 |
| | | }) |
| | | |
| | | // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; |
| | |
| | | Message({ |
| | | message: error.message, |
| | | type: 'error', |
| | | duration: 5 * 1000 |
| | | duration: 10 * 1000 |
| | | }) |
| | | return Promise.reject(error) |
| | | } |
| | |
| | | <template> |
| | | <div> |
| | | <div class="body" style="background-color: #ffffff; padding: 20px 10px 0 20px;" :style="{height:mainHeight+'px'}"> |
| | | <div style="height: 50px;"> |
| | | <el-form |
| | | ref="form" |
| | | :model="form" |
| | | label-width="80px" |
| | | inline |
| | | style="display: flex;justify-content: space-between" |
| | | > |
| | | <div style="display: flex;justify-content: space-around;width: 85%"> |
| | | <el-form-item label="è§è²ç¼ç " style=" display: flex;"> |
| | | <el-input v-model="form.RoleCode" placeholder="请è¾å
¥" style="width: calc(100%-30px)" /> |
| | | </el-form-item> |
| | | <el-form-item label="è§è²åç§°" style=" display: flex;"> |
| | | <el-input v-model="form.RoleName" placeholder="请è¾å
¥" style="width: calc(100%-30px)" /> |
| | | </el-form-item> |
| | | <el-form-item label="è§è²ç±»å" style=" display: flex;"> |
| | | <el-select v-model="form.RoleTypeCode" style="width: calc(100%-30px)" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in RoleTypeCodeArr" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å建人å" style=" display: flex;"> |
| | | <el-input v-model="form.UserName" style="width: calc(100%-30px)" placeholder="请è¾å
¥" /> |
| | | </el-form-item> |
| | | </div> |
| | | <div style="display: flex;align-items: start;margin-top: 5px;"> |
| | | <el-button type="primary" icon="el-icon-search" @click="search">æ¥è¯¢</el-button> |
| | | <el-button type="info" icon="el-icon-refresh" @click="reset">éç½®</el-button> |
| | | </div> |
| | | </el-form> |
| | | </div> |
| | | <div style="margin-bottom: 20px;display: flex"> |
| | | <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">æ°å¢</el-button> |
| | | <el-button type="primary" icon="el-icon-setting" @click="">设置</el-button> |
| | | <el-button type="primary" icon="el-icon-upload2" @click="upload">导å
¥</el-button> |
| | | </div> |
| | | |
| | | <div style="display: flex;border: 1px solid #eee"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | highlight-current-row |
| | | :style="{width: 100+'%',height:tableHeight+'px'}" |
| | | :header-cell-style="this.$headerCellStyle" |
| | | :cell-style="this.$cellStyle" |
| | | @sort-change="sortChange" |
| | | > |
| | | <!-- <el-table-column--> |
| | | <!-- type="selection"--> |
| | | <!-- width="50"--> |
| | | <!-- />--> |
| | | <!-- <el-table-column--> |
| | | <!-- prop="id"--> |
| | | <!-- width="50"--> |
| | | <!-- label="åºå·"--> |
| | | <!-- />--> |
| | | <el-table-column |
| | | prop="RowNum" |
| | | width="50" |
| | | label="åºå·" |
| | | /> |
| | | <el-table-column |
| | | prop="role_code" |
| | | label="è§è²ç¼ç " |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="role_name" |
| | | label="è§è²åç§°" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="roletype_name" |
| | | label="è§è²ç±»å" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="lm_user" |
| | | label="å建人å" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="lm_date" |
| | | label="å建æ¶é´" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="lm_date" |
| | | label="å
³èç¨æ·" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <i class="el-icon-user-solid" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="lm_date" |
| | | label="åé
æé" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <i class="el-icon-share" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="æä½" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div class="operationClass"> |
| | | <el-button type="text" @click="edit('edit',row)">ä¿®æ¹</el-button> |
| | | <el-button type="text" @click="del(row.id)">å é¤</el-button> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <!--å页--> |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="form.page" |
| | | :limit.sync="form.rows" |
| | | align="right" |
| | | layout="prev, pager, next,sizes" |
| | | popper-class="select_bottom" |
| | | @pagination="getRoleSearch" |
| | | /> |
| | | </div> |
| | | |
| | | <!-- æ°å¢ä¿®æ¹å¯¹è¯æ¡--> |
| | | <el-dialog |
| | | :title="operation==='add'?'æ·»å ':'ä¿®æ¹'" |
| | | :visible.sync="dialogVisible" |
| | | width="50%" |
| | | top="15vh" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | <el-form ref="dialogForm" :rules="dialogFormRules" :model="dialogForm" label-width="80px"> |
| | | <el-form-item label="ç»ç»ç±»å" prop="OrgType"> |
| | | <el-radio-group |
| | | v-model="dialogForm.OrgType" |
| | | style="display: flex;align-items: end;height: 29px;" |
| | | @change="changeRadio" |
| | | > |
| | | <el-radio |
| | | v-for="item in OrgTypeArr" |
| | | :key="item.value" |
| | | :value="item.value" |
| | | :label="item.label" |
| | | /> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="ç»ç»ç¼ç " prop="OrgCode"> |
| | | <el-input v-model="dialogForm.OrgCode" :disabled="operation!=='add'" style="width: 220px" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»ç»åç§°" prop="OrgName"> |
| | | <el-input v-model="dialogForm.OrgName" style="width: 220px" /> |
| | | </el-form-item> |
| | | <el-form-item v-if="dialogFormOrgTypeSelected!=='F'" prop="SupUnit" label="ä¸çº§åä½"> |
| | | <el-select |
| | | v-model="dialogForm.SupUnit" |
| | | style="width: 220px" |
| | | placeholder="è¯·éæ©" |
| | | > |
| | | <el-option |
| | | v-for="item in SupUnitArr" |
| | | :label="item.org_name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <div class="footerButton"> |
| | | <el-button @click="dialogVisibleCancel">å æ¶</el-button> |
| | | <el-button type="primary" @click="dialogVisibleConfirm">ç¡® å®</el-button> |
| | | </div> |
| | | </span> |
| | | </el-dialog> |
| | | <!-- 设置æé®å¯¹è¯æ¡--> |
| | | |
| | | <!-- å
³èç¨æ·å¯¹è¯æ¡--> |
| | | |
| | | <!-- åé
å
¨éå¯¹è¯æ¡--> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import Pagination from '@/components/Pagination' |
| | | import { |
| | | AddUpdateOrganization, |
| | | DeleteOrganization, |
| | | OrganizationSearch, |
| | | PrentOrganization, |
| | | RoleSearch, |
| | | RoleTypeDelete |
| | | } from '@/api/jcsz' |
| | | import { getCookie } from '@/utils/auth' |
| | | |
| | | const SER_HZ = /^[\u4e00-\u9fa5]+$/ |
| | | export default { |
| | | name: "jsqd" |
| | | name: 'Zzjg', |
| | | components: { |
| | | Pagination |
| | | }, |
| | | data() { |
| | | const validateName = (rule, value, callback) => { |
| | | if (!value) { |
| | | return callback(new Error('请è¾å
¥ç¼ç ')) |
| | | } else { |
| | | if (SER_HZ.test(value)) { |
| | | return callback(new Error('ç¼ç ä¸è½ä¸ºä¸æ')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } |
| | | const validateTypeCode = (rule, value, callback) => { |
| | | if (!value) { |
| | | return callback(new Error('è¯·éæ©ä¸çº§')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | mainHeight: 0, |
| | | tableHeight: 0, |
| | | form: { |
| | | RoleCode: '', // è§è²ç¼ç |
| | | RoleName: '', // è§è²åç§° |
| | | RoleTypeCode: '', // è§è²ç±»åç¼ç |
| | | CreateUser: '', // å建人å |
| | | prop: 'lm_date', // æåºå段 |
| | | order: 'desc', // æåºå段 |
| | | page: 1, // 第å 页 |
| | | rows: 10 // æ¯é¡µå¤å°æ¡ |
| | | }, |
| | | RoleTypeCodeArr: [], // è§è²ç±»åç¼ç æ°ç» |
| | | |
| | | total: 10, |
| | | tableData: [], |
| | | dialogVisible: false, |
| | | dialogForm: { |
| | | OrgType: '', |
| | | OrgCode: '', |
| | | OrgName: '', |
| | | SupUnit: ''// ä¸çº§åä½ |
| | | }, |
| | | SupUnitArr: [], |
| | | dialogFormOrgTypeSelected: '', |
| | | operation: '', |
| | | dialogFormRules: { |
| | | OrgType: [ |
| | | { required: true, message: '请è¾å
¥éæ©ç±»å', trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgCode: [ |
| | | { required: true, validator: validateName, trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgName: [ |
| | | { required: true, message: '请è¾å
¥åç§°', trigger: ['blur', 'change'] } |
| | | ], |
| | | SupUnit: [ |
| | | { required: true, validator: validateTypeCode, trigger: ['blur', 'change'] } |
| | | ] |
| | | } |
| | | |
| | | } |
| | | }, |
| | | created() { |
| | | this.getRoleSearch() |
| | | }, |
| | | mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | }, |
| | | methods: { |
| | | async getRoleSearch() { |
| | | const res = await RoleSearch(this.form) |
| | | this.tableData = res.data |
| | | this.total = res.count |
| | | }, |
| | | // æåºæ¹åæ¶ |
| | | sortChange({ column, prop, order }) { |
| | | if (order === 'descending') { |
| | | order = 'desc' |
| | | } else if (order === 'ascending') { |
| | | order = 'asc' |
| | | } else { |
| | | order = 'desc' |
| | | } |
| | | this.form.order = order |
| | | this.form.prop = prop |
| | | this.getRoleSearch() |
| | | }, |
| | | // æ¥è¯¢ |
| | | search() { |
| | | this.getRoleSearch() |
| | | }, |
| | | // éç½® |
| | | reset() { |
| | | this.form.RoleCode = '' |
| | | this.form.RoleName = '' |
| | | this.form.RoleTypeCode = '' |
| | | this.form.CreateUser = '' |
| | | this.getRoleSearch() |
| | | }, |
| | | // åéæ¡æ¹åæ¶ |
| | | // async changeRadio(val) { |
| | | // if (val.length > 1) { |
| | | // this.OrgTypeArr.forEach(item => { |
| | | // if (item.label === val) { |
| | | // this.dialogFormOrgTypeSelected = item.value |
| | | // } |
| | | // }) |
| | | // this.dialogForm.SupUnit = '' |
| | | // } else { |
| | | // this.dialogFormOrgTypeSelected = val |
| | | // } |
| | | // if (this.dialogFormOrgTypeSelected !== 'F') { |
| | | // const { data: res } = await PrentOrganization({ orgcode: this.dialogFormOrgTypeSelected }) |
| | | // this.SupUnitArr = res |
| | | // } |
| | | // }, |
| | | |
| | | // æ°å¢æé® |
| | | add(operation) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | }, |
| | | // ä¿®æ¹æé® |
| | | edit(operation, row) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | |
| | | this.$nextTick(() => { |
| | | this.changeRadio(this.dialogForm.OrgType) |
| | | this.dialogForm.OrgCode = row.org_code |
| | | this.dialogForm.OrgName = row.org_name |
| | | this.dialogForm.SupUnit = row.parent_id |
| | | }) |
| | | }, |
| | | // å é¤æé® |
| | | async del(id) { |
| | | this.$confirm('æ¯å¦ç¡®è®¤å é¤?', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | // RoleTypeDelete({ RoleTypeCode: id }).then(res => { |
| | | // if (res.code === '200') { |
| | | // this.$message.success('å 餿å!') |
| | | // this.getRoleSearch() |
| | | // } |
| | | // }) |
| | | }).catch(() => { |
| | | this.$message.info('已忶å é¤') |
| | | }) |
| | | }, |
| | | // å¯¹è¯æ¡å
³éäºä»¶ |
| | | handleClose() { |
| | | this.dialogForm.OrgType = '' |
| | | this.dialogForm.OrgCode = '' |
| | | this.dialogForm.OrgName = '' |
| | | this.dialogForm.SupUnit = '' |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // å¯¹è¯æ¡åæ¶ |
| | | dialogVisibleCancel() { |
| | | this.dialogVisible = false |
| | | }, |
| | | // å¯¹è¯æ¡ç¡®è®¤ |
| | | dialogVisibleConfirm() { |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | const data = { |
| | | OrganType: this.dialogFormOrgTypeSelected, |
| | | OrganCode: this.dialogForm.OrgCode, |
| | | OrganName: this.dialogForm.OrgName, |
| | | SupUnit: this.dialogFormOrgTypeSelected === 'F' ? '0' : this.dialogForm.SupUnit, |
| | | OperType: this.operation === 'add' ? 'Add' : 'Update', |
| | | Operator: getCookie('admin') |
| | | } |
| | | AddUpdateOrganization(data).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success(this.operation === 'add' ? 'æ·»å æåï¼' : 'ä¿®æ¹æåï¼') |
| | | this.getRoleSearch() |
| | | } else { |
| | | this.$message.error(this.operation === 'add' ? 'æ·»å 失败ï¼' : 'ä¿®æ¹å¤±è´¥ï¼') |
| | | } |
| | | }) |
| | | |
| | | this.dialogVisible = false |
| | | } |
| | | }) |
| | | }, |
| | | // è·å页é¢é«åº¦ |
| | | getHeight() { |
| | | this.$nextTick(() => { |
| | | this.mainHeight = window.innerHeight - 200 |
| | | this.tableHeight = this.mainHeight - 100 |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | <style lang="scss" scoped> |
| | | $main_color: #42b983; |
| | | ::v-deep .el-button--primary { |
| | | background-color: $main_color !important; |
| | | height: 30px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | ::v-deep .el-button--info { |
| | | //background-color: $main_color !important; |
| | | height: 30px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | ::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active { |
| | | background-color: $main_color !important; |
| | | } |
| | | |
| | | .footerButton { |
| | | display: flex; |
| | | justify-content: end; |
| | | } |
| | | |
| | | ::v-deep .el-button--default { |
| | | background-color: #ffffff !important; |
| | | height: 30px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | ::v-deep .el-button--default:hover { |
| | | color: #606266; |
| | | } |
| | | |
| | | ::v-deep .el-dialog__body { |
| | | padding: 20px 100px !important; |
| | | } |
| | | |
| | | ::v-deep .el-radio__input.is-checked .el-radio__inner { |
| | | background-color: $main_color; |
| | | border-color: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-radio__input.is-checked + .el-radio__label { |
| | | color: $main_color !important; |
| | | } |
| | | |
| | | ::v-deep .el-checkbox__input.is-checked .el-checkbox__inner { |
| | | border-color: $main_color; |
| | | background-color: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-input__inner { |
| | | height: 30px |
| | | } |
| | | |
| | | ::v-deep .el-table .caret-wrapper { |
| | | //float: right; |
| | | transform: scale(0.8); |
| | | } |
| | | |
| | | ::v-deep .cell { |
| | | display: flex !important; |
| | | align-items: center !important; |
| | | justify-content: space-between !important; |
| | | } |
| | | |
| | | ::v-deep .el-button--text { |
| | | color: $main_color; |
| | | font-size: 14px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .operationClass { |
| | | height: 23px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | |
| | | .el-icon-share ,.el-icon-user-solid{ |
| | | color: $main_color; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .el-checkbox.is-bordered.is-checked { |
| | | border-color: $main_color; |
| | | } |
| | | ::v-deep .el-radio__input.is-checked .el-radio__inner { |
| | | border-color: $main_color; |
| | | background: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-checkbox__input.is-indeterminate .el-checkbox__inner{ |
| | | border-color: $main_color; |
| | | background: $main_color; |
| | | } |
| | | ::v-deep .el-checkbox__input.is-checked + .el-checkbox__label { |
| | | color: $main_color !important; |
| | | } |
| | | |
| | | ::v-deep .el-checkbox.is-bordered+.el-checkbox.is-bordered{ |
| | | margin: 10px 30px 0px 0; |
| | | } |
| | | |
| | | ::v-deep .el-radio__input.is-checked + .el-radio__label { |
| | | color: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-radio.is-bordered + .el-radio.is-bordered { |
| | | margin: 10px 30px 0px 0; |
| | | } |
| | | </style> |
| | |
| | | width="50%" |
| | | top="15vh" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | <el-form ref="dialogForm" :rules="dialogFormRules" inline :model="dialogForm" label-width="80px"> |
| | | <el-form-item label="ç¨æ·ç¼ç " prop="UserCode"> |
| | |
| | | :visible.sync="dialogVisibleRoles" |
| | | width="50%" |
| | | top="15vh" |
| | | class="dialogVisibleRoles" |
| | | @closed="handleCloseRoles" |
| | | @close="handleCloseRoles" |
| | | > |
| | | <!-- @opened="handleOpenedRoles"--> |
| | | |
| | | <div> |
| | | <i class="el-icon-s-comment" style="color:#42b983;" /> ç¨æ·åç§°ï¼{{ dialogFormRoles.username }} |
| | |
| | | <div style="margin-bottom:20px"> |
| | | <i class="el-icon-s-operation" style="color:#42b983;" /> è§è²ç±»åéåï¼ |
| | | </div> |
| | | <el-checkbox-group v-model="dialogFormRoles.rolesArrSelectedArr" @change="dialogCheckboxChange"> |
| | | <el-checkbox |
| | | <div class="myCheckboxGroup"> |
| | | <div |
| | | v-for="item in dialogFormRoles.rolesArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | border |
| | | size="medium" |
| | | /> |
| | | </el-checkbox-group> |
| | | :style="{border:item.isSelected1?'1px solid #42b983':'1px solid #eee'}" |
| | | class="myCheckbox" |
| | | @click="myCheckboxClick(item)" |
| | | > |
| | | <input |
| | | class="myCheckboxInput" |
| | | type="checkbox" |
| | | :value="item.code" |
| | | :name="item.name" |
| | | :style="{color:item.isSelected2?'#42b983':'#fff'}" |
| | | @click="myCheckboxInputClick(item)" |
| | | >{{ item.name }} |
| | | <!-- ç¶åç¹å»äºä»¶ä¸å½±å--> |
| | | <!-- onClick="event.cancelBubble = true"--> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <el-divider /> |
| | | <div> |
| | |
| | | node-key="code" |
| | | default-expand-all |
| | | :props="defaultPropsOfRoleTree" |
| | | @check="checkBoxClick" |
| | | /> |
| | | <!-- @check-change="checkChange"--> |
| | | |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <div class="footerButton"> |
| | |
| | | import Pagination from '@/components/Pagination' |
| | | import { |
| | | AddUpdateUser, |
| | | DeleteUser, UserAssociationRole, |
| | | DeleteUser, SaveUserAssoctRole, UserAssociationRole, |
| | | UserOrganization, |
| | | UserSearch |
| | | } from '@/api/jcsz' |
| | | import { getCookie } from '@/utils/auth' |
| | | import $ from 'jquery' |
| | | |
| | | const SER_HZ = /^[\u4e00-\u9fa5]+$/ |
| | | export default { |
| | |
| | | { required: true, message: 'è¯·éæ©å·¥èµç±»å', trigger: ['blur', 'change'] } |
| | | ] |
| | | }, |
| | | // cascaderKey: 0, // 级èéæ©å¨key |
| | | dialogVisibleRoles: false, |
| | | dialogFormRoles: { |
| | | username: '', // ç¨æ·åç§° |
| | | usercode: '', // ç¨æ·ç¼ç |
| | | rolesArrSelectedArr: [], // è§è²ç±»åæ°ç»éä¸ |
| | | rolesArrSelected: [], // è§è²ç±»åéä¸ |
| | | rolesArr: [], // è§è²ç±»åéå |
| | | roleTree: [], // è§è²æ |
| | | rolesAll: []// è§è²ææ |
| | | roleTreeSelectedArr: [] // è§è²æ éä¸ |
| | | }, |
| | | |
| | | rolesAll: [], // è§è²ææ |
| | | defaultPropsOfRoleTree: { |
| | | value: 'code', |
| | | label: 'name', |
| | |
| | | Password: this.dialogForm.Password, |
| | | Enable: this.dialogForm.Enable, |
| | | // StuOrg: this.dialogForm.StuOrg, |
| | | StuOrg: this.$refs.dialogCascader.checkedValue[this.$refs.dialogCascader.checkedValue.length - 1].length === 4 ? this.$refs.dialogCascader.checkedValue[this.$refs.dialogCascader.checkedValue.length - 1] : this.$refs.dialogCascader.checkedValue, |
| | | 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, |
| | | wagetype: this.dialogForm.wagetype, |
| | |
| | | }, |
| | | // å
³èè§è²ç¹å»äºä»¶ |
| | | async roleClick({ row }) { |
| | | this.dialogFormRoles.rolesArrSelectedArr = [] |
| | | this.dialogFormRoles.rolesArr = [] |
| | | this.dialogFormRoles.roleTreeSelectedArr = [] |
| | | this.dialogVisibleRoles = true |
| | | this.dialogFormRoles.username = row.username |
| | | this.dialogFormRoles.usercode = row.usercode |
| | | const { data: res } = await UserAssociationRole({ usercode: row.usercode }) |
| | | this.rolesAll = res |
| | | res.forEach(item => { |
| | | this.dialogFormRoles.rolesArr.push({ code: item.code, name: item.name, flag: item.flag }) |
| | | |
| | | const nodeKey = []// æ 形忾key |
| | | res.forEach((item, index) => { |
| | | this.dialogFormRoles.rolesArr.push({ |
| | | code: item.code, |
| | | name: item.name, |
| | | flag: item.flag, |
| | | isSelected1: false, |
| | | isSelected2: false |
| | | }) |
| | | }, |
| | | dialogCheckboxChange(val, aa) { |
| | | // this.dialogFormRoles.rolesArrSelectedArr = ['管ç人å'] |
| | | this.dialogFormRoles.rolesArrSelected = val[val.length - 1] |
| | | this.dialogFormRoles.roleTree = this.rolesAll.filter(item => item.name === this.dialogFormRoles.rolesArrSelected) |
| | | if (item.flag === 'Y') { |
| | | this.dialogFormRoles.rolesArr[index].isSelected2 = true |
| | | this.$nextTick(() => { |
| | | // $('input:checkbox').eq(index).attr('checked', true)// èªå®ä¹å鿡忾 |
| | | $('input:checkbox').eq(index).prop('checked', true)// èªå®ä¹å鿡忾 |
| | | }) |
| | | this.dialogFormRoles.rolesArrSelectedArr.push(item.name) |
| | | if (item.children && item.children.length > 0) { |
| | | const Data = [] |
| | | item.children.forEach(it => { |
| | | if (it.flag === 'Y') { |
| | | nodeKey.push(it.code) |
| | | Data.push(it.code) |
| | | } |
| | | }) |
| | | this.dialogFormRoles.roleTreeSelectedArr.push({ Code: item.code, Name: item.name, Data: Data }) |
| | | } |
| | | } |
| | | }) |
| | | console.log(this.dialogFormRoles.roleTreeSelectedArr, 11) |
| | | console.log(this.dialogFormRoles.rolesArr, 888) |
| | | |
| | | this.dialogFormRoles.rolesArr[0].isSelected1 = true// é»è®¤éä¸ç¬¬ä¸ä¸ª |
| | | // this.dialogFormRoles.rolesArr[0].name = 'å
¨é¨' |
| | | |
| | | this.dialogFormRoles.roleTree = this.rolesAll.filter(item => item.code === this.dialogFormRoles.rolesArr[0].code) |
| | | this.dialogFormRoles.roleTree[0].name = 'å
¨é¨' |
| | | // this.dialogFormRoles.rolesArr |
| | | console.log(nodeKey, 1) |
| | | this.$refs.roleTree.setCheckedKeys(nodeKey) |
| | | }, |
| | | // å¤çç¨æ·å
³èå¯¹è¯æ¡å
³éäºä»¶ |
| | | handleCloseRoles() { |
| | | |
| | | this.$refs.roleTree.setCheckedKeys([]) |
| | | this.dialogFormRoles.rolesArrSelectedArr = [] |
| | | }, |
| | | // ç¨æ·å
³èå¯¹è¯æ¡åæ¶äºä»¶ |
| | | rolesDialogVisibleCancel() { |
| | | this.dialogVisibleRoles = false |
| | | }, |
| | | // ç¨æ·å
³èå¯¹è¯æ¡ç¡®è®¤äºä»¶ |
| | | rolesDialogVisibleConfirm() { |
| | | async rolesDialogVisibleConfirm() { |
| | | console.log(this.dialogFormRoles.roleTreeSelectedArr, 333337) |
| | | const res = await SaveUserAssoctRole(this.dialogFormRoles.roleTreeSelectedArr, this.dialogFormRoles.usercode) |
| | | if (res.code === '200') { |
| | | this.$message.success('ä¿åæåï¼') |
| | | this.dialogVisibleRoles = false |
| | | } |
| | | }, |
| | | // æ å½¢å¤éæ¡ç¹å»äºä»¶ |
| | | checkBoxClick(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) { |
| | | // console.log(obj, checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys, 78787878) |
| | | |
| | | // æ¾å° checkedFatherCode ç¶codeå¼ |
| | | // å½halfCheckedKeysä¸ççé¶çæ¶å |
| | | // let checkedFatherCode = halfCheckedKeys.length !== 0 ? halfCheckedKeys[0] : checkedKeys[0] |
| | | let checkedFatherCode = '' // æ¾å° checkedFatherCode ç¶codeå¼ |
| | | // if (checkedFatherCode === undefined) { |
| | | // console.log(this.rolesAll, 66666) |
| | | this.rolesAll.forEach((item, index) => { |
| | | if (item.code === obj.code) { |
| | | checkedFatherCode = item.code |
| | | } |
| | | if (item.children && item.children.length > 0) { |
| | | item.children.forEach((it, ind) => { |
| | | if (it.code === obj.code) { |
| | | checkedFatherCode = item.code |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | // } |
| | | console.log(checkedFatherCode, 8) |
| | | |
| | | // 1.第ä¸ç§æ
åµå½æ å½¢ åå¶ ä¸ä¸ºé¶ å
¨å¶ ä¸ä¸ºé¶ |
| | | if (halfCheckedKeys.length !== 0 && checkedKeys.length !== 0) { |
| | | this.dialogFormRoles.rolesArr.forEach((item, index) => { |
| | | if (item.code === checkedFatherCode) { |
| | | console.log('1.第ä¸ç§æ
åµå½æ å½¢ åå¶ ä¸ä¸ºé¶ å
¨å¶ ä¸ä¸ºé¶') |
| | | this.dialogFormRoles.rolesArr[index].isSelected2 = true |
| | | this.$nextTick(() => { |
| | | // $('input:checkbox').eq(index).attr('checked', true)// èªå®ä¹å鿡忾 |
| | | $('input:checkbox').eq(index).prop('checked', true)// èªå®ä¹å鿡忾 |
| | | }) |
| | | const temp = this.rolesAll.filter(it => it.code === checkedFatherCode)// è¿æ»¤åºæ¯æ¬¡éä¸ç大项 |
| | | temp.forEach(it => { |
| | | const a = [] |
| | | it.children.forEach(it => { |
| | | if (it.code === obj.code) { |
| | | a.push(it.code) |
| | | } |
| | | }) |
| | | // console.log(!this.dialogFormRoles.roleTreeSelectedArr.some(i => i.Code === checkedFatherCode)) |
| | | if (!this.dialogFormRoles.roleTreeSelectedArr.some(i => i.Code === checkedFatherCode)) { // å½ç´æ¥éç¶codeæ¶æ§è¡ |
| | | this.dialogFormRoles.roleTreeSelectedArr.push({ |
| | | Code: it.code, |
| | | Name: it.name, |
| | | Data: a |
| | | }) |
| | | } else { |
| | | this.dialogFormRoles.roleTreeSelectedArr.forEach((i, ind) => { // å½éåcodeæ¶æ§è¡ |
| | | if (i.Code === checkedFatherCode) { |
| | | this.dialogFormRoles.roleTreeSelectedArr[ind].Data.forEach((i1, ind2) => { |
| | | if (i1 === a[0]) { |
| | | this.dialogFormRoles.roleTreeSelectedArr[ind].Data.splice(ind2, 1)// å½åcodeä¸ç°å¨çcodeç¸åæ¶æ§è¡ |
| | | } else { |
| | | this.dialogFormRoles.roleTreeSelectedArr[ind].Data.push(a[0])// //å½åcodeä¸ç°å¨çcodeä¸ç¸åæ¶æ§è¡ |
| | | } |
| | | }) |
| | | // this.dialogFormRoles.roleTreeSelectedArr[ind].Data.filter((i1, ind2) => i1 !== a[0])// è¿æ»¤æéä¸ç¸åç |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | console.log(this.dialogFormRoles.roleTreeSelectedArr, 11) |
| | | |
| | | // 2.第äºç§æ
åµå½æ å½¢ åå¶ ä¸ºé¶ å
¨å¶ ä¸ºé¶ |
| | | if (halfCheckedKeys.length === 0 && checkedKeys.length === 0) { |
| | | this.dialogFormRoles.rolesArr.forEach((item, index) => { |
| | | if (item.code === checkedFatherCode) { |
| | | console.log('2.第äºç§æ
åµå½æ å½¢ åå¶ ä¸ºé¶ å
¨å¶ 为é¶') |
| | | this.dialogFormRoles.rolesArr[index].isSelected2 = false |
| | | this.$nextTick(() => { |
| | | // console.log($('input:checkbox').eq(1).attr('checked', false), 88888) |
| | | $('input:checkbox').eq(index).prop('checked', false)// èªå®ä¹å鿡忾 |
| | | }) |
| | | this.dialogFormRoles.roleTreeSelectedArr.forEach((it, ind) => { |
| | | if (it.Code === checkedFatherCode) { |
| | | console.log(it.Code, 9) |
| | | console.log(this.dialogFormRoles.roleTreeSelectedArr.splice(ind, 1), 7) |
| | | } |
| | | }) |
| | | this.dialogFormRoles.rolesArrSelectedArr.forEach((i, i1) => { |
| | | if (i === checkedFatherCode) { |
| | | console.log(this.dialogFormRoles.rolesArrSelectedArr.splice(i1, 1), 8) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | console.log(this.dialogFormRoles.roleTreeSelectedArr, 22) |
| | | |
| | | // 3.第ä¸ç§ç§æ
åµå½æ å½¢ åå¶ ä¸ºé¶ å
¨å¶ ä¸ä¸ºé¶ |
| | | if (halfCheckedKeys.length === 0 && checkedKeys.length !== 0) { |
| | | // this.dialogFormRoles.roleTreeSelectedArr = [] |
| | | this.dialogFormRoles.rolesArr.forEach((item, index) => { |
| | | if (item.code === checkedFatherCode) { |
| | | console.log(' 3.第ä¸ç§ç§æ
åµå½æ å½¢ åå¶ ä¸ºé¶ å
¨å¶ ä¸ä¸ºé¶') |
| | | this.dialogFormRoles.rolesArr[index].isSelected2 = true |
| | | this.$nextTick(() => { |
| | | // $('input:checkbox').eq(index).attr('checked', true)// èªå®ä¹å鿡忾 |
| | | $('input:checkbox').eq(index).prop('checked', true)// èªå®ä¹å鿡忾 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | const temp = this.rolesAll.filter(it => it.code === checkedFatherCode)// è¿æ»¤åºæ¯æ¬¡éä¸ç大项 |
| | | // console.log(!this.dialogFormRoles.roleTreeSelectedArr.some(i => i.Code === checkedFatherCode)) |
| | | if (!this.dialogFormRoles.roleTreeSelectedArr.some(i => i.Code === checkedFatherCode)) { // å½ç¶ç±»ä¸ºå
¨å¶æ¶ |
| | | temp.forEach(it => { |
| | | this.dialogFormRoles.roleTreeSelectedArr.push({ |
| | | Code: it.code, |
| | | Name: it.name, |
| | | Data: it.children.map(i => i.code) |
| | | }) |
| | | }) |
| | | } else { // å½ç¶ç±»ç±åå¶å为å
¨å¶æ¶ |
| | | this.dialogFormRoles.roleTreeSelectedArr.forEach((i1, ind) => { |
| | | if (i1.Code === checkedFatherCode) { // i1没æ¾å¯¹ |
| | | console.log(i1, this.dialogFormRoles.roleTreeSelectedArr.splice(ind, 1), 8) |
| | | temp.forEach(it => { |
| | | this.dialogFormRoles.roleTreeSelectedArr.push({ |
| | | Code: it.code, |
| | | Name: it.name, |
| | | Data: it.children.map(i => i.code) |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | // myCheckBoxç¹å»äºä»¶ 大çåç¹å» |
| | | myCheckboxClick(item) { |
| | | console.log(this.dialogFormRoles.rolesArr, 7) |
| | | this.dialogFormRoles.rolesArr.forEach(it => { |
| | | it.isSelected1 = it.code === item.code |
| | | }) |
| | | this.dialogFormRoles.roleTree = this.rolesAll.filter(it => it.code === item.code) |
| | | this.dialogFormRoles.roleTree[0].name = 'å
¨é¨' |
| | | if (this.dialogFormRoles.roleTree[0].children.length < 1) { |
| | | this.dialogFormRoles.roleTree = '' |
| | | } |
| | | const temp = this.dialogFormRoles.roleTreeSelectedArr.filter(it => it.Code === item.code) |
| | | console.log(temp, 33) |
| | | if (temp.length > 0) { |
| | | this.$refs.roleTree.setCheckedKeys(temp[0].Data)// æ å½¢éä¸åæ¾ |
| | | } else { |
| | | this.$refs.roleTree.setCheckedKeys([])// å½é¿åº¦ä¸ºé¶æ¶ç½®ç©º |
| | | } |
| | | }, |
| | | // myCheckBoxInputç¹å»äºä»¶ å°çåç¹å»(input) |
| | | myCheckboxInputClick(item) { |
| | | item.isSelected2 = !item.isSelected2 |
| | | this.dialogFormRoles.rolesArrSelectedArr = [...new Set(this.dialogFormRoles.rolesArrSelectedArr)]// æ°ç»å»é |
| | | if (item.isSelected2) { // 仿²¡éä¸å°éä¸ |
| | | console.log('仿²¡éä¸å°éä¸') |
| | | this.dialogFormRoles.rolesArr.forEach(it => { |
| | | if (it.code === item.code && item.isSelected2) { |
| | | this.dialogFormRoles.rolesArrSelectedArr.push(it.code) |
| | | } |
| | | }) |
| | | |
| | | const temp = this.rolesAll.filter(it => it.code === item.code)// è¿æ»¤åºæ¯æ¬¡éä¸ç大项 |
| | | |
| | | temp.forEach(it => { |
| | | this.dialogFormRoles.roleTreeSelectedArr.push({ |
| | | Code: it.code, |
| | | Name: it.name, |
| | | Data: it.children.map(i => i.code) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (!item.isSelected2) { // ä»éä¸å°æ²¡éä¸ |
| | | console.log('ä»éä¸å°æ²¡éä¸') |
| | | this.dialogFormRoles.rolesArr.forEach((it, ind) => { |
| | | if (it.code === item.code && !item.isSelected2) { |
| | | console.log('è¿æ¥äº') |
| | | console.log(this.dialogFormRoles.rolesArrSelectedArr, 78) |
| | | this.dialogFormRoles.rolesArrSelectedArr.forEach((i, i1) => { |
| | | if (i === it.code) { |
| | | console.log(this.dialogFormRoles.rolesArrSelectedArr.splice(i1, 1), 6664) |
| | | } |
| | | }) |
| | | this.dialogFormRoles.roleTreeSelectedArr.forEach((i, i1) => { |
| | | if (i.Code === it.code) { |
| | | console.log(i1, this.dialogFormRoles.roleTreeSelectedArr.splice(i1, 1), 6665) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.$refs.roleTree.setCheckedKeys(this.dialogFormRoles.rolesArrSelectedArr) |
| | | // this.$refs.roleTree.getCheckedKeys()//åªè½è·åå°ç¬¬ä¸ä¸ªæ å½¢ |
| | | |
| | | this.dialogFormRoles.rolesArrSelectedArr = [...new Set(this.dialogFormRoles.rolesArrSelectedArr)]// æ°ç»å»é |
| | | // æ°ç»ä¸å¯¹è±¡ç¸åçå»é |
| | | // this.dialogFormRoles.roleTreeSelectedArr = this.dialogFormRoles.roleTreeSelectedArr.filter((currentValue, currentIndex, selfArr) => { |
| | | // return selfArr.findIndex(item => item.code === currentValue.Code) === currentIndex |
| | | // }) |
| | | console.log(this.dialogFormRoles.rolesArrSelectedArr, 6666) |
| | | console.log(this.dialogFormRoles.roleTreeSelectedArr, 6777) |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | |
| | | .el-checkbox.is-bordered.is-checked { |
| | | border-color: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-radio__input.is-checked .el-radio__inner { |
| | | border-color: $main_color; |
| | | background: $main_color; |
| | |
| | | border-color: $main_color; |
| | | background: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-checkbox__input.is-checked + .el-checkbox__label { |
| | | color: $main_color !important; |
| | | } |
| | | |
| | | ::v-deep .el-checkbox.is-bordered + .el-checkbox.is-bordered { |
| | | margin: 10px 30px 0px 0; |
| | | //cursor: default !important; |
| | | } |
| | | |
| | | ::v-deep .el-radio__input.is-checked + .el-radio__label { |
| | | color: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-radio.is-bordered + .el-radio.is-bordered { |
| | | margin: 10px 30px 0px 0; |
| | | } |
| | | |
| | | .dialogVisibleRoles { |
| | | //::v-deep .el-checkbox.is-bordered.el-checkbox--medium{ |
| | | // pointer-events: none; |
| | | //} |
| | | |
| | | //::v-deep .el-checkbox__label{ |
| | | // pointer-events: none !important; |
| | | // color: red; |
| | | //} |
| | | .myCheckboxGroup { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | |
| | | .myCheckbox { |
| | | //border: 1px solid $main_color; |
| | | border: 1px solid #eee; |
| | | display: flex; |
| | | min-width: 100px; |
| | | padding: 10px; |
| | | margin: 10px 30px 0 0; |
| | | border-radius: 5px; |
| | | cursor: default; |
| | | |
| | | .myCheckboxInput { |
| | | margin: 1px 5px 0 0; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | } |
| | | |
| | | //.myCheckbox{ |
| | | // border: 1px solid $main_color; |
| | | //} |
| | | |
| | | input[type=checkbox] { |
| | | cursor: pointer; |
| | | position: relative; |
| | | width: 14px; |
| | | height: 14px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | input[type=checkbox]::after { |
| | | position: absolute; |
| | | top: 0; |
| | | //color: rgb(130, 35, 35); |
| | | color: $main_color; |
| | | width: 14px; |
| | | height: 14px; |
| | | display: inline-block; |
| | | visibility: visible; |
| | | padding-left: 0px; |
| | | text-align: center; |
| | | content: ' '; |
| | | border-radius: 3px |
| | | } |
| | | |
| | | input[type=checkbox]:checked::after { |
| | | content: "â"; |
| | | //content: "â"; |
| | | color: #fff; |
| | | font-size: 12px; |
| | | font-weight: bold; |
| | | background-color: $main_color; |
| | | } |
| | | } |
| | | |
| | | } |
| | | </style> |
| | |
| | | width="50%" |
| | | top="15vh" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | <el-form ref="dialogForm" :rules="dialogFormRules" :model="dialogForm" label-width="80px"> |
| | | <el-form-item label="ç»ç»ç±»å" prop="OrgType"> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <div class="body" style="background-color: #ffffff; padding: 20px 10px 0 20px;" :style="{height:mainHeight+'px'}"> |
| | | <div style="height: 50px;"> |
| | | <el-form |
| | | ref="form" |
| | | :model="form" |
| | | label-width="80px" |
| | | inline |
| | | style="display: flex;justify-content: space-between" |
| | | > |
| | | <div style="display: flex;justify-content: space-around;width: 85%"> |
| | | <el-form-item label="ç»ç»ç¼ç " style=" display: flex;"> |
| | | <el-input v-model="form.OrgCode" placeholder="请è¾å
¥" style="width: calc(100%-30px)" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»ç»åç§°" style=" display: flex;"> |
| | | <el-input v-model="form.OrgName" placeholder="请è¾å
¥" style="width: calc(100%-30px)" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»ç»ç±»å" style=" display: flex;"> |
| | | <el-select v-model="form.OrgType" style="width: calc(100%-30px)" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in OrgTypeArr" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å建人å" style=" display: flex;"> |
| | | <el-input v-model="form.UserName" style="width: calc(100%-30px)" placeholder="请è¾å
¥" /> |
| | | </el-form-item> |
| | | </div> |
| | | <div style="display: flex;align-items: start;margin-top: 5px;"> |
| | | <el-button type="primary" icon="el-icon-search" @click="search">æ¥è¯¢</el-button> |
| | | <el-button type="info" icon="el-icon-refresh" @click="reset">éç½®</el-button> |
| | | </div> |
| | | </el-form> |
| | | </div> |
| | | <div style="margin-bottom: 20px;display: flex"> |
| | | <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">æ°å¢</el-button> |
| | | <!-- <el-button type="primary" icon="el-icon-edit" @click="edit('edit')">ä¿®æ¹</el-button>--> |
| | | <!-- <el-button type="primary" icon="el-icon-delete" @click="del">æ¹éå é¤</el-button>--> |
| | | </div> |
| | | |
| | | <div style="display: flex;border: 1px solid #eee"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | highlight-current-row |
| | | :style="{width: 100+'%',height:tableHeight+'px'}" |
| | | :header-cell-style="this.$headerCellStyle" |
| | | :cell-style="this.$cellStyle" |
| | | @sort-change="sortChange" |
| | | > |
| | | <!-- <el-table-column--> |
| | | <!-- type="selection"--> |
| | | <!-- width="50"--> |
| | | <!-- />--> |
| | | <el-table-column |
| | | prop="id" |
| | | width="50" |
| | | label="åºå·" |
| | | /> |
| | | <el-table-column |
| | | prop="org_code" |
| | | label="ç»ç»ç¼ç " |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="org_name" |
| | | label="ç»ç»åç§°" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="description" |
| | | label="ç»ç»ç±»å" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.description==='F'">å·¥å</div> |
| | | <div v-if="row.description==='D'">é¨é¨</div> |
| | | <div v-if="row.description==='W'">车é´</div> |
| | | <div v-if="row.description==='K'">ç§å®¤</div> |
| | | <div v-if="row.description==='L'">ç产线</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="parentorg_name" |
| | | label="ä¸çº§åä½" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="lm_user" |
| | | label="å建人å" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="lm_date" |
| | | label="å建æ¶é´" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | label="æä½" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div class="operationClass"> |
| | | <el-button type="text" @click="edit('edit',row)">ä¿®æ¹</el-button> |
| | | <el-button type="text" @click="del(row.id)">å é¤</el-button> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <!--å页--> |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="form.page" |
| | | :limit.sync="form.rows" |
| | | align="right" |
| | | layout="prev, pager, next,sizes" |
| | | popper-class="select_bottom" |
| | | @pagination="getOrganizationSearch" |
| | | /> |
| | | </div> |
| | | |
| | | <el-dialog |
| | | :title="operation==='add'?'æ·»å ':'ä¿®æ¹'" |
| | | :visible.sync="dialogVisible" |
| | | width="50%" |
| | | top="15vh" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | <el-form ref="dialogForm" :rules="dialogFormRules" :model="dialogForm" label-width="80px"> |
| | | <el-form-item label="ç»ç»ç±»å" prop="OrgType"> |
| | | <el-radio-group |
| | | v-model="dialogForm.OrgType" |
| | | style="display: flex;align-items: end;height: 29px;" |
| | | @change="changeRadio" |
| | | > |
| | | <el-radio |
| | | v-for="item in OrgTypeArr" |
| | | :key="item.value" |
| | | :value="item.value" |
| | | :label="item.label" |
| | | /> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="ç»ç»ç¼ç " prop="OrgCode"> |
| | | <el-input v-model="dialogForm.OrgCode" :disabled="operation!=='add'" style="width: 220px" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»ç»åç§°" prop="OrgName"> |
| | | <el-input v-model="dialogForm.OrgName" style="width: 220px" /> |
| | | </el-form-item> |
| | | <el-form-item v-if="dialogFormOrgTypeSelected!=='F'" prop="SupUnit" label="ä¸çº§åä½"> |
| | | <el-select |
| | | v-model="dialogForm.SupUnit" |
| | | style="width: 220px" |
| | | placeholder="è¯·éæ©" |
| | | > |
| | | <el-option |
| | | v-for="item in SupUnitArr" |
| | | :label="item.org_name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <div class="footerButton"> |
| | | <el-button @click="dialogVisibleCancel">å æ¶</el-button> |
| | | <el-button type="primary" @click="dialogVisibleConfirm">ç¡® å®</el-button> |
| | | </div> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import Pagination from '@/components/Pagination' |
| | | import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz' |
| | | import { getCookie } from '@/utils/auth' |
| | | |
| | | const SER_HZ = /^[\u4e00-\u9fa5]+$/ |
| | | export default { |
| | | name: 'Zzjg', |
| | | components: { |
| | | Pagination |
| | | }, |
| | | data() { |
| | | const validateName = (rule, value, callback) => { |
| | | if (!value) { |
| | | return callback(new Error('请è¾å
¥ç¼ç ')) |
| | | } else { |
| | | if (SER_HZ.test(value)) { |
| | | return callback(new Error('ç¼ç ä¸è½ä¸ºä¸æ')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } |
| | | const validateTypeCode = (rule, value, callback) => { |
| | | if (!value) { |
| | | return callback(new Error('è¯·éæ©ä¸çº§')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | mainHeight: 0, |
| | | tableHeight: 0, |
| | | form: { |
| | | OrgCode: '', // ç»ç»æ¶æä»£ç |
| | | OrgName: '', // ç»ç»æ¶æåç§° |
| | | OrgType: '', // ç»ç»ç±»å |
| | | UserName: '', // å建人å |
| | | prop: 'lm_date', // æåºå段 |
| | | order: 'desc', // æåºå段 |
| | | page: 1, // 第å 页 |
| | | rows: 10 // æ¯é¡µå¤å°æ¡ |
| | | }, |
| | | OrgTypeArr: [ |
| | | { label: 'å·¥å', value: 'F' }, |
| | | { label: 'é¨é¨', value: 'D' }, |
| | | { label: '车é´', value: 'W' }, |
| | | { label: 'ç§å®¤', value: 'K' }, |
| | | { label: 'ç产线', value: 'L' } |
| | | ], |
| | | |
| | | total: 10, |
| | | tableData: [], |
| | | dialogVisible: false, |
| | | dialogForm: { |
| | | OrgType: '', |
| | | OrgCode: '', |
| | | OrgName: '', |
| | | SupUnit: ''// ä¸çº§åä½ |
| | | }, |
| | | SupUnitArr: [], |
| | | dialogFormOrgTypeSelected: '', |
| | | operation: '', |
| | | dialogFormRules: { |
| | | OrgType: [ |
| | | { required: true, message: '请è¾å
¥éæ©ç±»å', trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgCode: [ |
| | | { required: true, validator: validateName, trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgName: [ |
| | | { required: true, message: '请è¾å
¥åç§°', trigger: ['blur', 'change'] } |
| | | ], |
| | | SupUnit: [ |
| | | { required: true, validator: validateTypeCode, trigger: ['blur', 'change'] } |
| | | ] |
| | | } |
| | | |
| | | } |
| | | }, |
| | | created() { |
| | | this.getOrganizationSearch() |
| | | }, |
| | | mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | }, |
| | | methods: { |
| | | async getOrganizationSearch() { |
| | | const res = await OrganizationSearch(this.form) |
| | | this.tableData = res.data |
| | | this.total = res.count |
| | | }, |
| | | // æåºæ¹åæ¶ |
| | | sortChange({ column, prop, order }) { |
| | | if (order === 'descending') { |
| | | order = 'desc' |
| | | } else if (order === 'ascending') { |
| | | order = 'asc' |
| | | } else { |
| | | order = 'desc' |
| | | } |
| | | this.form.order = order |
| | | this.form.prop = prop |
| | | this.getOrganizationSearch() |
| | | }, |
| | | // æ¥è¯¢ |
| | | search() { |
| | | this.getOrganizationSearch() |
| | | }, |
| | | // éç½® |
| | | reset() { |
| | | this.form.OrgCode = '' |
| | | this.form.OrgName = '' |
| | | this.form.OrgType = '' |
| | | this.form.UserName = '' |
| | | this.getOrganizationSearch() |
| | | }, |
| | | // åéæ¡æ¹åæ¶ |
| | | async changeRadio(val) { |
| | | if (val.length > 1) { |
| | | this.OrgTypeArr.forEach(item => { |
| | | if (item.label === val) { |
| | | this.dialogFormOrgTypeSelected = item.value |
| | | } |
| | | }) |
| | | this.dialogForm.SupUnit = '' |
| | | } else { |
| | | this.dialogFormOrgTypeSelected = val |
| | | } |
| | | if (this.dialogFormOrgTypeSelected !== 'F') { |
| | | const { data: res } = await PrentOrganization({ orgcode: this.dialogFormOrgTypeSelected }) |
| | | this.SupUnitArr = res |
| | | } |
| | | }, |
| | | |
| | | // æ°å¢æé® |
| | | add(operation) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | }, |
| | | // ä¿®æ¹æé® |
| | | edit(operation, row) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | if (row.description === 'F') { |
| | | this.dialogForm.OrgType = 'å·¥å' |
| | | } else if (row.description === 'D') { |
| | | this.dialogForm.OrgType = 'é¨é¨' |
| | | } else if (row.description === 'W') { |
| | | this.dialogForm.OrgType = '车é´' |
| | | } else if (row.description === 'K') { |
| | | this.dialogForm.OrgType = 'ç§å®¤' |
| | | } else if (row.description === 'L') { |
| | | this.dialogForm.OrgType = 'ç产线' |
| | | } |
| | | this.$nextTick(() => { |
| | | this.changeRadio(this.dialogForm.OrgType) |
| | | this.dialogForm.OrgCode = row.org_code |
| | | this.dialogForm.OrgName = row.org_name |
| | | this.dialogForm.SupUnit = row.parent_id |
| | | }) |
| | | }, |
| | | // å é¤æé® |
| | | async del(id) { |
| | | this.$confirm('æ¯å¦ç¡®è®¤å é¤?', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | DeleteOrganization({ orgid: id }).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success('å 餿å!') |
| | | this.getOrganizationSearch() |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message.info('已忶å é¤') |
| | | }) |
| | | }, |
| | | // å¯¹è¯æ¡å
³éäºä»¶ |
| | | handleClose() { |
| | | this.dialogForm.OrgType = '' |
| | | this.dialogForm.OrgCode = '' |
| | | this.dialogForm.OrgName = '' |
| | | this.dialogForm.SupUnit = '' |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // å¯¹è¯æ¡åæ¶ |
| | | dialogVisibleCancel() { |
| | | this.dialogVisible = false |
| | | }, |
| | | // å¯¹è¯æ¡ç¡®è®¤ |
| | | dialogVisibleConfirm() { |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | const data = { |
| | | OrganType: this.dialogFormOrgTypeSelected, |
| | | OrganCode: this.dialogForm.OrgCode, |
| | | OrganName: this.dialogForm.OrgName, |
| | | SupUnit: this.dialogFormOrgTypeSelected === 'F' ? '0' : this.dialogForm.SupUnit, |
| | | OperType: this.operation === 'add' ? 'Add' : 'Update', |
| | | Operator: getCookie('admin') |
| | | } |
| | | AddUpdateOrganization(data).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success(this.operation === 'add' ? 'æ·»å æåï¼' : 'ä¿®æ¹æåï¼') |
| | | this.getOrganizationSearch() |
| | | } else { |
| | | this.$message.error(this.operation === 'add' ? 'æ·»å 失败ï¼' : 'ä¿®æ¹å¤±è´¥ï¼') |
| | | } |
| | | }) |
| | | |
| | | this.dialogVisible = false |
| | | } |
| | | }) |
| | | }, |
| | | // è·å页é¢é«åº¦ |
| | | getHeight() { |
| | | this.$nextTick(() => { |
| | | this.mainHeight = window.innerHeight - 200 |
| | | this.tableHeight = this.mainHeight - 100 |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | $main_color: #42b983; |
| | | ::v-deep .el-button--primary { |
| | | background-color: $main_color !important; |
| | | height: 30px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | ::v-deep .el-button--info { |
| | | //background-color: $main_color !important; |
| | | height: 30px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | ::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active { |
| | | background-color: $main_color !important; |
| | | } |
| | | |
| | | .footerButton { |
| | | display: flex; |
| | | justify-content: end; |
| | | } |
| | | |
| | | ::v-deep .el-button--default { |
| | | background-color: #ffffff !important; |
| | | height: 30px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | ::v-deep .el-button--default:hover { |
| | | color: #606266; |
| | | } |
| | | |
| | | ::v-deep .el-dialog__body { |
| | | padding: 20px 100px !important; |
| | | } |
| | | |
| | | ::v-deep .el-radio__input.is-checked .el-radio__inner { |
| | | background-color: $main_color; |
| | | border-color: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-radio__input.is-checked + .el-radio__label { |
| | | color: $main_color !important; |
| | | } |
| | | |
| | | ::v-deep .el-checkbox__input.is-checked .el-checkbox__inner { |
| | | border-color: $main_color; |
| | | background-color: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-input__inner { |
| | | height: 30px |
| | | } |
| | | |
| | | ::v-deep .el-table .caret-wrapper { |
| | | //float: right; |
| | | transform: scale(0.8); |
| | | } |
| | | |
| | | ::v-deep .cell { |
| | | display: flex !important; |
| | | align-items: center !important; |
| | | justify-content: space-between !important; |
| | | } |
| | | |
| | | ::v-deep .el-button--text { |
| | | color: $main_color; |
| | | font-size: 14px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .operationClass { |
| | | height: 23px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | |
| | | .el-icon-share { |
| | | color: $main_color; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .el-checkbox.is-bordered.is-checked { |
| | | border-color: $main_color; |
| | | } |
| | | ::v-deep .el-radio__input.is-checked .el-radio__inner { |
| | | border-color: $main_color; |
| | | background: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-checkbox__input.is-indeterminate .el-checkbox__inner{ |
| | | border-color: $main_color; |
| | | background: $main_color; |
| | | } |
| | | ::v-deep .el-checkbox__input.is-checked + .el-checkbox__label { |
| | | color: $main_color !important; |
| | | } |
| | | |
| | | ::v-deep .el-checkbox.is-bordered+.el-checkbox.is-bordered{ |
| | | margin: 10px 30px 0px 0; |
| | | } |
| | | |
| | | ::v-deep .el-radio__input.is-checked + .el-radio__label { |
| | | color: $main_color; |
| | | } |
| | | |
| | | ::v-deep .el-radio.is-bordered + .el-radio.is-bordered { |
| | | margin: 10px 30px 0px 0; |
| | | } |
| | | </style> |
| | |
| | | 'use strict' |
| | | const path = require('path') |
| | | const defaultSettings = require('./src/settings.js') |
| | | |
| | | const webpack = require('webpack') |
| | | function resolve(dir) { |
| | | return path.join(__dirname, dir) |
| | | } |
| | |
| | | alias: { |
| | | '@': resolve('src') |
| | | } |
| | | } |
| | | }, |
| | | plugins: [ |
| | | new webpack.ProvidePlugin({ |
| | | jQuery: 'jquery', |
| | | $: 'jquery' |
| | | }) |
| | | ] |
| | | }, |
| | | chainWebpack(config) { |
| | | // it can improve the speed of the first screen, it is recommended to turn on preload |