| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <div class="body" :style="{height:mainHeight+'px'}"> |
| | | |
| | | <div class="bodyTopButtonGroup"> |
| | | <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">æ°å¢</el-button> |
| | | </div> |
| | | <div class="bodyTopFormGroup"> |
| | | <el-form |
| | | ref="form" |
| | | :model="form" |
| | | label-width="100px" |
| | | inline |
| | | style="display: flex;" |
| | | > |
| | | <div class="elForm"> |
| | | <el-form-item label="ç»ç»ç¼ç " style=" display: flex;"> |
| | | <el-input v-model="form.OrgCode" placeholder="请è¾å
¥" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»ç»åç§°" style=" display: flex;"> |
| | | <el-input v-model="form.OrgName" placeholder="请è¾å
¥" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»ç»ç±»å" style=" display: flex;"> |
| | | <el-select |
| | | v-model="form.OrgType" |
| | | :popper-append-to-body="false" |
| | | filterable |
| | | style="width: 200px" |
| | | 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: 200px" placeholder="请è¾å
¥" /> |
| | | </el-form-item> |
| | | </div> |
| | | <div |
| | | class="bodySearchReset" |
| | | :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" |
| | | > |
| | | <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 |
| | | class="bodyTopFormExpand" |
| | | /> |
| | | </div> |
| | | <div class="elTableDiv"> |
| | | <el-table |
| | | ref="tableDataRef" |
| | | class="tableFixed" |
| | | :data="tableData" |
| | | border |
| | | :row-class-name="tableRowClassName" |
| | | :style="{width: 100+'%',height:tableHeight+'px'}" |
| | | highlight-current-row |
| | | :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="RowNum" |
| | | width="50" |
| | | label="åºå·" |
| | | fixed |
| | | /> |
| | | <el-table-column |
| | | prop="org_code" |
| | | label="ç»ç»ç¼ç " |
| | | sortable="custom" |
| | | show-tooltip-when-overflow |
| | | min-width="110" |
| | | /> |
| | | <el-table-column |
| | | prop="org_name" |
| | | label="ç»ç»åç§°" |
| | | sortable="custom" |
| | | show-tooltip-when-overflow |
| | | min-width="110" |
| | | /> |
| | | <el-table-column |
| | | prop="description" |
| | | label="ç»ç»ç±»å" |
| | | min-width="110" |
| | | show-tooltip-when-overflow |
| | | 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" |
| | | show-tooltip-when-overflow |
| | | min-widt="110" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.parentorg_name===null">/</div> |
| | | <div v-else>{{ row.parentorg_name }}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="lm_user" |
| | | label="å建人å" |
| | | width="110" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="lm_date" |
| | | label="å建æ¶é´" |
| | | width="160" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | fixed="right" |
| | | label="æä½" |
| | | width="120" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div class="operationClass"> |
| | | <el-tooltip class="item" effect="dark" content="ç¼è¾" placement="top"> |
| | | <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" /> |
| | | </el-tooltip> |
| | | <el-tooltip v-del-tab-index class="item" effect="dark" content="å é¤" placement="top"> |
| | | <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row.id)" /> |
| | | </el-tooltip> |
| | | <!-- <el-button type="primary" size="mini" />--> |
| | | <!-- <el-button type="danger" size="mini">å é¤</el-button>--> |
| | | |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <!--å页--> |
| | | <pagination |
| | | :total="total" |
| | | :page.sync="form.page" |
| | | :limit.sync="form.rows" |
| | | align="right" |
| | | layout="total ,prev, pager, next,sizes" |
| | | popper-class="select_bottom" |
| | | @pagination="getOrganizationSearch" |
| | | /> |
| | | </div> |
| | | |
| | | <el-dialog |
| | | :title="operation==='add'?'æ°å¢':'ç¼è¾'" |
| | | :visible.sync="dialogVisible" |
| | | width="800px" |
| | | top="15vh" |
| | | :close-on-click-modal="false" |
| | | @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" |
| | | :disabled="operation==='edit'" |
| | | @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: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»ç»åç§°" prop="OrgName"> |
| | | <el-input v-model="dialogForm.OrgName" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item v-if="dialogForm.OrgType!=='é¨é¨'" prop="SupUnit" label="ä¸çº§åä½"> |
| | | <el-select |
| | | v-model="dialogForm.SupUnit" |
| | | style="width: 200px" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | placeholder="è¯·éæ©" |
| | | > |
| | | <el-option |
| | | v-for="item in SupUnitArr" |
| | | :key="item.id" |
| | | :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" |
| | | :loading="$store.state.app.buttonIsDisabled" |
| | | :disabled="$store.state.app.buttonIsDisabled" |
| | | @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' |
| | | import { validateCode } from '@/utils/global' |
| | | |
| | | // const SER_HZ = /^[\u4e00-\u9fa5]+$/ |
| | | // const SER_HZ = /^[a-zA-Z0-9_;,.<>() ]{0,}$/ |
| | | export default { |
| | | name: 'ZZJG', |
| | | components: { |
| | | Pagination |
| | | }, |
| | | data() { |
| | | // const validateName = (rule, value, callback) => { |
| | | // if (!value) { |
| | | // return callback(new Error('请è¾å
¥ç¼ç ')) |
| | | // } else { |
| | | // if (!this.$SER_HZ.test(value)) { |
| | | // return callback(new Error('ç¼ç ä¸è½å«æä¸ææç¹æ®å符')) |
| | | // } else { |
| | | // callback() |
| | | // } |
| | | // } |
| | | // } |
| | | const validateTypeCode = (rule, value, callback) => { |
| | | if (!value) { |
| | | return callback(new Error('è¯·éæ©ä¸çº§')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | windowHeight: 0, |
| | | windowWidth: 0, |
| | | mainHeight: 0, |
| | | tableHeight: 0, |
| | | numvalue: 0, |
| | | form: { |
| | | OrgCode: '', // ç»ç»æ¶æä»£ç |
| | | OrgName: '', // ç»ç»æ¶æåç§° |
| | | OrgType: '', // ç»ç»ç±»å |
| | | UserName: '', // å建人å |
| | | prop: 'lm_date', // æåºå段 |
| | | order: 'desc', // æåºå段 |
| | | page: 1, // 第å 页 |
| | | rows: 20 // æ¯é¡µå¤å°æ¡ |
| | | }, |
| | | 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: [], |
| | | operation: '', |
| | | dialogFormRules: { |
| | | OrgType: [ |
| | | { required: true, message: '请è¾å
¥éæ©ç±»å', trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgCode: [ |
| | | // { required: true, validator: validateName, trigger: ['blur', 'change'] } |
| | | { required: true, validator: validateCode, trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgName: [ |
| | | { required: true, message: '请è¾å
¥åç§°', trigger: ['blur', 'change'] } |
| | | ], |
| | | SupUnit: [ |
| | | { required: true, validator: validateTypeCode, trigger: ['blur', 'change'] } |
| | | ] |
| | | } |
| | | |
| | | } |
| | | }, |
| | | // watch: { |
| | | // windowHeight(val) { |
| | | // console.log('宿¶å±å¹é«åº¦ï¼', val, this.windowHeight) |
| | | // }, |
| | | // windowWidth(val) { |
| | | // if (val < 768) { |
| | | // this.dialogWidth = '100%' |
| | | // } else { |
| | | // this.dialogWidth = '75%' |
| | | // } |
| | | // console.log('宿¶å±å¹å®½åº¦ï¼', val, this.windowHeight) |
| | | // } |
| | | // }, |
| | | created() { |
| | | this.getOrganizationSearch() |
| | | }, |
| | | mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | |
| | | // console.log('页é¢è¿å
¥æ¶ç宽度ï¼', document.body.clientWidth) |
| | | // if (document.body.clientWidth < 768) { |
| | | // this.dialogWidth = '100%' |
| | | // } |
| | | // |
| | | // // <!--æwindow.onresizeäºä»¶æå¨å°mounted彿°ä¸--> |
| | | // window.onresize = () => { |
| | | // return (() => { |
| | | // this.windowHeight = document.documentElement.clientHeight// é« |
| | | // this.windowWidth = document.documentElement.clientWidth // 宽 |
| | | // })() |
| | | // } |
| | | }, |
| | | destroyed() { |
| | | |
| | | }, |
| | | 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 (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) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | |
| | | // const res = await getNewEncodingRules(getCookie('ruleCode')) |
| | | // this.dialogForm.OrgCode = res.RightCode |
| | | // this.numvalue = res.numvalue |
| | | }, |
| | | // ä¿®æ¹æé® |
| | | 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('å 餿å!') |
| | | if (this.form.page > 1 && this.tableData.length === 1) { |
| | | this.form.page-- |
| | | } |
| | | 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) { |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | const data = { |
| | | OrganType: 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, |
| | | OperType: this.operation === 'add' ? 'Add' : 'Update', |
| | | Operator: getCookie('admin') |
| | | } |
| | | |
| | | AddUpdateOrganization(data).then(res => { |
| | | if (res.code === '200') { |
| | | this.dialogVisible = false |
| | | this.$message.success(this.operation === 'add' ? 'æ·»å æåï¼' : 'ä¿®æ¹æåï¼') |
| | | this.getOrganizationSearch() |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | } else { |
| | | this.$message.error(this.operation === 'add' ? 'æ·»å 失败ï¼' : 'ä¿®æ¹å¤±è´¥ï¼') |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | // è·å页é¢é«åº¦ |
| | | getHeight() { |
| | | this.$nextTick(() => { |
| | | this.mainHeight = window.innerHeight - 85 |
| | | this.tableHeight = this.mainHeight - 195 |
| | | if (window.innerHeight < 769) { |
| | | this.tableHeight = this.tableHeight - 40 |
| | | } |
| | | this.isIpad = window.innerHeight < 769 && window.innerWidth < 1367 |
| | | this.$refs.tableDataRef.doLayout() |
| | | }) |
| | | }, |
| | | tableRowClassName({ row, rowIndex }) { |
| | | return 'custom-row' |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <!--å
Œ
±é¡µé¢æ ·å¼--> |
| | | <style lang="scss" scoped> |
| | | $main_color: #42b983; |
| | | .el-icon-share, .el-icon-delete, .el-icon-edit-outline { |
| | | color: $main_color; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .el-icon-edit-outline { |
| | | margin-right: 15px; |
| | | } |
| | | |
| | | ::v-deep .el-button--primary, .el-button--default, .el-button--info { |
| | | height: 34px; |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 0 15px; |
| | | } |
| | | |
| | | ::v-deep .el-button--primary { |
| | | //background-color: $main_color !important; |
| | | } |
| | | |
| | | ::v-deep .el-button--default { |
| | | background-color: #f8f8fa; |
| | | border: none; |
| | | } |
| | | |
| | | ::v-deep .el-input__inner { |
| | | height: 34px; |
| | | line-height: 34px; |
| | | //color: #a7a7a7; |
| | | } |
| | | |
| | | ::v-deep .el-dialog__body { |
| | | padding: 20px 100px !important; |
| | | } |
| | | |
| | | ::v-deep .dialogVisibleRoles .el-dialog__body { |
| | | padding: 20px 20px !important; |
| | | } |
| | | |
| | | ::v-deep .importPickerClass .el-dialog__body { |
| | | padding: 20px 20px !important; |
| | | } |
| | | |
| | | ::v-deep .el-dialog__footer { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | ::v-deep .el-table .caret-wrapper { |
| | | transform: scale(0.8); |
| | | } |
| | | |
| | | ::v-deep .cell { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | ::v-deep .el-table::before { |
| | | height: 0; |
| | | } |
| | | |
| | | ::v-deep .el-table__body-wrapper { |
| | | background-color: #f8f8fa; |
| | | } |
| | | |
| | | ::v-deep .el-table__body .el-table__row.hover-row td { |
| | | background-color: #eaecef; |
| | | } |
| | | |
| | | ::v-deep .el-form--inline .el-form-item__label { |
| | | color: #a7a7a7; |
| | | } |
| | | |
| | | .body ::v-deep .el-divider { |
| | | border: 1px solid #eee; |
| | | width: 99%; |
| | | margin: 10px auto; |
| | | } |
| | | |
| | | .body ::v-deep .el-form-item { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | .tableFixed { |
| | | ::v-deep .el-table__fixed-right { |
| | | height: 100% !important; |
| | | } |
| | | |
| | | ::v-deep .el-table__fixed { |
| | | height: 100% !important; |
| | | } |
| | | } |
| | | |
| | | //::v-deep .cell { |
| | | // display: flex; |
| | | // flex-wrap: nowrap; |
| | | //} |
| | | // |
| | | //::v-deep .has-gutter .cell { |
| | | // display: flex; |
| | | // flex-wrap: nowrap; |
| | | //} |
| | | </style> |
| | | <style> |
| | | .osloading{ |
| | | font-size: 30px; |
| | | } |
| | | |
| | | .el-table .custom-row { |
| | | background: #f8f8fa; |
| | | } |
| | | </style> |