wzdxx1314@163.com hai 1 ano
pai
achega
be6710273c

+ 12 - 0
src/api/api.js

@@ -73,6 +73,9 @@ export default {
   login(params) {
     return fetch('api/system/login', params)
   },
+  getUserInfo(params) {
+    return fetch('/api/system/getUserInfo', params,'get')
+  },
   getCaptcha(params) {
     return fetch('/api/system/captcha', params, 'get')
   },
@@ -85,6 +88,12 @@ export default {
   addUser(params) {
     return fetch('/sysUser', params, 'post')
   },
+  editUser(params) {
+    return fetch('/sysUser', params, 'put')
+  },
+  getUserDetial(params) {
+    return fetch('/sysUser/' + params.id, params, 'get')
+  },
   deleteUser(params) {
     return fetch('/sysUser?id=' + params.id, params, 'delete')
   },
@@ -135,6 +144,9 @@ export default {
   getWorkPointList(params) {
     return fetch('/workAddr', params, 'get')
   },
+  getWorkClockList(params) {
+    return fetch('/workClock', params, 'get')
+  },
   deleteWorkPoint(params) {
     return fetch('/workAddr?id=' + params.id, params, 'delete')
   },

+ 10 - 3
src/components/navbar/Navbar.vue

@@ -35,7 +35,8 @@
 </template>
 
 <script setup>
-  import { computed } from 'vue'
+
+  import { computed,getCurrentInstance,ref } from 'vue'
   import { storeToRefs } from 'pinia'
   import { useGlobalStore } from '../../stores/global-store'
   import { useI18n } from 'vue-i18n'
@@ -43,14 +44,20 @@
   import VuesticLogo from '../VuesticLogo.vue'
   import VaIconMenuCollapsed from '../icons/VaIconMenuCollapsed.vue'
   import AppNavbarActions from './components/AppNavbarActions.vue'
-
+  const { proxy } = getCurrentInstance()
+  const { $api} = proxy
   const GlobalStore = useGlobalStore()
   const { t } = useI18n()
 
-  const { isSidebarMinimized, userName } = storeToRefs(GlobalStore)
+  const { isSidebarMinimized } = storeToRefs(GlobalStore)
 
   const { getColors } = useColors()
   const colors = computed(() => getColors())
+  let userName = ref('')
+  $api.getUserInfo().then(res=>{
+    console.log(res)
+    userName.value = res.result.name
+  })
 </script>
 
 <style lang="scss" scoped>

+ 1 - 1
src/pages/attendanceSetting/attendancePoint/index.vue

@@ -57,7 +57,7 @@
       },
       getTime(time){
         if(time){
-          return moment(new Date(parseInt(time))).format('hh:mm:ss')
+          return moment(new Date(parseInt(time))).format('HH:mm:ss')
         }else{
           return '-'
         }

+ 71 - 56
src/pages/attendanceSetting/attendanceRecord/index.vue

@@ -1,31 +1,38 @@
 <template>
   <div class="workSpace">
-    <searchForm :keys="['userName']"> </searchForm>
+    <searchForm ref='searchForm' :keys="['userName']" @on-search='onSearch'> </searchForm>
     <VaCard tag="b" class="table">
       <div class="va-table-responsive">
-        <table class="va-table">
-          <thead>
-            <tr>
-              <th>人员姓名</th>
-              <th>打卡时间</th>
-              <th>打卡地点</th>
-              <th>考勤状态</th>
-            </tr>
-          </thead>
-          <tbody>
-            <tr v-for="user in users" :key="user.id">
-              <td>{{ user.fullName }}</td>
-              <td>{{ user.email }}</td>
-              <td>{{ user.country }}</td>
-              <td>
-                <VaBadge :text="user.text" :color="user.status" />
-              </td>
-            </tr>
-          </tbody>
-        </table>
+        <VaDataTable :items="users" :columns="columns" :loading="loading">
+          <template #cell(clockTime)="{ value }">
+            {{getTime(value)}}
+          </template>
+          <template #cell(clockStatusName)="{ rowData }">
+            <VaBadge
+              v-if='rowData.clockStatus ==1'
+              :text="rowData.clockStatusName"
+              color="success"
+              class="mr-2"
+            />
+
+            <VaBadge
+              v-else
+              :text="rowData.clockStatusName"
+              color="danger"
+              class="mr-2"
+            />
+          </template>
+        </VaDataTable>
       </div>
       <div class="pagination">
-        <VaPagination v-model="page" :pages="15" :visible-pages="4" class="justify-center sm:justify-start" />
+        <VaPagination
+          @click="update"
+          v-model="pageInfo.pageNum"
+          :total="pageInfo.total"
+          :page-size="pageInfo.pageSize"
+          :visible-pages="4"
+          class="justify-center sm:justify-start"
+        />
       </div>
     </VaCard>
   </div>
@@ -33,48 +40,56 @@
 
 <script>
   import searchForm from '../module/searchForm.vue'
+  import dict from '../../../common/dict'
+  import moment from 'moment'
   export default {
     name: 'index',
     components: {
       searchForm,
     },
+    mounted() {
+      this.getList()
+    },
+    methods:{
+      onSearch(){
+        this.pageInfo.pageNum = 1
+        this.getList()
+      },
+      update(){
+        this.getList()
+      },
+      getTime(time){
+        return moment(new Date(parseInt(time))).format('yyyy-MM-DD HH:mm:ss')
+      },
+      getList(){
+        let params = {
+          pageNum: Math.ceil(this.pageInfo.pageNum / this.pageInfo.pageSize),
+          pageSize: this.pageInfo.pageSize,
+          userName: this.$refs.searchForm.form.userName,
+        }
+        if( this.$refs.searchForm.form.clockTime!=null){
+          params.clockTime = this.$refs.searchForm.form.clockTime.getTime()
+        }
+        this.$api.getWorkClockList(params).then(res=>{
+          this.users = res.result.records
+          this.pageInfo.total = res.result.total
+        })
+      },
+    },
     data() {
       return {
-        page: 3,
-        users: [
-          {
-            id: 1,
-            fullName: 'Ashley Mcdaniel',
-            email: '2024-01-06 10:00:00',
-            country: 'Cayman Islands',
-            status: 'warning',
-            text: '迟到',
-          },
-          {
-            id: 2,
-            fullName: 'Todd Sellers',
-            email: '2024-01-06 08:00:00',
-            country: 'Togo',
-            status: 'info',
-            text: '正常',
-          },
-          {
-            id: 3,
-            fullName: 'Sherman Knowles',
-            email: '2024-01-06 17:00:00',
-            country: 'Central African Republic',
-            status: 'warning',
-            text: '早退',
-          },
-          {
-            id: 4,
-            fullName: 'Vasquez Lawson',
-            email: '2024-01-06 08:00:00',
-            country: 'Bouvet Island',
-            status: 'info',
-            text: '正常',
-          },
+        pageInfo:{
+          ...dict.pageInfo
+        },
+        users:[],
+        columns:[
+          { key: 'name', label: '员工姓名' },
+          { key: 'clockAddr', label: '打卡地址' },
+          { key: 'clockTime', label: '打卡时间' },
+          { key: 'clockTypeName', label: '打卡类型' },
+          { key: 'clockStatusName', label: '打卡状态' },
         ],
+        loading:false
       }
     },
   }

+ 7 - 21
src/pages/attendanceSetting/module/searchForm.vue

@@ -2,8 +2,11 @@
   <va-card class="col-span-12">
     <!--    <va-card-title>测试</va-card-title>-->
     <div class="searchBox" @keypress="keypress">
-      <VaInput v-if="keys.includes('userName')" v-model="form.addrName" class="input" label="用户名" />
+      <VaInput v-if="keys.includes('userName')" v-model="form.userName" class="input" label="用户名" />
       <VaInput v-if="keys.includes('addrName')" v-model="form.addrName" class="input" label="考勤点名称" />
+      <div class='input'>
+        <VaDateInput label="打卡时间" v-model="form.clockTime" />
+      </div>
 
 <!--      <VaDateInput-->
 <!--        class="input"-->
@@ -33,14 +36,10 @@
 </template>
 
 <script>
-  const datePlusDay = (date, days) => {
-    const d = new Date(date)
-    d.setDate(d.getDate() + days)
-    return d
-  }
-  const nextWeek = datePlusDay(new Date(), 7)
   let defaultForm = {
-    addrName:''
+    addrName:'',
+    userName:'',
+    clockTime:null,
   }
   export default {
     name: 'searchForm',
@@ -51,7 +50,6 @@
     },
     data() {
       return {
-        value: { start: new Date(), end: nextWeek },
         form: {
           ...defaultForm
         },
@@ -67,18 +65,6 @@
         this.form = { ...defaultForm }
         this.$emit('on-search')
       },
-      formatDate(date) {
-        return `${date.getDate()}/${date.getMonth() + 1}/${date.getFullYear()}`
-      },
-
-      parseDate(text) {
-        const [day, month, year] = text.split('/')
-
-        return new Date(year, month - 1, day)
-      },
-      format(date) {
-        return ` ${date.getFullYear()}-${date.getMonth() + 1}`
-      },
     },
   }
 </script>

+ 4 - 1
src/pages/system/module/orgTree.vue

@@ -11,7 +11,7 @@
       <template #content="node">
         <div class="flex items-center" style="cursor: pointer" @click="goSelect(node)">
           <span>{{ node.orgName }}</span>
-          <VaBadge v-if="selectNode == node.id" text="选中" color="success" class="mr-2" />
+          <VaBadge v-if="selectNode == node.id" text="选中" color="success" class="mr-2 marginl-10" />
         </div>
       </template>
     </VaTreeView>
@@ -77,4 +77,7 @@
       align-items: center;
     }
   }
+  .marginl-10{
+    margin-left: 10px;
+  }
 </style>

+ 16 - 0
src/pages/system/module/searchForm.vue

@@ -5,6 +5,10 @@
       <VaInput v-if="keys.includes('userName')" v-model="form.userName" class="input" label="用户名" />
       <VaInput v-if="keys.includes('roleName')" class="input" :round="false" v-model="form.roleName" label="角色名称" />
       <VaInput v-if="keys.includes('orgName')" class="input" :round="false" v-model="form.orgName" label="部门名称" />
+      <div class='input' v-if="keys.includes('roleId')" >
+        <VaSelect label="角色" class="input"  v-model="form.roleId" :options="roleList" :textBy="'roleName'" multiple :valueBy="'id'" />
+      </div>
+
       <div class="btn-box">
         <VaButton :round="false" icon="search" @click="$emit('on-search')"> 搜索</VaButton>
         <VaButton
@@ -28,6 +32,7 @@
     userName: '',
     roleName: '',
     orgName: '',
+    roleId:[]
   }
   export default {
     name: 'searchForm',
@@ -36,12 +41,22 @@
         default: () => [],
       },
     },
+    mounted() {
+      if(this.keys.includes('roleId')){
+        this.getRoleList()
+      }
+    },
     methods: {
       keypress(v) {
         if (v.keyCode == 13) {
           this.$emit('on-search')
         }
       },
+      getRoleList() {
+        this.$api.getRoleList({ pageNum: 1, pageSize: 1000 }).then((res) => {
+          this.roleList = res.result.records
+        })
+      },
       clear() {
         this.form = { ...defaultForm }
         this.$emit('on-search')
@@ -49,6 +64,7 @@
     },
     data() {
       return {
+        roleList: [],
         form: {
           ...defaultForm,
         },

+ 1 - 1
src/pages/system/orgManage/module/addOrgBtn.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="addUserBtn">
     <VaButton preset="secondary" size="small" :round="false" @click="showModal = true"> 新增部门 </VaButton>
-    <VaModal :modelValue="showModal" blur @ok="submit" @cancel="showModal = false" ok-text="提交" cancelText="取消">
+    <VaModal :modelValue="showModal" :noDismiss="true" blur @ok="submit" @cancel="showModal = false" ok-text="提交" cancelText="取消">
       <h3 class="va-h3">部门信息</h3>
       <orgForm ref="orgForm"></orgForm>
     </VaModal>

+ 1 - 1
src/pages/system/roleManage/module/addRoleBtn.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="opBtn">
     <VaButton :round="false" color="info" gradient @click="showModal = true"> 新增角色</VaButton>
-    <VaModal :modelValue="showModal" :noDismiss="true" blur @ok="submit" ok-text="提交" cancelText="取消">
+    <VaModal :modelValue="showModal" :noDismiss="true" blur @cancel='showModal=false' @ok="submit" ok-text="提交" cancelText="取消">
       <h3 class="va-h3">角色信息</h3>
       <roleForm ref="roleForm"></roleForm>
     </VaModal>

+ 27 - 3
src/pages/system/userManage/module/editUserBtn.vue

@@ -1,11 +1,11 @@
 <template>
   <div class="editUserBtn opBtn">
-    <VaButton color="info" :round="false" size="small" class="mr-6 mb-2" icon="edit" @click="showModal = true">
+    <VaButton color="info" :round="false" size="small" class="mr-6 mb-2" icon="edit" @click="getUserDetial">
       修改信息
     </VaButton>
-    <VaModal v-model="showModal" :noDismiss="true" blur ok-text="提交" cancelText="取消">
+    <VaModal :modelValue="showModal" @ok='submit' :noDismiss="true" blur ok-text="提交" @cancel='showModal=false' cancelText="取消">
       <h3 class="va-h3">用户信息</h3>
-      <userForm></userForm>
+      <userForm ref='userForm'></userForm>
     </VaModal>
   </div>
 </template>
@@ -14,9 +14,33 @@
   import userForm from './userForm.vue'
   export default {
     name: 'editUserBtn',
+    props:{
+      params:{
+        default:()=>{}
+      }
+    },
     components: {
       userForm,
     },
+    methods:{
+      submit(){
+        let params = {
+          id:this.params.id,
+          ...this.$refs.userForm.getData()
+        }
+        this.$api.editUser(params).then(res=>{
+          this.$toast.success({message:res.message})
+          this.showModal = false
+          this.$emit('after-op')
+        })
+      },
+      getUserDetial(){
+        this.showModal = true
+        this.$api.getUserDetial({id:this.params.id}).then(res=>{
+          this.$refs.userForm.setData(res.result)
+        })
+      },
+    },
     data() {
       return {
         showModal: false,

+ 8 - 0
src/pages/system/userManage/module/userForm.vue

@@ -37,6 +37,14 @@
   export default {
     name: 'userForm',
     methods: {
+      setData(data){
+        Object.keys(this.form).forEach(x=>{
+          this.form[x] = data[x]
+        })
+        if(data.birthDate != null){
+          this.form.birthDate = new Date(parseInt(data.birthDate))
+        }
+      },
       getData() {
         return {
           ...this.form,

+ 12 - 40
src/pages/system/userManage/module/workSpace.vue

@@ -1,50 +1,16 @@
 <template>
   <div class="workSpace">
-    <searchForm :keys="['userName']" ref="searchForm" @on-search="onSearch"></searchForm>
+    <searchForm :keys="['userName','roleId']" ref="searchForm" @on-search="onSearch"></searchForm>
     <VaCard tag="b" class="table">
       <div class="va-table-responsive">
-        <!--        <table class="va-table">-->
-        <!--          <thead>-->
-        <!--          <tr>-->
-        <!--            <th>用户名称</th>-->
-        <!--            <th>联系方式</th>-->
-        <!--            <th>角色名称</th>-->
-        <!--            <th>状态</th>-->
-        <!--            <th>设置</th>-->
-        <!--          </tr>-->
-        <!--          </thead>-->
-        <!--          <tbody>-->
-        <!--          <tr-->
-        <!--            v-for="user in users"-->
-        <!--            :key="user.id"-->
-        <!--          >-->
-        <!--            <td>{{ user.userName }}</td>-->
-        <!--            <td>{{ user.userName }}</td>-->
-        <!--            <td>{{ user.userName }}</td>-->
-        <!--            <td>-->
-        <!--              <VaChip-->
-        <!--                size='small'-->
-        <!--                :color="'success'"-->
-        <!--                class="mr-6 mb-2"-->
-        <!--              >-->
-        <!--                使用中-->
-        <!--              </VaChip>-->
-        <!--            </td>-->
-        <!--            <td>-->
-        <!--              <editUserBtn></editUserBtn>-->
-        <!--              <deleteUserBtn></deleteUserBtn>-->
-        <!--            </td>-->
-        <!--          </tr>-->
-        <!--          </tbody>-->
-        <!--        </table>-->
-
         <VaDataTable :items="users" :columns="columns" :loading="loading">
           <template #cell(setting)="{ rowData }">
-            <editUserBtn :params="rowData"></editUserBtn>
-            <deleteUserBtn @after-op="afterOp" :params="rowData"></deleteUserBtn>
+            <editUserBtn :params="rowData"  @after-op="afterOp"></editUserBtn>
+            <deleteUserBtn  @after-op="afterOp" :params="rowData"></deleteUserBtn>
           </template>
           <template #cell(birthDate)="{ value }">
-            <VaChip size="small" :color="'success'" class="mr-6 mb-2"> {{value}} </VaChip>
+            {{value?getTime(value):'-'}}
+<!--            <VaChip size="small" :color="'success'" class="mr-6 mb-2"> {{value}} </VaChip>-->
           </template>
         </VaDataTable>
       </div>
@@ -66,6 +32,7 @@
   import editUserBtn from './editUserBtn.vue'
   import deleteUserBtn from './deleteUserBtn.vue'
   import dict from '../../../../common/dict'
+  import moment from 'moment'
   export default {
     name: 'workSpace',
     components: {
@@ -74,6 +41,9 @@
       deleteUserBtn,
     },
     methods: {
+      getTime(time){
+        return moment(new Date(parseInt(time))).format('yyyy-MM-DD')
+      },
       afterOp() {
         this.getList()
       },
@@ -88,6 +58,7 @@
           pageNum: this.pageInfo.pageNum,
           pageSize: this.pageInfo.pageSize,
           orgId: this.orgId || '',
+          roleIds: this.$refs.searchForm.form.roleId.join(','),
         }
         this.$api.getUserList(params).then((res) => {
           this.loading = false
@@ -105,9 +76,10 @@
         orgId: '',
         columns: [
           { key: 'userName', label: '用户名' },
+          { key: 'roleName', label: '角色' },
           { key: 'gender', label: '性别' },
           { key: 'phone', label: '联系方式' },
-          { key: 'status', label: '状态' },
+          { key: 'birthDate', label: '生日' },
           { key: 'setting', label: '设置' },
         ],
         pageInfo: {