Эх сурвалжийг харах

添加项目输入表过滤及新增客户部分项非必填

yangg 8 сар өмнө
parent
commit
fc4016d667

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/index.html


+ 0 - 0
dist/static/css/chunk-35c6022b.7479c590.css → dist/static/css/chunk-1e25476d.7479c590.css


+ 0 - 0
dist/static/css/chunk-8a96b752.21513b0f.css → dist/static/css/chunk-2ba36133.21513b0f.css


+ 0 - 0
dist/static/css/chunk-de393740.857f893e.css → dist/static/css/chunk-fa5c2480.857f893e.css


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/app.ec7d7c77.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-1e25476d.0fc289da.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-2ba36133.ace6b9d9.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-35c6022b.f5a5cd5c.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-8a96b752.1e9af733.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-de393740.7df78f7e.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-fa5c2480.d23f294a.js


+ 123 - 139
src/views/customer/components/dataInfo.vue

@@ -2,166 +2,150 @@
   <div class="data-info">
   <div class="data-info">
     <el-card>
     <el-card>
       <el-form :model="dataForm" label-width="120px">
       <el-form :model="dataForm" label-width="120px">
+        <el-form-item label="客户名称:"> </el-form-item>
+        <el-form-item label="客户联系人:"> </el-form-item>
 
 
+        <el-form-item label="联系电话:"> </el-form-item>
 
 
-        <el-form-item label="客户名称:">
-        </el-form-item>
-        <el-form-item label="客户联系人:">
-        </el-form-item>
-
-        <el-form-item label="联系电话:">
-        </el-form-item>
-
-        <el-form-item label="手机号码:">
-        </el-form-item>
-
-        <el-form-item label="联系地址:">
-
-        </el-form-item>
-
-
-
-
+        <el-form-item label="手机号码:"> </el-form-item>
 
 
+        <el-form-item label="联系地址:"> </el-form-item>
       </el-form>
       </el-form>
-
     </el-card>
     </el-card>
 
 
-
-      <div style="text-align:right; margin-top:20px;">
-          <el-button type="warning" @click="btnSave">确认关闭</el-button>
-      </div>
+    <div style="text-align: right; margin-top: 20px">
+      <el-button type="warning" @click="btnSave">确认关闭</el-button>
+    </div>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-  import Tinymce from "@/components/Tinymce";
-  import {searchProject} from'@/api/project'
-  export default{
-    components:{
-      Tinymce
+import Tinymce from "@/components/Tinymce";
+import { searchProject } from "@/api/project";
+export default {
+  components: {
+    Tinymce,
+  },
+  props: {
+    id: {
+      type: Number,
+      default: 0,
     },
     },
-    props:{
-      id:{
-        type:Number,
-        default:0
+  },
+  watch: {
+    id: {
+      handler(v) {
+        let _this = this;
+        if (v == null || v < 0) return;
+        _this.getInfo(v);
       },
       },
+      immediate: true,
+      deep: true,
     },
     },
-    watch:{
-      id:{
-        handler(v){
-            let _this=this;
-            if(v==null || v<0)return;
-            _this.getInfo(v);
+  },
+  data() {
+    return {
+      activeName: "base",
+      currentCategory: [],
+      allCategories: [],
+      dataForm: {
+        prod: {
+          items: [],
         },
         },
-        immediate: true,
-        deep: true
-      }
-    },
-    data(){
-      return{
-        activeName:'base',
-        currentCategory:[],
-        allCategories:[],
-        dataForm:{
-          prod:{
-            items:[],
-          }
+      },
+      statusOptions: [
+        {
+          status: 5,
+          name: "待审核",
+        },
+        {
+          status: 6,
+          name: "已审核",
+        },
+        {
+          status: 7,
+          name: "已拒绝",
+        },
+        {
+          status: 8,
+          name: "草稿箱",
         },
         },
-        statusOptions:[
-          {
-            status:5,
-            name:'待审核'
-          },
-          {
-            status:6,
-            name:'已审核'
-          },
-          {
-            status:7,
-            name:'已拒绝'
-          },
-          {
-            status:8,
-            name:'草稿箱'
-          },
-          {
-            status:9,
-            name:'已下架'
-          },
-        ],
+        {
+          status: 9,
+          name: "已下架",
+        },
+      ],
+    };
+  },
+
+  mounted() {
+    let _this = this;
+    _this.initAllCategory();
+  },
+  methods: {
+    //保存更新
+    btnSave(e) {
+      let _this = this;
+
+      if (_this.dataForm.title == "") {
+        _this.$alert("产品标题不能为空");
+        return;
       }
       }
-    },
 
 
-    mounted() {
-      let _this=this;
-      _this.initAllCategory();
+      let dataForm = {
+        id: _this.dataForm.id,
+        title: _this.dataForm.title,
+        status: _this.dataForm.status,
+        categoryId: _this.dataForm.categoryId,
+        sku: _this.dataForm.sku,
+      };
+
+      // productUpdate(_this.dataForm).then(res=>{
+      //   if(!res)return;
+      //    _this.$alert("产品审核操作成功");
+      //    _this.$emit("bindUpdate");
+      // })
     },
     },
-    methods:{
-      //保存更新
-      btnSave(e){
-          let _this=this;
-
-          if(_this.dataForm.title==''){
-            _this.$alert("产品标题不能为空");
-              return;
-          }
-
-         let dataForm={
-           id:_this.dataForm.id,
-           title:_this.dataForm.title,
-           status:_this.dataForm.status,
-           categoryId:_this.dataForm.categoryId,
-           sku:_this.dataForm.sku
-         };
-
-          // productUpdate(_this.dataForm).then(res=>{
-          //   if(!res)return;
-          //    _this.$alert("产品审核操作成功");
-          //    _this.$emit("bindUpdate");
-          // })
-      },
-
-      //产品详情
-      getInfo(id){
-          let _this=this;
-          let par={
-            id:id,
-          };
-          // productInfo(par).then(res=>{
-          //     if(!res)return;
-          //     if(res.status!=200)return;
-          //     _this.dataForm=res.data;
-          // })
-      },
 
 
-      onChangeStatus(e){
-          this.dataForm.status=e;
-      },
-      //修改分类信息
-      onChangeCategory(e){
-         let _this=this;
-         _this.dataForm.categoryId=e;
-      },
-      //初始化所有分类
-      initAllCategory(){
-          let _this=this;
-          let par={
-            page:1,
-            pageSize:9999,
-            status:1
-          };
-          // searchGoodsCategory().then(res=>{
-          //   if(!res)return;
-          //   if(res.status!=200)return;
-          //   _this.allCategories=res.data.data;
-          // })
-      }
+    //产品详情
+    getInfo(id) {
+      let _this = this;
+      let par = {
+        id: id,
+      };
+      // productInfo(par).then(res=>{
+      //     if(!res)return;
+      //     if(res.status!=200)return;
+      //     _this.dataForm=res.data;
+      // })
+    },
 
 
-    }
-  }
+    onChangeStatus(e) {
+      this.dataForm.status = e;
+    },
+    //修改分类信息
+    onChangeCategory(e) {
+      let _this = this;
+      _this.dataForm.categoryId = e;
+    },
+    //初始化所有分类
+    initAllCategory() {
+      let _this = this;
+      let par = {
+        page: 1,
+        pageSize: 9999,
+        status: 1,
+      };
+      // searchGoodsCategory().then(res=>{
+      //   if(!res)return;
+      //   if(res.status!=200)return;
+      //   _this.allCategories=res.data.data;
+      // })
+    },
+  },
+};
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
- @import './dataInfo.scss'
+@import "./dataInfo.scss";
 </style>
 </style>

+ 29 - 19
src/views/customer/components/dataList.vue

@@ -40,9 +40,9 @@
     <el-table :data="dataList" style="width: 100%; margin-top: 20px">
     <el-table :data="dataList" style="width: 100%; margin-top: 20px">
       <el-table-column prop="code" label="客户编码" />
       <el-table-column prop="code" label="客户编码" />
       <el-table-column prop="name" label="客户名称" />
       <el-table-column prop="name" label="客户名称" />
-      <el-table-column prop="enName" label="英文名称" />
-      <el-table-column prop="mobile" label="手机号码" />
       <el-table-column prop="contact" label="联系人" />
       <el-table-column prop="contact" label="联系人" />
+      <el-table-column prop="contactPosition" label="联系人职位" />
+      <el-table-column prop="mobile" label="手机号码" />
       <el-table-column prop="address" label="地址" />
       <el-table-column prop="address" label="地址" />
       <el-table-column prop="other" label="其他信息" />
       <el-table-column prop="other" label="其他信息" />
       <el-table-column prop="createTime" label="创建时间" />
       <el-table-column prop="createTime" label="创建时间" />
@@ -92,28 +92,29 @@
             class="w_input"
             class="w_input"
           />
           />
         </el-form-item>
         </el-form-item>
-        <el-form-item label="英文名称" required>
+        <el-form-item label="联系人">
           <el-input
           <el-input
-            v-model="customerForm.en_name"
-            placeholder="请输入英文名称"
+            v-model="customerForm.contact"
+            placeholder="请输入联系人"
             class="w_input"
             class="w_input"
           />
           />
         </el-form-item>
         </el-form-item>
-        <el-form-item label="手机号码" required>
+        <el-form-item label="联系人职位" required>
           <el-input
           <el-input
-            v-model="customerForm.mobile"
-            placeholder="请输入手机号码"
+            v-model="customerForm.contactPosition"
+            placeholder="请输入联系人职位"
             class="w_input"
             class="w_input"
           />
           />
         </el-form-item>
         </el-form-item>
-        <el-form-item label="联系人" required>
+        <el-form-item label="手机号码">
           <el-input
           <el-input
-            v-model="customerForm.contact"
-            placeholder="请输入联系人"
+            v-model="customerForm.mobile"
+            placeholder="请输入手机号码"
             class="w_input"
             class="w_input"
           />
           />
         </el-form-item>
         </el-form-item>
-        <el-form-item label="地址" required>
+
+        <el-form-item label="地址">
           <el-input
           <el-input
             v-model="customerForm.address"
             v-model="customerForm.address"
             placeholder="请输入地址"
             placeholder="请输入地址"
@@ -139,7 +140,13 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { searchCustomer, syncCustomer, createCustomer, updateCustomer,deleteCustomer } from "@/api/customer";
+import {
+  searchCustomer,
+  syncCustomer,
+  createCustomer,
+  updateCustomer,
+  deleteCustomer,
+} from "@/api/customer";
 /* import dataInfo from "./dataInfo.vue"; */
 /* import dataInfo from "./dataInfo.vue"; */
 import elDragDialog from "@/directive/el-drag-dialog";
 import elDragDialog from "@/directive/el-drag-dialog";
 export default {
 export default {
@@ -194,11 +201,12 @@ export default {
       customerForm: {
       customerForm: {
         code: "",
         code: "",
         name: "",
         name: "",
-        en_name: "",
+        contactPosition: "",
         mobile: "",
         mobile: "",
         contact: "",
         contact: "",
         address: "",
         address: "",
         other: "",
         other: "",
+        status:5
       },
       },
       tableData: [], // Add tableData
       tableData: [], // Add tableData
       isEdit: false, // Add flag for edit mode
       isEdit: false, // Add flag for edit mode
@@ -211,7 +219,7 @@ export default {
     // 处理创建/更新客户
     // 处理创建/更新客户
     handleEdit(row) {
     handleEdit(row) {
       this.isEdit = true;
       this.isEdit = true;
-      this.customerForm = { ...row,en_name:row.enName };
+      this.customerForm = { ...row, contactPosition: row.contactPosition };
       this.dialogVisible = true;
       this.dialogVisible = true;
     },
     },
 
 
@@ -221,10 +229,10 @@ export default {
         cancelButtonText: "取消",
         cancelButtonText: "取消",
         type: "warning",
         type: "warning",
       }).then(() => {
       }).then(() => {
-        deleteCustomer({id:row.id})
+        deleteCustomer({ id: row.id })
           .then(() => {
           .then(() => {
             this.$message.success("删除成功");
             this.$message.success("删除成功");
-            this.search()
+            this.search();
           })
           })
           .catch(() => {
           .catch(() => {
             this.$message.error("删除失败");
             this.$message.error("删除失败");
@@ -253,11 +261,12 @@ export default {
       this.customerForm = {
       this.customerForm = {
         code: "",
         code: "",
         name: "",
         name: "",
-        en_name: "",
+        contactPosition: "",
         mobile: "",
         mobile: "",
         contact: "",
         contact: "",
         address: "",
         address: "",
         other: "",
         other: "",
+        status:5
       };
       };
       this.dialogVisible = true;
       this.dialogVisible = true;
     },
     },
@@ -267,11 +276,12 @@ export default {
       this.customerForm = {
       this.customerForm = {
         code: "",
         code: "",
         name: "",
         name: "",
-        en_name: "",
+        contactPosition: "",
         mobile: "",
         mobile: "",
         contact: "",
         contact: "",
         address: "",
         address: "",
         other: "",
         other: "",
+        status:5
       };
       };
     },
     },
     // 搜索提交
     // 搜索提交

+ 145 - 18
src/views/project/ProjectInput.vue

@@ -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>
@@ -141,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)"
@@ -308,6 +321,27 @@
         </span>
         </span>
       </template>
       </template>
     </el-dialog>
     </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>
   
   
@@ -324,7 +358,7 @@ import {
   rateScope,
   rateScope,
   sequence,
   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";
@@ -374,7 +408,7 @@ export default {
         department: "",
         department: "",
         project_id: null,
         project_id: null,
         dateRange: [], // 添加时间范围
         dateRange: [], // 添加时间范围
-        hasContent: null, // 添加内容状态
+        content_empty: null, // 添加内容状态
       },
       },
       gsprPageForm: {
       gsprPageForm: {
         page: 1,
         page: 1,
@@ -399,7 +433,7 @@ export default {
       },
       },
       gsprPageForm: {
       gsprPageForm: {
         page: 1,
         page: 1,
-        page_size: 30,
+        page_size: 999,
       },
       },
       gsprTotal: 0,
       gsprTotal: 0,
       gsprRules: {
       gsprRules: {
@@ -441,6 +475,15 @@ export default {
         sequence: 1,
         sequence: 1,
         id: null,
         id: null,
       },
       },
+      remarkDialogVisible: false,
+      remarkForm: {
+        id: "",
+        remarks: "",
+      },
+      /* 已绑定项目 */
+      documentIds: [],
+      templateLocations: [], // 存储传递过来的位置信息
+      matchedContents: {}, // 存储技术报告位置匹配的内容
     };
     };
   },
   },
   mounted() {
   mounted() {
@@ -452,9 +495,67 @@ 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) {
     async rateScope(value, row) {
       try {
       try {
@@ -520,7 +621,6 @@ export default {
             Authorization: "Bearer " + localStorage.getItem("token"), // 根据实际token获取方式调整
             Authorization: "Bearer " + localStorage.getItem("token"), // 根据实际token获取方式调整
           },
           },
         });
         });
-        console.log(response);
         // 检查响应数据
         // 检查响应数据
         if (
         if (
           !response.data ||
           !response.data ||
@@ -601,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;
     },
     },
     // 修改编辑内容显示方法
     // 修改编辑内容显示方法
@@ -1058,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({
@@ -1078,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: typeof item.score === "number" ? item.score : 0, // 确保 score 是数字类型
-          }));
-          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);
@@ -1101,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();
@@ -1123,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();
     },
     },

+ 147 - 15
src/views/project/components/dataList.vue

@@ -7,7 +7,7 @@
       empty-text="没有项目信息"
       empty-text="没有项目信息"
     >
     >
       <el-table-column prop="id" label="项目编号" align="center" width="80" />
       <el-table-column prop="id" label="项目编号" align="center" width="80" />
-      <el-table-column prop="customer_id" label="客户名称" align="left" >
+      <el-table-column prop="customer_id" label="客户名称" align="left">
         <template #default="scope">
         <template #default="scope">
           <span>{{ getCusomName(scope.row.customer_id) }}</span>
           <span>{{ getCusomName(scope.row.customer_id) }}</span>
         </template>
         </template>
@@ -82,11 +82,6 @@
             </span>
             </span>
             <template #dropdown>
             <template #dropdown>
               <el-dropdown-menu>
               <el-dropdown-menu>
-                <el-dropdown-item
-                  :command="{ type: 'viewTemplates', row: scope.row }"
-                >
-                  已绑定模版
-                </el-dropdown-item>
                 <el-dropdown-item
                 <el-dropdown-item
                   :command="{ type: 'template', row: scope.row }"
                   :command="{ type: 'template', row: scope.row }"
                   >选择模版</el-dropdown-item
                   >选择模版</el-dropdown-item
@@ -94,6 +89,14 @@
                 <el-dropdown-item :command="{ type: 'enter', row: scope.row }"
                 <el-dropdown-item :command="{ type: 'enter', row: scope.row }"
                   >输入项目</el-dropdown-item
                   >输入项目</el-dropdown-item
                 >
                 >
+                <el-dropdown-item
+                  :command="{ type: 'viewTemplates', row: scope.row }"
+                  v-if="
+                    scope.row.documentIds && scope.row.documentIds.length > 0
+                  "
+                >
+                  已绑定模版
+                </el-dropdown-item>
                 <el-dropdown-item :command="{ type: 'edit', row: scope.row }">
                 <el-dropdown-item :command="{ type: 'edit', row: scope.row }">
                   <svg-icon icon-class="edit" />编辑
                   <svg-icon icon-class="edit" />编辑
                 </el-dropdown-item>
                 </el-dropdown-item>
@@ -341,18 +344,22 @@ export default {
   },
   },
   methods: {
   methods: {
     /* 客户名称 */
     /* 客户名称 */
-    getCusomName(phaseId){
+    getCusomName(phaseId) {
       const product = this.customList.find((item) => item.id === phaseId);
       const product = this.customList.find((item) => item.id === phaseId);
       return product ? product.name : "未知客户";
       return product ? product.name : "未知客户";
     },
     },
     /* 当前阶段 */
     /* 当前阶段 */
     getPhaseName(phaseId) {
     getPhaseName(phaseId) {
-      const product = this.currentPhaseList.find((item) => item.value === phaseId);
+      const product = this.currentPhaseList.find(
+        (item) => item.value === phaseId
+      );
       return product ? product.label : "未知阶段";
       return product ? product.label : "未知阶段";
     },
     },
 
 
     getPhaseType(phaseId) {
     getPhaseType(phaseId) {
-      const product = this.currentPhaseList.find((item) => item.value === phaseId);
+      const product = this.currentPhaseList.find(
+        (item) => item.value === phaseId
+      );
       if (!product) return "info";
       if (!product) return "info";
 
 
       // 根据不同阶段返回不同的类型
       // 根据不同阶段返回不同的类型
@@ -431,7 +438,7 @@ export default {
     viewBoundTemplates(row) {
     viewBoundTemplates(row) {
       this.currentData = row;
       this.currentData = row;
       this.boundTemplateLoading = true;
       this.boundTemplateLoading = true;
-      searchTemplateList({ ids: row.documentIds.join(",") })
+      searchTemplateList({ ids: row.documentIds.join(",") || 0 })
         .then((res) => {
         .then((res) => {
           if (res.status === 200) {
           if (res.status === 200) {
             this.boundTemplateList = res.data;
             this.boundTemplateList = res.data;
@@ -1282,13 +1289,138 @@ export default {
     },
     },
     /* 输入项目 */
     /* 输入项目 */
     enterPro(row) {
     enterPro(row) {
-      this.$router.push({
-        path: "/project/ProjectInput",
-        query: { id: row.id },
-      });
+      if (row.documentIds.length == 0) {
+        this.$message.warning("请先绑定模版!");
+        return;
+      }
+
+      // 获取已绑定模版的替换位置信息
+      searchTemplateList({ ids: row.documentIds.join(",") || 0 })
+        .then(async (res) => {
+          if (res.status === 200) {
+            const templates = res.data;
+            const locations = [];
+
+            // 遍历所有模版,提取替换位置
+            templates.forEach((template) => {
+              if (template.data) {
+                const templateData = JSON.parse(template.data);
+                templateData.forEach((item) => {
+                  const tempDiv = document.createElement("div");
+                  tempDiv.innerHTML = item.content;
+                  const plainText = tempDiv.textContent || tempDiv.innerText;
+
+                  const patterns = [
+                    /【([A-Z]{1,4}[0-9]{0,2})-([A-Z]{1,4}[0-9]{0,2})-([0-9]{2})-([0-9]{2,3})】/g,
+                    /\[([A-Z]{1,4}[0-9]{0,2})-([A-Z]{1,4}[0-9]{0,2})-([0-9]{2})-([0-9]{2,3})\]/g,
+                  ];
+
+                  patterns.forEach((pattern) => {
+                    let match;
+                    while ((match = pattern.exec(plainText)) !== null) {
+                      locations.push({
+                        template_id: template.id,
+                        template_title: template.title,
+                        location: match[0],
+                        type: this.getDocumentType(match[0]),
+                      });
+                    }
+                  });
+                });
+              }
+            });
+
+            try {
+              // 按类型分组位置信息
+              const params = {
+                template_location: [],
+                middle_layer_location: [],
+                tech_report_location: [],
+                other_location: [],
+              };
+
+              // 遍历所有位置并分类
+              locations.forEach((loc) => {
+                Object.keys(params).forEach((key) => {
+                  if (loc.type === key) {
+                    params[key].push(loc.location.replace(/[\[\]【】]/g, "")); // 清除括号
+                  } else {
+                    params[key].push("");
+                  }
+                });
+              });
+
+              // 获取替换内容
+              const response = await axios.post(
+                `${process.env.VUE_APP_BASE_API}/project-raw-data/batch-content`,
+                params,
+                {
+                  headers: {
+                    "Content-Type": "application/json",
+                  },
+                }
+              );
+
+              if (response.status === 200 && response.data) {
+                const replacementContents = response.data.data.matched_data;
+
+                // 将位置信息和对应的替换内容组合
+                const enrichedLocations = locations.map((loc, index) => ({
+                  ...loc,
+                  content: replacementContents[index]?.content || null,
+                  template_location:
+                    replacementContents[index]?.template_location || null,
+                  tech_report_location:
+                    replacementContents[index]?.tech_report_location || [],
+                }));
+
+                // 对整个 enrichedLocations 进行去重
+                const uniqueEnrichedLocations = enrichedLocations.reduce(
+                  (acc, current) => {
+                    const isDuplicate = acc.find(
+                      (item) =>
+                        item.template_id === current.template_id &&
+                        item.location === current.location
+                    );
+
+                    if (!isDuplicate) {
+                      // 如果不是重复项,则添加到结果数组中
+                      return [...acc, current];
+                    }
+                    return acc;
+                  },
+                  []
+                );
+                // 使用去重后的数据
+                this.$router.push({
+                  path: "/project/ProjectInput",
+                  query: {
+                    id: row.id,
+                    projectData: encodeURIComponent(
+                      JSON.stringify({
+                        locations: uniqueEnrichedLocations, // 使用去重后的数据
+                        templates: templates.map((t) => ({
+                          id: t.id,
+                          title: t.title,
+                        })),
+                      })
+                    ),
+                  },
+                });
+              }
+            } catch (error) {
+              console.error("获取替换内容失败:", error);
+              this.$message.error("获取替换内容失败");
+            }
+          }
+        })
+        .catch((error) => {
+          console.error("获取模版位置信息失败:", error);
+          this.$message.error("获取模版位置信息失败");
+        });
     },
     },
     /* 产品分类名称 */
     /* 产品分类名称 */
-    getCategoryTypeName(categoryId){
+    getCategoryTypeName(categoryId) {
       const category = this.productList.find((item) => item.id === categoryId);
       const category = this.productList.find((item) => item.id === categoryId);
       return category ? category.category.name : categoryId;
       return category ? category.category.name : categoryId;
     },
     },

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно