Merge remote-tracking branch 'biz-pc-cloud/master'
This commit is contained in:
commit
de2c93c4c8
25 files changed
+2975
-2475
No files matched your search
@@ -1,57 +1,64 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function refreshAvatar(query?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-active/refresh-avatar",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function fastCreateCard(data?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-active/fast-create-card',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-active/fast-create-card",
|
||||
method: "post",
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function pageJoin(query?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-active/page-join',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-active/page-join",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-active/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-active/page",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-active',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-active",
|
||||
method: "post",
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/wallet/wallet-active/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-active/" + id,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-active',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-active",
|
||||
method: "delete",
|
||||
data: ids,
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-active',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-active",
|
||||
method: "put",
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,50 +1,56 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function pageJoin(query?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-recharge-apply/page-join',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
export function apply(query?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-recharge-apply/apply",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function pageJoin(query?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-recharge-apply/page-join",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-recharge-apply/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-recharge-apply/page",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-recharge-apply',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-recharge-apply",
|
||||
method: "post",
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/wallet/wallet-recharge-apply/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-recharge-apply/" + id,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-recharge-apply',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-recharge-apply",
|
||||
method: "delete",
|
||||
data: ids,
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-recharge-apply',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
return request({
|
||||
url: "/wallet/wallet-recharge-apply",
|
||||
method: "put",
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,179 +1,191 @@
|
||||
<template>
|
||||
<el-dialog :title="$t('orgSelecotr.select') + $t(`orgSelecotr.${props.type}`)" v-model="visibleDialog" :width="600" append-to-body class="promoter_person">
|
||||
<div class="person_body clear">
|
||||
<div class="person_tree l">
|
||||
<selectBox ref="selectBoxRef" :selectSelf="selectSelf" :list="list" :multiple="multiple"
|
||||
v-model:selectedList="selectedList" :type="type"/>
|
||||
</div>
|
||||
<selectResult :total="total" @del="delList" :list="resList"/>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="$emit('update:visible', false)">{{ $t('common.cancelButtonText') }}</el-button>
|
||||
<el-button type="primary" @click="saveDialog">{{ $t('common.confirmButtonText') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
:title="$t('orgSelecotr.select') + $t(`orgSelecotr.${props.type}`)"
|
||||
v-model="visibleDialog"
|
||||
:width="600"
|
||||
append-to-body
|
||||
class="promoter_person"
|
||||
>
|
||||
<div class="person_body clear">
|
||||
<div class="person_tree l">
|
||||
<selectBox
|
||||
ref="selectBoxRef"
|
||||
:selectSelf="selectSelf"
|
||||
:list="list"
|
||||
:multiple="multiple"
|
||||
v-model:selectedList="selectedList"
|
||||
:type="type"
|
||||
/>
|
||||
</div>
|
||||
<selectResult :total="total" @del="delList" :list="resList" />
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="$emit('update:visible', false)">{{ $t("common.cancelButtonText") }}</el-button>
|
||||
<el-button type="primary" @click="saveDialog">{{ $t("common.confirmButtonText") }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import selectBox from './selectBox.vue';
|
||||
import selectResult from './selectResult.vue';
|
||||
import {computed, watch, ref, onMounted} from 'vue';
|
||||
import {departments, searchVal} from './common';
|
||||
import other from '/@/utils/other';
|
||||
import {useI18n} from "vue-i18n";
|
||||
import selectBox from "./selectBox.vue"
|
||||
import selectResult from "./selectResult.vue"
|
||||
import { computed, watch, ref, onMounted } from "vue"
|
||||
import { departments, searchVal } from "./common"
|
||||
import other from "/@/utils/other"
|
||||
import { useI18n } from "vue-i18n"
|
||||
|
||||
const selectBoxRef = ref();
|
||||
const selectBoxRef = ref()
|
||||
|
||||
let props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'user',
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
selectSelf: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: "user",
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
selectSelf: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
})
|
||||
|
||||
//已选择的集合
|
||||
let selectedList = ref([]);
|
||||
let selectedList = ref([])
|
||||
|
||||
let emits = defineEmits(['update:visible', 'change']);
|
||||
let emits = defineEmits(["update:visible", "change"])
|
||||
let visibleDialog = computed({
|
||||
get() {
|
||||
return props.visible;
|
||||
},
|
||||
set() {
|
||||
closeDialog();
|
||||
},
|
||||
});
|
||||
get() {
|
||||
return props.visible
|
||||
},
|
||||
set() {
|
||||
closeDialog()
|
||||
},
|
||||
})
|
||||
const isChecked = (id, type) => {
|
||||
return selectedList.value.filter((res) => res.id === id && res.type === type).length > 0;
|
||||
};
|
||||
return selectedList.value.filter((res) => res.id === id && res.type === type).length > 0
|
||||
}
|
||||
|
||||
let list = computed(() => {
|
||||
let value = departments.value;
|
||||
return [
|
||||
{
|
||||
type: 'dept',
|
||||
data: value === undefined ? [] : value.childDepartments,
|
||||
},
|
||||
{
|
||||
type: 'role',
|
||||
data: value === undefined ? [] : value.roleList,
|
||||
},
|
||||
{
|
||||
type: 'user',
|
||||
data: value === undefined ? [] : value.employees,
|
||||
change: (item) => {
|
||||
if (!isChecked(item.id, item.type)) {
|
||||
if (!props.multiple) {
|
||||
//单选
|
||||
selectedList.value = [];
|
||||
}
|
||||
let value = departments.value
|
||||
return [
|
||||
{
|
||||
type: "dept",
|
||||
data: value === undefined ? [] : value.childDepartments,
|
||||
},
|
||||
{
|
||||
type: "role",
|
||||
data: value === undefined ? [] : value.roleList,
|
||||
},
|
||||
{
|
||||
type: "user",
|
||||
data: value === undefined ? [] : value.employees,
|
||||
change: (item) => {
|
||||
if (!isChecked(item.id, item.type)) {
|
||||
if (!props.multiple) {
|
||||
//单选
|
||||
selectedList.value = []
|
||||
}
|
||||
|
||||
selectedList.value.push(item);
|
||||
} else {
|
||||
selectedList.value = selectedList.value.filter((res) => !(res.id === item.id && res.type === item.type));
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
});
|
||||
selectedList.value.push(item)
|
||||
} else {
|
||||
selectedList.value = selectedList.value.filter((res) => !(res.id === item.id && res.type === item.type))
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
})
|
||||
let resList = computed(() => {
|
||||
let userData = selectedList.value.filter((res) => res.type === 'user');
|
||||
let deptData = selectedList.value.filter((res) => res.type === 'dept');
|
||||
let roleData = selectedList.value.filter((res) => res.type === 'role');
|
||||
let userData = selectedList.value.filter((res) => res.type === "user")
|
||||
let deptData = selectedList.value.filter((res) => res.type === "dept")
|
||||
let roleData = selectedList.value.filter((res) => res.type === "role")
|
||||
|
||||
let data = [
|
||||
{
|
||||
type: 'user',
|
||||
data: userData,
|
||||
cancel: (item) => {
|
||||
item.selected = false;
|
||||
selectBoxRef.value.changeEvent(item);
|
||||
},
|
||||
},
|
||||
];
|
||||
if (props.type === 'org' || props.type === 'dept') {
|
||||
data.unshift({
|
||||
type: 'dept',
|
||||
data: deptData,
|
||||
cancel: (item) => {
|
||||
item.selected = false;
|
||||
selectBoxRef.value.changeEvent(item);
|
||||
},
|
||||
});
|
||||
}
|
||||
if (props.type === 'role') {
|
||||
data.unshift({
|
||||
type: 'role',
|
||||
data: roleData,
|
||||
cancel: (item) => {
|
||||
item.selected = false;
|
||||
selectBoxRef.value.changeEvent(item);
|
||||
},
|
||||
});
|
||||
}
|
||||
return data;
|
||||
});
|
||||
let data = [
|
||||
{
|
||||
type: "user",
|
||||
data: userData,
|
||||
cancel: (item) => {
|
||||
item.selected = false
|
||||
selectBoxRef.value.changeEvent(item)
|
||||
},
|
||||
},
|
||||
]
|
||||
if (props.type === "org" || props.type === "dept") {
|
||||
data.unshift({
|
||||
type: "dept",
|
||||
data: deptData,
|
||||
cancel: (item) => {
|
||||
item.selected = false
|
||||
selectBoxRef.value.changeEvent(item)
|
||||
},
|
||||
})
|
||||
}
|
||||
if (props.type === "role") {
|
||||
data.unshift({
|
||||
type: "role",
|
||||
data: roleData,
|
||||
cancel: (item) => {
|
||||
item.selected = false
|
||||
selectBoxRef.value.changeEvent(item)
|
||||
},
|
||||
})
|
||||
}
|
||||
return data
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(val) => {
|
||||
if (val) {
|
||||
selectedList.value = props.data;
|
||||
searchVal.value = '';
|
||||
}
|
||||
}
|
||||
);
|
||||
() => props.visible,
|
||||
(val) => {
|
||||
if (val) {
|
||||
selectedList.value = props.data
|
||||
searchVal.value = ""
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
const closeDialog = () => {
|
||||
emits('update:visible', false);
|
||||
};
|
||||
emits("update:visible", false)
|
||||
}
|
||||
|
||||
let total = computed(() => {
|
||||
let v = departments.value;
|
||||
if (!v) {
|
||||
return 0;
|
||||
}
|
||||
return selectedList.value.length;
|
||||
});
|
||||
let v = departments.value
|
||||
if (!v) {
|
||||
return 0
|
||||
}
|
||||
return selectedList.value.length
|
||||
})
|
||||
|
||||
const {proxy} = getCurrentInstance();
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
let saveDialog = () => {
|
||||
const v = selectedList.value;
|
||||
const v = selectedList.value
|
||||
|
||||
let checkedList = other.deepClone(v).map((item) => ({
|
||||
type: item.type,
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
avatar: item.avatar,
|
||||
}));
|
||||
emits('change', checkedList);
|
||||
//selectedList.value=[]
|
||||
};
|
||||
let checkedList = other.deepClone(v).map((item) => ({
|
||||
type: item.type,
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
avatar: item.avatar,
|
||||
}))
|
||||
emits("change", checkedList)
|
||||
//selectedList.value=[]
|
||||
}
|
||||
const delList = () => {
|
||||
for (const item of other.deepClone(selectedList.value)) {
|
||||
item.selected = false;
|
||||
selectBoxRef.value.changeEvent(item);
|
||||
}
|
||||
selectedList.value = [];
|
||||
};
|
||||
for (const item of other.deepClone(selectedList.value)) {
|
||||
item.selected = false
|
||||
selectBoxRef.value.changeEvent(item)
|
||||
}
|
||||
selectedList.value = []
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './dialog.css';
|
||||
@import "./dialog.css";
|
||||
</style>
|
||||
@@ -1,291 +1,297 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-input
|
||||
v-model="searchVal"
|
||||
class="w-50 m-2"
|
||||
style="width: 100%"
|
||||
v-if="type === 'user'"
|
||||
:placeholder="$t('orgSelecotr.search')"
|
||||
@input="getDebounceData($event)"
|
||||
:prefix-icon="Search"
|
||||
/>
|
||||
<p class="ellipsis tree_nav" v-if="!searchVal && type !== 'role'">
|
||||
<span @click="queryData(0)" class="ellipsis">根节点</span>
|
||||
<span v-for="(item, index) in departments.titleDepartments" class="ellipsis" :key="index + 'a'" @click="queryData(item.id)">{{
|
||||
item.name
|
||||
}}</span>
|
||||
</p>
|
||||
<div>
|
||||
<el-input
|
||||
v-model="searchVal"
|
||||
class="w-50 m-2"
|
||||
style="width: 100%"
|
||||
v-if="type === 'user'"
|
||||
:placeholder="$t('orgSelecotr.search')"
|
||||
@input="getDebounceData($event)"
|
||||
:prefix-icon="Search"
|
||||
/>
|
||||
<p class="ellipsis tree_nav" v-if="!searchVal && type !== 'role'">
|
||||
<span @click="queryData(0)" class="ellipsis">根节点</span>
|
||||
<span
|
||||
v-for="(item, index) in departments.titleDepartments"
|
||||
class="ellipsis"
|
||||
:key="index + 'a'"
|
||||
@click="queryData(item.id)"
|
||||
>{{ item.name }}</span
|
||||
>
|
||||
</p>
|
||||
|
||||
<ul class="select-box">
|
||||
<template v-for="(elem, i) in dataList" :key="i">
|
||||
<template v-if="elem.type === 'role'">
|
||||
<li v-for="item in elem.data" :key="item.id">
|
||||
<el-checkbox v-model="item.selected" @change="changeEvent(item)" :disabled="item.status === 0">
|
||||
<div style="display: flex; flex-direction: row">
|
||||
<div class="f11">
|
||||
<el-icon style="font-size: 20px">
|
||||
<Share />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="f12">{{ item.name }}</div>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
</li>
|
||||
</template>
|
||||
<template v-if="elem.type === 'dept' && (type === 'org' || type === 'dept' || type === 'user')">
|
||||
<li v-for="item in elem.data" :key="item.id">
|
||||
<div style="display: flex; flex-direction: row">
|
||||
<div class="d11">
|
||||
<el-checkbox v-model="item.selected" @change="changeEvent(item)" :disabled="!(type === 'org' || type === 'dept') || item.status == 0">
|
||||
<div style="display: flex; flex-direction: row">
|
||||
<div class="f11">
|
||||
<el-icon style="font-size: 20px">
|
||||
<Grid />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="f12">{{ item.name }}</div>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
<div class="d22" @click="queryData(item.id)">下级</div>
|
||||
</div>
|
||||
</li>
|
||||
</template>
|
||||
<template v-if="elem.type === 'user' && (type === 'org' || type === 'user')">
|
||||
<li v-for="item in elem.data" :key="item.id" class="check_box">
|
||||
<el-checkbox
|
||||
v-model="item.selected"
|
||||
:disabled="item.status === 0 || (!selectSelf && currentUserId === item.id)"
|
||||
@change="changeEvent(item)"
|
||||
>
|
||||
<div style="display: flex; flex-direction: row">
|
||||
<div class="f11">
|
||||
<upload-img v-model:image-url="item.avatar" disabled width="20px" height="20px"/>
|
||||
</div>
|
||||
<div class="f12">{{ item.name }}</div>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
</li>
|
||||
</template>
|
||||
</template>
|
||||
</ul>
|
||||
</div>
|
||||
<ul class="select-box">
|
||||
<template v-for="(elem, i) in dataList" :key="i">
|
||||
<template v-if="elem.type === 'role'">
|
||||
<li v-for="item in elem.data" :key="item.id">
|
||||
<el-checkbox v-model="item.selected" @change="changeEvent(item)" :disabled="item.status === 0">
|
||||
<div style="display: flex; flex-direction: row">
|
||||
<div class="f11">
|
||||
<el-icon style="font-size: 20px">
|
||||
<Share />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="f12">{{ item.name }}</div>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
</li>
|
||||
</template>
|
||||
<template v-if="elem.type === 'dept' && (type === 'org' || type === 'dept' || type === 'user')">
|
||||
<li v-for="item in elem.data" :key="item.id">
|
||||
<div style="display: flex; flex-direction: row">
|
||||
<div class="d11">
|
||||
<el-checkbox
|
||||
v-model="item.selected"
|
||||
@change="changeEvent(item)"
|
||||
:disabled="!(type === 'org' || type === 'dept') || item.status == 0"
|
||||
>
|
||||
<div style="display: flex; flex-direction: row">
|
||||
<div class="f11">
|
||||
<el-icon style="font-size: 20px">
|
||||
<Grid />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="f12">{{ item.name }}</div>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
<div class="d22" @click="queryData(item.id)">下级</div>
|
||||
</div>
|
||||
</li>
|
||||
</template>
|
||||
<template v-if="elem.type === 'user' && (type === 'org' || type === 'user')">
|
||||
<li v-for="item in elem.data" :key="item.id" class="check_box">
|
||||
<el-checkbox
|
||||
v-model="item.selected"
|
||||
:disabled="item.status === 0 || (!selectSelf && currentUserId === item.id)"
|
||||
@change="changeEvent(item)"
|
||||
>
|
||||
<div style="display: flex; flex-direction: row">
|
||||
<div class="f11">
|
||||
<preview-image width="20px" height="20px" :src="item.avatar" />
|
||||
</div>
|
||||
<div class="f12">{{ item.name }}</div>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
</li>
|
||||
</template>
|
||||
</template>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import {useUserInfo} from '/@/stores/userInfo';
|
||||
import { useUserInfo } from "/@/stores/userInfo"
|
||||
|
||||
import {departments, getDebounceData, getDepartmentList, searchVal} from './common';
|
||||
import other from '/@/utils/other';
|
||||
import UploadImg from "/@/components/Upload/Image.vue";
|
||||
import {Grid, Search, Share} from '@element-plus/icons-vue';
|
||||
import { departments, getDebounceData, getDepartmentList, searchVal } from "./common"
|
||||
import other from "/@/utils/other"
|
||||
import UploadImg from "/@/components/Upload/Image.vue"
|
||||
import { Grid, Search, Share } from "@element-plus/icons-vue"
|
||||
|
||||
var props = defineProps({
|
||||
selectedList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'org',
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
selectSelf: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
selectedList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: "org",
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
selectSelf: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
})
|
||||
const currentUserId = computed(() => {
|
||||
return useUserInfo().userInfos.user.userId;
|
||||
});
|
||||
|
||||
return useUserInfo().userInfos.user.userId
|
||||
})
|
||||
|
||||
const queryData = (pid) => {
|
||||
getDepartmentList(pid, props.type).then((res) => {
|
||||
let selectedList = props.selectedList;
|
||||
getDepartmentList(pid, props.type).then((res) => {
|
||||
let selectedList = props.selectedList
|
||||
|
||||
for (const it of dataList.value) {
|
||||
for (const item of it.data) {
|
||||
item.selected = selectedList.filter((res) => res.id === item.id && res.type === item.type).length > 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
for (const it of dataList.value) {
|
||||
for (const item of it.data) {
|
||||
item.selected = selectedList.filter((res) => res.id === item.id && res.type === item.type).length > 0
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let deptList = computed(() => {
|
||||
return departments.value.childDepartments;
|
||||
});
|
||||
return departments.value.childDepartments
|
||||
})
|
||||
|
||||
let userList = computed(() => {
|
||||
return departments.value.employees;
|
||||
});
|
||||
return departments.value.employees
|
||||
})
|
||||
let roleList = computed(() => {
|
||||
return departments.value.roleList;
|
||||
});
|
||||
return departments.value.roleList
|
||||
})
|
||||
|
||||
const dataList = computed(() => {
|
||||
return [
|
||||
{
|
||||
type: 'dept',
|
||||
data: deptList.value,
|
||||
},
|
||||
{
|
||||
type: 'user',
|
||||
data: userList.value,
|
||||
},
|
||||
{
|
||||
type: 'role',
|
||||
data: roleList.value,
|
||||
}
|
||||
];
|
||||
});
|
||||
return [
|
||||
{
|
||||
type: "dept",
|
||||
data: deptList.value,
|
||||
},
|
||||
{
|
||||
type: "user",
|
||||
data: userList.value,
|
||||
},
|
||||
{
|
||||
type: "role",
|
||||
data: roleList.value,
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
|
||||
let emits = defineEmits(['update:selectedList']);
|
||||
let emits = defineEmits(["update:selectedList"])
|
||||
|
||||
onMounted(() => {
|
||||
queryData(0);
|
||||
});
|
||||
queryData(0)
|
||||
})
|
||||
|
||||
const changeEvent = (e) => {
|
||||
let selectedList = other.deepClone(props.selectedList);
|
||||
let selectedList = other.deepClone(props.selectedList)
|
||||
|
||||
if (e.selected) {
|
||||
if (!props.multiple) {
|
||||
userList.value.forEach((res) => (res.selected = false));
|
||||
selectedList = [];
|
||||
}
|
||||
e.selected = true;
|
||||
selectedList.push(e);
|
||||
} else {
|
||||
for (const it of dataList.value) {
|
||||
let filter = it.data.filter((res) => res.id === e.id && res.type === e.type);
|
||||
if (filter.length > 0) {
|
||||
filter[0].selected = false;
|
||||
}
|
||||
}
|
||||
selectedList = selectedList.filter((res) => !(res.id === e.id && res.type === e.type));
|
||||
}
|
||||
emits('update:selectedList', selectedList);
|
||||
};
|
||||
if (e.selected) {
|
||||
if (!props.multiple) {
|
||||
userList.value.forEach((res) => (res.selected = false))
|
||||
selectedList = []
|
||||
}
|
||||
e.selected = true
|
||||
selectedList.push(e)
|
||||
} else {
|
||||
for (const it of dataList.value) {
|
||||
let filter = it.data.filter((res) => res.id === e.id && res.type === e.type)
|
||||
if (filter.length > 0) {
|
||||
filter[0].selected = false
|
||||
}
|
||||
}
|
||||
selectedList = selectedList.filter((res) => !(res.id === e.id && res.type === e.type))
|
||||
}
|
||||
emits("update:selectedList", selectedList)
|
||||
}
|
||||
|
||||
const refreshData = () => {
|
||||
let selectedList = props.selectedList;
|
||||
let selectedList = props.selectedList
|
||||
|
||||
for (var it of dataList.value) {
|
||||
for (var item of it.data) {
|
||||
var b = selectedList.filter((res) => res.id === item.id && res.type === item.type).length > 0;
|
||||
item.selected = b;
|
||||
}
|
||||
}
|
||||
};
|
||||
defineExpose({ queryData, changeEvent, refreshData });
|
||||
for (var it of dataList.value) {
|
||||
for (var item of it.data) {
|
||||
var b = selectedList.filter((res) => res.id === item.id && res.type === item.type).length > 0
|
||||
item.selected = b
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ queryData, changeEvent, refreshData })
|
||||
|
||||
watch(
|
||||
() => props.selectedList,
|
||||
(val) => {
|
||||
refreshData();
|
||||
}
|
||||
);
|
||||
() => props.selectedList,
|
||||
(val) => {
|
||||
refreshData()
|
||||
},
|
||||
)
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
@import './dialog.css';
|
||||
@import "./dialog.css";
|
||||
|
||||
.select-box {
|
||||
height: 420px;
|
||||
overflow-y: auto;
|
||||
height: 420px;
|
||||
overflow-y: auto;
|
||||
|
||||
li {
|
||||
padding: 5px 0;
|
||||
}
|
||||
li {
|
||||
padding: 5px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.radio_box a,
|
||||
.check_box a {
|
||||
font-size: 12px;
|
||||
position: relative;
|
||||
padding-left: 20px;
|
||||
margin-right: 30px;
|
||||
cursor: pointer;
|
||||
color: #333;
|
||||
white-space: pre;
|
||||
font-size: 12px;
|
||||
position: relative;
|
||||
padding-left: 20px;
|
||||
margin-right: 30px;
|
||||
cursor: pointer;
|
||||
color: #333;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.check_box.not a:hover {
|
||||
color: #333;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.check_box.not a::before,
|
||||
.check_box.not a:hover::before {
|
||||
border: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.check_box.not.active {
|
||||
background: #f3f3f3;
|
||||
background: #f3f3f3;
|
||||
}
|
||||
|
||||
.radio_box a:hover::before,
|
||||
.check_box a:hover::before {
|
||||
border: 1px solid #46a6fe;
|
||||
border: 1px solid #46a6fe;
|
||||
}
|
||||
|
||||
.radio_box a::before,
|
||||
.check_box a::before {
|
||||
position: absolute;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 2px;
|
||||
left: 0;
|
||||
top: 1px;
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 2px;
|
||||
left: 0;
|
||||
top: 1px;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.radio_box a::before {
|
||||
border-radius: 50%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.check-dot.active::after,
|
||||
.radio_box a.active::after,
|
||||
.check_box a.active::after {
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
top: 3px;
|
||||
left: 3px;
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
top: 3px;
|
||||
left: 3px;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.radio_box a.active::after {
|
||||
background: #46a6fe;
|
||||
background: #46a6fe;
|
||||
}
|
||||
|
||||
.check_box a.active::after {
|
||||
background: url(./assets/check_box.png) no-repeat center;
|
||||
background: url(./assets/check_box.png) no-repeat center;
|
||||
}
|
||||
|
||||
.f11 {
|
||||
width: 30px;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.f12 {
|
||||
width: calc(100% - 30px);
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
width: calc(100% - 30px);
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.d11 {
|
||||
width: calc(100% - 30px);
|
||||
width: calc(100% - 30px);
|
||||
}
|
||||
|
||||
.d22 {
|
||||
width: 30px;
|
||||
line-height: 41px;
|
||||
cursor: pointer;
|
||||
width: 30px;
|
||||
line-height: 41px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -46,7 +46,7 @@
|
||||
<li v-for="item in data" :key="item.id">
|
||||
<div style="display: flex; flex-direction: row">
|
||||
<div class="f11">
|
||||
<upload-img v-model:image-url="item.avatar" disabled width="20px" height="20px" />
|
||||
<preview-image width="20px" height="20px" :src="item.avatar" />
|
||||
</div>
|
||||
<div class="f12">{{ item.name }}</div>
|
||||
<div class="f13">
|
||||
@@ -60,8 +60,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { CircleClose, Grid, Share } from '@element-plus/icons-vue';
|
||||
import UploadImg from '/@/components/Upload/Image.vue';
|
||||
import { CircleClose, Grid, Share } from "@element-plus/icons-vue"
|
||||
import UploadImg from "/@/components/Upload/Image.vue"
|
||||
|
||||
defineProps({
|
||||
total: {
|
||||
@@ -70,10 +70,10 @@ defineProps({
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => [{ type: 'role', data, cancel }],
|
||||
default: () => [{ type: "role", data, cancel }],
|
||||
},
|
||||
});
|
||||
let emits = defineEmits(['del']);
|
||||
})
|
||||
let emits = defineEmits(["del"])
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
+11
-11
@@ -1,21 +1,21 @@
|
||||
/**
|
||||
* 显示价格把分转换到元
|
||||
* @param price
|
||||
* @returns
|
||||
* @param price
|
||||
* @returns
|
||||
*/
|
||||
export function displayPrice(price: any, suffix: string = "元") {
|
||||
if (typeof price === 'undefined') return '0.0' + suffix
|
||||
const parsedNumber = typeof price === 'string' ? parseFloat(price) : price
|
||||
return (parsedNumber / 100.0).toFixed(1) + suffix
|
||||
export function displayPrice(price: any, suffix: string = "元", fixed = 1) {
|
||||
if (typeof price === "undefined") return "0.0" + suffix
|
||||
const parsedNumber = typeof price === "string" ? parseFloat(price) : price
|
||||
return (parsedNumber / 100.0).toFixed(fixed) + suffix
|
||||
}
|
||||
|
||||
/**
|
||||
* 把显示价格改为分
|
||||
* @param price
|
||||
* @returns
|
||||
* @param price
|
||||
* @returns
|
||||
*/
|
||||
export const storePrice = (num: number | string | undefined) => {
|
||||
if (typeof num === 'undefined') return 0
|
||||
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
|
||||
if (typeof num === "undefined") return 0
|
||||
const parsedNumber = typeof num === "string" ? parseFloat(num) : num
|
||||
return Math.round(parsedNumber * 100)
|
||||
}
|
||||
}
|
||||
@@ -1,56 +1,61 @@
|
||||
<template>
|
||||
<div class="system-user-dialog-container">
|
||||
<el-dialog :close-on-click-modal="false" title="人脸管理" draggable v-model="dialogVisible">
|
||||
<el-button icon="folder-add" type="primary" @click="addFace">
|
||||
新增
|
||||
</el-button>
|
||||
<div class="h-4" />
|
||||
<el-table v-loading="state.loading" :data="state.dataList" row-key="userId" border
|
||||
:cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle">
|
||||
<el-table-column prop="username" align="center" label="用户名" />
|
||||
<el-table-column prop="date" align="center" label="人脸">
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.faceImg" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="address" align="center" label="操作">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="editFace(row)">
|
||||
<Icon icon="ep:edit" />修改
|
||||
</el-button>
|
||||
<el-button link type="danger" @click="delFace(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog v-model="uploadDialogVisible" :close-on-click-modal="false" :title="faceUploadTitle" width="30%"
|
||||
@close="uploadDialogClone">
|
||||
<el-form v-loading="formLoading" ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||
<el-form-item label="人脸" prop="uploadFace">
|
||||
<upload-img v-model:image-url="formData.uploadFace" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitFace" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="uploadDialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<div class="system-user-dialog-container">
|
||||
<el-dialog :close-on-click-modal="false" title="人脸管理" draggable v-model="dialogVisible">
|
||||
<el-button icon="folder-add" type="primary" @click="addFace"> 新增 </el-button>
|
||||
<div class="h-4" />
|
||||
<el-table
|
||||
v-loading="state.loading"
|
||||
:data="state.dataList"
|
||||
row-key="userId"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
>
|
||||
<el-table-column prop="username" align="center" label="用户名" />
|
||||
<el-table-column prop="date" align="center" label="人脸">
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.faceImg" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="address" align="center" label="操作">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="editFace(row)"> <Icon icon="ep:edit" />修改 </el-button>
|
||||
<el-button link type="danger" @click="delFace(row)"> 删除 </el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
v-model="uploadDialogVisible"
|
||||
:close-on-click-modal="false"
|
||||
:title="faceUploadTitle"
|
||||
width="30%"
|
||||
@close="uploadDialogClone"
|
||||
>
|
||||
<el-form v-loading="formLoading" ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||
<el-form-item label="人脸" prop="uploadFace">
|
||||
<upload-img v-model:image-url="formData.uploadFace" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitFace" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="uploadDialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="face-manage">
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import * as userFaceApi from "/@/api/admin/userFace"
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
|
||||
// 定义刷新表格emit
|
||||
const emit = defineEmits(['refresh']);
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const formRef = ref()
|
||||
@@ -64,101 +69,102 @@ const formLoading = ref(false)
|
||||
const faceTableLoading = ref(false)
|
||||
|
||||
const formData = ref<any>({
|
||||
id: undefined,
|
||||
uploadFace: undefined,
|
||||
id: undefined,
|
||||
uploadFace: undefined,
|
||||
})
|
||||
const detailId = ref<any>(null)
|
||||
|
||||
// 定义表格查询、后台调用的API
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
deptId: '',
|
||||
username: '',
|
||||
phone: '',
|
||||
},
|
||||
pageList: userFaceApi.pageJoin,
|
||||
});
|
||||
queryForm: {
|
||||
deptId: "",
|
||||
username: "",
|
||||
phone: "",
|
||||
},
|
||||
pageList: userFaceApi.pageJoin,
|
||||
})
|
||||
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
const formRules = reactive({
|
||||
uploadFace: [{ required: true, message: '请上传人脸', trigger: 'blur' }],
|
||||
uploadFace: [{ required: true, message: "请上传人脸", trigger: "blur" }],
|
||||
})
|
||||
|
||||
const submitForm = async () => {
|
||||
dialogVisible.value = false
|
||||
emit('refresh')
|
||||
dialogVisible.value = false
|
||||
emit("refresh")
|
||||
}
|
||||
|
||||
const addFace = (row: any) => {
|
||||
faceUploadTitle.value = "上传人脸"
|
||||
formData.value.uploadFace = ""
|
||||
uploadDialogVisible.value = true
|
||||
faceUploadTitle.value = "上传人脸"
|
||||
formData.value.uploadFace = ""
|
||||
uploadDialogVisible.value = true
|
||||
}
|
||||
|
||||
const editFace = (row: any) => {
|
||||
faceUploadTitle.value = "修改人脸"
|
||||
formData.value.id = row.id
|
||||
formData.value.uploadFace = row.faceImg
|
||||
uploadDialogVisible.value = true
|
||||
faceUploadTitle.value = "修改人脸"
|
||||
formData.value.id = row.id
|
||||
formData.value.uploadFace = row.faceImg
|
||||
uploadDialogVisible.value = true
|
||||
}
|
||||
|
||||
const delFace = async (row: any) => {
|
||||
try {
|
||||
await useMessage().delConfirm('是否删除人脸?')
|
||||
userFaceApi.delObjs(row.id)
|
||||
useMessage().success("删除成功")
|
||||
getDataList()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
try {
|
||||
await useMessage().delConfirm("是否删除人脸?")
|
||||
userFaceApi.delObjs([row.id])
|
||||
useMessage().success("删除成功")
|
||||
getDataList()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
const openDialog = async (id: number) => {
|
||||
if (!id) return;
|
||||
dialogVisible.value = true
|
||||
resetForm()
|
||||
detailId.value = id
|
||||
getDataList()
|
||||
if (!id) return
|
||||
dialogVisible.value = true
|
||||
resetForm()
|
||||
detailId.value = id
|
||||
state.queryForm.userId = id
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const submitFace = async () => {
|
||||
if (!formRef) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
formLoading.value = true
|
||||
const pa: any = {
|
||||
userId: detailId.value,
|
||||
faceImg: formData.value.uploadFace,
|
||||
}
|
||||
if (faceUploadTitle.value == "修改人脸") {
|
||||
pa.id = formData.value.id
|
||||
}
|
||||
try {
|
||||
const fc = faceUploadTitle.value == "上传人脸" ? userFaceApi.addObj : userFaceApi.putObj
|
||||
await fc(pa)
|
||||
useMessage().success("操作成功")
|
||||
uploadDialogClone()
|
||||
getDataList()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
if (!formRef) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
formLoading.value = true
|
||||
const pa: any = {
|
||||
userId: detailId.value,
|
||||
faceImg: formData.value.uploadFace,
|
||||
}
|
||||
if (faceUploadTitle.value == "修改人脸") {
|
||||
pa.id = formData.value.id
|
||||
}
|
||||
try {
|
||||
const fc = faceUploadTitle.value == "上传人脸" ? userFaceApi.addObj : userFaceApi.putObj
|
||||
await fc(pa)
|
||||
useMessage().success("操作成功")
|
||||
uploadDialogClone()
|
||||
getDataList()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const uploadDialogClone = () => {
|
||||
uploadDialogVisible.value = false
|
||||
resetForm()
|
||||
uploadDialogVisible.value = false
|
||||
resetForm()
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
uploadFace: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
uploadFace: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
defineExpose({ openDialog })
|
||||
</script>
|
||||
defineExpose({ openDialog })
|
||||
</script>
|
||||
@@ -1,19 +1,25 @@
|
||||
<template>
|
||||
<div class="system-user-dialog-container">
|
||||
<el-dialog :close-on-click-modal="false" :title="dataForm.userId ? $t('common.editBtn') : $t('common.addBtn')"
|
||||
draggable v-model="visible">
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:title="dataForm.userId ? $t('common.editBtn') : $t('common.addBtn')"
|
||||
draggable
|
||||
v-model="visible"
|
||||
>
|
||||
<el-form :model="dataForm" :rules="dataRules" label-width="90px" ref="dataFormRef" v-loading="loading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.username')" prop="username">
|
||||
<el-input :disabled="dataForm.userId !== ''" placeholder="请输入用户名"
|
||||
v-model="dataForm.username"></el-input>
|
||||
<el-input
|
||||
:disabled="dataForm.userId !== ''"
|
||||
placeholder="请输入用户名"
|
||||
v-model="dataForm.username"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.password')" prop="password">
|
||||
<el-input clearable placeholder="请输入密码" type="password"
|
||||
v-model="dataForm.password"></el-input>
|
||||
<el-input clearable placeholder="请输入密码" type="password" v-model="dataForm.password"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
@@ -29,24 +35,28 @@
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.role')" prop="role">
|
||||
<el-select clearable multiple placeholder="请选择角色" v-model="dataForm.role">
|
||||
<el-option :key="item.roleId" :label="item.roleName" :value="item.roleId"
|
||||
v-for="item in roleData" />
|
||||
<el-option :key="item.roleId" :label="item.roleName" :value="item.roleId" v-for="item in roleData" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.post')" prop="post">
|
||||
<el-select clearable multiple placeholder="请选择岗位" v-model="dataForm.post">
|
||||
<el-option :key="item.postId" :label="item.postName" :value="item.postId"
|
||||
v-for="item in postData" />
|
||||
<el-option :key="item.postId" :label="item.postName" :value="item.postId" v-for="item in postData" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.dept')" prop="deptId">
|
||||
<el-tree-select :data="deptData"
|
||||
:props="{ value: 'id', label: 'name', children: 'children' }" check-strictly
|
||||
class="w100" clearable placeholder="请选择所属部门" v-model="dataForm.deptId">
|
||||
<el-tree-select
|
||||
:data="deptData"
|
||||
:props="{ value: 'id', label: 'name', children: 'children' }"
|
||||
check-strictly
|
||||
class="w100"
|
||||
clearable
|
||||
placeholder="请选择所属部门"
|
||||
v-model="dataForm.deptId"
|
||||
>
|
||||
</el-tree-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -64,8 +74,9 @@
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.lockFlag')" prop="lockFlag">
|
||||
<el-radio-group v-model="dataForm.lockFlag">
|
||||
<el-radio :key="index" :label="item.value" border v-for="(item, index) in lock_flag">{{
|
||||
item.label }} </el-radio>
|
||||
<el-radio :key="index" :label="item.value" border v-for="(item, index) in lock_flag"
|
||||
>{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -73,9 +84,10 @@
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
|
||||
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText')
|
||||
}}</el-button>
|
||||
<el-button @click="visible = false">{{ $t("common.cancelButtonText") }}</el-button>
|
||||
<el-button @click="onSubmit" type="primary" :disabled="loading">{{
|
||||
$t("common.confirmButtonText")
|
||||
}}</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -83,155 +95,158 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemUserDialog" setup>
|
||||
import { addObj, getObj, putObj, validatePhone, validateUsername } from '/@/api/admin/user';
|
||||
import { list as roleList } from '/@/api/admin/role';
|
||||
import { list as postList } from '/@/api/admin/post';
|
||||
import { deptTree } from '/@/api/admin/dept';
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { rule } from '/@/utils/validate';
|
||||
import { addObj, getObj, putObj, validatePhone, validateUsername } from "/@/api/admin/user"
|
||||
import { list as roleList } from "/@/api/admin/role"
|
||||
import { list as postList } from "/@/api/admin/post"
|
||||
import { deptTree } from "/@/api/admin/dept"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useI18n } from "vue-i18n"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { rule } from "/@/utils/validate"
|
||||
|
||||
const { t } = useI18n();
|
||||
const { t } = useI18n()
|
||||
|
||||
// 定义刷新表格emit
|
||||
const emit = defineEmits(['refresh']);
|
||||
const emit = defineEmits(["refresh"])
|
||||
// @ts-ignore
|
||||
const { lock_flag } = useDict('lock_flag');
|
||||
const { lock_flag } = useDict("lock_flag")
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false);
|
||||
const deptData = ref<any[]>([]);
|
||||
const roleData = ref<any[]>([]);
|
||||
const postData = ref<any[]>([]);
|
||||
const loading = ref(false);
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const deptData = ref<any[]>([])
|
||||
const roleData = ref<any[]>([])
|
||||
const postData = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
|
||||
const props = defineProps({
|
||||
deptId: {
|
||||
type: String,
|
||||
default: '',
|
||||
}
|
||||
});
|
||||
default: "",
|
||||
},
|
||||
})
|
||||
|
||||
const dataForm = reactive({
|
||||
userId: '',
|
||||
username: '',
|
||||
password: '' as String | undefined,
|
||||
salt: '',
|
||||
wxOpenid: '',
|
||||
qqOpenid: '',
|
||||
lockFlag: '0',
|
||||
phone: '' as String | undefined,
|
||||
deptId: '',
|
||||
userId: "",
|
||||
username: "",
|
||||
password: "" as String | undefined,
|
||||
salt: "",
|
||||
wxOpenid: "",
|
||||
qqOpenid: "",
|
||||
lockFlag: "0",
|
||||
phone: "" as String | undefined,
|
||||
deptId: "",
|
||||
roleList: [],
|
||||
postList: [],
|
||||
nickname: '',
|
||||
name: '',
|
||||
email: '',
|
||||
nickname: "",
|
||||
name: "",
|
||||
email: "",
|
||||
post: [] as string[],
|
||||
role: [] as string[],
|
||||
});
|
||||
})
|
||||
|
||||
const dataRules = ref({
|
||||
// 用户名校验,不能为空 、长度 5-20、不能和已有数据重复
|
||||
username: [
|
||||
{ required: true, message: '用户名不能为空', trigger: 'blur' },
|
||||
{ min: 5, max: 20, message: '用户名称长度必须介于 5 和 20 之间', trigger: 'blur' },
|
||||
{ required: true, message: "用户名不能为空", trigger: "blur" },
|
||||
{ min: 5, max: 20, message: "用户名称长度必须介于 5 和 20 之间", trigger: "blur" },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validateUsername(rule, value, callback, dataForm.userId !== '');
|
||||
validateUsername(rule, value, callback, dataForm.userId !== "")
|
||||
},
|
||||
trigger: 'blur',
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '密码不能为空', trigger: 'blur' },
|
||||
{ required: true, message: "密码不能为空", trigger: "blur" },
|
||||
{
|
||||
min: 6,
|
||||
max: 20,
|
||||
message: '用户密码长度必须介于 5 和 20 之间',
|
||||
trigger: 'blur',
|
||||
message: "用户密码长度必须介于 5 和 20 之间",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
// 姓名校验,不能为空、只能是中文
|
||||
name: [
|
||||
{ validator: rule.overLength, trigger: 'blur' },
|
||||
{ required: true, message: '姓名不能为空', trigger: 'blur' },
|
||||
{ validator: rule.chinese, trigger: 'blur' },
|
||||
{ validator: rule.overLength, trigger: "blur" },
|
||||
{ required: true, message: "姓名不能为空", trigger: "blur" },
|
||||
{ validator: rule.chinese, trigger: "blur" },
|
||||
],
|
||||
deptId: [{ required: true, message: '部门不能为空', trigger: 'blur' }],
|
||||
role: [{ required: true, message: '角色不能为空', trigger: 'blur' }],
|
||||
post: [{ required: true, message: '岗位不能为空', trigger: 'blur' }],
|
||||
deptId: [{ required: true, message: "部门不能为空", trigger: "blur" }],
|
||||
role: [{ required: true, message: "角色不能为空", trigger: "blur" }],
|
||||
// post: [{ required: true, message: '岗位不能为空', trigger: 'blur' }],
|
||||
// 手机号校验,不能为空、新增的时不能重复校验
|
||||
phone: [
|
||||
{ required: true, message: '手机号不能为空', trigger: 'blur' },
|
||||
{ validator: rule.validatePhone, trigger: 'blur' },
|
||||
{ required: true, message: "手机号不能为空", trigger: "blur" },
|
||||
{ validator: rule.validatePhone, trigger: "blur" },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validatePhone(rule, value, callback, dataForm.userId !== '');
|
||||
validatePhone(rule, value, callback, dataForm.userId !== "")
|
||||
},
|
||||
trigger: 'blur',
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }, { validator: rule.overLength, trigger: 'blur' }],
|
||||
lockFlag: [{ required: true, message: '状态不能为空', trigger: 'blur' }],
|
||||
});
|
||||
email: [
|
||||
{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] },
|
||||
{ validator: rule.overLength, trigger: "blur" },
|
||||
],
|
||||
lockFlag: [{ required: true, message: "状态不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = async (id: string) => {
|
||||
visible.value = true;
|
||||
dataForm.userId = '';
|
||||
visible.value = true
|
||||
dataForm.userId = ""
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
|
||||
// 修改获取用户信息
|
||||
if (id) {
|
||||
dataForm.userId = id;
|
||||
await getUserData(id);
|
||||
dataForm.password = '******';
|
||||
dataForm.userId = id
|
||||
await getUserData(id)
|
||||
dataForm.password = "******"
|
||||
}
|
||||
|
||||
// 加载使用的数据
|
||||
getDeptData();
|
||||
getPostData();
|
||||
getRoleData();
|
||||
};
|
||||
getDeptData()
|
||||
getPostData()
|
||||
getRoleData()
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
const { userId, phone, password } = dataForm;
|
||||
const { userId, phone, password } = dataForm
|
||||
|
||||
if (userId) {
|
||||
// 清除占位符,避免提交错误的数据
|
||||
if (phone?.includes('*')) dataForm.phone = undefined;
|
||||
if (password?.includes('******')) dataForm.password = undefined;
|
||||
if (phone?.includes("*")) dataForm.phone = undefined
|
||||
if (password?.includes("******")) dataForm.password = undefined
|
||||
|
||||
loading.value = true;
|
||||
await putObj(dataForm);
|
||||
useMessage().success(t('common.editSuccessText'));
|
||||
visible.value = false; // 关闭弹窗
|
||||
emit('refresh');
|
||||
loading.value = true
|
||||
await putObj(dataForm)
|
||||
useMessage().success(t("common.editSuccessText"))
|
||||
visible.value = false // 关闭弹窗
|
||||
emit("refresh")
|
||||
} else {
|
||||
loading.value = true;
|
||||
await addObj(dataForm);
|
||||
useMessage().success(t('common.addSuccessText'));
|
||||
visible.value = false; // 关闭弹窗
|
||||
emit('refresh');
|
||||
loading.value = true
|
||||
await addObj(dataForm)
|
||||
useMessage().success(t("common.addSuccessText"))
|
||||
visible.value = false // 关闭弹窗
|
||||
emit("refresh")
|
||||
}
|
||||
} catch (error: any) {
|
||||
useMessage().error(error.msg);
|
||||
useMessage().error(error.msg)
|
||||
} finally {
|
||||
loading.value = false;
|
||||
loading.value = false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 从服务器获取用户数据
|
||||
@@ -242,57 +257,57 @@ const onSubmit = async () => {
|
||||
*/
|
||||
const getUserData = async (id: string) => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const { data } = await getObj(id);
|
||||
Object.assign(dataForm, data);
|
||||
loading.value = true
|
||||
const { data } = await getObj(id)
|
||||
Object.assign(dataForm, data)
|
||||
if (data.roleList) {
|
||||
dataForm.role = data.roleList.map((item) => item.roleId);
|
||||
dataForm.role = data.roleList.map((item) => item.roleId)
|
||||
}
|
||||
if (data.postList) {
|
||||
dataForm.post = data.postList.map((item) => item.postId);
|
||||
dataForm.post = data.postList.map((item) => item.postId)
|
||||
}
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false;
|
||||
loading.value = false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 初始化部门数据
|
||||
const getDeptData = () => {
|
||||
// 获取部门数据
|
||||
deptTree().then((res) => {
|
||||
deptData.value = res.data;
|
||||
deptData.value = res.data
|
||||
// 默认选择在树中选中的部门
|
||||
if (!dataForm.userId) {
|
||||
dataForm.deptId = props.deptId;
|
||||
dataForm.deptId = props.deptId
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
// 岗位数据
|
||||
const getPostData = () => {
|
||||
postList().then((res) => {
|
||||
postData.value = res.data;
|
||||
postData.value = res.data
|
||||
// 默认选择第一个
|
||||
if (!dataForm.userId) {
|
||||
dataForm.post = [res.data[0].postId];
|
||||
dataForm.post = [res.data[0].postId]
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
// 角色数据
|
||||
const getRoleData = () => {
|
||||
roleList().then((res) => {
|
||||
roleData.value = res.data;
|
||||
roleData.value = res.data
|
||||
// 默认选择第一个
|
||||
if (!dataForm.userId) {
|
||||
dataForm.role = [res.data[0].roleId];
|
||||
dataForm.role = [res.data[0].roleId]
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog,
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@@ -4,13 +4,23 @@
|
||||
<pane size="15">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-scrollbar>
|
||||
<query-tree :placeholder="$t('common.queryDeptTip')" :query="deptData.queryList"
|
||||
:show-expand="true" @node-click="handleNodeClick">
|
||||
<query-tree
|
||||
:placeholder="$t('common.queryDeptTip')"
|
||||
:query="deptData.queryList"
|
||||
:show-expand="true"
|
||||
@node-click="handleNodeClick"
|
||||
>
|
||||
<!-- 没有数据权限提示 -->
|
||||
<template #default="{ node, data }">
|
||||
<el-tooltip v-if="data.isLock" class="item" effect="dark"
|
||||
:content="$t('sysuser.noDataScopeTip')" placement="right-start">
|
||||
<span>{{ node.label }}
|
||||
<el-tooltip
|
||||
v-if="data.isLock"
|
||||
class="item"
|
||||
effect="dark"
|
||||
:content="$t('sysuser.noDataScopeTip')"
|
||||
placement="right-start"
|
||||
>
|
||||
<span
|
||||
>{{ node.label }}
|
||||
<SvgIcon name="ele-Lock" />
|
||||
</span>
|
||||
</el-tooltip>
|
||||
@@ -25,68 +35,97 @@
|
||||
<el-row v-show="showSearch">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-form-item :label="$t('sysuser.username')" prop="username">
|
||||
<el-input v-model="state.queryForm.username"
|
||||
:placeholder="$t('sysuser.inputUsernameTip')" clearable />
|
||||
<el-input v-model="state.queryForm.username" :placeholder="$t('sysuser.inputUsernameTip')" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('sysuser.phone')" prop="phone">
|
||||
<el-input v-model="state.queryForm.phone" :placeholder="$t('sysuser.inputPhoneTip')"
|
||||
clearable />
|
||||
<el-input v-model="state.queryForm.phone" :placeholder="$t('sysuser.inputPhoneTip')" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t('common.queryBtn')
|
||||
}}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button v-auth="'sys_user_add'" icon="folder-add" type="primary"
|
||||
@click="userDialogRef.openDialog()">
|
||||
{{ $t('common.addBtn') }}
|
||||
<el-button v-auth="'sys_user_add'" icon="folder-add" type="primary" @click="userDialogRef.openDialog()">
|
||||
{{ $t("common.addBtn") }}
|
||||
</el-button>
|
||||
<el-button plain v-auth="'sys_user_add'" class="ml10" icon="upload-filled" type="primary"
|
||||
@click="excelUploadRef.show()">
|
||||
{{ $t('common.importBtn') }}
|
||||
<el-button
|
||||
plain
|
||||
v-auth="'sys_user_add'"
|
||||
class="ml10"
|
||||
icon="upload-filled"
|
||||
type="primary"
|
||||
@click="excelUploadRef.show()"
|
||||
>
|
||||
{{ $t("common.importBtn") }}
|
||||
</el-button>
|
||||
|
||||
<el-button plain v-auth="'sys_user_del'" :disabled="multiple" class="ml10" icon="Delete"
|
||||
type="primary" @click="handleDelete(selectObjs)">
|
||||
{{ $t('common.delBtn') }}
|
||||
<el-button
|
||||
plain
|
||||
v-auth="'sys_user_del'"
|
||||
:disabled="multiple"
|
||||
class="ml10"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
{{ $t("common.delBtn") }}
|
||||
</el-button>
|
||||
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'sys_user_export'"
|
||||
@exportExcel="exportExcel" @queryTable="getDataList" class="ml10 mr20"
|
||||
style="float: right" />
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'sys_user_export'"
|
||||
@exportExcel="exportExcel"
|
||||
@queryTable="getDataList"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
/>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table v-loading="state.loading" :data="state.dataList" @selection-change="handleSelectionChange"
|
||||
row-key="userId" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle">
|
||||
<el-table
|
||||
v-loading="state.loading"
|
||||
:data="state.dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
row-key="userId"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
>
|
||||
<el-table-column :selectable="handleSelectable" type="selection" width="40" />
|
||||
<el-table-column :label="$t('sysuser.index')" type="index" width="60" fixed="left" />
|
||||
<el-table-column :label="$t('sysuser.username')" prop="username" fixed="left"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysuser.name')" prop="name"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysuser.phone')" prop="phone"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column
|
||||
:label="$t('sysuser.username')"
|
||||
prop="username"
|
||||
fixed="left"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column :label="$t('sysuser.name')" prop="name" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysuser.phone')" prop="phone" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysuser.post')" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-tag v-for="(item, index) in scope.row.postList" :key="index">{{ item.postName
|
||||
}}</el-tag>
|
||||
<el-tag v-for="(item, index) in scope.row.postList" :key="index">{{ item.postName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('sysuser.role')" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-tag v-for="(item, index) in scope.row.roleList" :key="index">{{ item.roleName
|
||||
}}</el-tag>
|
||||
<el-tag v-for="(item, index) in scope.row.roleList" :key="index">{{ item.roleName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="80" label="人脸">
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.faceImgs" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('sysuser.lockFlag')" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.lockFlag" @change="changeSwitch(scope.row)"
|
||||
active-value="0" inactive-value="9"></el-switch>
|
||||
<el-switch
|
||||
v-model="scope.row.lockFlag"
|
||||
@change="changeSwitch(scope.row)"
|
||||
active-value="0"
|
||||
inactive-value="9"
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('common.action')" width="300" fixed="right">
|
||||
@@ -95,29 +134,40 @@
|
||||
<!-- 重置密码 -->
|
||||
<popover-input v-model="inputPassword" @confirm="changePassword(scope.row)">
|
||||
<template #default>
|
||||
<el-button v-auth="'sys_user_edit'" icon="RefreshLeft" text type="primary"
|
||||
class="mr-4">
|
||||
{{ $t('sysuser.passwordBtn') }}
|
||||
<el-button v-auth="'sys_user_edit'" icon="RefreshLeft" text type="primary" class="mr-4">
|
||||
{{ $t("sysuser.passwordBtn") }}
|
||||
</el-button>
|
||||
</template>
|
||||
</popover-input>
|
||||
<!-- 修改信息 -->
|
||||
<el-button v-auth="'sys_user_edit'" icon="edit-pen" text type="primary"
|
||||
@click="userDialogRef.openDialog(scope.row.userId)">
|
||||
{{ $t('common.editBtn') }}
|
||||
<el-button
|
||||
v-auth="'sys_user_edit'"
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
@click="userDialogRef.openDialog(scope.row.userId)"
|
||||
>
|
||||
{{ $t("common.editBtn") }}
|
||||
</el-button>
|
||||
<!-- 人脸管理 -->
|
||||
<el-button icon="User" text type="primary"
|
||||
@click="faceManageRef.openDialog(scope.row.userId)">
|
||||
<el-button icon="User" text type="primary" @click="faceManageRef.openDialog(scope.row.userId)">
|
||||
人脸管理
|
||||
</el-button>
|
||||
<!-- 删除用户 -->
|
||||
<el-tooltip :content="$t('sysuser.deleteDisabledTip')"
|
||||
:disabled="scope.row.userId !== '1'" placement="top">
|
||||
<el-tooltip
|
||||
:content="$t('sysuser.deleteDisabledTip')"
|
||||
:disabled="scope.row.userId !== '1'"
|
||||
placement="top"
|
||||
>
|
||||
<span style="margin-left: 12px">
|
||||
<el-button icon="delete" v-auth="'sys_user_del'"
|
||||
:disabled="scope.row.username === 'admin'" text type="primary"
|
||||
@click="handleDelete([scope.row.userId])">{{ $t('common.delBtn') }}
|
||||
<el-button
|
||||
icon="delete"
|
||||
v-auth="'sys_user_del'"
|
||||
:disabled="scope.row.username === 'admin'"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleDelete([scope.row.userId])"
|
||||
>{{ $t("common.delBtn") }}
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
@@ -125,8 +175,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-bind="state.pagination" @current-change="currentChangeHandle"
|
||||
@size-change="sizeChangeHandle">
|
||||
<pagination v-bind="state.pagination" @current-change="currentChangeHandle" @size-change="sizeChangeHandle">
|
||||
</pagination>
|
||||
</div>
|
||||
</pane>
|
||||
@@ -136,126 +185,131 @@
|
||||
|
||||
<face-manage ref="faceManageRef" @refresh="getDataList(false)" />
|
||||
|
||||
<upload-excel ref="excelUploadRef" :title="$t('sysuser.importUserTip')"
|
||||
temp-url="/admin/sys-file/local/file/user.xlsx" url="/admin/user/import" @refreshDataList="getDataList" />
|
||||
<upload-excel
|
||||
ref="excelUploadRef"
|
||||
:title="$t('sysuser.importUserTip')"
|
||||
temp-url="/admin/sys-file/local/file/user.xlsx"
|
||||
url="/admin/user/import-face"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemUser" setup>
|
||||
import { delObj, pageList, putObj } from '/@/api/admin/user';
|
||||
import { deptTree } from '/@/api/admin/dept';
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { delObj, pageList, putObj } from "/@/api/admin/user"
|
||||
import { deptTree } from "/@/api/admin/dept"
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useI18n } from "vue-i18n"
|
||||
|
||||
// 动态引入组件
|
||||
const UserForm = defineAsyncComponent(() => import('./form.vue'));
|
||||
const FaceManage = defineAsyncComponent(() => import('./face-manage.vue'));
|
||||
const QueryTree = defineAsyncComponent(() => import('/@/components/QueryTree/index.vue'));
|
||||
const PopoverInput = defineAsyncComponent(() => import('/@/components/PopoverInput/index.vue'));
|
||||
const UserForm = defineAsyncComponent(() => import("./form.vue"))
|
||||
const FaceManage = defineAsyncComponent(() => import("./face-manage.vue"))
|
||||
const QueryTree = defineAsyncComponent(() => import("/@/components/QueryTree/index.vue"))
|
||||
const PopoverInput = defineAsyncComponent(() => import("/@/components/PopoverInput/index.vue"))
|
||||
|
||||
const { t } = useI18n();
|
||||
const { t } = useI18n()
|
||||
|
||||
// 定义变量内容
|
||||
const userDialogRef = ref();
|
||||
const faceManageRef = ref();
|
||||
const excelUploadRef = ref();
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
const inputPassword = ref();
|
||||
const userDialogRef = ref()
|
||||
const faceManageRef = ref()
|
||||
const excelUploadRef = ref()
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const inputPassword = ref()
|
||||
|
||||
// 多选rows
|
||||
const selectObjs = ref([]) as any;
|
||||
const selectObjs = ref([]) as any
|
||||
// 是否可以多选
|
||||
const multiple = ref(true);
|
||||
const multiple = ref(true)
|
||||
|
||||
// 定义表格查询、后台调用的API
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
deptId: '',
|
||||
username: '',
|
||||
phone: '',
|
||||
deptId: "",
|
||||
username: "",
|
||||
phone: "",
|
||||
},
|
||||
pageList: pageList,
|
||||
});
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
||||
})
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 部门树使用的数据
|
||||
const deptData = reactive({
|
||||
queryList: (name: String) => {
|
||||
return deptTree({
|
||||
deptName: name,
|
||||
});
|
||||
})
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
queryRef.value?.resetFields();
|
||||
state.queryForm.deptId = '';
|
||||
getDataList();
|
||||
};
|
||||
queryRef.value?.resetFields()
|
||||
state.queryForm.deptId = ""
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 点击树
|
||||
const handleNodeClick = (e: any) => {
|
||||
state.queryForm.deptId = e.id;
|
||||
getDataList();
|
||||
};
|
||||
state.queryForm.deptId = e.id
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/user/export', Object.assign(state.queryForm, { ids: selectObjs }), 'users.xlsx');
|
||||
};
|
||||
downBlobFile("/admin/user/export", Object.assign(state.queryForm, { ids: selectObjs }), "users.xlsx")
|
||||
}
|
||||
|
||||
// 是否可以多选
|
||||
const handleSelectable = (row: any) => {
|
||||
return row.username !== 'admin';
|
||||
};
|
||||
return row.username !== "admin"
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: { userId: string }[]) => {
|
||||
selectObjs.value = objs.map(({ userId }) => userId);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ userId }) => userId)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm(t('common.delConfirmText'));
|
||||
await useMessageBox().confirm(t("common.delConfirmText"))
|
||||
} catch {
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObj(ids);
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
await delObj(ids)
|
||||
getDataList()
|
||||
useMessage().success(t("common.delSuccessText"))
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//表格内开关 (用户状态)
|
||||
const changeSwitch = async (row: any) => {
|
||||
// 不修改密码
|
||||
row.password = undefined;
|
||||
row.phone = undefined;
|
||||
await putObj(row);
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
getDataList();
|
||||
};
|
||||
row.password = undefined
|
||||
row.phone = undefined
|
||||
await putObj(row)
|
||||
useMessage().success(t("common.optSuccessText"))
|
||||
getDataList()
|
||||
}
|
||||
|
||||
//修改用户密码
|
||||
const changePassword = async (row: any) => {
|
||||
if (!inputPassword.value || inputPassword.value.length < 6 || inputPassword.value.length > 20) {
|
||||
useMessage().error(t('sysuser.inputPasswordTip'));
|
||||
return;
|
||||
useMessage().error(t("sysuser.inputPasswordTip"))
|
||||
return
|
||||
}
|
||||
|
||||
row.phone = undefined;
|
||||
row.password = inputPassword.value;
|
||||
await putObj(row);
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
getDataList();
|
||||
};
|
||||
row.phone = undefined
|
||||
row.password = inputPassword.value
|
||||
await putObj(row)
|
||||
useMessage().success(t("common.optSuccessText"))
|
||||
getDataList()
|
||||
}
|
||||
</script>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import selectShow from '/@/components/OrgSelector/index.vue';
|
||||
import selectShow from "/@/components/OrgSelector/index.vue"
|
||||
|
||||
let props = defineProps({
|
||||
nodeUser: {
|
||||
@@ -14,10 +14,10 @@ let props = defineProps({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
const { proxy } = getCurrentInstance();
|
||||
})
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
import { Check, Plus, Refresh } from '@element-plus/icons-vue';
|
||||
import { Check, Plus, Refresh } from "@element-plus/icons-vue"
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -43,7 +43,10 @@ import { Check, Plus, Refresh } from '@element-plus/icons-vue';
|
||||
</p>
|
||||
</template>
|
||||
<!-- 渲染用户头像列表-->
|
||||
<div v-if="node.userVoList && node.userVoList.length > 0" style="display: flex; flex-direction: row; flex-wrap: wrap">
|
||||
<div
|
||||
v-if="node.userVoList && node.userVoList.length > 0"
|
||||
style="display: flex; flex-direction: row; flex-wrap: wrap"
|
||||
>
|
||||
<div
|
||||
class="box-card"
|
||||
v-for="(item1, index1) in node.userVoList"
|
||||
@@ -54,9 +57,17 @@ import { Check, Plus, Refresh } from '@element-plus/icons-vue';
|
||||
<div style="overflow: hidden">
|
||||
<div class="d1">
|
||||
<div>
|
||||
<upload-img v-model:image-url="item1.avatar" width="30px" height="30px"></upload-img>
|
||||
<preview-image :src="item1.avatar" />
|
||||
</div>
|
||||
<div style="font-size: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: center">
|
||||
<div
|
||||
style="
|
||||
font-size: 8px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
text-align: center;
|
||||
"
|
||||
>
|
||||
{{ item1.name }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -76,7 +87,10 @@ import { Check, Plus, Refresh } from '@element-plus/icons-vue';
|
||||
</div>
|
||||
<div style="height: 40px; line-height: 40px; font-size: 10px">(添加了评论) {{ item1.showTime }}</div>
|
||||
</div>
|
||||
<div class="box-card" style="margin-bottom: 10px; padding: 5px; background-color: var(--el-fill-color-light)">
|
||||
<div
|
||||
class="box-card"
|
||||
style="margin-bottom: 10px; padding: 5px; background-color: var(--el-fill-color-light)"
|
||||
>
|
||||
{{ item1.approveDesc }}
|
||||
</div>
|
||||
</template>
|
||||
@@ -84,14 +98,28 @@ import { Check, Plus, Refresh } from '@element-plus/icons-vue';
|
||||
|
||||
<!-- 选择用户-->
|
||||
<template v-if="node.selectUser">
|
||||
<select-show :disabled="disableSelect" v-model:orgList="nodeUser[node.id]" type="user" :multiple="node.multiple"></select-show>
|
||||
<select-show
|
||||
:disabled="disableSelect"
|
||||
v-model:orgList="nodeUser[node.id]"
|
||||
type="user"
|
||||
:multiple="node.multiple"
|
||||
></select-show>
|
||||
</template>
|
||||
|
||||
<el-tabs v-if="node.branch.length > 0" type="border-card">
|
||||
<el-tab-pane v-for="(node1, index1) in node.branch" :label="'分支' + (index1 + 1)" :name="index1 + ''" :key="index1">
|
||||
<el-tab-pane
|
||||
v-for="(node1, index1) in node.branch"
|
||||
:label="'分支' + (index1 + 1)"
|
||||
:name="index1 + ''"
|
||||
:key="index1"
|
||||
>
|
||||
<template v-if="node1.placeholder && node1.placeholder.length > 0">[{{ node1.placeholder }}]</template>
|
||||
<div style="padding: 0px 5px">
|
||||
<flow-node-format :node-user="nodeUser" :disableSelect="disableSelect" :row="node1.children"></flow-node-format>
|
||||
<flow-node-format
|
||||
:node-user="nodeUser"
|
||||
:disableSelect="disableSelect"
|
||||
:row="node1.children"
|
||||
></flow-node-format>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
@@ -1,284 +1,303 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div v-loading="loading" class="layout-padding-auto layout-padding-view" style="overflow: scroll !important;">
|
||||
<el-descriptions :column="3" border title="订单信息">
|
||||
<el-descriptions-item :span="3" label="订单号: ">
|
||||
{{ globalData.detail.id }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="订单类型: ">
|
||||
<dict-tag :options="hard_order_type" :value="globalData.detail.orderType" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="付款方式: ">
|
||||
<dict-tag :options="hard_pay_type" :value="globalData.detail.payType" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="订单状态: ">
|
||||
<dict-tag :options="hard_order_status" :value="globalData.detail.orderStatus" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商户: ">
|
||||
<span> {{ globalData.detail.merchantName }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设备名: ">
|
||||
<span> {{ globalData.detail.hardName }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设备类型: ">
|
||||
<span> {{ globalData.detail.hardType }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商品总价: ">
|
||||
<span class="color-success">
|
||||
{{ displayPrice(globalData.detail.totalPrice) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="额外支付: ">
|
||||
<span class="color-danger">
|
||||
{{ displayPrice(globalData.detail.extraPrice) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="实际支付: ">
|
||||
<span class="color-primary">
|
||||
{{ displayPrice(globalData.detail.payPrice) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="1" title="商品信息">
|
||||
<el-descriptions-item labelClassName="no-colon">
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle">
|
||||
<el-table-column label="商品名" align="center" prop="productName" />
|
||||
<el-table-column label="商品图片" align="center" prop="code">
|
||||
<template #default="{ row }">
|
||||
<preview-image v-if="row.productPic" :src="row.productPic" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品价格" align="center" prop="ticketId">
|
||||
<template #default="{ row }">
|
||||
<span>{{ displayPrice(row.productPrice) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品数量" align="center" prop="productCount" />
|
||||
<el-table-column label="商品总额" align="center" prop="totalPrice">
|
||||
<template #default="{ row }">
|
||||
<span>{{ displayPrice(row.totalPrice) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div class="layout-padding">
|
||||
<div v-loading="loading" class="layout-padding-auto layout-padding-view" style="overflow: scroll !important">
|
||||
<el-descriptions :column="3" border title="订单信息">
|
||||
<el-descriptions-item :span="3" label="订单号: ">
|
||||
{{ globalData.detail.id }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="订单类型: ">
|
||||
<dict-tag :options="hard_order_type" :value="globalData.detail.orderType" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="付款方式: ">
|
||||
<dict-tag :options="hard_pay_type" :value="globalData.detail.payType" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="订单状态: ">
|
||||
<dict-tag :options="hard_order_status" :value="globalData.detail.orderStatus" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商户: ">
|
||||
<span> {{ globalData.detail.merchantName }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设备名: ">
|
||||
<span> {{ globalData.detail.hardName }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设备类型: ">
|
||||
<span> {{ globalData.detail.hardType }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商品总价: ">
|
||||
<span class="color-success">
|
||||
{{ displayPrice(globalData.detail.totalPrice) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="额外支付: ">
|
||||
<span class="color-danger">
|
||||
{{ displayPrice(globalData.detail.extraPrice) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="实际支付: ">
|
||||
<span class="color-primary">
|
||||
{{ displayPrice(globalData.detail.payPrice) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="1" title="商品信息">
|
||||
<el-descriptions-item labelClassName="no-colon">
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column label="商品名" align="center" prop="productName" />
|
||||
<el-table-column label="商品图片" align="center" prop="code">
|
||||
<template #default="{ row }">
|
||||
<preview-image v-if="row.productPic" :src="row.productPic" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品价格" align="center" prop="ticketId">
|
||||
<template #default="{ row }">
|
||||
<span>{{ displayPrice(row.productPrice) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品数量" align="center" prop="productCount" />
|
||||
<el-table-column label="商品总额" align="center" prop="totalPrice">
|
||||
<template #default="{ row }">
|
||||
<span>{{ displayPrice(row.totalPrice) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<!-- 退款状态 -->
|
||||
<el-descriptions v-if="globalData.afterSaleData.id" :column="2" border title="退款状态">
|
||||
<el-descriptions-item :column="1" label="退款状态: ">
|
||||
<dict-tag :options="hard_sale_status" :value="globalData.afterSaleData.status" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :column="1"
|
||||
v-if="globalData.type == 'apply' && globalData.afterSaleData.status == 10" label="操作: "
|
||||
label-class-name="no-colon">
|
||||
<div class="flex justify-evenly">
|
||||
<el-button type="primary" @click="agree">
|
||||
同意售后
|
||||
</el-button>
|
||||
<el-button type="danger" @click="refundRejectRef.openDialog(globalData.detail.id)">
|
||||
拒绝售后
|
||||
</el-button>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<!-- 退款状态 -->
|
||||
<el-descriptions v-if="globalData.afterSaleData.id" :column="2" border title="退款状态">
|
||||
<el-descriptions-item :column="1" label="退款状态: ">
|
||||
<dict-tag :options="hard_sale_status" :value="globalData.afterSaleData.status" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
:column="1"
|
||||
v-if="globalData.type == 'apply' && globalData.afterSaleData.status == 10"
|
||||
label="操作: "
|
||||
label-class-name="no-colon"
|
||||
>
|
||||
<div class="flex justify-evenly">
|
||||
<el-button type="primary" @click="agree"> 同意售后 </el-button>
|
||||
<el-button type="danger" @click="refundRejectRef.openDialog(globalData.detail.id)"> 拒绝售后 </el-button>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions v-if="globalData.afterSaleData.id" border title="售后信息">
|
||||
<el-descriptions-item :span="3" label="退款编号: ">
|
||||
{{ globalData.afterSaleData.no }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="售后类型: ">
|
||||
<dict-tag :options="hard_after_sale_type" :value="globalData.afterSaleData.type" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="售后方式: ">
|
||||
<dict-tag :options="hard_after_sale_way" :value="globalData.afterSaleData.way" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="退款金额: ">
|
||||
{{ displayPrice(globalData.afterSaleData.refundPrice) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="退款原因: ">
|
||||
{{ globalData.afterSaleData.applyReason }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="补充描述: ">
|
||||
{{ globalData.afterSaleData.applyDescription }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions v-if="globalData.afterSaleData.id" border title="售后信息">
|
||||
<el-descriptions-item :span="3" label="退款编号: ">
|
||||
{{ globalData.afterSaleData.no }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="售后类型: ">
|
||||
<dict-tag :options="hard_after_sale_type" :value="globalData.afterSaleData.type" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="售后方式: ">
|
||||
<dict-tag :options="hard_after_sale_way" :value="globalData.afterSaleData.way" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="退款金额: ">
|
||||
{{ displayPrice(globalData.afterSaleData.refundPrice) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="退款原因: ">
|
||||
{{ globalData.afterSaleData.applyReason }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="补充描述: ">
|
||||
{{ globalData.afterSaleData.applyDescription }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions v-if="globalData.log && globalData.log.length" title="售后日志">
|
||||
<el-descriptions-item labelClassName="no-colon">
|
||||
<el-timeline>
|
||||
<el-timeline-item v-for="v in globalData.log" :key="v.id" :timestamp="v.createTime"
|
||||
placement="top">
|
||||
<div class="el-timeline-right-content">
|
||||
<span>{{ v.content }}</span>
|
||||
</div>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
<el-descriptions v-if="globalData.log && globalData.log.length" title="售后日志">
|
||||
<el-descriptions-item labelClassName="no-colon">
|
||||
<el-timeline>
|
||||
<el-timeline-item v-for="v in globalData.log" :key="v.id" :timestamp="v.createTime" placement="top">
|
||||
<div class="el-timeline-right-content">
|
||||
<span>{{ v.content }}</span>
|
||||
</div>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
|
||||
<refund-reject-form ref="refundRejectRef" @refresh="getDetail" />
|
||||
</div>
|
||||
<refund-reject-form ref="refundRejectRef" @refresh="getDetail" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="order-refund">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import * as hardOrder from "/@/api/hard/hard-order";
|
||||
import * as hardCar from "/@/api/hard/hard-car";
|
||||
import * as hardAfterSaleApi from '/@/api/hard/hard-after-sale'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import * as hardOrder from "/@/api/hard/hard-order"
|
||||
import * as hardCar from "/@/api/hard/hard-car"
|
||||
import * as hardAfterSaleApi from "/@/api/hard/hard-after-sale"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { ElLoading } from 'element-plus'
|
||||
import { ElLoading } from "element-plus"
|
||||
|
||||
// 引入组件
|
||||
const RefundRejectForm = defineAsyncComponent(() => import('./refund-reject.vue'));
|
||||
const RefundRejectForm = defineAsyncComponent(() => import("./refund-reject.vue"))
|
||||
|
||||
// 定义查询字典
|
||||
const { hard_pay_type, hard_order_type, hard_order_status, hard_after_sale_way, hard_after_sale_type, hard_sale_status } = useDict("hard_pay_type", "hard_order_type", "hard_order_status", "hard_after_sale_way", "hard_after_sale_type", "hard_sale_status")
|
||||
const {
|
||||
hard_pay_type,
|
||||
hard_order_type,
|
||||
hard_order_status,
|
||||
hard_after_sale_way,
|
||||
hard_after_sale_type,
|
||||
hard_sale_status,
|
||||
} = useDict(
|
||||
"hard_pay_type",
|
||||
"hard_order_type",
|
||||
"hard_order_status",
|
||||
"hard_after_sale_way",
|
||||
"hard_after_sale_type",
|
||||
"hard_sale_status",
|
||||
)
|
||||
|
||||
const { query } = useRoute()
|
||||
const refundRejectRef = ref()
|
||||
const loading = ref(false)
|
||||
const globalData = reactive<any>({
|
||||
type: "",
|
||||
detail: {},
|
||||
afterSaleData: {},
|
||||
log: []
|
||||
type: "",
|
||||
detail: {},
|
||||
afterSaleData: {},
|
||||
log: [],
|
||||
})
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
createdIsNeed: false,
|
||||
queryForm: {},
|
||||
pagination: {
|
||||
size: 100,
|
||||
},
|
||||
pageList: hardCar.getCarByOrderId
|
||||
createdIsNeed: false,
|
||||
queryForm: {},
|
||||
pagination: {
|
||||
size: 100,
|
||||
},
|
||||
pageList: hardCar.getCarByOrderId,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
|
||||
onMounted(async () => {
|
||||
const type = query.type as unknown as any
|
||||
if (type) {
|
||||
globalData.type = type
|
||||
}
|
||||
await getDetail()
|
||||
const type = query.type as unknown as any
|
||||
if (type) {
|
||||
globalData.type = type
|
||||
}
|
||||
await getDetail()
|
||||
})
|
||||
|
||||
const agree = async () => {
|
||||
let loading: any = null
|
||||
try {
|
||||
await useMessage().delConfirm("是否同意售后?")
|
||||
loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '提交中',
|
||||
background: 'rgba(0, 0, 0, 0.7)',
|
||||
})
|
||||
await hardAfterSaleApi.agree({ id: globalData.afterSaleData.id })
|
||||
await getDetail()
|
||||
} finally {
|
||||
setTimeout(() => loading.close(), 1000)
|
||||
}
|
||||
let loading: any = null
|
||||
try {
|
||||
await useMessage().delConfirm("是否同意售后?")
|
||||
loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: "提交中",
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
})
|
||||
await hardAfterSaleApi.agree({ id: globalData.afterSaleData.id })
|
||||
await getDetail()
|
||||
} finally {
|
||||
setTimeout(() => loading.close(), 1000)
|
||||
}
|
||||
}
|
||||
|
||||
const getDetail = async () => {
|
||||
const id = query.id as unknown as any
|
||||
if (!id) return
|
||||
state.queryForm.orderId = id
|
||||
const { data: orderData } = await hardOrder.getObj(id)
|
||||
globalData.detail = orderData
|
||||
getDataList()
|
||||
const { data: afterSaleData } = await hardAfterSaleApi.detailByOrderId({ orderId: id })
|
||||
if (afterSaleData && afterSaleData.id) {
|
||||
globalData.afterSaleData = afterSaleData
|
||||
const { data: log } = await hardAfterSaleApi.history({ id: afterSaleData.id })
|
||||
globalData.log = log
|
||||
}
|
||||
const id = query.id as unknown as any
|
||||
if (!id) return
|
||||
state.queryForm.orderId = id
|
||||
const { data: orderData } = await hardOrder.getObj(id)
|
||||
globalData.detail = orderData
|
||||
getDataList()
|
||||
const { data: afterSaleData } = await hardAfterSaleApi.detailByOrderId({ orderId: id })
|
||||
if (afterSaleData && afterSaleData.id) {
|
||||
globalData.afterSaleData = afterSaleData
|
||||
const { data: log } = await hardAfterSaleApi.history({ id: afterSaleData.id })
|
||||
globalData.log = log
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-descriptions) {
|
||||
&:not(:nth-child(1)) {
|
||||
margin-top: 20px;
|
||||
}
|
||||
&:not(:nth-child(1)) {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.el-descriptions__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.el-descriptions__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&::before {
|
||||
display: inline-block;
|
||||
width: 3px;
|
||||
height: 20px;
|
||||
margin-right: 10px;
|
||||
background-color: #409eff;
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
&::before {
|
||||
display: inline-block;
|
||||
width: 3px;
|
||||
height: 20px;
|
||||
margin-right: 10px;
|
||||
background-color: #409eff;
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
|
||||
.el-descriptions-item__container {
|
||||
margin: 0 10px;
|
||||
.el-descriptions-item__container {
|
||||
margin: 0 10px;
|
||||
|
||||
.no-colon {
|
||||
margin: 0;
|
||||
.no-colon {
|
||||
margin: 0;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
}
|
||||
&::after {
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 时间线样式调整
|
||||
:deep(.el-timeline) {
|
||||
margin: 10px 0 0 160px;
|
||||
margin: 10px 0 0 160px;
|
||||
|
||||
.el-timeline-item__wrapper {
|
||||
position: relative;
|
||||
top: -20px;
|
||||
.el-timeline-item__wrapper {
|
||||
position: relative;
|
||||
top: -20px;
|
||||
|
||||
.el-timeline-item__timestamp {
|
||||
position: absolute !important;
|
||||
top: 10px;
|
||||
left: -150px;
|
||||
}
|
||||
}
|
||||
.el-timeline-item__timestamp {
|
||||
position: absolute !important;
|
||||
top: 10px;
|
||||
left: -150px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-timeline-right-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 30px;
|
||||
padding: 10px;
|
||||
background-color: #409eff;
|
||||
.el-timeline-right-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 30px;
|
||||
padding: 10px;
|
||||
background-color: #409eff;
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 13px;
|
||||
border-color: transparent #409eff transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 8px;
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 13px;
|
||||
border-color: transparent #409eff transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 8px;
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
|
||||
.el-timeline-item__node {
|
||||
position: absolute;
|
||||
left: -5px;
|
||||
top: -50%;
|
||||
transform: translateY(100%);
|
||||
display: flex;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 10px;
|
||||
background: #409eff;
|
||||
border-radius: 50%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.el-timeline-item__node {
|
||||
position: absolute;
|
||||
left: -5px;
|
||||
top: -50%;
|
||||
transform: translateY(100%);
|
||||
display: flex;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 10px;
|
||||
background: #409eff;
|
||||
border-radius: 50%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,114 +1,111 @@
|
||||
<template>
|
||||
<el-dialog title="人脸sdk设置" width="30%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="120px"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-dialog title="人脸sdk设置" width="40%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="120px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="人脸appId" prop="faceAppId">
|
||||
<el-input v-model="form.faceAppId" placeholder="请输入人脸appId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="人脸appId" prop="faceAppId">
|
||||
<el-input v-model="form.faceAppId" placeholder="请输入人脸appId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="人脸sdkKey" prop="faceSdkKey">
|
||||
<el-input v-model="form.faceSdkKey" placeholder="请输入人脸sdkKey" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="人脸sdkKey" prop="faceSdkKey">
|
||||
<el-input v-model="form.faceSdkKey" placeholder="请输入人脸sdkKey" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="人脸activeKey" prop="faceActiveKey">
|
||||
<el-input v-model="form.faceActiveKey" placeholder="请输入人脸activeKey" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="人脸activeKey" prop="faceActiveKey">
|
||||
<el-input v-model="form.faceActiveKey" placeholder="请输入人脸activeKey" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="face-form">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/hard/hard-manager'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/hard/hard-manager"
|
||||
import { rule } from "/@/utils/validate"
|
||||
const emit = defineEmits(["refresh"])
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive<any>({
|
||||
id: undefined,
|
||||
faceAppId: undefined,
|
||||
faceSdkKey: undefined,
|
||||
faceActiveKey: undefined,
|
||||
});
|
||||
id: undefined,
|
||||
faceAppId: undefined,
|
||||
faceSdkKey: undefined,
|
||||
faceActiveKey: undefined,
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
faceAppId: [{ required: true, message: '请输入人脸appId', trigger: 'blur' }],
|
||||
faceSdkKey: [{ required: true, message: '请输入人脸sdkKey', trigger: 'blur' }],
|
||||
faceActiveKey: [{ required: true, message: '请输入人脸activeKey', trigger: 'blur' }],
|
||||
faceAppId: [{ required: true, message: "请输入人脸appId", trigger: "blur" }],
|
||||
faceSdkKey: [{ required: true, message: "请输入人脸sdkKey", trigger: "blur" }],
|
||||
faceActiveKey: [{ required: true, message: "请输入人脸activeKey", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
|
||||
// 获取hardManager信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
gethardManagerData(id)
|
||||
}
|
||||
};
|
||||
// 获取hardManager信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
gethardManagerData(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
form.id ? await putObj(form) : await addObj(form)
|
||||
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const gethardManagerData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
|
||||
</script>
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
@@ -1,115 +1,114 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" width="30%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" width="40%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="设备名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入设备名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="设备名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入设备名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商户" prop="merchantId">
|
||||
<select-mch v-model="form.merchantId" placeholder="请选择商户" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商户" prop="merchantId">
|
||||
<select-mch v-model="form.merchantId" placeholder="请选择商户" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="设备类型" prop="type">
|
||||
<dict-select v-model="form.type" dict-code="hard_type" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="设备类型" prop="type">
|
||||
<dict-select v-model="form.type" dict-code="hard_type" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="HardManagerDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/hard/hard-manager'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/hard/hard-manager"
|
||||
import { rule } from "/@/utils/validate"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
merchantId: '',
|
||||
deptId: '',
|
||||
name: '',
|
||||
type: '',
|
||||
});
|
||||
id: "",
|
||||
merchantId: "",
|
||||
deptId: "",
|
||||
name: "",
|
||||
type: "",
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
name: [{ required: true, message: '设备名不能为空', trigger: 'blur' }],
|
||||
merchantId: [{ required: true, message: '商户不能为空', trigger: 'change' }],
|
||||
type: [{ required: true, message: '设备类型不能为空', trigger: 'change' }],
|
||||
name: [{ required: true, message: "设备名不能为空", trigger: "blur" }],
|
||||
merchantId: [{ required: true, message: "商户不能为空", trigger: "change" }],
|
||||
type: [{ required: true, message: "设备类型不能为空", trigger: "change" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
|
||||
// 获取hardManager信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
gethardManagerData(id)
|
||||
}
|
||||
};
|
||||
// 获取hardManager信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
gethardManagerData(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
form.id ? await putObj(form) : await addObj(form)
|
||||
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const gethardManagerData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
@@ -1,104 +1,141 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="设备名" prop="name">
|
||||
<el-input v-model="state.queryForm.name" placeholder="设备名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="设备类型" prop="type">
|
||||
<dict-select v-model="state.queryForm.type" dict-code="hard_type" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="商户" prop="merchantIds">
|
||||
<select-mch v-model="state.queryForm.merchantIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t('common.queryBtn')
|
||||
}}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'hard_hardManager_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'hard_hardManager_del'"
|
||||
@click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'hard_hardManager_export'" @exportExcel="exportExcel"
|
||||
class="ml10 mr20" style="float: right;" @queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="name" label="设备名" />
|
||||
<el-table-column prop="type" label="设备类型">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="hard_type" :value="row.type" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="merchantName" label="商户" />
|
||||
<el-table-column prop="deptName" label="部门" />
|
||||
<el-table-column prop="uniqueCode" label="设备唯一编号" />
|
||||
<el-table-column prop="mainTopic" width="200" label="topic" />
|
||||
<el-table-column prop="isTakeFood" width="200" label="是否为当前商户的取餐机器">
|
||||
<template #default="{ row }">
|
||||
<el-switch v-if="row.type == 1" :loading="switchTakeFoodLoading" active-text="是" inactive-text="否"
|
||||
active-value="1" inactive-value="0" v-model="row.isTakeFood" @change="changeTakeFood($event, row)" />
|
||||
<div v-else>只有食堂需要设置</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" width="200" label="创建时间" />
|
||||
<el-table-column label="操作" fixed="right" width="400">
|
||||
<template #default="{ row }">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'hard_hardManager_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)">编辑</el-button>
|
||||
<el-button icon="TrendCharts" link type="primary" @click="mqformDialogRef.openDialog(row.id)">
|
||||
mq设置
|
||||
</el-button>
|
||||
<el-button icon="SetUp" link type="primary" @click="faceFormDialogRef.openDialog(row.id)">
|
||||
人脸sdk设置
|
||||
</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'hard_hardManager_del'"
|
||||
@click="handleDelete([row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="设备名" prop="name">
|
||||
<el-input v-model="state.queryForm.name" placeholder="设备名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="设备类型" prop="type">
|
||||
<dict-select v-model="state.queryForm.type" dict-code="hard_type" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="商户" prop="merchantIds">
|
||||
<select-mch v-model="state.queryForm.merchantIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()"
|
||||
v-auth="'hard_hardManager_add'"
|
||||
>
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button
|
||||
plain
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'hard_hardManager_del'"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'hard_hardManager_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="name" width="200" label="设备名" />
|
||||
<el-table-column prop="type" width="100" label="设备类型">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="hard_type" :value="row.type" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="merchantName" width="100" label="商户" />
|
||||
<el-table-column prop="deptName" width="100" label="部门" />
|
||||
<el-table-column prop="uniqueCode" width="200" label="设备唯一编号" />
|
||||
<el-table-column prop="mainTopic" width="350" label="topic" />
|
||||
<el-table-column prop="isTakeFood" width="200" label="是否为当前商户的取餐机器">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
v-if="row.type == 1"
|
||||
:loading="switchTakeFoodLoading"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
v-model="row.isTakeFood"
|
||||
@change="changeTakeFood($event, row)"
|
||||
/>
|
||||
<div v-else>只有超市需要设置</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" width="200" label="创建时间" />
|
||||
<el-table-column label="操作" fixed="right" width="400">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'hard_hardManager_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button icon="TrendCharts" link type="primary" @click="mqformDialogRef.openDialog(row.id)">
|
||||
mq设置
|
||||
</el-button>
|
||||
<el-button icon="SetUp" link type="primary" @click="faceFormDialogRef.openDialog(row.id)">
|
||||
人脸sdk设置
|
||||
</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'hard_hardManager_del'" @click="handleDelete([row.id])"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<face-form-dialog ref="faceFormDialogRef" @refresh="getDataList(false)" />
|
||||
<mq-form-dialog ref="mqformDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<face-form-dialog ref="faceFormDialogRef" @refresh="getDataList(false)" />
|
||||
<mq-form-dialog ref="mqformDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemHardManager">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import * as hardManageApi from '/@/api/hard/hard-manager'
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import * as hardManageApi from "/@/api/hard/hard-manager"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const FaceFormDialog = defineAsyncComponent(() => import('./face-form.vue'));
|
||||
const MqFormDialog = defineAsyncComponent(() => import('./mq-form.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
const FaceFormDialog = defineAsyncComponent(() => import("./face-form.vue"))
|
||||
const MqFormDialog = defineAsyncComponent(() => import("./mq-form.vue"))
|
||||
// 定义查询字典
|
||||
const { hard_type } = useDict('hard_type')
|
||||
const { hard_type } = useDict("hard_type")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const faceFormDialogRef = ref()
|
||||
@@ -112,64 +149,58 @@ const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: hardManageApi.pageJoin
|
||||
queryForm: {},
|
||||
pageList: hardManageApi.pageJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const changeTakeFood = async (e: any, row: any) => {
|
||||
switchTakeFoodLoading.value = true
|
||||
try {
|
||||
await hardManageApi.putObj({ id: row.id, isTakeFood: e })
|
||||
getDataList()
|
||||
} finally {
|
||||
switchTakeFoodLoading.value = false
|
||||
}
|
||||
switchTakeFoodLoading.value = true
|
||||
try {
|
||||
await hardManageApi.putObj({ id: row.id, isTakeFood: e })
|
||||
getDataList()
|
||||
} finally {
|
||||
switchTakeFoodLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/hard/hardManager/export', Object.assign(state.queryForm, { ids: selectObjs }), 'hardManager.xlsx')
|
||||
downBlobFile("/hard/hardManager/export", Object.assign(state.queryForm, { ids: selectObjs }), "hardManager.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await hardManageApi.delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
try {
|
||||
await hardManageApi.delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,144 +1,142 @@
|
||||
<template>
|
||||
<el-dialog title="mq设置" width="30%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-dialog title="mq设置" width="40%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="连接id" prop="mqClientId">
|
||||
<el-input disabled v-model="form.mqClientId" placeholder="待同步" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="连接id" prop="mqClientId">
|
||||
<el-input disabled v-model="form.mqClientId" placeholder="待同步" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="mac地址" prop="macAddress">
|
||||
<el-input disabled v-model="form.macAddress" placeholder="待同步" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="mac地址" prop="macAddress">
|
||||
<el-input disabled v-model="form.macAddress" placeholder="待同步" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="topic" prop="mainTopic">
|
||||
<el-input disabled v-model="form.mainTopic" placeholder="待同步" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="topic" prop="mainTopic">
|
||||
<el-input disabled v-model="form.mainTopic" placeholder="待同步" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="mq地址" prop="mqSocketAddress">
|
||||
<el-input v-model="form.mqSocketAddress" placeholder="请输入mq地址" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="mq地址" prop="mqSocketAddress">
|
||||
<el-input v-model="form.mqSocketAddress" placeholder="请输入mq地址" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="mq端口" prop="mqSocketPort">
|
||||
<el-input v-model="form.mqSocketPort" placeholder="请输入mq端口" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="mq端口" prop="mqSocketPort">
|
||||
<el-input v-model="form.mqSocketPort" placeholder="请输入mq端口" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="mq用户名" prop="mqUsername">
|
||||
<el-input disabled v-model="form.mqUsername" placeholder="请输入mq用户名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="mq用户名" prop="mqUsername">
|
||||
<el-input disabled v-model="form.mqUsername" placeholder="请输入mq用户名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="mq密码" prop="mqPassword">
|
||||
<el-input v-model="form.mqPassword" placeholder="请输入mq密码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="mq密码" prop="mqPassword">
|
||||
<el-input v-model="form.mqPassword" placeholder="请输入mq密码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="mq-form">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/hard/hard-manager'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/hard/hard-manager"
|
||||
import { rule } from "/@/utils/validate"
|
||||
const emit = defineEmits(["refresh"])
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive<any>({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
type: undefined,
|
||||
merchantId: undefined,
|
||||
mqClientId: undefined,
|
||||
macAddress: undefined,
|
||||
mainTopic: undefined,
|
||||
mqSocketAddress: undefined,
|
||||
mqSocketPort: undefined,
|
||||
mqUsername: undefined,
|
||||
mqPassword: undefined,
|
||||
mqSyncCount: undefined
|
||||
});
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
type: undefined,
|
||||
merchantId: undefined,
|
||||
mqClientId: undefined,
|
||||
macAddress: undefined,
|
||||
mainTopic: undefined,
|
||||
mqSocketAddress: undefined,
|
||||
mqSocketPort: undefined,
|
||||
mqUsername: undefined,
|
||||
mqPassword: undefined,
|
||||
mqSyncCount: undefined,
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
mqSocketAddress: [{ required: true, message: 'mq地址', trigger: 'blur' }],
|
||||
mqSocketPort: [{ required: true, message: 'mq端口', trigger: 'blur' }],
|
||||
mqSocketAddress: [{ required: true, message: "mq地址", trigger: "blur" }],
|
||||
mqSocketPort: [{ required: true, message: "mq端口", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
|
||||
// 获取hardManager信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
gethardManagerData(id)
|
||||
}
|
||||
};
|
||||
// 获取hardManager信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
gethardManagerData(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
form.id ? await putObj(form) : await addObj(form)
|
||||
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const gethardManagerData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
|
||||
</script>
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
+290
-216
@@ -1,176 +1,230 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="商户" prop="mchIds">
|
||||
<select-mch v-model="state.queryForm.mchIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item class="w100" label="创建时间" prop="payTimeList">
|
||||
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD" type="daterange" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t('common.queryBtn')
|
||||
}}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-tabs v-if="tabList && tabList.length" v-model="activeName" @tab-click="handleClick">
|
||||
<div v-for="(v) in tabList" :key="v.value">
|
||||
<el-tab-pane :label="v.label" :name="v.value">
|
||||
<div></div>
|
||||
</el-tab-pane>
|
||||
</div>
|
||||
</el-tabs>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="50" />
|
||||
<el-table-column prop="username" label="用户" />
|
||||
<el-table-column prop="userAvatar" label="头像">
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.userAvatar" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="userMobile" width="120" label="手机号" />
|
||||
<el-table-column width="200px" label="设备信息">
|
||||
<template #default="{ row }">
|
||||
<div class="status">
|
||||
<span>商户</span>
|
||||
<span>
|
||||
{{ row.merchantName }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>设备名</span>
|
||||
<span>
|
||||
{{ row.hardName }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>设备类型</span>
|
||||
<span>
|
||||
{{ row.hardType }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="250px" label="订单信息">
|
||||
<template #default="{ row }">
|
||||
<div class="status">
|
||||
<span>订单类型</span>
|
||||
<span>
|
||||
<dict-tag :options="hard_order_type" :value="row.orderType" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>支付方式</span>
|
||||
<span>
|
||||
<dict-tag :options="hard_pay_type" :value="row.payType" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>订单状态</span>
|
||||
<span>
|
||||
<dict-tag :options="hard_order_status" :value="row.orderStatus" />
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="200px" label="付款信息">
|
||||
<template #default="{ row }">
|
||||
<div class="status">
|
||||
<span>商品总价</span>
|
||||
<span class="color-success">
|
||||
{{ displayPrice(row.totalPrice) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>额外支付</span>
|
||||
<span class="color-danger">
|
||||
{{ displayPrice(row.extraPrice) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>实际支付</span>
|
||||
<span class="color-primary">
|
||||
{{ displayPrice(row.payPrice) }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="270px" label="退款信息">
|
||||
<template #default="{ row }">
|
||||
<div class="status">
|
||||
<span>退款金额</span>
|
||||
<span class="color-success">
|
||||
{{ displayPrice(row.refundPrice) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>退款状态</span>
|
||||
<span class="color-success">
|
||||
<dict-tag :options="hard_refund_status" :value="row.refundStatus" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>退款时间</span>
|
||||
<span>
|
||||
{{ row.refundTime }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="支付时间" align="center" prop="payTime" width="180px" />
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button icon="ShoppingCartFull" text type="primary"
|
||||
@click="shopCarDialogRef.openDialog(row.id)">购物车</el-button>
|
||||
<el-button icon="InfoFilled" link type="primary" @click="doRefund(row)">
|
||||
详情
|
||||
</el-button>
|
||||
<el-button v-if="false" icon="edit-pen" text type="primary" v-auth="'hard_hardwareOrder_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)">编辑</el-button>
|
||||
<el-button v-if="false" icon="delete" text type="primary" v-auth="'hard_hardwareOrder_del'"
|
||||
@click="handleDelete([row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<shop-car ref="shopCarDialogRef" />
|
||||
</div>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="商户" prop="mchIds">
|
||||
<select-mch v-model="state.queryForm.mchIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item class="w100" label="创建时间" prop="payTimeList">
|
||||
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD" type="daterange" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-tabs v-if="tabList && tabList.length" v-model="activeName" @tab-click="handleClick">
|
||||
<div v-for="v in tabList" :key="v.value">
|
||||
<el-tab-pane :label="v.label" :name="v.value">
|
||||
<div></div>
|
||||
</el-tab-pane>
|
||||
</div>
|
||||
</el-tabs>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="50" />
|
||||
<el-table-column prop="username" width="100" label="用户" />
|
||||
<el-table-column prop="userAvatar" width="100" label="头像">
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.userAvatar" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="userMobile" width="120" label="手机号" />
|
||||
<el-table-column width="200px" label="商品简要信息">
|
||||
<template #default="{ row }">
|
||||
<div class="desc">
|
||||
<span>商品</span>
|
||||
<span>
|
||||
{{ row.productDesc }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status" v-if="row.hourType">
|
||||
<span>用餐时间段</span>
|
||||
<span>
|
||||
<dict-tag :options="daily_menu" :value="row.hourType" />
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="250px" label="设备信息">
|
||||
<template #default="{ row }">
|
||||
<div class="status">
|
||||
<span>商户</span>
|
||||
<span>
|
||||
{{ row.merchantName }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>设备名</span>
|
||||
<span>
|
||||
{{ row.hardName }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>设备类型</span>
|
||||
<span>
|
||||
<dict-tag :options="hard_type" :value="row.hardType" />
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="250px" label="订单信息">
|
||||
<template #default="{ row }">
|
||||
<div class="status">
|
||||
<span>订单类型</span>
|
||||
<span>
|
||||
<dict-tag :options="hard_order_type" :value="row.orderType" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>支付方式</span>
|
||||
<span>
|
||||
<dict-tag :options="hard_pay_type" :value="row.payType" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>订单状态</span>
|
||||
<span>
|
||||
<dict-tag :options="hard_order_status" :value="row.orderStatus" />
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="200px" label="付款信息">
|
||||
<template #default="{ row }">
|
||||
<div class="status">
|
||||
<span>商品总价</span>
|
||||
<span class="color-success">
|
||||
{{ displayPrice(row.totalPrice) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>额外支付</span>
|
||||
<span class="color-danger">
|
||||
{{ displayPrice(row.extraPrice) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>实际支付</span>
|
||||
<span class="color-primary">
|
||||
{{ displayPrice(row.payPrice) }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="270px" label="退款信息">
|
||||
<template #default="{ row }">
|
||||
<div v-if="row.payRefundId">
|
||||
<div class="status">
|
||||
<span>退款金额</span>
|
||||
<span class="color-success">
|
||||
{{ displayPrice(row.refundPrice) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>退款状态</span>
|
||||
<span class="color-success">
|
||||
<dict-tag :options="hard_refund_status" :value="row.refundStatus" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>退款时间</span>
|
||||
<span>
|
||||
{{ row.refundTime }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="支付时间" align="center" prop="payTime" width="250px">
|
||||
<template #default="{ row }">
|
||||
<div class="status">
|
||||
<span>创建时间</span>
|
||||
<span>{{ row.createTime }} </span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span>支付时间</span>
|
||||
<span>{{ row.payTime }} </span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button icon="ShoppingCartFull" text type="primary" @click="shopCarDialogRef.openDialog(row.id)"
|
||||
>购物车</el-button
|
||||
>
|
||||
<el-button icon="InfoFilled" link type="primary" @click="doRefund(row)"> 详情 </el-button>
|
||||
<el-button
|
||||
v-if="false"
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'hard_hardwareOrder_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="false"
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'hard_hardwareOrder_del'"
|
||||
@click="handleDelete([row.id])"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<shop-car ref="shopCarDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemHardwareOrder">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import * as hardOrder from "/@/api/hard/hard-order";
|
||||
import * as hardCar from "/@/api/hard/hard-car";
|
||||
import { getDicts } from '/@/api/admin/dict';
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import * as hardOrder from "/@/api/hard/hard-order"
|
||||
import * as hardCar from "/@/api/hard/hard-car"
|
||||
import { getDicts } from "/@/api/admin/dict"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
|
||||
const { push } = useRouter()
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const ShopCar = defineAsyncComponent(() => import('../components/shop-car.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
const ShopCar = defineAsyncComponent(() => import("../components/shop-car.vue"))
|
||||
// 定义查询字典
|
||||
const { hard_pay_type, hard_order_type, hard_order_status, hard_type, hard_refund_status } = useDict("hard_pay_type", "hard_order_type", "hard_order_status", "hard_type", "hard_refund_status")
|
||||
const { hard_pay_type, hard_order_type, hard_order_status, hard_type, hard_refund_status, daily_menu } = useDict(
|
||||
"hard_pay_type",
|
||||
"hard_order_type",
|
||||
"hard_order_status",
|
||||
"hard_type",
|
||||
"hard_refund_status",
|
||||
"daily_menu",
|
||||
)
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const shopCarDialogRef = ref()
|
||||
@@ -184,90 +238,110 @@ const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: hardOrder.pageJoin
|
||||
queryForm: {},
|
||||
pageList: hardOrder.pageJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
|
||||
onMounted(async () => {
|
||||
const { data } = await getDicts("hard_order_type")
|
||||
data.unshift({ label: '全部', value: null })
|
||||
tabList.value = data
|
||||
const { data } = await getDicts("hard_order_type")
|
||||
data.unshift({ label: "全部", value: null })
|
||||
tabList.value = data
|
||||
})
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleClick = (e: any) => {
|
||||
state.queryForm.orderType = tabList.value[e.index].value
|
||||
getDataList()
|
||||
state.queryForm.orderType = tabList.value[e.index].value
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const doRefund = (row: any) => {
|
||||
push({ path: '/hard/hard-after-sale/order-refund', query: { id: row.id, type: "view" } })
|
||||
push({ path: "/hard/hard-after-sale/order-refund", query: { id: row.id, type: "view" } })
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/hard/hardwareOrder/export', Object.assign(state.queryForm, { ids: selectObjs }), 'hardwareOrder.xlsx')
|
||||
downBlobFile("/hard/hardwareOrder/export", Object.assign(state.queryForm, { ids: selectObjs }), "hardwareOrder.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await hardOrder.delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
try {
|
||||
await hardOrder.delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 2px;
|
||||
.desc {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 2px;
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
}
|
||||
span {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
span:nth-child(1) {
|
||||
width: 100px;
|
||||
text-align: left;
|
||||
}
|
||||
span:nth-child(1) {
|
||||
min-width: 60px;
|
||||
max-width: 100px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
span:nth-child(2) {
|
||||
flex: 1;
|
||||
}
|
||||
span:nth-child(2) {
|
||||
flex: 1;
|
||||
min-width: 50px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 2px;
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
span:nth-child(1) {
|
||||
min-width: 60px;
|
||||
max-width: 100px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
span:nth-child(2) {
|
||||
flex: 1;
|
||||
min-width: 50px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,87 +1,121 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'wallet_mchManage_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'wallet_mchManage_del'"
|
||||
@click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_mchManage_export'" @exportExcel="exportExcel"
|
||||
class="ml10 mr20" style="float: right;" @queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="name" label="商户名" />
|
||||
<el-table-column prop="logoPic" label="log">
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.logoPic" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="collectionCode" label="商户收款二维码" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.collectionCode" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="merchantType" label="商户类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="flex justify-center items-center">
|
||||
<div v-for="(v, i) in row.types.split(',')" :key="i" class="mr-1">
|
||||
<dict-tag :options="merchant_type" :value="v" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deptName" label="部门" />
|
||||
<el-table-column prop="phone" label="联系电话" show-overflow-tooltip />
|
||||
<el-table-column prop="businessTime" label="结束营业时间" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<span>{{ row.jobStartTime }}</span>
|
||||
<span class="mx-1">-</span>
|
||||
<span>{{ row.jobStartTime }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'wallet_mchManage_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'wallet_mchManage_del'"
|
||||
@click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()"
|
||||
v-auth="'wallet_mchManage_add'"
|
||||
>
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button
|
||||
plain
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'wallet_mchManage_del'"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'wallet_mchManage_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="name" label="商户名" />
|
||||
<el-table-column prop="logoPic" label="log">
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.logoPic" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="collectionCode" width="80" label="商户收款二维码" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.collectionCode" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="merchantType" label="商户类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="flex justify-center items-center">
|
||||
<div v-for="(v, i) in row.types.split(',')" :key="i" class="mr-1">
|
||||
<dict-tag :options="merchant_type" :value="v" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deptName" label="部门" />
|
||||
<el-table-column prop="phone" label="联系电话" show-overflow-tooltip />
|
||||
<el-table-column prop="businessTime" label="结束营业时间" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<span>{{ row.jobStartTime }}</span>
|
||||
<span class="mx-1">-</span>
|
||||
<span>{{ row.jobStartTime }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_mchManage_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_mchManage_del'"
|
||||
@click="handleDelete([scope.row.id])"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MchManage">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { pageJoin, delObjs } from '/@/api/wallet/mch-manage'
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { parseDate } from '/@/utils/formatTime'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { pageJoin, delObjs } from "/@/api/wallet/mch-manage"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { parseDate } from "/@/utils/formatTime"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
// 定义查询字典
|
||||
|
||||
const { merchant_type } = useDict('merchant_type')
|
||||
const { merchant_type } = useDict("merchant_type")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
@@ -92,54 +126,48 @@ const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: pageJoin
|
||||
queryForm: {},
|
||||
pageList: pageJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/canteen/merchantInfo/export', Object.assign(state.queryForm, { ids: selectObjs }), 'merchantInfo.xlsx')
|
||||
downBlobFile("/canteen/merchantInfo/export", Object.assign(state.queryForm, { ids: selectObjs }), "merchantInfo.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
try {
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,90 +1,132 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="是否激活" prop="isActiveHardware">
|
||||
<dict-select v-model="state.queryForm.isActiveHardware" dict-code="yes_no_type" placeholder="是否激活" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="卡号" prop="cardNumber">
|
||||
<el-input v-model="state.queryForm.cardNumber" placeholder="饭卡卡号" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">
|
||||
{{ $t("common.queryBtn") }}
|
||||
</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="是否激活" prop="isActiveHardware">
|
||||
<dict-select v-model="state.queryForm.isActiveHardware" dict-code="yes_no_type" placeholder="是否激活" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="卡号" prop="cardNumber">
|
||||
<el-input v-model="state.queryForm.cardNumber" placeholder="饭卡卡号" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()"
|
||||
v-auth="'wallet_walletActive_add'"
|
||||
>
|
||||
开 卡
|
||||
</el-button>
|
||||
<el-button
|
||||
plain
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'wallet_walletActive_del'"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'wallet_walletActive_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="usernaem" label="用户" show-overflow-tooltip />
|
||||
<el-table-column prop="deptName" label="部门" show-overflow-tooltip />
|
||||
<el-table-column prop="merchantName" label="商户" show-overflow-tooltip />
|
||||
<el-table-column prop="cardNumber" label="用户卡号" show-overflow-tooltip />
|
||||
<el-table-column prop="isActiveHardware" label="是否激活" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="yes_no_type" :value="row.isActiveHardware" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="row.isActiveHardware == 1"
|
||||
icon="Postcard"
|
||||
text
|
||||
type="primary"
|
||||
@click="doRefreshAvatar(row)"
|
||||
>重新激活</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="false"
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletActive_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletActive_del'"
|
||||
@click="handleDelete([row.id])"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'wallet_walletActive_add'">
|
||||
开 卡
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'wallet_walletActive_del'"
|
||||
@click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_walletActive_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="usernaem" label="用户" show-overflow-tooltip />
|
||||
<el-table-column prop="deptName" label="部门" show-overflow-tooltip />
|
||||
<el-table-column prop="merchantName" label="商户" show-overflow-tooltip />
|
||||
<el-table-column prop="cardNumber" label="用户卡号" show-overflow-tooltip />
|
||||
<el-table-column prop="isActiveHardware" label="是否激活" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="yes_no_type" :value="row.isActiveHardware" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button v-if="false" icon="edit-pen" text type="primary" v-auth="'wallet_walletActive_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'wallet_walletActive_del'"
|
||||
@click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemWalletActive">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, pageJoin, delObjs } from "/@/api/wallet/wallet-active";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { refreshAvatar, pageJoin, delObjs } from "/@/api/wallet/wallet-active"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { ElLoading } from "element-plus"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
// 定义查询字典
|
||||
const { wallet_type, yes_no_type } = useDict('wallet_type', 'yes_no_type');
|
||||
const { wallet_type, yes_no_type } = useDict("wallet_type", "yes_no_type")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
@@ -95,54 +137,64 @@ const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: pageJoin
|
||||
queryForm: {},
|
||||
pageList: pageJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/wallet/walletActive/export', Object.assign(state.queryForm, { ids: selectObjs }), 'walletActive.xlsx')
|
||||
downBlobFile("/wallet/walletActive/export", Object.assign(state.queryForm, { ids: selectObjs }), "walletActive.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
const doRefreshAvatar = async (row: any) => {
|
||||
let loading: any = null
|
||||
try {
|
||||
await useMessage().delConfirm("是否重新进行激活")
|
||||
loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: "提交中",
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
})
|
||||
await refreshAvatar({ id: row.id })
|
||||
getDataList()
|
||||
} finally {
|
||||
setTimeout(() => loading.close(), 1000)
|
||||
}
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
try {
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,93 +1,119 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t('common.queryBtn')
|
||||
}}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'wallet_walletForeign_add'">
|
||||
申 请
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'wallet_walletForeign_del'"
|
||||
@click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_walletForeign_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="username" label="申请人" />
|
||||
<el-table-column prop="deptName" label="部门" />
|
||||
<el-table-column prop="applyStartTime" label="申请使用时间">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.applyStartTime }}</span>
|
||||
<span class="mx-1">-</span>
|
||||
<span>{{ row.applyEndTime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="count" label="申请数量" />
|
||||
<el-table-column prop="useCount" label="使用数量" />
|
||||
<el-table-column prop="processStatus" label="审核状态">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.processStatus == 1" type="success">进行中</el-tag>
|
||||
<el-tag v-else>已结束</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" />
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button icon="InfoFilled" text type="primary" @click="codeUseTableRef.openDialog(row.id)">
|
||||
使用情况
|
||||
</el-button>
|
||||
<el-button icon="Promotion" text type="primary" v-auth="'admin_walletStride_del'" @click="doInfo(row)">
|
||||
查看审批
|
||||
</el-button>
|
||||
<el-button v-if="false" icon="delete" text type="primary" v-auth="'wallet_walletForeign_del'"
|
||||
@click="handleDelete([row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()"
|
||||
v-auth="'wallet_walletForeign_add'"
|
||||
>
|
||||
申 请
|
||||
</el-button>
|
||||
<el-button
|
||||
plain
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'wallet_walletForeign_del'"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'wallet_walletForeign_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="username" label="申请人" />
|
||||
<el-table-column prop="deptName" label="部门" />
|
||||
<el-table-column prop="applyStartTime" label="申请使用时间">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.applyStartTime }}</span>
|
||||
<span class="mx-1">-</span>
|
||||
<span>{{ row.applyEndTime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="count" label="申请数量" />
|
||||
<el-table-column prop="useCount" label="使用数量" />
|
||||
<el-table-column prop="processStatus" label="审核状态">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="check_status" :value="row.processStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" />
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button icon="InfoFilled" text type="primary" @click="codeUseTableRef.openDialog(row.id)">
|
||||
使用情况
|
||||
</el-button>
|
||||
<el-button icon="Promotion" text type="primary" v-auth="'admin_walletStride_del'" @click="doInfo(row)">
|
||||
查看审批
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="false"
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletForeign_del'"
|
||||
@click="handleDelete([row.id])"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<code-use-table ref="codeUseTableRef" />
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<code-use-table ref="codeUseTableRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemWalletForeign">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, pageJoin, delObjs } from "/@/api/wallet/wallet-foreign";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, pageJoin, delObjs } from "/@/api/wallet/wallet-foreign"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const CodeUseTable = defineAsyncComponent(() => import('../components/code-use-table.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
const CodeUseTable = defineAsyncComponent(() => import("../components/code-use-table.vue"))
|
||||
// 定义查询字典
|
||||
|
||||
const { check_status } = useDict("check_status")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const codeUseTableRef = ref()
|
||||
@@ -101,59 +127,56 @@ const multiple = ref(true)
|
||||
const { push } = useRouter()
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: pageJoin
|
||||
queryForm: {},
|
||||
pageList: pageJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const doInfo = (row: any) => {
|
||||
push({ path: '/flow/task/started', query: { id: row.id } })
|
||||
push({ path: "/flow/task/started", query: { id: row.id } })
|
||||
}
|
||||
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/wallet/walletForeign/export', Object.assign(state.queryForm, { ids: selectObjs }), 'walletForeign.xlsx')
|
||||
downBlobFile(
|
||||
"/wallet/walletForeign/export",
|
||||
Object.assign(state.queryForm, { ids: selectObjs }),
|
||||
"walletForeign.xlsx",
|
||||
)
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
try {
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,110 +1,138 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="饭卡卡号" prop="cardNumber">
|
||||
<el-input v-model="state.queryForm.cardNumber" placeholder="饭卡卡号" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t('common.queryBtn')
|
||||
}}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'wallet_walletManage_del'"
|
||||
@click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_walletManage_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="username" label="用户" show-overflow-tooltip />
|
||||
<el-table-column prop="userAvatar" label="头像" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.userAvatar" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="userMobile" width="120" label="手机号" show-overflow-tooltip />
|
||||
<el-table-column prop="deptName" label="部门" show-overflow-tooltip />
|
||||
<el-table-column prop="walletTypeUniqueCode" width="200" label="饭卡类型">
|
||||
<template #default="{ row }">
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="color-primary">{{ row.walletTypeName }}</div>
|
||||
<div class="flex items-center just ml5">
|
||||
<dict-tag :options="wallet_type" :value="row.walletTypeUniqueCode" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="cardNumber" label="饭卡卡号" show-overflow-tooltip />
|
||||
<el-table-column prop="balance" label="余额" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="color-primary">{{ displayPrice(row.balance) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="totalExpense" label="累计支出" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="color-danger">{{ displayPrice(row.totalExpense) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="totalRecharge" label="累计充值" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="color-success">{{ displayPrice(row.totalRecharge) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isFreeze" width="120" label="是否冻结饭卡" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="yes_no_type" :value="row.isFreeze" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="activeBindStatus" width="120" label="饭卡绑定状态" show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" width="200" label="创建时间" show-overflow-tooltip />
|
||||
<el-table-column label="操作" fixed="right" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button icon="InfoFilled" text type="primary" v-auth="'wallet_walletManage_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)">详情</el-button>
|
||||
<el-button icon="Money" text type="primary" v-auth="'wallet_walletManage_edit'"
|
||||
@click="changeBalanceRef.openDialog(row.userId, row.id)">充值/扣款</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
<transaction-list ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<change-balance ref="changeBalanceRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="饭卡卡号" prop="cardNumber">
|
||||
<el-input v-model="state.queryForm.cardNumber" placeholder="饭卡卡号" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
plain
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'wallet_walletManage_del'"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'wallet_walletManage_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="username" width="100" label="用户" />
|
||||
<el-table-column prop="userAvatar" width="80" label="头像">
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.userAvatar" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="userMobile" width="120" label="手机号" />
|
||||
<el-table-column prop="deptName" label="部门" width="200" />
|
||||
<el-table-column prop="walletTypeUniqueCode" width="200" label="饭卡类型">
|
||||
<template #default="{ row }">
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="color-primary">{{ row.walletTypeName }}</div>
|
||||
<div class="flex items-center just ml5">
|
||||
<dict-tag :options="wallet_type" :value="row.walletTypeUniqueCode" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="cardNumber" width="150" label="饭卡卡号" />
|
||||
<el-table-column prop="balance" width="100" label="余额">
|
||||
<template #default="{ row }">
|
||||
<div class="color-primary">{{ displayPrice(row.balance) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="totalExpense" width="100" label="累计支出">
|
||||
<template #default="{ row }">
|
||||
<div class="color-danger">{{ displayPrice(row.totalExpense) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="totalRecharge" width="100" label="累计充值">
|
||||
<template #default="{ row }">
|
||||
<div class="color-success">{{ displayPrice(row.totalRecharge) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isFreeze" width="120" label="是否冻结饭卡">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="yes_no_type" :value="row.isFreeze" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="activeBindStatus" width="120" label="饭卡绑定状态" />
|
||||
<el-table-column prop="createTime" width="200" label="创建时间" />
|
||||
<el-table-column label="操作" fixed="right" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
icon="InfoFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="Money"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
@click="changeBalanceRef.openDialog(row.userId, row.id)"
|
||||
>充值/扣款</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
<transaction-list ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<change-balance ref="changeBalanceRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemWalletManage">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, fetchListJoin, delObjs } from '/@/api/wallet/wallet-manage'
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, fetchListJoin, delObjs } from "/@/api/wallet/wallet-manage"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
|
||||
// 引入组件
|
||||
const TransactionList = defineAsyncComponent(() => import('./transaction-list.vue'));
|
||||
const ChangeBalance = defineAsyncComponent(() => import('./change-balance.vue'));
|
||||
const TransactionList = defineAsyncComponent(() => import("./transaction-list.vue"))
|
||||
const ChangeBalance = defineAsyncComponent(() => import("./change-balance.vue"))
|
||||
// 定义查询字典
|
||||
const { wallet_type, yes_no_type } = useDict('wallet_type', 'yes_no_type');
|
||||
const { wallet_type, yes_no_type } = useDict("wallet_type", "yes_no_type")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const changeBalanceRef = ref()
|
||||
@@ -116,54 +144,48 @@ const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchListJoin
|
||||
queryForm: {},
|
||||
pageList: fetchListJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/wallet/walletManage/export', Object.assign(state.queryForm, { ids: selectObjs }), 'walletManage.xlsx')
|
||||
downBlobFile("/wallet/walletManage/export", Object.assign(state.queryForm, { ids: selectObjs }), "walletManage.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
try {
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,33 +1,38 @@
|
||||
<template>
|
||||
<el-dialog title="钱包余额明细" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle">
|
||||
<el-table-column align="center" width="200" label="编号" prop="id" />
|
||||
<el-table-column align="center" width="200" label="钱包编号" prop="walletId" />
|
||||
<el-table-column align="center" label="交易类型" prop="title" />
|
||||
<el-table-column align="center" label="交易金额" prop="price">
|
||||
<template #default="{ row }"> {{ displayPrice(row.price) }} </template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="钱包余额" prop="balance">
|
||||
<template #default="{ row }"> {{ displayPrice(row.balance) }} </template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="交易时间" prop="createTime" width="180px" />
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<Pagination v-model:limit="state.queryForm.pageSize" v-model:page="state.queryForm.pageNo" :total="total"
|
||||
@pagination="getDataList" />
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog title="钱包余额明细" v-model="visible" width="60%" :close-on-click-modal="false" draggable>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column align="center" width="200" label="编号" prop="id" />
|
||||
<el-table-column align="center" width="200" label="钱包编号" prop="walletId" />
|
||||
<el-table-column align="center" width="200" label="交易类型" prop="title" />
|
||||
<el-table-column align="center" label="交易金额" prop="price">
|
||||
<template #default="{ row }"> {{ displayPrice(row.price) }} </template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="钱包余额" prop="balance">
|
||||
<template #default="{ row }"> {{ displayPrice(row.balance) }} </template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="交易时间" prop="createTime" width="180px" />
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WalletManageDialog">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import * as walletTransactionApi from '/@/api/wallet/wallet-transaction'
|
||||
import { rule } from '/@/utils/validate';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import * as walletTransactionApi from "/@/api/wallet/wallet-transaction"
|
||||
import { rule } from "/@/utils/validate"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
const emit = defineEmits(['refresh']);
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const visible = ref(false)
|
||||
@@ -35,39 +40,29 @@ const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
});
|
||||
const form = reactive({})
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
pagination: { size: 5, },
|
||||
queryForm: {},
|
||||
pageList: walletTransactionApi.pageJoin
|
||||
queryForm: {},
|
||||
pageList: walletTransactionApi.pageJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
const { getDataList, total, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
if (id) {
|
||||
state.queryForm.walletId = id
|
||||
state.dataList = []
|
||||
getDataList()
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
if (id) {
|
||||
state.queryForm.walletId = id
|
||||
state.dataList = []
|
||||
getDataList()
|
||||
}
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
@@ -1,101 +1,157 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" placeholder="用户" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="饭卡类型" prop="walletTypeId">
|
||||
<select-wallet-type v-model="state.queryForm.walletTypeId" placeholder="饭卡类型" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t('common.queryBtn')
|
||||
}}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="uploadExcelRef.show()"
|
||||
v-auth="'wallet_walletRechargeApply_add'">
|
||||
导 入
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'wallet_walletRechargeApply_del'"
|
||||
@click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_walletRechargeApply_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="username" label="申请人" show-overflow-tooltip />
|
||||
<el-table-column prop="bizType" label="充值类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="wallet_biz_recharge" :value="row.bizType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="walletTypeId" widht="150" label="饭卡类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="color-primary">{{ row.walletTypeName }}</div>
|
||||
<div class="flex items-center just ml5">
|
||||
<dict-tag :options="wallet_type" :value="row.uniqueCode" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deptName" label="部门" show-overflow-tooltip />
|
||||
<el-table-column prop="importTime" label="充值时间" show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="300">
|
||||
<template #default="scope">
|
||||
<el-button icon="Document" text type="primary" v-auth="'wallet_walletRechargeApply_edit'"
|
||||
@click="doInfo(scope.row)">数据</el-button>
|
||||
<el-button icon="Connection" text type="primary" v-auth="'wallet_walletRechargeApply_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">申请</el-button>
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'wallet_walletRechargeApply_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'wallet_walletRechargeApply_del'"
|
||||
@click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" placeholder="用户" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="饭卡类型" prop="walletTypeId">
|
||||
<select-wallet-type v-model="state.queryForm.walletTypeId" placeholder="饭卡类型" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="uploadExcelRef.show()"
|
||||
v-auth="'wallet_walletRechargeApply_add'"
|
||||
>
|
||||
导 入
|
||||
</el-button>
|
||||
<el-button
|
||||
plain
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'wallet_walletRechargeApply_del'"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'wallet_walletRechargeApply_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="username" label="申请人" show-overflow-tooltip />
|
||||
<el-table-column prop="bizType" label="充值类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="wallet_biz_recharge" :value="row.bizType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="walletTypeId" widht="150" label="饭卡类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="color-primary">{{ row.walletTypeName }}</div>
|
||||
<div class="flex items-center just ml5">
|
||||
<dict-tag :options="wallet_type" :value="row.uniqueCode" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deptName" label="部门" show-overflow-tooltip />
|
||||
<el-table-column prop="importTime" label="充值时间" show-overflow-tooltip />
|
||||
<el-table-column prop="processStatus" label="审核状态">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="check_status" :value="row.processStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="300">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
icon="Document"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletRechargeApply_edit'"
|
||||
@click="doInfo(row)"
|
||||
>数据</el-button
|
||||
>
|
||||
<!-- v-if="!row.processId" -->
|
||||
<el-button
|
||||
icon="Connection"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletRechargeApply_edit'"
|
||||
@click="doApply(row)"
|
||||
>申请</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletRechargeApply_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletRechargeApply_del'"
|
||||
@click="handleDelete([row.id])"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
<upload-excel ref="uploadExcelRef" title="用户信息导入" url="/wallet/wallet-recharge-apply/read-excel"
|
||||
temp-url="/admin/sys-file/local/file/wallet_recharge.xlsx" @refreshDataList="getDataList(false)" />
|
||||
</div>
|
||||
<upload-excel
|
||||
ref="uploadExcelRef"
|
||||
title="用户信息导入"
|
||||
url="/wallet/wallet-recharge-apply/read-excel"
|
||||
temp-url="/admin/sys-file/local/file/wallet_recharge.xlsx"
|
||||
@refreshDataList="getDataList(false)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemWalletRechargeApply">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import * as walletRechargeApplyApi from "/@/api/wallet/wallet-recharge-apply";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import * as walletRechargeApplyApi from "/@/api/wallet/wallet-recharge-apply"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { ElLoading } from "element-plus"
|
||||
|
||||
const { push } = useRouter()
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
// 定义查询字典
|
||||
const { wallet_biz_recharge, wallet_type } = useDict('wallet_biz_recharge', 'wallet_type');
|
||||
|
||||
const { wallet_biz_recharge, wallet_type, check_status } = useDict("wallet_biz_recharge", "wallet_type", "check_status")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const uploadExcelRef = ref()
|
||||
@@ -107,58 +163,73 @@ const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: walletRechargeApplyApi.pageJoin
|
||||
queryForm: {},
|
||||
pageList: walletRechargeApplyApi.pageJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/wallet/walletRechargeApply/export', Object.assign(state.queryForm, { ids: selectObjs }), 'walletRechargeApply.xlsx')
|
||||
downBlobFile(
|
||||
"/wallet/walletRechargeApply/export",
|
||||
Object.assign(state.queryForm, { ids: selectObjs }),
|
||||
"walletRechargeApply.xlsx",
|
||||
)
|
||||
}
|
||||
|
||||
const doApply = async (row: any) => {
|
||||
let loading: any = null
|
||||
try {
|
||||
await useMessage().delConfirm("是否提交审批")
|
||||
loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: "提交中",
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
})
|
||||
await walletRechargeApplyApi.apply({ id: row.id })
|
||||
useMessage().success("提交成功")
|
||||
getDataList()
|
||||
} finally {
|
||||
setTimeout(() => loading.close(), 500)
|
||||
}
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
const doInfo = (row: any) => {
|
||||
push({ path: '/wallet/wallet-recharge-apply/preview-excel', query: { id: row.id } })
|
||||
push({ path: "/wallet/wallet-recharge-apply/preview-excel", query: { id: row.id } })
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await walletRechargeApplyApi.delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
try {
|
||||
await walletRechargeApplyApi.delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,99 +1,119 @@
|
||||
<template>
|
||||
<div class="w100">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<div class="flex justify-center flex-col">
|
||||
<div>
|
||||
<el-form ref="dataFormRef" label-width="120px" :model="form" :rules="dataRules" formDialogRef
|
||||
v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="每一餐的上限" prop="payAmountEnable">
|
||||
<el-switch active-value="1" inactive-value="0" v-model="form.payAmountEnable"
|
||||
active-text="开启" inactive-text="关闭" inline-prompt />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="每一餐的上限" prop="payAmountMealLimit">
|
||||
<el-input style="width: 300px;" type="number" v-model="form.payAmountMealLimit"
|
||||
placeholder="请输入上限金额">
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="倍数" prop="payAmountMealTimes">
|
||||
<el-input style="width: 300px;" type="number" v-model="form.payAmountMealTimes"
|
||||
placeholder="请输入倍数">
|
||||
<template #append>倍</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="flex items-center">
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w100">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<div class="flex justify-center flex-col">
|
||||
<div>
|
||||
<el-form
|
||||
ref="dataFormRef"
|
||||
label-width="120px"
|
||||
:model="form"
|
||||
:rules="dataRules"
|
||||
formDialogRef
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="每一餐的上限" prop="payAmountEnable">
|
||||
<el-switch
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
v-model="form.payAmountEnable"
|
||||
active-text="开启"
|
||||
inactive-text="关闭"
|
||||
inline-prompt
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="每一餐的上限" prop="payAmountMealLimit">
|
||||
<el-input
|
||||
style="width: 300px"
|
||||
type="number"
|
||||
v-model="form.payAmountMealLimit"
|
||||
placeholder="请输入上限金额"
|
||||
>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="倍数" prop="payAmountMealTimes">
|
||||
<el-input
|
||||
style="width: 300px"
|
||||
type="number"
|
||||
v-model="form.payAmountMealTimes"
|
||||
placeholder="请输入倍数"
|
||||
>
|
||||
<template #append>倍</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="flex items-center">
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="extra-price">
|
||||
import { storePrice } from "/@/utils/formatMoney"
|
||||
import { storePrice, displayPrice } from "/@/utils/formatMoney"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, putObj } from "/@/api/wallet/wallet-setting"
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const dataFormRef = ref()
|
||||
const loading = ref(false)
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: undefined,
|
||||
payAmountEnable: undefined,
|
||||
payAmountMealLimit: undefined,
|
||||
payAmountMealTimes: undefined,
|
||||
});
|
||||
id: undefined,
|
||||
payAmountEnable: undefined,
|
||||
payAmountMealLimit: undefined,
|
||||
payAmountMealTimes: undefined,
|
||||
})
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
payAmountEnable: [{ required: true, message: '请选择是否开启每一餐的上限', trigger: 'change' }],
|
||||
payAmountMealLimit: [{ required: true, message: '请输入上限金额', trigger: 'blur' }],
|
||||
payAmountMealTimes: [{ required: true, message: '请输入倍数', trigger: 'blur' }],
|
||||
payAmountEnable: [{ required: true, message: "请选择是否开启每一餐的上限", trigger: "change" }],
|
||||
payAmountMealLimit: [{ required: true, message: "请输入上限金额", trigger: "blur" }],
|
||||
payAmountMealTimes: [{ required: true, message: "请输入倍数", trigger: "blur" }],
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getwalletRechargePackageData('1')
|
||||
getwalletRechargePackageData("1")
|
||||
})
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
const pa = {
|
||||
...form,
|
||||
payPrice: storePrice(form.payAmountMealLimit),
|
||||
}
|
||||
await putObj(pa)
|
||||
useMessage().success('修改成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
const pa = {
|
||||
...form,
|
||||
payAmountMealLimit: storePrice(form.payAmountMealLimit),
|
||||
}
|
||||
await putObj(pa)
|
||||
useMessage().success("修改成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getwalletRechargePackageData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
</script>
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data, { payAmountMealLimit: displayPrice(res.data.payAmountMealLimit, "", 0) })
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -1,87 +1,122 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t('common.queryBtn')
|
||||
}}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'admin_walletStride_add'">
|
||||
申 请
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'admin_walletStride_del'"
|
||||
@click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'admin_walletStride_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="username" label="申请人" />
|
||||
<el-table-column prop="deptName" label="部门" />
|
||||
<el-table-column prop="count" label="申请数量" />
|
||||
<el-table-column prop="useCount" label="使用数量" />
|
||||
<el-table-column prop="processStatus" label="审核状态">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="check_status" :value="row.processStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" />
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button v-if="false" icon="edit-pen" text type="primary" v-auth="'admin_walletStride_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)">编辑</el-button>
|
||||
<el-button v-if="false" icon="delete" text type="primary" v-auth="'admin_walletStride_del'"
|
||||
@click="handleDelete([row.id])">删除</el-button>
|
||||
<el-button icon="InfoFilled" text type="primary" @click="codeUseTableRef.openDialog(row.id)">
|
||||
使用情况
|
||||
</el-button>
|
||||
<el-button icon="Promotion" text type="primary" v-auth="'admin_walletStride_del'" @click="doInfo(row)">
|
||||
查看审批
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()"
|
||||
v-auth="'admin_walletStride_add'"
|
||||
>
|
||||
申 请
|
||||
</el-button>
|
||||
<el-button
|
||||
plain
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'admin_walletStride_del'"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'admin_walletStride_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="username" label="申请人" />
|
||||
<el-table-column prop="deptName" label="部门" />
|
||||
<el-table-column prop="count" label="申请数量" />
|
||||
<el-table-column prop="useCount" label="使用数量" />
|
||||
<el-table-column prop="processStatus" label="审核状态">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="check_status" :value="row.processStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" />
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="false"
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'admin_walletStride_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="false"
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'admin_walletStride_del'"
|
||||
@click="handleDelete([row.id])"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button icon="InfoFilled" text type="primary" @click="codeUseTableRef.openDialog(row.id)">
|
||||
使用情况
|
||||
</el-button>
|
||||
<el-button icon="Promotion" text type="primary" v-auth="'admin_walletStride_del'" @click="doInfo(row)">
|
||||
查看审批
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<code-use-table ref="codeUseTableRef" />
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<code-use-table ref="codeUseTableRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemWalletStride">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs, pageJoin } from "/@/api/wallet/wallet-stride";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, delObjs, pageJoin } from "/@/api/wallet/wallet-stride"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
const { push } = useRouter()
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const CodeUseTable = defineAsyncComponent(() => import('../components/code-use-table.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
const CodeUseTable = defineAsyncComponent(() => import("../components/code-use-table.vue"))
|
||||
// 定义查询字典
|
||||
const { check_status, yes_no_type } = useDict('check_status', 'yes_no_type');
|
||||
const { check_status, yes_no_type } = useDict("check_status", "yes_no_type")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const codeUseTableRef = ref()
|
||||
@@ -93,58 +128,52 @@ const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: pageJoin
|
||||
queryForm: {},
|
||||
pageList: pageJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const doInfo = (row: any) => {
|
||||
push({ path: '/flow/task/started', query: { id: row.id } })
|
||||
push({ path: "/flow/task/started", query: { id: row.id } })
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/walletStride/export', Object.assign(state.queryForm, { ids: selectObjs }), 'walletStride.xlsx')
|
||||
downBlobFile("/admin/walletStride/export", Object.assign(state.queryForm, { ids: selectObjs }), "walletStride.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
try {
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user