以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于公用表中文件删除权限  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=50693)

--  作者:wealthwind
--  发布时间:2014/5/11 14:27:00
--  关于公用表中文件删除权限
项目个案申请中,有很多用户比如:华北区,东南区,西北区等用户,提交个案;现在的情况是如果个案保存成功了,并给予审批意见,那无论是那种类型的用户都无法修改个案;;;

好想在问题来了,就是在个案还未给予审批意见时,比如华北区提交了个案,由于大家都能看到表内容,所以西北区的人有可以会误修改和删除了华北区的个案;

现在我想达到的就是,根据区域的不同,在没有给予审批意见前,各区域自身只能最自身的个案进行相关操作。。。

现在DataColChanging的代码是:

Select Case e.DataCol.name
    Case "审核意见", "审核日期", "审核"
        If user.roles = "个案拆分" Then
            If e.NewValue <> Nothing AndAlso e.OldValue <> Nothing AndAlso e.DataRow.IsNull("审核") = False  Then
                msgbox("已审核")
                e.cancel = True
            Else If e.DataRow.IsNull("批准日期") = False OrElse e.DataRow.IsNull("终审意见") = False Then
                msgbox("已提交,不能再修改")
                e.cancel = True
            End If
        Else
            e.Cancel = True
        End If
    Case "批准意见" , "批准日期", "批准"
        If User.roles = "行销部主管" Then
            If e.DataRow.IsNull("审核") Then
                msgbox("没审核")
                e.Cancel = True
            Else If e.NewValue <> Nothing AndAlso e.OldValue <> Nothing AndAlso e.DataRow.IsNull("批准") = False  Then
                msgbox("已批准")
                e.Cancel = True
            Else If e.DataRow.IsNull("终审日期") = False Then
                msgbox("已提交")
                e.cancel = True
            End If
        Else
            e.Cancel = True
        End If
    Case "终审意见", "终审日期", "终审"
        If User.roles = "行销部经理" Then
            If e.DataRow.IsNull("批准") Then
                msgbox("没批准")
                e.Cancel = True
            Else If e.NewValue <> Nothing AndAlso e.OldValue <> Nothing AndAlso e.DataRow.IsNull("终审") = False Then
                msgbox("已终审")
                e.cancel = True
            End If
        Else
            e.Cancel = True
        End If
    Case "裁决意见", "裁决日期", "裁决"
        If User.roles = "BOSS" Then
            If e.DataRow.IsNull("终审") Then
                msgbox("没终审")
                e.Cancel = True
            Else If e.NewValue <> Nothing AndAlso e.OldValue <> Nothing AndAlso e.DataRow.IsNull("裁决") = False Then
                msgbox("已裁决")
                e.cancel = True
            End If
        Else
            e.Cancel = True
        End If
    Case "个案申请","日期","编号","文件名称","分区","内容"
        Select Case User.Group
            Case "东北区", "西北区", "华北区", "华东区", "东南区", "华南区", "西南区"
                If e.DataRow.IsNull("审核日期") = False Then
                    e.Cancel = True
                End If
            Case Else
                e.Cancel = True
        End Select
End Select
图片点击可在新窗口打开查看此主题相关图片如下:360截图20140511142143205.jpg
图片点击可在新窗口打开查看

--  作者:lsy
--  发布时间:2014/5/11 15:50:00
--  

加载数据时,只加载登录用户所在区域的数据,其他的数据,看都看不见,又怎么能误删除?


--  作者:wealthwind
--  发布时间:2014/5/11 16:19:00
--  
我也将个案申请,列为公用表了,共享大家的想法,所以大家能互相看到自己的个案,,,这样就有可能出现误删的情况。。。。。。。。。。
--  作者:wealthwind
--  发布时间:2014/5/11 16:43:00
--  
老师在吗??能否帮我处理一下~
--  作者:lsy
--  发布时间:2014/5/11 16:49:00
--  

一、表或者与字段有关的录入控件默认不可编辑,也就不能修改、删除

二、在修改和删除按钮中写代码,先根据用户所管区域筛选数据,然后使表或者与字段有关的录入控件可用(也就是可编辑)。


--  作者:wealthwind
--  发布时间:2014/5/11 17:04:00
--  
我已经弄懂了

If e.Datarow("分区") <> User.Group Then

    e.Cancel = True

End If。。。。



那修改和保存,在哪里设置比较好~~~


--  作者:lsy
--  发布时间:2014/5/11 17:10:00
--  

按钮好用、灵活。


--  作者:wealthwind
--  发布时间:2014/5/11 17:34:00
--  
老师,如何将这两段代码,连在一起呢??

If user.name <> User.Group Then
    msgbox("你对此文件没有修改保存的权限")
    e.Cancel = True
End If

If e.Form.Controls("TextBox1").text > "" Then
    Tables("个案申请").current("内容")=e.Form.Controls("TextBox1").text
    Tables("个案申请").current.save()
    Vars("编辑器校验")=10
    MessageBox.Show("保存成功")
Else
    MessageBox.Show("不允许空文档保存")
End If

--  作者:有点甜
--  发布时间:2014/5/11 17:46:00
--  

If user.name <> User.Group Then
    msgbox("你对此文件没有修改保存的权限")
Else
    If e.Form.Controls("TextBox1").text > "" Then
        Tables("个案申请").current("内容")=e.Form.Controls("TextBox1").text
        Tables("个案申请").current.save()
        Vars("编辑器校验")=10
        MessageBox.Show("保存成功")
    Else
        MessageBox.Show("不允许空文档保存")
    End If
End If


 


--  作者:wealthwind
--  发布时间:2014/5/11 18:19:00
--  
老师,代码有错误额,~~~我现在就用华南区登录,如果新建文件,后,我不输入内容,应该弹出对话框”不允许文件为空“才对‘


现在弹出来的对话框”你没有修改和保存的权限“”这个不对额。。。。