Browse Source

Merge branch 'master' of http://175.27.169.173:10880/zkqy-sass-platform/mec-cloud_-intelligent-manufacturing_crm

sql715 2 tháng trước cách đây
mục cha
commit
238f354ebd

+ 62 - 1
zkqy-admin/src/main/java/com/zkqy/web/controller/system/SysBpmNodeScriptController.java

@@ -65,6 +65,12 @@ public class SysBpmNodeScriptController extends BaseController {
     @Value("${template.urluPload}")
     private  String  urluPload;
 
+
+    @Value("${template.pageUrl}")
+    private  String  pageUrl;
+
+
+
     /**
      * 查询流程节点脚本列表
      */
@@ -149,7 +155,12 @@ public class SysBpmNodeScriptController extends BaseController {
         zipOutputStream.closeEntry();
     }
 
-    private static final String UPLOAD_DIR = "uploads/";
+
+    /**
+     * 脚本节点上传
+     * @param file
+     * @return
+     */
 
     @PostMapping("/upload")
     public ResponseEntity<String> uploadFile(@RequestParam("file") MultipartFile file) {
@@ -185,6 +196,56 @@ public class SysBpmNodeScriptController extends BaseController {
         }
     }
 
+    /**
+     * 脚本节点上传
+     * @param file
+     * @return
+     */
+
+    /**
+     * 组件页面上传
+     * @param file
+     * @param id
+     * @return
+     */
+    @PostMapping("/uploadPage")
+    public ResponseEntity<String> uploadPage(@RequestParam("file") MultipartFile file,@RequestParam("id") String id) {
+        if (file.isEmpty()) {
+            return ResponseEntity.badRequest().body("请选择一个文件进行上传!");
+        }
+        try {
+            // 确保保存文件的目录存在
+            Path uploadPath = Paths.get(pageUrl);
+            if (!Files.exists(uploadPath)) {
+                Files.createDirectories(uploadPath);
+            }
+
+            //更新节点编码状态(文件名)
+//            String string = file.getOriginalFilename().toString();
+            //查询节点信息列表
+            SysBpmNodeScript sysBpmNodeScript1 = sysBpmNodeScriptService.selectSysBpmNodeScriptById(Long.valueOf(id));
+            SysBpmNodeScript sysBpmNodeScript = new SysBpmNodeScript();
+            sysBpmNodeScript.setPageUpload("1");
+            sysBpmNodeScript.setId(Long.valueOf(id));
+            int i = sysBpmNodeScriptService.updateSysBpmNodeScript(sysBpmNodeScript);//更新脚本key
+            if(i>0){
+                // 将文件保存到指定路径
+                byte[] bytes = file.getBytes();
+                Path path = Paths.get(pageUrl + sysBpmNodeScript1.getScriptKey()+".html");
+                Files.write(path, bytes);
+                return ResponseEntity.ok("文件上传成功:" + file.getOriginalFilename());
+            }else {
+                return ResponseEntity.status(200).body("脚本组件状态未更新成功");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            return ResponseEntity.status(500).body("文件上传失败:" + e.getMessage());
+        }
+    }
+
+
+
+
     @GetMapping("/download")
     @Anonymous
     public ResponseEntity<byte[]> downloadFile() throws Exception {

+ 26 - 16
zkqy-system/src/main/java/com/zkqy/system/domain/SysBpmNodeScript.java

@@ -6,7 +6,7 @@ import com.zkqy.common.core.domain.BaseEntity;
 
 /**
  * 流程节点脚本对象 sys_bpm_node_script
- * 
+ *
  * @author zkqy
  * @date 2023-10-26
  */
@@ -22,6 +22,16 @@ public class SysBpmNodeScript extends BaseEntity
     /** 脚本编码 */
     private String scriptKey;
 
+    private  String  pageUpload;
+
+    public String getPageUpload() {
+        return pageUpload;
+    }
+
+    public void setPageUpload(String pageUpload) {
+        this.pageUpload = pageUpload;
+    }
+
     /**
      * 脚本状态
      */
@@ -53,7 +63,7 @@ public class SysBpmNodeScript extends BaseEntity
     /** 删除标志(0:否;1:是) */
     private String delFlag;
 
-    public void setId(Long id) 
+    public void setId(Long id)
     {
         this.id = id;
     }
@@ -75,65 +85,65 @@ public class SysBpmNodeScript extends BaseEntity
         this.tenantId = tenantId;
     }
 
-    public Long getId() 
+    public Long getId()
     {
         return id;
     }
-    public void setScriptKey(String scriptKey) 
+    public void setScriptKey(String scriptKey)
     {
         this.scriptKey = scriptKey;
     }
 
-    public String getScriptKey() 
+    public String getScriptKey()
     {
         return scriptKey;
     }
-    public void setScriptFunctionName(String scriptFunctionName) 
+    public void setScriptFunctionName(String scriptFunctionName)
     {
         this.scriptFunctionName = scriptFunctionName;
     }
 
-    public String getScriptFunctionName() 
+    public String getScriptFunctionName()
     {
         return scriptFunctionName;
     }
-    public void setScriptName(String scriptName) 
+    public void setScriptName(String scriptName)
     {
         this.scriptName = scriptName;
     }
 
-    public String getScriptName() 
+    public String getScriptName()
     {
         return scriptName;
     }
-    public void setScriptFunctionCode(String scriptFunctionCode) 
+    public void setScriptFunctionCode(String scriptFunctionCode)
     {
         this.scriptFunctionCode = scriptFunctionCode;
     }
 
-    public String getScriptFunctionCode() 
+    public String getScriptFunctionCode()
     {
         return scriptFunctionCode;
     }
-    public void setScriptType(Long scriptType) 
+    public void setScriptType(Long scriptType)
     {
         this.scriptType = scriptType;
     }
 
-    public Long getScriptType() 
+    public Long getScriptType()
     {
         return scriptType;
     }
-    public void setScriptDescription(String scriptDescription) 
+    public void setScriptDescription(String scriptDescription)
     {
         this.scriptDescription = scriptDescription;
     }
 
-    public String getScriptDescription() 
+    public String getScriptDescription()
     {
         return scriptDescription;
     }
-    public void setDelFlag(String delFlag) 
+    public void setDelFlag(String delFlag)
     {
         this.delFlag = delFlag;
     }

+ 10 - 5
zkqy-system/src/main/resources/mapper/system/SysBpmNodeScriptMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.zkqy.system.mapper.SysBpmNodeScriptMapper">
-    
+
     <resultMap type="com.zkqy.system.domain.SysBpmNodeScript" id="SysBpmNodeScriptResult">
         <result property="id"    column="id"    />
         <result property="scriptKey"    column="script_key"    />
@@ -21,10 +21,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime"    column="update_time"    />
         <result property="scriptState"    column="script_state"    />
         <result property="tenantId"    column="tenant_id"    />
+        <result property="pageUpload"    column="page_upload"    />
+
     </resultMap>
 
     <sql id="selectSysBpmNodeScriptVo">
-        select id, script_key, script_function_name, script_name, script_function_code, script_type, script_description, industry_type,table_name, del_flag, create_by, create_time, update_by, update_time,tenant_id,script_state,tenant_id from sys_bpm_node_script
+        select id, script_key, script_function_name, script_name, script_function_code, script_type, script_description, industry_type,
+               table_name, del_flag, create_by, create_time, update_by, update_time,tenant_id,script_state,tenant_id,page_upload from sys_bpm_node_script
     </sql>
 
     <select id="selectSysBpmNodeScriptList" parameterType="com.zkqy.system.domain.SysBpmNodeScript" resultMap="SysBpmNodeScriptResult">
@@ -41,12 +44,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
              <if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
              order by create_time desc
     </select>
-    
+
     <select id="selectSysBpmNodeScriptById" parameterType="Long" resultMap="SysBpmNodeScriptResult">
         <include refid="selectSysBpmNodeScriptVo"/>
         where id = #{id}
     </select>
-        
+
     <insert id="insertSysBpmNodeScript" parameterType="com.zkqy.system.domain.SysBpmNodeScript" useGeneratedKeys="true" keyProperty="id">
         insert into sys_bpm_node_script
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -94,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="tenantId != null">tenant_id = #{tenantId},</if>
             <if test="scriptState != null">script_state = #{scriptState},</if>
+            <if test="pageUpload!=null and pageUpload!=''">page_upload=#{pageUpload}</if>
         </trim>
         where id = #{id}
     </update>
@@ -122,6 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="tenantId != null">tenant_id = #{tenantId},</if>
+            <if test="pageUpload!=null and pageUpload!='' ">page_upload=#{pageUpload}</if>
         </trim>
         where script_key = #{scriptKey}
     </update>
@@ -161,4 +166,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </select>
 
-</mapper>
+</mapper>

+ 87 - 7
zkqy-ui/src/views/bpmprocess/scriptManage.vue

@@ -213,16 +213,18 @@
           {{ getDictLabel(scope.row.scriptState, dict.type.zkqy_jbzt) }}
         </template>
       </el-table-column>
+
+      <el-table-column label="组件状态" align="center" prop="pageUpload">
+        <template slot-scope="scope">
+          {{ getDictLabel(scope.row.pageUpload, dict.type.isuploadpage) }}
+        </template>
+      </el-table-column>
       <el-table-column
         label="脚本描述"
         align="center"
         prop="scriptDescription"
       />
-      <!--      <el-table-column-->
-      <!--        label="租户id"-->
-      <!--        align="center"-->
-      <!--        prop="tenantId"-->
-      <!--      />-->
+
 
       <el-table-column
         label="操作"
@@ -273,6 +275,18 @@
                 >审核
                 </el-button>
               </el-dropdown-item>
+
+              <el-dropdown-item >
+                <el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-edit"
+                  @click="updateLoadPage(scope.row)"
+                  v-hasPermi="['system:script:edit']"
+                >上传组件页面
+                </el-button>
+              </el-dropdown-item>
+
             </el-dropdown-menu>
           </el-dropdown>
         </template>
@@ -416,7 +430,7 @@
     >
       <div ref="container" class="monaco-container"></div>
     </el-drawer>
-    <!-- 用户导入对话框 -->
+    <!--节点上传 -->
     <el-dialog
       :title="upload.title"
       :visible.sync="upload.open"
@@ -443,6 +457,34 @@
         <el-button @click="upload.open = false">取 消</el-button>
       </div>
     </el-dialog>
+    <!--页面上传 -->
+    <el-dialog
+      :title="upload1.title"
+      :visible.sync="upload1.open"
+      width="400px"
+      append-to-body
+    >
+      <el-upload
+        ref="upload1"
+        :limit="1"
+        accept="*"
+        :headers="upload1.headers"
+        :action="upload1.url"
+        :disabled="upload1.isUploading"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess1"
+        :auto-upload="false"
+        :data="uploadObj"
+         drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm1">确 定</el-button>
+        <el-button @click="upload1.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -468,11 +510,14 @@ import { Cog } from 'lucide-vue'
 import { getToken } from '@/utils/auth'
 export default {
   name: 'Script',
-  dicts: ['bpm_script_type', 'industry_type', 'zkqy_jbzt'],
+  dicts: ['bpm_script_type', 'industry_type', 'zkqy_jbzt','isuploadpage'],
   components: { Editor },
   data () {
     return {
       openSH:false,
+      uploadObj:{
+        id:""
+      },
       // 用户导入参数
       upload: {
         // 是否显示弹出层(用户导入)
@@ -488,6 +533,21 @@ export default {
         // 上传的地址
         url: process.env.VUE_APP_BASE_API + '/system/script/upload'
       },
+      // 用户导入参数
+      upload1: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: '',
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: 'Bearer ' + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + '/system/script/uploadPage'
+      },
       openUpdate: true,
       // 脚本上传列表
       fileList: [], // 上传的文件列表
@@ -498,6 +558,7 @@ export default {
       ids: [],
       // 非单个禁用
       single: true,
+      iddq:"",
       // 非多个禁用
       multiple: true,
       // 显示搜索条件
@@ -582,6 +643,14 @@ export default {
     this.getTenantAllList()
   },
   methods: {
+    //上传组件页面
+    updateLoadPage(row){
+      this.upload1.open=true;
+      this.upload1.title = '节点组件上传'
+      this.uploadObj.id="";
+      this.uploadObj.id=row.id
+      console.log("上传组件页面",this.uploadObj)
+    },
     //上传节点模版
     uploadTheNodeTemplate () {
       this.upload.title = '租户脚本上传'
@@ -599,10 +668,21 @@ export default {
       this.$modal.msgSuccess('文件上传成功')
       this.getList();
     },
+    // 文件上传成功处理
+    handleFileSuccess1 (response, file, fileList) {
+      this.upload1.isUploading = false
+      this.upload1.open=false;
+      this.$refs.upload1.clearFiles()
+      this.$modal.msgSuccess('文件上传成功')
+      this.getList();
+    },
     // 提交上传文件
     submitFileForm () {
       this.$refs.upload.submit()
     },
+    submitFileForm1 () {
+      this.$refs.upload1.submit()
+    },
     // 编辑器初始化
     editorInit () {
       require('brace/theme/chrome')