Browse Source

控制价相关

MaiXinRong 1 năm trước cách đây
mục cha
commit
385acd539b

+ 6 - 0
app/controller/ctrl_price_controller.js

@@ -73,6 +73,10 @@ module.exports = app => {
             }
         }
 
+        _checkCanUpdate(ctx) {
+            if (ctx.tender.isTourist) throw '您无权修改数据';
+        }
+
         async _billsBase(relaService, type, data) {
             if (isNaN(data.id) || data.id <= 0) throw '数据错误';
             if (type !== 'add') {
@@ -131,6 +135,7 @@ module.exports = app => {
         async update(ctx) {
             try {
                 if (!ctx.tender) throw '项目数据错误';
+                this._checkCanUpdate(ctx);
 
                 const relaService = this.ctx.service.controlPrice;
                 const data = JSON.parse(ctx.request.body.data);
@@ -169,6 +174,7 @@ module.exports = app => {
         async uploadExcel(ctx) {
             try {
                 if (!ctx.tender) throw '项目数据错误';
+                this._checkCanUpdate(ctx);
 
                 const ueType = ctx.params.ueType;
                 const compressData = ctx.request.body.data;

+ 1 - 1
app/public/js/ctrl_price.js

@@ -192,7 +192,7 @@ $(document).ready(() => {
             setObjEnable($('a[name=base-opr][type=delete]'), valid && first && sameParent && first.level > 1);
             setObjEnable($('a[name=base-opr][type=up-move]'), valid && first && sameParent && first.level > 1 && preNode);
             setObjEnable($('a[name=base-opr][type=down-move]'), valid && first && sameParent && first.level > 1 && !tree.isLastSibling(last));
-            setObjEnable($('a[name=base-opr][type=up-level]'), valid && first && sameParent && tree.getParent(first) && first.level > 2 && tree.isLastSibling(last));
+            setObjEnable($('a[name=base-opr][type=up-level]'), valid && first && sameParent && tree.getParent(first) && first.level > 2);
             setObjEnable($('a[name=base-opr][type=down-level]'), valid && first && sameParent && first.level > 1 && preNode);
         },
         selectionChanged: function (e, info) {

+ 1 - 1
app/view/tender/ctrl_price.ejs

@@ -90,7 +90,7 @@
 <script>
     const stdChapters = JSON.parse(unescape('<%- escape(JSON.stringify(stdChapters)) %>'));
     const stdBills = JSON.parse(unescape('<%- escape(JSON.stringify(stdBills)) %>'));
-    const readOnly = false;
+    const readOnly = <%- !!ctx.tender.isTourist %>;
     const spreadSetting = JSON.parse('<%- JSON.stringify(spreadSetting) %>');
     let decimal = JSON.parse('<%- JSON.stringify(ctx.tender.info.decimal) %>');
 </script>