aXin-0810 10 bulan lalu
induk
melakukan
5cc51b63dc

+ 61 - 0
src/api/increaseAndDecreaseExpense.js

@@ -0,0 +1,61 @@
+import request, { postBlob, getBlob, handleImport } from '@/utils/request'
+
+export function dailySummaryReduceCountList(data) {
+  return request({
+    url: `/daily/summary/reduceCount/list?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+export function dailySummaryIncrDecrCostImport(data) {
+  return handleImport('/daily/summary/incrDecrCost/import', data.formdata, data.id || '')
+}
+
+export function dailySummaryIncrDecrCostList(data) {
+  return request({
+    url: `/daily/summary/incrDecrCost/list?moduleId=${data.moduleId}22`,
+    method: 'post',
+    data
+  })
+}
+
+export function dailySummaryIncrDecrCostListExport(data, name) {
+  return postBlob({
+    url: '/daily/summary/incrDecrCost/list/export',
+    data,
+    name
+  })
+}
+
+export function dailySummaryReduceBatchDo(params) {
+  return request({
+    url: `/daily/summary/reduce/batchDo`,
+    method: 'post',
+    params
+  })
+}
+
+export function dailySummaryReduceBatchDel(params) {
+  return request({
+    url: `/daily/summary/reduce/batchDel`,
+    method: 'post',
+    params
+  })
+}
+
+export function dailySummaryReduceCountDelete(params) {
+  return request({
+    url: `/daily/summary/reduceCount/delete`,
+    method: 'post',
+    params
+  })
+}
+
+export function dailySummaryReduceCountDo(params) {
+  return request({
+    url: `/daily/summary/reduceCount/do`,
+    method: 'post',
+    params
+  })
+}

+ 27 - 8
src/components/template/operation_mixin.js

@@ -12,18 +12,18 @@ function setBtnName(name, row) {
 function hasCommonElements(arr1, arr2) {
   for (let i = 0; i < arr1.length; i++) {
     if (arr2.includes(arr1[i])) {
-      return true;
+      return true
     }
   }
-  return false;
+  return false
 }
 
 export default {
-  data(){
+  data() {
     return {
-      pageType:this?.$route?.params?.pageType,
-      pageCode:this?.$route?.params?.pageCode,
-      pagePam:this?.$route?.params?.pagePam
+      pageType: this?.$route?.params?.pageType,
+      pageCode: this?.$route?.params?.pageCode,
+      pagePam: this?.$route?.params?.pagePam
     }
   },
   methods: {
@@ -33,7 +33,12 @@ export default {
         return { isRole: false }
       }
       if (key instanceof Array) {
-        if (!hasCommonElements(roleItems.map(item => item.code), key)) {
+        if (
+          !hasCommonElements(
+            roleItems.map(item => item.code),
+            key
+          )
+        ) {
           return { isRole: false }
         } else {
           return typeof obj == 'function' ? obj(roleItems) : obj
@@ -60,7 +65,21 @@ export default {
               .map(key => {
                 return (h, { row, index, column }) => {
                   var role = roleItems?.find(item => item.code === key)
-                  if (opt[key]?.prompt) {
+                  if (opt[key]?.import) {
+                    return role && (opt[key]?.conditions ? opt[key]?.conditions({ row, index, column }) : true) ? (
+                      <el-upload
+                        action={'_'}
+                        show-file-list={false}
+                        http-request={async data => {
+                          opt[key]?.click({ row, index, column, file: data.file })
+                        }}
+                      >
+                        <el-button size="mini" type={opt[key]?.btnType || 'text'}>
+                          {setBtnName(opt[key]?.name, { row, index, column }) || role.moduleName}
+                        </el-button>
+                      </el-upload>
+                    ) : null
+                  } else if (opt[key]?.prompt) {
                     return role && (opt[key]?.conditions ? opt[key]?.conditions({ row, index, column }) : true) ? (
                       <el-popconfirm
                         title={setBtnName(opt[key]?.prompt, { row, index, column })}

+ 287 - 0
src/views/engineerFeeSettlement/dailyMaintenanceBalance/increaseAndDecreaseExpense/index.vue

@@ -0,0 +1,287 @@
+<template>
+  <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
+    <template slot-scope="{ activeKey, data }">
+      <div
+        :style="{
+          width: '100%',
+          height: activeKey == 'list' ? '100%' : '0px',
+          overflow: 'hidden'
+        }"
+      >
+        <template-page
+          ref="pageRef"
+          :get-list="getList"
+          :table-attributes="tableAttributes"
+          :table-events="tableEvents"
+          :options-evens-group="optionsEvensGroup"
+          :moreParameters="moreParameters"
+          :column-parsing="columnParsing"
+          :operationColumnWidth="180"
+          :operation="operation()"
+        >
+        </template-page>
+      </div>
+      <div
+        v-if="activeKey == 'view'"
+        :style="{
+          width: '100%',
+          height: '100%',
+          overflow: 'hidden'
+        }"
+      >
+        <template-page
+          ref="pageRef2"
+          :operationColumnWidth="180"
+          :table-attributes="tableAttributes2"
+          :table-events="tableEvents2"
+          :get-list="getList2"
+          :exportList="exportList2"
+          :options-evens-group="optionsEvensGroup2"
+          :operation="operation2()"
+          expCode="exp2"
+        >
+        </template-page>
+      </div>
+    </template>
+  </zj-tab-page>
+</template>
+
+<script>
+import TemplatePage from '@/components/template/template-page-1.vue'
+import import_mixin from '@/components/template/import_mixin.js'
+import ImageUpload from '@/components/file-upload'
+import operation_mixin from '@/components/template/operation_mixin.js'
+import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
+import {
+  dailySummaryList,
+  dailySummaryOrderImport,
+  dailySummaryRepairDelete,
+  dailySummaryRepairSummary,
+  dailySummaryRepairDetailList,
+  dailySummaryRepairDetailListExport,
+  dailySummaryRepairItemDelete,
+  dailySummaryRepairItemWait,
+  dailySummaryRepairItemResummary
+} from '@/api/settlementDataImport'
+import {
+  dailySummaryReduceCountList,
+  dailySummaryIncrDecrCostList,
+  dailySummaryIncrDecrCostImport,
+  dailySummaryIncrDecrCostListExport,
+  dailySummaryReduceBatchDo,
+  dailySummaryReduceBatchDel,
+  dailySummaryReduceCountDelete,
+  dailySummaryReduceCountDo
+} from '@/api/increaseAndDecreaseExpense'
+export default {
+  components: { TemplatePage, ImageUpload },
+  mixins: [import_mixin, operation_mixin],
+  data() {
+    return {
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: true
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      // 表格属性
+      tableAttributes2: {
+        // 启用勾选列
+        selectColumn: true
+      },
+      // 表格事件
+      tableEvents2: {
+        'selection-change': this.selectionChange2
+      },
+      // 勾选选中行
+      recordSelected2: [],
+      // 表单
+      formData: {}
+    }
+  },
+  computed: {
+    // 更多参数
+    moreParameters() {
+      return []
+    },
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('import', ({ moduleName }) => {
+              return {
+                name: moduleName,
+                render: () => {
+                  return this.importButton(dailySummaryIncrDecrCostImport, moduleName)
+                }
+              }
+            })
+          ]
+        ]
+      ]
+    },
+    //
+    optionsEvensGroup2() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('batchExecute2', {
+              click: () => {
+                if (this.recordSelected2.length === 0) {
+                  this.$message.warning('请勾选')
+                  return
+                }
+                dailySummaryReduceBatchDo({
+                  ids: this.recordSelected2.map(item => item.id).join(',')
+                }).then(res => {
+                  this.$message({ type: 'success', message: '设置成功!' })
+                  this.$refs.pageRef2.refreshList()
+                })
+              }
+            })
+          ],
+          [
+            this.optionsEvensAuth('batchDel2', {
+              click: () => {
+                if (this.recordSelected.length === 0) {
+                  this.$message.warning('请勾选')
+                  return
+                }
+                dailySummaryReduceBatchDel({
+                  ids: this.recordSelected.map(item => item.id).join(',')
+                }).then(res => {
+                  this.$message({ type: 'success', message: '删除成功!' })
+                  this.$refs.pageRef2.refreshList()
+                })
+              }
+            })
+          ]
+        ]
+      ]
+    },
+    formItems() {
+      return []
+    }
+  },
+  methods: {
+    // 列表请求函数
+    getList(p, cb) {
+      try {
+        cb && cb(p)
+        return dailySummaryReduceCountList(p)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    getList2(p, cb) {
+      try {
+        cb && cb(p)
+        return dailySummaryIncrDecrCostList(p)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 列表导出函数
+    exportList2: dailySummaryIncrDecrCostListExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
+    },
+    selectionChange2(data) {
+      this.recordSelected2 = data
+    },
+    operation() {
+      return this.operationBtn({
+        view: {
+          click: ({ row, index, column }) => {
+            this.$refs.tabPage.addTab({
+              // 对应显示的模块
+              activeKey: 'view',
+              // 唯一标识
+              key: 'view',
+              // 页签名称
+              label: '明细',
+              // 打开时事件
+              triggerEvent: () => {},
+              // 关闭时事件
+              closeEvent: () => {}
+            })
+          }
+        },
+        execute: {
+          prompt: '确定执行吗?',
+          click: ({ row, index, column }) => {
+            dailySummaryReduceCountDo({ importBatchNos: row.importBatchNo }).then(res => {
+              this.$message({ type: 'success', message: '执行成功!' })
+              this.$refs.pageRef.refreshList()
+            })
+          }
+        },
+        coverImport: {
+          import: true,
+          click: ({ row, index, column, file }) => {
+            var formdata = new FormData()
+            formdata.append('file', file)
+            formdata.append('importBatchNo', row.importBatchNo)
+            dailySummaryIncrDecrCostImport({ formdata })
+              .then(res => {
+                this.$refs.pageRef.refreshList()
+                this.$message({
+                  type: 'success',
+                  message: '导入成功!'
+                })
+              })
+              .catch(err => {
+                this.$message({
+                  type: 'error',
+                  message: err.message || '导入失败'
+                })
+              })
+          }
+        },
+        del: {
+          prompt: '确定删除吗?',
+          click: ({ row, index, column }) => {
+            dailySummaryReduceCountDelete({ importBatchNo: row.importBatchNo }).then(res => {
+              this.$message({ type: 'success', message: '删除成功!' })
+              this.$refs.pageRef.refreshList()
+            })
+          }
+        }
+      })
+    },
+    operation2() {
+      return this.operationBtn({
+        execute2: {
+          click: ({ row, index, column }) => {
+            dailySummaryReduceBatchDo({ ids: row.id }).then(res => {
+              this.$message({ type: 'success', message: '设置成功!' })
+              this.$refs.pageRef2.refreshList()
+            })
+          }
+        },
+        del2: {
+          prompt: '确定删除吗?',
+          click: ({ row, index, column }) => {
+            dailySummaryReduceBatchDel({ ids: row.id }).then(res => {
+              this.$message({ type: 'success', message: '删除成功!' })
+              this.$refs.pageRef2.refreshList()
+            })
+          }
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 22 - 2
src/views/engineerFeeSettlement/dailyMaintenanceBalance/settlementDataImport/index.vue

@@ -22,9 +22,10 @@
         </template-page>
       </div>
       <div
+        v-if="activeKey == 'view'"
         :style="{
           width: '100%',
-          height: activeKey == 'view' ? '100%' : '0px',
+          height: '100%',
           overflow: 'hidden'
         }"
       >
@@ -231,7 +232,26 @@ export default {
           }
         },
         coverImport: {
-          click: ({ row, index, column }) => {}
+          import: true,
+          click: ({ row, index, column, file }) => {
+            var formdata = new FormData()
+            formdata.append('file', file)
+            formdata.append('importBatchNo', row.importBatchNo)
+            dailySummaryOrderImport({ formdata })
+              .then(res => {
+                this.$refs.pageRef.refreshList()
+                this.$message({
+                  type: 'success',
+                  message: '导入成功!'
+                })
+              })
+              .catch(err => {
+                this.$message({
+                  type: 'error',
+                  message: err.message || '导入失败'
+                })
+              })
+          }
         },
         del: {
           prompt: '确定删除吗?',