123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892 |
- <template>
- <div class="app-container">
- <div class="operation">
- <el-button v-if="isRoleEdit" class="success" @click="handleCreate">新增</el-button>
- </div>
- <div class="search">
- <el-input v-model="tab1.table.getdataListParm.parammaps.groupsname" placeholder="集团名称" style="width: 180px;" class="filter-item" clearable />
- <el-select v-model="tab1.table.getdataListParm.parammaps.enable" placeholder="状态" class="filter-item" style="width: 120px;" clearable>
- <el-option v-for="item in stateList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- <el-button class="successBorder" @click="handleSearch">查询</el-button>
- <el-button class="successBorder" @click="handleRefresh">重置</el-button>
- </div>
- <div class="table">
- <el-table
- :key="tab1.table.tableKey"
- v-loading="tab1.table.listLoading"
- element-loading-text="给我一点时间"
- :data="tab1.table.list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="序号" align="center" type="index" width="50px">
- <template slot-scope="scope">
- <span>{{ scope.$index + (tab1.table.pageNum-1) * tab1.table.pageSize + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="集团ID" min-width="130px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.NoEdit">{{ scope.row.groupscode }}</span>
- <el-input v-if="scope.row.Edit" v-model="scope.row.groupscode" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" placeholder="1-32字符" style="width:95%;padding:10px 0;" />
- </template>
- </el-table-column>
- <el-table-column label="集团名称" min-width="130px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.NoEdit">{{ scope.row.groupsname }}</span>
- <el-input v-if="scope.row.Edit" v-model="scope.row.groupsname" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" placeholder="1-32字符" style="width:95%;padding:10px 0;" />
- </template>
- </el-table-column>
- <el-table-column label="联系人" min-width="130px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.NoEdit">{{ scope.row.emp }}</span>
- <el-input v-if="scope.row.Edit" v-model="scope.row.emp" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" placeholder="1-32字符" style="width:95%;padding:10px 0;" />
- </template>
- </el-table-column>
- <el-table-column label="联系方式" min-width="130px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.NoEdit">{{ scope.row.phone }}</span>
- <el-input v-if="scope.row.Edit" v-model.trim="scope.row.phone" placeholder="请输入11位手机号" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="11" style="width:95%;padding:10px 0;" />
- </template>
- </el-table-column>
- <el-table-column label="管理员用户名" min-width="130px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.NoEdit">{{ scope.row.user }}</span>
- <el-input v-if="scope.row.Edit" v-model="scope.row.user" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" placeholder="1-32字符" style="width:95%;padding:10px 0;" />
- </template>
- </el-table-column>
- <el-table-column label="状态" min-width="110px" align="center">
- <template slot-scope="scope">
- <el-switch v-model="scope.row.enable" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
- </template>
- </el-table-column>
- <el-table-column label="备注" min-width="130px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.NoEdit">{{ scope.row.note }}</span>
- <el-input v-if="scope.row.Edit" v-model="scope.row.note" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="255" placeholder="1-255字符" style="width:95%;padding:10px 0;" />
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <!-- 页面权限 -->
- <el-button v-if="row.NoEdit && isRoleEdit" class="miniSuccess" @click="handlePageConfiguration(row)">页面配置</el-button>
- <!-- 新增 -->
- <el-button v-if="row.isCreate && isRoleEdit" class="miniSuccess" :disabled="isokDisable" @click="createData(row)">保存</el-button>
- <el-button v-if="row.isCreate && isRoleEdit" class="minCancel" @click="createCancel(row)">取消</el-button>
- <!-- 编辑 -->
- <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>
- <!-- 关联 -->
- <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleRelation(row)">关联</el-button>
- <!-- 编辑保存 -->
- <el-button v-if="row.isUpdateSave && isRoleEdit" class="miniSuccess" :disabled="isokDisable" @click="updateData(row)">保存</el-button>
- <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" @click="updateCancel(row)">取消</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="tab1.table.total>=0" :total="tab1.table.total" :page.sync="tab1.table.getdataListParm.offset" :limit.sync="tab1.table.getdataListParm.pagecount" @pagination="getList" />
- </div>
- <!-- 页面配置 -->
- <el-dialog :title="textMap[tab1.pageConfiguration.dialogStatus]" :visible.sync="tab1.pageConfiguration.dialogFormVisible" :close-on-click-modal="false" width="25%">
- <div style="height: 400px;overflow-y: auto;">
- <el-tree
- ref="tree"
- v-loading="tab1.pageConfiguration.listLoading"
- show-checkbox
- node-key="id"
- :default-expand-all="true"
- :data="tab1.pageConfiguration.data"
- :props="tab1.pageConfiguration.defaultProps"
- :default-checked-keys="tab1.pageConfiguration.defaultCheckedKeys"
- @check-change="handelCheckChange"
- />
- </div>
- <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:5px">
- <el-button @click="tab1.pageConfiguration.dialogFormVisible = false;getList(); ">取消</el-button>
- <el-button type="success" :disabled="isokDisable" @click="pageConfigurationData()">确认</el-button>
- </div>
- </el-dialog>
- <!-- 关联 -->
- <el-dialog :title="textMap[tab1.relation.dialogStatus]" :visible.sync="tab1.relation.dialogFormVisible" :close-on-click-modal="false" width="70%">
- <div>
- <el-form ref="relationTemp" :rules="rules" label-position="right" :model="tab1.relation.temp" label-width="130px" style="width: 100%;">
- <el-row>
- <el-col :span="8">
- <el-form-item label="集团名称:" prop="groupsname">
- <el-input ref="groupsname" v-model="tab1.relation.temp.groupsname" disabled class="filter-item" placeholder="集团名称" type="text" style="width:100%;" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8">
- <el-form-item label="关联:" prop="radio">
- <el-radio-group v-model="tab1.relation.radio">
- <el-radio-button label="集团" />
- <el-radio-button label="牧场" />
- </el-radio-group>
- </el-form-item>
- </el-col>
- </el-row>
- <div v-if="tab1.relation.radio =='集团'" class="group">
- <el-row>
- <el-col :span="16">
- <el-form-item label="选择关联集团:">
- <el-autocomplete v-model="tab1.relation.group.groupsname" class="inline-input" :fetch-suggestions="groupSearch" placeholder="选择关联集团" style="width: 100%;" @select="handleGroupSelect">
- <template slot-scope="{ item }">
- <span class="addr"> 集团:{{ item.groupsname }}</span>
- </template>
- </el-autocomplete>
- </el-form-item>
- </el-col>
- </el-row>
- <div class="table">
- <el-table
- :key="tab1.relation.group.table.tableKey"
- v-loading="tab1.relation.group.table.listLoading"
- element-loading-text="给我一点时间"
- :data="tab1.relation.group.table.list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="序号" align="center" type="index" width="50px" />
- <el-table-column label="集团ID" min-width="130px" align="center" prop="groupscode" />
- <el-table-column label="集团名称" min-width="130px" align="center" prop="groupsname" />
- <el-table-column label="管理员用户名" min-width="130px" align="center" prop="user" />
- <el-table-column label="状态" min-width="110px" align="center">
- <template slot-scope="scope">
- <el-switch v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
- </template>
- </el-table-column>
- <el-table-column label="备注" min-width="130px" align="center" prop="note" />
- <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <el-button class="miniDanger" @click="handleGroupDelete(row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <div v-if="tab1.relation.radio =='牧场'" class="pasture">
- <el-row>
- <el-col :span="16">
- <el-form-item label="选择关联牧场:">
- <el-autocomplete v-model="tab1.relation.pasture.pastureName" class="inline-input" :fetch-suggestions="pastureSearch" placeholder="选择关联牧场" style="width: 100%;" @select="handlePastureSelect">
- <template slot-scope="{ item }">
- <span class="addr"> 牧场:{{ item.pasturename }}</span>
- </template>
- </el-autocomplete>
- </el-form-item>
- </el-col>
- </el-row>
- <div class="table">
- <el-table
- :key="tab1.relation.pasture.table.tableKey"
- v-loading="tab1.relation.pasture.table.listLoading"
- element-loading-text="给我一点时间"
- :data="tab1.relation.pasture.table.list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="序号" align="center" type="index" width="50px" />
- <el-table-column label="牧场ID" min-width="130px" align="center" prop="pasturecode" />
- <el-table-column label="牧场名称" min-width="130px" align="center" prop="pasturename" />
- <el-table-column label="管理员用户名" min-width="130px" align="center" prop="user" />
- <el-table-column label="权限归属" min-width="130px" align="center" prop="groupsname" />
- <el-table-column label="状态" min-width="110px" align="center">
- <template slot-scope="scope">
- <el-switch v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
- </template>
- </el-table-column>
- <el-table-column label="备注" min-width="130px" align="center" prop="note" />
- <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <el-button class="miniDanger" @click="handlePastureDelete(row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- </el-form>
- </div>
- <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:5px">
- <el-button @click="tab1.relation.dialogFormVisible = false;getList(); ">取消</el-button>
- <el-button v-if="tab1.relation.dialogStatus==='relation'" type="success" :disabled="isokDisable" @click="relationData()">确认</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { GetDataByName, failproccess, transData, ExecDataByConfig, checkButtons } from '@/api/common'
- import Cookies from 'js-cookie'
- import { parseTime } from '@/utils/index.js'
- import { validate11Digits } from '@/utils/validate.js'
- import { MessageBox } from 'element-ui'
- import Pagination from '@/components/Pagination'
- export default {
- name: 'OperationManagement',
- components: { Pagination },
- data() {
- return {
- requestParams: [
- { name: 'getGroupsAllList', offset: 0, pagecount: 0, parammaps: {}}
- ],
- isRoleEdit: [],
- stateList: [{ id: 1, name: '启用' }, { id: 0, name: '禁止' }], // 状态
- tab1: {
- table: {
- getdataListParm: {
- name: 'getGroupsAllList',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- groupsname: '',
- enable: ''
- }
- },
- tableKey: 0,
- list: [],
- total: 0,
- listLoading: true,
- temp: {}
- },
- // 页面配置
- pageConfiguration: {
- dialogFormVisible: false,
- dialogStatus: '',
- temp: {},
- listLoading: true,
- getdataListParm: {
- name: 'getMenuandButtonlistJT'
- },
- parentType: [],
- defaultProps: {
- children: 'children',
- label: 'name'
- },
- defaultCheckedKeys: [],
- arrList: []
- },
- // 关联
- relation: {
- dialogFormVisible: false,
- dialogStatus: '',
- radio: '集团',
- temp: {},
- group: {
- requestParam: {
- name: 'getGroupsAllListV2',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- groupsname: ''
- }
- },
- searchList: [],
- table: {
- tableKey: 1,
- list: [],
- total: 0,
- listLoading: false,
- getdataListParm: {
- name: 'groupsrelationlistJT',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- groupsname: ''
- }
- }
- }
- },
- pasture: {
- requestParam: {
- name: 'groupsrelationlistMCAll',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- pastureName: ''
- }
- },
- searchList: [],
- table: {
- tableKey: 2,
- list: [],
- total: 0,
- listLoading: false,
- getdataListParm: {
- name: 'groupsrelationlistMC',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- pastureName: ''
- }
- }
- }
- }
- }
- },
- requestParam: {},
- rules: {},
- isokDisable: false,
- textMap: {
- pageConfiguration: '页面配置',
- relation: '关联'
- },
- rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
- cellStyle: { padding: 0 + 'px' }
- }
- },
- created() {
- this.getList()
- this.getButtons()
- },
- methods: {
- getButtons() {
- const Edit = 'Role'
- const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
- this.isRoleEdit = isRoleEdit
- },
- getList() {
- this.tab1.table.listLoading = true
- GetDataByName(this.tab1.table.getdataListParm).then(response => {
- console.log('table数据', response.data.list)
- if (response.data.list !== null) {
- for (let i = 0; i < response.data.list.length; i++) {
- this.$set(response.data.list[i], 'Edit', false) // 编辑
- this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
- this.$set(response.data.list[i], 'isCreate', false) // 新增操作
- this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
- this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
- }
- this.tab1.table.list = response.data.list
- this.tab1.table.pageNum = response.data.pageNum
- this.tab1.table.pageSize = response.data.pageSize
- this.tab1.table.total = response.data.total
- } else {
- this.tab1.table.list = []
- }
- setTimeout(() => {
- this.tab1.table.listLoading = false
- }, 100)
- })
- },
- handleSearch() {
- console.log('点击了查询')
- this.tab1.table.getdataListParm.offset = 1
- this.getList()
- },
- handleRefresh() {
- console.log('点击了重置')
- this.tab1.table.getdataListParm.parammaps.groupsname = ''
- this.tab1.table.getdataListParm.parammaps.enable = ''
- this.tab1.table.getdataListParm.offset = 1
- this.getList()
- },
- handleCreate() {
- console.log('点击了新增')
- // 编辑true/不可编辑false
- // 新增操true,编辑false,编辑保存false
- for (let i = 0; i < this.tab1.table.list.length; i++) {
- if (this.tab1.table.list[i].Edit == true) {
- this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
- return false
- }
- }
- this.tab1.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'groupscode': '', 'groupsname': '', 'emp': '', 'phone': '', 'user': '', 'note': '' })
- },
- createData(row) {
- // 检验集团ID/集团名称是否为空
- console.log(row)
- if (row.groupscode == '' && row.groupsname == '' && row.user == '') {
- this.$message({ type: 'error', message: '集团ID/集团名称/管理员用户名不能为空', duration: 2000 })
- return false
- } else if (row.groupsname == '' && row.user == '') {
- this.$message({ type: 'error', message: '集团名称/管理员用户名不能为空', duration: 2000 })
- return false
- } else if (row.groupscode == '') {
- this.$message({ type: 'error', message: '集团ID不能为空', duration: 2000 })
- return false
- } else if (row.groupsname == '') {
- this.$message({ type: 'error', message: '集团名称不能为空', duration: 2000 })
- return false
- } else if (row.user == '') {
- this.$message({ type: 'error', message: '管理员用户名不能为空', duration: 2000 })
- return false
- }
- if (row.phone !== undefined && row.phone !== '') {
- const phone = /^\d{11}$/
- if (!phone.test(row.phone)) {
- this.$message({ type: 'error', message: '请输入11位手机号', duration: 2000 })
- return false
- }
- }
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.requestParam = {}
- this.requestParam.common = { 'returnmap': '0' }
- this.requestParam.data = []
- this.requestParam.data[0] = { 'name': 'checkuser', 'type': 'v', 'parammaps': {
- 'user': row.user
- }}
- this.requestParam.data[1] = { 'name': 'insertGroups', 'type': 'e', 'parammaps': {
- 'groupsname': row.groupsname,
- 'groupscode': row.groupscode,
- 'emp': row.emp,
- 'phone': row.phone,
- 'enable': row.enable,
- 'note': row.note,
- 'user': row.user
- }}
- this.requestParam.data[2] = { 'name': 'createNewPasture', 'type': 'e', 'parammaps': {
- 'user': row.user,
- 'pastureid': '@insertGroups.LastInsertId',
- 'type': '1'
- }}
- ExecDataByConfig(this.requestParam).then(response => {
- console.log('新增保存发送参数', this.requestParam)
- if (response.msg !== 'fail') {
- this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- this.getList()
- } else {
- const tId = new RegExp("column 'id'")
- if (tId.test(response.data)) {
- this.$notify({ title: '保存失败', message: '集团已存在,不可重复生成', type: 'warning', duration: 2000 })
- } else {
- this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
- }
- }
- })
- },
- createCancel(row) {
- console.log('点击了集团新增取消')
- for (let i = 0; i < this.tab1.table.list.length; i++) {
- if (row.myId === this.tab1.table.list[i].myId) {
- var listIndex = this.tab1.table.list.indexOf(this.tab1.table.list[i])
- }
- if (listIndex > -1) {
- this.tab1.table.list.splice(listIndex, 1)
- return
- }
- }
- },
- handleUpdate(row) {
- console.log('点击了编辑')
- for (let i = 0; i < this.tab1.table.list.length; i++) {
- if (this.tab1.table.list[i].Edit == true) {
- this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
- return false
- }
- }
- // 编辑true,不可编辑false
- row.Edit = true
- row.NoEdit = false
- // 新增false,编辑false,编辑保存true
- row.isCreate = false
- row.isUpdate = false
- row.isUpdateSave = true
- },
- updateData(row) {
- if (row.pasturecode == '' && row.pasturename == '' && row.user == '') {
- this.$message({ type: 'error', message: '牧场ID/牧场名称/管理员用户名不能为空', duration: 2000 })
- return false
- } else if (row.pasturename == '' && row.user == '') {
- this.$message({ type: 'error', message: '牧场名称/管理员用户名不能为空', duration: 2000 })
- return false
- } else if (row.pasturecode == '') {
- this.$message({ type: 'error', message: '牧场ID不能为空', duration: 2000 })
- return false
- } else if (row.pasturename == '') {
- this.$message({ type: 'error', message: '牧场名称不能为空', duration: 2000 })
- return false
- } else if (row.user == '') {
- this.$message({ type: 'error', message: '管理员用户名不能为空', duration: 2000 })
- return false
- }
- if (row.phone !== undefined && row.phone !== '') {
- const phone = /^\d{11}$/
- if (!phone.test(row.phone)) {
- this.$message({ type: 'error', message: '请输入11位手机号', duration: 2000 })
- return false
- }
- }
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.requestParam = {}
- this.requestParam.common = { 'returnmap': '0' }
- this.requestParam.data = []
- this.requestParam.data[0] = { 'name': 'updateGroups', 'type': 'e', 'parammaps': {
- 'id': row.id,
- 'groupsname': row.groupsname,
- 'groupscode': row.groupscode,
- 'emp': row.emp,
- 'phone': row.phone,
- 'enable': row.enable,
- 'note': row.note,
- 'user': row.user
- }}
- this.requestParam.data[1] = { 'name': 'updateUserName', 'type': 'e', 'parammaps': {
- 'id': row.id,
- 'userold': row.userold,
- 'user': row.user
- }}
- ExecDataByConfig(this.requestParam).then(response => {
- console.log('编辑保存发送参数', this.requestParam)
- if (response.msg !== 'fail') {
- this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- this.getList()
- } else {
- const tId = new RegExp("column 'id'")
- if (tId.test(response.data)) {
- this.$notify({ title: '保存失败', message: '集团已存在,不可重复生成', type: 'warning', duration: 2000 })
- } else {
- this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
- }
- }
- })
- },
- updateCancel(row) {
- console.log('点击了编辑取消')
- // 编辑false,不可编辑true
- row.Edit = false
- row.NoEdit = true
- // 新增false,编辑true,编辑保存false
- row.isCreate = false
- row.isUpdate = true
- row.isUpdateSave = false
- this.getList()
- },
- handlePageConfiguration(row) {
- this.tab1.pageConfiguration.temp = Object.assign({}, row)
- console.log('点击了行内页面配置')
- this.tab1.pageConfiguration.dialogStatus = 'pageConfiguration'
- this.tab1.pageConfiguration.dialogFormVisible = true
- this.getPageConfigurationList()
- },
- getPageConfigurationList() {
- this.tab1.pageConfiguration.getdataListParm.parammaps = {}
- this.tab1.pageConfiguration.getdataListParm.parammaps.pastureid = this.tab1.pageConfiguration.temp.pastureid
- this.tab1.pageConfiguration.getdataListParm.parammaps.id = this.tab1.pageConfiguration.temp.id
- this.tab1.pageConfiguration.listLoading = true
- GetDataByName(this.tab1.pageConfiguration.getdataListParm).then(response => {
- if (response.data.list !== null) {
- for (let i = 0; i < response.data.list.length; i++) {
- if (parseFloat(response.data.list[i].seebutton) > 0 && response.data.list[i].pid !== -1) {
- this.tab1.pageConfiguration.defaultCheckedKeys.push(String(response.data.list[i].menu_id))
- }
- if (parseFloat(response.data.list[i].seebutton) > 0) {
- this.tab1.pageConfiguration.arrList.push(String(response.data.list[i].menu_id))
- }
- }
- this.tab1.pageConfiguration.data = transData(response.data.list, 'id', 'pid', 'children')
- console.log(this.tab1.pageConfiguration.data)
- console.log(response.data.list)
- } else {
- this.tab1.pageConfiguration.data = []
- }
- setTimeout(() => {
- this.tab1.pageConfiguration.listLoading = false
- }, 1000)
- })
- },
- handelCheckChange(id) {
- this.tab1.pageConfiguration.defaultCheckedKeys = this.$refs.tree.getCheckedKeys()
- var checkedKeys = this.$refs.tree.getCheckedKeys()
- var options = checkedKeys.map((item) => {
- var node = this.$refs.tree.getNode(item) // 所有被选中的节点对应的node
- const tmpMap = {}
- console.log(node, 'node')
- tmpMap.pid = node.parent.key
- tmpMap.value = node.key
- return tmpMap
- })
- var selectedData = options.map((item) => {
- console.log(item)
- return item
- })
- console.log(selectedData)
- var arr = []
- for (let i = 0; i < selectedData.length; i++) {
- if (selectedData[i].pid !== undefined) {
- arr.push(selectedData[i].pid, selectedData[i].value)
- } else {
- arr.push(selectedData[i].value)
- }
- }
- this.tab1.pageConfiguration.arrList = this.unique(arr)
- },
- unique(arr) {
- return Array.from(new Set(arr))
- },
- pageConfigurationData() {
- console.log('集团页面配置保存')
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.requestParam = {}
- this.requestParam.common = { 'returnmap': '0' }
- this.requestParam.data = []
- this.requestParam.data[0] = { 'name': 'deletemenuPastureJT', 'type': 'e', 'parammaps': {
- 'id': this.tab1.pageConfiguration.temp.id
- }}
- var list = []
- for (let i = 0; i < this.tab1.pageConfiguration.arrList.length; i++) {
- list.push({ 'id': this.tab1.pageConfiguration.arrList[i] })
- }
- this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': list }}
- this.requestParam.data[1].children = []
- this.requestParam.data[1].children[0] = { 'name': 'insertRolepastureJT', 'type': 'e', 'parammaps': {
- menuid: '@insertSpotList.id',
- id: this.tab1.pageConfiguration.temp.id
- }}
- ExecDataByConfig(this.requestParam).then(response => {
- console.log('页面配置保存发送参数', this.requestParam)
- if (response.msg !== 'fail') {
- this.tab1.pageConfiguration.dialogFormVisible = false
- this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- this.getList()
- } else {
- failproccess(response, this.$notify)
- }
- })
- },
- handleRelation(row) {
- this.tab1.relation.temp = Object.assign({}, row)
- console.log('关联', this.tab1.relation.temp)
- this.tab1.relation.dialogStatus = 'relation'
- this.tab1.relation.dialogFormVisible = true
- this.tab1.relation.radio = '集团'
- this.getGrouplist()
- this.getPasturelist()
- },
- getGrouplist() {
- this.tab1.relation.group.table.listLoading = true
- this.tab1.relation.group.table.getdataListParm.parammaps.id = this.tab1.relation.temp.id
- GetDataByName(this.tab1.relation.group.table.getdataListParm).then(response => {
- console.log('集团table数据', response.data.list)
- if (response.data.list !== null) {
- this.tab1.relation.group.table.list = response.data.list
- } else {
- this.tab1.relation.group.table.list = []
- }
- setTimeout(() => {
- this.tab1.relation.group.table.listLoading = false
- }, 100)
- })
- },
- getPasturelist() {
- this.tab1.relation.pasture.table.listLoading = true
- this.tab1.relation.pasture.table.getdataListParm.parammaps.id = this.tab1.relation.temp.id
- GetDataByName(this.tab1.relation.pasture.table.getdataListParm).then(response => {
- console.log('牧场table数据', response.data.list)
- if (response.data.list !== null) {
- this.tab1.relation.pasture.table.list = response.data.list
- } else {
- this.tab1.relation.pasture.table.list = []
- }
- setTimeout(() => {
- this.tab1.relation.pasture.table.listLoading = false
- }, 100)
- })
- },
- groupSearch(queryString, cb) {
- console.log(this.tab1.relation.temp, '====')
- this.tab1.relation.group.requestParam.parammaps.groupsname = queryString
- this.tab1.relation.group.requestParam.parammaps.id = this.tab1.relation.temp.id
- GetDataByName(this.tab1.relation.group.requestParam).then(response => {
- if (response.data.list !== null) {
- this.tab1.relation.group.searchList = response.data.list
- cb(this.tab1.relation.group.searchList)
- } else {
- cb([])
- }
- })
- },
- handleGroupSelect(item) {
- if (this.tab1.relation.group.table.list.length > 0) {
- if (this.tab1.relation.group.table.list.find(obj => obj.id === item.id)) {
- this.$message({ type: 'warning', message: '集团不可重复添加' })
- } else {
- this.tab1.relation.group.table.list.push(item)
- }
- } else {
- this.tab1.relation.group.table.list.push(item)
- }
- },
- handleGroupDelete(row) {
- for (var i = 0; i < this.tab1.relation.group.table.list.length; i++) {
- if (this.tab1.relation.group.table.list[i].id == row.id) {
- var listIndex = this.tab1.relation.group.table.list.indexOf(this.tab1.relation.group.table.list[i])
- }
- if (listIndex > -1) {
- this.tab1.relation.group.table.list.splice(listIndex, 1)
- return
- }
- }
- },
- pastureSearch(queryString, cb) {
- this.tab1.relation.pasture.requestParam.parammaps.pastureName = queryString
- GetDataByName(this.tab1.relation.pasture.requestParam).then(response => {
- if (response.data.list !== null) {
- this.tab1.relation.pasture.searchList = response.data.list
- cb(this.tab1.relation.pasture.searchList)
- } else {
- cb([])
- }
- })
- },
- handlePastureSelect(item) {
- if (this.tab1.relation.pasture.table.list.length > 0) {
- if (this.tab1.relation.pasture.table.list.find(obj => obj.id === item.id)) {
- this.$message({ type: 'warning', message: '集团不可重复添加' })
- } else {
- this.tab1.relation.pasture.table.list.push(item)
- }
- } else {
- this.tab1.relation.pasture.table.list.push(item)
- }
- },
- handlePastureDelete(row) {
- for (var i = 0; i < this.tab1.relation.pasture.table.list.length; i++) {
- if (this.tab1.relation.pasture.table.list[i].id == row.id) {
- var listIndex = this.tab1.relation.pasture.table.list.indexOf(this.tab1.relation.pasture.table.list[i])
- }
- if (listIndex > -1) {
- this.tab1.relation.pasture.table.list.splice(listIndex, 1)
- return
- }
- }
- },
- relationData() {
- console.log('关联保存')
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.requestParam = {}
- this.requestParam.common = { 'returnmap': '0' }
- this.requestParam.data = []
- this.requestParam.data[0] = { 'name': 'deletegroupsPasture', 'type': 'e', 'parammaps': {
- 'id': this.tab1.relation.temp.id
- }}
- this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.tab1.relation.group.table.list }}
- this.requestParam.data[1].children = []
- this.requestParam.data[1].children[0] = { 'name': 'insertgroupsPasture', 'type': 'e', 'parammaps': {
- rid: '@insertSpotList.id',
- id: this.tab1.relation.temp.id,
- type: '1'
- }}
- this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.tab1.relation.pasture.table.list }}
- this.requestParam.data[2].children = []
- this.requestParam.data[2].children[0] = { 'name': 'insertgroupsPasture', 'type': 'e', 'parammaps': {
- rid: '@insertSpotList2.id',
- id: this.tab1.relation.temp.id,
- type: '0'
- }}
- ExecDataByConfig(this.requestParam).then(response => {
- console.log('关联保存发送参数', this.requestParam)
- if (response.msg !== 'fail') {
- this.tab1.relation.dialogFormVisible = false
- this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- this.getList()
- } else {
- failproccess(response, this.$notify)
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .search{margin-top:10px;}
- .table{margin-top:10px;}
- .inside-base {
- position: relative;
- }
- .inside-base-main {
- width: 100%;
- background: #ffffff;
- box-shadow: 0px 0px 10px 0px rgba(231,232,238,1);
- border-radius: 4px;
- margin-bottom: 30px;
- }
- // 中间内容
- .inside-base-cont {
- margin: 0 20px;
- }
- .role-cont {
- position: relative;
- font-size: 16px;
- color: #333333;
- line-height: 40px;
- > span {
- width: 90px;
- height: 40px;
- text-align: right;
- float: left;
- margin-right: 10px;
- margin-bottom: 20px;
- }
- > div {
- position: relative;
- width: 100%;
- float: left;
- margin-bottom: 20px;
- >>> .el-input__inner {
- width: 320px;
- }
- }
- }
- .check-page-all {
- position: absolute;
- top: 13px;
- left: 11px;
- z-index: 99;
- }
- /* element-ui css */
- .inside-base {
- >>> .el-input__inner {
- font-size: 16px;
- color: #333333;
- }
- }
- </style>
|