| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- <!--
- * @Title:
- * @Description:
- * @Author: swp
- * @Date: 2022-08-24 10:49:21
- * @LastEditors:
- * @LastEditTime: 2022-08-24 10:49:21
- -->
- <template>
- <div>
- <el-row>
- <el-col :span="24">
- <basic-container>
- <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page"
- :before-open="beforeOpen" ref="crud" v-model="form" :permission="permissionList"
- @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
- @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
- @on-load="onLoad">
- <template slot-scope="{ row, index }" slot="menu">
- <el-button type="text" size="small" @click="openDetail(row)">导入详情
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <el-dialog title="导入详情" :visible.sync="detailDialog" width="60%" height="60%" :close-on-click-modal="false"
- append-to-body v-if="detailDialog">
- <rtuimportdetail :id="id" ref="rtuimportdetail">
- </rtuimportdetail>
- </el-dialog>
- </div>
- </template>
- <script>
- import { getPage } from "@/api/data/rtuImport.js";
- import rtuimportdetail from "./rtuimportdetail.vue";
- export default {
- components: {
- rtuimportdetail
- },
- data() {
- return {
- detailDialog: false,
- loading: false,
- id: "",
- editForm: {},
- editDialog: false,
- form: {},
- selectionList: [],
- query: {},
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- option: {
- labelWidth: 120,
- viewLabelWidth: 100,
- searchlabelWidth: 100,
- height: "auto",
- calcHeight: 80,
- align: "center",
- headerAlign: "center",
- lazy: false,
- tip: false,
- simplePage: true,
- searchShow: true,
- searchMenuSpan: 6,
- tree: true,
- border: true,
- index: true,
- selection: false,
- viewBtn: false,
- viewTitle: "测站导入",
- editBtn: false,
- delBtn: false,
- addBtn: false,
- menu: true,
- menuWidth: 120,
- dialogType: "drawer",
- dialogClickModal: false,
- columnBtn: false,
- column: [
- {
- label: "导入结果",
- prop: "importStatus",
- span: 24,
- width: 120,
- html: true,
- formatter: (val) => {
- if (val.importStatus === 0) {
- return '<b style="color:blue">导入中</b>'
- } else if (val.importStatus === 1) {
- return '<b style="color:green">导入成功</b>'
- } else if (val.importStatus === 2) {
- return '<b style="color:red">导入失败</b>'
- } else {
- return '';
- }
- },
- },
- {
- label: "操作用户",
- prop: "createUserName",
- span: 24,
- width: 120,
- editDisplay: false,
- addDisplay: false,
- hide: true,
- },
- {
- label: "导入时间",
- prop: "importTime",
- span: 24,
- width: 160,
- },
- {
- label: "导入说明",
- prop: "remark",
- span: 24,
- overHidden: true,
- },
- {
- label: "导入操作类型",
- prop: "saveType",
- span: 24,
- width: 120,
- html: true,
- formatter: (val) => {
- if (val.saveType === 0) {
- return '<b style="color:blue">只新增</b>'
- } else if (val.saveType === 1) {
- return '<b style="color:red">只更新</b>'
- } else if (val.saveType === 2) {
- return '<b style="color:red">新增或更新</b>'
- } else {
- return '';
- }
- },
- },
- {
- label: "文件名称",
- prop: "fileName",
- span: 24,
- overHidden: true,
- },
- ],
- },
- data: [],
- };
- },
- computed: {
- // ...mapGetters(["userInfo", "permission"]),
- permissionList() {
- return {
- // addBtn: this.vaildData(this.permission.docCategory_add, false),
- // viewBtn: this.vaildData(this.permission.docCategory_view, false),
- // delBtn: this.vaildData(this.permission.docCategory_delete, false),
- // editBtn: this.vaildData(this.permission.docCategory_edit, false),
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach((ele) => {
- ids.push(ele.id);
- });
- return ids.join(",");
- },
- },
- mounted() { },
- created() {
- },
- methods: {
- openDetail(row) {
- this.id = row.id;
- this.detailDialog = true;
- this.$nextTick(() => {
- this.$refs["rtuimportdetail"].init();
- });
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getPage(
- page.currentPage,
- page.pageSize,
- Object.assign(params, this.query)
- ).then((res) => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
- });
- },
- },
- };
- </script>
|