| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud |
| | | ref="userCrud" |
| | | :data="tableData" |
| | | :option="option" |
| | | :table-loading="tableLoading" |
| | | @on-load="getTableList" |
| | | @refresh-change="handleRefresh" |
| | | @search-change="handleSearch" |
| | | @search-reset="handleReset" |
| | | @selection-change="selectChange" |
| | | @row-click="rowClickHandler" |
| | | > |
| | | <el-container> |
| | | <el-main> |
| | | <basic-container> |
| | | <avue-crud |
| | | ref="userCrud" |
| | | :data="tableData" |
| | | :option="option" |
| | | :table-loading="tableLoading" |
| | | @on-load="getTableList" |
| | | @refresh-change="handleRefresh" |
| | | @search-change="handleSearch" |
| | | @search-reset="handleReset" |
| | | @selection-change="selectChange" |
| | | @row-click="rowClickHandler" |
| | | > |
| | | |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <el-button icon="el-icon-plus" size="small" type="primary" @click="rowSaveHandlerClick">创建</el-button> |
| | | <el-button icon="el-icon-delete" plain size="small" type="danger" @click="allDelHandler">删除</el-button> |
| | | <el-button icon="el-icon-view" plain size="small" type="primary" @click="chekView">查看使用范围</el-button> |
| | | <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadTemplateHandler">下载导入模板 |
| | | </el-button> |
| | | <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadHandler">导出</el-button> |
| | | <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadUser">导入</el-button> |
| | | </template> |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <el-button icon="el-icon-plus" size="small" type="primary" @click="rowSaveHandlerClick">创建</el-button> |
| | | <el-button icon="el-icon-delete" plain size="small" type="danger" @click="allDelHandler">删除</el-button> |
| | | <el-button icon="el-icon-view" plain size="small" type="primary" @click="chekView">查看使用范围</el-button> |
| | | <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadTemplateHandler">下载导入模板 |
| | | </el-button> |
| | | <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadUser">导入</el-button> |
| | | <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadHandler">导出</el-button> |
| | | </template> |
| | | |
| | | <template slot="menu" slot-scope="scope"> |
| | | <el-button icon="el-icon-edit" size="small" type="text" @click="editBtnClick(scope.row)">编辑 |
| | | </el-button> |
| | | <el-button icon="el-icon-delete" size="small" type="text" @click="rowDeleteHandler(scope.row)">删除 |
| | | </el-button> |
| | | </template> |
| | | <template slot="menu" slot-scope="scope"> |
| | | <el-button icon="el-icon-edit" size="small" type="text" @click="editBtnClick(scope.row)">编辑 |
| | | </el-button> |
| | | <el-button icon="el-icon-delete" size="small" type="text" @click="rowDeleteHandler(scope.row)">删除 |
| | | </el-button> |
| | | </template> |
| | | |
| | | </avue-crud> |
| | | <!-- 创建编辑自定义对话框 --> |
| | | <el-dialog |
| | | v-dialogDrag |
| | | v-loading="dialogLoading" |
| | | :title="dialogType === 'add' ? ' 创建' : '编辑'" |
| | | :visible.sync="dialogVisible" |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | width="70%" |
| | | @close="dialogClose" |
| | | > |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="名称:" prop="id"> |
| | | <el-input v-model="form.id"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="标签:"> |
| | | <el-input v-model="form.name"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="类型:"> |
| | | <el-select v-model="form.enumValueDataType" placeholder="请选择类型"> |
| | | <el-option label="String" value="String"></el-option> |
| | | <el-option label="Integer" value="Integer"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="长度:"> |
| | | <el-input-number v-model="form.length" :max="999" :min="1" label="描述文字"></el-input-number> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <avue-crud |
| | | ref="dialogCrud" |
| | | :data="dialogData" |
| | | :option="dialogOption" |
| | | @row-save="rowSaveDialogHandler" |
| | | @row-update="rowUpdateDialogHandler" |
| | | @row-del="rowDeleteDialogHandler" |
| | | > |
| | | </avue-crud> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </avue-crud> |
| | | <!-- 创建编辑自定义对话框 --> |
| | | <el-dialog |
| | | v-dialogDrag |
| | | v-loading="dialogLoading" |
| | | :title="dialogType === 'add' ? ' 创建' : '编辑'" |
| | | :visible.sync="dialogVisible" |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | width="70%" |
| | | @close="dialogClose" |
| | | > |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="名称:" prop="id"> |
| | | <el-input v-model="form.id"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="标签:"> |
| | | <el-input v-model="form.name"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="类型:"> |
| | | <el-select v-model="form.enumValueDataType" placeholder="请选择类型"> |
| | | <el-option label="String" value="String"></el-option> |
| | | <el-option label="Integer" value="Integer"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="长度:"> |
| | | <el-input-number v-model="form.length" :max="999" :min="1" label="描述文字"></el-input-number> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <avue-crud |
| | | ref="dialogCrud" |
| | | :data="dialogData" |
| | | :option="dialogOption" |
| | | @row-save="rowSaveDialogHandler" |
| | | @row-update="rowUpdateDialogHandler" |
| | | @row-del="rowDeleteDialogHandler" |
| | | > |
| | | </avue-crud> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="rowSaveHandler">确 定</el-button> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </el-dialog> |
| | | |
| | | <!-- 查看使用范围 --> |
| | | <el-dialog |
| | | v-dialogDrag |
| | | v-loading="checkViewLoading" |
| | | :visible.sync="checkViewVisible" |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | title="查看使用范围" |
| | | width="70%" |
| | | > |
| | | <avue-crud |
| | | ref="checkViewCrud" |
| | | :data="checkViewData" |
| | | :option="checkViewOption" |
| | | @search-change="checkHandleSearch" |
| | | @search-reset="checkHandleReset" |
| | | > |
| | | <!-- 查看使用范围 --> |
| | | <el-dialog |
| | | v-dialogDrag |
| | | v-loading="checkViewLoading" |
| | | :visible.sync="checkViewVisible" |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | title="查看使用范围" |
| | | width="70%" |
| | | > |
| | | <avue-crud |
| | | ref="checkViewCrud" |
| | | :data="checkViewData" |
| | | :option="checkViewOption" |
| | | @search-change="checkHandleSearch" |
| | | @search-reset="checkHandleReset" |
| | | > |
| | | |
| | | </avue-crud> |
| | | </el-dialog> |
| | | </avue-crud> |
| | | </el-dialog> |
| | | |
| | | <!--导入 --> |
| | | <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="导入" |
| | | @updata="getTableList"></upload-file> |
| | | </basic-container> |
| | | <!--导入 --> |
| | | <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="导入" |
| | | @updata="getTableList"></upload-file> |
| | | </basic-container> |
| | | </el-main> |
| | | |
| | | <el-aside width="30%"> |
| | | <basic-container> |
| | | <el-descriptions :column="1" border size="medium" style="margin-bottom: 20px" title="枚举信息"> |
| | | <el-descriptions-item> |
| | | <template slot="label"> |
| | | 名称 |
| | | </template> |
| | | {{ this.lastItem.id }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item> |
| | | <template slot="label"> |
| | | 标签 |
| | | </template> |
| | | {{ this.lastItem.name }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item> |
| | | <template slot="label"> |
| | | 类型 |
| | | </template> |
| | | {{ this.lastItem.enumValueDataType || 'String' }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item> |
| | | <template slot="label"> |
| | | 长度 |
| | | </template> |
| | | <el-tag> {{ this.lastItem.length || 50 }}</el-tag> |
| | | </el-descriptions-item> |
| | | |
| | | </el-descriptions> |
| | | |
| | | <p style="font-weight: bold">枚举项</p> |
| | | <avue-crud |
| | | :data="asideData" |
| | | :option="asideOption" |
| | | > |
| | | </avue-crud> |
| | | </basic-container> |
| | | </el-aside> |
| | | </el-container> |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | name: "index", |
| | | data() { |
| | | return { |
| | | asideOption: { |
| | | ...basicOption, |
| | | addBtn: false, |
| | | editBtn: false, |
| | | menu: false, |
| | | refreshBtn: false, |
| | | selection: false, |
| | | index: false, |
| | | column: [ |
| | | { |
| | | label: '枚举项名称', |
| | | prop: 'name', |
| | | sortable: true, |
| | | }, |
| | | { |
| | | label: '枚举值', |
| | | prop: 'value', |
| | | sortable: true, |
| | | }, |
| | | { |
| | | label: '描述', |
| | | prop: 'description', |
| | | }, |
| | | ] |
| | | }, |
| | | tipList: [ |
| | | "导入模板中标明红色字体的为必输项", |
| | | "*注意*:第二行开始的数据为示例数据,导入前请将其删除,当导入的枚举下具备多个枚举项时,应按照示例enum2的写法", |
| | |
| | | searchParams: {} |
| | | } |
| | | }, |
| | | computed: { |
| | | lastItem() { |
| | | return this.selectList.length > 0 ? this.selectList[this.selectList.length - 1] : {}; |
| | | }, |
| | | asideData() { |
| | | return this.selectList.length > 0 ? this.selectList[this.selectList.length - 1].items : []; |
| | | } |
| | | }, |
| | | methods: { |
| | | //表格查询请求 |
| | | getTableList() { |
| | |
| | | |
| | | // 选择框 |
| | | selectChange(row) { |
| | | console.log(row) |
| | | this.selectList = row; |
| | | }, |
| | | |
| | |
| | | message: '已取消删除' |
| | | }); |
| | | }); |
| | | |
| | | |
| | | }, |
| | | |
| | | // 对话框枚举保存 |