diff --git a/src/components/Charts/Keyboard.vue b/src/components/Charts/Keyboard.vue new file mode 100644 index 0000000..0b258f3 --- /dev/null +++ b/src/components/Charts/Keyboard.vue @@ -0,0 +1,155 @@ + + + diff --git a/src/components/Charts/LineMarker.vue b/src/components/Charts/LineMarker.vue new file mode 100644 index 0000000..3dd7436 --- /dev/null +++ b/src/components/Charts/LineMarker.vue @@ -0,0 +1,227 @@ + + + diff --git a/src/components/Charts/MixChart.vue b/src/components/Charts/MixChart.vue new file mode 100644 index 0000000..c416542 --- /dev/null +++ b/src/components/Charts/MixChart.vue @@ -0,0 +1,271 @@ + + + diff --git a/src/components/Charts/Normal.vue b/src/components/Charts/Normal.vue new file mode 100644 index 0000000..d648a37 --- /dev/null +++ b/src/components/Charts/Normal.vue @@ -0,0 +1,72 @@ + + + diff --git a/src/components/Charts/mixins/resize.js b/src/components/Charts/mixins/resize.js new file mode 100644 index 0000000..b1e76e9 --- /dev/null +++ b/src/components/Charts/mixins/resize.js @@ -0,0 +1,56 @@ +import { debounce } from '@/utils' + +export default { + data() { + return { + $_sidebarElm: null, + $_resizeHandler: null + } + }, + mounted() { + this.initListener() + }, + activated() { + if (!this.$_resizeHandler) { + // avoid duplication init + this.initListener() + } + + // when keep-alive chart activated, auto resize + this.resize() + }, + beforeDestroy() { + this.destroyListener() + }, + deactivated() { + this.destroyListener() + }, + methods: { + // use $_ for mixins properties + // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential + $_sidebarResizeHandler(e) { + if (e.propertyName === 'width') { + this.$_resizeHandler() + } + }, + initListener() { + this.$_resizeHandler = debounce(() => { + this.resize() + }, 100) + window.addEventListener('resize', this.$_resizeHandler) + + this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0] + this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler) + }, + destroyListener() { + window.removeEventListener('resize', this.$_resizeHandler) + this.$_resizeHandler = null + + this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler) + }, + resize() { + const { chart } = this + chart && chart.resize() + } + } +} diff --git a/src/components/ColumnSettings/index.vue b/src/components/ColumnSettings/index.vue new file mode 100644 index 0000000..faf66be --- /dev/null +++ b/src/components/ColumnSettings/index.vue @@ -0,0 +1,46 @@ + + + + \ No newline at end of file diff --git a/src/components/CompanyForm/index.vue b/src/components/CompanyForm/index.vue index 962b2a4..3210517 100644 --- a/src/components/CompanyForm/index.vue +++ b/src/components/CompanyForm/index.vue @@ -66,7 +66,7 @@ 取消 - 确认 + 确认 @@ -79,35 +79,36 @@ export default { props: {}, data() { return { - visible: false, - loading: false, - dataForm: { - id: '', - id: undefined, - companyName: undefined, - socialCreditAgency: undefined, - legalPerson: undefined, - address: undefined, - contactInformation: undefined, - qualificationCertificate: [], - otherInfo: undefined, - }, - rules: { - companyName: [ - { - required: true, - message: '请输入公司名称', - trigger: 'blur' - }, - ], - contactInformation: [ - { - pattern: /^1[3456789]\d{9}$|^0\d{2,3}-?\d{7,8}$/, - message: '请输入正确的联系方式', - trigger: 'blur' - }, - ], - }, + visible: false, + loading: false, + dataForm: { + id: '', + id: undefined, + companyName: undefined, + socialCreditAgency: undefined, + legalPerson: undefined, + address: undefined, + contactInformation: undefined, + qualificationCertificate: [], + otherInfo: undefined, + }, + rules: { + companyName: [ + { + required: true, + message: '请输入公司名称', + trigger: 'blur' + }, + ], + contactInformation: [ + { + pattern: /^1[3456789]\d{9}$|^0\d{2,3}-?\d{7,8}$/, + message: '请输入正确的联系方式', + trigger: 'blur' + }, + ], + }, + btnLoading: false }; }, watch: {}, @@ -122,25 +123,27 @@ export default { this.$refs['elForm'].resetFields(); }, async confirm() { - this.$refs['elForm'].validate((valid) => { - if (valid) { - request({ - url: `/Extend/BaseComapnyInfo`, - method: 'post', - data: this.dataForm, - }).then((res) => { - this.$message({ - message: res.msg, - type: 'success', - duration: 1000, - onClose: () => { - this.visible = false, - this.$emit('refresh', true) - } - }) - }) - }}) - + this.$refs['elForm'].validate((valid) => { + if (valid) { + this.btnLoading = true; + request({ + url: `/Extend/BaseComapnyInfo`, + method: 'post', + data: this.dataForm, + }).then((res) => { + this.btnLoading = false; + this.$message({ + message: res.msg, + type: 'success', + duration: 1000, + onClose: () => { + this.visible = false, + this.$emit('refresh', true) + } + }) + }).catch(() => {this.btnLoading = false}) + } + }) }, }, }; diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue new file mode 100644 index 0000000..abc993d --- /dev/null +++ b/src/components/Hamburger/index.vue @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/src/components/HeaderSearch/index.vue b/src/components/HeaderSearch/index.vue new file mode 100644 index 0000000..d901d84 --- /dev/null +++ b/src/components/HeaderSearch/index.vue @@ -0,0 +1,187 @@ + + + + + diff --git a/src/components/InfoForm/index.vue b/src/components/InfoForm/index.vue index a336adb..2bd0d98 100644 --- a/src/components/InfoForm/index.vue +++ b/src/components/InfoForm/index.vue @@ -220,7 +220,7 @@ 取消 - 确认 + 确认 @@ -312,6 +312,7 @@ export default { systemTypeOptions: [], systemClassOptions: [], areaOptions: [], + btnLoading: false, }; }, watch: {}, @@ -388,6 +389,7 @@ export default { async confirm() { this.$refs["infoForm"].validate((valid) => { if (valid) { + this.btnLoading = true; switch (this.type) { case "add": addSystem(this.infoForm).then((res) => { @@ -395,9 +397,10 @@ export default { message: "恭喜你,新增成功", type: "success", }); + this.btnLoading = false; this.$emit('reInit'); this.close(); - }); + }).catch(() => { this.btnLoading = false }); break; case "edit": this.infoForm.id = this.systemId; @@ -406,9 +409,10 @@ export default { message: "恭喜你,修改成功", type: "success", }); + this.btnLoading = false; this.$emit('reInit'); this.close(); - }); + }).catch(() => { this.btnLoading = false });; break; default: diff --git a/src/components/LangSelect/index.vue b/src/components/LangSelect/index.vue new file mode 100644 index 0000000..e8dc038 --- /dev/null +++ b/src/components/LangSelect/index.vue @@ -0,0 +1,45 @@ + + + diff --git a/src/components/MarkdownEditor/default-options.js b/src/components/MarkdownEditor/default-options.js new file mode 100644 index 0000000..303aa13 --- /dev/null +++ b/src/components/MarkdownEditor/default-options.js @@ -0,0 +1,31 @@ +// doc: https://nhnent.github.io/tui.editor/api/latest/ToastUIEditor.html#ToastUIEditor +export default { + minHeight: '200px', + previewStyle: 'vertical', + useCommandShortcut: true, + useDefaultHTMLSanitizer: true, + usageStatistics: false, + hideModeSwitch: false, + toolbarItems: [ + 'heading', + 'bold', + 'italic', + 'strike', + 'divider', + 'hr', + 'quote', + 'divider', + 'ul', + 'ol', + 'task', + 'indent', + 'outdent', + 'divider', + 'table', + 'image', + 'link', + 'divider', + 'code', + 'codeblock' + ] +} diff --git a/src/components/MarkdownEditor/index.vue b/src/components/MarkdownEditor/index.vue new file mode 100644 index 0000000..1a8a01e --- /dev/null +++ b/src/components/MarkdownEditor/index.vue @@ -0,0 +1,118 @@ + + + diff --git a/src/components/NCC-TreeTransfer/array.js b/src/components/NCC-TreeTransfer/array.js new file mode 100644 index 0000000..b1edecf --- /dev/null +++ b/src/components/NCC-TreeTransfer/array.js @@ -0,0 +1,91 @@ +/** + * auth: weilan + * github: https://github.com/hql7 + * description: 一个数组操作函数库 + */ + +// 从树形数据中递归筛选目标值 +function valInDeep(arr = [], val, id, childs) { + return arr.reduce((flat, item) => { + return flat.concat( + item[id] == val ? item : valInDeep(item[childs] || [], val, id, childs) + ); + }, []); +} + +// 将树形数据向下递归为一维数组 +function flattenDeep(arr = [], childs) { + return arr.reduce((flat, item) => { + return flat.concat( + item, + item[childs] ? flattenDeep(item[childs], childs) : [] + ); + }, []); +} + +// 将树形数据向上将此支线递归为一维数组 +function flattenDeepParents(arr, parent) { + return arr.reduce((flat, item) => { + return flat.concat( + item[parent] || [], + item[parent] ? flattenDeepParents([item[parent]], parent) : [] + ); + }, []); +} + +// 根据条件递归祖先元素 +function regDeepParents(row, parent, reg) { + if (row[parent]) { + reg && reg(row[parent]); + regDeepParents(row[parent], parent, reg); + } +} + +// 将数组转化成树结构 +function arrayToTree( + array = [], + options = { id: "id", pid: "pid", children: "children" } +) { + let array_ = []; // 创建储存剔除叶子节点后的骨架节点数组 + let unique = {}; // 创建盒子辅助本轮children合并去重 + array.forEach(item => { + // 适应el-tree-transfer 将根节点pid重置为 0 + let root = ["undefined", undefined, null].includes(item[options.pid]); + if (root) item[options.pid] = 0; + // 筛选可以插入当前节点的所有子节点 + let children_array = array.filter( + it => it[options.pid] === item[options.id] + ); + if (item.children && item.children instanceof Array) { + // 去重合并数组 + item.children.map(i => (unique[i[options.id]] = 1)); + item.children.push( + ...children_array.filter(i => unique[i[options.id]] !== 1) + ); + } else { + item.children = children_array; + } + // 当children_array有数据时插入下一轮array_,当无数据时将最后留下来的根节点树形插入数组 + let has_children = children_array.length > 0; + if ( + has_children || + (!has_children && [0, "0"].includes(item[options.pid])) + ) { + array_.push(item); + } + }); + // 当数组内仅有根节点时退出,否组继续处理 最终递归深度次 + if (!array_.every(item => [0, "0"].includes(item[options.pid]))) { + return arrayToTree(array_, options); + } else { + return array_; + } +} + +export { + valInDeep, + flattenDeep, + flattenDeepParents, + regDeepParents, + arrayToTree +}; diff --git a/src/components/NCC-TreeTransfer/index.vue b/src/components/NCC-TreeTransfer/index.vue new file mode 100644 index 0000000..b692bff --- /dev/null +++ b/src/components/NCC-TreeTransfer/index.vue @@ -0,0 +1,811 @@ + + + + + diff --git a/src/components/NCC-enlarge/index.vue b/src/components/NCC-enlarge/index.vue new file mode 100644 index 0000000..3ec56bd --- /dev/null +++ b/src/components/NCC-enlarge/index.vue @@ -0,0 +1,40 @@ + + + + + \ No newline at end of file diff --git a/src/components/NCC-tableOperation/index.vue b/src/components/NCC-tableOperation/index.vue new file mode 100644 index 0000000..a040e56 --- /dev/null +++ b/src/components/NCC-tableOperation/index.vue @@ -0,0 +1,85 @@ + + \ No newline at end of file diff --git a/src/components/NCC-topOperation/index.vue b/src/components/NCC-topOperation/index.vue new file mode 100644 index 0000000..1af18ee --- /dev/null +++ b/src/components/NCC-topOperation/index.vue @@ -0,0 +1,68 @@ + + + \ No newline at end of file diff --git a/src/components/NCC-uploadBtn/index.vue b/src/components/NCC-uploadBtn/index.vue new file mode 100644 index 0000000..4dda851 --- /dev/null +++ b/src/components/NCC-uploadBtn/index.vue @@ -0,0 +1,61 @@ + + + + \ No newline at end of file diff --git a/src/components/NCC-userBox/index.vue b/src/components/NCC-userBox/index.vue new file mode 100644 index 0000000..577eb18 --- /dev/null +++ b/src/components/NCC-userBox/index.vue @@ -0,0 +1,92 @@ + + + \ No newline at end of file diff --git a/src/components/NCC-userSelect/index.vue b/src/components/NCC-userSelect/index.vue new file mode 100644 index 0000000..8161866 --- /dev/null +++ b/src/components/NCC-userSelect/index.vue @@ -0,0 +1,220 @@ + + + + \ No newline at end of file diff --git a/src/components/NCCEditor/quill.vue b/src/components/NCCEditor/quill.vue index 6eff03f..d09bca5 100644 --- a/src/components/NCCEditor/quill.vue +++ b/src/components/NCCEditor/quill.vue @@ -1,6 +1,6 @@ + + \ No newline at end of file