框架使用记录

 一、流程表

1.我的审批查看

具体代码见service中。

-- 用户审批 = 1 (UserInfo.User_Id), 角色审批 = 2 (UserInfo.Role_Id),部门审批 = 3(user.DeptIds)
select * from Sys_WorkFlowTable where WorkFlowTable_Id in(
select WorkFlowTable_Id from Sys_WorkFlowTableStep s
where (StepType=1 and StepValue='3365') or (StepType=2 and StepValue='9') or(StepType=3 and StepValue in('',''))
);

select s.StepType,s.StepValue,s.* from Sys_WorkFlowTableStep s
-- where (StepType=1 and StepValue='3365') or (StepType=2 and StepValue='9') or(StepType=3 and StepValue in('',''))
order by CreateDate desc;

 

删除某个流程:

delete from Sys_WorkFlowTableStep where WorkFlowTable_Id in('A539703A-8DC6-4EBE-B63D-5B41DE07C7CF','01544834-6E18-4EDD-8745-71F919BAE27B');
delete from Sys_WorkFlowTable where WorkFlowTable_Id in('A539703A-8DC6-4EBE-B63D-5B41DE07C7CF','01544834-6E18-4EDD-8745-71F919BAE27B');

 

delete from Sys_WorkFlowTableStep where WorkFlowTable_Id in(
SELECT WorkFlowTable_Id FROM Sys_WorkFlowTable where BusKeyValue in('PY202508060005','PY202508060004','PY202508080003'));

delete from Sys_WorkFlowTable where BusKeyValue in('PY202508060005','PY202508060004','PY202508080003');

 

2.流程节点设置表:Sys_WorkFlowStep、Sys_WorkFlow

StepType存的是“审批类型,1、用户;2角色”    如果StepType是1(用户) StepValue 存的是用户id,如果 StepType是2(角色)存的是 角色ID 

如果指定用,且指定的用户要动态的,那可以建一个不用的用户,指定它,主要用他的名称对就可以。

3.具体某个业务的流程表:Sys_WorkFlowTableStep

Sys_WorkFlowTableStep 中的AuditStatus必须是审批中、待审批, 且StepId= Sys_WorkFlowTable.CurrentStepId,审核页面的 isCurrentUser才会是true ,且Sys_WorkFlowTable 中的AuditStatus必须是审批中、待审批 如此才出现审批按钮 

4.换了一个环境流程不可用了

手工重新分配。

二、修改了本地的生成的配置,菜单,各权限功能配置,对应四张表

Sys_TableColumn、Sys_TableInfo、 sys_menu、sys_roleauth 服务器导入菜单入好像没有用,还要再保存,重新勾选权限。

三、控制主从表,保存不关闭当前页面。

  updateAfter(formData) {
      //控制 保存不关闭当前页面。
      this.search();
      return false;
    },

四、控制 弹出框保存不关闭。保存成功后并处理状态为修改。

 addAfter(result) {
      // console.info(result);
      // console.info(result.status);
      // console.info(JSON.parse(result.data));
      // console.info(JSON.parse(result.data).data.PriceSheetId);
      // console.info(result.data.Data);
      
      if(result.status===true)
      {

        // console.info('this.editFormFields:'+this.editFormFields["PriceSheetId"]);
        let resultData = JSON.parse(result.data).data;

        Object.keys(resultData).forEach(key=>{ 
          this.editFormFields[key] = resultData[key];
        });

        this.boxButtons[0].hidden=false;
        this.boxButtons[1].hidden=false;
        this.currentAction="update";
        // console.info('extendsPriceSheetId:'+extendsPriceSheetId);
        // console.info('this.editFormFields:'+JSON.parse(this.editFormFields));
        // console.info('this.editFormFields:'+this.editFormFields["PriceSheetId"]);

        console.info(this.currentAction);
        this.search(); 
      }
      // this.refresh();
      //控制 保存不关闭当前页面。      
      return false;
    },

 四、禁用页面缓存keepAlive

 meta: {
      keepAlive: false
   }

 四、导入增加固定参数

JS:

 importExcelBefore (formData) { //导入excel导入前
      //往formData写一些其他参数提交到后台,
      // alert(store.getters.data().Warehouse);
      formData.append("strWarehouseCode",  store.getters.data().Warehouse);
      //后台按下面方法获取请求的参数
      // Core.Utilities.HttpContext.Current.Request("val2");
      return true;
    },

后台:

 //导入后处理(已经写入到数据库了)
            ImportOnExecuted = (List<PutIntoStorageTmp> list) =>
            {
                try 
                {
                   string strWarehouseCode = Core.Utilities.HttpContext.Current.Request("strWarehouseCode");                  
                }
                catch (Exception err)
                {
                    return webResponse.Error("导入出错,请联系管理员!");
                }                
                return webResponse.OK();
            };
View Code

 五、前端

 1.明细是否可编辑,且动态绑定下拉数据。

//可编辑
      this.columns.forEach(row => {        
        //加载列下拉数据
      // this.AddColumnsSelectData(); 
        if (row.field == "Quality") {
          row.edit = { type: "select",keep: true };
          //如果设置key的字典编号,data设置空数组会自动绑定数据源
          row.bind = { key:'QualityState',data:[]};
        }
        if (row.field == "MoveQty") {
          row.edit = { keep: true };            
        }
      })
View Code

 六、明细表添加行

addRow () {
      //明细表添加行,在此处可以设置添加的默认值
      let obj = {};
      //给明细表添加行时,设置默认值。--onInited方法中对this.detailOptions.columns进行formatter也可以实现)
      //obj.xx=123;
      this.$refs.detail.addRow(obj);
      //明细表批量添加行this.$refs. detail.rowData.push(...[{},{}]);
    },
View Code

七、select 下拉框 选择过多 不显示

select2Count	下拉框选项超出500个后会启用element plus中的select2组件
修改 前端 select2Count 默认值 就好了。

 八、同一栏位,取不同数据字典

如下只介绍了主从表方式 修改方法

  //编辑方法保存数据库前处理
            UpdateOnExecuting = (PriceSheetHead head, object addList, object updateList, List<object> delKeys) =>
            {
                int intPriceSheetId = head.PriceSheetId;
                List<PriceSheetList> listAll = null;
                if (addList != null)
                { 
                    //新增的明细表
                    List<PriceSheetList> add = addList as List<PriceSheetList>;
                    listAll = add;
                }
                if (addList != null)
                {
                    //修改的明细表
                    List<PriceSheetList> update = updateList as List<PriceSheetList>;
                    listAll = listAll.Concat(update).ToList();
                }

                if (listAll != null) {
                    List<Sys_DictionaryShow> arrFromAddress = new List<Sys_DictionaryShow>();
                    List<Sys_DictionaryShow> arrToAddress = new List<Sys_DictionaryShow>();
                    //验证 导入数据,并根据进出口标志 返回不同的起始地和目的地。
                    string strCheckResult = _serviceSheetList.CheckImport(listAll,  "当前数据存在", intPriceSheetId, head.SummaryCompanyCode,head.IEFlag.ToString(),head.AgentName,head.BusinessType,head.TradeTerm, out arrFromAddress, out arrToAddress);
                    if (!string.IsNullOrEmpty(strCheckResult))
                    {
                        //设置webResponse.Code = "-1"会中止后面代码执行,与返回 webResponse.Error()一样,区别在于前端提示的是成功或失败
                        webResponse.Code = "-1";
                        webResponse.Message = strCheckResult;
                        return webResponse.Error(strCheckResult);
                    }
                    else
                    {
                      
                        foreach (PriceSheetList item in listAll)
                        {
                            var arrFromTmp = arrFromAddress.Where(x => x.DicName == item.FromAddress).ToList();
                            var arrToTmp = arrToAddress.Where(x => x.DicName == item.ToAddress).ToList();
                            if (arrFromTmp != null && arrFromTmp.Count > 0 && arrToTmp != null && arrToTmp.Count > 0)
                            {
                                item.FromAddress = arrFromTmp[0].DicValue;
                                item.ToAddress = arrToTmp[0].DicValue;
                            }
                            else
                            {
                                webResponse.Code = "-1";
                                strCheckResult = string.Format("起始地:【{0}】或目的地:【{1}】在数据字典中不存在!", item.FromAddress, item.ToAddress);                                  
                                webResponse.Message = strCheckResult;
                                return webResponse.Error(strCheckResult);
                            }
                        }
                        
                        return webResponse.OK();
                    }
                }
                return webResponse.OK();
            };
View Code

 九、增加自定义按钮权限

增加其他权限,保存的时候一定要把前面的复选框选择好。

  JS 代码 //例:判断用户是否有SellOrder表有没有Add权限
      //第二个参数可选值:Add、Update、Delete、Audit、Import、Export、Search,也可以是自定的义的按钮权限值
      if (this.filterPermission("SellOrder",'Add')) {
        //to do...
      }
   如果是自定义页面请用:
var roleOperate = true;
          this.$emit('parentCall', ($parent) => {
            roleOperate = $parent.filterPermission("t_demandorderflight",'Add');
          });  
          if (roleOperate)            
          {
            this.showSave = true;
          }
          else
          {
            this.showSave = false;
          }
View Code

十、审批状态有负值时,编辑界面显示不了中文

 Object.keys(row).forEach(key=>{ 
            if(key==="AuditStatus")
            {
              this.formHeadFields[key] = String(row[key]);       
            }
            else
            {
              this.formHeadFields[key] = row[key];             
            } 
            });
赋值时转成字符串

 十一、新建页面对话框—“确定”后 页面上的信息 与对话框填写的不一致。

解决:“实际表名”做下修改,可能是先新建了菜单。

十二、数据默认不加载

this.load=false

 十三、显示按钮数

this.maxBtnLength
十四、左边标签宽度 自定义表单表使用 labelWidth
<vol-form :labelWidth="150"
十五、后台:Updat方法中 saveModel.MainData["xx"] 取不到未设编辑页面不显示的字段值。
解决:先设该列为在某个行列显示,然后在前端js中处理。
this.editFormOptions.forEach(x => {
        x.forEach(item => {
        
          if (item.field == 'DemandOrderId') {            
            item.hidden=true;
          }
        

        })
      })
View Code

 其他细节使用:https://www.cnblogs.com/xbding/p/18841005

 
posted @ 2023-10-31 17:50  丁焕轩  阅读(29)  评论(0)    收藏  举报