|
@@ -0,0 +1,350 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="book org">
|
|
|
|
|
+ <ProjectMenu cur-key="org/authorization" />
|
|
|
|
|
+
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-button type="primary" @click="dialogFormEdit = true">创建链接</el-button>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ <el-divider />
|
|
|
|
|
+ <div id="query-form">
|
|
|
|
|
+ <el-form inline>
|
|
|
|
|
+ <el-form-item prop="type" label="链接类型">
|
|
|
|
|
+ <el-select v-model="queryForm.type" placeholder="请选择类型">
|
|
|
|
|
+ <el-option label="全部" :value="-1" />
|
|
|
|
|
+ <el-option label="试用" :value="0" />
|
|
|
|
|
+ <el-option label="一书一码" :value="1" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item prop="book_name" label="教材">
|
|
|
|
|
+ <el-input v-model="queryForm.book_name" clearable />
|
|
|
|
|
+ </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>
|
|
|
|
|
+ <div class="book-list">
|
|
|
|
|
+ <el-table :data="list">
|
|
|
|
|
+ <el-table-column label="序号" width="60" align="center" header-align="center" class-name="index-column">
|
|
|
|
|
+ <template slot-scope="{ $index }">
|
|
|
|
|
+ {{ cur_page_begin_index + $index }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="类型" width="120" align="center" header-align="center">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ {{ row.type == 0 ? '试用' : '一书一码' }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="book_name" label="教材" />
|
|
|
|
|
+ <el-table-column prop="identity_code" label="识别码" width="240" align="center" />
|
|
|
|
|
+ <el-table-column prop="creator_name" label="创建人" width="120" />
|
|
|
|
|
+ <el-table-column prop="create_time" label="创建时间" width="180" />
|
|
|
|
|
+ <el-table-column label="有效天数" width="100" align="center" header-align="center">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ {{ row.effective_day_count == -1 ? '永久' : row.effective_day_count + '天' }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+
|
|
|
|
|
+ <el-table-column label="有效截止日期" width="120" align="center" header-align="center">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ <span v-if="isTrue(row.is_disabled)" style="color: red">已废弃</span>
|
|
|
|
|
+ <span v-else-if="row.effective_day_count === -1">--</span>
|
|
|
|
|
+ <span v-else>{{ row.effective_end_date }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="操作" fixed="right" width="270" align="center" header-align="center">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ <span class="link" @click="copyUrl(row.id)">复制链接</span>
|
|
|
|
|
+ <el-divider direction="vertical" />
|
|
|
|
|
+ <span class="link" @click="handleDisable(row.id)">废弃</span>
|
|
|
|
|
+ <el-divider direction="vertical" />
|
|
|
|
|
+ <span class="link" @click="handleDel(row.id)">删除</span>
|
|
|
|
|
+ <!-- <el-divider direction="vertical" /> -->
|
|
|
|
|
+ <!-- <span class="link" @click="handleOpenLog('', row.id)">查看访问日志</span> -->
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+
|
|
|
|
|
+ <PaginationPage :total="total" @getList="pageList" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <el-dialog title="创建链接" width="500px" :visible.sync="dialogFormEdit" :close-on-click-modal="false">
|
|
|
|
|
+ <el-form ref="editForm" :model="editForm" :rules="rules" label-width="100px">
|
|
|
|
|
+ <el-form-item label="教材" prop="book_name">
|
|
|
|
|
+ <el-input v-model="editForm.book_name" disabled class="input-with-select" placeholder="请选择教材">
|
|
|
|
|
+ <el-button slot="append" icon="el-icon-search" @click="handleSearchBook('')" />
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="类型" prop="type">
|
|
|
|
|
+ <el-select v-model="editForm.type" placeholder="请选择类型">
|
|
|
|
|
+ <el-option label="试用" :value="0" />
|
|
|
|
|
+ <el-option label="一书一码" :value="1" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="有效期类型" prop="is_forever">
|
|
|
|
|
+ <el-select v-model="editForm.is_forever" placeholder="请选择有效期类型" @change="handleForeverChange">
|
|
|
|
|
+ <el-option label="永久" value="true" />
|
|
|
|
|
+ <el-option label="期限" value="false" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item v-if="!isTrue(editForm.is_forever)" label="有效期" prop="effective_date">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="editForm.effective_date"
|
|
|
|
|
+ type="daterange"
|
|
|
|
|
+ range-separator="至"
|
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="备注" prop="memo">
|
|
|
|
|
+ <el-input v-model="editForm.memo" type="textarea" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
|
+ <el-button @click="dialogFormEdit = false">取 消</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="handleSave('editForm')">确 定</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <el-dialog title="选择教材" width="950px" :visible.sync="dialogSearchBook" :close-on-click-modal="false">
|
|
|
|
|
+ <el-table :data="bookList">
|
|
|
|
|
+ <el-table-column label="序号" width="60" align="center" header-align="center" class-name="index-column">
|
|
|
|
|
+ <template slot-scope="{ $index }">
|
|
|
|
|
+ {{ cur_page_begin_index + $index }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="sn" label="编号" width="120" header-align="center" />
|
|
|
|
|
+ <el-table-column prop="name" label="名称" min-width="240" header-align="center" />
|
|
|
|
|
+ <el-table-column prop="project_sn" label="项目编号" width="120" header-align="center" />
|
|
|
|
|
+ <el-table-column prop="project_name" label="项目名称" width="240" header-align="center" />
|
|
|
|
|
+ <el-table-column label="操作" width="80">
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ <el-button type="primary" @click="selectBook(row)">选择</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ <PaginationPage :total="bookTotal" @getList="pageBookList" />
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ :title="'【' + logTitle + '】访问日志'"
|
|
|
|
|
+ width="800px"
|
|
|
|
|
+ :visible.sync="dialogVisitLog"
|
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-table :data="logList">
|
|
|
|
|
+ <el-table-column label="序号" width="60" align="center" header-align="center" class-name="index-column">
|
|
|
|
|
+ <template slot-scope="{ $index }">
|
|
|
|
|
+ {{ cur_page_begin_index + $index }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="sn" label="编号" width="120" header-align="center" />
|
|
|
|
|
+ <el-table-column prop="name" label="名称" header-align="center" />
|
|
|
|
|
+ <el-table-column prop="project_sn" label="项目编号" width="120" header-align="center" />
|
|
|
|
|
+ <el-table-column prop="create_time" label="访问时间" width="180" />
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ <PaginationPage :total="logkTotal" @getList="pageLogList" />
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+import ProjectMenu from '@/views/project_manage/common/ProjectMenu.vue';
|
|
|
|
|
+import PaginationPage from '@/components/PaginationPage.vue';
|
|
|
|
|
+
|
|
|
|
|
+import { PageQueryYSJBookList_OrgManager } from '@/api/list';
|
|
|
|
|
+import { CreateOBOC, DeleteOBOC, DisableOBOC, PageQueryOBOCList } from '@/api/oboc';
|
|
|
|
|
+import { isTrue } from '@/utils/validate';
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: 'OrgProjectManageAuthorization',
|
|
|
|
|
+ components: {
|
|
|
|
|
+ ProjectMenu,
|
|
|
|
|
+ PaginationPage,
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ list: [],
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ logTitle: '',
|
|
|
|
|
+ cur_page_begin_index: 0,
|
|
|
|
|
+ bookList: [],
|
|
|
|
|
+ bookTotal: 0,
|
|
|
|
|
+ bookPageIndex: 0,
|
|
|
|
|
+ logList: [],
|
|
|
|
|
+ logkTotal: 0,
|
|
|
|
|
+ logPageIndex: 0,
|
|
|
|
|
+ isTrue,
|
|
|
|
|
+ dialogFormEdit: false,
|
|
|
|
|
+ dialogSearchBook: false,
|
|
|
|
|
+ dialogVisitLog: false,
|
|
|
|
|
+ queryForm: {
|
|
|
|
|
+ book_name: '',
|
|
|
|
|
+ type: -1,
|
|
|
|
|
+ page_capacity: 10,
|
|
|
|
|
+ cur_page: 1,
|
|
|
|
|
+ },
|
|
|
|
|
+ editForm: {
|
|
|
|
|
+ book_id: '',
|
|
|
|
|
+ book_name: '',
|
|
|
|
|
+ type: 1,
|
|
|
|
|
+ is_forever: 'true',
|
|
|
|
|
+ effective_date: '',
|
|
|
|
|
+ memo: '',
|
|
|
|
|
+ },
|
|
|
|
|
+ rules: {
|
|
|
|
|
+ book_name: [{ required: true, message: '请选择教材', trigger: 'blur' }],
|
|
|
|
|
+ type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
|
|
|
|
|
+ is_forever: [{ required: true, message: '请选择有效期类型', trigger: 'blur' }],
|
|
|
|
|
+ effective_date: [{ required: true, message: '请选择有效期', trigger: 'blur' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {},
|
|
|
|
|
+ watch: {
|
|
|
|
|
+ dialogFormEdit: {
|
|
|
|
|
+ handler(val) {
|
|
|
|
|
+ if (!val) {
|
|
|
|
|
+ this.$refs.editForm.resetFields();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ deep: true,
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ queryList() {
|
|
|
|
|
+ this.pageList(this.queryForm);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ pageList(data) {
|
|
|
|
|
+ Object.assign(this.queryForm, data);
|
|
|
|
|
+ PageQueryOBOCList(this.queryForm).then(({ total_count, oboc_list, cur_page_begin_index }) => {
|
|
|
|
|
+ this.list = oboc_list;
|
|
|
|
|
+ this.total = total_count;
|
|
|
|
|
+ this.cur_page_begin_index = cur_page_begin_index;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ pageBookList(data) {
|
|
|
|
|
+ this.handleSearchBook(data);
|
|
|
|
|
+ },
|
|
|
|
|
+ pageLogList(data) {
|
|
|
|
|
+ this.handleOpenLog(data);
|
|
|
|
|
+ },
|
|
|
|
|
+ handleForeverChange(value) {
|
|
|
|
|
+ if (value === 'true') {
|
|
|
|
|
+ // 如果是永久有效,清空日期选择
|
|
|
|
|
+ this.editForm.effective_date = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ handleSearchBook(data) {
|
|
|
|
|
+ let page = data || {
|
|
|
|
|
+ cur_page: 1,
|
|
|
|
|
+ page_capacity: 10,
|
|
|
|
|
+ };
|
|
|
|
|
+ PageQueryYSJBookList_OrgManager(page).then(({ total_count, book_list, cur_page_begin_index }) => {
|
|
|
|
|
+ this.bookList = book_list;
|
|
|
|
|
+ this.bookTotal = total_count;
|
|
|
|
|
+ this.bookPageIndex = cur_page_begin_index;
|
|
|
|
|
+ this.dialogSearchBook = true;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ selectBook(book) {
|
|
|
|
|
+ this.editForm.book_name = book.name;
|
|
|
|
|
+ this.editForm.book_id = book.id;
|
|
|
|
|
+ this.dialogSearchBook = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ handleSave(formName) {
|
|
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ let f = this.editForm;
|
|
|
|
|
+ let data = {
|
|
|
|
|
+ book_id_list: [f.book_id],
|
|
|
|
|
+ type: f.type,
|
|
|
|
|
+ is_forever: f.is_forever,
|
|
|
|
|
+ memo: f.memo,
|
|
|
|
|
+ };
|
|
|
|
|
+ if (!this.isTrue(f.is_forever)) {
|
|
|
|
|
+ data.effective_begin_date = f.effective_date[0];
|
|
|
|
|
+ data.effective_end_date = f.effective_date[1];
|
|
|
|
|
+ }
|
|
|
|
|
+ this.dialogSearchBook = false;
|
|
|
|
|
+ CreateOBOC(data).then((res) => {
|
|
|
|
|
+ if (res && res.status == 1) {
|
|
|
|
|
+ this.dialogFormEdit = false;
|
|
|
|
|
+ this.queryList();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ copyUrl(id) {
|
|
|
|
|
+ let url = this.list.find((x) => x.id == id).url;
|
|
|
|
|
+
|
|
|
|
|
+ navigator.clipboard.writeText(url).then(() => {
|
|
|
|
|
+ this.$message.success('链接已复制到剪贴板');
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ async handleDisable(id) {
|
|
|
|
|
+ this.$confirm('确定要废弃此条数据吗?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ DisableOBOC({ id: id }).then(() => {
|
|
|
|
|
+ this.queryList();
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(() => {});
|
|
|
|
|
+ },
|
|
|
|
|
+ async handleDel(id) {
|
|
|
|
|
+ this.$confirm('确定要删除此条数据吗?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ DeleteOBOC({ id: id }).then(() => {
|
|
|
|
|
+ this.queryList();
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(() => {});
|
|
|
|
|
+ },
|
|
|
|
|
+ // async handleOpenLog(data, id) {
|
|
|
|
|
+ // return;
|
|
|
|
|
+ // let page = data || {
|
|
|
|
|
+ // cur_page: 1,
|
|
|
|
|
+ // page_capacity: 10,
|
|
|
|
|
+ // };
|
|
|
|
|
+ // if (id) this.logTitle = this.list.find((x) => x.id == id).book_name;
|
|
|
|
|
+ // PageQueryYSJBookList_OrgManager(page).then(({ total_count, book_list, cur_page_begin_index }) => {
|
|
|
|
|
+ // this.logList = book_list;
|
|
|
|
|
+ // this.logkTotal = total_count;
|
|
|
|
|
+ // this.logPageIndex = cur_page_begin_index;
|
|
|
|
|
+ // this.dialogVisitLog = true;
|
|
|
|
|
+ // });
|
|
|
|
|
+ // },
|
|
|
|
|
+ },
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+@use '@/styles/mixin.scss' as *;
|
|
|
|
|
+
|
|
|
|
|
+.book {
|
|
|
|
|
+ @include page-base;
|
|
|
|
|
+ @include table-list;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.el-divider--horizontal {
|
|
|
|
|
+ margin: 10px 0 !important;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.el-form-item__content > * {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|