Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

ZaiZai 2 жил өмнө
parent
commit
4ac957ecaa

+ 157 - 29
src/views/system/components/tab-approve.vue

@@ -4,13 +4,16 @@
             <HcCardItem ui="hac-card-item w-60 mr-5">
                 <template #header>
                     <span class="mr-2">审批类型:</span>
-                 
+                    <el-button _icon hc-btn size="small" type="primary" @click="openpriceEdit(1)">
+                        <HcIcon name="add"/>
+                    </el-button>
                 </template>
                 <div> <span class="mt-2">预算一级科目:</span></div>
                 <div class="hc-layout-left-box menu mt-3">
                     <div class="hc-menu-contents-box">
                         <el-scrollbar>
                             <HcMenuSimple :datas="menuOptions" :keys="menuKey" :props="menusProps"
+                                          :menus="contextMenu" @menuTap="contextMenuClick"
                                           @change="menuChange"/>
                         </el-scrollbar>
                     </div>
@@ -23,80 +26,191 @@
                     <template #header>
                         <span class="mr-2">流程设置:</span>
                     </template>
+                    <template #extra>
+                        <el-button size="large" type="primary" hc-btn>
+                        <HcIcon name="save"/>
+                        <span>保存</span>
+                    </el-button>
+                    </template>
                     <div class="approve-box">
                         <el-checkbox-group v-model="checkList"  @change="handleCheckedApproveChange">
-                            <el-checkbox  v-for="item in checkData" :key="item" :label="item.name"  />
+                            <el-checkbox  v-for="item in checkData" :key="item" :label="item.dictName"  />
                         </el-checkbox-group>
                        <HcTable :column="tableColumn" :datas="tableData" ui="hc-test-drop-table" isRowDrop isSort @row-drop="rowDropTap" @row-sort="rowSortTap" :indexName="'顺序'" class="mt-4"/>
                     </div>
                 
                     <div class="approve-box mt-4">
                         <el-checkbox-group v-model="checkList1" @change="handleCheckedApproveChange1">
-                            <el-checkbox  v-for="item in checkData" :key="item" :label="item.name"  />
+                            <el-checkbox  v-for="item in checkData" :key="item" :label="item.dictName"  />
                   
                         </el-checkbox-group>
                        <HcTable :column="tableColumn1" :datas="tableData1" ui="hc-test-drop-table" isRowDrop isSort @row-drop="rowDropTap" @row-sort="rowSortTap" :indexName="'顺序'" class="mt-4"/>
                     </div>
-             
-                   
-                  
-              
-         
                 </HcCardItem>
             </div>
         </div>
       
     </HcCard>
+                <!--预算分类新增编辑弹窗-->
+                <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.dictName"/>
+                            </el-form-item>
+                        </el-form>
+                    </HcDialog>
 </template>
 
 <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 checkList = ref(['部门经理'])
-const checkList1 = ref(['人事'])
+const tabsType = ref(props.type)
+
 //监听
 watch(() => [
     props.cur,
-    checkList,
-    checkList1
-], ([key,list,list1]) => {
+    props.type,
+], ([key,type]) => {
     tabsKey.value = key
-    handleCheckedApproveChange(list.value)
-    handleCheckedApproveChange1(list1.value)
+    tabsType.value = type
+   
 })
 
 onMounted(() => {
-
+    setContextMenu()
+    getParentListData()
+    getcheckData()
+   
 })
+const menuItem=ref({})
+//获取一级科目
+const getParentListData=async()=>{
+    const { error, code, data,msg } = await getParentList({
+        type:tabsType.value,
+       
+    })
+    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
+           
+        }
+    } 
+    else {
+        menuOptions.value =[]
+        window.$message?.warning(msg)
+    }
+}
 
-//左侧菜单
-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 checkList = ref(['部门经理'])
+const checkList1 = ref(['人事'])
 
+//左侧菜单
+const menuKey = ref('')
+const menuOptions = 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'
 })
 
+//菜单的右键菜单
+const contextMenu = ref([])
+const setContextMenu = () => {
+    let newArr = [];
+    newArr.push({icon: 'draft', label: '编辑分类', key: "edit"})
+    newArr.push({icon: 'delete-bin', label: '删除分类', key: "del"})
+
+    contextMenu.value = newArr
+}
+const priceTitle = ref('')
+const priceModal = ref(false)
+const openpriceEdit = (type) => {
+    if (type === 1) {
+        priceTitle.value = '新增分类'
+        priceform.value={}
+        menuKey.value=''
+    } else {
+        priceTitle.value = '编辑分类'
+    }
+
+    priceModal.value = true
+}
+
+const priceform = ref({})
+const priceModalClose = () => {
+    priceModal.value = false
+}
 
+//菜单的右键菜单被点击
+const contextMenuClick = ({key, item}) => {
+    console.log(item,'item');
+    menuKey.value = item?.id
+  
+    if (key === 'edit') {
+        openpriceEdit(2)
+        menuKey.value = item?.id
+        priceform.value.dictName=item.dictName
+    } else if (key === 'del') {
+        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 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 tableColumn = [
     {key: 'name', name: '审批岗位',align:'center'},
   
@@ -126,7 +240,21 @@ const tableColumn1 = [
     {key: 'name', name: '抄送信息',align:'center'},
   
 ]
-
+const getcheckData=async()=>{
+    const { error, code, data,msg } = await getParentList({
+        code:'dept_info',
+        type:11
+       
+    })
+    if (!error && code === 200) {
+        checkData.value = getArrValue(data['records'])
+        
+    } 
+    else {
+        checkData.value =[]
+        window.$message?.warning(msg)
+    }
+}
 const checkData = ref([
     {name: '部门经理', },
     {name: '财务', },

+ 151 - 57
src/views/system/components/tab-cost.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>
@@ -56,53 +56,58 @@
                 </HcCardItem>
             </div>
         </div>
-        <template #action>
-            <HcPages :pages="searchForm" @change="pageChange"/>
-        </template>
+ 
     </HcCard>
 </template>
 
 <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 +122,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 +157,8 @@ const priceModal = ref(false)
 const openpriceEdit = (type) => {
     if (type === 1) {
         priceTitle.value = '新增分类'
+        priceform.value={}
+        menuKey.value=''
     } else {
         priceTitle.value = '编辑分类'
     }
@@ -153,14 +172,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,46 +198,112 @@ 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: '',
     type: '',
 })
 
-const searchForm = ref({
-    postType: '', name: '',
-    current: 1, size: 20, total: 0
-})
-//分页被点击
-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:tabsType.value,
+       
+    })
+    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 {
+        menuOptions.value =[]
+        window.$message?.warning(msg)
+    }
+}
+//获取二级科目
+const getChildListData=async()=>{
+    tableLoaing.value=true
+    const { error, code, data,msg } = await getChildList({
+        parentId: menuItem.value.id,
+        type:tabsType.value,
+    })
+    tableLoaing.value=false
+    if (!error && code === 200) {
+        tableData.value=getArrValue(data)
+        // tab.value = getArrValue(data['records'])
+    } 
+    else {
+        window.$message?.warning(msg)
+    }
 }
 </script>
 
@@ -281,4 +376,3 @@ const pageChange = ({current, size}) => {
     }
 }
 </style>
-

+ 130 - 60
src/views/system/components/tab-other.vue

@@ -3,10 +3,10 @@
    <HcCard>
     <template #header>
           <div class="w-48">
-                <el-input v-model="searchForm.queryValue1" clearable placeholder="请输入字典名称进行查询" size="large"/>
+                <el-input v-model="searchForm.dictName" clearable placeholder="请输入字典名称进行查询" size="large"/>
             </div>
             <div class="w-48 ml-2">
-                <el-input v-model="searchForm.queryValue2" clearable placeholder="请输入字典编号进行查询" size="large"/>
+                <el-input v-model="searchForm.code" clearable placeholder="请输入字典编号进行查询" size="large"/>
             </div>
             <div class="ml-4">
                 <el-button type="primary" @click="searchClick" size="large">
@@ -29,28 +29,26 @@
                 </el-button>
          </div>
          <div class="ml-2">
-                <el-button type="primary" @click="batcheditClick" size="large">
+                <el-button type="primary" @click="delModal" size="large">
                     <HcIcon name="delete-bin-2"/>
                     <span>删除</span>
                 </el-button>
         </div>
       </template>
-      <HcTable :column="tableColumn" :datas="tableData" isCheck @selection-change="tableSelectionChange">
+      <HcTable :column="tableColumn" :datas="tableData" isCheck @selection-change="tableSelectionChange" :loading="tableLoaing">
             <template #name="{row}">{{ row['name'] }}</template>
             <template #text="{row}">{{ row['text'] }}</template>
             <template #color="{row}">{{ row['color'] }}</template>
             <template #action="{row, index}">
-                <el-button size="small" type="primary" @click="eidtModal">编辑</el-button>
-                <el-button size="small" type="primary" @click="delModal">删除</el-button>
+                <el-button size="small" type="primary" @click="eidtModal(row)">编辑</el-button>
+                <el-button size="small" type="primary" @click="delModal(row)">删除</el-button>
                 <el-button size="small" type="primary" @click="configModalclick">字典配置</el-button>
                 
             </template>
         </HcTable>
-        <template #action>
-            <HcPages :pages="searchForm" @change="pageChange"></HcPages>
-        </template>
+
         <!-- 新增编辑字典 -->
-        <HcDialog bgColor="#ffffff" isToBody  :show="codeModal" :title="codeModalTitle" @close="codeModalClose"  widths="62rem" >
+        <HcDialog bgColor="#ffffff" isToBody  :show="codeModal" :title="codeModalTitle" @close="codeModalClose"  widths="62rem"  @save="saveparentClick">
             <el-form label-position="left" label-width="auto" :model="formcode" :rules="formUserRules" size="large">
                 <el-row :gutter="20">
                     <el-col :span="24">
@@ -59,13 +57,13 @@
                         </el-form-item>
                     </el-col>
                     <el-col :span="12">
-                        <el-form-item label="字典名称:"  prop="name">
-                            <el-input v-model="formcode.name"/>
+                        <el-form-item label="字典名称:"  prop="dictName">
+                            <el-input v-model="formcode.dictName"/>
                         </el-form-item>
                     </el-col>
                     <el-col :span="12" v-if="isConfigedit">
-                        <el-form-item label="上级字典:"  prop="parent">
-                            <el-select v-model="formcode.parent" class="m-2" placeholder="请选择" size="large" style="width: 100%;">
+                        <el-form-item label="上级字典:"  prop="parentId">
+                            <el-select v-model="formcode.parentId" class="m-2" placeholder="请选择" size="large" style="width: 100%;">
                                     <el-option
                                     v-for="item in parentoptions"
                                     :key="item.value"
@@ -86,7 +84,7 @@
                             />
                         </el-form-item>
                     </el-col>
-                    <el-col :span="12">
+                    <!-- <el-col :span="12">
                         <el-form-item label="封存:" prop="isstorage">
                             <el-switch
                                 v-model="formcode.isstorage"
@@ -100,12 +98,8 @@
                         <el-form-item label="字典备注:">
                             <el-input v-model="formcode.price"/>
                         </el-form-item>
-                    </el-col>
+                    </el-col> -->
                 </el-row>
-          
-            
-             
-         
             </el-form>
         </HcDialog>
         <!-- 字典配置 -->
@@ -158,72 +152,148 @@
                     
                 </template>
             </HcTable>
-        <template #action>
-            <HcPages :pages="searchForm" @change="configpageChange"></HcPages>
-        </template>
+       
         </HcDialog>
    </HcCard>
 </template>
 
 <script setup>
-import {ref, watch} from  'vue'
 
+import {onMounted, ref, watch} from "vue";
+import {submitDictionary,removeDictionary,getParentList,getChildList} from '~api/system/parameter.js';
+import {getArrValue,arrToId} 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(() => {
+    getTableData()
+   
+   
+})
 //搜索表单
 const searchForm = ref({
-    projectType: null, user: null, project: null,
-    current: 1, size: 20, total: 0
 })
-const getTableData=()=>{
-
+const tableLoaing=ref(false)
+const getTableData=async()=>{
+    tableLoaing.value=true
+    const { error, code, data,msg } = await getParentList({
+        type:tabsType.value,
+        code:searchForm.value?.code||'',
+        dictName:searchForm.value?.dictName||'',
+       
+    })
+    tableLoaing.value=false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data['records'])
+    } 
+    else {
+        tableData.value =[]
+        window.$message?.warning(msg)
+    }
 }
 //搜索
 const searchClick = () => {
-    searchForm.value.current = 1;
     getTableData()
 }
 
 //重置搜索表单
 const resetClick = () => {
-    searchForm.value = {current: 1, size: 20, total: 0}
+    searchForm.value = {}
+    getTableData()
+   
 }
 const addClick=()=>{
+    formcode.value={}
   codeModal.value=true
 }
+//新增一级科目
+const saveparentClick=async()=>{
+    const { error, code, data,msg } = await submitDictionary({
+        type:tabsType.value,
+        dictName:formcode.value?.dictName,
+        code:formcode.value?.code,
+        id:formcode.value?.id||null,
+        sort:formcode.value?.sort||null,
+    })
+   
+    if (!error && code === 200) {
+        window.$message?.success(msg)
+        codeModal.value=false
+        getTableData()
+    } 
+    else {
+        window.$message?.warning(msg)
+    }
+}
 const batcheditClick=()=>{
   
 }
 
-//分页被点击
-const pageChange = ({current, size}) => {
-    searchForm.value.current = current
-    searchForm.value.size = size
-}
+
 
 const tableColumn = [
-    {key: 'key1', name: '字典编号'},
-    {key: 'key2', name: '字典名称'},
-    {key: 'key3', name: '封存'},
-   
+    {key: 'code', name: '字典编号'},
+    {key: 'dictName', name: '字典名称'},
     {key: 'action', name: '操作', width:250}
 
 ]
-const tableData = ref([
-    {key1: '名称1', key2: '文本1', key3: 'red'},
-    {key1: '名称1', key2: '文本1', key3: 'red'},
-    {key1: '名称1', key2: '文本1', key3: 'red'},
-])
+const tableData = ref([])
 const tableCheckedKeys = ref([]);
 const tableSelectionChange = (rows) => {
     tableCheckedKeys.value = rows
-    if (tableCheckedKeys.value.length > 1) {
-        window.$message.warning('只能选择一条数据')
-    }
+  
 }
-const eidtModal=()=>{
-
+const eidtModal=(row)=>{
+    formcode.value=row
+    codeModal.value=true
 }
-const delModal=()=>{
-  
+const delbtnloading=ref(false)
+const delModal=(item)=>{
+    const rows = tableCheckedKeys.value;
+    const ids = arrToId(rows)
+    delbtnloading.value=true
+    window?.$messageBox?.alert('您确定要删除该信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
+            showCancelButton: true,
+            confirmButtonText: '确认注销',
+            cancelButtonText: '取消',
+            type: 'warning',
+            callback: async(action) => {
+                if (action === 'confirm') {
+                        const {error, code, msg} = await removeDictionary({
+                            ids: ids||item.id,
+                        })
+                        delbtnloading.value=false
+                        if (!error && code === 200) {
+                            window?.$message?.success('删除成功')
+                            getTableData()
+                        } else {
+                            window?.$message?.warning(msg)
+                        }
+                }
+            }
+        })
 }
 
 const codeModal=ref(false)
@@ -235,22 +305,22 @@ const formcode=ref({})
 const formUserRules = {
     code: {
         required: true,
-        trigger: "blur"
+        trigger: "blur",
+        message: "请输入字典编号"
     },
-    name: {
+    dictName: {
         required: true,
-        trigger: "blur"
+        trigger: "blur",
+        message: "请输入字典名称"
     },
     sort: {
         required: true,
-        trigger: "blur"
+        trigger: "blur",
+        message: "请输入字典排序"
     },
-    isstorage:{
-        required: true,
-        trigger: "blur"
-    }
+ 
 }
-const handleSortChange=()=>{
+const handleSortChange=(value)=>{
     console.log(value)
 }
 //字典配置

+ 84 - 40
src/views/system/components/tab-price.vue

@@ -8,20 +8,18 @@
         </template>
         <HcTable :column="positiontableColumn" :datas="positiontableData">
             <template #action="{row, index}">
-                <el-button size="small" type="primary" @click="positionEdit(2)">编辑</el-button>
-                <el-button size="small" type="primary" @click="delTaskposition">删除</el-button>
+                <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>
-        <template #action>
-            <HcPages :pages="searchForm" @change="pageChange"></HcPages>
-        </template>
-        <HcDialog bgColor="#ffffff" isToBody widths="24rem" :show="positonModal" :title="positonModalTitle" @close="positonModalClose">
+
+        <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.name"/>
+                    <el-input v-model="formposition.dictName"/>
                 </el-form-item>
                 <el-form-item label="日单价:">
-                    <el-input v-model="formposition.price"/>
+                    <el-input v-model="formposition.dictValue" oninput="value=value.replace(/[^\d]/g,'')"/>
                 </el-form-item>
             </el-form>
         </HcDialog>
@@ -29,57 +27,78 @@
 </template>
 
 <script setup>
-import {ref, watch} from "vue";
-
+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,
-], ([key]) => {
+    props.type,
+], ([key,type]) => {
     tabsKey.value = key
-    console.log(key)
+    tabsType.value = type
 })
 
-
-const searchForm = ref({
-    postType: '', name: '',
-    current: 1, size: 20, total: 0
+onMounted(() => {
+    getParentListData()
+   
 })
-//分页被点击
-const pageChange = ({current, size}) => {
-    searchForm.value.current = current
-    searchForm.value.size = size
+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: 'name', name: '岗位类型名称'},
-    {key: 'text', name: '日单价'},
+    {key: 'dictName', name: '岗位类型名称'},
+    {key: 'dictValue', name: '日单价'},
     {key: 'action', name: '操作', width: 200}
 ]
 
 
-const positiontableData = ref([
-    {name: '名称1', text: '文本1', color: 'red'},
-    {name: '名称2', text: '文本2', color: 'blue'},
-    {name: '名称3', text: '文本3', color: '无'}
-])
+const positiontableData = ref([])
 
 const positonModal = ref(false)
 const positonModalTitle = ref('')
-
-const positionEdit = (type) => {
+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
 }
@@ -89,18 +108,43 @@ const positonModalClose = () => {
 }
 
 const formposition = ref({})
-
-const delTaskposition = () => {
-    window?.$messageBox?.alert('您确定要删除该岗位单价吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-        showCancelButton: true,
-        confirmButtonText: '确认注销',
-        cancelButtonText: '取消',
-        type: 'warning',
-        callback: (action) => {
-            if (action === 'confirm') {
-                console.log(11111);
+//新增编辑提交
+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>

+ 4 - 13
src/views/system/components/tab-pricetype.vue

@@ -56,9 +56,7 @@
                 </HcCardItem>
             </div>
         </div>
-        <template #action>
-            <HcPages :pages="searchForm" @change="pageChange"/>
-        </template>
+ 
     </HcCard>
 </template>
 
@@ -236,15 +234,7 @@ const formLabelAlign = ref({
     type: '',
 })
 
-const searchForm = ref({
-    postType: '', name: '',
-    current: 1, size: 20, total: 0
-})
-//分页被点击
-const pageChange = ({current, size}) => {
-    searchForm.value.current = current
-    searchForm.value.size = size
-}
+
 //新增一级科目
 const saveparentClick=async()=>{
     const { error, code, data,msg } = await submitDictionary({
@@ -283,7 +273,7 @@ const savechilidClick=async()=>{
 //获取一级科目
 const getParentListData=async()=>{
     const { error, code, data,msg } = await getParentList({
-        type:1,
+        type:tabsType.value,
        
     })
     if (!error && code === 200) {
@@ -295,6 +285,7 @@ const getParentListData=async()=>{
         }
     } 
     else {
+        menuOptions.value =[]
         window.$message?.warning(msg)
     }
 }

+ 83 - 36
src/views/system/components/tab-reimbursement.vue

@@ -6,19 +6,17 @@
                 <HcIcon name="add"/>
             </el-button>
         </template>
-        <HcTable :column="positiontableColumn" :datas="positiontableData">
+        <HcTable :column="positiontableColumn" :datas="positiontableData" :loading="tableLoaing">
             <template #action="{row, index}">
-                <el-button size="small" type="primary" @click="positionEdit(2)">编辑</el-button>
-                <el-button size="small" type="primary" @click="delTaskposition">删除</el-button>
+                <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>
-        <template #action>
-            <HcPages :pages="searchForm" @change="pageChange"></HcPages>
-        </template>
-        <HcDialog bgColor="#ffffff" isToBody widths="24rem" :show="positonModal" :title="positonModalTitle" @close="positonModalClose">
+   
+        <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.name"/>
+                    <el-input v-model="formposition.dictName"/>
                 </el-form-item>
         
             </el-form>
@@ -27,77 +25,126 @@
 </template>
 
 <script setup>
-import {ref, watch} from "vue";
-
+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,
-], ([key]) => {
+    props.type,
+], ([key,type]) => {
     tabsKey.value = key
-    console.log(key)
+    tabsType.value = type
 })
 
-
-const searchForm = ref({
-    postType: '', name: '',
-    current: 1, size: 20, total: 0
+onMounted(() => {
+    getParentListData()
+   
 })
-//分页被点击
-const pageChange = ({current, size}) => {
-    searchForm.value.current = current
-    searchForm.value.size = size
+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: 'name', name: '报销类型名称'},
+    {key: 'dictName', name: '报销类型名称'},
     {key: 'action', name: '操作', width: 200}
 ]
 
 
 const positiontableData = ref([
-    {name: '名称1', text: '文本1', color: 'red'},
-    {name: '名称2', text: '文本2', color: 'blue'},
-    {name: '名称3', text: '文本3', color: '无'}
+   
 ])
 
 const positonModal = ref(false)
 const positonModalTitle = ref('')
-
-const positionEdit = (type) => {
+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 delTaskposition = () => {
-    window?.$messageBox?.alert('您确定要删除该岗位单价吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-        showCancelButton: true,
-        confirmButtonText: '确认注销',
-        cancelButtonText: '取消',
-        type: 'warning',
-        callback: (action) => {
-            if (action === 'confirm') {
-                console.log(11111);
+//新增编辑提交
+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>

+ 87 - 48
src/views/system/components/tab-tasktype.vue

@@ -6,32 +6,25 @@
                 <HcIcon name="add"/>
             </el-button>
         </template>
-        <!-- <template #extra>
-            <div style="float: right;">
-                <el-button size="large" type="primary">
-                    <HcIcon name="save"/>
-                    <span>保存</span>
-                </el-button>
-            </div>
-        </template> -->
-        <HcTable :column="tasktableColumn" :datas="tasktableData">
+        <HcTable :column="tasktableColumn" :datas="tasktableData" :loading="tableLoaing">
+            <template #dictValue="{row}">
+                        <div >{{row?.dictValue==='1'?'固定任务':'临时任务'}}</div>
+            </template>
             <template #action="{row, index}">
-                <el-button size="small" type="primary" @click="openTypeEdit(2)">编辑</el-button>
-                <el-button size="small" type="primary" @click="delTasktype">删除</el-button>
+                <el-button size="small" type="primary" @click="openTypeEdit(2,row)">编辑</el-button>
+                <el-button size="small" type="primary" @click="delTasktype(row)">删除</el-button>
             </template>
         </HcTable>
-        <template #action>
-            <HcPages :pages="searchForm" @change="pageChange"></HcPages>
-        </template>
+     
 
         <!--任务类型弹窗-->
-        <HcDialog bgColor="#ffffff" isToBody widths="24rem" :show="tasktypeModal" :title="taskTypeTitle" @close="taskTypeModalClose">
+        <HcDialog bgColor="#ffffff" isToBody widths="24rem" :show="tasktypeModal" :title="taskTypeTitle" @close="taskTypeModalClose" @save="saveparentClick">
             <el-form label-position="top" :model="formtaskType" label-width="auto" size="large">
                 <el-form-item label="任务类型名称">
-                    <el-input v-model="formtaskType.name"/>
+                    <el-input v-model="formtaskType.dictName"/>
                 </el-form-item>
                 <el-form-item label="类型">
-                    <el-select v-model="formtaskType.type" class="block" placeholder="请选择">
+                    <el-select v-model="formtaskType.dictValue" class="block" placeholder="请选择">
                         <el-option v-for="item in typeoptions" :key="item.value" :label="item.label" :value="item.value"/>
                     </el-select>
                 </el-form-item>
@@ -42,57 +35,95 @@
 </template>
 
 <script setup>
-import {ref, watch} from "vue";
-
+import {onMounted, ref, watch} from "vue";
+import {submitDictionary,removeDictionary,getParentList,getChildList} from '~api/system/parameter.js';
+import {getArrValue} from "js-fast-way"
+onMounted(() => {
+    getParentListData()
+   
+})
 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
+    tabsType.value = type
     console.log(key)
 })
 
-const searchForm = ref({
-    postType: '', name: '',
-    current: 1, size: 20, total: 0
-})
-//分页被点击
-const pageChange = ({current, size}) => {
-    searchForm.value.current = current
-    searchForm.value.size = size
-}
 
 const tasktableColumn = [
-    {key: 'name', name: '任务类型名称'},
-    {key: 'text', name: '类型'},
+    {key: 'dictName', name: '任务类型名称'},
+    {key: 'dictValue', name: '类型'},
     {key: 'action', name: '操作', width: 200}
 ]
-const tasktableData = ref([
-    {name: '名称1', text: '文本1', color: 'red'},
-    {name: '名称2', text: '文本2', color: 'blue'},
-    {name: '名称3', text: '文本3', color: '无'}
-])
+const tasktableData = ref([])
 
 const taskTypeTitle = ref('')
 const tasktypeModal = ref(false)
-const openTypeEdit = (type) => {
+const editItem=ref({})
+const openTypeEdit = (type,row) => {
     if (type === 1) {
         taskTypeTitle.value = '新增任务'
+        formtaskType.value={}
+        editItem.value={}
     } else {
         taskTypeTitle.value = '编辑任务'
+        editItem.value=row
+        formtaskType.value=row
     }
     tasktypeModal.value = true
 }
 
+//新增一级科目
+const saveparentClick=async()=>{
+    const { error, code, data,msg } = await submitDictionary({
+        type:tabsType.value,
+        dictValue:formtaskType.value?.dictValue,
+        dictName:formtaskType.value?.dictName,
+        id:editItem.value.id||null
+      
+    })
+    tasktypeModal.value=false
+    if (!error && code === 200) {
+        window.$message?.success(msg)
+        getParentListData()
+    } 
+    else {
+        window.$message?.warning(msg)
+    }
+}
+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) {
+        tasktableData.value = getArrValue(data['records'])
+       
+    } 
+    else {
+        tasktableData.value=[]
+        window.$message?.warning(msg)
+    }
+}
 const formtaskType = ref({})
 const typeoptions = ref([
     {
@@ -109,18 +140,26 @@ const taskTypeModalClose = () => {
     tasktypeModal.value = false
 }
 
-const delTasktype = () => {
-    window?.$messageBox?.alert('您确定要删除该任务分类吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-        showCancelButton: true,
-        confirmButtonText: '确认注销',
-        cancelButtonText: '取消',
-        type: 'warning',
-        callback: (action) => {
-            if (action === 'confirm') {
-                console.log(11111);
+const delTasktype = (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)
+                        }
+                }
             }
-        }
-    })
+        })
 }
 </script>
 

+ 1 - 1
src/views/system/parameter.vue

@@ -19,7 +19,7 @@
             <TabApprove :cur="tabsKey" :type="6"/>
         </template>
         <template #tab-other>
-            <TabOther :cur="tabsKey" :type="7"/>
+            <TabOther :cur="tabsKey" :type="11"/>
         </template>
     </HcTabsSimple>
 </template>