Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
kanyxmo committed Mar 2, 2023
2 parents 0b3b007 + 2f36e03 commit f2d25c0
Show file tree
Hide file tree
Showing 136 changed files with 6,082 additions and 5,287 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>
<p align="center">
<img src="https://svg.hamm.cn/badge.svg?key=License&value=MIT" />
<img src="https://svg.hamm.cn/badge.svg?key=Version&value=1.0.0" />
<img src="https://svg.hamm.cn/badge.svg?key=Version&value=1.2.0" />
</p>

## 简介
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
{
"name": "mineadmin-vue",
"version": "1.1.0",
"version": "1.2.0",
"license": "MIT",
"scripts": {
"dev": "vite serve --mode development",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"vite": "^4.1.1",
"@vitejs/plugin-vue": "^4.0.0",
"@vitejs/plugin-vue-jsx": "^3.0.0",
"@arco-design/color": "^0.4.0",
"@arco-design/web-vue": "^2.42.0",
"@arco-themes/vue-mine-admin": "^0.0.11",
"@arco-design/web-vue": "^2.43.2",
"@arco-themes/vue-mine-admin-v2": "^0.0.2",
"@tinymce/tinymce-vue": "^5.0.0",
"autoprefixer": "^10.4.0",
"axios": "^0.27.2",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.2",
"default-passive-events": "^2.0.0",
"echarts": "^5.3.2",
"file2md5": "^1.3.0",
"lodash": "^4.17.21",
"monaco-editor": "^0.33.0",
"nprogress": "^0.2.0",
"pinia": "^2.0.15",
"pinia": "^2.0.30",
"postcss-import": "^14.0.2",
"qs": "^6.10.3",
"resize-observer-polyfill": "^1.5.1",
"sortablejs": "^1.15.0",
"tailwindcss": "^3.0.24",
"tinymce": "^6.1.0",
"vue": "^3.2.45",
"vue": "^3.2.47",
"vue-clipboard3": "^2.0.0",
"vue-color-kit": "^1.0.5",
"vue-echarts": "^6.0.2",
"vue-i18n": "^9.1.10",
"vue-router": "^4.1.2",
"vite": "^3.0.0",
"@vitejs/plugin-vue": "^3.1.2",
"@vitejs/plugin-vue-jsx": "^2.0.0"
"vue-router": "^4.1.6",
"vuedraggable": "^4.1.0"
},
"devDependencies": {
"less": "^4.1.3",
Expand Down
16 changes: 0 additions & 16 deletions src/assets/ma-icons/index.js

This file was deleted.

2 changes: 2 additions & 0 deletions src/components/ma-cityLinkage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<template>
<a-cascader
v-if="props.type === 'cascader'"
path-mode
v-model="val"
placeholder="请选择省市区"
:options="jsonData"
:field-names="props.mode == 'name' ? { value: 'name', label: 'name' } : { value: 'code', label: 'name' }"
check-strictly
Expand Down
62 changes: 62 additions & 0 deletions src/components/ma-colorPicker/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<template>
<a-input-group class="w-full">
<a-trigger position="bottom" trigger="click" auto-fit-position :unmount-on-close="false">
<a-button type="primary">选择颜色</a-button>
<template #content>
<ColorPicker
theme="dark"
:color="val"
:sucker-hide="true"
:colors-default="defaultColorList"
@changeColor="selectColor"
style="width: 218px;"
/>
</template>
</a-trigger>
<a-input v-model="val" :style="`color: ${val}`" readonly :placeholder="props.placeholder">
</a-input>
<a-tooltip content="复制">
<a-button @click="copyColor"><template #icon><icon-copy class="cursor-pointer" /></template></a-button>
</a-tooltip>
</a-input-group>
</template>
<script setup>
import { ref, watch, reactive } from 'vue'
import { ColorPicker } from 'vue-color-kit'
import 'vue-color-kit/dist/vue-color-kit.css'
import { generate, getRgbStr } from '@arco-design/color'
import useClipboard from 'vue-clipboard3'
import { Message } from '@arco-design/web-vue'
const val = ref()
const props = defineProps({
modelValue: String,
placeholder: { type: String, default: '请选择颜色' },
})
const selectColor = (color) => {
val.value = color.hex
}
const copyColor = async () => {
try {
await useClipboard().toClipboard(val.value)
Message.success('复制成功')
} catch(e) {
Message.error('复制失败')
}
}
const defaultColorList = reactive([
'#165DFF', '#F53F3F', '#F77234', '#F7BA1E', '#00B42A', '#14C9C9', '#3491FA',
'#722ED1', '#F5319D', '#D91AD9', '#34C759', '#43a047', '#7cb342', '#c0ca33',
'#86909c', '#6d4c41',
])
const emit = defineEmits(['update:modelValue'])
watch(
() => val.value,
vl => emit('update:modelValue', vl)
)
</script>
118 changes: 61 additions & 57 deletions src/components/ma-crud/components/column.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
<template>
<template v-for="row in props.columns" :key="row[props.options.pk]">
<template v-for="row in columns" :key="row[options.pk]">
<template v-if="!row.hide">
<a-table-column :title="row.title" v-if="row.children && row.children.length > 0">
<column
:options="props.options"
:columns="row.children"
:searchRef="props.searchRef"
:formRef="props.formRef"
:isRecovery="props.isRecovery"
:params="props.params"
@refresh="() => refresh()"
>
<column @refresh="() => refresh()" :isRecovery="props.isRecovery" :crudFormRef="props.crudFormRef" >
<template
v-for="(childRow, childIndex) in row.children"
:key="childIndex"
Expand All @@ -24,8 +16,17 @@
:title="row.title"
:data-index="row.dataIndex"
:width="row.width"
:ellipsis="true"
:tooltip="row.dataIndex === '__operation' ? false : true"
:ellipsis="row.ellipsis ?? true"
:filterable="row.filterable"
:cell-class="row.cellClass"
:header-cell-class="row.headerCellClass"
:body-cell-class="row.bodyCellClass"
:summary-cell-class="row.summaryCellClass"
:cell-style="row.cellStyle"
:header-cell-style="row.headerCellStyle"
:body-cell-style="row.bodyCellStyle"
:summary-cell-style="row.summaryCellStyle"
:tooltip="row.dataIndex === '__operation' ? false : (row.tooltip ?? true)"
:align="row.align || 'left'"
:fixed="row.fixed"
:sortable="row.sortable"
Expand All @@ -38,48 +39,47 @@
<slot name="operationCell" v-bind="{ record, column, rowIndex }">
<!-- <a-link
v-if="
props.options.see.show
&& ($common.auth(props.options.see.auth || [])
|| (props.options.see.role || []))
options.see.show
&& ($common.auth(options.see.auth || [])
|| (options.see.role || []))
"
type="primary"
><icon-eye /> {{ props.options.see.text || '查看' }}</a-link> -->

><icon-eye /> {{ options.see.text || '查看' }}</a-link> -->
<a-link
v-if="(isFunction(props.options.edit.show) ? props.options.edit.show(record):props.options.edit.show) && !props.isRecovery"
v-auth="props.options.edit.auth || []"
v-role="props.options.edit.role || []"
v-if="(isFunction(options.edit.show) ? options.edit.show(record):options.edit.show) && !props.isRecovery"
v-auth="options.edit.auth || []"
v-role="options.edit.role || []"
type="primary"
@click="editAction(record)"
>
<icon-edit /> {{ props.options.edit.text || '编辑' }}
<icon-edit /> {{ options.edit.text || '编辑' }}
</a-link>

<a-popconfirm
content="确定要恢复该数据吗?"
position="bottom"
@ok="recoveryAction(record)"
v-if="(isFunction(props.options.recovery.show) ? props.options.recovery.show(record):props.options.recovery.show) && props.isRecovery"
v-auth="props.options.recovery.auth || []"
v-role="props.options.recovery.role || []"
v-if="(isFunction(options.recovery.show) ? options.recovery.show(record):options.recovery.show) && props.isRecovery"
v-auth="options.recovery.auth || []"
v-role="options.recovery.role || []"
>
<a-link type="primary"> <icon-undo /> {{ props.options.recovery.text || '恢复' }} </a-link>
<a-link type="primary"><icon-undo /> {{ options.recovery.text || '恢复' }} </a-link>
</a-popconfirm>

<a-popconfirm
content="确定要删除该数据吗?"
position="bottom"
@ok="deleteAction(record)"
v-if="(isFunction(props.options.delete.show) ? props.options.delete.show(record):props.options.delete.show)"
v-if="(isFunction(options.delete.show) ? options.delete.show(record):options.delete.show)"
>
<a-link
type="primary"
v-auth="props.options.delete.auth || []"
v-role="props.options.delete.role || []"
v-auth="options.delete.auth || []"
v-role="options.delete.role || []"
>
<icon-delete />
{{
props.isRecovery ? props.options.delete.realText || '删除' : props.options.delete.text || '删除'
props.isRecovery ? options.delete.realText || '删除' : options.delete.text || '删除'
}}
</a-link>
</a-popconfirm>
Expand All @@ -99,7 +99,10 @@
<template v-if="row.dataIndex === '__index'">{{ getIndex(rowIndex) }}</template>

<template v-if="row.dict && row.dict.translation">
<a-tag v-if="row.dict.tagColors" :color="getTagColor(row, record)">
<template v-if="isArray(get(record, row.dataIndex))">
<a-tag v-for="item in get(record, row.dataIndex)" class="ml-1">{{ getDataIndex(row, item) }}</a-tag>
</template>
<a-tag v-else-if="row.dict.tagColors" :color="getTagColor(row, record)">
{{ getDataIndex(row, record) }}
</a-tag>
<a-tag v-else-if="row.dict.tagColor" :color="row.dict.tagColor">{{ getDataIndex(row, record) }}</a-tag>
Expand All @@ -120,29 +123,26 @@
</template>

<script setup>
import { Message } from '@arco-design/web-vue'
import { inject } from 'vue'
import config from '@/config/crud'
import { isFunction, get } from 'lodash'
import uploadConfig from '@/config/upload'
import { Message } from '@arco-design/web-vue'
import {isFunction, get, isArray, isObject} from 'lodash'
import CustomRender from '../js/custom-render'
import tool from '@/utils/tool'
import commonApi from '@/api/common'
const emit = defineEmits(['refresh', 'showImage'])
const props = defineProps({
options: Object,
searchRef: Object,
formRef: Object,
columns: Array,
params: Object,
isRecovery: Boolean,
crudFormRef: Object
})
const storageMode = {
'1': 'LOCAL',
'2': 'OSS',
'3': 'COS',
'4': 'QINIU'
}
const options = inject('options')
const columns = inject('columns')
const requestParams = inject('requestParams')
const dictTrans = inject('dictTrans')
const dictColors = inject('dictColors')
const imageSee = async (row, record) => {
if (row.returnType) {
Expand All @@ -167,7 +167,7 @@ const imageSee = async (row, record) => {
const isImage = res.data.mime_type.indexOf('image') > -1
result && emit(
'showImage',
isImage ? tool.attachUrl(res.data.url, storageMode[res.data.storage_mode]) : 'not-image.png'
isImage ? tool.attachUrl(res.data.url, uploadConfig.storageMode[res.data.storage_mode]) : 'not-image.png'
)
} else {
Expand All @@ -180,42 +180,46 @@ const imageSee = async (row, record) => {
}
const getTagColor = (row, record) => {
return props.searchRef.dictColors( row.dataIndex, (row.dataIndex.indexOf('.') > -1 ) ? get(record, row.dataIndex) : record[row.dataIndex] )
return dictColors( row.dataIndex, (row.dataIndex.indexOf('.') > -1 ) ? get(record, row.dataIndex) : record[row.dataIndex] )
}
const getDataIndex = (row, record) => {
return props.searchRef.dictTrans( row.dataIndex, (row.dataIndex.indexOf('.') > -1 ) ? get(record, row.dataIndex) : record[row.dataIndex] )
if (isObject(record)) {
return dictTrans( row.dataIndex, (row.dataIndex.indexOf('.') > -1 ) ? get(record, row.dataIndex) : record[row.dataIndex] )
}else{
return dictTrans( row.dataIndex, record)
}
}
const getIndex = rowIndex => {
const index = rowIndex + 1
if (props.params[config.request.page] == 1) {
if (requestParams[config.request.page] == 1) {
return index
} else {
return (props.params[config.request.page] - 1) * props.params[config.request.pageSize] + index
return (requestParams[config.request.page] - 1) * requestParams[config.request.pageSize] + index
}
}
const editAction = record => {
isFunction(props.options.beforeOpenEdit) && props.options.beforeOpenEdit(record)
props.formRef.edit(record)
isFunction(options.beforeOpenEdit) && options.beforeOpenEdit(record)
props.crudFormRef.edit(record)
}
const recoveryAction = async record => {
const response = await props.options.recovery.api({ ids: [record[props.options.pk]] })
const response = await options.recovery.api({ ids: [record[options.pk]] })
Message.success(response.message || `恢复成功!`)
emit('refresh')
}
const deleteAction = async record => {
let data = {}
if (props.options.beforeDelete && isFunction(props.options.beforeDelete)) {
data = props.options.beforeDelete(record)
if (options.beforeDelete && isFunction(options.beforeDelete)) {
data = options.beforeDelete(record)
}
const api = props.isRecovery ? props.options.delete.realApi : props.options.delete.api
const response = await api(Object.assign({ ids: [record[props.options.pk]] }, data))
if (props.options.afterDelete && isFunction(props.options.afterDelete)) {
props.options.afterDelete(response, record)
const api = props.isRecovery ? options.delete.realApi : options.delete.api
const response = await api(Object.assign({ ids: [record[options.pk]] }, data))
if (options.afterDelete && isFunction(options.afterDelete)) {
options.afterDelete(response, record)
}
Message.success(response.message || `删除成功!`)
emit('refresh')
Expand Down
Loading

0 comments on commit f2d25c0

Please sign in to comment.