master
xy 2 years ago
parent 8170af3d31
commit 974e30f17d

@ -15,6 +15,7 @@ import {
const getDefaultState = () => { const getDefaultState = () => {
return { return {
token: getToken(), token: getToken(),
id: "",
name: '', name: '',
avatar: '', avatar: '',
roles: [], roles: [],
@ -42,6 +43,9 @@ const mutations = {
}, },
SET_DEPARTMENT:(state, department) => { SET_DEPARTMENT:(state, department) => {
state.department = department state.department = department
},
SET_ID:(state, id) => {
state.id = id
} }
} }
@ -86,6 +90,7 @@ const actions = {
} }
response["roles"] = ["admin"]; response["roles"] = ["admin"];
const { const {
id,
roles, roles,
name, name,
avatar, avatar,
@ -98,6 +103,7 @@ const actions = {
commit('SET_NAME', name) commit('SET_NAME', name)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
commit('SET_DEPARTMENT', department) commit('SET_DEPARTMENT', department)
commit('SET_ID', id)
resolve(response) resolve(response)
}).catch(error => { }).catch(error => {
reject(error) reject(error)

@ -52,6 +52,11 @@ export default {
page_size: 20, page_size: 20,
table_name: "tags", table_name: "tags",
filter: [ filter: [
{
key: 'zhuangtai',
op: 'eq',
value: '1'
},
{ {
key: "mingcheng", key: "mingcheng",
op: "like", op: "like",

@ -12,7 +12,7 @@
<slot> <slot>
<header-content :auths="auths_auth_mixin"> <header-content :auths="auths_auth_mixin">
<template #search> <template #search>
<div style="display: flex"> <div style="display: flex;align-items: center;">
<Select <Select
v-model="select.filter[1].key" v-model="select.filter[1].key"
style="width: 100px" style="width: 100px"
@ -104,6 +104,7 @@
@input="(e) => inputEndHandler(e, select.filter[1])" @input="(e) => inputEndHandler(e, select.filter[1])"
/> />
</template> </template>
<el-switch v-model="value1" active-text="查询自己" inactive-text="查询所有" style="margin-left: 10px;" @change="switchChange"></el-switch>
<Button <Button
style="margin-left: 10px" style="margin-left: 10px"
type="primary" type="primary"
@ -286,15 +287,53 @@
} }
" "
> >
<template #edit="{ row }" v-if="/^\/manage/.test($route.path)">
<Button v-if="row.zhuangtai == 0 || row.zhuangtai == 3" type="primary" style="margin-right: 6px;" size="small" @click="() => {
$refs['dialog'].setId(row.id);
$refs['dialog'].setType('editor');
$refs['dialog'].show();
}"
>编辑</Button
>
</template>
<template #delete="scope" v-if="/^\/manage/.test($route.path)">
<el-popover width="180" trigger="hover" v-if="scope.row.zhuangtai == 0 || scope.row.zhuangtai == 3">
<template #default>
<div>
<p :style="{ 'padding-bottom': '10px' }">确定要删除吗</p>
<div :style="{ 'text-align': 'right', margin: '0' }">
<el-button size="mini" type="text">取消</el-button>
<el-button
type="primary"
size="mini"
@click="
() => {
destroy({ id: scope.row.id, table_name: 'materials' }).then(res => $refs['xyTable'].getTableData())
}
"
>确定</el-button
>
</div>
</div>
</template>
<template #reference>
<div
:style="{ 'margin-right': '6px', height: '100%', width: '100%' }"
>
<Button type="error" size="small">删除</Button>
</div>
</template>
</el-popover>
</template>
<template #submit="scope"> <template #submit="scope">
<template v-if="scope.row.zhuangtai == 0"> <template v-if="scope.row.zhuangtai == 0 || scope.row.zhuangtai == 3">
<Button type="primary" size="small" @click="submit(scope, 1)" <Button type="primary" size="small" @click="submit(scope, 1)"
>提交</Button >提交</Button
> >
</template> </template>
<template v-else> <template v-else>
<Button type="error" ghost size="small" @click="submit(scope, 0)" <Button type="error" ghost size="small" @click="submit(scope, 0)"
>下架</Button >取消提交</Button
> >
</template> </template>
</template> </template>
@ -392,6 +431,7 @@ export default {
}, },
data() { data() {
return { return {
value1: false,
op, op,
select: { select: {
table_name: "", table_name: "",
@ -434,6 +474,19 @@ export default {
}; };
}, },
switchChange (e) {
if (e) {
this.select.filter.push({
key: 'admin_id',
op: 'eq',
value: this.$store.state.user.id
})
} else {
this.select.filter.splice(this.select.filter.indexOf(this.select.filter.find(i => i.key === 'admin_id')),1)
}
console.log(this.select.filter)
},
async exportExcel(sheetName) { async exportExcel(sheetName) {
const res = await index( const res = await index(
Object.assign(this.select, { page: 1, page_size: 9999 }) Object.assign(this.select, { page: 1, page_size: 9999 })
@ -518,7 +571,7 @@ export default {
async () => { async () => {
const res = await listdeptNoAuth({ const res = await listdeptNoAuth({
page: 1, page: 1,
page_size: 999 page_size: 999,
}); });
return res; return res;
}, },
@ -662,31 +715,30 @@ export default {
}; };
} }
} }
if (!/\/manage\/rule/.test(this.$route.fullPath) && if (
!!["nianfen", "bianhao", "wenjian"].find( !/\/manage\/rule/.test(this.$route.fullPath) &&
(j) => j === i.field !!["nianfen", "bianhao", "wenjian"].find((j) => j === i.field)
)) { ) {
} else { } else {
this.table.push(Object.assign( this.table.push(
{ Object.assign(
prop: i.field, {
label: i.name, prop: i.field,
width: i.width, label: i.name,
fixed: i.is_fixed, width: i.width,
}, fixed: i.is_fixed,
linkOb },
)) linkOb
)
);
} }
}); });
this.table.unshift({ this.table.unshift({
type: "index", type: "index",
width: 60, width: 60,
label: "序号", label: "序号",
}); });
}, },
}, },

@ -285,6 +285,11 @@ export default {
vm.getMaterial(); vm.getMaterial();
}); });
}, },
destroyed() {
this.$store.commit("reception/SET_SELECTED",{
refresh: true
})
}
}; };
</script> </script>

@ -23,10 +23,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="username" label="用户名"> <el-table-column prop="username" label="用户名">
</el-table-column> </el-table-column>
<el-table-column prop="department" label="部门"> <el-table-column prop="department.name" label="部门">
<template slot-scope="scope">
{{scope.row.department.name}}
</template>
</el-table-column> </el-table-column>
<el-table-column prop="address" label="角色"> <el-table-column prop="address" label="角色">
<template slot-scope="scope"> <template slot-scope="scope">

Loading…
Cancel
Save