|
@@ -1,680 +1,1005 @@
|
|
<!-- 项目输入页面 -->
|
|
<!-- 项目输入页面 -->
|
|
<template>
|
|
<template>
|
|
- <div class="project-input-container">
|
|
|
|
- <!-- 从原代码中移动第一个 tab-pane 的内容 -->
|
|
|
|
- <div class="project-selector">
|
|
|
|
- <el-form :inline="true">
|
|
|
|
- <el-form-item label="当前项目">
|
|
|
|
- <el-select
|
|
|
|
- disabled
|
|
|
|
- v-model="selectedProjectId"
|
|
|
|
- placeholder="请选择项目"
|
|
|
|
|
|
+ <div class="project-input-container">
|
|
|
|
+ <!-- 从原代码中移动第一个 tab-pane 的内容 -->
|
|
|
|
+ <div class="project-selector">
|
|
|
|
+ <el-form :inline="true">
|
|
|
|
+ <el-form-item label="当前项目">
|
|
|
|
+ <el-select
|
|
|
|
+ disabled
|
|
|
|
+ v-model="selectedProjectId"
|
|
|
|
+ placeholder="请选择项目"
|
|
|
|
+ style="width: 300px"
|
|
|
|
+ @change="handleProjectConfirm"
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="project in projectOptions"
|
|
|
|
+ :key="project.id"
|
|
|
|
+ :label="project.name"
|
|
|
|
+ :value="project.id"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="handleAddGspr"
|
|
|
|
+ v-if="!hasExistingData"
|
|
|
|
+ >创建输入项目</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button type="primary" @click="handleUpdateGspr" v-else
|
|
|
|
+ >更新输入项目</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button type="danger" @click="handleDeleteItems">删除</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 使用 v-if 控制其余内容的显示 -->
|
|
|
|
+ <template v-if="selectedProjectId">
|
|
|
|
+ <div class="operation-bar">
|
|
|
|
+ <el-form :inline="true" :model="gsprSearchForm" class="search-form">
|
|
|
|
+ <el-form-item label="内容">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="gsprSearchForm.keyword"
|
|
|
|
+ placeholder="请输入项目名称/技术报告位置"
|
|
style="width: 300px"
|
|
style="width: 300px"
|
|
- @change="handleProjectConfirm"
|
|
|
|
|
|
+ clearable
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="部门">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="gsprSearchForm.department"
|
|
|
|
+ placeholder="请选择部门"
|
|
|
|
+ clearable
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
- v-for="project in projectOptions"
|
|
|
|
- :key="project.id"
|
|
|
|
- :label="project.name"
|
|
|
|
- :value="project.id"
|
|
|
|
|
|
+ v-for="(item, index) in departList"
|
|
|
|
+ :key="index"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.label"
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item>
|
|
|
|
- <el-button
|
|
|
|
- type="primary"
|
|
|
|
- @click="handleAddGspr"
|
|
|
|
- v-if="!hasExistingData"
|
|
|
|
- >创建输入项目</el-button
|
|
|
|
- >
|
|
|
|
- <el-button type="primary" @click="handleUpdateGspr" v-else
|
|
|
|
- >更新输入项目</el-button
|
|
|
|
|
|
+ <!-- 添加时间范围选择器 -->
|
|
|
|
+ <el-form-item label="创建时间">
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="gsprSearchForm.dateRange"
|
|
|
|
+ type="daterange"
|
|
|
|
+ range-separator="至"
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
|
+ :picker-options="pickerOptions"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <!-- 添加内容状态筛选 -->
|
|
|
|
+ <el-form-item label="内容状态">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="gsprSearchForm.hasContent"
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ clearable
|
|
>
|
|
>
|
|
- <el-button type="danger" @click="handleDeleteItems">删除</el-button>
|
|
|
|
|
|
+ <el-option label="有内容" :value="true" />
|
|
|
|
+ <el-option label="无内容" :value="false" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button type="primary" @click="handleGsprSearch">搜索</el-button>
|
|
|
|
+ <el-button @click="handleGsprReset">重置</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
- <!-- 使用 v-if 控制其余内容的显示 -->
|
|
|
|
- <template v-if="selectedProjectId">
|
|
|
|
- <div class="operation-bar">
|
|
|
|
- <el-form :inline="true" :model="gsprSearchForm" class="search-form">
|
|
|
|
- <el-form-item label="内容">
|
|
|
|
- <el-input
|
|
|
|
- v-model="gsprSearchForm.keyword"
|
|
|
|
- placeholder="请输入项目名称/技术报告位置"
|
|
|
|
- style="width: 300px"
|
|
|
|
- clearable
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="部门">
|
|
|
|
- <el-select
|
|
|
|
- v-model="gsprSearchForm.department"
|
|
|
|
- placeholder="请选择部门"
|
|
|
|
- clearable
|
|
|
|
- >
|
|
|
|
- <el-option
|
|
|
|
- v-for="(item, index) in departList"
|
|
|
|
- :key="index"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.label"
|
|
|
|
- />
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item>
|
|
|
|
- <el-button type="primary" @click="handleGsprSearch">搜索</el-button>
|
|
|
|
- <el-button @click="handleGsprReset">重置</el-button>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <el-table
|
|
|
|
- :data="gsprTableData"
|
|
|
|
- style="width: 100%"
|
|
|
|
- :default-sort="{ prop: sort_field, order: sort_order }"
|
|
|
|
- @sort-change="handleSortChange"
|
|
|
|
- >
|
|
|
|
- <el-table-column prop="name" label="项目名称" sortable="custom" />
|
|
|
|
- <el-table-column prop="tech_report_location" label="技术报告位置" />
|
|
|
|
- <el-table-column prop="department" label="部门" sortable="custom" />
|
|
|
|
- <el-table-column prop="content" label="内容">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <div style="display: flex; align-items: center">
|
|
|
|
- <span style="margin-right: 10px">{{ scope.row.content }}</span>
|
|
|
|
- <i
|
|
|
|
- class="el-icon-edit"
|
|
|
|
- @click="handleEditContent(scope.row)"
|
|
|
|
- style="cursor: pointer; margin-left: 5px"
|
|
|
|
- ></i>
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="操作" width="200">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-button type="primary" @click="handleEditGspr(scope.row)"
|
|
|
|
- >编辑</el-button
|
|
|
|
- >
|
|
|
|
- <el-button type="danger" @click="handleDeleteGspr(scope.row)"
|
|
|
|
- >删除</el-button
|
|
|
|
- >
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
-
|
|
|
|
- <div class="pagination-container">
|
|
|
|
- <el-pagination
|
|
|
|
- @size-change="handleGsprSizeChange"
|
|
|
|
- @current-change="handleGsprCurrentChange"
|
|
|
|
- :current-page="gsprPageForm.page"
|
|
|
|
- :page-sizes="[10, 20, 30, 50]"
|
|
|
|
- :page-size="gsprPageForm.page_size"
|
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
- :total="gsprTotal"
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <!-- GSPR表单弹窗 -->
|
|
|
|
- <el-dialog
|
|
|
|
- :title="gsprDialogTitle"
|
|
|
|
- :visible.sync="gsprDialogVisible"
|
|
|
|
- width="700px"
|
|
|
|
- >
|
|
|
|
- <el-form
|
|
|
|
- :model="gsprForm"
|
|
|
|
- ref="gsprForm"
|
|
|
|
- :rules="gsprRules"
|
|
|
|
- label-width="120px"
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ >导出输入项目</el-button
|
|
>
|
|
>
|
|
- <el-form-item label="名称" prop="name">
|
|
|
|
- <el-input v-model="gsprForm.name" />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="技术报告位置" prop="tech_report_location">
|
|
|
|
- <el-input v-model="gsprForm.tech_report_location" />
|
|
|
|
- </el-form-item>
|
|
|
|
-
|
|
|
|
- <el-form-item label="部门" prop="department">
|
|
|
|
- <el-select v-model="gsprForm.department" placeholder="请选择状态">
|
|
|
|
- <el-option
|
|
|
|
- v-for="(item, index) in departList"
|
|
|
|
- :key="index"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.label"
|
|
|
|
- />
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="内容" prop="content">
|
|
|
|
- <el-input
|
|
|
|
- type="textarea"
|
|
|
|
- v-model="gsprForm.content"
|
|
|
|
- :rows="4"
|
|
|
|
- placeholder="请输入内容"
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- <div slot="footer">
|
|
|
|
- <el-button @click="gsprDialogVisible = false">取消</el-button>
|
|
|
|
- <el-button type="primary" @click="handleGsprSubmit">确定</el-button>
|
|
|
|
- </div>
|
|
|
|
- </el-dialog>
|
|
|
|
- <!-- 添加内容编辑弹窗 -->
|
|
|
|
- <el-dialog
|
|
|
|
- title="编辑内容"
|
|
|
|
- :visible.sync="contentDialogVisible"
|
|
|
|
- width="600px"
|
|
|
|
- >
|
|
|
|
- <el-form :model="contentForm" ref="contentForm">
|
|
|
|
- <el-form-item label="内容" prop="content">
|
|
|
|
- <el-input
|
|
|
|
- type="textarea"
|
|
|
|
- v-model="contentForm.content"
|
|
|
|
- :rows="4"
|
|
|
|
- placeholder="请输入内容"
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- <div slot="footer">
|
|
|
|
- <el-button @click="contentDialogVisible = false">取消</el-button>
|
|
|
|
- <el-button type="primary" @click="handleContentSubmit"
|
|
|
|
- >确定</el-button
|
|
|
|
|
|
+ </div>
|
|
|
|
+ <el-table
|
|
|
|
+ :data="gsprTableData"
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ :default-sort="{ prop: sort_field, order: sort_order }"
|
|
|
|
+ @sort-change="handleSortChange"
|
|
|
|
+ >
|
|
|
|
+ <el-table-column prop="sort" label="排序" sortable="custom" width="80" />
|
|
|
|
+ <el-table-column prop="name" label="项目名称" sortable="custom" />
|
|
|
|
+ <el-table-column prop="tech_report_location" label="技术报告位置" />
|
|
|
|
+ <el-table-column prop="department" label="部门" sortable="custom" />
|
|
|
|
+ <el-table-column prop="content" label="内容">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
|
+ <span style="margin-right: 10px">{{ scope.row.content }}</span>
|
|
|
|
+ <i
|
|
|
|
+ class="el-icon-edit"
|
|
|
|
+ @click="handleEditContent(scope.row)"
|
|
|
|
+ style="cursor: pointer; margin-left: 5px"
|
|
|
|
+ ></i>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="" label="难度" sortable="custom" />
|
|
|
|
+ <el-table-column label="操作" width="200">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button type="primary" @click="handleEditGspr(scope.row)"
|
|
|
|
+ >编辑</el-button
|
|
>
|
|
>
|
|
- </div>
|
|
|
|
- </el-dialog>
|
|
|
|
- </template>
|
|
|
|
-
|
|
|
|
- <!-- 未选择项目时显示提示 -->
|
|
|
|
- <el-empty
|
|
|
|
- v-else
|
|
|
|
- description="请先选择一个项目"
|
|
|
|
- :image-size="200"
|
|
|
|
- ></el-empty>
|
|
|
|
-
|
|
|
|
- <!-- 添加删除确认对话框 -->
|
|
|
|
|
|
+ <el-button type="danger" @click="handleDeleteGspr(scope.row)"
|
|
|
|
+ >删除</el-button
|
|
|
|
+ >
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+
|
|
|
|
+ <div class="pagination-container">
|
|
|
|
+ <el-pagination
|
|
|
|
+ @size-change="handleGsprSizeChange"
|
|
|
|
+ @current-change="handleGsprCurrentChange"
|
|
|
|
+ :current-page="gsprPageForm.page"
|
|
|
|
+ :page-sizes="[10, 20, 30, 50]"
|
|
|
|
+ :page-size="gsprPageForm.page_size"
|
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
+ :total="gsprTotal"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <!-- GSPR表单弹窗 -->
|
|
<el-dialog
|
|
<el-dialog
|
|
- title="删除确认"
|
|
|
|
- :visible.sync="deleteDialogVisible"
|
|
|
|
- width="400px"
|
|
|
|
|
|
+ :title="gsprDialogTitle"
|
|
|
|
+ :visible.sync="gsprDialogVisible"
|
|
|
|
+ width="700px"
|
|
>
|
|
>
|
|
- <!-- 添加提示信息区域 -->
|
|
|
|
- <div class="delete-warning" style="margin-bottom: 20px">
|
|
|
|
- <i
|
|
|
|
- class="el-icon-warning"
|
|
|
|
- style="color: #e6a23c; margin-right: 8px"
|
|
|
|
- ></i>
|
|
|
|
- <span
|
|
|
|
- >此操作将永久删除该项目下的所有输入项目,请输入'DELETE'确认删除</span
|
|
|
|
- >
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
<el-form
|
|
<el-form
|
|
- :model="deleteForm"
|
|
|
|
- :rules="deleteRules"
|
|
|
|
- ref="deleteForm"
|
|
|
|
- label-width="100px"
|
|
|
|
|
|
+ :model="gsprForm"
|
|
|
|
+ ref="gsprForm"
|
|
|
|
+ :rules="gsprRules"
|
|
|
|
+ label-width="120px"
|
|
>
|
|
>
|
|
- <el-form-item label="确认文本" prop="confirmText">
|
|
|
|
- <el-input
|
|
|
|
- v-model="deleteForm.confirmText"
|
|
|
|
- placeholder="请输入'DELETE'"
|
|
|
|
- ></el-input>
|
|
|
|
|
|
+ <el-form-item label="名称" prop="name">
|
|
|
|
+ <el-input v-model="gsprForm.name" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <el-form-item label="技术报告位置" prop="tech_report_location">
|
|
|
|
+ <el-input v-model="gsprForm.tech_report_location" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ <el-form-item label="部门" prop="department">
|
|
|
|
+ <el-select v-model="gsprForm.department" placeholder="请选择状态">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item, index) in departList"
|
|
|
|
+ :key="index"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.label"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <!-- <el-form-item label="内容" prop="content">
|
|
|
|
+ <div class="editor-area sticky-editor">
|
|
|
|
+ <ckeditor
|
|
|
|
+ ref="editor"
|
|
|
|
+ v-model="gsprForm.content"
|
|
|
|
+ :config="editorConfig"
|
|
|
|
+ :editorUrl="editorUrl"
|
|
|
|
+ ></ckeditor>
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item> -->
|
|
</el-form>
|
|
</el-form>
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
|
- <el-button @click="deleteDialogVisible = false">取消</el-button>
|
|
|
|
- <el-button type="danger" @click="confirmDelete">确认删除</el-button>
|
|
|
|
- </span>
|
|
|
|
|
|
+ <div slot="footer">
|
|
|
|
+ <el-button @click="gsprDialogVisible = false">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="handleGsprSubmit">确定</el-button>
|
|
|
|
+ </div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
- <!-- 其余第一个tab的内容... -->
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
-
|
|
|
|
- <script>
|
|
|
|
- import {
|
|
|
|
- projectList,
|
|
|
|
- projectAdd,
|
|
|
|
- departments,
|
|
|
|
- projectUpdate,
|
|
|
|
- projectDelete,
|
|
|
|
- create_items,
|
|
|
|
- delete_items,
|
|
|
|
- update_items,
|
|
|
|
- } from "@/api/knowledge";
|
|
|
|
- import { searchProject } from "@/api/project";
|
|
|
|
- import { mapState } from "vuex";
|
|
|
|
-
|
|
|
|
- export default {
|
|
|
|
- data() {
|
|
|
|
- // 自定义验证规则
|
|
|
|
- const validateDeleteConfirm = (rule, value, callback) => {
|
|
|
|
- if (value !== "DELETE") {
|
|
|
|
- callback(new Error("请输入正确的确认文本"));
|
|
|
|
- } else {
|
|
|
|
- callback();
|
|
|
|
|
|
+ <!-- 添加内容编辑弹窗 -->
|
|
|
|
+ <el-dialog
|
|
|
|
+ title="编辑内容"
|
|
|
|
+ :visible.sync="contentDialogVisible"
|
|
|
|
+ width="80%"
|
|
|
|
+ >
|
|
|
|
+ <!-- <el-form :model="contentForm" ref="contentForm">
|
|
|
|
+ <el-form-item label="内容" prop="content"> -->
|
|
|
|
+ <!-- <el-inputwidth="600px"
|
|
|
|
+ type="textarea"
|
|
|
|
+ v-model="contentForm.content"
|
|
|
|
+ :rows="4"
|
|
|
|
+ placeholder="请输入内容"
|
|
|
|
+ /> -->
|
|
|
|
+ <ckeditor
|
|
|
|
+ ref="editor"
|
|
|
|
+ v-model="contentForm.content"
|
|
|
|
+ :config="editorConfig"
|
|
|
|
+ :editorUrl="editorUrl"
|
|
|
|
+ ></ckeditor>
|
|
|
|
+ <!-- </el-form-item>
|
|
|
|
+ </el-form> -->
|
|
|
|
+ <div slot="footer">
|
|
|
|
+ <el-button @click="contentDialogVisible = false">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="handleContentSubmit"
|
|
|
|
+ >确定</el-button
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
|
|
+ <!-- 未选择项目时显示提示 -->
|
|
|
|
+ <el-empty
|
|
|
|
+ v-else
|
|
|
|
+ description="请先选择一个项目"
|
|
|
|
+ :image-size="200"
|
|
|
|
+ ></el-empty>
|
|
|
|
+
|
|
|
|
+ <!-- 添加删除确认对话框 -->
|
|
|
|
+ <el-dialog
|
|
|
|
+ title="删除确认"
|
|
|
|
+ :visible.sync="deleteDialogVisible"
|
|
|
|
+ width="400px"
|
|
|
|
+ >
|
|
|
|
+ <!-- 添加提示信息区域 -->
|
|
|
|
+ <div class="delete-warning" style="margin-bottom: 20px">
|
|
|
|
+ <i
|
|
|
|
+ class="el-icon-warning"
|
|
|
|
+ style="color: #e6a23c; margin-right: 8px"
|
|
|
|
+ ></i>
|
|
|
|
+ <span
|
|
|
|
+ >此操作将永久删除该项目下的所有输入项目,请输入'DELETE'确认删除</span
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <el-form
|
|
|
|
+ :model="deleteForm"
|
|
|
|
+ :rules="deleteRules"
|
|
|
|
+ ref="deleteForm"
|
|
|
|
+ label-width="100px"
|
|
|
|
+ >
|
|
|
|
+ <el-form-item label="确认文本" prop="confirmText">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="deleteForm.confirmText"
|
|
|
|
+ placeholder="请输入'DELETE'"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="deleteDialogVisible = false">取消</el-button>
|
|
|
|
+ <el-button type="danger" @click="confirmDelete">确认删除</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <!-- 其余第一个tab的内容... -->
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import {
|
|
|
|
+ projectList,
|
|
|
|
+ projectAdd,
|
|
|
|
+ departments,
|
|
|
|
+ projectUpdate,
|
|
|
|
+ projectDelete,
|
|
|
|
+ create_items,
|
|
|
|
+ delete_items,
|
|
|
|
+ update_items,
|
|
|
|
+} from "@/api/knowledge";
|
|
|
|
+import { searchProject } from "@/api/project";
|
|
|
|
+import { mapState } from "vuex";
|
|
|
|
+import CKEditor from "ckeditor4-vue";
|
|
|
|
+export default {
|
|
|
|
+ compnents: {
|
|
|
|
+ ckeditor: CKEditor.component,
|
|
|
|
+ },
|
|
|
|
+ data() {
|
|
|
|
+ // 自定义验证规则
|
|
|
|
+ const validateDeleteConfirm = (rule, value, callback) => {
|
|
|
|
+ if (value !== "DELETE") {
|
|
|
|
+ callback(new Error("请输入正确的确认文本"));
|
|
|
|
+ } else {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ return {
|
|
|
|
+ pickerOptions: {
|
|
|
|
+ shortcuts: [
|
|
|
|
+ {
|
|
|
|
+ text: "最近一周",
|
|
|
|
+ onClick(picker) {
|
|
|
|
+ const end = new Date();
|
|
|
|
+ const start = new Date();
|
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
|
|
|
+ picker.$emit("pick", [start, end]);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: "最近一个月",
|
|
|
|
+ onClick(picker) {
|
|
|
|
+ const end = new Date();
|
|
|
|
+ const start = new Date();
|
|
|
|
+ start.setMonth(start.getMonth() - 1);
|
|
|
|
+ picker.$emit("pick", [start, end]);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ selectedProjectId: null,
|
|
|
|
+ projectOptions: [],
|
|
|
|
+ gsprTableData: [],
|
|
|
|
+ gsprSearchForm: {
|
|
|
|
+ keyword: "",
|
|
|
|
+ department: "",
|
|
|
|
+ project_id: null,
|
|
|
|
+ dateRange: [], // 添加时间范围
|
|
|
|
+ hasContent: null, // 添加内容状态
|
|
|
|
+ },
|
|
|
|
+ gsprPageForm: {
|
|
|
|
+ page: 1,
|
|
|
|
+ page_size: 30,
|
|
|
|
+ },
|
|
|
|
+ gsprTotal: 0,
|
|
|
|
+ departList: [],
|
|
|
|
+ sort_field: "name",
|
|
|
|
+ sort_order: "desc",
|
|
|
|
+ hasExistingData: false,
|
|
|
|
+ gsprDialogVisible: false,
|
|
|
|
+ gsprDialogTitle: "",
|
|
|
|
+ gsprForm: {
|
|
|
|
+ id: "",
|
|
|
|
+ name: "",
|
|
|
|
+ tech_report_location: "",
|
|
|
|
+ department: "",
|
|
|
|
+ content: "",
|
|
|
|
+ status: 5,
|
|
|
|
+ },
|
|
|
|
+ gsprPageForm: {
|
|
|
|
+ page: 1,
|
|
|
|
+ page_size: 30,
|
|
|
|
+ },
|
|
|
|
+ gsprTotal: 0,
|
|
|
|
+ gsprRules: {
|
|
|
|
+ name: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
|
|
|
+ tech_report_location: [
|
|
|
|
+ { required: true, message: "请输入技术报告位置", trigger: "blur" },
|
|
|
|
+ ],
|
|
|
|
+ department: [
|
|
|
|
+ { required: true, message: "请输入部门", trigger: "blur" },
|
|
|
|
+ ],
|
|
|
|
+ status: [{ required: true, message: "请选择状态", trigger: "change" }],
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ contentDialogVisible: false,
|
|
|
|
+ contentForm: {
|
|
|
|
+ id: "",
|
|
|
|
+ content: "",
|
|
|
|
+ name: "",
|
|
|
|
+ department: "",
|
|
|
|
+ },
|
|
|
|
+ /* 删除逻辑 */
|
|
|
|
+ deleteDialogVisible: false,
|
|
|
|
+ deleteForm: {
|
|
|
|
+ confirmText: "",
|
|
|
|
+ },
|
|
|
|
+ deleteRules: {
|
|
|
|
+ confirmText: [
|
|
|
|
+ { required: true, message: "请输入确认文本", trigger: "blur" },
|
|
|
|
+ { validator: validateDeleteConfirm, trigger: "blur" },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ editorUrl: "/ckeditor/ckeditor.js",
|
|
|
|
+ editorConfig: {
|
|
|
|
+ language: "zh-cn",
|
|
|
|
+ height: "300px",
|
|
|
|
+ },
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ this.fetchProjects().then(() => {
|
|
|
|
+ // Get project ID from URL query parameter
|
|
|
|
+ const urlProjectId = this.$route.query.id;
|
|
|
|
+ if (urlProjectId) {
|
|
|
|
+ this.selectedProjectId = parseInt(urlProjectId);
|
|
|
|
+ this.handleProjectConfirm();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ methods: {
|
|
|
|
+ /* 删除 */
|
|
|
|
+ async handleDeleteGspr(row) {
|
|
|
|
+ try {
|
|
|
|
+ await this.$confirm("确认删除该记录?", "提示", {
|
|
|
|
+ type: "warning",
|
|
|
|
+ });
|
|
|
|
+ // 替换为实际的删除API调用
|
|
|
|
+ await projectDelete({ id: row.id });
|
|
|
|
+ this.$message.success("删除成功");
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ if (error !== "cancel") {
|
|
|
|
+ this.$message.error("删除失败");
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ handleEditGspr(row) {
|
|
|
|
+ this.gsprDialogTitle = "编辑文献项目";
|
|
|
|
+ this.gsprForm = { ...row };
|
|
|
|
+ console.log(this.gsprForm);
|
|
|
|
+ this.gsprDialogVisible = true;
|
|
|
|
+ },
|
|
|
|
+ // 修改编辑内容显示方法
|
|
|
|
+ handleEditContent(row) {
|
|
|
|
+ const selectedProject = this.projectOptions.find(
|
|
|
|
+ (p) => p.id === this.selectedProjectId
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ // 处理content内容,将文本格式转换为HTML并清理空样式
|
|
|
|
+ const processedContent = this.cleanEmptyStyles(
|
|
|
|
+ this.convertTextToHtml(row.content)
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ this.contentForm = {
|
|
|
|
+ project: selectedProject.id,
|
|
|
|
+ project_name: selectedProject.name,
|
|
|
|
+ id: row.id,
|
|
|
|
+ tech_report_location: row.tech_report_location,
|
|
|
|
+ content: processedContent,
|
|
|
|
+ name: row.name,
|
|
|
|
+ department: row.department,
|
|
};
|
|
};
|
|
- return {
|
|
|
|
- selectedProjectId: null,
|
|
|
|
- projectOptions: [],
|
|
|
|
- gsprTableData: [],
|
|
|
|
- gsprSearchForm: {
|
|
|
|
- keyword: "",
|
|
|
|
- department: "",
|
|
|
|
- project_id: null,
|
|
|
|
- },
|
|
|
|
- gsprPageForm: {
|
|
|
|
- page: 1,
|
|
|
|
- page_size: 30,
|
|
|
|
- },
|
|
|
|
- gsprTotal: 0,
|
|
|
|
- departList: [],
|
|
|
|
- sort_field: "name",
|
|
|
|
- sort_order: "desc",
|
|
|
|
- hasExistingData: false,
|
|
|
|
- gsprDialogVisible: false,
|
|
|
|
- gsprDialogTitle: "",
|
|
|
|
- gsprForm: {
|
|
|
|
- id: "",
|
|
|
|
- name: "",
|
|
|
|
- tech_report_location: "",
|
|
|
|
- department: "",
|
|
|
|
- content: "",
|
|
|
|
- status: 5,
|
|
|
|
- },
|
|
|
|
- gsprPageForm: {
|
|
|
|
- page: 1,
|
|
|
|
- page_size: 30,
|
|
|
|
- },
|
|
|
|
- gsprTotal: 0,
|
|
|
|
- gsprRules: {
|
|
|
|
- name: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
|
|
|
- tech_report_location: [
|
|
|
|
- { required: true, message: "请输入技术报告位置", trigger: "blur" },
|
|
|
|
- ],
|
|
|
|
- department: [
|
|
|
|
- { required: true, message: "请输入部门", trigger: "blur" },
|
|
|
|
- ],
|
|
|
|
- status: [{ required: true, message: "请选择状态", trigger: "change" }],
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- contentDialogVisible: false,
|
|
|
|
- contentForm: {
|
|
|
|
- id: "",
|
|
|
|
- content: "",
|
|
|
|
- name: "",
|
|
|
|
- department: "",
|
|
|
|
- },
|
|
|
|
- /* 删除逻辑 */
|
|
|
|
- deleteDialogVisible: false,
|
|
|
|
- deleteForm: {
|
|
|
|
- confirmText: "",
|
|
|
|
- },
|
|
|
|
- deleteRules: {
|
|
|
|
- confirmText: [
|
|
|
|
- { required: true, message: "请输入确认文本", trigger: "blur" },
|
|
|
|
- { validator: validateDeleteConfirm, trigger: "blur" },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- };
|
|
|
|
|
|
+ this.contentDialogVisible = true;
|
|
},
|
|
},
|
|
- mounted() {
|
|
|
|
- this.fetchProjects().then(() => {
|
|
|
|
- // Get project ID from URL query parameter
|
|
|
|
- const urlProjectId = this.$route.query.id;
|
|
|
|
- if (urlProjectId) {
|
|
|
|
- this.selectedProjectId = parseInt(urlProjectId);
|
|
|
|
- this.handleProjectConfirm();
|
|
|
|
|
|
+
|
|
|
|
+ // 修改回显方法,解析样式
|
|
|
|
+ convertTextToHtml(text) {
|
|
|
|
+ if (!text) return "";
|
|
|
|
+
|
|
|
|
+ let html = text;
|
|
|
|
+
|
|
|
|
+ // 处理表格标记(包含边框样式)
|
|
|
|
+ html = html.replace(
|
|
|
|
+ /\[表格\|style=(.*?)\|class=(.*?)\]([\s\S]*?)(?=\[|$)/g,
|
|
|
|
+ (match, tableStyle, tableClass, tableContent) => {
|
|
|
|
+ const rows = tableContent.trim().split("\n");
|
|
|
|
+ let tableHtml = `<table style="${tableStyle}" class="${tableClass}">`;
|
|
|
|
+
|
|
|
|
+ rows.forEach((row) => {
|
|
|
|
+ tableHtml += "<tr>";
|
|
|
|
+ const cells = row.split("|").map((cell) => {
|
|
|
|
+ const cellMatch = cell.match(
|
|
|
|
+ /(.*?)(?:\[style=(.*?)\|class=(.*?)\])?$/
|
|
|
|
+ );
|
|
|
|
+ if (cellMatch) {
|
|
|
|
+ const [_, content, style = "", className = ""] = cellMatch;
|
|
|
|
+ return `<td style="${style}" class="${className}">${content.trim()}</td>`;
|
|
|
|
+ }
|
|
|
|
+ return `<td>${cell.trim()}</td>`;
|
|
|
|
+ });
|
|
|
|
+ tableHtml += cells.join("") + "</tr>";
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ tableHtml += "</table>";
|
|
|
|
+ return tableHtml;
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ // 2. 处理图片标记(保持不变)
|
|
|
|
+ html = html.replace(
|
|
|
|
+ /\[图片:(.*?)\|style=(.*?)\|class=(.*?)\]/g,
|
|
|
|
+ (match, src, style, className) => {
|
|
|
|
+ return `<img src="${src}" alt="图片" style="${style}" class="${className}">`;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ // 3. 处理文本样式(保持不变)
|
|
|
|
+ html = html.replace(
|
|
|
|
+ /\[文本:(.*?)\|style=(.*?)\|class=(.*?)\]/g,
|
|
|
|
+ (match, content, style, className) => {
|
|
|
|
+ return `<span style="${style}" class="${className}">${content}</span>`;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ // 4. 处理换行
|
|
|
|
+ html = html.replace(/\n/g, "<br>");
|
|
|
|
+
|
|
|
|
+ return html;
|
|
},
|
|
},
|
|
-
|
|
|
|
- methods: {
|
|
|
|
- /* 删除 */
|
|
|
|
- async handleDeleteGspr(row) {
|
|
|
|
- try {
|
|
|
|
- await this.$confirm("确认删除该记录?", "提示", {
|
|
|
|
- type: "warning",
|
|
|
|
|
|
+
|
|
|
|
+ // 添加辅助方法:清理空样式属性
|
|
|
|
+ cleanEmptyStyles(html) {
|
|
|
|
+ return html
|
|
|
|
+ .replace(/style=""/g, "")
|
|
|
|
+ .replace(/class=""/g, "")
|
|
|
|
+ .replace(/\s+>/g, ">");
|
|
|
|
+ },
|
|
|
|
+ /* */
|
|
|
|
+ async handleContentSubmit() {
|
|
|
|
+ try {
|
|
|
|
+ // 创建一个函数来处理富文本内容,保留样式
|
|
|
|
+ const processContent = (htmlContent) => {
|
|
|
|
+ const tempDiv = document.createElement("div");
|
|
|
|
+ tempDiv.innerHTML = htmlContent;
|
|
|
|
+
|
|
|
|
+ // 处理图片:保留样式属性
|
|
|
|
+ const images = tempDiv.getElementsByTagName("img");
|
|
|
|
+ Array.from(images).forEach((img) => {
|
|
|
|
+ const style = img.getAttribute("style") || "";
|
|
|
|
+ const className = img.getAttribute("class") || "";
|
|
|
|
+ const imgPlaceholder = `[图片:${img.src}|style=${style}|class=${className}]`;
|
|
|
|
+ img.replaceWith(document.createTextNode(imgPlaceholder));
|
|
});
|
|
});
|
|
- // 替换为实际的删除API调用
|
|
|
|
- await projectDelete({ id: row.id });
|
|
|
|
- this.$message.success("删除成功");
|
|
|
|
- this.fetchGsprData();
|
|
|
|
- } catch (error) {
|
|
|
|
- if (error !== "cancel") {
|
|
|
|
- this.$message.error("删除失败");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- handleEditGspr(row) {
|
|
|
|
- this.gsprDialogTitle = "编辑文献项目";
|
|
|
|
- this.gsprForm = { ...row };
|
|
|
|
- console.log(this.gsprForm);
|
|
|
|
- this.gsprDialogVisible = true;
|
|
|
|
- },
|
|
|
|
- /* 编辑内容 */
|
|
|
|
- handleEditContent(row) {
|
|
|
|
- const selectedProject = this.projectOptions.find(
|
|
|
|
- (p) => p.id === this.selectedProjectId
|
|
|
|
- );
|
|
|
|
- this.contentForm = {
|
|
|
|
- project: selectedProject.id,
|
|
|
|
- project_name: selectedProject.name,
|
|
|
|
- id: row.id,
|
|
|
|
- tech_report_location: row.tech_report_location,
|
|
|
|
- content: row.content,
|
|
|
|
- name: row.name,
|
|
|
|
- department: row.department,
|
|
|
|
|
|
+
|
|
|
|
+ // 处理表格:保留完整的样式属性,包括边框
|
|
|
|
+ const tables = tempDiv.getElementsByTagName("table");
|
|
|
|
+ Array.from(tables).forEach((table) => {
|
|
|
|
+ const tableStyle = table.getAttribute("style") || "";
|
|
|
|
+ const tableClass = table.getAttribute("class") || "";
|
|
|
|
+ const tableBorder = table.getAttribute("border") || "";
|
|
|
|
+
|
|
|
|
+ const rows = Array.from(table.rows).map((row) => {
|
|
|
|
+ return Array.from(row.cells)
|
|
|
|
+ .map((cell) => {
|
|
|
|
+ const cellStyle = cell.getAttribute("style") || "";
|
|
|
|
+ const cellClass = cell.getAttribute("class") || "";
|
|
|
|
+ const cellBorder = cell.getAttribute("border") || "";
|
|
|
|
+ const content = cell.textContent.trim();
|
|
|
|
+
|
|
|
|
+ // 合并所有样式属性
|
|
|
|
+ const cellStyles = [
|
|
|
|
+ cellStyle,
|
|
|
|
+ cellBorder ? `border: ${cellBorder}px solid #000;` : "",
|
|
|
|
+ ]
|
|
|
|
+ .filter(Boolean)
|
|
|
|
+ .join(" ");
|
|
|
|
+
|
|
|
|
+ return `${content}${
|
|
|
|
+ cellStyles || cellClass
|
|
|
|
+ ? `[style=${cellStyles}|class=${cellClass}]`
|
|
|
|
+ : ""
|
|
|
|
+ }`;
|
|
|
|
+ })
|
|
|
|
+ .join("|");
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 合并表格的样式属性
|
|
|
|
+ const tableStyles = [
|
|
|
|
+ tableStyle,
|
|
|
|
+ tableBorder ? `border: ${tableBorder}px solid #000;` : "",
|
|
|
|
+ ]
|
|
|
|
+ .filter(Boolean)
|
|
|
|
+ .join(" ");
|
|
|
|
+
|
|
|
|
+ const tablePlaceholder = `[表格|style=${tableStyles}|class=${tableClass}]\n${rows.join(
|
|
|
|
+ "\n"
|
|
|
|
+ )}`;
|
|
|
|
+ table.replaceWith(document.createTextNode(tablePlaceholder));
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 处理文本样式
|
|
|
|
+ const styledSpans = tempDiv.getElementsByTagName("span");
|
|
|
|
+ Array.from(styledSpans).forEach((span) => {
|
|
|
|
+ const style = span.getAttribute("style") || "";
|
|
|
|
+ const className = span.getAttribute("class") || "";
|
|
|
|
+ if (style || className) {
|
|
|
|
+ const content = span.textContent;
|
|
|
|
+ span.replaceWith(
|
|
|
|
+ document.createTextNode(
|
|
|
|
+ `[文本:${content}|style=${style}|class=${className}]`
|
|
|
|
+ )
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return tempDiv.textContent || tempDiv.innerText;
|
|
};
|
|
};
|
|
- this.contentDialogVisible = true;
|
|
|
|
- },
|
|
|
|
- /* */
|
|
|
|
- async handleContentSubmit() {
|
|
|
|
- try {
|
|
|
|
- await projectUpdate(this.contentForm);
|
|
|
|
- this.$message.success("内容更新成功");
|
|
|
|
- this.contentDialogVisible = false;
|
|
|
|
- this.fetchGsprData();
|
|
|
|
- } catch (error) {
|
|
|
|
- this.$message.error("内容更新失败");
|
|
|
|
|
|
+
|
|
|
|
+ const submitData = {
|
|
|
|
+ ...this.contentForm,
|
|
|
|
+ content: processContent(this.contentForm.content),
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ await projectUpdate(submitData);
|
|
|
|
+ this.$message.success("内容更新成功");
|
|
|
|
+ this.contentDialogVisible = false;
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$message.error("内容更新失败");
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 同样修改handleGsprSubmit方法
|
|
|
|
+ async handleGsprSubmit() {
|
|
|
|
+ try {
|
|
|
|
+ await this.$refs.gsprForm.validate();
|
|
|
|
+
|
|
|
|
+ // 处理富文本内容
|
|
|
|
+ const processContent = (htmlContent) => {
|
|
|
|
+ const tempDiv = document.createElement("div");
|
|
|
|
+ tempDiv.innerHTML = htmlContent;
|
|
|
|
+
|
|
|
|
+ // 处理图片
|
|
|
|
+ const images = tempDiv.getElementsByTagName("img");
|
|
|
|
+ Array.from(images).forEach((img) => {
|
|
|
|
+ const imgPlaceholder = `[图片:${img.src}]`;
|
|
|
|
+ img.replaceWith(document.createTextNode(imgPlaceholder));
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 处理表格
|
|
|
|
+ const tables = tempDiv.getElementsByTagName("table");
|
|
|
|
+ Array.from(tables).forEach((table) => {
|
|
|
|
+ const rows = Array.from(table.rows).map((row) =>
|
|
|
|
+ Array.from(row.cells)
|
|
|
|
+ .map((cell) => cell.textContent.trim())
|
|
|
|
+ .join(" | ")
|
|
|
|
+ );
|
|
|
|
+ const tablePlaceholder = "[表格]\n" + rows.join("\n");
|
|
|
|
+ table.replaceWith(document.createTextNode(tablePlaceholder));
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return tempDiv.textContent || tempDiv.innerText;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ // 创建新对象避免修改原始数据
|
|
|
|
+ const submitData = {
|
|
|
|
+ ...this.gsprForm,
|
|
|
|
+ content: processContent(this.gsprForm.content),
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ if (this.gsprForm.id) {
|
|
|
|
+ await projectUpdate(submitData);
|
|
|
|
+ } else {
|
|
|
|
+ await projectAdd(submitData);
|
|
}
|
|
}
|
|
- },
|
|
|
|
- /* */
|
|
|
|
- async handleGsprSubmit() {
|
|
|
|
- try {
|
|
|
|
- await this.$refs.gsprForm.validate();
|
|
|
|
- // 替换为实际的保存API调用
|
|
|
|
- if (this.gsprForm.id) {
|
|
|
|
- await projectUpdate(this.gsprForm);
|
|
|
|
- } else {
|
|
|
|
- await projectAdd(this.gsprForm);
|
|
|
|
- }
|
|
|
|
- this.$message.success(this.gsprForm.id ? "更新成功" : "创建成功");
|
|
|
|
- this.gsprDialogVisible = false;
|
|
|
|
- this.fetchGsprData();
|
|
|
|
- } catch (error) {
|
|
|
|
- if (error !== false) {
|
|
|
|
- this.$message.error("保存失败");
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ this.$message.success(this.gsprForm.id ? "更新成功" : "创建成功");
|
|
|
|
+ this.gsprDialogVisible = false;
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ if (error !== false) {
|
|
|
|
+ this.$message.error("保存失败");
|
|
}
|
|
}
|
|
- },
|
|
|
|
- /* 初始化项目列表 */
|
|
|
|
- async fetchProjects() {
|
|
|
|
- try {
|
|
|
|
- const response = await searchProject({ page: 1, pageSize: 999 });
|
|
|
|
- if (response.status === 200) {
|
|
|
|
- this.projectOptions = response.data.dataList;
|
|
|
|
-
|
|
|
|
- // 如果有当前项目ID但没有选中项目,自动选中
|
|
|
|
- // 如果有当前项目ID但没有选中项目,自动选中
|
|
|
|
- if (!this.selectedProjectId && this.$route.query.id) {
|
|
|
|
- this.selectedProjectId = parseInt(this.$route.query.id);
|
|
|
|
- this.handleProjectConfirm();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } catch (error) {
|
|
|
|
- this.$message.error("获取项目列表失败");
|
|
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /* */
|
|
|
|
+ async handleGsprSubmit() {
|
|
|
|
+ try {
|
|
|
|
+ await this.$refs.gsprForm.validate();
|
|
|
|
+ // 替换为实际的保存API调用
|
|
|
|
+ if (this.gsprForm.id) {
|
|
|
|
+ await projectUpdate(this.gsprForm);
|
|
|
|
+ } else {
|
|
|
|
+ await projectAdd(this.gsprForm);
|
|
}
|
|
}
|
|
- },
|
|
|
|
- async handleProjectConfirm() {
|
|
|
|
- if (!this.selectedProjectId) {
|
|
|
|
- this.$message.warning("请先选择一个项目");
|
|
|
|
- return;
|
|
|
|
|
|
+ this.$message.success(this.gsprForm.id ? "更新成功" : "创建成功");
|
|
|
|
+ this.gsprDialogVisible = false;
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ if (error !== false) {
|
|
|
|
+ this.$message.error("保存失败");
|
|
}
|
|
}
|
|
- console.log(this.selectedProjectId);
|
|
|
|
- const selectedProject = this.projectOptions.find(
|
|
|
|
- (p) => p.id === this.selectedProjectId
|
|
|
|
- );
|
|
|
|
- if (!selectedProject) {
|
|
|
|
- this.$message.error("未找到选中的项目");
|
|
|
|
- return;
|
|
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /* 初始化项目列表 */
|
|
|
|
+ async fetchProjects() {
|
|
|
|
+ try {
|
|
|
|
+ const response = await searchProject({ page: 1, pageSize: 999 });
|
|
|
|
+ if (response.status === 200) {
|
|
|
|
+ this.projectOptions = response.data.dataList;
|
|
|
|
+
|
|
|
|
+ // 如果有当前项目ID但没有选中项目,自动选中
|
|
|
|
+ // 如果有当前项目ID但没有选中项目,自动选中
|
|
|
|
+ if (!this.selectedProjectId && this.$route.query.id) {
|
|
|
|
+ this.selectedProjectId = parseInt(this.$route.query.id);
|
|
|
|
+ this.handleProjectConfirm();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
- this.$store.dispatch("project/setCurrentProject", {
|
|
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$message.error("获取项目列表失败");
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ async handleProjectConfirm() {
|
|
|
|
+ if (!this.selectedProjectId) {
|
|
|
|
+ this.$message.warning("请先选择一个项目");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ console.log(this.selectedProjectId);
|
|
|
|
+ const selectedProject = this.projectOptions.find(
|
|
|
|
+ (p) => p.id === this.selectedProjectId
|
|
|
|
+ );
|
|
|
|
+ if (!selectedProject) {
|
|
|
|
+ this.$message.error("未找到选中的项目");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.$store.dispatch("project/setCurrentProject", {
|
|
|
|
+ id: selectedProject.id,
|
|
|
|
+ name: selectedProject.name,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ localStorage.setItem(
|
|
|
|
+ "currentProject",
|
|
|
|
+ JSON.stringify({
|
|
id: selectedProject.id,
|
|
id: selectedProject.id,
|
|
name: selectedProject.name,
|
|
name: selectedProject.name,
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ this.gsprSearchForm.project_id = this.selectedProjectId;
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ },
|
|
|
|
+ // 创建项目
|
|
|
|
+ async handleAddGspr() {
|
|
|
|
+ if (!this.selectedProjectId) {
|
|
|
|
+ this.$message.warning("请先选择一个项目");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const loading = this.$loading({
|
|
|
|
+ lock: true,
|
|
|
|
+ text: "正在创建项目...",
|
|
|
|
+ spinner: "el-icon-loading",
|
|
|
|
+ background: "rgba(0, 0, 0, 0.7)",
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ const res = await create_items({
|
|
|
|
+ project_id: this.selectedProjectId,
|
|
|
|
+ project_name: this.projectOptions.find(
|
|
|
|
+ (p) => p.id === this.selectedProjectId
|
|
|
|
+ ).name,
|
|
});
|
|
});
|
|
-
|
|
|
|
- localStorage.setItem(
|
|
|
|
- "currentProject",
|
|
|
|
- JSON.stringify({
|
|
|
|
- id: selectedProject.id,
|
|
|
|
- name: selectedProject.name,
|
|
|
|
- })
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- this.gsprSearchForm.project_id = this.selectedProjectId;
|
|
|
|
- this.fetchGsprData();
|
|
|
|
- },
|
|
|
|
- // 创建项目
|
|
|
|
- async handleAddGspr() {
|
|
|
|
- if (!this.selectedProjectId) {
|
|
|
|
- this.$message.warning("请先选择一个项目");
|
|
|
|
- return;
|
|
|
|
|
|
+
|
|
|
|
+ if (res.status === 200) {
|
|
|
|
+ this.$message.success(
|
|
|
|
+ `成功创建 ${res.data.data.created_count} 个输入项目!`
|
|
|
|
+ );
|
|
|
|
+ await this.fetchGsprData();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$message.error("创建失败: " + (error.message || "未知错误"));
|
|
|
|
+ } finally {
|
|
|
|
+ loading.close();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 更新项目
|
|
|
|
+ async handleUpdateGspr() {
|
|
|
|
+ if (!this.selectedProjectId) {
|
|
|
|
+ this.$message.warning("请先选择一个项目");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ const selectedProject = this.projectOptions.find(
|
|
|
|
+ (p) => p.id === this.selectedProjectId
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ await this.$confirm(
|
|
|
|
+ "此操作将更新当前项目的所有输入项目,是否继续?",
|
|
|
|
+ "提示",
|
|
|
|
+ {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+
|
|
const loading = this.$loading({
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
lock: true,
|
|
- text: "正在创建项目...",
|
|
|
|
|
|
+ text: "正在更新项目...",
|
|
spinner: "el-icon-loading",
|
|
spinner: "el-icon-loading",
|
|
background: "rgba(0, 0, 0, 0.7)",
|
|
background: "rgba(0, 0, 0, 0.7)",
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+
|
|
try {
|
|
try {
|
|
- const res = await create_items({
|
|
|
|
- project_id: this.selectedProjectId,
|
|
|
|
- project_name: this.projectOptions.find(
|
|
|
|
- (p) => p.id === this.selectedProjectId
|
|
|
|
- ).name,
|
|
|
|
|
|
+ const res = await update_items({
|
|
|
|
+ // 假设有一个update_items的API
|
|
|
|
+ project_id: selectedProject.id,
|
|
|
|
+ project_name: selectedProject.name,
|
|
});
|
|
});
|
|
-
|
|
|
|
- if (res.status === 200) {
|
|
|
|
- this.$message.success(
|
|
|
|
- `成功创建 ${res.data.data.created_count} 个输入项目!`
|
|
|
|
- );
|
|
|
|
- await this.fetchGsprData();
|
|
|
|
|
|
+
|
|
|
|
+ if (res.status !== 200) {
|
|
|
|
+ throw new Error("更新失败");
|
|
}
|
|
}
|
|
- } catch (error) {
|
|
|
|
- this.$message.error("创建失败: " + (error.message || "未知错误"));
|
|
|
|
|
|
+
|
|
|
|
+ this.$message.success(
|
|
|
|
+ `成功更新 ${res.data.data.updated_count} 个输入项目!`
|
|
|
|
+ );
|
|
|
|
+ await this.fetchGsprData();
|
|
} finally {
|
|
} finally {
|
|
loading.close();
|
|
loading.close();
|
|
}
|
|
}
|
|
- },
|
|
|
|
-
|
|
|
|
- // 更新项目
|
|
|
|
- async handleUpdateGspr() {
|
|
|
|
- if (!this.selectedProjectId) {
|
|
|
|
- this.$message.warning("请先选择一个项目");
|
|
|
|
- return;
|
|
|
|
|
|
+ } catch (error) {
|
|
|
|
+ if (error !== "cancel") {
|
|
|
|
+ this.$message.error("更新失败: " + (error.message || "未知错误"));
|
|
}
|
|
}
|
|
- const selectedProject = this.projectOptions.find(
|
|
|
|
- (p) => p.id === this.selectedProjectId
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 删除项目
|
|
|
|
+ async handleDeleteItems() {
|
|
|
|
+ if (!this.selectedProjectId) {
|
|
|
|
+ this.$message.warning("请先选择一个项目");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const selectedProject = this.projectOptions.find(
|
|
|
|
+ (p) => p.id === this.selectedProjectId
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ this.$confirm(
|
|
|
|
+ `您确定要删除项目 "${selectedProject.name}" 的所有输入项目吗?此操作不可恢复。`,
|
|
|
|
+ "警告",
|
|
|
|
+ {
|
|
|
|
+ confirmButtonText: "继续删除",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.deleteForm.confirmText = "";
|
|
|
|
+ this.deleteDialogVisible = true;
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "info",
|
|
|
|
+ message: "已取消删除",
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 确认删除
|
|
|
|
+ confirmDelete() {
|
|
|
|
+ this.$refs.deleteForm.validate(async (valid) => {
|
|
|
|
+ if (!valid) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
try {
|
|
try {
|
|
- await this.$confirm(
|
|
|
|
- "此操作将更新当前项目的所有输入项目,是否继续?",
|
|
|
|
- "提示",
|
|
|
|
- {
|
|
|
|
- confirmButtonText: "确定",
|
|
|
|
- cancelButtonText: "取消",
|
|
|
|
- type: "warning",
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
const loading = this.$loading({
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
lock: true,
|
|
- text: "正在更新项目...",
|
|
|
|
|
|
+ text: "正在删除...",
|
|
spinner: "el-icon-loading",
|
|
spinner: "el-icon-loading",
|
|
background: "rgba(0, 0, 0, 0.7)",
|
|
background: "rgba(0, 0, 0, 0.7)",
|
|
});
|
|
});
|
|
-
|
|
|
|
- try {
|
|
|
|
- const res = await update_items({
|
|
|
|
- // 假设有一个update_items的API
|
|
|
|
- project_id: selectedProject.id,
|
|
|
|
- project_name: selectedProject.name,
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- if (res.status !== 200) {
|
|
|
|
- throw new Error("更新失败");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- this.$message.success(
|
|
|
|
- `成功更新 ${res.data.data.updated_count} 个输入项目!`
|
|
|
|
- );
|
|
|
|
- await this.fetchGsprData();
|
|
|
|
- } finally {
|
|
|
|
- loading.close();
|
|
|
|
- }
|
|
|
|
- } catch (error) {
|
|
|
|
- if (error !== "cancel") {
|
|
|
|
- this.$message.error("更新失败: " + (error.message || "未知错误"));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- // 删除项目
|
|
|
|
- async handleDeleteItems() {
|
|
|
|
- if (!this.selectedProjectId) {
|
|
|
|
- this.$message.warning("请先选择一个项目");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const selectedProject = this.projectOptions.find(
|
|
|
|
- (p) => p.id === this.selectedProjectId
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- this.$confirm(
|
|
|
|
- `您确定要删除项目 "${selectedProject.name}" 的所有输入项目吗?此操作不可恢复。`,
|
|
|
|
- "警告",
|
|
|
|
- {
|
|
|
|
- confirmButtonText: "继续删除",
|
|
|
|
- cancelButtonText: "取消",
|
|
|
|
- type: "warning",
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
- .then(() => {
|
|
|
|
- this.deleteForm.confirmText = "";
|
|
|
|
- this.deleteDialogVisible = true;
|
|
|
|
- })
|
|
|
|
- .catch(() => {
|
|
|
|
- this.$message({
|
|
|
|
- type: "info",
|
|
|
|
- message: "已取消删除",
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- // 确认删除
|
|
|
|
- confirmDelete() {
|
|
|
|
- this.$refs.deleteForm.validate(async (valid) => {
|
|
|
|
- if (!valid) {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- const loading = this.$loading({
|
|
|
|
- lock: true,
|
|
|
|
- text: "正在删除...",
|
|
|
|
- spinner: "el-icon-loading",
|
|
|
|
- background: "rgba(0, 0, 0, 0.7)",
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- const response = await delete_items({
|
|
|
|
- project_id: this.selectedProjectId,
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- loading.close();
|
|
|
|
-
|
|
|
|
- if (response.status === 200) {
|
|
|
|
- this.$message.success("删除成功");
|
|
|
|
- this.deleteDialogVisible = false;
|
|
|
|
- // 重新加载数据
|
|
|
|
- this.fetchGsprData();
|
|
|
|
- } else {
|
|
|
|
- this.$message.error(response.message || "删除失败");
|
|
|
|
- }
|
|
|
|
- } catch (error) {
|
|
|
|
- this.$message.error("删除失败:" + (error.message || "未知错误"));
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- // 数据获取与分页
|
|
|
|
- async fetchGsprData() {
|
|
|
|
- if (!this.selectedProjectId) {
|
|
|
|
- return; // 如果没有选择项目,直接返回
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const loading = this.$loading({
|
|
|
|
- lock: true,
|
|
|
|
- text: "加载中...",
|
|
|
|
- spinner: "el-icon-loading",
|
|
|
|
- background: "rgba(0, 0, 0, 0.7)",
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- const params = {
|
|
|
|
- sort_field: this.sort_field,
|
|
|
|
- sort_order: this.sort_order,
|
|
|
|
|
|
+
|
|
|
|
+ const response = await delete_items({
|
|
project_id: this.selectedProjectId,
|
|
project_id: this.selectedProjectId,
|
|
- ...this.gsprPageForm,
|
|
|
|
- ...this.gsprSearchForm,
|
|
|
|
- };
|
|
|
|
- const response = await projectList(params);
|
|
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ loading.close();
|
|
|
|
+
|
|
if (response.status === 200) {
|
|
if (response.status === 200) {
|
|
- this.gsprTableData = response.data.list;
|
|
|
|
- this.gsprTotal = response.data.total;
|
|
|
|
- this.hasExistingData = this.gsprTotal > 0;
|
|
|
|
|
|
+ this.$message.success("删除成功");
|
|
|
|
+ this.deleteDialogVisible = false;
|
|
|
|
+ // 重新加载数据
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(response.message || "删除失败");
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- console.error("获取数据失败:", error);
|
|
|
|
- this.$message.error("获取数据失败");
|
|
|
|
- } finally {
|
|
|
|
- loading.close();
|
|
|
|
|
|
+ this.$message.error("删除失败:" + (error.message || "未知错误"));
|
|
}
|
|
}
|
|
- },
|
|
|
|
-
|
|
|
|
- handleGsprSizeChange(val) {
|
|
|
|
- this.gsprPageForm.page_size = val;
|
|
|
|
- this.fetchGsprData();
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- handleGsprCurrentChange(val) {
|
|
|
|
- this.gsprPageForm.page = val;
|
|
|
|
- this.fetchGsprData();
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- // 搜索相关
|
|
|
|
- handleGsprSearch() {
|
|
|
|
- this.gsprPageForm.page = 1;
|
|
|
|
- this.fetchGsprData();
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- handleGsprReset() {
|
|
|
|
- this.gsprSearchForm = {
|
|
|
|
- keyword: "",
|
|
|
|
- department: "",
|
|
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 数据获取与分页
|
|
|
|
+ async fetchGsprData() {
|
|
|
|
+ if (!this.selectedProjectId) {
|
|
|
|
+ return; // 如果没有选择项目,直接返回
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const loading = this.$loading({
|
|
|
|
+ lock: true,
|
|
|
|
+ text: "加载中...",
|
|
|
|
+ spinner: "el-icon-loading",
|
|
|
|
+ background: "rgba(0, 0, 0, 0.7)",
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ const params = {
|
|
|
|
+ sort_field: this.sort_field,
|
|
|
|
+ sort_order: this.sort_order,
|
|
project_id: this.selectedProjectId,
|
|
project_id: this.selectedProjectId,
|
|
|
|
+ ...this.gsprPageForm,
|
|
|
|
+ ...this.gsprSearchForm,
|
|
|
|
+ // 处理日期范围
|
|
|
|
+ start_date: this.gsprSearchForm.dateRange?.[0] || null,
|
|
|
|
+ end_date: this.gsprSearchForm.dateRange?.[1] || null,
|
|
};
|
|
};
|
|
- this.handleGsprSearch();
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- // 排序处理
|
|
|
|
- handleSortChange({ prop, order }) {
|
|
|
|
- this.sort_field = prop;
|
|
|
|
- this.sort_order = order === "ascending" ? "asc" : "desc";
|
|
|
|
- if (!order) {
|
|
|
|
- this.sort_field = "name";
|
|
|
|
- this.sort_order = "desc";
|
|
|
|
|
|
+ // 删除原始dateRange参数
|
|
|
|
+ delete params.dateRange;
|
|
|
|
+ const response = await projectList(params);
|
|
|
|
+ if (response.status === 200) {
|
|
|
|
+ this.gsprTableData = response.data.list;
|
|
|
|
+ this.gsprTotal = response.data.total;
|
|
|
|
+ this.hasExistingData = this.gsprTotal > 0;
|
|
}
|
|
}
|
|
- this.fetchGsprData();
|
|
|
|
- },
|
|
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error("获取数据失败:", error);
|
|
|
|
+ this.$message.error("获取数据失败");
|
|
|
|
+ } finally {
|
|
|
|
+ loading.close();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleGsprSizeChange(val) {
|
|
|
|
+ this.gsprPageForm.page_size = val;
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleGsprCurrentChange(val) {
|
|
|
|
+ this.gsprPageForm.page = val;
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 搜索相关
|
|
|
|
+ handleGsprSearch() {
|
|
|
|
+ this.gsprPageForm.page = 1;
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleGsprReset() {
|
|
|
|
+ this.gsprSearchForm = {
|
|
|
|
+ keyword: "",
|
|
|
|
+ department: "",
|
|
|
|
+ project_id: this.selectedProjectId,
|
|
|
|
+ dateRange: [], // 重置时间范围
|
|
|
|
+ hasContent: null, // 重置内容状态
|
|
|
|
+ };
|
|
|
|
+ this.handleGsprSearch();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 排序处理
|
|
|
|
+ handleSortChange({ prop, order }) {
|
|
|
|
+ this.sort_field = prop;
|
|
|
|
+ this.sort_order = order === "ascending" ? "asc" : "desc";
|
|
|
|
+ if (!order) {
|
|
|
|
+ this.sort_field = "name";
|
|
|
|
+ this.sort_order = "desc";
|
|
|
|
+ }
|
|
|
|
+ this.fetchGsprData();
|
|
},
|
|
},
|
|
- };
|
|
|
|
- </script>
|
|
|
|
- <style >
|
|
|
|
- .project-input-container {
|
|
|
|
- padding: 20px;
|
|
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+<style lang="scss" >
|
|
|
|
+.project-input-container {
|
|
|
|
+ padding: 20px;
|
|
|
|
+}
|
|
|
|
+.pagination-container {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
+}
|
|
|
|
+.editor-area {
|
|
|
|
+ ::v-deep .cke_top {
|
|
|
|
+ display: block; // Hide the original toolbar
|
|
}
|
|
}
|
|
- .pagination-container {
|
|
|
|
- display: flex;
|
|
|
|
- justify-content: flex-end;
|
|
|
|
|
|
+}
|
|
|
|
+.project-input-container {
|
|
|
|
+ padding: 20px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.pagination-container {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* 添加编辑器工具栏样式 */
|
|
|
|
+.editor-area {
|
|
|
|
+ .cke_top {
|
|
|
|
+ display: flex !important;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ align-items: center;
|
|
|
|
+ padding: 6px 8px !important;
|
|
|
|
+
|
|
|
|
+ /* 工具栏组样式 */
|
|
|
|
+ .cke_toolgroup {
|
|
|
|
+ margin: 0 2px;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* 工具栏按钮样式 */
|
|
|
|
+ .cke_toolbar {
|
|
|
|
+ float: none !important;
|
|
|
|
+ display: inline-flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- </style>
|
|
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* 如果需要调整编辑器容器宽度 */
|
|
|
|
+.cke_chrome {
|
|
|
|
+ width: 100% !important;
|
|
|
|
+}
|
|
|
|
+</style>
|