Browse Source

费用管理修改金额统计

caojunjie 2 years ago
parent
commit
92040d4378
2 changed files with 22 additions and 26 deletions
  1. 1 1
      src/combination/listComponent.vue
  2. 21 25
      src/views/costManagement/index.vue

+ 1 - 1
src/combination/listComponent.vue

@@ -143,7 +143,7 @@ export default {
     },
     //输入框数据变动时触发
     totalAmount(scope, item) {
-      this.$emit('totalAmount', scope, item)
+      this.$emit('totalAmount', scope, item,this.tableData)
     },
     //合计
     listTotal(param) {

+ 21 - 25
src/views/costManagement/index.vue

@@ -106,10 +106,13 @@
         :setRowList="setRowList"
         :listData="listData"
       />
-      <h4 style="text-align: left;margin: 8px 0 -8px 0;padding: 5px 0;border-top: 1px solid #ccc;border-bottom: 1px solid #ccc;">
-        附件管理
-      </h4>
-      <c-upload :list="tEnclosure" ref="cUpload" :disabled="disabled"></c-upload>
+      <el-collapse>
+        <el-collapse-item title="附件管理" name="1">
+          <div style="padding-right: 10px">
+            <c-upload :list="tEnclosure" ref="cUpload" :disabled="disabled"></c-upload>
+          </div>
+        </el-collapse-item>
+      </el-collapse>
     </div>
     <add-or-update
       v-if="addOrUpdateVisible"
@@ -695,7 +698,6 @@ export default {
           label: 'remark',
           name: '备注',
           inputType: 4,
-          onabort: 'this.value=this.value.replace(/[^0-9]/g,\'\')',
           width: 200,
           disabled: true,
           labelSize: '80'
@@ -895,19 +897,13 @@ export default {
       this.query(this.formDataList)
     },
     //计算金额
-    totalAmount(scope, item) {
-      if (item.label === 'fPurchase') {
-        this.$set(scope.row, 'fQty', scope.row.fPurchase)
-      }
-      if (item.label === 'fAmount') {
-        if (scope.row.fAmount && scope.row.fQty) {
-          this.$set(scope.row, 'fUnitprice', (scope.row.fAmount / scope.row.fQty).toFixed(2))
-        }
-      }
-      if (item.label === 'fUnitprice' || item.label === 'fQty') {
-        if (scope.row.fUnitprice && scope.row.fQty) {
-          this.$set(scope.row, 'fAmount', (scope.row.fUnitprice * scope.row.fQty).toFixed(2))
+    totalAmount(scope, item,data) {
+      if (item.label === 'amount') {
+        let amount = 0
+        for (let item of data){
+          amount += item.amount?Number(item.amount):0
         }
+        this.$set(this.$refs.avatar.form, 'totalAmount', amount.toFixed(2))
       }
     },
     //查询主页列数据
@@ -1038,7 +1034,7 @@ export default {
           this.purchaseList.columnList.forEach(item => item.disabled = false)
           this.contentStyle.forEach(item => item.disabled = false)
           this.contentOption.forEach(item => {
-            if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime') {
+            if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
               item.disabled = true
             } else {
               item.disabled = false
@@ -1076,7 +1072,7 @@ export default {
       this.$refs.avatar.form.fPrint = 0
       this.contentList.forEach(item => item.fId = '')
       this.contentOption.forEach(item => {
-        if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime') {
+        if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
           item.disabled = true
         } else {
           item.disabled = false
@@ -1150,7 +1146,7 @@ export default {
           this.$refs.avatar.form.fPrint = 0
           this.contentList.forEach(item => item.fId = '')
           this.contentOption.forEach(item => {
-            if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime') {
+            if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
               item.disabled = true
             } else {
               item.disabled = false
@@ -1205,7 +1201,7 @@ export default {
         this.$refs.avatar.form.fPrint = 0
         this.contentList.forEach(item => item.fId = '')
         this.contentOption.forEach(item => {
-          if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime') {
+          if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
             item.disabled = true
           } else {
             item.disabled = false
@@ -1296,7 +1292,7 @@ export default {
               this.$refs.avatar.form = {}
               this.getRow(data, '', 1)
               this.contentOption.forEach(item => {
-                if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime') {
+                if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
                   item.disabled = true
                 } else {
                   item.disabled = false
@@ -1319,7 +1315,7 @@ export default {
             this.getRow(data, '', 1)
             //点击列表新单控制主表是否需要禁用项
             this.contentOption.forEach(item => {
-              if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime') {
+              if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
                 item.disabled = true
               } else {
                 item.disabled = false
@@ -1393,7 +1389,7 @@ export default {
               this.purchaseList.columnList.forEach(item => item.disabled = false)
               this.contentStyle.forEach(item => item.disabled = false)
               this.contentOption.forEach(item => {
-                if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime') {
+                if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
                   item.disabled = true
                 } else {
                   item.disabled = false
@@ -1410,7 +1406,7 @@ export default {
             fFeeunitid: '',
             fStltypeid: '',
             remark: '',
-            createTime: '',
+            createTime: 0,
             fAmount: 0,
             fQty: 0,
             fUnitprice: 0,