¶Ô±ÈÐÂÎļþ |
| | |
| | | <style scoped> |
| | | .title { |
| | | height: 60px; |
| | | line-height: 60px; |
| | | } |
| | | |
| | | .search { |
| | | background-color: #fff; |
| | | height: 80px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .search_thing { |
| | | width: 350px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .search_label { |
| | | width: 110px; |
| | | font-size: 14px; |
| | | text-align: right; |
| | | } |
| | | |
| | | .search_input { |
| | | width: calc(100% - 110px); |
| | | } |
| | | |
| | | .table { |
| | | margin-top: 10px; |
| | | background-color: #fff; |
| | | width: calc(100% - 40px); |
| | | height: calc(100% - 60px - 80px - 10px - 40px); |
| | | padding: 20px; |
| | | } |
| | | </style> |
| | | |
| | | <template> |
| | | <div class="custom_manage"> |
| | | <div> |
| | | <el-row class="title"> |
| | | <el-col :span="12" style="padding-left: 20px;">客æ·ç®¡ç</el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-button size="medium" type="primary" @click="addDia = true" v-if="addPower">æ°å¢</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="search"> |
| | | <div class="search_thing"> |
| | | <div class="search_label">客æ·åç§°ï¼</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请è¾å
¥" clearable |
| | | v-model="componentData.entity.name" @keyup.enter.native="refreshTable()"></el-input></div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label">è´¦å·ç¶æï¼</div> |
| | | <div class="search_input"> |
| | | <el-select size="small" v-model="componentData.entity.state" style="width: 100%;" @change="refreshTable()"> |
| | | <el-option label="å
¨é¨" :value="null"></el-option> |
| | | <el-option label="å¯ç¨" :value="1"></el-option> |
| | | <el-option label="åç¨" :value="0"></el-option> |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | | <div class="search_thing" style="padding-left: 30px;"> |
| | | <el-button size="small" @click="refresh()">é ç½®</el-button> |
| | | <el-button size="small" type="primary" @click="refreshTable()">æ¥ è¯¢</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table"> |
| | | <ValueTable ref="ValueTable" :url="$api.user.selectCustomPageList" :delUrl="$api.user.delCustomById" |
| | | :componentData="componentData" :key="upIndex" /> |
| | | </div> |
| | | <el-dialog title="æ°å¢å®¢æ·" :visible.sync="addDia" width="450px"> |
| | | <div style="margin-bottom: 15px;"> |
| | | <el-row style="line-height: 50px;"> |
| | | <el-col :span="7" style="text-align: right;padding-right: 8px;"> |
| | | <span class="required-span">* </span>客æ·åç§°ï¼</el-col> |
| | | <el-col :span="15"> |
| | | <el-input v-model="user.name" readonly size="small"> |
| | | <template slot="append"><el-button slot="append" icon="el-icon-search" |
| | | @click="selectUserDia = true"></el-button></template> |
| | | </el-input> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="line-height: 50px;"> |
| | | <el-col :span="7" style="text-align: right;padding-right: 8px;"><span class="required-span">* |
| | | </span>客æ·è´¦æ·ï¼</el-col> |
| | | <el-col :span="15"> |
| | | <el-input v-model="user.account" readonly size="small"></el-input> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="line-height: 50px;"> |
| | | <el-col :span="7" style="text-align: right;padding-right: 8px;">çµåé®ç®±ï¼</el-col> |
| | | <el-col :span="15"> |
| | | <el-input v-model="user.email" size="small" clearable></el-input> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="line-height: 50px;"> |
| | | <el-col :span="7" style="text-align: right;padding-right: 8px;"><span class="required-span">* |
| | | </span>çµè¯å·ç ï¼</el-col> |
| | | <el-col :span="15"> |
| | | <el-input v-model="user.phone" size="small" clearable></el-input> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="line-height: 50px;"> |
| | | <el-col :span="7" style="text-align: right;padding-right: 8px;"><span class="required-span">* |
| | | </span>客æ·åä½ï¼</el-col> |
| | | <el-col :span="15"> |
| | | <el-input v-model="user.company" size="small" clearable></el-input> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 15px;"> |
| | | <el-col :span="7" style="text-align: right;padding-right: 8px;"><span class="required-span">* |
| | | </span>åä½å°åï¼</el-col> |
| | | <el-col :span="15"> |
| | | <el-input type="textarea" v-model="user.address" size="small" clearable :autosize="{minRows: 2, maxRows: 4}"></el-input> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="addDia = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="customAdd" :loading="loading">ç¡® å®</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="éæ©ç¨æ·" :visible.sync="selectUserDia" width="70%"> |
| | | <div class="body" style="height: 60vh;" v-if="selectUserDia"> |
| | | <ValueTable ref="ValueTable2" :url="$api.user.selectUserList" :componentData="componentData2" /> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="selectUserDia = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="selectUser">ç¡® å®</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import ValueTable from '../tool/value-table.vue' |
| | | export default { |
| | | components: { |
| | | ValueTable |
| | | }, |
| | | data() { |
| | | return { |
| | | componentData: { |
| | | entity: { |
| | | name: null, |
| | | state: null, |
| | | orderBy: { |
| | | field: 'id', |
| | | order: 'asc' |
| | | } |
| | | }, |
| | | isIndex: true, |
| | | showSelect: false, |
| | | select: false, |
| | | do: [{ |
| | | font: 'å§æè®°å½', |
| | | type: 'text', |
| | | method: 'entrust' |
| | | }, { |
| | | font: 'å议记å½', |
| | | type: 'text', |
| | | method: 'protocol' |
| | | }, { |
| | | id: 'delete', |
| | | font: 'å é¤', |
| | | type: 'text', |
| | | method: 'doDiy' |
| | | }], |
| | | tagField: { |
| | | state: { |
| | | select: [{ |
| | | value: 1, |
| | | type: 'success', |
| | | label: 'å¯ç¨' |
| | | }, { |
| | | value: 0, |
| | | type: 'danger', |
| | | label: 'åç¨' |
| | | }] |
| | | } |
| | | }, |
| | | selectField: { |
| | | state: { |
| | | select: [{ |
| | | value: 1, |
| | | type: 'success', |
| | | label: 'å¯ç¨' |
| | | }, { |
| | | value: 0, |
| | | type: 'danger', |
| | | label: 'åç¨' |
| | | }] |
| | | } |
| | | }, |
| | | requiredAdd: [], |
| | | requiredUp: [] |
| | | }, |
| | | entityCopy: {}, |
| | | upIndex: 0, |
| | | addDia: false, |
| | | addPower: true, |
| | | addDia: false, |
| | | user: { |
| | | name: null |
| | | }, |
| | | selectUserDia: false, |
| | | loading: false, |
| | | componentData2: { |
| | | entity: { |
| | | isCustom: 0, |
| | | orderBy: { |
| | | field: 'id', |
| | | order: 'asc' |
| | | } |
| | | }, |
| | | isIndex: true, |
| | | showSelect: true, |
| | | select: false, |
| | | do: [], |
| | | tagField: {}, |
| | | selectField: {}, |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.entityCopy = this.HaveJson(this.componentData.entity) |
| | | this.getPower() |
| | | }, |
| | | methods: { |
| | | refreshTable() { |
| | | this.$refs['ValueTable'].selectList() |
| | | }, |
| | | refresh() { |
| | | this.componentData.entity = this.HaveJson(this.entityCopy) |
| | | this.upIndex++ |
| | | }, |
| | | customAdd() { |
| | | if (this.user.name == '' || this.user.name == null) { |
| | | this.$message.error('请填å客æ·åç§°') |
| | | return |
| | | } |
| | | if (this.user.account == '' || this.user.account == null) { |
| | | this.$message.error('请填å客æ·è´¦æ·') |
| | | return |
| | | } |
| | | if (this.user.phone == '' || this.user.phone == null) { |
| | | this.$message.error('请填åçµè¯å·ç ') |
| | | return |
| | | } |
| | | if (this.user.company == '' || this.user.company == null) { |
| | | this.$message.error('请填å客æ·åä½') |
| | | return |
| | | } |
| | | if (this.user.address == '' || this.user.address == null) { |
| | | this.$message.error('请填ååä½å°å') |
| | | return |
| | | } |
| | | this.loading = true |
| | | this.$axios.post(this.$api.user.addCustom, this.user, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res => { |
| | | if (res.code == 201) return |
| | | this.$message.success('æ·»å æå') |
| | | this.refreshTable() |
| | | this.loading = false |
| | | this.addDia = false |
| | | }) |
| | | }, |
| | | // æéåé
|
| | | getPower() { |
| | | let power = JSON.parse(sessionStorage.getItem('power')) |
| | | let up = false |
| | | let del = false |
| | | let add = false |
| | | for (var i = 0; i < power.length; i++) { |
| | | if (power[i].menuMethod == 'delCustomById') { |
| | | del = true |
| | | } |
| | | if (power[i].menuMethod == 'addCustom') { |
| | | add = true |
| | | } |
| | | } |
| | | if (!del) { |
| | | this.componentData.do.splice(2, 1) |
| | | } |
| | | this.addPower = add |
| | | }, |
| | | entrust(data) { |
| | | |
| | | }, |
| | | protocol(data) { |
| | | |
| | | }, |
| | | selectUser() { |
| | | let selects = this.$refs.ValueTable2.multipleSelection |
| | | if (selects.length == 0) { |
| | | this.$message.error('æªéæ©æ°æ®') |
| | | return |
| | | } |
| | | delete selects['orderBy'] |
| | | delete selects['updateUser'] |
| | | delete selects['updateTime'] |
| | | this.user = selects |
| | | this.selectUserDia = false |
| | | } |
| | | } |
| | | } |
| | | </script> |