Explorar o código

调差审批人修改权限功能

laiguoran %!s(int64=2) %!d(string=hai) anos
pai
achega
fa1c901746

+ 3 - 1
app/middleware/material_check.js

@@ -121,7 +121,9 @@ module.exports = options => {
                 tid: this.tender.id,
             });
             // 调差的readOnly 指表格和页面只能看不能改,和审批无关
-            material.readOnly = !((material.status === status.uncheck || material.status === status.checkNo) && accountId === material.user_id);
+            material.readOnly = !(((material.status === status.uncheck || material.status === status.checkNo) && accountId === material.user_id)
+                || (this.session.sessionProject.page_show.openMaterialEditForAudit && (material.status === status.checking || material.status === status.checkNoPre) && material.curAuditor.aid === accountId));
+            material.editForAudit = this.session.sessionProject.page_show.openMaterialEditForAudit && (material.status === status.checking || material.status === status.checkNoPre) && material.curAuditor.aid === accountId;
             material.decimal = material.decimal ? JSON.parse(material.decimal) : materialConst.decimal;
             this.material = material;
             // 根据状态判断是否需要更新审批人列表

+ 109 - 107
app/public/js/material.js

@@ -820,6 +820,8 @@ $(document).ready(() => {
     materialSpread.bind(spreadNS.Events.SelectionChanged, materialSpreadObj.selectionChanged);
     materialSpread.bind(spreadNS.Events.ClipboardPasted, materialSpreadObj.clipboardPasted);
     SpreadJsObj.addDeleteBind(materialSpread, materialSpreadObj.deletePress);
+    materialSpread.bind(spreadNS.Events.EditEnded, materialSpreadObj.editEnded);
+    materialSpread.bind(spreadNS.Events.ButtonClicked, materialSpreadObj.buttonClicked);
     const sheet = materialSpread.getActiveSheet();
     sheet.suspendPaint();
     // const basic_range = sheet.getRange(-1, 8, -1, 1);
@@ -1152,6 +1154,7 @@ $(document).ready(() => {
 
     materialMonthSpread.bind(spreadNS.Events.ClipboardPasted, materialMonthSpreadObj.clipboardPasted);
     SpreadJsObj.addDeleteBind(materialMonthSpread, materialMonthSpreadObj.deletePress);
+    materialMonthSpread.bind(spreadNS.Events.EditEnded, materialMonthSpreadObj.editEnded);
 
     // 期切换
     $('#myTab a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
@@ -1171,112 +1174,7 @@ $(document).ready(() => {
         }, 1000);
     });
 
-    if (!readOnly) {
-        $('#add').click(materialSpreadObj.add);
-        $('#del').click(materialSpreadObj.del);
-        $('#up-move').click(materialSpreadObj.upMove);
-        $('#down-move').click(materialSpreadObj.downMove);
-        materialSpread.bind(spreadNS.Events.EditEnded, materialSpreadObj.editEnded);
-        materialSpread.bind(spreadNS.Events.ButtonClicked, materialSpreadObj.buttonClicked);
-        materialMonthSpread.bind(spreadNS.Events.EditEnded, materialMonthSpreadObj.editEnded);
-
-        // 右键菜单
-        $.contextMenu({
-            selector: '#material-spread',
-            build: function ($trigger, e) {
-                const target = SpreadJsObj.safeRightClickSelection($trigger, e, materialSpread);
-                return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
-            },
-            items: {
-                'create': {
-                    name: '新增材料',
-                    icon: 'fa-sign-in',
-                    callback: function (key, opt) {
-                        materialSpreadObj.add(materialSpread.getActiveSheet());
-                    },
-                },
-                'delete': {
-                    name: '删除材料',
-                    icon: 'fa-remove',
-                    callback: function (key, opt) {
-                        materialSpreadObj.del(materialSpread.getActiveSheet());
-                    },
-                    disabled: function (key, opt) {
-                        const sheet = materialSpread.getActiveSheet();
-                        const select = SpreadJsObj.getSelectObject(sheet);
-                        const sel = sheet.getSelections()[0];
-                        materialSpreadObj.refreshActn(sel.rowCount);
-                        if (!readOnly && select && materialBase.isUsed(select) && sel.rowCount === 1) {
-                            return false;
-                        } else {
-                            return true;
-                        }
-                    }
-                },
-            }
-        });
-        $('.changeRate').click(function () {
-            $('#rateInput').val(parseInt($(this).data('value')));
-            $('#rateInput').siblings('.dropdown-menu').hide();
-        });
-        $('#rateInput').click(function () {
-            $(this).siblings('.dropdown-menu').show();
-        })
-        // 回车提交
-        $('#rateInput').on('keypress', function () {
-            if(window.event.keyCode === 13) {
-                $(this).blur();
-            }
-        });
-        $('#rateInput').blur(function () {
-            const _self = $(this);
-            setTimeout(function () {
-                let rate = parseFloat(_self.val());
-                if (_.isNaN(rate)) {
-                    toastr.error('请输入0-100之前的整数值');
-                    $('#rateInput').val(materialRate);
-                    return;
-                }
-                rate = _.round(rate);
-                if(rate < 0 || rate > 100) {
-                    toastr.error('请输入0-100之前的整数值');
-                    $('#rateInput').val(materialRate);
-                    return;
-                }
-                $('#rateInput').siblings('.dropdown-menu').hide();
-                console.log(rate, materialRate);
-                if (rate !== materialRate) {
-                    postData(window.location.pathname + '/save', { type:'rate', rate: rate }, function (result) {
-                        const bqhs = ZhCalc.round(ZhCalc.mul(m_tp, 1+rate/100), materialDecimal.tp);
-                        // const exbqhs = ZhCalc.round(ZhCalc.mul(ex_tp, 1+rate/100), materialDecimal.tp);
-                        const jzbqhs = ZhCalc.round(ZhCalc.add(pre_tp_hs, bqhs), materialDecimal.tp);
-                        // const exjzbqhs = ZhCalc.round(ZhCalc.add(ex_pre_tp_hs, exbqhs), materialDecimal.tp);
-                        $('#rate_set').find('td').eq(1).text(bqhs !== 0 ? bqhs : '');
-                        $('#rate_set').find('td').eq(2).text(jzbqhs !== 0 ? jzbqhs : '');
-                        // $('#rate_set').find('td').eq(3).text(exbqhs !== 0 ? exbqhs : '');
-                        // $('#rate_set').find('td').eq(4).text(exjzbqhs !== 0 ? exjzbqhs : '');
-                        materialRate = rate;
-                        $('#rateInput').val(rate);
-                    });
-                } else {
-                    $('#rateInput').val(rate);
-                }
-            }, 500);
-        });
-        // $('#changeRate').change(function () {
-        //     const rate = parseInt($(this).val());
-        //     postData(window.location.pathname + '/save', { type:'rate', rate: rate }, function (result) {
-        //         const bqhs = ZhCalc.round(ZhCalc.mul(m_tp, 1+rate/100), materialDecimal.tp);
-        //         const exbqhs = ZhCalc.round(ZhCalc.mul(ex_tp, 1+rate/100), materialDecimal.tp);
-        //         const jzbqhs = ZhCalc.round(ZhCalc.add(pre_tp_hs, bqhs), materialDecimal.tp);
-        //         const exjzbqhs = ZhCalc.round(ZhCalc.add(ex_pre_tp_hs, exbqhs), materialDecimal.tp);
-        //         $('#rate_set').find('td').eq(1).text(bqhs !== 0 ? bqhs : '');
-        //         $('#rate_set').find('td').eq(2).text(jzbqhs !== 0 ? jzbqhs : '');
-        //         $('#rate_set').find('td').eq(3).text(exbqhs !== 0 ? exbqhs : '');
-        //         $('#rate_set').find('td').eq(4).text(exjzbqhs !== 0 ? exjzbqhs : '');
-        //     });
-        // });
-
+    if (!readOnly || editForAudit) {
         $('#expr_select button').on('click', function () {
             const code = $(this).text();
             // $('#expr').val($('#expr').val() + code);
@@ -1451,6 +1349,110 @@ $(document).ready(() => {
                 $('#bcyy').modal('hide');
             });
         });
+    }
+
+    if (!readOnly && !editForAudit) {
+        $('#add').click(materialSpreadObj.add);
+        $('#del').click(materialSpreadObj.del);
+        $('#up-move').click(materialSpreadObj.upMove);
+        $('#down-move').click(materialSpreadObj.downMove);
+
+        // 右键菜单
+        $.contextMenu({
+            selector: '#material-spread',
+            build: function ($trigger, e) {
+                const target = SpreadJsObj.safeRightClickSelection($trigger, e, materialSpread);
+                return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
+            },
+            items: {
+                'create': {
+                    name: '新增材料',
+                    icon: 'fa-sign-in',
+                    callback: function (key, opt) {
+                        materialSpreadObj.add(materialSpread.getActiveSheet());
+                    },
+                },
+                'delete': {
+                    name: '删除材料',
+                    icon: 'fa-remove',
+                    callback: function (key, opt) {
+                        materialSpreadObj.del(materialSpread.getActiveSheet());
+                    },
+                    disabled: function (key, opt) {
+                        const sheet = materialSpread.getActiveSheet();
+                        const select = SpreadJsObj.getSelectObject(sheet);
+                        const sel = sheet.getSelections()[0];
+                        materialSpreadObj.refreshActn(sel.rowCount);
+                        if (!readOnly && select && materialBase.isUsed(select) && sel.rowCount === 1) {
+                            return false;
+                        } else {
+                            return true;
+                        }
+                    }
+                },
+            }
+        });
+        $('.changeRate').click(function () {
+            $('#rateInput').val(parseInt($(this).data('value')));
+            $('#rateInput').siblings('.dropdown-menu').hide();
+        });
+        $('#rateInput').click(function () {
+            $(this).siblings('.dropdown-menu').show();
+        })
+        // 回车提交
+        $('#rateInput').on('keypress', function () {
+            if(window.event.keyCode === 13) {
+                $(this).blur();
+            }
+        });
+        $('#rateInput').blur(function () {
+            const _self = $(this);
+            setTimeout(function () {
+                let rate = parseFloat(_self.val());
+                if (_.isNaN(rate)) {
+                    toastr.error('请输入0-100之前的整数值');
+                    $('#rateInput').val(materialRate);
+                    return;
+                }
+                rate = _.round(rate);
+                if(rate < 0 || rate > 100) {
+                    toastr.error('请输入0-100之前的整数值');
+                    $('#rateInput').val(materialRate);
+                    return;
+                }
+                $('#rateInput').siblings('.dropdown-menu').hide();
+                console.log(rate, materialRate);
+                if (rate !== materialRate) {
+                    postData(window.location.pathname + '/save', { type:'rate', rate: rate }, function (result) {
+                        const bqhs = ZhCalc.round(ZhCalc.mul(m_tp, 1+rate/100), materialDecimal.tp);
+                        // const exbqhs = ZhCalc.round(ZhCalc.mul(ex_tp, 1+rate/100), materialDecimal.tp);
+                        const jzbqhs = ZhCalc.round(ZhCalc.add(pre_tp_hs, bqhs), materialDecimal.tp);
+                        // const exjzbqhs = ZhCalc.round(ZhCalc.add(ex_pre_tp_hs, exbqhs), materialDecimal.tp);
+                        $('#rate_set').find('td').eq(1).text(bqhs !== 0 ? bqhs : '');
+                        $('#rate_set').find('td').eq(2).text(jzbqhs !== 0 ? jzbqhs : '');
+                        // $('#rate_set').find('td').eq(3).text(exbqhs !== 0 ? exbqhs : '');
+                        // $('#rate_set').find('td').eq(4).text(exjzbqhs !== 0 ? exjzbqhs : '');
+                        materialRate = rate;
+                        $('#rateInput').val(rate);
+                    });
+                } else {
+                    $('#rateInput').val(rate);
+                }
+            }, 500);
+        });
+        // $('#changeRate').change(function () {
+        //     const rate = parseInt($(this).val());
+        //     postData(window.location.pathname + '/save', { type:'rate', rate: rate }, function (result) {
+        //         const bqhs = ZhCalc.round(ZhCalc.mul(m_tp, 1+rate/100), materialDecimal.tp);
+        //         const exbqhs = ZhCalc.round(ZhCalc.mul(ex_tp, 1+rate/100), materialDecimal.tp);
+        //         const jzbqhs = ZhCalc.round(ZhCalc.add(pre_tp_hs, bqhs), materialDecimal.tp);
+        //         const exjzbqhs = ZhCalc.round(ZhCalc.add(ex_pre_tp_hs, exbqhs), materialDecimal.tp);
+        //         $('#rate_set').find('td').eq(1).text(bqhs !== 0 ? bqhs : '');
+        //         $('#rate_set').find('td').eq(2).text(jzbqhs !== 0 ? jzbqhs : '');
+        //         $('#rate_set').find('td').eq(3).text(exbqhs !== 0 ? exbqhs : '');
+        //         $('#rate_set').find('td').eq(4).text(exjzbqhs !== 0 ? exjzbqhs : '');
+        //     });
+        // });
 
         // 创建月信息价
         $('#make-month').click(function() {
@@ -1538,7 +1540,7 @@ $(document).ready(() => {
 
     let gljLib;
     const gljLibCellDoubleClick = function (e, info) {
-        if (readOnly) return;
+        if (readOnly || editForAudit) return;
         const gljSheet = info.sheet;
         if (!gljSheet.zh_setting || !gljSheet.zh_tree) { return; }
 

+ 39 - 38
app/public/js/material_exponent.js

@@ -431,52 +431,53 @@ $(document).ready(() => {
         }
     };
     materialExponentSpreadObj.refreshActn();
-    materialExponentSpread.bind(spreadNS.Events.SelectionChanged, materialExponentSpreadObj.selectionChanged);
-
 
 
     if (!readOnly) {
         $('#add').click(materialExponentSpreadObj.add);
         $('#del').click(materialExponentSpreadObj.del);
-        materialExponentSpread.bind(spreadNS.Events.EditEnded, materialExponentSpreadObj.editEnded);
-        materialExponentSpread.bind(spreadNS.Events.ButtonClicked, materialExponentSpreadObj.buttonClicked);
-        materialExponentSpread.bind(spreadNS.Events.ClipboardPasted, materialExponentSpreadObj.clipboardPasted);
-        SpreadJsObj.addDeleteBind(materialExponentSpread, materialExponentSpreadObj.deletePress);
-        // 右键菜单
-        $.contextMenu({
-            selector: '#material-exponent-spread',
-            build: function ($trigger, e) {
-                const target = SpreadJsObj.safeRightClickSelection($trigger, e, materialExponentSpread);
-                return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
-            },
-            items: {
-                'create': {
-                    name: '新增',
-                    icon: 'fa-sign-in',
-                    callback: function (key, opt) {
-                        materialExponentSpreadObj.add(materialExponentSpread.getActiveSheet());
-                    },
+        if (!editForAudit) {
+            materialExponentSpread.bind(spreadNS.Events.SelectionChanged, materialExponentSpreadObj.selectionChanged);
+            materialExponentSpread.bind(spreadNS.Events.EditEnded, materialExponentSpreadObj.editEnded);
+            materialExponentSpread.bind(spreadNS.Events.ButtonClicked, materialExponentSpreadObj.buttonClicked);
+            materialExponentSpread.bind(spreadNS.Events.ClipboardPasted, materialExponentSpreadObj.clipboardPasted);
+            SpreadJsObj.addDeleteBind(materialExponentSpread, materialExponentSpreadObj.deletePress);
+            // 右键菜单
+            $.contextMenu({
+                selector: '#material-exponent-spread',
+                build: function ($trigger, e) {
+                    const target = SpreadJsObj.safeRightClickSelection($trigger, e, materialExponentSpread);
+                    return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
                 },
-                'delete': {
-                    name: '删除',
-                    icon: 'fa-remove',
-                    callback: function (key, opt) {
-                        materialExponentSpreadObj.del(materialExponentSpread.getActiveSheet());
+                items: {
+                    'create': {
+                        name: '新增',
+                        icon: 'fa-sign-in',
+                        callback: function (key, opt) {
+                            materialExponentSpreadObj.add(materialExponentSpread.getActiveSheet());
+                        },
                     },
-                    disabled: function (key, opt) {
-                        const sheet = materialExponentSpread.getActiveSheet();
-                        const select = SpreadJsObj.getSelectObject(sheet);
-                        const sel = sheet.getSelections()[0];
-                        materialExponentSpreadObj.refreshActn(sel.rowCount);
-                        if (!readOnly && select && materialExponentBase.isUsed(select) && sel.rowCount === 1) {
-                            return false;
-                        } else {
-                            return true;
+                    'delete': {
+                        name: '删除',
+                        icon: 'fa-remove',
+                        callback: function (key, opt) {
+                            materialExponentSpreadObj.del(materialExponentSpread.getActiveSheet());
+                        },
+                        disabled: function (key, opt) {
+                            const sheet = materialExponentSpread.getActiveSheet();
+                            const select = SpreadJsObj.getSelectObject(sheet);
+                            const sel = sheet.getSelections()[0];
+                            materialExponentSpreadObj.refreshActn(sel.rowCount);
+                            if (!readOnly && select && materialExponentBase.isUsed(select) && sel.rowCount === 1) {
+                                return false;
+                            } else {
+                                return true;
+                            }
                         }
-                    }
-                },
-            }
-        });
+                    },
+                }
+            });
+        }
 
         // 调差基数选中
         $('.calc_select').on('click', function () {

+ 166 - 164
app/public/js/material_list.js

@@ -804,177 +804,179 @@ $(document).ready(() => {
         }
         $('#materialBills').find('input:disabled').prop('checked', true);
     });
+    const leafXmjSpreadObj = {
+        getSelect : function () {
+            const sheet = ledgerSpread.getActiveSheet();
+            const select = SpreadJsObj.getSelectObject(sheet);
+            const index = gclGatherData.indexOf(select);
+            const leafXmjSheet = leafXmjSpread.getActiveSheet();
+            const leafXmjSelect = SpreadJsObj.getSelectObject(leafXmjSheet);
+            const iRow = gclGatherData[index].leafXmjs.indexOf(leafXmjSelect);
+            const leafXmjs = gclGatherData[index].leafXmjs.filter(item => {
+                return item.qc_qty || item.contract_qty
+            });
+            const nRow = leafXmjs.indexOf(leafXmjSelect);
+            const leafXmjColor = findNotJoinLeafXmj(leafXmjSelect) ? '#d6d8db' : '';
+            return [index, iRow, nRow, leafXmjSheet, leafXmjSelect, leafXmjColor];
+        },
+        checkJoinMaterial: function (type) {
+            const [iGclRow, iRow, nRow, sheet, select] = leafXmjSpreadObj.getSelect();
+            const color = type === 'join' ? '' : '#d6d8db';
+            const data = {
+                type: type,
+                select: type === 'join' ? findNotJoinLeafXmj(select) : select,
+                ms_id: $('#myTab').find('.active').data('msid') || null,
+            };
+            // 添加到
+            postData(window.location.pathname + '/save', data, function (result) {
+                if (type === 'join') {
+                    const index = findNotJoinLeafXmj(select, 'index');
+                    notJoinList.splice(index, 1);
+                } else {
+                    notJoinList.push(result);
+                }
+                gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(select);
+                calculateJiaCha(gclGatherData, iGclRow);
+                SpreadJsObj.reLoadRowData(sheet, nRow);
+                sheet.getRange(nRow, -1, 1, -1).backColor(color);
+                loadMaterialData(iGclRow);
+                SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
+            });
+        },
+        checkSelfMaterial: function (type) {
+            const [iGclRow, iRow, nRow, sheet, select, color] = leafXmjSpreadObj.getSelect();
+            // const color = type === 'self' ? '' : '#d6d8db';
+            const data = {
+                type: type,
+                select: type === 'noself' ? findSelfLeafXmj(select) : select,
+                ms_id: $('#myTab').find('.active').data('msid') || null,
+            };
+            // 添加到
+            postData(window.location.pathname + '/save', data, function (result) {
+                if (type === 'noself') {
+                    const index = findSelfLeafXmj(select, 'index');
+                    selfList.splice(index, 1);
+                    materialListData = result;
+                    $('#cancel-self').modal('hide');
+                } else {
+                    selfList.push(result);
+                }
+                gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(select);
+                calculateJiaCha(gclGatherData, iGclRow);
+                SpreadJsObj.reLoadRowData(sheet, nRow);
+                sheet.getRange(nRow, -1, 1, -1).backColor(color);
+                loadXmjMaterialData(iGclRow, nRow);
+                SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
+            });
+        },
+    }
     if (!readOnly) {
-        const leafXmjSpreadObj = {
-            getSelect : function () {
-                const sheet = ledgerSpread.getActiveSheet();
-                const select = SpreadJsObj.getSelectObject(sheet);
-                const index = gclGatherData.indexOf(select);
-                const leafXmjSheet = leafXmjSpread.getActiveSheet();
-                const leafXmjSelect = SpreadJsObj.getSelectObject(leafXmjSheet);
-                const iRow = gclGatherData[index].leafXmjs.indexOf(leafXmjSelect);
-                const leafXmjs = gclGatherData[index].leafXmjs.filter(item => {
-                    return item.qc_qty || item.contract_qty
-                });
-                const nRow = leafXmjs.indexOf(leafXmjSelect);
-                const leafXmjColor = findNotJoinLeafXmj(leafXmjSelect) ? '#d6d8db' : '';
-                return [index, iRow, nRow, leafXmjSheet, leafXmjSelect, leafXmjColor];
-            },
-            checkJoinMaterial: function (type) {
-                const [iGclRow, iRow, nRow, sheet, select] = leafXmjSpreadObj.getSelect();
-                const color = type === 'join' ? '' : '#d6d8db';
-                const data = {
-                    type: type,
-                    select: type === 'join' ? findNotJoinLeafXmj(select) : select,
-                    ms_id: $('#myTab').find('.active').data('msid') || null,
-                };
-                // 添加到
-                postData(window.location.pathname + '/save', data, function (result) {
-                    if (type === 'join') {
-                        const index = findNotJoinLeafXmj(select, 'index');
-                        notJoinList.splice(index, 1);
-                    } else {
-                        notJoinList.push(result);
-                    }
-                    gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(select);
-                    calculateJiaCha(gclGatherData, iGclRow);
-                    SpreadJsObj.reLoadRowData(sheet, nRow);
-                    sheet.getRange(nRow, -1, 1, -1).backColor(color);
-                    loadMaterialData(iGclRow);
-                    SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
-                });
-            },
-            checkSelfMaterial: function (type) {
-                const [iGclRow, iRow, nRow, sheet, select, color] = leafXmjSpreadObj.getSelect();
-                // const color = type === 'self' ? '' : '#d6d8db';
-                const data = {
-                    type: type,
-                    select: type === 'noself' ? findSelfLeafXmj(select) : select,
-                    ms_id: $('#myTab').find('.active').data('msid') || null,
-                };
-                // 添加到
-                postData(window.location.pathname + '/save', data, function (result) {
-                    if (type === 'noself') {
-                        const index = findSelfLeafXmj(select, 'index');
-                        selfList.splice(index, 1);
-                        materialListData = result;
-                        $('#cancel-self').modal('hide');
-                    } else {
-                        selfList.push(result);
-                    }
-                    gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(select);
-                    calculateJiaCha(gclGatherData, iGclRow);
-                    SpreadJsObj.reLoadRowData(sheet, nRow);
-                    sheet.getRange(nRow, -1, 1, -1).backColor(color);
-                    loadXmjMaterialData(iGclRow, nRow);
-                    SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
-                });
-            },
-        }
         // leafXmj右键功能
-        $.contextMenu({
-            selector: '#leaf-xmj-spread',
-            build: function ($trigger, e) {
-                const target = SpreadJsObj.safeRightClickSelection($trigger, e, leafXmjSpread);
-                return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
-            },
-            items: {
-                'stop': {
-                    name: '不参与调差',
-                    icon: 'fa-remove',
-                    callback: function (key, opt) {
-                        leafXmjSpreadObj.checkJoinMaterial('notjoin');
-                    },
-                    visible: function (key, opt) {
-                        const sheet = leafXmjSpread.getActiveSheet();
-                        const select = SpreadJsObj.getSelectObject(sheet);
-                        const sel = sheet.getSelections()[0];
-                        if (!select || sel.rowCount !== 1) {
-                            return false;
-                        }
-                        const notx = findNotJoinLeafXmj(select);
-                        if (!readOnly && select && notx === undefined) {
-                            return true;
-                        } else {
-                            return false;
-                        }
-                    }
+        if (!editForAudit) {
+            $.contextMenu({
+                selector: '#leaf-xmj-spread',
+                build: function ($trigger, e) {
+                    const target = SpreadJsObj.safeRightClickSelection($trigger, e, leafXmjSpread);
+                    return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
                 },
-                'start': {
-                    name: '参与调差',
-                    icon: 'fa-sign-in',
-                    callback: function (key, opt) {
-                        leafXmjSpreadObj.checkJoinMaterial('join');
-                    },
-                    visible: function (key, opt) {
-                        const sheet = leafXmjSpread.getActiveSheet();
-                        const select = SpreadJsObj.getSelectObject(sheet);
-                        const sel = sheet.getSelections()[0];
-                        if (!select || sel.rowCount !== 1) {
-                            return false;
-                        }
-                        const notx = findNotJoinLeafXmj(select);
-                        if (!readOnly && select && notx === undefined) {
-                            return false;
-                        } else {
-                            return true;
+                items: {
+                    'stop': {
+                        name: '不参与调差',
+                        icon: 'fa-remove',
+                        callback: function (key, opt) {
+                            leafXmjSpreadObj.checkJoinMaterial('notjoin');
+                        },
+                        visible: function (key, opt) {
+                            const sheet = leafXmjSpread.getActiveSheet();
+                            const select = SpreadJsObj.getSelectObject(sheet);
+                            const sel = sheet.getSelections()[0];
+                            if (!select || sel.rowCount !== 1) {
+                                return false;
+                            }
+                            const notx = findNotJoinLeafXmj(select);
+                            if (!readOnly && select && notx === undefined) {
+                                return true;
+                            } else {
+                                return false;
+                            }
                         }
                     },
-                },
-                'self': {
-                    name: '单独添加工料',
-                    icon: 'fa-sign-in',
-                    callback: function (key, opt) {
-                        leafXmjSpreadObj.checkSelfMaterial('self');
+                    'start': {
+                        name: '参与调差',
+                        icon: 'fa-sign-in',
+                        callback: function (key, opt) {
+                            leafXmjSpreadObj.checkJoinMaterial('join');
+                        },
+                        visible: function (key, opt) {
+                            const sheet = leafXmjSpread.getActiveSheet();
+                            const select = SpreadJsObj.getSelectObject(sheet);
+                            const sel = sheet.getSelections()[0];
+                            if (!select || sel.rowCount !== 1) {
+                                return false;
+                            }
+                            const notx = findNotJoinLeafXmj(select);
+                            if (!readOnly && select && notx === undefined) {
+                                return false;
+                            } else {
+                                return true;
+                            }
+                        },
                     },
-                    visible: function (key, opt) {
-                        if (!openMaterialSelf) {
-                            return false;
-                        }
-                        const sheet = leafXmjSpread.getActiveSheet();
-                        const select = SpreadJsObj.getSelectObject(sheet);
-                        const sel = sheet.getSelections()[0];
-                        if (!select || sel.rowCount !== 1) {
-                            return false;
-                        }
-                        const notx = findSelfLeafXmj(select);
-                        if (!readOnly && select && notx === undefined) {
-                            return true;
-                        } else {
-                            return false;
+                    'self': {
+                        name: '单独添加工料',
+                        icon: 'fa-sign-in',
+                        callback: function (key, opt) {
+                            leafXmjSpreadObj.checkSelfMaterial('self');
+                        },
+                        visible: function (key, opt) {
+                            if (!openMaterialSelf) {
+                                return false;
+                            }
+                            const sheet = leafXmjSpread.getActiveSheet();
+                            const select = SpreadJsObj.getSelectObject(sheet);
+                            const sel = sheet.getSelections()[0];
+                            if (!select || sel.rowCount !== 1) {
+                                return false;
+                            }
+                            const notx = findSelfLeafXmj(select);
+                            if (!readOnly && select && notx === undefined) {
+                                return true;
+                            } else {
+                                return false;
+                            }
                         }
-                    }
-                },
-                'noself': {
-                    name: '取消单独添加工料',
-                    icon: 'fa-remove',
-                    callback: function (key, opt) {
-                        $('#cancel-self').modal('show');
-                        // leafXmjSpreadObj.checkSelfMaterial('noself');
                     },
-                    visible: function (key, opt) {
-                        if (!openMaterialSelf) {
-                            return false;
-                        }
-                        const sheet = leafXmjSpread.getActiveSheet();
-                        const select = SpreadJsObj.getSelectObject(sheet);
-                        const sel = sheet.getSelections()[0];
-                        if (!select || sel.rowCount !== 1) {
-                            return false;
-                        }
-                        const notx = findSelfLeafXmj(select);
-                        if (!readOnly && select && notx === undefined) {
-                            return false;
-                        } else {
-                            return true;
-                        }
+                    'noself': {
+                        name: '取消单独添加工料',
+                        icon: 'fa-remove',
+                        callback: function (key, opt) {
+                            $('#cancel-self').modal('show');
+                            // leafXmjSpreadObj.checkSelfMaterial('noself');
+                        },
+                        visible: function (key, opt) {
+                            if (!openMaterialSelf) {
+                                return false;
+                            }
+                            const sheet = leafXmjSpread.getActiveSheet();
+                            const select = SpreadJsObj.getSelectObject(sheet);
+                            const sel = sheet.getSelections()[0];
+                            if (!select || sel.rowCount !== 1) {
+                                return false;
+                            }
+                            const notx = findSelfLeafXmj(select);
+                            if (!readOnly && select && notx === undefined) {
+                                return false;
+                            } else {
+                                return true;
+                            }
+                        },
                     },
-                },
-            }
-        });
-        $('#cancelSelfBtn').click(function () {
-            leafXmjSpreadObj.checkSelfMaterial('noself');
-        });
+                }
+            });
+            $('#cancelSelfBtn').click(function () {
+                leafXmjSpreadObj.checkSelfMaterial('noself');
+            });
+        }
         // material-spread右键功能
         const materialSpreadObj = {
             del: function () {
@@ -1674,7 +1676,7 @@ $(document).ready(() => {
             materialSelfSpread.bind(spreadNS.Events.ClipboardPasted, materialSelfSpreadObj.clipboardPasted);
             SpreadJsObj.addDeleteBind(materialSelfSpread, materialSelfSpreadObj.deletePress);
         }
-        if (!openMaterialChecklist) {
+        if (!openMaterialChecklist && !editForAudit) {
             $.contextMenu({
                 selector: '#material-spread',
                 build: function ($trigger, e) {
@@ -1728,7 +1730,7 @@ $(document).ready(() => {
                 }
             });
         }
-        if (openMaterialSelf) {
+        if (openMaterialSelf && !editForAudit) {
             $.contextMenu({
                 selector: '#material-self-spread',
                 build: function ($trigger, e) {

+ 4 - 3
app/view/material/exponent.ejs

@@ -43,8 +43,8 @@
                             <div class="input-group-prepend">
                                 <span class="input-group-text" id="basic-addon1">增值税税率</span>
                             </div>
-                            <input id="rateInput" class="form-control form-control-sm col-1" <% if (material.readOnly) { %>disabled<% } %> type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="100" value="<%- material.exponent_rate %>">
-                            <% if (!material.readOnly) { %>
+                            <input id="rateInput" class="form-control form-control-sm col-1" <% if (material.readOnly || material.editForAudit) { %>disabled<% } %> type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="100" value="<%- material.exponent_rate %>">
+                            <% if (!material.readOnly || !material.editForAudit) { %>
                                 <div class="dropdown-menu">
                                     <a class="dropdown-item changeRate" href="javascript:void(0);" data-value="9">9%</a>
                                     <a class="dropdown-item changeRate" href="javascript:void(0);" data-value="10">10%</a>
@@ -52,7 +52,7 @@
                                 </div>
                             <% } %>
                             <!--<select class="form-control form-control-sm col-1" id="changeRate">-->
-                                <!--<% if (!material.readOnly) { %>-->
+                                <!--<% if (!material.readOnly && !material.editForAudit) { %>-->
                                     <!--<option value="9" <% if(material.exponent_rate === 9) { %>selected<% } %>>9%</option>-->
                                     <!--<option value="10" <% if(material.exponent_rate === 10) { %>selected<% } %>>10%</option>-->
                                     <!--<option value="11" <% if(material.exponent_rate === 11) { %>selected<% } %>>11%</option>-->
@@ -161,6 +161,7 @@
     const materialID = <%- material.id %>;
     const materialTax = <%- material.material_tax %>;
     const materialOrder = <%- material.order %>;
+    const editForAudit = <%- material.editForAudit %>;
     const materialDecimal = JSON.parse(unescape('<%- escape(JSON.stringify(material.decimal)) %>'));
     const decimal = JSON.parse('<%- JSON.stringify(ctx.tender.info.decimal) %>');
     let m_tp = <%= material.m_tp !== null ? material.m_tp : 0 %>;

+ 3 - 2
app/view/material/info.ejs

@@ -93,8 +93,8 @@
                             <div class="input-group-prepend">
                                 <span class="input-group-text" id="basic-addon1">建筑增值税</span>
                             </div>
-                            <input id="rateInput" class="form-control form-control-sm col-1" <% if (material.material_tax || material.readOnly) { %>disabled<% } %> type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="100" value="<%- material.rate %>">
-                            <% if (!material.readOnly || !material.material_tax) { %>
+                            <input id="rateInput" class="form-control form-control-sm col-1" <% if (material.material_tax || material.readOnly || material.editForAudit) { %>disabled<% } %> type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="100" value="<%- material.rate %>">
+                            <% if (!material.readOnly || !material.editForAudit || !material.material_tax) { %>
                             <div class="dropdown-menu">
                                 <a class="dropdown-item changeRate" href="javascript:void(0);" data-value="9">9%</a>
                                 <a class="dropdown-item changeRate" href="javascript:void(0);" data-value="10">10%</a>
@@ -229,6 +229,7 @@
     const materialType = JSON.parse('<%- materialType %>');
     const isStageSelf = parseInt('<%- material.is_stage_self %>');
     const editTaxPermission = <%- material.editTaxPermission %>;
+    const editForAudit = <%- material.editForAudit %>;
     let materialBillsData = JSON.parse(unescape('<%- escape(JSON.stringify(materialBillsData)) %>'));
     let materialStageData = isStageSelf ? JSON.parse(unescape('<%- escape(JSON.stringify(materialStageData)) %>')) : [];
     let materialStageBillsData = isStageSelf ? JSON.parse(unescape('<%- escape(JSON.stringify(materialStageBillsData)) %>')) : [];

+ 1 - 0
app/view/material/list.ejs

@@ -99,6 +99,7 @@
 <script>
     const materialType = JSON.parse('<%- materialType %>');
     const isStageSelf = parseInt('<%- material.is_stage_self %>');
+    const editForAudit = <%- material.editForAudit %>;
     const materialBillsData = JSON.parse(unescape('<%- escape(JSON.stringify(materialBillsData)) %>'));
     const materialStageData = isStageSelf ? JSON.parse(unescape('<%- escape(JSON.stringify(materialStageData)) %>')) : [];
     const materialStageBillsData = isStageSelf ? JSON.parse(unescape('<%- escape(JSON.stringify(materialStageBillsData)) %>')) : [];