我负责的页面获取项目接口
This commit is contained in:
parent
f166717873
commit
aaa2ea6c54
2
auto-imports.d.ts
vendored
2
auto-imports.d.ts
vendored
@ -2,6 +2,4 @@
|
|||||||
export {}
|
export {}
|
||||||
declare global {
|
declare global {
|
||||||
const ElMessage: typeof import('element-plus/es')['ElMessage']
|
const ElMessage: typeof import('element-plus/es')['ElMessage']
|
||||||
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
|
|
||||||
const ElNotification: typeof import('element-plus/es')['ElNotification']
|
|
||||||
}
|
}
|
||||||
|
10
components.d.ts
vendored
10
components.d.ts
vendored
@ -13,6 +13,7 @@ declare module '@vue/runtime-core' {
|
|||||||
DropdownMenu: typeof import('./src/components/Share/DropdownMenu.vue')['default']
|
DropdownMenu: typeof import('./src/components/Share/DropdownMenu.vue')['default']
|
||||||
Dropzone: typeof import('./src/components/Dropzone/index.vue')['default']
|
Dropzone: typeof import('./src/components/Dropzone/index.vue')['default']
|
||||||
EditorImage: typeof import('./src/components/Tinymce/components/EditorImage.vue')['default']
|
EditorImage: typeof import('./src/components/Tinymce/components/EditorImage.vue')['default']
|
||||||
|
ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
|
||||||
ElBadge: typeof import('element-plus/es')['ElBadge']
|
ElBadge: typeof import('element-plus/es')['ElBadge']
|
||||||
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
|
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
|
||||||
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
|
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
|
||||||
@ -21,29 +22,30 @@ declare module '@vue/runtime-core' {
|
|||||||
ElCard: typeof import('element-plus/es')['ElCard']
|
ElCard: typeof import('element-plus/es')['ElCard']
|
||||||
ElCol: typeof import('element-plus/es')['ElCol']
|
ElCol: typeof import('element-plus/es')['ElCol']
|
||||||
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
||||||
|
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
||||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||||
|
ElDivider: typeof import('element-plus/es')['ElDivider']
|
||||||
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
||||||
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
||||||
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
|
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
|
||||||
|
ElForm: typeof import('element-plus/es')['ElForm']
|
||||||
|
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
||||||
ElIcon: typeof import('element-plus/es')['ElIcon']
|
ElIcon: typeof import('element-plus/es')['ElIcon']
|
||||||
ElInput: typeof import('element-plus/es')['ElInput']
|
ElInput: typeof import('element-plus/es')['ElInput']
|
||||||
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
|
||||||
ElMenu: typeof import('element-plus/es')['ElMenu']
|
ElMenu: typeof import('element-plus/es')['ElMenu']
|
||||||
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
|
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
|
||||||
ElOption: typeof import('element-plus/es')['ElOption']
|
ElOption: typeof import('element-plus/es')['ElOption']
|
||||||
ElPagination: typeof import('element-plus/es')['ElPagination']
|
ElPagination: typeof import('element-plus/es')['ElPagination']
|
||||||
ElProgress: typeof import('element-plus/es')['ElProgress']
|
ElProgress: typeof import('element-plus/es')['ElProgress']
|
||||||
ElRadio: typeof import('element-plus/es')['ElRadio']
|
|
||||||
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
|
|
||||||
ElRow: typeof import('element-plus/es')['ElRow']
|
ElRow: typeof import('element-plus/es')['ElRow']
|
||||||
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
||||||
ElSelect: typeof import('element-plus/es')['ElSelect']
|
ElSelect: typeof import('element-plus/es')['ElSelect']
|
||||||
ElSlider: typeof import('element-plus/es')['ElSlider']
|
|
||||||
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
|
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
|
||||||
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
||||||
ElTable: typeof import('element-plus/es')['ElTable']
|
ElTable: typeof import('element-plus/es')['ElTable']
|
||||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||||
ElTag: typeof import('element-plus/es')['ElTag']
|
ElTag: typeof import('element-plus/es')['ElTag']
|
||||||
|
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
||||||
ErrorLog: typeof import('./src/components/ErrorLog/index.vue')['default']
|
ErrorLog: typeof import('./src/components/ErrorLog/index.vue')['default']
|
||||||
GithubCorner: typeof import('./src/components/GithubCorner/index.vue')['default']
|
GithubCorner: typeof import('./src/components/GithubCorner/index.vue')['default']
|
||||||
Hamburger: typeof import('./src/components/Hamburger/index.vue')['default']
|
Hamburger: typeof import('./src/components/Hamburger/index.vue')['default']
|
||||||
|
@ -2,24 +2,28 @@ import request from '@/utils/request';
|
|||||||
function getCurrentTimestamp() {
|
function getCurrentTimestamp() {
|
||||||
return new Date().getTime();
|
return new Date().getTime();
|
||||||
}
|
}
|
||||||
export function SystemGetByProjId(projectId, token) {
|
export function GetProject(projectId, token) {
|
||||||
return request({
|
return request({
|
||||||
url: '/module/get',
|
url: '/project/get/' + projectId,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: { projectId },
|
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization':'Bearer '+token,
|
'Authorization':'Bearer '+ token,
|
||||||
'content-type': 'application/json;charset=utf-8',
|
'content-type': 'application/json;charset=utf-8',
|
||||||
'Timestamp': getCurrentTimestamp()
|
'Timestamp': getCurrentTimestamp()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchArticle(id) {
|
export function GetProjectInfo(token,id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/vue-element-admin/article/detail',
|
url: '/project/get/id/',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: { id }
|
params: { id },
|
||||||
|
headers: {
|
||||||
|
'Authorization':'Bearer '+ token,
|
||||||
|
'content-type': 'application/json;charset=utf-8',
|
||||||
|
'Timestamp': getCurrentTimestamp()
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +82,7 @@ import Upload from '@/components/Upload/SingleImage3';
|
|||||||
import MDinput from '@/components/MDinput';
|
import MDinput from '@/components/MDinput';
|
||||||
import Sticky from '@/components/Sticky'; // 粘性header组件
|
import Sticky from '@/components/Sticky'; // 粘性header组件
|
||||||
import { validURL } from '@/utils/validate';
|
import { validURL } from '@/utils/validate';
|
||||||
import { fetchArticle } from '@/api/article';
|
import { fetchArticle } from '@/api/project';
|
||||||
import { searchUser } from '@/api/remote-search';
|
import { searchUser } from '@/api/remote-search';
|
||||||
import Warning from './Warning';
|
import Warning from './Warning';
|
||||||
import { CommentDropdown, PlatformDropdown, SourceUrlDropdown } from './Dropdown';
|
import { CommentDropdown, PlatformDropdown, SourceUrlDropdown } from './Dropdown';
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { parseTime } from '@/utils';
|
import { parseTime } from '@/utils';
|
||||||
import { fetchList } from '@/api/article';
|
import { fetchList } from '@/api/project';
|
||||||
import Pagination from '@/components/Pagination'; // Secondary package based on el-pagination
|
import Pagination from '@/components/Pagination'; // Secondary package based on el-pagination
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent, markRaw } from 'vue';
|
import { defineComponent, markRaw } from 'vue';
|
||||||
import { fetchList } from '@/api/article';
|
import { fetchList } from '@/api/project';
|
||||||
import { parseTime } from '@/utils';
|
import { parseTime } from '@/utils';
|
||||||
// options components
|
// options components
|
||||||
import FilenameOption from './components/FilenameOption';
|
import FilenameOption from './components/FilenameOption';
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent, markRaw } from 'vue';
|
import { defineComponent, markRaw } from 'vue';
|
||||||
import { fetchList } from '@/api/article';
|
import { fetchList } from '@/api/project';
|
||||||
import { parseTime } from '@/utils';
|
import { parseTime } from '@/utils';
|
||||||
import { Document as IconDocument, Timer as IconTimer } from '@element-plus/icons-vue';
|
import { Document as IconDocument, Timer as IconTimer } from '@element-plus/icons-vue';
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent, markRaw } from 'vue';
|
import { defineComponent, markRaw } from 'vue';
|
||||||
import { fetchList } from '@/api/article';
|
import { fetchList } from '@/api/project';
|
||||||
import { Document as IconDocument, Timer as IconTimer } from '@element-plus/icons-vue';
|
import { Document as IconDocument, Timer as IconTimer } from '@element-plus/icons-vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -1,3 +1,565 @@
|
|||||||
<template>
|
<template>
|
||||||
hello
|
<el-card style="max-width: 100vw;margin: 1.5vw;">
|
||||||
</template>
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<span>项目1</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div style="display: flex; gap: 100px">
|
||||||
|
<el-input
|
||||||
|
v-model="input1"
|
||||||
|
style="width: 550px"
|
||||||
|
placeholder="请输入"
|
||||||
|
>
|
||||||
|
<template #prepend>名称</template>
|
||||||
|
</el-input>
|
||||||
|
<el-input
|
||||||
|
v-model="input2"
|
||||||
|
style="width: 550px"
|
||||||
|
placeholder="请输入"
|
||||||
|
>
|
||||||
|
<template #prepend>状态</template>
|
||||||
|
</el-input>
|
||||||
|
<div>
|
||||||
|
<el-button-group>
|
||||||
|
<el-button type="primary">查询</el-button>
|
||||||
|
<el-button>重置</el-button>
|
||||||
|
</el-button-group>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<template #footer>Footer content</template>
|
||||||
|
</el-card>
|
||||||
|
<el-card style="max-width: 100vw;margin: 1.5vw;">
|
||||||
|
<div>
|
||||||
|
<el-table :data="tableData" ref="multipleTableRef" style="width: 100%">
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column prop="id" label="序号">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.id }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="name" label="项目名称">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.name }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="address" label="工作量">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.id }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="cycle" label="周期">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.cycle }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="principal_id" label="负责人">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.principal_id }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="status" label="状态">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.status }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="tags" label="标签">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.tags }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="file" label="文档(点击下载">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.file }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="address" label="项目简介">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.id }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="deadline" label="截止时间">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.deadline }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="address" label="操作">
|
||||||
|
<el-button text>
|
||||||
|
查看详情
|
||||||
|
</el-button>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; justify-content: center;margin-top: 2vh">
|
||||||
|
<el-pagination background layout="prev, pager, next" :total="1000" />
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { ElTable } from 'element-plus';
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
import {
|
||||||
|
GetProject,
|
||||||
|
GetProjectInfo
|
||||||
|
} from '@/api/project';
|
||||||
|
|
||||||
|
const input1 = ref('');
|
||||||
|
const input2 = ref('');
|
||||||
|
/* interface User {
|
||||||
|
date: string
|
||||||
|
name: string
|
||||||
|
address: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const multipleTableRef = ref<InstanceType<typeof ElTable>>();
|
||||||
|
const multipleSelection = ref<User[]>([]);
|
||||||
|
|
||||||
|
const handleSelectionChange = (val: User[]) => {
|
||||||
|
multipleSelection.value = val;
|
||||||
|
};
|
||||||
|
const tableData = [
|
||||||
|
{
|
||||||
|
date: '2016-05-03',
|
||||||
|
name: 'Tom',
|
||||||
|
address: 'No. 189, Grove St, Los Angeles',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
date: '2016-05-02',
|
||||||
|
name: 'Tom',
|
||||||
|
address: 'No. 189, Grove St, Los Angeles',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
date: '2016-05-04',
|
||||||
|
name: 'Tom',
|
||||||
|
address: 'No. 189, Grove St, Los Angeles',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
date: '2016-05-01',
|
||||||
|
name: 'Tom',
|
||||||
|
address: 'No. 189, Grove St, Los Angeles',
|
||||||
|
},
|
||||||
|
]; */
|
||||||
|
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name:'projectTable',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tableData:[],
|
||||||
|
listLoading: false,
|
||||||
|
token: window.localStorage.getItem('token'),
|
||||||
|
projId:''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true;
|
||||||
|
GetProject(this.projId,this.token).then(response => {
|
||||||
|
this.tableData = response.data.data;
|
||||||
|
// Just to simulate the time of the request
|
||||||
|
setTimeout(() => {
|
||||||
|
this.listLoading = false;
|
||||||
|
}, 1.5 * 1000);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<div class="filter-container">
|
||||||
|
<el-input v-model="listQuery.title" placeholder="Title" style="width: 200px;" class="filter-item" @keyup.enter="handleFilter" />
|
||||||
|
<el-select v-model="listQuery.importance" placeholder="Imp" clearable style="width: 90px" class="filter-item">
|
||||||
|
<el-option v-for="item in importanceOptions" :key="item" :label="item" :value="item" />
|
||||||
|
</el-select>
|
||||||
|
<el-select v-model="listQuery.type" placeholder="Type" clearable class="filter-item" style="width: 130px">
|
||||||
|
<el-option v-for="item in calendarTypeOptions" :key="item.key" :label="item.display_name+'('+item.key+')'" :value="item.key" />
|
||||||
|
</el-select>
|
||||||
|
<el-select v-model="listQuery.sort" style="width: 140px" class="filter-item" @change="handleFilter">
|
||||||
|
<el-option v-for="item in sortOptions" :key="item.key" :label="item.label" :value="item.key" />
|
||||||
|
</el-select>
|
||||||
|
<el-button class="filter-item" type="primary" :icon="iconSearch" @click="handleFilter">
|
||||||
|
<span v-waves>Search</span>
|
||||||
|
</el-button>
|
||||||
|
<el-button class="filter-item" style="margin-left: 10px;" type="primary" :icon="iconEdit" @click="handleCreate">
|
||||||
|
Add
|
||||||
|
</el-button>
|
||||||
|
<el-button :loading="downloadLoading" class="filter-item" type="primary" :icon="iconDownload" @click="handleDownload">
|
||||||
|
<span v-waves>Export</span>
|
||||||
|
</el-button>
|
||||||
|
<el-checkbox v-model="showReviewer" class="filter-item" style="margin-left:15px;" @change="tableKey=tableKey+1">
|
||||||
|
reviewer
|
||||||
|
</el-checkbox>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
:key="tableKey"
|
||||||
|
v-loading="listLoading"
|
||||||
|
:data="list"
|
||||||
|
border
|
||||||
|
fit
|
||||||
|
highlight-current-row
|
||||||
|
style="width: 100%;"
|
||||||
|
@sort-change="sortChange"
|
||||||
|
>
|
||||||
|
<el-table-column label="序号" prop="id" sortable="custom" align="center" width="80" :class-name="getSortClass('id')">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.id }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="子系统名称" width="150px" align="center">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ parseTime(row.timestamp, '{y}-{m}-{d} {h}:{i}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="工作量" min-width="150px">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span class="link-type" @click="handleUpdate(row)">{{ row.title }}</span>
|
||||||
|
<el-tag>{{ typeFilter(row.type) }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="周期" width="110px" align="center">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span>{{ row.author }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column v-if="showReviewer" label="负责人" width="110px" align="center">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span style="color:red;">{{ row.reviewer }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" width="80px">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<svg-icon v-for="n in row.importance" :key="n" icon-class="star" class="meta-item__icon" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="子系统简介" align="center" width="95">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<span v-if="row.pageviews" class="link-type" @click="handleFetchPv(row.pageviews)">{{ row.pageviews }}</span>
|
||||||
|
<span v-else>0</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="截止时间" class-name="status-col" width="100">
|
||||||
|
<template v-slot="{row}">
|
||||||
|
<el-tag :type="statusFilter(row.status)">
|
||||||
|
{{ row.status }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
|
||||||
|
<template v-slot="{row,$index}">
|
||||||
|
<el-button type="primary" size="small" @click="handleUpdate(row)">
|
||||||
|
Edit
|
||||||
|
</el-button>
|
||||||
|
<el-button v-if="row.status!='published'" size="small" type="success" @click="handleModifyStatus(row,'published')">
|
||||||
|
Publish
|
||||||
|
</el-button>
|
||||||
|
<el-button v-if="row.status!='draft'" size="small" @click="handleModifyStatus(row,'draft')">
|
||||||
|
Draft
|
||||||
|
</el-button>
|
||||||
|
<el-button v-if="row.status!='deleted'" size="small" type="danger" @click="handleDelete(row,$index)">
|
||||||
|
Delete
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination v-show="total>0" :total="total" v-model:page="listQuery.page" v-model:limit="listQuery.limit" @pagination="getList" />
|
||||||
|
|
||||||
|
<el-dialog :title="textMap[dialogStatus]" v-model="dialogFormVisible">
|
||||||
|
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="70px" style="width: 400px; margin-left:50px;">
|
||||||
|
<el-form-item label="Type" prop="type">
|
||||||
|
<el-select v-model="temp.type" class="filter-item" placeholder="Please select">
|
||||||
|
<el-option v-for="item in calendarTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Date" prop="timestamp">
|
||||||
|
<el-date-picker v-model="temp.timestamp" type="datetime" placeholder="Please pick a date" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Title" prop="title">
|
||||||
|
<el-input v-model="temp.title" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Status">
|
||||||
|
<el-select v-model="temp.status" class="filter-item" placeholder="Please select">
|
||||||
|
<el-option v-for="item in statusOptions" :key="item" :label="item" :value="item" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Imp">
|
||||||
|
<el-rate v-model="temp.importance" :colors="['#99A9BF', '#F7BA2A', '#FF9900']" :max="3" style="margin-top:8px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Remark">
|
||||||
|
<el-input v-model="temp.remark" :autosize="{ minRows: 2, maxRows: 4}" type="textarea" placeholder="Please input" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="dialogFormVisible = false">
|
||||||
|
Cancel
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" @click="dialogStatus==='create'?createData():updateData()">
|
||||||
|
Confirm
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog v-model="dialogPvVisible" title="Reading statistics">
|
||||||
|
<el-table :data="pvData" border fit highlight-current-row style="width: 100%">
|
||||||
|
<el-table-column prop="key" label="Channel" />
|
||||||
|
<el-table-column prop="pv" label="Pv" />
|
||||||
|
</el-table>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="dialogPvVisible = false">Confirm</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { defineComponent, markRaw } from 'vue';
|
||||||
|
import { Search, Edit, Download } from '@element-plus/icons-vue';
|
||||||
|
import {
|
||||||
|
GetProject,
|
||||||
|
fetchPv,
|
||||||
|
createArticle,
|
||||||
|
updateArticle,
|
||||||
|
} from '@/api/article';
|
||||||
|
import waves from '@/directive/waves'; // waves directive
|
||||||
|
import { parseTime } from '@/utils';
|
||||||
|
import Pagination from '@/components/Pagination'; // secondary package based on el-pagination
|
||||||
|
|
||||||
|
const calendarTypeOptions = [
|
||||||
|
{ key: 'CN', display_name: 'China' },
|
||||||
|
{ key: 'US', display_name: 'USA' },
|
||||||
|
{ key: 'JP', display_name: 'Japan' },
|
||||||
|
{ key: 'EU', display_name: 'Eurozone' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// arr to obj, such as { CN : "China", US : "USA" }
|
||||||
|
const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
|
||||||
|
acc[cur.key] = cur.display_name;
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'ComplexTable',
|
||||||
|
components: { Pagination },
|
||||||
|
directives: { waves },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
iconSearch: markRaw(Search),
|
||||||
|
iconEdit: markRaw(Edit),
|
||||||
|
iconDownload: markRaw(Download),
|
||||||
|
tableKey: 0,
|
||||||
|
list: null,
|
||||||
|
total: 0,
|
||||||
|
listLoading: true,
|
||||||
|
listQuery: {
|
||||||
|
page: 1,
|
||||||
|
limit: 20,
|
||||||
|
},
|
||||||
|
importanceOptions: [1, 2, 3],
|
||||||
|
calendarTypeOptions,
|
||||||
|
sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
|
||||||
|
statusOptions: ['published', 'draft', 'deleted'],
|
||||||
|
showReviewer: false,
|
||||||
|
temp: {
|
||||||
|
id: undefined,
|
||||||
|
importance: 1,
|
||||||
|
remark: '',
|
||||||
|
timestamp: new Date(),
|
||||||
|
title: '',
|
||||||
|
type: '',
|
||||||
|
status: 'published'
|
||||||
|
},
|
||||||
|
dialogFormVisible: false,
|
||||||
|
dialogStatus: '',
|
||||||
|
textMap: {
|
||||||
|
update: 'Edit',
|
||||||
|
create: 'Create'
|
||||||
|
},
|
||||||
|
dialogPvVisible: false,
|
||||||
|
pvData: [],
|
||||||
|
rules: {
|
||||||
|
type: [{ required: true, message: 'type is required', trigger: 'change' }],
|
||||||
|
timestamp: [{ type: 'date', required: true, message: 'timestamp is required', trigger: 'change' }],
|
||||||
|
title: [{ required: true, message: 'title is required', trigger: 'blur' }]
|
||||||
|
},
|
||||||
|
downloadLoading: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
parseTime,
|
||||||
|
statusFilter(status) {
|
||||||
|
const statusMap = {
|
||||||
|
published: 'success',
|
||||||
|
draft: 'info',
|
||||||
|
deleted: 'danger'
|
||||||
|
};
|
||||||
|
return statusMap[status];
|
||||||
|
},
|
||||||
|
typeFilter(type) {
|
||||||
|
return calendarTypeKeyValue[type];
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true;
|
||||||
|
GetProject(this.listQuery).then(response => {
|
||||||
|
this.list = response.data.items;
|
||||||
|
this.total = response.data.total;
|
||||||
|
|
||||||
|
// Just to simulate the time of the request
|
||||||
|
setTimeout(() => {
|
||||||
|
this.listLoading = false;
|
||||||
|
}, 1.5 * 1000);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleFilter() {
|
||||||
|
this.listQuery.page = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
handleModifyStatus(row, status) {
|
||||||
|
ElMessage({
|
||||||
|
message: '操作Success',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
row.status = status;
|
||||||
|
},
|
||||||
|
sortChange(data) {
|
||||||
|
const { prop, order } = data;
|
||||||
|
if (prop === 'id') {
|
||||||
|
this.sortByID(order);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sortByID(order) {
|
||||||
|
if (order === 'ascending') {
|
||||||
|
this.listQuery.sort = '+id';
|
||||||
|
} else {
|
||||||
|
this.listQuery.sort = '-id';
|
||||||
|
}
|
||||||
|
this.handleFilter();
|
||||||
|
},
|
||||||
|
resetTemp() {
|
||||||
|
this.temp = {
|
||||||
|
id: undefined,
|
||||||
|
importance: 1,
|
||||||
|
remark: '',
|
||||||
|
timestamp: new Date(),
|
||||||
|
title: '',
|
||||||
|
status: 'published',
|
||||||
|
type: ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
handleCreate() {
|
||||||
|
this.resetTemp();
|
||||||
|
this.dialogStatus = 'create';
|
||||||
|
this.dialogFormVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['dataForm'].clearValidate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
createData() {
|
||||||
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.temp.id = parseInt(Math.random() * 100) + 1024; // mock a id
|
||||||
|
this.temp.author = 'vue-element-admin';
|
||||||
|
createArticle(this.temp).then(() => {
|
||||||
|
this.list.unshift(this.temp);
|
||||||
|
this.dialogFormVisible = false;
|
||||||
|
ElNotification({
|
||||||
|
title: 'Success',
|
||||||
|
message: 'Created Successfully',
|
||||||
|
type: 'success',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.temp = Object.assign({}, row); // copy obj
|
||||||
|
this.temp.timestamp = new Date(this.temp.timestamp);
|
||||||
|
this.dialogStatus = 'update';
|
||||||
|
this.dialogFormVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['dataForm'].clearValidate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
updateData() {
|
||||||
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const tempData = Object.assign({}, this.temp);
|
||||||
|
tempData.timestamp = +new Date(tempData.timestamp); // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
|
||||||
|
updateArticle(tempData).then(() => {
|
||||||
|
const index = this.list.findIndex(v => v.id === this.temp.id);
|
||||||
|
this.list.splice(index, 1, this.temp);
|
||||||
|
this.dialogFormVisible = false;
|
||||||
|
ElNotification({
|
||||||
|
title: 'Success',
|
||||||
|
message: 'Update Successfully',
|
||||||
|
type: 'success',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete(row, index) {
|
||||||
|
ElNotification({
|
||||||
|
title: 'Success',
|
||||||
|
message: 'Delete Successfully',
|
||||||
|
type: 'success',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
this.list.splice(index, 1);
|
||||||
|
},
|
||||||
|
handleFetchPv(pv) {
|
||||||
|
fetchPv(pv).then(response => {
|
||||||
|
this.pvData = response.data.pvData;
|
||||||
|
this.dialogPvVisible = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDownload() {
|
||||||
|
this.downloadLoading = true;
|
||||||
|
import('@/vendor/Export2Excel').then(excel => {
|
||||||
|
const tHeader = ['timestamp', 'title', 'type', 'importance', 'status'];
|
||||||
|
const filterVal = ['timestamp', 'title', 'type', 'importance', 'status'];
|
||||||
|
const data = this.formatJson(filterVal);
|
||||||
|
excel.export_json_to_excel({
|
||||||
|
header: tHeader,
|
||||||
|
data,
|
||||||
|
filename: 'table-list'
|
||||||
|
});
|
||||||
|
this.downloadLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
formatJson(filterVal) {
|
||||||
|
return this.list.map(v => filterVal.map(j => {
|
||||||
|
if (j === 'timestamp') {
|
||||||
|
return parseTime(v[j]);
|
||||||
|
} else {
|
||||||
|
return v[j];
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
getSortClass: function(key) {
|
||||||
|
const sort = this.listQuery.sort;
|
||||||
|
return sort === `+${key}` ? 'ascending' : 'descending';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
-->
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { parseTime } from '@/utils';
|
import { parseTime } from '@/utils';
|
||||||
import { fetchList } from '@/api/article';
|
import { fetchList } from '@/api/project';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<template>
|
<!--<template>
|
||||||
<el-card style="max-width: 100vw;margin: 1.5vw;">
|
<el-card style="max-width: 100vw;margin: 1.5vw;">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
@ -123,9 +123,9 @@ const tableData = [
|
|||||||
address: 'No. 189, Grove St, Los Angeles',
|
address: 'No. 189, Grove St, Los Angeles',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
</script>
|
</script>-->
|
||||||
|
|
||||||
<!--<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!– Note that row-key is necessary to get a correct row order. –>
|
<!– Note that row-key is necessary to get a correct row order. –>
|
||||||
<el-table ref="dragTable" v-loading="listLoading" :data="list" row-key="id" border fit highlight-current-row style="width: 100%">
|
<el-table ref="dragTable" v-loading="listLoading" :data="list" row-key="id" border fit highlight-current-row style="width: 100%">
|
||||||
@ -190,7 +190,7 @@ const tableData = [
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { SystemGetByProjId } from '@/api/article';
|
import { SystemGetByProjId } from '@/api/project';
|
||||||
import Sortable from "sortablejs";
|
import Sortable from "sortablejs";
|
||||||
import { parseTime } from '@/utils';
|
import { parseTime } from '@/utils';
|
||||||
const token: string | null = window.localStorage.getItem('token')
|
const token: string | null = window.localStorage.getItem('token')
|
||||||
@ -258,7 +258,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>-->
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.sortable-ghost{
|
.sortable-ghost{
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent, markRaw } from 'vue';
|
import { defineComponent, markRaw } from 'vue';
|
||||||
import { fetchList } from '@/api/article';
|
import { fetchList } from '@/api/project';
|
||||||
import { parseTime } from '@/utils';
|
import { parseTime } from '@/utils';
|
||||||
import { Refresh, CircleCheck, Edit } from '@element-plus/icons-vue';
|
import { Refresh, CircleCheck, Edit } from '@element-plus/icons-vue';
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { fetchList } from '@/api/article';
|
import { fetchList } from '@/api/project';
|
||||||
import { Timer as IconTimer, Document as IconDocument } from '@element-plus/icons-vue';
|
import { Timer as IconTimer, Document as IconDocument } from '@element-plus/icons-vue';
|
||||||
import { markRaw } from 'vue';
|
import { markRaw } from 'vue';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user