¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud v-model="form" :option="option" :data="data" ref="crud" @on-load="onLoad" @row-save="rowSave" @row-update="rowUpdate" @row-del="rowDel" :page.sync="page"> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getadd, |
| | | getupdata, |
| | | getremove, |
| | | getPage |
| | | } from "@/api/system/passwordresultant"; |
| | | |
| | | export default { |
| | | name: "passwords.vue", |
| | | data() { |
| | | return { |
| | | form:{}, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 100 |
| | | }, |
| | | |
| | | data: [], |
| | | option:{ |
| | | headerAlign: 'center', |
| | | align: 'center', |
| | | border: true, |
| | | index: true, |
| | | rowKey:'id', |
| | | column:[ |
| | | { |
| | | label: 'åç§°', |
| | | prop: 'name', |
| | | align: 'left', |
| | | }, |
| | | { |
| | | label: 'æè¿°', |
| | | prop: 'desc', |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | |
| | | |
| | | created() { |
| | | this.onLoad() |
| | | }, |
| | | methods:{ |
| | | rowDel(row){ |
| | | this.$confirm("ç¡®å®å°éæ©æ°æ®å é¤?", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return getremove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | this.onLoad(); |
| | | }); |
| | | }, |
| | | rowSave(row,done){ |
| | | getadd(row).then(()=>{ |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | done(row) |
| | | this.onLoad() |
| | | }).catch((res)=>{ |
| | | this.$message({ |
| | | type: "success", |
| | | message:res |
| | | }); |
| | | }) |
| | | }, |
| | | rowUpdate(row,index,done){ |
| | | getupdata(row).then(()=>{ |
| | | this.onLoad() |
| | | this.$message({ |
| | | type: "success", |
| | | message: "ä¿®æ¹æå!" |
| | | }); |
| | | done(row) |
| | | }) |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | // this.loading = true; |
| | | getPage(this.page.currentPage, this.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(); |
| | | this.data=res.data.data.records |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | </style> |