| | |
| | | <basic-container> |
| | | <avue-crud |
| | | ref="useCrud" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :option="option" |
| | | :page.sync="page" |
| | | :table-loading="loading" |
| | | @selection-change="selectChange" |
| | | @row-click="rowClickHandler" |
| | | @refresh-change="handleRefresh" |
| | |
| | | </el-button> |
| | | <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">导入 |
| | | </el-button> |
| | | <el-button icon="el-icon-check" plain size="small" type="primary" |
| | | @click="checkViewClickHandler">查看使用范围 |
| | | <el-button icon="el-icon-view" plain size="small" type="primary" @click="checkViewClickHandler">查看使用范围 |
| | | </el-button> |
| | | </template> |
| | | |
| | |
| | | <el-button icon="el-icon-delete" plain size="small" type="text" @click="delRowClickHandler(row)">删除 |
| | | </el-button> |
| | | </template> |
| | | |
| | | |
| | | </avue-crud> |
| | | |
| | | <!-- 新增 修改 --> |
| | |
| | | :visible.sync="visible" |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | width="40%" |
| | | width="500px" |
| | | @close="visibleCloseHandler" |
| | | > |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px" size="small"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="名称:" prop="id"> |
| | |
| | | </el-row> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="visibleCloseHandler">取 消</el-button> |
| | | <el-button type="primary" @click="addSaveHandler">确 定</el-button> |
| | | <el-button @click="visibleCloseHandler">取 消</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | |
| | | name: "index", |
| | | data() { |
| | | return { |
| | | loading:false, |
| | | loading: false, |
| | | data: [], |
| | | option: { |
| | | ...basicOption, |
| | |
| | | searchMenuSpan: 8, |
| | | refreshBtn: false, |
| | | selection: false, |
| | | header:false, |
| | | column: [ |
| | | { |
| | | label: '名称', |
| | |
| | | ] |
| | | }, |
| | | visible: false, |
| | | selectList:[], |
| | | lastIndex:null, |
| | | selectList: [], |
| | | lastIndex: null, |
| | | page: { |
| | | currentPage: 1, |
| | | pageSize: 15, |
| | |
| | | this.page.total = res.data.total; |
| | | this.loading = false; |
| | | }).catch(err => { |
| | | this.$message.error(err) |
| | | this.$message.error(err); |
| | | }); |
| | | }, |
| | | |
| | | // 表格刷新 |
| | | handleRefresh(){ |
| | | handleRefresh() { |
| | | this.getTreeList(); |
| | | }, |
| | | |
| | | // 表格多选 |
| | | selectChange(row){ |
| | | selectChange(row) { |
| | | this.selectList = row; |
| | | }, |
| | | |
| | |
| | | row, |
| | | this.$refs.useCrud, |
| | | this.lastIndex, |
| | | (newIndex) => { this.lastIndex = newIndex; }, |
| | | () => { this.selectList = []; } |
| | | (newIndex) => { |
| | | this.lastIndex = newIndex; |
| | | }, |
| | | () => { |
| | | this.selectList = []; |
| | | } |
| | | ); |
| | | }, |
| | | |
| | |
| | | }, |
| | | |
| | | // 行单个删除 |
| | | delRowClickHandler(row){ |
| | | delRowClickHandler(row) { |
| | | this.$confirm('您确定要删除所选择的数据吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | |
| | | // 创建或编辑保存 |
| | | addSaveHandler() { |
| | | const saveFunction = this.dialogTitle === 'add' ? addSave : editSave; |
| | | |
| | | saveFunction(this.form).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.loading = true; |
| | | this.getTreeList(); |
| | | this.visible = false; |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | saveFunction(this.form).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.loading = true; |
| | | this.getTreeList(); |
| | | this.visible = false; |
| | | } else { |
| | | this.$message.error(res.data.obj); |
| | | } |
| | | }).catch(error => { |
| | | this.$message.error(error); |
| | | }); |
| | | } else { |
| | | this.$message.error(res.data.obj); |
| | | return false; |
| | | } |
| | | }).catch(error => { |
| | | this.$message.error(error); |
| | | }); |
| | | }, |
| | | |