| | |
| | | {{ item }} |
| | | </el-tag> |
| | | </div> |
| | | <avue-input v-model="form" placeholder="查询" size="mini" prefixIcon="el-icon-search" style="width: 300px;max-width: 30%"></avue-input> |
| | | <avue-input v-model="searchText" @change="handleSearch" placeholder="查询" size="mini" prefixIcon="el-icon-search" style="width: 300px;max-width: 30%"></avue-input> |
| | | </div> |
| | | <div style="height: calc(100vh - 190px)"> |
| | | <input-icon v-model="iconValue"></input-icon> |
| | | <div> |
| | | <el-button icon="el-icon-upload" type="primary" size="mini" @click="uploadHandler">上传</el-button> |
| | | </div> |
| | | <el-tabs v-model="activeName" @tab-click="handleClick"> |
| | | <el-tab-pane v-for="item in iconList" :label="item.label" :name="item.label"> |
| | | <div class="iconList"> |
| | |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | | <!-- 上传 --> |
| | | <el-dialog |
| | | v-dialogDrag |
| | | title="图标上传" |
| | | :visible.sync="visible" |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | width="500px" |
| | | @close="visibleCloseHandler" |
| | | > |
| | | <avue-form ref="form" :option="option" v-model="form"> </avue-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button size="small" type="primary" @click="uploadSaveHandler">确 定</el-button> |
| | | <el-button size="small" @click="visibleCloseHandler">取 消</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </basic-container> |
| | | </el-main> |
| | | </el-container> |
| | |
| | | import {validatenull} from "@/util/validate"; |
| | | import {getStore} from "@/util/store"; |
| | | import store from "@/store"; |
| | | import {addSave, editSave} from "@/api/modeling/statusPool/api"; |
| | | import {getToken} from "@/util/auth"; |
| | | |
| | | export default { |
| | | name: "index", |
| | |
| | | return { |
| | | types: ['标签一' , '标签二' , '标签三' , '标签四','标签五' ], |
| | | checkedTypes:[], |
| | | form:'', |
| | | searchText:'', |
| | | activeName:'', |
| | | iconValue:'iconoir2:adobe-illustrator', |
| | | iconList:[] |
| | | allIconList:[], |
| | | iconList:[], |
| | | visible: false, |
| | | option: { |
| | | labelWidth: 80, |
| | | submitBtn:false, |
| | | emptyBtn:false, |
| | | column: [{ |
| | | label: '分类', |
| | | prop: 'type', |
| | | type: 'select', |
| | | span: 24, |
| | | multiple:true, |
| | | dicData:[{ |
| | | label:'标签一', |
| | | value:0 |
| | | },{ |
| | | label:'标签二', |
| | | value:1 |
| | | },{ |
| | | label:'标签三', |
| | | value:2 |
| | | }] |
| | | }, { |
| | | label: "附件上传", |
| | | prop: "file", |
| | | dataType: "object", |
| | | type: "upload", |
| | | accept:'.json', |
| | | data:{}, |
| | | headers:this.uploadHeaders, |
| | | propsHttp: { |
| | | res: "data", |
| | | }, |
| | | span: 24, |
| | | action: "", |
| | | } |
| | | ] |
| | | }, |
| | | form:{ |
| | | type:[] |
| | | } |
| | | } |
| | | }, |
| | | created() {debugger; |
| | | computed: { |
| | | uploadHeaders() { |
| | | return { |
| | | "Authorizationtoken":getToken(), |
| | | }; |
| | | }, |
| | | }, |
| | | created() { |
| | | this.initList(); |
| | | }, |
| | | methods:{ |
| | | initList(){ |
| | | if (!validatenull(this.$store.state.icons)) { |
| | | this.iconList = this.$store.state.icons; |
| | | } else { |
| | | this.iconList = getStore({ name:'icons'}); |
| | | } |
| | | this.allIconList=this.iconList; |
| | | if(this.iconList && this.iconList.length>0){ |
| | | this.activeName=this.iconList[0].label; |
| | | }else { |
| | |
| | | "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"1.5\" stroke-width=\"1.5\"><path d=\"M12 15a3 3 0 1 0 0-6a3 3 0 0 0 0 6\"/><path d=\"M12 9s-1.988-1.975-2-4c.001-1.993-.05-4.001 2-4c1.948.001 1.997 1.976 2 4c.003 1.985-2 4-2 4m3 3s1.975-1.988 4-2c1.993.001 4.001-.05 4 2c-.001 1.948-1.976 1.997-4 2c-1.985.003-4-2-4-2m-6 0s-1.975 1.988-4 2c-1.993-.001-4.001.05-4-2c.001-1.948 1.976-1.997 4-2c1.985-.003 4 2 4 2m3 3s1.988 1.975 2 4c-.001 1.993.05 4.001-2 4c-1.948-.001-1.997-1.976-2-4c-.003-1.985 2-4 2-4\" clip-rule=\"evenodd\"/></g></svg>" |
| | | }] |
| | | }] |
| | | this.allIconList=this.iconList; |
| | | store.dispatch("setIcons", this.iconList); |
| | | if(this.iconList.length>0) { |
| | | this.activeName=this.iconList[0].label; |
| | |
| | | }) |
| | | } |
| | | }, |
| | | methods:{ |
| | | changeType(type){ |
| | | if(this.checkedTypes.includes(type)){ |
| | | this.checkedTypes=this.checkedTypes.filter(item=> item!=type) |
| | | }else { |
| | | this.checkedTypes.push(type) |
| | | } |
| | | //按照分类过滤图标 |
| | | if(this.checkedTypes.length==0){ |
| | | this.iconList=this.allIconList |
| | | }else{ |
| | | this.iconList=this.allIconList.filter(item=> { |
| | | return this.checkedTypes.includes(item.type); |
| | | }) |
| | | } |
| | | this.activeName=this.iconList[0].label; |
| | | }, |
| | | handleSearch(data){ |
| | | if(data.value==''){ |
| | | this.iconList=this.allIconList; |
| | | } |
| | | let iconList=[] |
| | | this.allIconList.forEach(item=> { |
| | | iconList.push({ |
| | | label:item.label, |
| | | type:item.type, |
| | | list: item.list.filter(iconItem=>{ |
| | | return iconItem.name.replace(item.label,'').indexOf(data.value)!=-1; |
| | | }) |
| | | }) |
| | | }) |
| | | this.iconList=iconList; |
| | | }, |
| | | handleClick(tab, event){ |
| | | |
| | | }, |
| | | uploadHandler(){ |
| | | this.visible = true; |
| | | }, |
| | | // 关闭对话框 |
| | | visibleCloseHandler() { |
| | | const form = {} |
| | | this.form = form; |
| | | this.visible = false; |
| | | this.$refs.form.clearValidate(); |
| | | }, |
| | | |
| | | // 上传保存 |
| | | uploadSaveHandler() {debugger; |
| | | this.$refs.form.validate((valid,done) => { |
| | | if (valid) { |
| | | done() |
| | | saveFunction(this.form).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.initList(); |
| | | done(); |
| | | this.visibleCloseHandler(); |
| | | } else { |
| | | this.$message.error(res.data.obj); |
| | | } |
| | | }) |
| | | } else { |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | } |
| | | } |
| | | </script> |