|
@@ -75,12 +75,13 @@
|
|
<!-- 添加内容状态筛选 -->
|
|
<!-- 添加内容状态筛选 -->
|
|
<el-form-item label="内容状态">
|
|
<el-form-item label="内容状态">
|
|
<el-select
|
|
<el-select
|
|
- v-model="gsprSearchForm.hasContent"
|
|
|
|
|
|
+ v-model="gsprSearchForm.content_empty"
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
clearable
|
|
clearable
|
|
>
|
|
>
|
|
- <el-option label="有内容" :value="true" />
|
|
|
|
- <el-option label="无内容" :value="false" />
|
|
|
|
|
|
+ <!-- <el-option label="请选择状态" value="null" /> -->
|
|
|
|
+ <el-option label="有内容" :value="false" />
|
|
|
|
+ <el-option label="无内容" :value="true" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
@@ -103,7 +104,18 @@
|
|
label="排序"
|
|
label="排序"
|
|
sortable="custom"
|
|
sortable="custom"
|
|
width="80"
|
|
width="80"
|
|
- />
|
|
|
|
|
|
+ >
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
|
+ <span style="margin-right: 10px">{{ scope.row.sequence }}</span>
|
|
|
|
+ <i
|
|
|
|
+ class="el-icon-edit"
|
|
|
|
+ @click="handleEditSequence(scope.row)"
|
|
|
|
+ style="cursor: pointer; margin-left: 5px"
|
|
|
|
+ ></i>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column prop="name" label="项目名称" sortable="custom" />
|
|
<el-table-column prop="name" label="项目名称" sortable="custom" />
|
|
<el-table-column prop="tech_report_location" label="技术报告位置" />
|
|
<el-table-column prop="tech_report_location" label="技术报告位置" />
|
|
<el-table-column prop="department" label="部门" sortable="custom" />
|
|
<el-table-column prop="department" label="部门" sortable="custom" />
|
|
@@ -130,6 +142,18 @@
|
|
/>
|
|
/>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
+ <el-table-column label="备注">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
|
+ <span style="margin-right: 10px">{{ scope.row.remarks }}</span>
|
|
|
|
+ <i
|
|
|
|
+ class="el-icon-edit"
|
|
|
|
+ @click="handleEditRemark(scope.row)"
|
|
|
|
+ style="cursor: pointer; margin-left: 5px"
|
|
|
|
+ ></i>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column label="操作" width="200">
|
|
<el-table-column label="操作" width="200">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-button type="primary" @click="handleEditGspr(scope.row)"
|
|
<el-button type="primary" @click="handleEditGspr(scope.row)"
|
|
@@ -142,7 +166,7 @@
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
|
- <div class="pagination-container">
|
|
|
|
|
|
+ <!-- <div class="pagination-container">
|
|
<el-pagination
|
|
<el-pagination
|
|
@size-change="handleGsprSizeChange"
|
|
@size-change="handleGsprSizeChange"
|
|
@current-change="handleGsprCurrentChange"
|
|
@current-change="handleGsprCurrentChange"
|
|
@@ -152,7 +176,7 @@
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
:total="gsprTotal"
|
|
:total="gsprTotal"
|
|
/>
|
|
/>
|
|
- </div>
|
|
|
|
|
|
+ </div> -->
|
|
|
|
|
|
<!-- GSPR表单弹窗 -->
|
|
<!-- GSPR表单弹窗 -->
|
|
<el-dialog
|
|
<el-dialog
|
|
@@ -273,6 +297,51 @@
|
|
</span>
|
|
</span>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
<!-- 其余第一个tab的内容... -->
|
|
<!-- 其余第一个tab的内容... -->
|
|
|
|
+ <!-- 修改序号 -->
|
|
|
|
+ <el-dialog
|
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
|
+ title="修改序号"
|
|
|
|
+ width="30%"
|
|
|
|
+ append-to-body
|
|
|
|
+ v-el-drag-dialog
|
|
|
|
+ >
|
|
|
|
+ <el-form :model="sequenceForm" label-width="80px">
|
|
|
|
+ <el-form-item label="序号">
|
|
|
|
+ <el-input-number
|
|
|
|
+ v-model="sequenceForm.sequence"
|
|
|
|
+ :min="0"
|
|
|
|
+ controls-position="right"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <span class="dialog-footer">
|
|
|
|
+ <el-button @click="dialogVisible = false">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="submitSequence">确定</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <!-- 添加备注编辑对话框 -->
|
|
|
|
+ <el-dialog
|
|
|
|
+ title="编辑备注"
|
|
|
|
+ :visible.sync="remarkDialogVisible"
|
|
|
|
+ width="500px"
|
|
|
|
+ >
|
|
|
|
+ <el-form :model="remarkForm">
|
|
|
|
+ <el-form-item label="备注">
|
|
|
|
+ <el-input
|
|
|
|
+ type="textarea"
|
|
|
|
+ v-model="remarkForm.remarks"
|
|
|
|
+ :rows="4"
|
|
|
|
+ placeholder="请输入备注"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer">
|
|
|
|
+ <el-button @click="remarkDialogVisible = false">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="handleRemarkSubmit">确定</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -287,15 +356,18 @@ import {
|
|
delete_items,
|
|
delete_items,
|
|
update_items,
|
|
update_items,
|
|
rateScope,
|
|
rateScope,
|
|
|
|
+ sequence,
|
|
} from "@/api/knowledge";
|
|
} from "@/api/knowledge";
|
|
-import { searchProject, exportItems } from "@/api/project";
|
|
|
|
|
|
+import { searchProject, exportItems, getProjectInfo } from "@/api/project";
|
|
import { mapState } from "vuex";
|
|
import { mapState } from "vuex";
|
|
import CKEditor from "ckeditor4-vue";
|
|
import CKEditor from "ckeditor4-vue";
|
|
import axios from "axios";
|
|
import axios from "axios";
|
|
|
|
+import elDragDialog from "@/directive/el-drag-dialog";
|
|
export default {
|
|
export default {
|
|
compnents: {
|
|
compnents: {
|
|
ckeditor: CKEditor.component,
|
|
ckeditor: CKEditor.component,
|
|
},
|
|
},
|
|
|
|
+ directives: { elDragDialog },
|
|
data() {
|
|
data() {
|
|
// 自定义验证规则
|
|
// 自定义验证规则
|
|
const validateDeleteConfirm = (rule, value, callback) => {
|
|
const validateDeleteConfirm = (rule, value, callback) => {
|
|
@@ -336,16 +408,18 @@ export default {
|
|
department: "",
|
|
department: "",
|
|
project_id: null,
|
|
project_id: null,
|
|
dateRange: [], // 添加时间范围
|
|
dateRange: [], // 添加时间范围
|
|
- hasContent: null, // 添加内容状态
|
|
|
|
|
|
+ content_empty: null, // 添加内容状态
|
|
},
|
|
},
|
|
gsprPageForm: {
|
|
gsprPageForm: {
|
|
page: 1,
|
|
page: 1,
|
|
page_size: 30,
|
|
page_size: 30,
|
|
|
|
+ /* sort_field:'sequence',
|
|
|
|
+ sort_order:"asc", */
|
|
},
|
|
},
|
|
gsprTotal: 0,
|
|
gsprTotal: 0,
|
|
departList: [],
|
|
departList: [],
|
|
- sort_field: "name",
|
|
|
|
- sort_order: "desc",
|
|
|
|
|
|
+ sort_field: "sequence",
|
|
|
|
+ sort_order: "asc",
|
|
hasExistingData: false,
|
|
hasExistingData: false,
|
|
gsprDialogVisible: false,
|
|
gsprDialogVisible: false,
|
|
gsprDialogTitle: "",
|
|
gsprDialogTitle: "",
|
|
@@ -359,7 +433,7 @@ export default {
|
|
},
|
|
},
|
|
gsprPageForm: {
|
|
gsprPageForm: {
|
|
page: 1,
|
|
page: 1,
|
|
- page_size: 30,
|
|
|
|
|
|
+ page_size: 999,
|
|
},
|
|
},
|
|
gsprTotal: 0,
|
|
gsprTotal: 0,
|
|
gsprRules: {
|
|
gsprRules: {
|
|
@@ -396,6 +470,20 @@ export default {
|
|
language: "zh-cn",
|
|
language: "zh-cn",
|
|
height: "300px",
|
|
height: "300px",
|
|
},
|
|
},
|
|
|
|
+ dialogVisible: false,
|
|
|
|
+ sequenceForm: {
|
|
|
|
+ sequence: 1,
|
|
|
|
+ id: null,
|
|
|
|
+ },
|
|
|
|
+ remarkDialogVisible: false,
|
|
|
|
+ remarkForm: {
|
|
|
|
+ id: "",
|
|
|
|
+ remarks: "",
|
|
|
|
+ },
|
|
|
|
+ /* 已绑定项目 */
|
|
|
|
+ documentIds: [],
|
|
|
|
+ templateLocations: [], // 存储传递过来的位置信息
|
|
|
|
+ matchedContents: {}, // 存储技术报告位置匹配的内容
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
@@ -407,9 +495,115 @@ export default {
|
|
this.handleProjectConfirm();
|
|
this.handleProjectConfirm();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ // 获取并处理传递过来的模板位置数据
|
|
|
|
+ const projectDataStr = this.$route.query.projectData;
|
|
|
|
+ if (projectDataStr) {
|
|
|
|
+ try {
|
|
|
|
+ const projectData = JSON.parse(decodeURIComponent(projectDataStr));
|
|
|
|
+ this.templateLocations = projectData.locations;
|
|
|
|
+
|
|
|
|
+ // 创建位置到内容的映射
|
|
|
|
+ this.matchedContents = this.templateLocations.reduce((acc, loc) => {
|
|
|
|
+ if (loc.type === "template_location") {
|
|
|
|
+ // 移除位置标记中的括号以便匹配
|
|
|
|
+ const cleanLocation = loc.tech_report_location;
|
|
|
|
+ acc[cleanLocation] = loc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return acc;
|
|
|
|
+ }, {});
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error("解析项目数据失败:", error);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 修改现有的 handleEditRemark 方法
|
|
|
|
+ handleEditRemark(row) {
|
|
|
|
+ // 只复制需要的字段
|
|
|
|
+ this.remarkForm = {
|
|
|
|
+ id: row.id,
|
|
|
|
+ remarks: row.remarks || "",
|
|
|
|
+ sequence: row.sequence,
|
|
|
|
+ project: row.project,
|
|
|
|
+ content: row.content,
|
|
|
|
+ status: row.status,
|
|
|
|
+ // 保留其他必要字段,但不包含 score
|
|
|
|
+ name: row.name,
|
|
|
|
+ tech_report_location: row.tech_report_location,
|
|
|
|
+ department: row.department,
|
|
|
|
+ content: row.content,
|
|
|
|
+ };
|
|
|
|
+ this.remarkDialogVisible = true;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 修改备注提交方法
|
|
|
|
+ async handleRemarkSubmit() {
|
|
|
|
+ try {
|
|
|
|
+ // 只更新必要的字段
|
|
|
|
+ const updateData = {
|
|
|
|
+ ...this.remarkForm,
|
|
|
|
+ remarks: this.remarkForm.remarks,
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ await projectUpdate(updateData);
|
|
|
|
+ this.$message.success("备注更新成功");
|
|
|
|
+ this.remarkDialogVisible = false;
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$message.error("备注更新失败");
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /* 修改评分 */
|
|
|
|
+ async rateScope(value, row) {
|
|
|
|
+ try {
|
|
|
|
+ const response = await rateScope({
|
|
|
|
+ id: row.id,
|
|
|
|
+ score: value,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (response.status === 200) {
|
|
|
|
+ this.$message.success("评分更新成功");
|
|
|
|
+ // 更新本地数据
|
|
|
|
+ const index = this.gsprTableData.findIndex(
|
|
|
|
+ (item) => item.id === row.id
|
|
|
|
+ );
|
|
|
|
+ if (index !== -1) {
|
|
|
|
+ this.gsprTableData[index].score = value;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ throw new Error(response.message || "评分更新失败");
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$message.error(error.message || "评分更新失败");
|
|
|
|
+ // 恢复原始评分
|
|
|
|
+ row.score = row.score || 0;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /* 修改序号 */
|
|
|
|
+ handleEditSequence(row) {
|
|
|
|
+ this.sequenceForm.sequence = row.sequence;
|
|
|
|
+ this.sequenceForm.id = row.id;
|
|
|
|
+ this.dialogVisible = true;
|
|
|
|
+ },
|
|
|
|
+ // 提交序号修改
|
|
|
|
+ async submitSequence() {
|
|
|
|
+ try {
|
|
|
|
+ await sequence({
|
|
|
|
+ id: this.sequenceForm.id,
|
|
|
|
+ new_sequence: this.sequenceForm.sequence,
|
|
|
|
+ });
|
|
|
|
+ this.$message.success("修改序号成功");
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
+ // 重新加载数据
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$message.error("修改序号失败:" + error.message);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
/* 项目导出 */
|
|
/* 项目导出 */
|
|
async handleExport() {
|
|
async handleExport() {
|
|
const loading = this.$loading({
|
|
const loading = this.$loading({
|
|
@@ -421,13 +615,12 @@ export default {
|
|
const response = await axios({
|
|
const response = await axios({
|
|
url: `${process.env.VUE_APP_BASE_API}/project-input/export`,
|
|
url: `${process.env.VUE_APP_BASE_API}/project-input/export`,
|
|
method: "post",
|
|
method: "post",
|
|
- data: {project_id: this.selectedProjectId},
|
|
|
|
|
|
+ data: { project_id: this.selectedProjectId },
|
|
headers: {
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Content-Type": "application/json",
|
|
Authorization: "Bearer " + localStorage.getItem("token"), // 根据实际token获取方式调整
|
|
Authorization: "Bearer " + localStorage.getItem("token"), // 根据实际token获取方式调整
|
|
},
|
|
},
|
|
});
|
|
});
|
|
- console.log(response);
|
|
|
|
// 检查响应数据
|
|
// 检查响应数据
|
|
if (
|
|
if (
|
|
!response.data ||
|
|
!response.data ||
|
|
@@ -508,7 +701,6 @@ export default {
|
|
handleEditGspr(row) {
|
|
handleEditGspr(row) {
|
|
this.gsprDialogTitle = "编辑文献项目";
|
|
this.gsprDialogTitle = "编辑文献项目";
|
|
this.gsprForm = { ...row };
|
|
this.gsprForm = { ...row };
|
|
- console.log(this.gsprForm);
|
|
|
|
this.gsprDialogVisible = true;
|
|
this.gsprDialogVisible = true;
|
|
},
|
|
},
|
|
// 修改编辑内容显示方法
|
|
// 修改编辑内容显示方法
|
|
@@ -523,6 +715,7 @@ export default {
|
|
);
|
|
);
|
|
|
|
|
|
this.contentForm = {
|
|
this.contentForm = {
|
|
|
|
+ sequence: row.sequence,
|
|
project: selectedProject.id,
|
|
project: selectedProject.id,
|
|
project_name: selectedProject.name,
|
|
project_name: selectedProject.name,
|
|
id: row.id,
|
|
id: row.id,
|
|
@@ -786,7 +979,6 @@ export default {
|
|
this.$message.warning("请先选择一个项目");
|
|
this.$message.warning("请先选择一个项目");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- console.log(this.selectedProjectId);
|
|
|
|
const selectedProject = this.projectOptions.find(
|
|
const selectedProject = this.projectOptions.find(
|
|
(p) => p.id === this.selectedProjectId
|
|
(p) => p.id === this.selectedProjectId
|
|
);
|
|
);
|
|
@@ -965,10 +1157,10 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|
|
- // 数据获取与分页
|
|
|
|
|
|
+ // 修改获取数据的方法
|
|
async fetchGsprData() {
|
|
async fetchGsprData() {
|
|
if (!this.selectedProjectId) {
|
|
if (!this.selectedProjectId) {
|
|
- return; // 如果没有选择项目,直接返回
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
|
|
const loading = this.$loading({
|
|
const loading = this.$loading({
|
|
@@ -985,20 +1177,41 @@ export default {
|
|
project_id: this.selectedProjectId,
|
|
project_id: this.selectedProjectId,
|
|
...this.gsprPageForm,
|
|
...this.gsprPageForm,
|
|
...this.gsprSearchForm,
|
|
...this.gsprSearchForm,
|
|
- // 处理日期范围
|
|
|
|
start_date: this.gsprSearchForm.dateRange?.[0] || null,
|
|
start_date: this.gsprSearchForm.dateRange?.[0] || null,
|
|
end_date: this.gsprSearchForm.dateRange?.[1] || null,
|
|
end_date: this.gsprSearchForm.dateRange?.[1] || null,
|
|
};
|
|
};
|
|
- // 删除原始dateRange参数
|
|
|
|
delete params.dateRange;
|
|
delete params.dateRange;
|
|
|
|
+
|
|
const response = await projectList(params);
|
|
const response = await projectList(params);
|
|
|
|
+
|
|
if (response.status === 200) {
|
|
if (response.status === 200) {
|
|
- this.gsprTableData = response.data.list.map((item) => ({
|
|
|
|
- ...item,
|
|
|
|
- score: item.score || 0,
|
|
|
|
- }));
|
|
|
|
- this.gsprTotal = response.data.total;
|
|
|
|
|
|
+ // 只保留匹配的数据
|
|
|
|
+ this.gsprTableData = response.data.list
|
|
|
|
+ .filter((item) => {
|
|
|
|
+ // 移除括号以进行匹配
|
|
|
|
+ const cleanLocation = item.tech_report_location;
|
|
|
|
+ return this.matchedContents[cleanLocation];
|
|
|
|
+ })
|
|
|
|
+ .map((item) => {
|
|
|
|
+ const cleanLocation = item.tech_report_location;
|
|
|
|
+ const matchedContent = this.matchedContents[cleanLocation];
|
|
|
|
+ return {
|
|
|
|
+ ...item,
|
|
|
|
+ score: typeof item.score === "number" ? item.score : 0,
|
|
|
|
+ matched_content: matchedContent?.content || null,
|
|
|
|
+ raw_content: matchedContent?.raw_content || null,
|
|
|
|
+ input_items: matchedContent?.input_items || [],
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ // 更新总数为过滤后的数量
|
|
|
|
+ this.gsprTotal = this.gsprTableData.length;
|
|
this.hasExistingData = this.gsprTotal > 0;
|
|
this.hasExistingData = this.gsprTotal > 0;
|
|
|
|
+
|
|
|
|
+ // 如果当前页没有数据但总数大于0,回到第一页
|
|
|
|
+ if (this.gsprTableData.length === 0 && this.gsprTotal > 0) {
|
|
|
|
+ this.gsprPageForm.page = 1;
|
|
|
|
+ this.fetchGsprData();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error("获取数据失败:", error);
|
|
console.error("获取数据失败:", error);
|
|
@@ -1008,6 +1221,13 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ // 添加一个辅助方法来检查位置是否匹配
|
|
|
|
+ isLocationMatched(location) {
|
|
|
|
+ if (!location) return false;
|
|
|
|
+ const cleanLocation = location.replace(/[\[\]【】]/g, "");
|
|
|
|
+ return !!this.matchedContents[cleanLocation];
|
|
|
|
+ },
|
|
|
|
+
|
|
handleGsprSizeChange(val) {
|
|
handleGsprSizeChange(val) {
|
|
this.gsprPageForm.page_size = val;
|
|
this.gsprPageForm.page_size = val;
|
|
this.fetchGsprData();
|
|
this.fetchGsprData();
|
|
@@ -1030,7 +1250,7 @@ export default {
|
|
department: "",
|
|
department: "",
|
|
project_id: this.selectedProjectId,
|
|
project_id: this.selectedProjectId,
|
|
dateRange: [], // 重置时间范围
|
|
dateRange: [], // 重置时间范围
|
|
- hasContent: null, // 重置内容状态
|
|
|
|
|
|
+ content_empty: null, // 重置内容状态
|
|
};
|
|
};
|
|
this.handleGsprSearch();
|
|
this.handleGsprSearch();
|
|
},
|
|
},
|