| | |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | const formData = this.initFormData(); |
| | | console.log(formData) |
| | | btmSave(formData).then(res => { |
| | | if (res.data.success) { |
| | | this.$message.success("ä¿åæå"); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <!--æµç¨æ¨¡æ¿å®ä¹--> |
| | | <basic-container> |
| | | <div> |
| | | æµç¨åç±»ï¼ |
| | | <el-select v-model="tempType" :clearable="true" placeholder="è¯·éæ©" size="small" |
| | | style="width: 300px;margin-right: 20px;" |
| | | @change="tempTypeChange"> |
| | | <el-option |
| | | v-for="item in tempTypeData" |
| | | :key="item.oid" |
| | | :label="item.text" |
| | | :value="item.attributes.name"> |
| | | </el-option> |
| | | </el-select> |
| | | æµç¨æ¨¡æ¿åç§°ï¼ |
| | | <el-input size="small" v-model="tempName" style="width: 300px;margin-right: 10px;"></el-input> |
| | | <el-button icon="el-icon-search" plain size="small" style="margin-right: 40px;" type="primary" |
| | | @click="searchValue"> |
| | | æ¥è¯¢ |
| | | </el-button> |
| | | </div> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import {mapGetters} from "vuex"; |
| | | import basicOption from "@/util/basic-option"; |
| | | |
| | | export default { |
| | | name: "index", |
| | | data(){ |
| | | return { |
| | | tempType:'', |
| | | tempName:'', |
| | | tempTypeData:[], |
| | | form:{}, |
| | | tableLoading: false, |
| | | tableData: [], |
| | | currentRow:null, |
| | | selectionList: [], |
| | | } |
| | | }, |
| | | computed: { |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | }, |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false), |
| | | delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false), |
| | | editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false), |
| | | }; |
| | | }, |
| | | option(){ |
| | | return { |
| | | ...basicOption, |
| | | addBtn:false, |
| | | editBtn:false, |
| | | delBtn:false, |
| | | calcHeight: -60, |
| | | align:'left', |
| | | headerAlign:'center', |
| | | menuWidth:160, |
| | | dialogMenuPosition: 'right', |
| | | dialogWidth:600, |
| | | column: [ |
| | | { |
| | | label: 'æµç¨æ¨¡æ¿åç§°', |
| | | prop: 'name' |
| | | },{ |
| | | label: 'çæ¬', |
| | | prop: 'desc' |
| | | },{ |
| | | label: 'ç¶æ', |
| | | prop: 'status' |
| | | }] |
| | | } |
| | | } |
| | | }, |
| | | methods:{ |
| | | getTableList(){ |
| | | |
| | | }, |
| | | tempTypeChange(val){ |
| | | this.getTableList(); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <!--æµç¨æ¨¡æ¿åç±»--> |
| | | <basic-container> |
| | | <avue-crud |
| | | ref="crud" |
| | | v-model="form" |
| | | :data="tableData" |
| | | :option="option" |
| | | :table-loading="tableLoading" |
| | | @on-load="getTableList" |
| | | @row-save="rowSaveHandler" |
| | | @row-update="rowUpdateHandler" |
| | | @row-click="rowClickHandler" |
| | | @selection-change="selectionChange" |
| | | > |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <el-button v-if="permissionList.addBtn" class="button-custom-icon" size="small" type="primary" |
| | | @click="$refs.crud.rowAdd()"> |
| | | <icon-show :name="permissionList.addBtn.source"></icon-show> |
| | | æ° å¢ |
| | | </el-button> |
| | | <el-button v-if="permissionList.exportBtn" class="button-custom-icon" plain size="small" type="primary" @click="exportClickHandler"> |
| | | <icon-show :name="permissionList.exportBtn.source"></icon-show> |
| | | å¯¼åº |
| | | </el-button> |
| | | </template> |
| | | <template slot="menu" slot-scope="{ row, index }"> |
| | | <el-button |
| | | v-if="permissionList.editBtn" |
| | | size="small" |
| | | type="text" |
| | | @click="handleEdit(row, index)" |
| | | > |
| | | <icon-show :name="permissionList.editBtn.source"></icon-show> |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | v-if="permissionList.delBtn" |
| | | size="small" |
| | | type="text" |
| | | @click="handleDel(row, index)" |
| | | > |
| | | <icon-show :name="permissionList.delBtn.source"></icon-show> |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import {mapGetters} from "vuex"; |
| | | import basicOption from "@/util/basic-option"; |
| | | import {deletePvolume, getPvolumesPage, savePvolume, updatePvolume} from "@/api/system/fileCab/api"; |
| | | import func from "@/util/func"; |
| | | |
| | | export default { |
| | | name: "index", |
| | | data: function () { |
| | | return { |
| | | form:{}, |
| | | tableLoading: false, |
| | | tableData: [], |
| | | currentRow:null, |
| | | selectionList: [], |
| | | } |
| | | }, |
| | | computed: { |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | }, |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false), |
| | | delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false), |
| | | editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false), |
| | | }; |
| | | }, |
| | | option(){ |
| | | return { |
| | | ...basicOption, |
| | | addBtn:false, |
| | | editBtn:false, |
| | | delBtn:false, |
| | | calcHeight: -60, |
| | | align:'left', |
| | | headerAlign:'center', |
| | | menuWidth:160, |
| | | dialogMenuPosition: 'right', |
| | | dialogWidth:600, |
| | | column: [ |
| | | { |
| | | label: 'åç±»åç§°', |
| | | prop: 'name', |
| | | span: 24, |
| | | rules: [{ required: true, message: '请è¾å
¥åç±»åç§°', trigger: 'blur' }] |
| | | },{ |
| | | label: 'æè¿°', |
| | | prop: 'desc', |
| | | span: 24, |
| | | type:'textarea' |
| | | }] |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | // è¡¨æ ¼è¯·æ± |
| | | getTableList() { |
| | | this.tableLoading = true; |
| | | getPvolumesPage().then(res => { |
| | | this.tableData = res.data.data; |
| | | this.tableLoading = false; |
| | | }) |
| | | }, |
| | | |
| | | // æ°å¢ |
| | | rowSaveHandler(row, done, loading) { |
| | | savePvolume(row).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTableList(); |
| | | done(); |
| | | } |
| | | }).catch(err => { |
| | | loading() |
| | | }); |
| | | }, |
| | | |
| | | handleEdit(row,index){ |
| | | this.$refs.crud.rowEdit(row, index); |
| | | }, |
| | | |
| | | // ç¼è¾ |
| | | rowUpdateHandler(row, index, done, loading) { |
| | | updatePvolume(row).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTableList(); |
| | | done() |
| | | } |
| | | }).catch(err => { |
| | | loading() |
| | | }); |
| | | }, |
| | | |
| | | // å é¤ |
| | | handleDel(row,index) { |
| | | let params = { |
| | | ids: row.id |
| | | } |
| | | |
| | | this.$confirm('æ¨ç¡®å®è¦å é¤å½åçåç±»åï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | deletePvolume(params).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTableList(); |
| | | } |
| | | }); |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已忶å é¤' |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | //éæ©çè¡ |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | |
| | | // è¡åé |
| | | rowClickHandler(row) { |
| | | func.rowClickHandler( |
| | | row, |
| | | this.$refs.crud, |
| | | this.lastIndex, |
| | | (newIndex) => { |
| | | this.lastIndex = newIndex; |
| | | }, |
| | | () => { |
| | | this.selectionList = [row]; |
| | | } |
| | | ); |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | let node = this.currentClickNode.parent; |
| | | node.loaded = false; |
| | | node.expand(); |
| | | this.$refs.tree.setCurrentNode(this.currentClickNode); |
| | | this.$nextTick(()=>{ |
| | | this.$refs.tree.setCurrentKey(this.currentClickNode.data.id); |
| | | }); |
| | | } else { |
| | | this.refresh = Math.random(); // å·æ°å·¦ä¾§æ |
| | | } |
| | |
| | | methods: { |
| | | // æ è¡ç¹å» |
| | | nodeClick(row, node) { |
| | | console.log(row.childType); |
| | | this.form = {...row}; |
| | | this.nodeRow = {...row}; |
| | | this.currentClickNode = node; |
| | |
| | | let node = this.currentClickNode.parent; |
| | | node.loaded = false; |
| | | node.expand(); |
| | | this.$refs.tree.setCurrentNode(this.currentClickNode); |
| | | this.$nextTick(()=>{ |
| | | this.$refs.tree.setCurrentKey(this.currentClickNode.data.id); |
| | | }); |
| | | } else { |
| | | this.refresh = Math.random(); // å·æ°å·¦ä¾§æ |
| | | } |