Browse Source

新增发票类型

duy 2 years ago
parent
commit
d17cacbb24
2 changed files with 159 additions and 0 deletions
  1. 154 0
      src/views/system/components/tab-invoice.vue
  2. 5 0
      src/views/system/parameter.vue

+ 154 - 0
src/views/system/components/tab-invoice.vue

@@ -0,0 +1,154 @@
+<template>
+    <HcCard>
+        <template #header>
+            <span class="mr-2">发票类型:</span>
+            <el-button _icon hc-btn size="small" type="primary" @click="positionEdit(1)">
+                <HcIcon name="add"/>
+            </el-button>
+        </template>
+        <HcTable :column="positiontableColumn" :datas="positiontableData" :loading="tableLoaing">
+            <template #action="{row, index}">
+                <el-button size="small" type="primary" @click="positionEdit(2,row)">编辑</el-button>
+                <el-button size="small" type="primary" @click="delTaskposition(row)">删除</el-button>
+            </template>
+        </HcTable>
+   
+        <HcDialog bgColor="#ffffff" isToBody widths="24rem" :show="positonModal" :title="positonModalTitle" @close="positonModalClose" @save="savepositionClick">
+            <el-form label-position="top" label-width="auto" :model="formposition" size="large">
+                <el-form-item label="发票类型名称:">
+                    <el-input v-model="formposition.dictName"/>
+                </el-form-item>
+        
+            </el-form>
+        </HcDialog>
+    </HcCard>
+</template>
+
+<script setup>
+import {ref, watch,onMounted} from "vue";
+import {submitDictionary,removeDictionary,getParentList,getChildList} from '~api/system/parameter.js';
+import {getArrValue} from "js-fast-way"
+const props = defineProps({
+    cur: {
+        type: [String,Number],
+        default: ''
+    },
+    type:{
+        type: [String,Number],
+        default: ''
+    }
+})
+
+const tabsKey = ref(props.cur)
+const tabsType = ref(props.type)
+
+//监听
+watch(() => [
+    props.cur,
+    props.type,
+], ([key,type]) => {
+    tabsKey.value = key
+    tabsType.value = type
+})
+
+onMounted(() => {
+    getParentListData()
+   
+})
+const tableLoaing=ref(false)
+const getParentListData=async()=>{
+    tableLoaing.value=true
+    const { error, code, data,msg } = await getParentList({
+        type:tabsType.value,
+    })
+    tableLoaing.value=false
+    if (!error && code === 200) {
+        positiontableData.value = getArrValue(data['records'])
+       
+    } 
+    else {
+        positiontableData.value=[]
+        window.$message?.warning(msg)
+    }
+}
+
+
+
+
+const positiontableColumn = [
+    {key: 'dictName', name: '报销类型名称'},
+    {key: 'action', name: '操作', width: 200}
+]
+
+
+const positiontableData = ref([
+   
+])
+
+const positonModal = ref(false)
+const positonModalTitle = ref('')
+const editItem=ref({})
+const positionEdit = (type,row) => {
+    if (type === 1) {
+        positonModalTitle.value = '新增报销类型'
+        formposition.value={}
+        editItem.value={}
+    } else {
+        positonModalTitle.value = '编辑报销类型'
+        editItem.value=row
+        formposition.value=row
+    }
+    positonModal.value = true
+}
+
+
+const positonModalClose = () => {
+    positonModal.value = false
+}
+
+const formposition = ref({})
+
+//新增编辑提交
+const savepositionClick=async()=>{
+    const { error, code, data,msg } = await submitDictionary({
+        type:tabsType.value,
+        dictValue:formposition.value?.dictValue,
+        dictName:formposition.value?.dictName,
+        id:editItem.value.id||null
+      
+    })
+    positonModal.value=false
+    if (!error && code === 200) {
+        window.$message?.success(msg)
+        getParentListData()
+    } 
+    else {
+        window.$message?.warning(msg)
+    }
+}
+const delTaskposition = (row) => {
+    window?.$messageBox?.alert('您确定要删除该信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
+            showCancelButton: true,
+            confirmButtonText: '确认注销',
+            cancelButtonText: '取消',
+            type: 'warning',
+            callback: async(action) => {
+                if (action === 'confirm') {
+                        const {error, code, msg} = await removeDictionary({
+                            ids: row?.id,
+                        })
+                        if (!error && code === 200) {
+                            window?.$message?.success('删除成功')
+                            getParentListData()
+                        } else {
+                            window?.$message?.warning(msg)
+                        }
+                }
+            }
+    })
+}
+</script>
+
+<style scoped lang="scss">
+
+</style>

+ 5 - 0
src/views/system/parameter.vue

@@ -18,6 +18,9 @@
         <template #tab-approve>
             <HcTabApprove :cur="tabsKey" :type="6" v-if="tabsKey==='approve'"/>
         </template>
+        <template #tab-invoice>
+            <HcTabInvoice :cur="tabsKey" :type="7" v-if="tabsKey==='invoice'"/>
+        </template>
         <template #tab-other>
             <HcTabOther :cur="tabsKey" :type="11" v-if="tabsKey==='other'"/>
         </template>
@@ -32,6 +35,7 @@ import HcTabPrice from "./components/tab-price.vue";
 import HcTabReimbursement from "./components/tab-reimbursement.vue";
 import HcTabCost from "./components/tab-cost.vue";
 import HcTabApprove from "./components/tab-approve.vue";
+import HcTabInvoice from "./components/tab-invoice.vue";
 import HcTabOther from './components/tab-other.vue'
 
 
@@ -44,6 +48,7 @@ const tabsData = ref([
     {icon: 'sun-cloudy', label: '报销类型字典', key: 'reimbursement'},
     {icon: 'sun-cloudy', label: '成本测算类型', key: 'cost'},
     {icon: 'sun-cloudy', label: '审批流程', key: 'approve'},
+    {icon: 'sun-cloudy', label: '发票字典', key: 'invoice'},
     {icon: 'sun-cloudy', label: '其他', key: 'other'},
 
 ])