mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-07-05 10:08:15 +08:00
@ -1,23 +1,12 @@
|
||||
<template>
|
||||
<el-table-column v-bind:="$attrs">
|
||||
<template #default="{ row }">
|
||||
<template v-for="(item, i) in options" :key="i">
|
||||
<div v-if="tool.getNestedProperty(row, this.$attrs.prop) === item.value">
|
||||
<sc-status-indicator
|
||||
:pulse="item.pulse"
|
||||
:style="item.type ? '' : `background: #${Math.abs(this.$TOOL.crypto.hashCode(item.value)).toString(16).substring(0, 6)}`"
|
||||
:type="item.type" />
|
||||
<span v-if="!$slots.default"> {{ item.text }}</span>
|
||||
<slot :row="row" :text="item.text"></slot>
|
||||
</div>
|
||||
</template>
|
||||
<slot :row="row" name="info"></slot>
|
||||
<na-indicator :data="row" :options="options" :prop="$attrs.prop" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<script>
|
||||
import tool from '@/utils/tool'
|
||||
|
||||
import naIndicator from '@/components/naIndicator/index.vue'
|
||||
export default {
|
||||
emits: [],
|
||||
props: {
|
||||
@ -28,12 +17,8 @@ export default {
|
||||
},
|
||||
mounted() {},
|
||||
created() {},
|
||||
components: {},
|
||||
computed: {
|
||||
tool() {
|
||||
return tool
|
||||
},
|
||||
},
|
||||
components: { naIndicator },
|
||||
computed: {},
|
||||
methods: {},
|
||||
}
|
||||
</script>
|
37
src/frontend/admin/src/components/naIndicator/index.vue
Normal file
37
src/frontend/admin/src/components/naIndicator/index.vue
Normal file
@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<template v-for="(item, i) in options" :key="i">
|
||||
<div v-if="tool.getNestedProperty(data, this.prop) === item.value">
|
||||
<sc-status-indicator
|
||||
:pulse="item.pulse"
|
||||
:style="item.type ? '' : `background: #${Math.abs(this.$TOOL.crypto.hashCode(item.value)).toString(16).substring(0, 6)}`"
|
||||
:type="item.type" />
|
||||
<span v-if="!$slots.default"> {{ item.text }}</span>
|
||||
<slot :data="data" :text="item.text"></slot>
|
||||
</div>
|
||||
</template>
|
||||
<slot :data="data" name="info"></slot>
|
||||
</template>
|
||||
<script>
|
||||
import tool from '@/utils/tool'
|
||||
|
||||
export default {
|
||||
emits: [],
|
||||
props: {
|
||||
options: { type: Array },
|
||||
data: { type: Object },
|
||||
prop: { type: String },
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
mounted() {},
|
||||
created() {},
|
||||
components: {},
|
||||
computed: {
|
||||
tool() {
|
||||
return tool
|
||||
},
|
||||
},
|
||||
methods: {},
|
||||
}
|
||||
</script>
|
@ -116,22 +116,55 @@
|
||||
:command="menu"
|
||||
:key="index"
|
||||
:title="`${menu}`">
|
||||
<sc-contextmenu-item :command="`${menu}^|^Equal^|^${current.row[menu]}`" title="="></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^NotEqual^|^${current.row[menu]}`" title="≠"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^GreaterThan^|^${current.row[menu]}`" divided title=">"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^GreaterThanOrEqual^|^${current.row[menu]}`" title="≥"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^LessThan^|^${current.row[menu]}`" title="<"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^LessThanOrEqual^|^${current.row[menu]}`" title="≤"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^Contains^|^${current.row[menu]}`" divided title="包含"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^NotContains^|^${current.row[menu]}`" title="不含"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^StartsWith^|^${current.row[menu]}`" divided title="以 x 开始"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^NotStartsWith^|^${current.row[menu]}`" title="非 x 开始"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^EndsWith^|^${current.row[menu]}`" title="以 x 结束"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^NotEndsWith^|^${current.row[menu]}`" title="非 x 结束"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^Range^|^${current.row[menu]}`" divided title="数值范围"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^DateRange^|^${current.row[menu]}`" title="日期范围"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^Any^|^${current.row[menu]}`" divided title="为其一"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^NotAny^|^${current.row[menu]}`" title="非其一"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^Equal^|^${tool.getNestedProperty(current.row, menu) ?? ''}`" title="="></sc-contextmenu-item>
|
||||
<sc-contextmenu-item :command="`${menu}^|^NotEqual^|^${tool.getNestedProperty(current.row, menu) ?? ''}`" title="≠"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^GreaterThan^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
divided
|
||||
title=">"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^GreaterThanOrEqual^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
title="≥"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^LessThan^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
title="<"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^LessThanOrEqual^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
title="≤"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^Contains^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
divided
|
||||
title="包含"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^NotContains^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
title="不含"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^StartsWith^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
divided
|
||||
title="以 x 开始"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^NotStartsWith^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
title="非 x 开始"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^EndsWith^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
title="以 x 结束"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^NotEndsWith^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
title="非 x 结束"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^Range^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
divided
|
||||
title="数值范围"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^DateRange^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
title="日期范围"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^Any^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
divided
|
||||
title="为其一"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item
|
||||
:command="`${menu}^|^NotAny^|^${tool.getNestedProperty(current.row, menu) ?? ''}`"
|
||||
title="非其一"></sc-contextmenu-item>
|
||||
</sc-contextmenu-item>
|
||||
<sc-contextmenu-item v-if="contextOpers.includes('view')" command="view" divided icon="el-icon-view" title="查看"></sc-contextmenu-item>
|
||||
<sc-contextmenu-item v-if="contextOpers.includes('edit')" command="edit" icon="el-icon-edit" title="编辑"></sc-contextmenu-item>
|
||||
@ -153,6 +186,7 @@ import columnSetting from './columnSetting'
|
||||
import scContextmenuItem from '@/components/scContextmenu/item.vue'
|
||||
import scContextmenu from '@/components/scContextmenu/index.vue'
|
||||
import { h } from 'vue'
|
||||
import tool from '@/utils/tool'
|
||||
|
||||
export default {
|
||||
name: 'scTable',
|
||||
@ -222,6 +256,9 @@ export default {
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
tool() {
|
||||
return tool
|
||||
},
|
||||
_height() {
|
||||
return Number(this.height) ? Number(this.height) + 'px' : this.height
|
||||
},
|
||||
@ -321,9 +358,9 @@ export default {
|
||||
try {
|
||||
value = await this.$prompt(`仅显示 ${kv[0]} ${kv[1]}:`, '高级筛选', {
|
||||
inputPlaceholder: '一行一个',
|
||||
inputPattern: /.+/,
|
||||
inputPattern: /.*/,
|
||||
inputType: 'textarea',
|
||||
inputValue: command.split('^|^')[2],
|
||||
inputValue: kv[2],
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
|
@ -85,6 +85,35 @@ axios.interceptors.response.use(
|
||||
if (response.headers['x-access-token']) {
|
||||
setCookie('X-ACCESS-TOKEN', response.headers['x-access-token'])
|
||||
}
|
||||
//此处判断是否下载请求
|
||||
if (response.headers['content-type'] === 'application/octet-stream') {
|
||||
//根据响应头获取文件名称
|
||||
console.error(response.headers['content-disposition'])
|
||||
let fileName = response.headers['content-disposition'].match(/filename\*=UTF-8''([^;]+)/)[1]
|
||||
if (fileName) {
|
||||
fileName = decodeURI(fileName)
|
||||
} else {
|
||||
//此处表示后台没有设置响应头 content-disposition,请根据业务场景自行处理
|
||||
fileName = Date.now() + 'download.txt'
|
||||
}
|
||||
const blob = new Blob([response.data], { type: 'application/octet-stream' })
|
||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
||||
window.navigator.msSaveBlob(blob, fileName)
|
||||
} else {
|
||||
const blobURL = window.URL.createObjectURL(blob)
|
||||
const tempLink = document.createElement('a')
|
||||
tempLink.style.display = 'none'
|
||||
tempLink.href = blobURL
|
||||
tempLink.setAttribute('download', fileName)
|
||||
if (typeof tempLink.download === 'undefined') {
|
||||
tempLink.setAttribute('target', '_blank')
|
||||
}
|
||||
document.body.appendChild(tempLink)
|
||||
tempLink.click()
|
||||
document.body.removeChild(tempLink)
|
||||
window.URL.revokeObjectURL(blobURL)
|
||||
}
|
||||
}
|
||||
return response
|
||||
},
|
||||
async (error) => {
|
||||
|
@ -93,10 +93,11 @@
|
||||
<el-table-column :label="$t('执行计划')" align="center" prop="executionCron" sortable="custom" width="150" />
|
||||
<na-col-indicator
|
||||
:label="$t('作业状态')"
|
||||
:options="[
|
||||
{ text: '空闲', type: 'success', value: 'idle' },
|
||||
{ text: '运行', type: 'warning', value: 'running' },
|
||||
]"
|
||||
:options="
|
||||
Object.entries(this.$GLOBAL.enums.jobStatues).map((x) => {
|
||||
return { value: x[0], text: x[1][1], type: x[1][2] }
|
||||
})
|
||||
"
|
||||
align="center"
|
||||
prop="status"
|
||||
sortable="custom"
|
||||
@ -105,7 +106,7 @@
|
||||
:label="$t('请求方式')"
|
||||
:options="
|
||||
Object.entries(this.$GLOBAL.enums.httpMethods).map((x) => {
|
||||
return { value: x[0], text: x[1][1] }
|
||||
return { value: x[0], text: x[1][1], type: x[1][2] }
|
||||
})
|
||||
"
|
||||
align="center"
|
||||
|
@ -68,7 +68,7 @@
|
||||
:label="$t('请求方式')"
|
||||
:options="
|
||||
Object.entries(this.$GLOBAL.enums.httpMethods).map((x) => {
|
||||
return { value: x[0], text: x[1][1] }
|
||||
return { value: x[0], text: x[1][1], type: x[1][2] }
|
||||
})
|
||||
"
|
||||
align="center"
|
||||
|
@ -64,7 +64,7 @@
|
||||
:label="$t('消息类型')"
|
||||
:options="
|
||||
Object.entries(this.$GLOBAL.enums.siteMsgTypes).map((x) => {
|
||||
return { value: x[0], text: x[1][1] }
|
||||
return { value: x[0], text: x[1][1], type: x[1][2] }
|
||||
})
|
||||
"
|
||||
align="center"
|
||||
|
@ -98,7 +98,7 @@
|
||||
:label="$t('数据范围')"
|
||||
:options="
|
||||
Object.entries(this.$GLOBAL.enums.dataScopes).map((x) => {
|
||||
return { value: x[0], text: x[1][1] }
|
||||
return { value: x[0], text: x[1][1], type: x[1][2] }
|
||||
})
|
||||
"
|
||||
prop="dataScope"
|
||||
|
Reference in New Issue
Block a user