| | |
| | | <template> |
| | | <el-dialog |
| | | title="ä¸ä¼ æä»¶" |
| | | :visible.sync="dialogVisible" |
| | | append-to-body |
| | | title="ä¸ä¼ æä»¶" |
| | | > |
| | | <Divider text="导å
¥æç¤º" left="30px"></Divider> |
| | | <Divider left="30px" text="导å
¥æç¤º"></Divider> |
| | | <ul> |
| | | <li> |
| | | 1.红è²åä½è¡¨ç¤ºå¿
è¾é¡¹ |
| | |
| | | 2.æ¯æ¬¡ä»
è½æå¤å¯¼å
¥10000æ¡æ°æ® |
| | | </li> |
| | | </ul> |
| | | <Divider text="excelæä»¶ï¼éæ©æä»¶åä¼èªå¨ä¸ä¼ " left="30px"></Divider> |
| | | <Divider left="30px" text="excelæä»¶ï¼éæ©æä»¶åä¼èªå¨ä¸ä¼ "></Divider> |
| | | <el-upload |
| | | :before-upload="beforeUpload" |
| | | :headers="uploadHeaders" |
| | | :on-change="uploadChange" |
| | | :on-error="onError" |
| | | :on-success="onSuccess" |
| | | :show-file-list="false" |
| | | accept=".xlsx, .xls" |
| | | action="/api/ubcs-code/codeClassify/importClassify" |
| | | :on-success="onSuccess" |
| | | :on-error="onError" |
| | | :headers="uploadHeaders" |
| | | :show-file-list="false" |
| | | :before-upload="beforeUpload" |
| | | :on-change="uploadChange" |
| | | class="upload-demo"> |
| | | <el-button size="small" type="primary" style="margin: 15px 35px">æµè§æä»¶</el-button> |
| | | <el-button size="small" style="margin: 15px 35px" type="primary">æµè§æä»¶</el-button> |
| | | </el-upload> |
| | | <template #footer> |
| | | <el-button |
| | | type="primary" |
| | | size="small" |
| | | @click="downloadTemplateFun" |
| | | :loading="downloadLoading" |
| | | >ä¸è½½å¯¼å
¥æ¨¡æ¿</el-button |
| | | size="small" |
| | | type="primary" |
| | | @click="downloadTemplateFun" |
| | | >ä¸è½½å¯¼å
¥æ¨¡æ¿ |
| | | </el-button |
| | | > |
| | | <el-button size="small" @click="dialogVisible = false">å
³é</el-button> |
| | | </template> |
| | |
| | | // import {downloadErrorFile,downloadBatchImportApplyTemplate} from '@/api/template/templateAttr' |
| | | import {getToken} from "@/util/auth"; |
| | | import func from "@/util/func"; |
| | | |
| | | export default { |
| | | name: "Upload-files", |
| | | props: { |
| | |
| | | default: "", |
| | | }, |
| | | }, |
| | | data(){ |
| | | return{ |
| | | flga:true, |
| | | data() { |
| | | return { |
| | | flga: true, |
| | | pageLoading: null, |
| | | downloadLoading: false, |
| | | } |
| | | }, |
| | | watch:{ |
| | | visible:{ |
| | | handler(newval,oldval){ |
| | | watch: { |
| | | visible: { |
| | | handler(newval, oldval) { |
| | | // console.log('newval',newval) |
| | | } |
| | | } |
| | | }, |
| | | computed:{ |
| | | computed: { |
| | | uploadHeaders() { |
| | | return { |
| | | "Blade-Auth": "bearer " + getToken(), |
| | |
| | | }, |
| | | }, |
| | | }, |
| | | methods:{ |
| | | methods: { |
| | | //æä»¶ä¸ä¼ å |
| | | async beforeUpload(file) { |
| | | const fileType = file.name.split(".").pop(); |
| | |
| | | return true; |
| | | }, |
| | | // æä»¶ä¸ä¼ æå |
| | | onSuccess(resbonse){ |
| | | onSuccess(resbonse) { |
| | | if (Object.keys(resbonse.data).length === 0) { |
| | | this.$message.success( "ä¸ä¼ æåï¼"); |
| | | this.$message.success("ä¸ä¼ æåï¼"); |
| | | this.dialogVisible = false; |
| | | return; |
| | | } |
| | | if (resbonse.data.fileOid) { |
| | | const fileName = resbonse.data.filePath.split("/").pop(); |
| | | this.$message.error("请ä¸è½½éè¯¯ä¿¡æ¯æä»¶è¿è¡æ¥çï¼"); |
| | | downloadErrorFile({ uuid: resbonse.data.fileOid }).then((res) => { |
| | | downloadErrorFile({uuid: resbonse.data.fileOid}).then((res) => { |
| | | func.downloadFileByBlobHandler(res); |
| | | }); |
| | | } |
| | | }, |
| | | //ç¹å»ä¸è½½æ¨¡æ¿ |
| | | downloadTemplateFun(){ |
| | | downloadTemplateFun() { |
| | | this.downloadLoading = true; |
| | | downloadBatchImportApplyTemplate({codeClassifyOid: this.codeClassifyOid}).then(res=>{ |
| | | this.$utilFunc.downloadFileByBlob(res.data, "æ¨¡æ¿æä»¶.xls"); |
| | | downloadBatchImportApplyTemplate({codeClassifyOid: this.codeClassifyOid}).then(res => { |
| | | this.$utilFunc.downloadFileByBlob(res.data, "æ¨¡æ¿æä»¶.xls"); |
| | | this.downloadLoading = false; |
| | | }).catch((res)=>{ |
| | | }).catch((res) => { |
| | | this.$message.warning(res) |
| | | this.downloadLoading = false; |
| | | }) |
| | | }, |
| | | //æä»¶ä¸ä¼ 失败 |
| | | onError(res){ |
| | | onError(res) { |
| | | this.pageLoading.close(); |
| | | }, |
| | | //æä»¶ç¶ææ¹å |
| | | uploadChange(file){ |
| | | uploadChange(file) { |
| | | if (file.status === "success" || file.status === "error") { |
| | | this.pageLoading.close(); |
| | | } |
| | |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | <style lang="scss" scoped> |
| | | ul { |
| | | color: rgb(188, 188, 188); |
| | | margin: 20px 0 20px 0; |
| | | padding: 0 0 0 30px; |
| | | list-style: none; |
| | | |
| | | li { |
| | | margin-bottom: 5px; |
| | | font-size: 13px; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <!-- |
| | | directory å¼å¯ç®å½ |
| | | --> |
| | | <el-upload |
| | | ref="uploadRef" |
| | | :before-upload="handleBeforeUpload" |
| | | :directory="true" |
| | | :headers="uploadHeaders" |
| | | :on-change="handleFileChange" |
| | | :on-error="onError" |
| | | :on-success="onSuccess" |
| | | :show-file-list="false" |
| | | action="https://jsonplaceholder.typicode.com/posts/" |
| | | class="upload-demo" |
| | | :accept="fileAccpet" |
| | | drag |
| | | multiple> |
| | | <i class="el-icon-upload"></i> |
| | | <div class="el-upload__text">å°æä»¶æå°æ¤å¤ï¼æ |
| | | <el-link type="primary" @click="UploadSingleFile">ä¸ä¼ åæä»¶</el-link> |
| | | <el-link type="success" @click="UploadFolder">ä¸ä¼ æä»¶å¤¹</el-link> |
| | | </div> |
| | | </el-upload> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getToken} from "@/util/auth"; |
| | | import func from "@/util/func"; |
| | | |
| | | export default { |
| | | name: "formUpload", |
| | | // props:{ |
| | | // fileAccpet:String, |
| | | // defalut:'.img,.xls,.png,.xlsx' |
| | | // }, |
| | | data() { |
| | | return { |
| | | pageLoading: null, |
| | | fileAccpet:'.img,.xls,.png,.xlsx' |
| | | } |
| | | }, |
| | | computed: { |
| | | uploadHeaders() { |
| | | return { |
| | | "Blade-Auth": "bearer " + getToken(), |
| | | }; |
| | | }, |
| | | }, |
| | | methods: { |
| | | //ä¸ä¼ æä»¶ä¹åçé©åï¼åæ°ä¸ºä¸ä¼ çæä»¶ï¼è¥è¿å false æè
è¿å Promise ä¸è¢« rejectï¼å忢ä¸ä¼ ã |
| | | handleBeforeUpload(file) { |
| | | console.log(file) |
| | | if(!file.type){ |
| | | this.$message.error('䏿¯æææ½ä¸ä¼ æä»¶å¤¹ï¼è¯·æå¨éæ©æä»¶å¤¹ä¸ä¼ ï¼') |
| | | return |
| | | } |
| | | const fileList = this.fileAccpet.split(','); |
| | | const fileType = file.name.split(".").pop(); |
| | | // fileList.forEach(res => { |
| | | // if (fileType !== res) { |
| | | // // this.$message.error(`䏿¯æä¸ä¼ ${res}æä»¶ï¼è¯·éæ°é
ç½®ï¼`) |
| | | // messageList.push(fileType) |
| | | // return Promise.reject(false); |
| | | // } |
| | | // }); |
| | | if(!fileList.includes(fileType)){ |
| | | this.$message.error(`䏿¯æä¸ä¼ ${fileType}ï¼è¯·éæ°é
ç½®ï¼`) |
| | | return Promise.reject(false); |
| | | } |
| | | |
| | | this.pageLoading = this.$loading({ |
| | | lock: true, |
| | | text: "æä»¶ä¸ä¼ ä¸", |
| | | spinner: "el-icon-loading", |
| | | background: "rgba(0, 0, 0, 0.7)", |
| | | }); |
| | | return true; |
| | | }, |
| | | //æä»¶ç¶ææ¹åæ¶çé©åï¼æ·»å æä»¶ãä¸ä¼ æååä¸ä¼ 失败æ¶é½ä¼è¢«è°ç¨ |
| | | handleFileChange(file) { |
| | | if (file.status === "success" || file.status === "error") { |
| | | this.pageLoading.close(); |
| | | } |
| | | // this.$refs.uploadRef.clearFiles() |
| | | }, |
| | | //失败 |
| | | onError(error) { |
| | | this.pageLoading.close(); |
| | | }, |
| | | //æå |
| | | onSuccess(response) { |
| | | if (Object.keys(response.data).length === 0) { |
| | | this.$message.success("ä¸ä¼ æåï¼"); |
| | | this.dialogVisible = false; |
| | | return; |
| | | } |
| | | }, |
| | | //ä¸ä¼ åæä»¶ |
| | | UploadSingleFile() { |
| | | this.$refs.uploadRef.$children[0].$refs.input.webkitdirectory = false; |
| | | }, |
| | | //ä¸ä¼ æä»¶å¤¹ |
| | | UploadFolder() { |
| | | this.$refs.uploadRef.$children[0].$refs.input.webkitdirectory = true; |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | class="avatar-uploader"> |
| | | </el-upload> |
| | | <!-- åºäºelementUiçä¸ä¼ ç»ä»¶ el-upload end--> |
| | | <quill-editor ref="customQuillEditor" v-model="content" :options="editorOption" class="editor"> |
| | | <quill-editor ref="customQuillEditor" v-model="value" :options="editorOption" class="editor"> |
| | | </quill-editor> |
| | | </div> |
| | | <!-- <template #footer>--> |
| | | <!-- <el-button size="small">ç¡®å®</el-button>--> |
| | | <!-- <el-button size="small" @click="dialogVisible = false">å
³é</el-button>--> |
| | | <!-- </template>--> |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | ['clean'] // æ¸
é¤ææ¬æ ¼å¼ |
| | | ]; |
| | | export default { |
| | | name: 'richText', |
| | | props: { |
| | | visible: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | value: { |
| | | type: String |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | headers: { |
| | |
| | | }, |
| | | } |
| | | }, |
| | | computed: {}, |
| | | methods: { |
| | | //ä¸ä¼ å¾çä¹åasync |
| | | beforeEditorUpload(file) { |
| | |
| | | console.log("å¼å§å è½½") |
| | | // åå§ç»ç¼è¾å¨è®¾ç½®title |
| | | }, |
| | | watch: { |
| | | content(newVal, oldVal) { |
| | | //this.$emit('input', newVal); |
| | | console.log(newVal) |
| | | console.log(oldVal) |
| | | } |
| | | }, |
| | | watch: {}, |
| | | |
| | | |
| | | } |
| | |
| | | @setReferValue="setReferValue"> |
| | | |
| | | </vciWebRefer> |
| | | <quill-editor ref="customQuillEditor" v-model="content" :options="editorOption" class="editor"> |
| | | </quill-editor> |
| | | </template> |
| | | </avue-form> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import vciWebRefer from '@/components/refer/vciWebRefer' |
| | | |
| | | import VciWebRefer from "@/components/refer/vciWebRefer"; |
| | | import {verifyNull, verifySlash} from "@/util/validate"; |
| | | |
| | | const toolbarOptions = [ |
| | | ['bold', 'italic', 'underline', 'strike'], // toggled buttons |
| | | ['blockquote', 'code-block'], |
| | | |
| | | [{'header': 1}, {'header': 2}], // custom button values |
| | | [{'list': 'ordered'}, {'list': 'bullet'}], |
| | | [{'script': 'sub'}, {'script': 'super'}], // superscript/subscript |
| | | [{'indent': '-1'}, {'indent': '+1'}], // outdent/indent |
| | | [{'direction': 'rtl'}], // text direction |
| | | |
| | | [{'size': ['small', false, 'large', 'huge']}], // custom dropdown |
| | | [{'header': [1, 2, 3, 4, 5, 6, false]}], |
| | | |
| | | [{'color': []}, {'background': []}], // dropdown with defaults from theme |
| | | [{'font': []}], |
| | | [{'align': []}], |
| | | ['link', 'image', 'video'], |
| | | ['clean'] // remove formatting button |
| | | ]; |
| | | export default { |
| | | name: "dynamic-form", |
| | | components: {VciWebRefer}, |
| | |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | content: '', |
| | | editorOption: { |
| | | placeholder: 'ä½ æ³è¯´ä»ä¹ï¼', |
| | | modules: { |
| | | imageResize: { |
| | | displayStyles: { |
| | | backgroundColor: 'black', |
| | | border: 'none', |
| | | color: 'white' |
| | | }, |
| | | modules: ['Resize', 'DisplaySize', 'Toolbar'] |
| | | }, |
| | | toolbar: { |
| | | container: toolbarOptions, // å·¥å
·æ |
| | | handlers: { |
| | | 'image': function (value) { |
| | | if (value) { |
| | | document.querySelector('#quillEditorQiniu .avatar-uploader input').click() |
| | | } else { |
| | | this.quill.format('image', false); |
| | | } |
| | | }, |
| | | 'video': function (value) { |
| | | if (value) { |
| | | document.querySelector('#quillEditorQiniu .avatar-uploader input').click() |
| | | } else { |
| | | this.quill.format('video', false); |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | import Divider from '@/components/Divider/index' |
| | | // ä¸å¡ç»ä»¶ |
| | | import tenantPackage from './views/system/tenantpackage'; |
| | | //åºç¡ç»å®è¡¨åæé® |
| | | // åºç¡ç»å®è¡¨åæé® |
| | | import dynamicButton from '@/components/dynamic-components/dynamic-button' |
| | | //åºç¡å¨æå¼¹çªè¡¨åç»ä»¶ |
| | | // åºç¡å¨æå¼¹çªè¡¨åç»ä»¶ |
| | | import dynamicTableForm from '@/components/dynamic-components/dynamic-table-form' |
| | | //åºå®è¡¨åç»ä»¶ |
| | | // åºå®è¡¨åç»ä»¶ |
| | | import dynamicForm from '@/components/dynamic-components/dynamic-form' |
| | | //坿æ¬ç»ä»¶ |
| | | // 坿æ¬ç»ä»¶ |
| | | import richText from '@/components/PLT-basic-component/richText' |
| | | // ä¸ä¼ æä»¶ç»ä»¶ |
| | | import UploadFiles from '@/components/PLT-basic-component/Upload-files' |
| | | // 表åä¸ä¼ æä»¶ç»ä»¶ |
| | | import formUpload from "@/components/PLT-basic-component/formUpload"; |
| | | // 注åå
¨å±å®¹å¨ |
| | | Vue.component('basicContainer', basicContainer); |
| | | Vue.component('basicBlock', basicBlock); |
| | |
| | | Vue.component('dynamicForm', dynamicForm); |
| | | Vue.component('richText', richText); |
| | | Vue.component('UploadFiles', UploadFiles); |
| | | Vue.component('formUpload', formUpload); |
| | | Vue.component('Divider', Divider); |
| | | |
| | | import 'quill/dist/quill.core.css' |
| | |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä¸ºå¯¹è±¡å¹¶ä¸ä¸ºç©ºå¯¹è±¡ |
| | | * @param value |
| | | * @returns {Boolean} |
| | | */ |
| | | static isValuableObj(value) { |
| | | return typeof value === 'object' && value !== null && Object.keys(value).length > 0; |
| | | } |
| | | |
| | | /** |
| | | * è·åæµæä»¶è¿è¡æä»¶ä¸ |
| | | * @param value |
| | | * @returns {Boolean} |
| | | */ |
| | | static downloadFileByBlobHandler(res) { |
| | | if (res.headers['content-disposition']) { |
| | | const fileNames = res.headers['content-disposition'].split(";"); |
| | | let characterSet = fileNames[2].split("filename*=")[1]; |
| | | let fileName = decodeURI(fileNames[1].split("filename=")[1], characterSet); // ä¸è½½çæä»¶å |
| | | let blob = new Blob([res.data], { |
| | | type: res.data.type + ";charset=utf-8", |
| | | }); |
| | | const url = URL.createObjectURL(blob); // çæä¸è½½é¾æ¥ |
| | | const link = document.createElement("a"); |
| | | link.href = url; |
| | | link.download = fileName; // æå®æä»¶ååæ ¼å¼ |
| | | document.body.appendChild(link); // æ·»å ä¸è½½é¾æ¥å°é¡µé¢ |
| | | link.click(); // 触åä¸è½½ |
| | | document.body.removeChild(link); //å é¤ä¸è½½ |
| | | window.URL.revokeObjectURL(url); //éæ¾æblob对象 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åæµæä»¶è¿è¡æä»¶ä¸ |
| | | * @param value |
| | | * @returns {Boolean} |
| | | */ |
| | | static downloadFileByBlob(blobData, name) { |
| | | const url = URL.createObjectURL(blobData); // çæä¸è½½é¾æ¥ |
| | | const link = document.createElement("a"); |
| | | link.href = url; |
| | | link.download = name; // æå®æä»¶ååæ ¼å¼ |
| | | document.body.appendChild(link); // æ·»å ä¸è½½é¾æ¥å°é¡µé¢ |
| | | link.click(); // 触åä¸è½½ |
| | | document.body.removeChild(link); //å é¤ä¸è½½ |
| | | } |
| | | |
| | | /** |
| | | * å°æ°ç»ä¸ç屿§æ¼æ¥æå符串 |
| | | * @param {æ°ç»} array |
| | | * @param {屿§} attr |
| | | * @returns |
| | | */ |
| | | static joinedString(array, attr) { |
| | | return array.reduce((accumulator, item) => { |
| | | return accumulator + (accumulator ? ',' : '') + item[attr]; |
| | | }, ''); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¯¹æ°ç»ä¸ç对象çæä¸ªå±æ§æ¯å¦å
¨é¨ä¸è´ |
| | | * @param {æ°ç»} array |
| | | * @param {屿§} attr |
| | | * @returns ä¸è´è¿åfasle,ä¸ä¸è´è¿åtrue |
| | | */ |
| | | static isAttrInconsistent(array, attr) { |
| | | return Object.values(array).some((item, index, array) => { |
| | | return item[attr] !== array[0][attr]; |
| | | }); |
| | | } |
| | | } |
| | | |
| | |
| | | <template> |
| | | <div id='quillEditorQiniu'> |
| | | <el-button @click="visible = true">ä¸ä¼ æä»¶</el-button> |
| | | <!-- åºäºelementUiçä¸ä¼ ç»ä»¶ el-upload begin--> |
| | | <el-upload |
| | | :accept="'image'" |
| | | :action="uploadImgUrl" |
| | | :before-upload="beforeEditorUpload" |
| | | :headers="headers" |
| | | :on-error="uploadEditorError" |
| | | :on-success="uploadEditorSuccess" |
| | | :show-file-list="false" |
| | | class="avatar-uploader"> |
| | | </el-upload> |
| | | <!-- åºäºelementUiçä¸ä¼ ç»ä»¶ el-upload end--> |
| | | <quill-editor ref="customQuillEditor" v-model="content" :options="editorOption" class="editor"> |
| | | </quill-editor> |
| | | <el-button @click="textVisible = true">坿æ¬ç¼è¾</el-button> |
| | | <UploadFiles :visible.sync="visible"></UploadFiles> |
| | | <rich-text :visible.sync="textVisible"></rich-text> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getToken} from "@/util/auth"; |
| | | |
| | | const toolbarOptions = [ |
| | | ['bold', 'italic', 'underline', 'strike'], // å ç² æä½ ä¸å线 å é¤çº¿ |
| | | ['blockquote', 'code-block'], // å¼ç¨ 代ç å |
| | | [{header: 1}, {header: 2}], // 1ã2 级æ é¢ |
| | | [{list: 'ordered'}, {list: 'bullet'}], // æåºãæ åºå表 |
| | | [{script: 'sub'}, {script: 'super'}], // 䏿 /䏿 |
| | | [{indent: '-1'}, {indent: '+1'}], // ç¼©è¿ |
| | | [{size: ['small', false, 'large', 'huge']}], // åä½å¤§å° |
| | | [{header: [1, 2, 3, 4, 5, 6, false]}], // æ é¢ |
| | | [{color: []}, {background: []}], // åä½é¢è² åä½èæ¯é¢è² |
| | | [{font: []}], // åä½ç§ç±» |
| | | [{align: []}], // 坹齿¹å¼ |
| | | ['link', 'image'], // 龿¥ å¾ç |
| | | ['clean'] // æ¸
é¤ææ¬æ ¼å¼ |
| | | ]; |
| | | export default { |
| | | data() { |
| | | return { |
| | | visible: false, |
| | | headers: { |
| | | Authorization: "Bearer " + getToken(), |
| | | }, |
| | | uploadImgUrl: "/v1/admin/common/upload", |
| | | uploadUrlPath: "没ææä»¶ä¸ä¼ ", |
| | | quillUpdateImg: false, |
| | | content: '', //æç»ä¿åçå
容 |
| | | editorOption: { |
| | | theme: 'snow', |
| | | placeholder: '请è¾å
¥å
容', |
| | | modules: { |
| | | toolbar: { |
| | | container: toolbarOptions, // å·¥å
·æ |
| | | handlers: { |
| | | image: function (value) { |
| | | if (value) { |
| | | document.querySelector('#quillEditorQiniu .avatar-uploader input').click() |
| | | } else { |
| | | this.quill.format('image', false); |
| | | } |
| | | }, |
| | | link: function (value) { |
| | | if (value) { |
| | | const href = prompt('请è¾å
¥é¾æ¥å°åï¼'); |
| | | this.quill.format('link', href) |
| | | } else { |
| | | this.quill.format('link', false) |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | textVisible:false, |
| | | } |
| | | }, |
| | | methods: { |
| | | //ä¸ä¼ å¾çä¹åasync |
| | | beforeEditorUpload(file) { |
| | | const isJPG = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif' |
| | | if (!isJPG) { |
| | | this.$message.error('ä¸ä¼ å¾çåªè½æ¯ JPGï¼PNG, GIF æ ¼å¼!') |
| | | } else { |
| | | //æ¾ç¤ºä¸ä¼ å¨ç» |
| | | this.quillUpdateImg = true; |
| | | } |
| | | }, |
| | | // ä¸ä¼ å¾çæå |
| | | uploadEditorSuccess(res, file) { |
| | | console.log("ä¸ä¼ æå") |
| | | // this.$emit('upload',res, file) |
| | | console.log(res, file); |
| | | //æ¼æ¥åºä¸ä¼ çå¾ç卿å¡å¨ç宿´å°å |
| | | let imgUrl = res.data.url; |
| | | let type = imgUrl.substring(imgUrl.lastIndexOf(".") + 1); |
| | | console.log(type); |
| | | // è·å坿æ¬ç»ä»¶å®ä¾ |
| | | let quill = this.$refs.customQuillEditor.quill; |
| | | // è·åå
æ æå¨ä½ç½® |
| | | let length = quill.getSelection().index; |
| | | // æå
¥å¾ç||è§é¢ res.info为æå¡å¨è¿åçå¾çå°å |
| | | if (type == 'mp4' || type == 'MP4') { |
| | | quill.insertEmbed(length, 'video', imgUrl) |
| | | } else { |
| | | quill.insertEmbed(length, 'image', imgUrl) |
| | | } |
| | | // è°æ´å
æ å°æå |
| | | quill.setSelection(length + 1) |
| | | //åæ¶ä¸ä¼ å¨ç» |
| | | this.quillUpdateImg = false; |
| | | }, |
| | | // ä¸ä¼ (æä»¶)å¾ç失败 |
| | | uploadEditorError(res, file) { |
| | | console.log(res); |
| | | console.log(file); |
| | | //é¡µé¢æç¤º |
| | | this.$message.error('ä¸ä¼ å¾ç失败') |
| | | //åæ¶ä¸ä¼ å¨ç» |
| | | this.quillUpdateImg = false; |
| | | }, |
| | | //ä¸ä¼ ç»ä»¶è¿åçç»æ |
| | | uploadResult: function (res) { |
| | | this.uploadUrlPath = res; |
| | | }, |
| | | openContent: function () { |
| | | console.log(this.content) |
| | | }, |
| | | |
| | | }, |
| | | methods: {}, |
| | | created() { |
| | | |
| | | }, |
| | | //åªæ§è¡ä¸æ¬¡ï¼å è½½æ§è¡ |
| | | |
| | | mounted() { |
| | | console.log("å¼å§å è½½") |
| | | // åå§ç»ç¼è¾å¨è®¾ç½®title |
| | | }, |
| | | watch: { |
| | | content(newVal, oldVal) { |
| | | //this.$emit('input', newVal); |
| | | console.log(newVal) |
| | | console.log(oldVal) |
| | | } |
| | | }, |
| | | watch: {}, |
| | | |
| | | |
| | | } |
| | |
| | | <template> |
| | | <basic-container> |
| | | æµè¯èªå®ä¹ç»ä»¶å±ç¤º222222222 |
| | | <div :id="'UI-dynamic-'+areasName+componentVO.oid" class="UI-dynamic"> |
| | | <avue-form v-model="form" :option="option"> |
| | | <template v-for="item in slotData" :slot="item.prop + 'Label'"> |
| | | <span> |
| | | <span>{{ item.label }} </span> |
| | | <el-tooltip |
| | | v-if="item.keyAttr" |
| | | class="item" |
| | | content="è¯¥å±æ§ä¸ºå
³é®å±æ§" |
| | | effect="dark" |
| | | placement="top-start" |
| | | > |
| | | <i class="el-icon-star-on" style="font-size: 17px !important; color: red;vertical-align: baseline;"></i> |
| | | </el-tooltip> |
| | | </span> |
| | | </template> |
| | | <template slot="menuForm"> |
| | | <dynamic-button :butttonList="componentVO.buttons" type="form" @buttonClick="buttonClick"></dynamic-button> |
| | | </template> |
| | | |
| | | <template v-for="item in slotData" :slot="item.prop + ''"> |
| | | <!-- åç
§ --> |
| | | <vciWebRefer v-if="item.type == 'refer'" |
| | | :key="item.prop" |
| | | :ref="'referFormRef'+item.prop" |
| | | :data-key="item.prop" |
| | | :disabled="item.disabled || false" |
| | | :display="item.display || true" |
| | | :referConfig="item.referConfig || {}" |
| | | :reloadFormKey="(item.referConfig.useFormKey && item.referConfig.formValues && item.referConfig.formValues[item.referConfig.useFormKey]) || ''" |
| | | :text="item.referConfig.showProp" |
| | | :value="item.prop || item.value" |
| | | referType="master" |
| | | @setReferValue="setReferValue"> |
| | | |
| | | </vciWebRefer> |
| | | <!-- å¯ææ¬æ§ä»¶ --> |
| | | <rich-text v-if="item.type === 'richText'" :value="form[subitemName]" @input="form[subitemName] = $event"></rich-text> |
| | | <!-- 表åä¸ä¼ æä»¶ç»ä»¶ --> |
| | | <form-upload v-if="item.type === 'upload'"></form-upload> |
| | | </template> |
| | | </avue-form> |
| | | </div> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import VciWebRefer from "@/components/refer/vciWebRefer"; |
| | | import {verifyNull, verifySlash} from "@/util/validate"; |
| | | |
| | | export default { |
| | | name: "test2" |
| | | name: "test2", |
| | | components: {VciWebRefer}, |
| | | props: { |
| | | componentVO: { |
| | | type: Object, |
| | | default: {} |
| | | }, |
| | | inDialog: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | areasName: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | sourceData: { |
| | | //æå±åºåçä¸ä¸åºåé䏿°æ® |
| | | type: Object, |
| | | default: {} |
| | | }, |
| | | dataStore: { |
| | | //å¼¹çªæ¶æé®æå±åºåé䏿°æ® |
| | | type: Array, |
| | | default: [] |
| | | }, |
| | | paramVOS: { |
| | | type: Object, |
| | | default: {} |
| | | }, |
| | | isShow: { |
| | | //æå¨åºåæ¯å¦å·²æ¾ç¤ºï¼é对tabåcollapse |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | formDefine: { |
| | | "formDefineVO": { |
| | | "btmType": "material", |
| | | "columnOneRow": 3, |
| | | "freeMarkerEls": [], |
| | | "id": "materialform", |
| | | "items": [ |
| | | { |
| | | "comboxKey": null, |
| | | "customClass": null, |
| | | "data": null, |
| | | "dateFormate": null, |
| | | "defaultValue": "", |
| | | "displayExtension": "", |
| | | "extendAttrMap": null, |
| | | "extendAttrString": null, |
| | | "field": "id", |
| | | "hidden": false, |
| | | "keyAttr": false, |
| | | "prefix": null, |
| | | "readOnly": false, |
| | | "referConfig": null, |
| | | "required": true, |
| | | "selectLibFlag": null, |
| | | "showField": null, |
| | | "suffix": null, |
| | | "text": "ææä»£ç ", |
| | | "tooltips": null, |
| | | "type": "text", |
| | | "unique": false, |
| | | "verify": "" |
| | | }, |
| | | { |
| | | "comboxKey": null, |
| | | "customClass": null, |
| | | "data": null, |
| | | "dateFormate": null, |
| | | "defaultValue": "", |
| | | "displayExtension": "", |
| | | "extendAttrMap": null, |
| | | "extendAttrString": null, |
| | | "field": "name", |
| | | "hidden": false, |
| | | "keyAttr": false, |
| | | "prefix": null, |
| | | "readOnly": false, |
| | | "referConfig": null, |
| | | "required": true, |
| | | "selectLibFlag": null, |
| | | "showField": null, |
| | | "suffix": null, |
| | | "text": "ææåç§°", |
| | | "tooltips": null, |
| | | "type": "text", |
| | | "unique": false, |
| | | "verify": "" |
| | | }, |
| | | { |
| | | "comboxKey": null, |
| | | "customClass": null, |
| | | "data": null, |
| | | "dateFormate": null, |
| | | "defaultValue": "", |
| | | "displayExtension": "", |
| | | "extendAttrMap": null, |
| | | "extendAttrString": null, |
| | | "field": "specification", |
| | | "hidden": false, |
| | | "keyAttr": false, |
| | | "prefix": null, |
| | | "readOnly": false, |
| | | "referConfig": null, |
| | | "required": false, |
| | | "selectLibFlag": null, |
| | | "showField": null, |
| | | "suffix": null, |
| | | "text": "è§æ ¼åæ å", |
| | | "tooltips": null, |
| | | "type": "text", |
| | | "unique": false, |
| | | "verify": "" |
| | | }, |
| | | { |
| | | "comboxKey": null, |
| | | "customClass": null, |
| | | "data": null, |
| | | "dateFormate": null, |
| | | "defaultValue": "", |
| | | "displayExtension": "", |
| | | "extendAttrMap": null, |
| | | "extendAttrString": null, |
| | | "field": "materialtrademark", |
| | | "hidden": false, |
| | | "keyAttr": false, |
| | | "prefix": null, |
| | | "readOnly": false, |
| | | "referConfig": null, |
| | | "required": false, |
| | | "selectLibFlag": null, |
| | | "showField": null, |
| | | "suffix": null, |
| | | "text": "ææçå·åæ å", |
| | | "tooltips": null, |
| | | "type": "text", |
| | | "unique": false, |
| | | "verify": "" |
| | | }, |
| | | { |
| | | "comboxKey": null, |
| | | "customClass": null, |
| | | "data": null, |
| | | "dateFormate": null, |
| | | "defaultValue": "", |
| | | "displayExtension": "", |
| | | "extendAttrMap": null, |
| | | "extendAttrString": null, |
| | | "field": "technicalrequirement", |
| | | "hidden": false, |
| | | "keyAttr": false, |
| | | "prefix": null, |
| | | "readOnly": false, |
| | | "referConfig": null, |
| | | "required": false, |
| | | "selectLibFlag": null, |
| | | "showField": null, |
| | | "suffix": null, |
| | | "text": "ææ¯è¦æ±", |
| | | "tooltips": null, |
| | | "type": "text", |
| | | "unique": false, |
| | | "verify": "" |
| | | }, |
| | | { |
| | | "comboxKey": null, |
| | | "customClass": null, |
| | | "data": null, |
| | | "dateFormate": null, |
| | | "defaultValue": "", |
| | | "displayExtension": "", |
| | | "extendAttrMap": null, |
| | | "extendAttrString": null, |
| | | "field": "classofexpenditure", |
| | | "hidden": false, |
| | | "keyAttr": false, |
| | | "prefix": null, |
| | | "readOnly": false, |
| | | "referConfig": { |
| | | showProp: "userIdName", |
| | | type: 'user', |
| | | extraParams: { |
| | | aaa: '111' |
| | | },//æ¥è¯¢æ¡ä»¶ï¼å¯é |
| | | paramForFormKey: 'formDeptId', //使ç¨è¡¨åä¸çæ°æ®ä½ä¸ºæ¥è¯¢æ¡ä»¶åæ°,æ²¡ææ¶ä½¿ç¨useFormKey |
| | | formValuesKey: 'ruleForm',//页é¢ä¸çè¡¨åæ°æ®å¯¹è±¡åç§°ï¼é»è®¤å¼âformâ |
| | | useFormKey: 'deptId',//éè¦ä»formValuesä¸è·åç表ååæ®µ,æ ¹æ®é¨é¨æ åç
§é䏿°æ®å¨ææ¥è¯¢ç¨æ· |
| | | isMuti: true,//æ¯å¦å¤éï¼å¯é |
| | | width: '1000px', |
| | | referBusCode: "user", |
| | | mapProps: { |
| | | 'personClassifyText': 'personClassify' |
| | | }, |
| | | defalutValue: '1', //åç
§é»è®¤å¼ |
| | | defalutText: 'æµè¯é»è®¤å¼' //åç
§é»è®¤æ¾ç¤ºå¼ |
| | | }, |
| | | "required": false, |
| | | "selectLibFlag": null, |
| | | "showField": null, |
| | | "suffix": null, |
| | | "text": "æ¶èåç±»", |
| | | "tooltips": null, |
| | | "type": "refer", |
| | | "unique": false, |
| | | "verify": "" |
| | | }, |
| | | { |
| | | "comboxKey": null, |
| | | "customClass": null, |
| | | "data": null, |
| | | "dateFormate": null, |
| | | "defaultValue": "", |
| | | "displayExtension": "", |
| | | "extendAttrMap": null, |
| | | "extendAttrString": null, |
| | | "field": "measurementunit", |
| | | "hidden": false, |
| | | "keyAttr": false, |
| | | "prefix": null, |
| | | "readOnly": false, |
| | | "referConfig": null, |
| | | "required": false, |
| | | "selectLibFlag": null, |
| | | "showField": null, |
| | | "suffix": null, |
| | | "text": "计éåä½", |
| | | "tooltips": null, |
| | | "type": "upload", |
| | | "unique": false, |
| | | "verify": "", |
| | | "uploadList":['.png','.xls','.'] |
| | | }, |
| | | { |
| | | "comboxKey": null, |
| | | "customClass": null, |
| | | "data": null, |
| | | "dateFormate": null, |
| | | "defaultValue": "", |
| | | "displayExtension": "", |
| | | "extendAttrMap": null, |
| | | "extendAttrString": null, |
| | | "field": "description", |
| | | "hidden": false, |
| | | "keyAttr": false, |
| | | "prefix": null, |
| | | "readOnly": false, |
| | | "referConfig": null, |
| | | "required": false, |
| | | "selectLibFlag": null, |
| | | "showField": null, |
| | | "suffix": null, |
| | | "text": "夿³¨", |
| | | "tooltips": null, |
| | | "type": "richText", |
| | | "unique": false, |
| | | "verify": "" |
| | | } |
| | | ], |
| | | "linkTypeFlag": false, |
| | | "oid": "ED51077B-253F-2AB9-A0E6-BA289052B03C", |
| | | "queryTemplateName": "" |
| | | }, |
| | | "id": null, |
| | | "lastModifier": null, |
| | | "lastModifyTime": null, |
| | | "lastR": null, |
| | | "lastV": null, |
| | | "lcStatus": null, |
| | | "lcStatusText": null, |
| | | "lctid": null, |
| | | "name": "è¡¨åæ¾ç¤º", |
| | | "nameOid": null, |
| | | "oid": "88BF207E-6F02-8E76-5086-5061DBD35A98", |
| | | "orderNum": 1, |
| | | "owner": null, |
| | | "pkLayout": "0D6C19B4-4C8B-F540-7441-2ABAFE606031", |
| | | "revisionOid": null, |
| | | "revisionRule": null, |
| | | "revisionSeq": 0, |
| | | "revisionValue": null, |
| | | "secretGrade": null, |
| | | "secretGradeText": null, |
| | | "tableDefineVO": null, |
| | | "treeDefineVO": null, |
| | | "treeTableDefineVO": null, |
| | | "ts": null, |
| | | "uiComponentType": "form", |
| | | "uiComponentTypeText": "表å", |
| | | "uiParseClass": "", |
| | | "versionRule": null, |
| | | "versionSeq": 0, |
| | | "versionValue": null |
| | | }, |
| | | form: { |
| | | }, |
| | | subitemName:'' |
| | | } |
| | | }, |
| | | computed: { |
| | | option() { |
| | | return { |
| | | submitBtn: false, |
| | | emptyBtn: false, |
| | | height: 300, |
| | | column: this.getColumnData() |
| | | } |
| | | }, |
| | | slotData() { |
| | | return this.getColumnData() |
| | | } |
| | | }, |
| | | watch: { |
| | | slotData: { |
| | | handler(newV) { |
| | | this.getDictList(newV) |
| | | }, |
| | | immediate: true, |
| | | }, |
| | | form: { |
| | | handler(val) { |
| | | if (val) { |
| | | if (Array.isArray(val)) { // æ£æ¥ val æ¯å¦ä¸ºæ°ç» |
| | | for (let code of val) { |
| | | if ( |
| | | code.type == "refer" && |
| | | code.referConfig && |
| | | code.referConfig.useFormKey |
| | | ) { |
| | | code.referConfig.formValues = val; |
| | | // code.referConfigTemp.options = code.referConfig; |
| | | } |
| | | } |
| | | } else if (typeof val === 'object') { // æ£æ¥ val æ¯å¦ä¸ºå¯¹è±¡ |
| | | // è¿ä»£å¯¹è±¡çé»è¾ |
| | | } |
| | | this.$emit("input", val); |
| | | } |
| | | }, |
| | | deep: true, |
| | | immediate: true, |
| | | }, |
| | | sourceData: { |
| | | handler(newval) { |
| | | //æºæ°æ®æååæ¶åæ´å½ååºåæ°æ® |
| | | console.log(this.areasName); |
| | | console.log(newval); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | //è½¬åæ°æ® |
| | | formColumn(formList) { |
| | | return formList.map(item => { |
| | | const typeValue = item.type === 'text' ? 'input' : item.type === 'combox' ? 'select' : item.type; |
| | | if(item.type === 'richText'){ |
| | | this.subitemName = item.field; |
| | | }else if(item.type === 'upload'){ |
| | | |
| | | } |
| | | |
| | | |
| | | return { |
| | | label: item.text, |
| | | prop: item.field, |
| | | type: typeValue, |
| | | labelWidth: item.text.length >= 6 ? 115 : 90, |
| | | value: item.defaultValue, |
| | | dicData: item.type === 'combox' ? item.dicData : item.dicUrl, |
| | | readonly: item.readOnly, |
| | | disabled: item.disabled, |
| | | display: !item.hidden, |
| | | labelSuffix: item.suffix, |
| | | suffixIcon: item.prefix, |
| | | placeholder: item.placeholder, |
| | | clearable: item.clearable, |
| | | tip: item.tooltips, |
| | | keyAttr: item.keyAttr, |
| | | referConfig: item.referConfig, |
| | | rules: [{ |
| | | required: item.required, |
| | | message: `请è¾å
¥${item.text}!`, |
| | | trigger: "blur" |
| | | }] |
| | | }; |
| | | }); |
| | | }, |
| | | |
| | | //æ°æ®å¤ç©º |
| | | getColumnData() { |
| | | if (this.formDefine && this.formDefine.formDefineVO && this.formDefine.formDefineVO.items && this.formDefine.formDefineVO.items.length > 0) { |
| | | return this.formColumn(this.formDefine.formDefineVO.items) |
| | | } else { |
| | | return null; |
| | | } |
| | | }, |
| | | |
| | | buttonClick(item) { |
| | | console.log(item.id) |
| | | }, |
| | | async getDictList(val) { |
| | | for (let code of val) { |
| | | if (!verifyNull(code.dictData) && code.type == "select") { |
| | | if ( |
| | | verifySlash(code.dictCode) && |
| | | Object.prototype.hasOwnProperty.call(code, "dictCode") |
| | | ) { |
| | | const res = await getlistByCode(code.dictCode); |
| | | if (res.success) { |
| | | const dic = res.data; |
| | | code.dictData = dic.map((d) => { |
| | | return { |
| | | label: d.name, |
| | | key: d.code, |
| | | value: d.id, |
| | | }; |
| | | }); |
| | | } |
| | | } else { |
| | | this.getDicts(code.dictCode) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | const dic = res.obj.datas; |
| | | code.dictData = dic.map((d) => { |
| | | return { |
| | | label: d.name, |
| | | key: d.code, |
| | | value: d.code, |
| | | }; |
| | | }); |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | this.$message.error(` æ°æ®åå
¸${code.dictCode}é误`); |
| | | }); |
| | | } |
| | | } |
| | | if (code.type == "refer") { |
| | | if (code.referConfig && code.referConfig.useFormKey) { |
| | | if (verifyNull(code.referConfig.formValuesKey)) { |
| | | code.referConfig.formValuesKey = "form"; |
| | | } |
| | | code.referConfig.formValues = this[code.referConfig.formValuesKey]; |
| | | } |
| | | code.referConfigTemp = { |
| | | title: code.label, |
| | | showProp: |
| | | code.showProp || code.referConfig.showProp || code.prop + "Name", |
| | | prop: code.prop, |
| | | propMap: code.propMap || {}, |
| | | placeholder: code.placeholder |
| | | ? code.placeholder |
| | | : ` è¯·éæ©` + code.label, |
| | | options: code.referConfig, |
| | | }; |
| | | } |
| | | } |
| | | this.formTemplateData = val; |
| | | }, |
| | | setReferValue(data) { |
| | | if (data && data.prop) { |
| | | this.form[data.prop] = data.value || ""; |
| | | this.form[data.showProp] = data.text || ""; |
| | | if (data.propMap) { |
| | | //说æéè¦æ å° |
| | | for (let key in data.propMap) { |
| | | let mapFields = data.propMap[key].split(","); |
| | | let value = []; |
| | | data.rawData.forEach((_item) => { |
| | | var temp; |
| | | if (!_item.extendData) { |
| | | _item.extendData = {}; |
| | | } |
| | | if (mapFields.length == 1) { |
| | | var mapField = mapFields[0]; |
| | | temp = _item[mapField] || _item["extendData"][mapField]; |
| | | } else { |
| | | //æå¤ä¸ª |
| | | var mutiTemp = []; |
| | | mapFields.forEach((_itemField) => { |
| | | mutiTemp.push( |
| | | _item[_itemField] || _item["extendData"][_itemField] |
| | | ); |
| | | }); |
| | | temp = mutiTemp.join(" "); |
| | | } |
| | | if (temp != null && temp != "") { |
| | | value.push(temp); |
| | | } |
| | | }); |
| | | this.form[key] = value.join(","); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |