|
|
@@ -0,0 +1,289 @@
|
|
|
+<template>
|
|
|
+ <div class="template">
|
|
|
+ <div class="template-list">
|
|
|
+ <div id="query-form">
|
|
|
+ <el-form inline>
|
|
|
+ <el-form-item prop="storage_type" label="来源">
|
|
|
+ <el-select v-model="form.storage_type">
|
|
|
+ <el-option v-for="item in storage_type_list" :key="item.value" :value="item.value" :label="item.label" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="name" label="名称">
|
|
|
+ <el-input v-model="form.name" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- <el-form-item prop="status" label="状态">
|
|
|
+ <el-select v-model="form.status">
|
|
|
+ <el-option v-for="item in status_list" :key="item.value" :value="item.value" :label="item.label" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item> -->
|
|
|
+ <el-form-item class="search-box">
|
|
|
+ <el-button class="search-btn" type="primary" @click="queryList">查询</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <el-table v-if="tableHeight" :data="list" :max-height="tableHeight + 'px'">
|
|
|
+ <el-table-column
|
|
|
+ type="index"
|
|
|
+ label="序号"
|
|
|
+ width="60"
|
|
|
+ align="center"
|
|
|
+ :index="(form.cur_page - 1) * form.page_capacity + 1"
|
|
|
+ header-align="center"
|
|
|
+ class-name="index-column"
|
|
|
+ />
|
|
|
+ <el-table-column prop="sn" width="140" label="编号" align="center" header-align="center" />
|
|
|
+ <el-table-column prop="name" min-width="140" label="名称" align="center" header-align="center" />
|
|
|
+ <el-table-column prop="label_list" label="标签" align="center" header-align="center">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ {{ row.label_list.join('、') }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="type_name" width="90" label="结构类型" align="center" header-align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="content_type_name" width="90" label="内容类型" align="center" header-align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <!-- <el-table-column prop="memo" label="描述" align="center" header-align="center" /> -->
|
|
|
+
|
|
|
+ <el-table-column width="70" prop="storage_type_name" label="来源" align="center" header-align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="120" prop="status_name" label="状态" align="center" header-align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="80" prop="use_scope_name" label="使用范围" align="center" header-align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="request_status_name" width="120" label="申请状态" align="center" header-align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="org_name" width="120" label="机构" align="center" header-align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="create_time" label="创建时间" align="center" width="180" header-align="center" />
|
|
|
+
|
|
|
+ <el-table-column prop="operation" label="操作" fixed="right" width="230" align="center" header-align="center">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span class="link" @click="previewTemplate(row)">预览</span>
|
|
|
+ <span
|
|
|
+ class="link"
|
|
|
+ v-for="(item, index) in row.cur_can_operate_button_list"
|
|
|
+ :key="index"
|
|
|
+ @click="handleOperate(row, item)"
|
|
|
+ >{{ operate_button[item] }}</span
|
|
|
+ >
|
|
|
+
|
|
|
+ <template v-if="row.is_can_audit === 'true'">
|
|
|
+ <span class="link" @click="handleAudit(row, 'true')">审核通过</span>
|
|
|
+ <span class="link" @click="handleAudit(row, 'false')">审核拒绝</span>
|
|
|
+ </template>
|
|
|
+ <span class="link danger" v-if="row.is_can_delete === 'true'" @click="deleteTemplate(row)">删除</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <PaginationPage ref="pagination" :total="total" @getList="queryTemplateList" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import PaginationPage from '@/components/PaginationPage.vue';
|
|
|
+
|
|
|
+import { PageQueryTemplateListAdmin } from '@/api/list.js';
|
|
|
+import {
|
|
|
+ UpdateTemplateStatus,
|
|
|
+ UpdateTemplateUseScope,
|
|
|
+ DeleteTemplate,
|
|
|
+ TemplateAuditOperate,
|
|
|
+ TemplateRequestOperate,
|
|
|
+} from '@/api/template';
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'PersonalWorkbenchTemplateAdmin',
|
|
|
+ components: {
|
|
|
+ PaginationPage,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ cur_page_begin_index: 0,
|
|
|
+ status_list: [
|
|
|
+ {
|
|
|
+ value: -1,
|
|
|
+ label: '全部',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 0,
|
|
|
+ label: '草稿',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 1,
|
|
|
+ label: '申请发布',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 2,
|
|
|
+ label: '已发布',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 3,
|
|
|
+ label: '未发布',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 4,
|
|
|
+ label: '驳回发布申请',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ storage_type_list: [
|
|
|
+ {
|
|
|
+ value: -1,
|
|
|
+ label: '全部',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 0,
|
|
|
+ label: '个人库',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 1,
|
|
|
+ label: '机构库',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ form: {
|
|
|
+ name: '',
|
|
|
+ storage_type: -1,
|
|
|
+ page_capacity: 10,
|
|
|
+ cur_page: 1,
|
|
|
+ },
|
|
|
+ tableHeight: 0,
|
|
|
+ operate_button: {
|
|
|
+ 1: '申请机构共享',
|
|
|
+ 3: '申请发布',
|
|
|
+ 5: '申请全域共享',
|
|
|
+ 7: '发布',
|
|
|
+ 8: '取消发布',
|
|
|
+ 9: '撤回申请',
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.tableHeight =
|
|
|
+ document.getElementsByClassName('app-container')[0].clientHeight -
|
|
|
+ document.getElementById('query-form').clientHeight -
|
|
|
+ document.getElementsByClassName('el-pagination')[0].clientHeight -
|
|
|
+ 10;
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ queryTemplateList(data) {
|
|
|
+ this.form.page_capacity = data.page_capacity;
|
|
|
+ this.form.cur_page = data.cur_page;
|
|
|
+ PageQueryTemplateListAdmin(this.form).then(({ total_count, template_list }) => {
|
|
|
+ this.total = total_count;
|
|
|
+ this.list = template_list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ queryList() {
|
|
|
+ this.queryTemplateList({ cur_page: 1, page_capacity: this.form.page_capacity });
|
|
|
+ },
|
|
|
+ // 预览模板
|
|
|
+ previewTemplate(row) {
|
|
|
+ if (!row.id) return;
|
|
|
+ this.$router.push({
|
|
|
+ path: `/personal_workbench/template_list/preview/${row.id}`,
|
|
|
+ query: { template_type: 'manager' },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 更改模板状态
|
|
|
+ changeStatusTemplate(row, status) {
|
|
|
+ UpdateTemplateStatus({ status, id: row.id }).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '操作成功!',
|
|
|
+ });
|
|
|
+ this.queryTemplateList({ cur_page: this.form.cur_page, page_capacity: this.form.page_capacity });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 更改使用范围
|
|
|
+ changeUseScope(row) {
|
|
|
+ UpdateTemplateUseScope({ use_scope: row.use_scope === 0 ? 1 : 0, id: row.id }).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '设置成功!',
|
|
|
+ });
|
|
|
+ this.queryTemplateList({ cur_page: this.form.cur_page, page_capacity: this.form.page_capacity });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 删除模板
|
|
|
+ deleteTemplate(row) {
|
|
|
+ this.$confirm('是否删除此模板?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ DeleteTemplate({ id: row.id }).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!',
|
|
|
+ });
|
|
|
+ this.queryTemplateList({ cur_page: this.form.cur_page, page_capacity: this.form.page_capacity });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ // 审核通过/拒绝
|
|
|
+ handleAudit(row, type) {
|
|
|
+ this.$confirm(type === 'true' ? '是否审核通过此模板?' : '是否审核拒绝此模板?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ TemplateAuditOperate({ template_id: row.id, is_pass: type }).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '操作成功!',
|
|
|
+ });
|
|
|
+ this.queryTemplateList({ cur_page: this.form.cur_page, page_capacity: this.form.page_capacity });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ // 操作
|
|
|
+ handleOperate(row, type) {
|
|
|
+ TemplateRequestOperate({ template_id: row.id, operate_type: type }).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '操作成功!',
|
|
|
+ });
|
|
|
+ this.queryTemplateList({ cur_page: this.form.cur_page, page_capacity: this.form.page_capacity });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+@use '@/styles/mixin.scss' as *;
|
|
|
+
|
|
|
+.template {
|
|
|
+ @include page-base;
|
|
|
+ @include table-list;
|
|
|
+
|
|
|
+ #query-form {
|
|
|
+ display: flex;
|
|
|
+ gap: 10px;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ :deep .el-form-item--small.el-form-item {
|
|
|
+ margin-bottom: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|