Browse Source

修改文件

ZaiZai 9 months ago
parent
commit
9b39196263
5 changed files with 43 additions and 16 deletions
  1. 1 1
      package.json
  2. 2 1
      src/config/index.json
  3. 1 1
      src/views/system/modules/user/data.vue
  4. 35 9
      src/views/system/user.vue
  5. 4 4
      yarn.lock

+ 1 - 1
package.json

@@ -19,7 +19,7 @@
         "dayjs": "^1.11.11",
         "echarts": "^5.5.0",
         "element-plus": "2.7.4",
-        "hc-vue3-ui": "^3.9.7",
+        "hc-vue3-ui": "^3.9.8",
         "js-base64": "^3.7.7",
         "js-fast-way": "^0.5.0",
         "js-md5": "^0.8.3",

+ 2 - 1
src/config/index.json

@@ -1,6 +1,7 @@
 {
     "version": "20230607160059",
-    "target": "http://39.108.216.210:8090",
+    "target1": "http://39.108.216.210:8090",
+    "target": "http://192.168.0.109:8090",
     "vite": {
         "port": 5188,
         "host": "0.0.0.0"

+ 1 - 1
src/views/system/modules/user/data.vue

@@ -455,7 +455,7 @@ const dialogSubmit = async () => {
     submitLoading.value = true
     const form = formModel.value
     let res = {}
-    if (isNullES(form)) {
+    if (isNullES(form.id)) {
         res = await mainApi.add(form)
     } else {
         res = await mainApi.up(form)

+ 35 - 9
src/views/system/user.vue

@@ -1,8 +1,11 @@
 <template>
     <hc-body split>
         <template #left>
-            <hc-card scrollbar>
-                <hc-lazy-tree :is-root-expand="false" :h-props="treeProps" tree-key="id" @load="treeLoadNode" @node-tap="treeNodeTap">
+            <hc-card title="部门树" scrollbar>
+                <template #extra>
+                    <el-button hc-btn type="primary" :disabled="isNullES(searchForm.deptId)" @click="clearSearchDeptId">清空选择</el-button>
+                </template>
+                <hc-lazy-tree ref="lazyTreeRef" :is-root-expand="false" :h-props="treeProps" tree-key="id" @load="treeLoadNode" @node-tap="treeNodeTap">
                     <template #default="{ node }">{{ node.label }}</template>
                 </hc-lazy-tree>
             </hc-card>
@@ -26,7 +29,7 @@
                 </div>
             </template>
             <template #extraToHeader>
-                <el-button hc-btn type="primary">新增</el-button>
+                <el-button hc-btn type="primary" @click="addUserClick">新增</el-button>
                 <el-button hc-btn type="danger">删除</el-button>
                 <el-button hc-btn type="info">角色配置</el-button>
                 <el-button hc-btn type="warning">密码重置</el-button>
@@ -56,11 +59,11 @@
 
 <script setup>
 import { onActivated, ref } from 'vue'
-import { getArrValue } from 'js-fast-way'
-import deptApi from '~api/system/dept'
+import { getArrValue, isNullES } from 'js-fast-way'
 import { getDictionaryData } from '~uti/tools'
-import mainApi from '~api/system/user'
 import HcDataDialog from './modules/user/data.vue'
+import deptApi from '~api/system/dept'
+import mainApi from '~api/system/user'
 
 onActivated(()=> {
     getUserTypeData()
@@ -69,7 +72,7 @@ onActivated(()=> {
 
 //搜索表单
 const searchFormType = ref('account')
-const searchFormName = ref('pengct')
+const searchFormName = ref('')
 const searchForm = ref({ deptId: null, current: 1, size: 30, total: 0 })
 
 //获取用户平台
@@ -79,6 +82,7 @@ const getUserTypeData = async () => {
 }
 
 //数据格式
+const lazyTreeRef = ref(null)
 const treeProps = {
     label: 'title',
     children: 'children',
@@ -98,6 +102,13 @@ const treeNodeTap = ({ data }) => {
     searchClick()
 }
 
+//清空树节点选择
+const clearSearchDeptId = () => {
+    searchForm.value.deptId = null
+    lazyTreeRef.value?.treeRef?.setCurrentKey(null)
+    searchClick()
+}
+
 //搜索
 const searchClick = () => {
     searchForm.value.current = 1
@@ -147,17 +158,32 @@ const tableCheckChange = (rows) => {
     tableCheckKeys.value = rows
 }
 
+//新增修改用户
 const isUserDataShow = ref(false)
+const userItem = ref({})
+
+//新增用户
+const addUserClick = () => {
+    userItem.value = {}
+    isUserDataShow.value = true
+}
 
 //修改账号
-const userItem = ref({})
 const editRowClick = (row) => {
     userItem.value = row
     isUserDataShow.value = true
 }
 
 //删除账号
-const delRowClick = () => {
+const delRowClick = async ({ item }, resolve) => {
+    await delUserData(item.id)
+    resolve()
+}
 
+//删除用户
+const delUserData = async (id) => {
+    const { isRes } = await mainApi.del(id)
+    if (!isRes) return
+    window.$message.success('删除成功')
 }
 </script>

+ 4 - 4
yarn.lock

@@ -2069,10 +2069,10 @@ has-flag@^4.0.0:
   resolved "http://39.108.216.210:9000/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
   integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
 
-hc-vue3-ui@^3.9.7:
-  version "3.9.7"
-  resolved "http://39.108.216.210:9000/hc-vue3-ui/-/hc-vue3-ui-3.9.7.tgz#9f333e8f1c4380451d6b53b02b35bc427c568b0b"
-  integrity sha512-Mo8Dyq6jWzJ7HJCmO7B8jUhmEcY/VkjsTC9Xj9Vgixmoxcw/L8pyMyBAwy9QcfcopwRJ3DNWgwhybOPb7BTHRg==
+hc-vue3-ui@^3.9.8:
+  version "3.9.8"
+  resolved "http://39.108.216.210:9000/hc-vue3-ui/-/hc-vue3-ui-3.9.8.tgz#49015f20f4c6dca6cbd739b955606c177443322b"
+  integrity sha512-0yNp2a7dKmQocCwAEY+6qWpoo/C+Mt1Ga11Y72xpgnJdCDr4pfHtBRrryOVYomEWQ1NepH2Pn3MVUcHkjjJSDA==
   dependencies:
     axios "^1.7.2"
     dayjs "^1.11.11"