Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

ZaiZai 2 rokov pred
rodič
commit
daef101106

+ 27 - 0
src/api/modules/system/parameter.js

@@ -0,0 +1,27 @@
+import {httpApi} from "../../request/httpApi";
+import website from "~src/config/index";
+
+//新增或修改参数
+export const submitDictionary = (form, msg = true) => httpApi({
+    url: '/api/blade-control/dictinfo/submit',
+    method: 'post',
+    data: form
+}, msg);
+//删除
+export const removeDictionary = (form, msg = true) => httpApi({
+    url: '/api/blade-control/dictinfo/remove',
+    method: 'post',
+    params: form
+}, msg);
+//顶级列表
+export const getParentList = (form, msg = true) => httpApi({
+    url: '/api/blade-control/dictinfo/parent-list',
+    method: 'get',
+    params: form
+}, msg);
+//子列表
+export const getChildList = (form, msg = true) => httpApi({
+    url: '/api/blade-control/dictinfo/child-list',
+    method: 'get',
+    params: form
+}, msg);

+ 42 - 0
src/router/modules/base.js

@@ -248,6 +248,48 @@ export default [
                 meta: {title: '参数配置'},
                 component: () => import('~src/views/system/parameter.vue')
             },
+            {
+                path: '/system/parameter-pricetype',
+                name: 'system-parameter-pricetype',
+                meta: {title: '财务费用字典'},
+                component: () => import('~src/views/system/components/tab-pricetype')
+            },
+            {
+                path: '/system/parameter-tasktype',
+                name: 'system-parameter-tasktype',
+                meta: {title: '任务类型字典'},
+                component: () => import('~src/views/system/components/tab-tasktype')
+            },
+            {
+                path: '/system/parameter-price',
+                name: 'system-parameter-price',
+                meta: {title: '岗位类型字典'},
+                component: () => import('~src/views/system/components/tab-price')
+            },
+            {
+                path: '/system/parameter-reimbursement',
+                name: 'system-parameter-reimbursement',
+                meta: {title: '报销类型字典'},
+                component: () => import('~src/views/system/components/tab-reimbursement')
+            },
+            {
+                path: '/system/parameter-cost',
+                name: 'system-parameter-cost',
+                meta: {title: '成本测算类型'},
+                component: () => import('~src/views/system/components/tab-cost')
+            },
+            {
+                path: '/system/parameter-approve',
+                name: 'system-parameter-approve',
+                meta: {title: '审批流程'},
+                component: () => import('~src/views/system/components/tab-approve')
+            },
+            {
+                path: '/system/parameter-other',
+                name: 'system-parameter-other',
+                meta: {title: '其他'},
+                component: () => import('~src/views/system/components/tab-other')
+            },
             {
                 path: '/system/organization',
                 name: 'system-organization',

+ 7 - 0
src/router/modules/token.js

@@ -29,6 +29,13 @@ export default [
     'system-user',
     'system-menu',
     'system-parameter',
+    'system-parameter-pricetype',
+    'system-parameter-tasktype',
+    'system-parameter-price',
+    'system-parameter-reimbursement',
+    'system-parameter-cost',
+    'system-parameter-approve',
+    'system-parameter-other',
     'system-organization',
     'risk-warning',
     'static-project',

+ 149 - 45
src/views/system/components/tab-pricetype.vue

@@ -19,10 +19,10 @@
                     </div>
 
                     <!--预算分类新增编辑弹窗-->
-                    <HcDialog bgColor="#ffffff" widths="22rem" isToBody :show="priceModal" :title="priceTitle" @close="priceModalClose">
+                    <HcDialog bgColor="#ffffff" widths="22rem" isToBody :show="priceModal" :title="priceTitle" @close="priceModalClose" @save="saveparentClick">
                         <el-form :model="priceform" label-position="top" label-width="auto" size="large">
                             <el-form-item label="预算一级科目名称:">
-                                <el-input v-model="priceform.name"/>
+                                <el-input v-model="priceform.dictName"/>
                             </el-form-item>
                         </el-form>
                     </HcDialog>
@@ -37,18 +37,18 @@
                             <HcIcon name="add"/>
                         </el-button>
                     </template>
-                    <HcTable :column="tableColumn" :datas="tableData"  :isIndex="false">
+                    <HcTable :column="tableColumn" :datas="tableData"  :isIndex="false" :loading="tableLoaing">
                         <template #action="{row, index}">
-                            <el-button size="small" type="primary" @click="openEdit(2)">编辑</el-button>
-                            <el-button size="small" type="primary" @click="delTask">删除</el-button>
+                            <el-button size="small" type="primary" @click="openEdit(2,row)">编辑</el-button>
+                            <el-button size="small" type="primary" @click="delTask(row)">删除</el-button>
                         </template>
                     </HcTable>
 
                     <!--任务明细弹窗-->
-                    <HcDialog bgColor="#ffffff" widths="24rem" isToBody :show="editTaskModal" :title="taskTitle" @close="testModalClose">
+                    <HcDialog bgColor="#ffffff" widths="24rem" isToBody :show="editTaskModal" :title="taskTitle" @close="testModalClose" @save="savechilidClick">
                         <el-form label-position="top" label-width="auto" :model="formLabelAlign" size="large">
                             <el-form-item label="预算二级科目名称:">
-                                <el-input v-model="formLabelAlign.name"/>
+                                <el-input v-model="formLabelAlign.dictName"/>
                             </el-form-item>
                         </el-form>
                     </HcDialog>
@@ -64,45 +64,52 @@
 
 <script setup>
 import {onMounted, ref, watch} 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,
-], ([key]) => {
+    props.type,
+], ([key,type]) => {
     tabsKey.value = key
-    console.log(key)
+    tabsType.value = type
+   
 })
 
 onMounted(() => {
     setContextMenu()
+    getParentListData()
+   
 })
 
 //左侧菜单
-const menuKey = ref('1')
-const menuOptions = ref([
-    {key: '1', label: '合同洽谈', badge: 0},
-    {key: '2', label: '合同洽谈', badge: 0},
-    {key: '3', label: '合同洽谈', badge: 0},
-    {key: '4', label: '合同洽谈', badge: 0},
-    {key: '5', label: '合同洽谈', badge: 0},
-]);
-
+const menuKey = ref('')
+const menuOptions = ref([]);
+const menuItem=ref({})
 const menuChange = (item) => {
     console.log(item)
-    menuKey.value = item?.key
+    menuKey.value = item?.id
+    menuItem.value=item
+    getChildListData()
 }
 const menusProps = ref({
-    key: 'key',
-    label: 'label'
+    key: 'id',
+    label: 'dictName'
 })
 
 //菜单的右键菜单
@@ -117,18 +124,30 @@ const setContextMenu = () => {
 
 //菜单的右键菜单被点击
 const contextMenuClick = ({key, item}) => {
+    console.log(item,'item');
+    menuKey.value = item?.id
+  
     if (key === 'edit') {
         openpriceEdit(2)
-        menuKey.value = item?.key
+        menuKey.value = item?.id
+        priceform.value.dictName=item.dictName
     } else if (key === 'del') {
         window?.$messageBox?.alert('您确定要删除该预算分类信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
             showCancelButton: true,
             confirmButtonText: '确认注销',
             cancelButtonText: '取消',
             type: 'warning',
-            callback: (action) => {
+            callback: async(action) => {
                 if (action === 'confirm') {
-                    console.log(11111);
+                        const {error, code, msg} = await removeDictionary({
+                            ids: item?.id,
+                        })
+                        if (!error && code === 200) {
+                            window?.$message?.success('删除成功')
+                            getParentListData()
+                        } else {
+                            window?.$message?.warning(msg)
+                        }
                 }
             }
         })
@@ -140,6 +159,8 @@ const priceModal = ref(false)
 const openpriceEdit = (type) => {
     if (type === 1) {
         priceTitle.value = '新增分类'
+        priceform.value={}
+        menuKey.value=''
     } else {
         priceTitle.value = '编辑分类'
     }
@@ -153,14 +174,24 @@ const priceModalClose = () => {
 }
 
 const taskTitle = ref('')
-const openEdit = (type) => {
+const openEdit = (type,row) => {
+    
     if (type === 1) {
+        formLabelAlign.value.dictName=''
+        formLabelAlign.value.id=''
         taskTitle.value = '新增'
     } else {
+        formLabelAlign.value.dictName=row.dictName
+        formLabelAlign.value.id=row.id
         taskTitle.value = '编辑'
     }
-
-    editTaskModal.value = true
+    if(menuKey.value){
+       
+        editTaskModal.value = true
+    }else{
+        window.$message.warning('请先选择一级科目')
+    }
+   
 }
 
 
@@ -169,32 +200,36 @@ const testModalClose = () => {
     editTaskModal.value = false
 }
 
-const delTask = () => {
-    window?.$messageBox?.alert('您确定要删除该预算科目吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-        showCancelButton: true,
-        confirmButtonText: '确认注销',
-        cancelButtonText: '取消',
-        type: 'warning',
-        callback: (action) => {
-            if (action === 'confirm') {
-                console.log(11111);
+const delTask = (item) => {
+    window?.$messageBox?.alert('您确定要删除该预算科目信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
+            showCancelButton: true,
+            confirmButtonText: '确认注销',
+            cancelButtonText: '取消',
+            type: 'warning',
+            callback: async(action) => {
+                if (action === 'confirm') {
+                        const {error, code, msg} = await removeDictionary({
+                            ids: item?.id,
+                        })
+                        if (!error && code === 200) {
+                            window?.$message?.success('删除成功')
+                            getParentListData()
+                        } else {
+                            window?.$message?.warning(msg)
+                        }
+                }
             }
-        }
-    })
+        })
 }
 
 const tableColumn = [
-    {key: 'name', name: '预算二级科目',align:'center'},
+    {key: 'dictName', name: '预算二级科目',align:'center'},
     // {key: 'text', name: '任务内容'},
     // {key: 'color', name: '完成指标'},
     {key: 'action', name: '操作', width: 200}
 ]
-const tableData = ref([
-    {name: '名称1', text: '文本1', color: 'red'},
-    {name: '名称2', text: '文本2', color: 'blue'},
-    {name: '名称3', text: '文本3', color: '无'}
-])
-
+const tableData = ref([])
+const tableLoaing=ref(false)
 const formLabelAlign = ref({
     name: '',
     region: '',
@@ -210,6 +245,75 @@ const pageChange = ({current, size}) => {
     searchForm.value.current = current
     searchForm.value.size = size
 }
+//新增一级科目
+const saveparentClick=async()=>{
+    const { error, code, data,msg } = await submitDictionary({
+        type:tabsType.value,
+        dictName:priceform.value?.dictName,
+        id:menuKey.value||null,
+    })
+   
+    if (!error && code === 200) {
+        window.$message?.success(msg)
+        priceModal.value=false
+        getParentListData()
+    } 
+    else {
+        window.$message?.warning(msg)
+    }
+}
+//新增二级级科目
+const savechilidClick=async()=>{
+    const { error, code, data,msg } = await submitDictionary({
+        type:tabsType.value,
+        dictName:formLabelAlign.value?.dictName,
+        id:formLabelAlign.value.id||null,
+        parentId:menuKey.value
+    })
+   
+    if (!error && code === 200) {
+        window.$message?.success(msg)
+        editTaskModal.value=false
+        getChildListData()
+    } 
+    else {
+        window.$message?.warning(msg)
+    }
+}
+//获取一级科目
+const getParentListData=async()=>{
+    const { error, code, data,msg } = await getParentList({
+        type:1,
+       
+    })
+    if (!error && code === 200) {
+        menuOptions.value = getArrValue(data['records'])
+        if( menuOptions.value.length>0){
+            menuKey.value= menuOptions.value[0]?.id
+            menuItem.value.id =   menuOptions.value[0]?.id
+            getChildListData()
+        }
+    } 
+    else {
+        window.$message?.warning(msg)
+    }
+}
+//获取二级科目
+const getChildListData=async()=>{
+    tableLoaing.value=true
+    const { error, code, data,msg } = await getChildList({
+        parentId: menuItem.value.id,
+        type:1,
+    })
+    tableLoaing.value=false
+    if (!error && code === 200) {
+        tableData.value=getArrValue(data)
+        // tab.value = getArrValue(data['records'])
+    } 
+    else {
+        window.$message?.warning(msg)
+    }
+}
 </script>
 
 <style lang="scss">

+ 12 - 10
src/views/system/parameter.vue

@@ -1,28 +1,25 @@
 <template>
     <HcTabsSimple :cur="tabsKey" :datas="tabsData" @tabClick="tabsClick">
         <template #tab-pricetype>
-            <TabPriceType :cur="tabsKey"/>
+            <TabPriceType :cur="tabsKey" :type="1"/>
         </template>
         <template #tab-tasktype>
-            <TabTaskType :cur="tabsKey"/>
-        </template>
-        <template #tab-indicator>
-            测试3
+            <TabTaskType :cur="tabsKey" :type="2"/>
         </template>
         <template #tab-price>
-            <TabPrice :cur="tabsKey"/>
+            <TabPrice :cur="tabsKey" :type="3"/>
         </template>
         <template #tab-reimbursement>
-            <TabReimbursement :cur="tabsKey"/>
+            <TabReimbursement :cur="tabsKey" :type="4"/>
         </template>
         <template #tab-cost>
-            <TabCost :cur="tabsKey"/>
+            <TabCost :cur="tabsKey" :type="5"/>
         </template>
         <template #tab-approve>
-            <TabApprove :cur="tabsKey"/>
+            <TabApprove :cur="tabsKey" :type="6"/>
         </template>
         <template #tab-other>
-            <TabOther :cur="tabsKey"/>
+            <TabOther :cur="tabsKey" :type="7"/>
         </template>
     </HcTabsSimple>
 </template>
@@ -37,6 +34,7 @@ import TabCost from "./components/tab-cost.vue";
 import TabApprove from "./components/tab-approve.vue";
 import TabOther from './components/tab-other.vue'
 
+
 //类型处理
 const tabsKey = ref('pricetype')
 const tabsData = ref([
@@ -49,11 +47,15 @@ const tabsData = ref([
     {icon: 'sun-cloudy', label: '其他', key: 'other'},
    
 ])
+//渲染完成
+onMounted(() => {
 
+})
 const tabsClick = (key) => {
     tabsKey.value = key
 }
 
+
 </script>
 
 <style lang="scss" scoped>