Browse Source

资金账户管理

lilei 3 năm trước cách đây
mục cha
commit
5d77a035ff

+ 65 - 0
src/api/settleAcount.js

@@ -0,0 +1,65 @@
+import { axios } from '@/utils/request'
+
+// 更新结算账户功能状态
+export const updateAccountMangeState = params => {
+  return axios({
+    url: `/settleAccount/updateFunctionState/${params.enableFlag}`,
+    method: 'get'
+  })
+}
+// 查询结算账户功能状态
+export const queryAccountMangeState = params => {
+  return axios({
+    url: `/settleAccount/queryFunctionState`,
+    method: 'get'
+  })
+}
+// 分页查找结算账户列表
+export const settleAccountList = (params) => {
+  const url = `/settleAccount/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 保存结算账户信息
+export const settleAccountSave = params => {
+  return axios({
+    url: '/settleAccount/save',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 根据sn查找结算账户信息
+export const settleAccountDetail = params => {
+  return axios({
+    url: `/settleAccount/findBySn/${params.settleAccountSn}`,
+    method: 'get'
+  })
+}
+// 启禁用结算账户信息
+export const settleAccountEnable = params => {
+  return axios({
+    url: `/settleAccount/enable/${params.settleAccountSn}/${params.enableFlag}`,
+    method: 'get'
+  })
+}
+// 删除结算账户信息
+export const settleAccountDelete = params => {
+  return axios({
+    url: `/settleAccount/delete/${params.settleAccountSn}`,
+    method: 'get'
+  })
+}
+// 审核结算账户信息
+export const settleAccountAudit = params => {
+  return axios({
+    url: `/settleAccount/audit/${params.settleAccountSn}/${params.auditState}`,
+    method: 'get'
+  })
+}

+ 1 - 0
src/store/getters.js

@@ -11,6 +11,7 @@ const getters = {
   userInfo: state => state.user.info,
   authOrgs: state => state.user.authOrgs,
   changeOrg: state => state.user.changeOrg,
+  settleAccountFlag:state => state.user.settleAccountFlag,
   addRouters: state => state.permission.addRouters,
   multiTab: state => state.app.multiTab,
   lang: state => state.i18n.lang,

+ 36 - 3
src/store/modules/user.js

@@ -1,5 +1,6 @@
 import Vue from 'vue'
 import { login, logout } from '@/api/login'
+import { updateAccountMangeState, queryAccountMangeState } from '@/api/settleAcount'
 import { ACCESS_TOKEN } from '@/store/mutation-types'
 import { welcome } from '@/utils/util'
 import VueCookies from 'vue-cookies'
@@ -13,7 +14,8 @@ const user = {
     roles: { permissionList: [] },
     info: {},
     authOrgs: [],
-    changeOrg: ''
+    changeOrg: '',
+    settleAccountFlag: 0, // 结算账户管理是否开启
   },
 
   mutations: {
@@ -43,7 +45,10 @@ const user = {
     },
     SET_MUSTCHANGEPWD: (state, status) => {
       state.mustChangePwd = status
-    }
+    },
+    SET_SETTLEACCOUNT:(state, status) => {
+      state.settleAccountFlag = status
+    },
   },
 
   actions: {
@@ -100,9 +105,37 @@ const user = {
     },
     // 切换账号
     SetOrgSn ({ commit, state }, info) {
-      // console.log(info)
       commit('SET_CHANGEORG', info)
     },
+    // 更新结算账户状态
+    UpdateSettleAccount({ commit, state }, info) {
+      return new Promise((resolve, reject) => {
+        updateAccountMangeState(info).then(res => {
+          if(res.status == 200){
+            resolve(res)
+          }else{
+            reject(ret)
+          }
+        }).catch(error => {
+            reject(error)
+          })
+      })
+    },
+    // 查询结算账户状态
+    GetSettleAccountState({ commit, state }) {
+      return new Promise((resolve, reject) => {
+        queryAccountMangeState().then(res => {
+          if(res.status == 200){
+            commit('SET_SETTLEACCOUNT', res.data&&res.data.functionEnableFlag)
+            resolve(res)
+          }else{
+            reject(ret)
+          }
+        }).catch(error => {
+            reject(error)
+          })
+      })
+    },
     // 登出
     Logout ({ commit, state }) {
       console.log(state)

+ 74 - 0
src/views/common/settleStyle.js

@@ -0,0 +1,74 @@
+import { settleStyleQueryAll } from '@/api/settleStyle'
+const CustList = {
+  template: `
+        <a-select
+          :id="id"
+          :placeholder="placeholder"
+          allowClear
+          :value="defaultVal"
+          :showSearch="true"
+          @change="handleChange"
+          :filter-option="filterOption">
+          <a-select-option v-for="item in list" :key="item[defValKey]" :value="item[defValKey]">{{ item.name }}</a-select-option>
+        </a-select>
+    `,
+  props: {
+    value: {
+      type: String,
+      defatut: ''
+    },
+    id: {
+      type: String,
+      default: ''
+    },
+    defValKey: {
+      type: String,
+      default: 'settleStyleSn'
+    },
+    placeholder: {
+      type: String,
+      default: '请选择结算方式'
+    }
+  },
+  data() {
+    return {
+      defaultVal: this.value||undefined,
+      list: []
+    };
+  },
+  watch: {
+    value(newValue, oldValue) {
+      console.log(newValue)
+      this.defaultVal = newValue||undefined
+    }
+  },
+  mounted() {
+    this.getList()
+  },
+  methods: {
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    handleChange(value) {
+      this.defaultVal = value;
+      const settleStyleName = this.list.find(item => item[this.defValKey] == value).name
+      this.$emit('input', value);
+      this.$emit('change', this.value, settleStyleName);
+    },
+    // 列表数据
+    getList () {
+      const _this = this
+      settleStyleQueryAll().then(res => {
+        if (res.status == 200) {
+          _this.list = res.data || []
+        } else {
+          _this.list = []
+        }
+      })
+    },
+  },
+};
+
+export default CustList

+ 32 - 18
src/views/financialManagement/fundAccountManagement/addModal.vue

@@ -4,7 +4,7 @@
     class="fundAount-basicInfo-modal"
     :footer="null"
     :maskClosable="false"
-    title="新增资金账户"
+    :title="(isEdit?'编辑':'新增')+'资金账户'"
     v-model="isShow"
     @cancel="isShow=false"
     :width="600">
@@ -16,13 +16,13 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
-        <a-form-model-item label="账户类型" prop="accountType">
-          <v-select
-            code="FLAG"
-            id="fundAount-grabFlag"
-            v-model="form.accountType"
-            allowClear
-            placeholder="请选择账户类型"></v-select>
+        <a-form-model-item label="账户类型" prop="settleStyleSn">
+          <settleStyle
+            id="fundAount-settleStyleSn"
+            v-model="form.settleStyleSn"
+            @change="settleStyleChange"
+            placeholder="请选择账户类型">
+          </settleStyle>
         </a-form-model-item>
         <a-form-model-item label="账户名称" prop="accountName">
           <a-input
@@ -52,10 +52,11 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
-import { purchaseReturnSaveByNoSync } from '@/api/purchaseReturn'
+import { settleAccountSave, settleAccountDetail } from '@/api/settleAcount'
+import settleStyle from '@/views/common/settleStyle'
 export default {
   name: 'BasicInfoModal',
-  components: { VSelect },
+  components: { VSelect, settleStyle },
   mixins: [commonMixin],
   props: {
     openModal: { //  弹框显示状态
@@ -68,18 +69,19 @@ export default {
       spinning: false,
       confirmLoading: false,
       isShow: this.openModal, //  是否打开弹框
-      settleStyleList: [], // 支付方式
+      isEdit: false,
       formItemLayout: {
         labelCol: { span: 4 },
         wrapperCol: { span: 18 }
       },
       form: {
-        accountType: undefined, // 供应商
+        settleStyleSn: '',
+        settleStyleName: '',
         accountName: '',
         accountNo: ''
       },
       rules: {
-        accountType: [
+        settleStyleSn: [
           { required: true, message: '请选择账户类型', trigger: 'change' }
         ],
         accountName: [
@@ -94,9 +96,16 @@ export default {
   methods: {
     resetForm () {
       this.$refs.ruleForm.resetFields()
-      this.form.accountName = ''
-      this.form.accountType = undefined
-      this.form.accountNo = ''
+      this.form = {
+        settleStyleSn: '',
+        settleStyleName: '',
+        accountName: '',
+        accountNo: ''
+      }
+      this.isEdit = false
+    },
+    settleStyleChange (v, name) {
+      this.form.settleStyleName = name
     },
     //  保存
     handleSubmit (e) {
@@ -105,7 +114,7 @@ export default {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           _this.spinning = true
-          purchaseReturnSaveByNoSync(_this.form).then(res => {
+          settleAccountSave(_this.form).then(res => {
             if (res.status == 200) {
               _this.isShow = false
               _this.$emit('ok', res.data)
@@ -122,7 +131,12 @@ export default {
     },
     // 编辑信息
     setData (data) {
-      this.form = JSON.parse(JSON.stringify(data))
+      settleAccountDetail({ settleAccountSn: data.settleAccountSn }).then(res => {
+        if (res.status == '200') {
+          this.form = Object.assign(this.form, res.data || {})
+          this.isEdit = true
+        }
+      })
     }
   },
   watch: {

+ 75 - 40
src/views/financialManagement/fundAccountManagement/list.vue

@@ -36,65 +36,66 @@
           :scroll="{ y: tableHeight }"
           :defaultLoadData="false"
           bordered>
-          <!-- 费用类别 -->
-          <template slot="expensesType" slot-scope="text, record">
-            {{ record.expensesTypeName1 }} <span v-if="record.expensesTypeName2">>{{ record.expensesTypeName2 }}</span> <span v-if="record.expensesTypeName3">>{{ record.expensesTypeName3 }}</span>
-          </template>
-          <!-- 审核 -->
-          <template slot="audit" slot-scope="text, record">
-            <stateIcon :title="record.stateDictValue" :state="record.state == 'AUDIT_PASS'?'1':'2'"></stateIcon>
-          </template>
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
             <a-button
               size="small"
               type="link"
-              v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_expenseAudit')"
+              v-if="record.state == 'ENABLE'||record.state == 'DISABLE'"
+              class="button-primary"
+              @click="handleEnable(record)"
+              id="foundAcount-enable-btn">
+              {{ record.state == 'ENABLE'?'禁用':'' }}
+              {{ record.state == 'DISABLE'?'启用':'' }}
+            </a-button>
+            <a-button
+              size="small"
+              type="link"
+              v-if="record.state == 'ENABLE'||record.state == 'DISABLE'"
               class="button-primary"
               @click="handleDetail(record)"
               id="foundAcount-detail-btn">资金明细</a-button>
             <a-button
               size="small"
               type="link"
-              v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_expenseAudit')"
+              v-if="record.state == 'WAIT'"
               class="button-primary"
               @click="handleAudit(record)"
               id="foundAcount-audit-btn">审核</a-button>
             <a-button
               size="small"
               type="link"
-              v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_expenseEdit')"
+              v-if="record.state == 'WAIT'"
               class="button-primary"
               @click="handleEdit(record)"
               id="foundAcount-edit-btn">编辑</a-button>
             <a-button
               size="small"
               type="link"
-              v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_expenseDel')"
+              v-if="record.state == 'WAIT'"
               class="button-error"
               @click="handleDel(record)"
               id="foundAcount-del-btn">删除</a-button>
-            <span v-if="record.state != 'WAIT_AUDIT'||( !$hasPermissions('B_expenseAudit')&& !$hasPermissions('B_expenseEdit') && !$hasPermissions('B_expenseDel'))">--</span>
           </template>
         </s-table>
       </a-card>
 
     </a-spin>
-    <!-- 详情 -->
-    <addModal :openModal="openModal" :itemId="itemId" @close="closeAddModal" />
+    <!-- 新增编辑 -->
+    <addModal ref="addModal" :openModal="openModal" @ok="addSuccess" @close="closeAddModal" />
   </div>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
+import { mapActions } from 'vuex'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { settleExpenseQuery, delExpense, auditExpense } from '@/api/settleExpense'
 import addModal from './addModal.vue'
-import stateIcon from '@/views/common/stateIcon'
+import { settleAccountList, settleAccountEnable, settleAccountDelete, settleAccountAudit } from '@/api/settleAcount'
 export default {
   name: 'ExpenseManagementList',
-  components: { STable, VSelect, addModal, rangeDate, stateIcon },
+  components: { STable, VSelect, addModal, rangeDate },
   mixins: [commonMixin],
   data () {
     return {
@@ -102,26 +103,25 @@ export default {
       tableHeight: 0,
       disabled: false, //  查询、重置按钮是否可操作
       advanced: true, //  高级搜索 展开/关闭
-      enableFundAccount: '1',
+      enableFundAccount: '',
       // 查询参数
       queryParam: {},
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '账户类型', dataIndex: 'accountExpensesNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '账户名称', dataIndex: 'createDate', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '账户号码', scopedSlots: { customRender: 'expensesType' }, width: '20%', align: 'center' },
-        { title: '收入金额', dataIndex: 'settleAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
-        { title: '支出金额', dataIndex: 'settleAmount1', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
-        { title: '启用', scopedSlots: { customRender: 'enable' }, width: '3%', align: 'center' },
-        { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
+        { title: '账户类型', dataIndex: 'settleStyleName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '账户名称', dataIndex: 'accountName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '账户号码', dataIndex: 'accountNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '收入金额', dataIndex: 'totalIncomeAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
+        { title: '支出金额', dataIndex: 'totalExpendAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
+        { title: '状态', dataIndex: 'stateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return settleExpenseQuery(Object.assign(parameter, this.queryParam)).then(res => {
+        return settleAccountList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -140,8 +140,14 @@ export default {
     }
   },
   methods: {
+    ...mapActions(['UpdateSettleAccount', 'GetSettleAccountState']),
     enableFundAccountChange (v) {
-
+      this.UpdateSettleAccount({ enableFlag: v.target.value }).then(res => {
+        if (res.status == 200) {
+          this.GetSettleAccountState()
+        }
+        this.$message.info(res.message)
+      })
     },
     // 关闭弹框
     closeAddModal () {
@@ -150,8 +156,13 @@ export default {
     },
     //  新增/编辑
     handleEdit (row) {
-      this.itemId = row ? row.id : null
       this.openModal = true
+      this.$nextTick(() => {
+        this.$refs.addModal.setData(row)
+      })
+    },
+    addSuccess () {
+      this.$refs.table.refresh()
     },
     //  资金明细
     handleDetail (row) {
@@ -162,20 +173,41 @@ export default {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '确定要审核吗?',
+        content: '审核通过后,账户信息不能再修改,确认审核通过吗?',
         centered: true,
         onOk () {
           _this.spinning = true
-          auditExpense({
-            id: row.id
+          settleAccountAudit({
+            settleAccountSn: row.settleAccountSn,
+            auditState: 'PASS'
           }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
             }
+            _this.spinning = false
+          })
+        }
+      })
+    },
+    // 启用,禁用
+    handleEnable (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: row.state == 'ENABLE' ? '确认禁用该账户吗?' : '确认启用该账户吗?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          settleAccountEnable({
+            settleAccountSn: row.settleAccountSn,
+            enableFlag: row.state == 'ENABLE' ? 'DISABLE' : 'ENABLE'
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+            _this.spinning = false
           })
         }
       })
@@ -183,21 +215,18 @@ export default {
     //  删除
     handleDel (row) {
       const _this = this
-      _this.itemId = row.id
       _this.$confirm({
         title: '提示',
         content: '删除后原数据不可恢复,是否删除?',
         centered: true,
         onOk () {
           _this.spinning = true
-          delExpense({ id: _this.itemId }).then(res => {
+          settleAccountDelete({ settleAccountSn: row.settleAccountSn }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
             }
+            _this.spinning = false
           })
         }
       })
@@ -211,6 +240,12 @@ export default {
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
+      // 结算账户状态查询
+      this.GetSettleAccountState().then(res => {
+        if (res.status == 200) {
+          _this.enableFundAccount = res.data.functionEnableFlag
+        }
+      })
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight