Explorar el Código

al公务信息添加一行

liuhj hace 4 meses
padre
commit
18c045a7e9
Se han modificado 1 ficheros con 87 adiciones y 1 borrados
  1. 87 1
      src/components/OP/RequestAccess.vue

+ 87 - 1
src/components/OP/RequestAccess.vue

@@ -88,12 +88,16 @@
             </div>
         </div>
         <div class="RequestAccess-table">
-            <el-table ref="multipleTable" :data="tableData" border style="width: 100%" @select="tableselect" @select-all="handleSelectAll" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName">
+            <el-table  height="700" ref="multipleTable" :data="tableData" border style="width: 100%" @select="tableselect" @select-all="handleSelectAll" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName">
                 <el-table-column type="selection" prop="isChecked" width="55">
                 </el-table-column>
                 <el-table-column type="index" label="序号" width="50">
                 </el-table-column>
                 <el-table-column prop="region" label="国家" width="80">
+                    <template slot-scope="scope">
+                        <el-input type="textarea" autosize placeholder="请输入内容" size="small" v-model="scope.row.region">
+                        </el-input>
+                    </template>
                 </el-table-column>
                 <el-table-column prop="nameCn" label="名称">
                      <template slot-scope="scope">
@@ -160,6 +164,9 @@
                     </template>
                 </el-table-column>
             </el-table>
+            <div class="RAaddline">
+                <el-button size="small" @click="addlineclick" type="primary">添加一行</el-button>
+            </div>
         </div>
     </div>
 </template>
@@ -346,6 +353,71 @@ export default {
             });
 
         },
+        //添加一行
+        addlineclick() {
+            // 生成唯一标识
+            const newGuid = this.generateGuid();
+
+            // 新行数据模板
+            const newRow = {
+                guid: newGuid,
+                region: '',           // 国家
+                nameCn: '',           // 名称
+                address: '',          // 地址
+                scope: '',            // 经营范围
+                contact: '',          // 联系人
+                phone: '',            // 联系电话
+                email: '',            // 联系邮箱
+                postUrl: [
+                    {
+                        date:"",
+                        description:"",
+                        url:"",
+                    }
+                ],          // 相关信息链接
+                isChecked: false,     // 是否选中
+                source: 2,            // 来源:2-手动添加,1-AI生成
+                emailInfo: {          // 邮件信息
+                    status: 0,        // 0-未生成,1-已生成,4-已发送
+                    emailTitle: '',
+                    emailContent: ''
+                },
+                intgAdvice:'',
+                recLevel:'',
+                industry:'',
+                nameEn:'',
+                siteUrl:'',
+                remark: '',
+            };
+
+            // 添加到表格数据最前面
+            this.tableData.unshift(newRow);
+
+            // 可选:滚动到顶部
+            this.$nextTick(() => {
+                const table = this.$refs.multipleTable;
+                if (table && table.$el) {
+                    table.$el.scrollIntoView({ behavior: 'smooth' });
+                }
+            });
+
+            this.$message({
+                message: '已添加新行,请填写信息后保存',
+                type: 'success',
+                duration: 2000
+            });
+            
+        },
+         /**
+        * 生成唯一标识
+        */
+        generateGuid() {
+            return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
+                const r = Math.random() * 16 | 0;
+                const v = c === 'x' ? r : (r & 0x3 | 0x8);
+                return v.toString(16);
+            });
+        },
         //邮件预览
         EmailPreview(val){
             this.RequestAccessEmailVisible=true;
@@ -793,6 +865,15 @@ export default {
                 cancelButtonText: '取消',
                 type: 'warning'
             }).then(() => {
+                if(this.Id===0){
+                    this.tableData.splice(this.tableData.findIndex(item=>item.guid===row.guid),1);
+                    this.$message({
+                        message: '删除成功',
+                        type: 'success',
+                    });
+                    return;
+                }
+
                 var url = "/api/Resource/InvitationAISingleDel"
                 var that = this
                 new Promise(function (resolve, reject) {
@@ -1049,6 +1130,11 @@ export default {
 .quill-btn{
     text-align: right;
 }
+.RAaddline {
+    margin-top: 10px;
+    text-align: center;
+}
+
 
 /*富文本样式*/
 .quill-box{