| | |
| | | <template> |
| | | <basic-container> |
| | | <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"> |
| | | <template slot="menu" slot-scope="{ row, index }"> |
| | | <el-button |
| | |
| | | option: { |
| | | headerAlign: 'center', |
| | | align: 'center', |
| | | columnBtn:false, |
| | | border: true, |
| | | index: true, |
| | | rowKey:'id', |
| | | editBtn:false, |
| | | height:700, |
| | | delBtn:false, |
| | | column: [ |
| | | { |
| | |
| | | |
| | | }, |
| | | { |
| | | //写两个组合方法是因为id和name不能同时绑定这个prop来渲染,一个表格做隐藏来数据操作(表单隐藏),另一个表格做显示只显示在页面(表单隐藏)。 |
| | | label: '组合方法', |
| | | prop: 'combinationIds', |
| | | type: "checkbox", |
| | |
| | | labelWidth:"22%", |
| | | id:5, |
| | | hide:true, |
| | | change:this.handleCheckboxChange, |
| | | change: this.handleCheckboxChange, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请选择组合方法", |
| | |
| | | created() { |
| | | this.onLoad() |
| | | combination().then(res=>{ |
| | | console.log("111",res) |
| | | // console.log("111",res) |
| | | }) |
| | | }, |
| | | mount() { |
| | | }, |
| | | methods:{ |
| | | handleSelectChange(val){ |
| | |
| | | // } |
| | | }, |
| | | handleCheckboxChange(val) { |
| | | console.log("val",val); |
| | | const arr = this.option.column[5]; |
| | | this.checkboxlength = val.value; |
| | | console.log("this.checkboxlength",this.checkboxlength); |
| | | this.checkboxedit = this.checkboxlength.toString().split(","); |
| | | |
| | | if (val.value != undefined && val.value != null) { |
| | |
| | | }); |
| | | this.onLoad(); |
| | | }).catch(res=>{ |
| | | console.log(res) |
| | | // console.log(res) |
| | | }) |
| | | }, |
| | | rowSave(row,done){ |
| | |
| | | }) |
| | | }, |
| | | rowEdit(row){ |
| | | console.log("打开编辑edit",row) |
| | | // console.log("打开编辑edit",row) |
| | | }, |
| | | handleDel(row){ |
| | | this.$refs.crud.rowDel(row,row.$index); |
| | |
| | | // const arr=this.option.column[5]; |
| | | this.checkboxNumber=row.combinationIds.split(",") |
| | | this.selectNumber=row.requiredType |
| | | console.log(this.checkboxNumber, this.selectNumber) |
| | | // console.log(this.checkboxNumber, this.selectNumber) |
| | | // 打开编辑首先判断,组合方法是否小于必填种类,如果小于给予提醒修改 |
| | | if(this.checkboxNumber.length<=this.selectNumber){ |
| | | this.$message({ |
| | |
| | | }); |
| | | done() |
| | | }).catch(res=>{ |
| | | console.log(res) |
| | | // console.log(res) |
| | | }) |
| | | }, |
| | | onLoad(page, params = {}) { |
| | |
| | | // this.data = data.records; |
| | | // this.loading = false; |
| | | // this.selectionClear(); |
| | | console.log(res) |
| | | // console.log(res) |
| | | this.page.total=res.data.data.total |
| | | this.data=res.data.data.records |
| | | }); |