From 9dd958f0ee99cdd36356cc4f253ec3216bdce1c6 Mon Sep 17 00:00:00 2001 From: luobisheng <727299681@qq.com> Date: 星期五, 25 十一月 2022 17:50:53 +0800 Subject: [PATCH] 上传处置结果 --- src/views/systemSetting/device/bayonet/index.vue | 295 +++++++++++++++++++++-------------------------------------- 1 files changed, 105 insertions(+), 190 deletions(-) diff --git a/src/views/systemSetting/device/bayonet/index.vue b/src/views/systemSetting/device/bayonet/index.vue index 23b3a98..6781e1b 100644 --- a/src/views/systemSetting/device/bayonet/index.vue +++ b/src/views/systemSetting/device/bayonet/index.vue @@ -4,102 +4,52 @@ <div class="header-content"> <div class="search"> <span style="padding-right:20px">绛涢�夋潯浠�:</span> - <el-select v-model="context" placeholder="璇烽�夋嫨"> + <el-select v-model="context" placeholder="璇烽�夋嫨" @change="getBayonetListData"> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> - <!-- <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="context"></el-input> --> </div> </div> </header> <main> <div class="main-content"> <div class="main-title"> - <el-button class="el-icon-plus" type="primary" @click="dialogCreate = true">娣诲姞</el-button> - <el-button class="">瀵煎嚭鍗″彛</el-button> + <el-button class="el-icon-plus" type="primary" @click="showDialog(false, null)">娣诲姞</el-button> + <el-button @click="handleExport">瀵煎嚭鍗″彛</el-button> </div> <!-- 鏁版嵁灞曠ず --> - <el-table ref="multipleTable" - :header-cell-style="{background:'#06122c','font-size':'12px',color:'#4b9bb7','font-weight':'650','line-height':'45px'}" - :data="tableData" style="width: 100%" :row-class-name="tableRowClassName" - @selection-change="tableChange"> - <el-table-column type="selection" min-width="5"> - </el-table-column> - <el-table-column prop="name" label="鍗″彛鍚嶇О" min-width="10"> - </el-table-column> - <el-table-column prop="sort" label="缁忕含搴︿綅缃�" min-width="10"> - </el-table-column> - <el-table-column prop="adminCount" label="鎵�灞炲尯鍩�" min-width="10"> - </el-table-column> - <el-table-column prop="description" label="鍩熷悕/IP" min-width="10"> - </el-table-column> - <el-table-column prop="description" label="绔彛鍙�" min-width="10"> - </el-table-column> - <el-table-column prop="description" label="鍓嶇绫诲瀷" min-width="10"> - </el-table-column> - <el-table-column prop="description" label="鍑哄叆鍩庣被鍨�" min-width="10"> - </el-table-column> - <el-table-column prop="operation" label="鎿嶄綔" min-width="15"> - <template slot-scope="scope"> - <div class="operation"> - <span>缂栬緫</span> - </div> - </template> - </el-table-column> - </el-table> - <!-- tools --> - <!-- <div class="tools"> - <div class="funs"> - <div class="funsItem"> - <el-checkbox v-model="all" @change="selectAll()">鍏ㄩ��</el-checkbox> - </div> - <div class="funsItem"> - <el-checkbox v-model="unsame" @change="disSame(tableData)">鍙嶉��</el-checkbox> - </div> - <div class="funsItem"> - <el-select v-model="myIdx" placeholder="鎵归噺鎿嶄綔" @change="selectChange"> - <el-option v-for="item in options" :key="item.value" :label="item.label" - :value="item.value" :disabled="item.disabled"> - </el-option> - </el-select> - </div> - </div> - <div class="pagination"> - <el-pagination background :current-page="currentPage" layout="prev, pager, next" - :total="totalNum" :page-size="pageSize" @current-change="changeCurrentPage" - @prev-click="handlePrev" @next-click="handleNext"> - </el-pagination> - </div> - </div> --> + <MyTable + :tableOption="tableOption" + :tableData="list" + :pageShow="false"> + <template #operation="info"> + <el-link :underline="false" style="color:#4b9bb7" @click="showDialog(true, info)">缂栬緫</el-link> + </template> + </MyTable> </div> </main> <footer> <!-- 娣诲姞鍗″彛 --> - <el-dialog title="娣诲姞鍗″彛" :visible.sync="dialogCreate" width="60%" :before-close="handleClose"> - <MyCreate></MyCreate> + <el-dialog :destroy-on-close="true" :title="getDialogTitle" :visible.sync="isShowDialog" width="60%" :before-close="handleClose"> + <MyCreate v-if="isShowDialog" @closeDialog="closeDialog" :originalBayonet="originalBayonet" :isEdit="isEdit"></MyCreate> </el-dialog> </footer> </div> </template> <script> -import helper from "@/utils/mydate.js" import MyCreate from './create' +import MyTable from '@/components/Table' +import bayonet from "@/api/system/bayonet"; +import { downloadFile } from "@/utils/helper"; + export default { components: { - MyCreate + MyCreate, MyTable, }, data() { return { - tableData: [], - context: 0, - dialogCreate: false, - totalNum: null, - pageSize: 10, - currentPage: 1, - all: false, - unsame: false, - myIdx: 0, - preMyIdx: 0, + isShowDialog: false, + context: null, options: [ { value: 0, @@ -110,132 +60,99 @@ label: '鍦ㄧ嚎', } ], - tempList: [] + list: [], + current: 1, + size: 10, + tableOption: { + group: [ + { + label: '鍗″彛鍚嶇О', + type: 'text', + prop: 'bayonetName', + }, + { + label: '缁忕含搴︿綅缃�', + type: 'text', + prop: 'latitude', + }, + { + label: '鍩熷悕/IP', + type: 'text', + prop: 'ipAddress', + }, + { + label: '绔彛鍙�', + type: 'text', + prop: 'port', + }, + { + label: '鍓嶇绫诲瀷', + type: 'text', + prop: 'frontEndType', + }, + { + label: '鍑哄叆鍩庣被鍨�', + type: 'text', + prop: 'inOutCityType', + }, + { + label: '鎿嶄綔', + type: 'operation', + prop: 'operation', + }, + ] + }, + originalBayonet: null, + isEdit: false } + }, + + computed: { + getDialogTitle() { + return this.isEdit ? '缂栬緫鍗″彛' : '鏂板缓鍗″彛'; + }, }, created() { + this.getBayonetListData(); }, methods: { - async selectChange(list) { - console.log(this.tempList); - if (this.tempList.length !== 0) { - this.preMyIdx = list; - if (list === 3) { - await this.handleDelete(this.tempList); - } else if (list === 2) { - await this.mulUpdateStatus(this.tempList, 0); - } else { - await this.mulUpdateStatus(this.tempList, 1); - } - this.myIdx = 0; - } else { - this.myIdx = this.preMyIdx; - this.$message({ - type: 'warning', - message: '鎮ㄨ繕娌¢�変腑浠讳綍鏁版嵁', - }) - } - }, - mulUpdateStatus(idArr, flag) { - this.$confirm(flag === 1 ? "鎮ㄧ‘瀹氳杩涜鎵归噺鍚敤瑙掕壊鍚�?" : '鎮ㄧ‘瀹氳杩涜鎵归噺绂佺敤瑙掕壊鍚�?') - .then(_ => { - this.$axios({ - method: 'post', - url: 'sccg/role/updateStatusBatch?ids=' + idArr + '&status=' + flag, - }) - .then(res => { - if (res.code === 200) { - this.$message({ - type: 'success', - message: '鏇存敼鐢ㄦ埛鐘舵�佹垚鍔�', - }) - this.getUserList(); - } else { - this.$message({ - type: 'error', - message: res.message - }) - } - console.log(res); - }) - }) - .catch(err => { console.log(err) }) - }, - tableChange(list) { - this.tempList = []; - list.forEach(item => { - this.tempList.push(item.id); + getBayonetListData() { + bayonet.getBayonetList({ bayonetName: this.context, current: this.current, size: this.size }) + .then(({ records }) => { + this.list = records; }) - if (list.length === this.tableData.length) { - this.all = true; - } else { - this.all = false - } - }, - changeTime({ createTime }) { - return helper(createTime); - }, - selectAll() { - this.$refs.multipleTable.toggleAllSelection(); - }, - disSame(list) { - list.forEach(row => { - this.$refs.multipleTable.toggleRowSelection(row) + .catch(err => { + this.$message({ type: 'error', message: err }); }) - }, - handleDelete(id) { - const that = this; - // let arr = []; - // arr.push(id); - this.$confirm('纭鍒犻櫎锛�') - .then(_ => { - that.$axios({ - method: 'post', - url: 'sccg/role/delete?ids=' + id, - }) - .then(res => { - this.myIdx = 0; - this.preMyIdx = 0; - console.log(res); - this.$message({ - type: 'success', - message: res.message - }) + }, + // 寮圭獥鍏抽棴 + handleClose(done) { + this.$confirm('纭鍏抽棴?') + .then(_ => { + done(); + }) + }, - this.getUserList(); - }) - }) - .catch(_ => { }); - }, - // 璁剧疆琛ㄦ牸鏂戦┈绾� - tableRowClassName({ row, rowIndex }) { - if ((rowIndex + 1) % 2 == 0) { - return 'warning-row'; - } else { - return 'success-row'; - } - return ''; - }, - // 褰撳墠椤垫敼鍙樿Е鍙戜簨浠� - changeCurrentPage(page) { - this.currentPage = page; - }, - // 涓婁竴椤电偣鍑讳簨浠� - handlePrev(page) { - this.currentPage = page; - }, - // 涓嬩竴椤电偣鍑讳簨浠� - handleNext(page) { - this.currentPage = page; - }, - // 鍏抽棴寮圭獥 - handleClose(done) { - this.$confirm('纭鍏抽棴锛�') - .then(_ => { - done(); - }) - .catch(_ => { }); - } + closeDialog() { + this.isShowDialog = false; + this.getBayonetListData(); + }, + + handleExport() { + bayonet.exportBayonetList({ bayonetName: this.context, current: this.current, size: this.size }) + .then(res => { + downloadFile(res); + this.$message({ type: 'success', message: '鎿嶄綔鎴愬姛' }); + }) + .catch(err => { + this.$message({ type: 'error', message: err }); + }) + }, + showDialog(isEdit, data) { + this.isShowDialog = true; + this.isEdit = isEdit; + this.originalBayonet = data.info.row; + } } } </script> @@ -247,7 +164,6 @@ header { background-color: #09152f; - border: 1pox solid #fff; .header-content { padding: 0 40px; @@ -282,7 +198,6 @@ background-color: #09152f; margin-top: 20px; padding-bottom: 50px; - border: 1pox solid #fff; .main-title { line-height: 60px; -- Gitblit v1.8.0