PlatformTable.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <div class="form">
  3. <el-form ref="ruleFormRef" :model="ruleForm" inline label-width="60px">
  4. <!-- <el-form-item label="姓名:" prop="nickName" style="margin-top: 15px;">
  5. <el-input v-model="ruleForm.nickName" placeholder="请输入姓名!" style="width: 150px;"></el-input>
  6. </el-form-item>
  7. <el-form-item label="工号:" prop="staffNo" style="margin-top: 15px;">
  8. <el-input v-model="ruleForm.staffNo" placeholder="请输入工号!" style="width: 150px;"></el-input>
  9. </el-form-item> -->
  10. <el-input
  11. v-model="searchValue"
  12. style="max-width:251px;margin-right: 50px;"
  13. :placeholder="'请输入'+searchLabel"
  14. >
  15. <template #prepend>
  16. <el-select v-model="searchLabel" style="width: 70px">
  17. <el-option value="姓名" />
  18. <el-option value="工号" />
  19. </el-select>
  20. </template>
  21. </el-input>
  22. <el-form-item label="部门:" prop="dept" style="margin-bottom: 0;margin-right: 0;">
  23. <el-select v-model="ruleForm.dept" placeholder="请选择部门" style="width: 200px;">
  24. <el-option v-for="item in departmentList"
  25. :key="item.deptId"
  26. :value="item.deptName"
  27. :label="item.deptName">
  28. </el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-button type="primary" @click="submitForm(ruleFormRef)"
  32. style="width: 65px;height: 32px;position: absolute;right:134px">搜 索</el-button>
  33. <el-button @click="resetForm(ruleFormRef)"
  34. style="width: 65px; height: 32px;position: absolute;right:57px">重 置</el-button>
  35. </el-form>
  36. <el-table style="width: 100%;margin-top: 18px;" :data="tableData" stripe highlight-current-row
  37. :default-sort="{ prop: 'todayVisits', order: 'descending' }">
  38. <el-table-column label="姓名" prop="nickName" align="center"></el-table-column>
  39. <el-table-column label="工号" prop="staffNo" align="center"></el-table-column>
  40. <el-table-column label="部门" prop="deptName" align="center"></el-table-column>
  41. <el-table-column label="当日访问次数" prop="todayVisits" sortable align="right"></el-table-column>
  42. <el-table-column label="本月访问次数" prop="monthVisits" sortable align="right"></el-table-column>
  43. <el-table-column label="累计访问次数" prop="totalVisits" sortable align="right"></el-table-column>
  44. <el-table-column label="访问次数统计图" align="center">
  45. <img style="display: inline-block; margin-right: 20px;" src="@/assets/icons/chart-bar.png" alt="" />
  46. <img style="display: inline-block;" src="@/assets/icons/chart-line.png" alt="" />
  47. </el-table-column>
  48. </el-table>
  49. <!-- <el-pagination v-model="currentPage" v-model:currentPageSize="currentPageSize" :page-sizes="[10, 20, 50, 100, 200]"
  50. layout="->, total,sizes,prev,pager,next,jumper" :total="total" @size-change="handeSizeChange"
  51. @current-change="handleCurrentPageChange" /> -->
  52. </div>
  53. <!-- <TableEcharts v-model="dialogVisible" :dialog-visible="dialogVisible" :userId="userId"
  54. :current-day-chart="currentDayData" :current-month-chart="currentMonthData" :all-datas-chart="currentAllData"
  55. :close-dialog="closeDialog">
  56. </TableEcharts> -->
  57. </template>
  58. <script setup lang="ts">
  59. import { ref } from 'vue';
  60. import { FormInstance } from 'element-plus';
  61. import { DepartMentModel } from '@/api/datamanagement/dataplatform';
  62. // import { DepartMentModel, Records, Visits, VisitsModel, getDeptList } from '@/api/datamanagement/dataplatform';
  63. const searchLabel = ref('姓名');
  64. const searchValue = ref('');
  65. export interface TableModel {
  66. deptId: number,
  67. deptName: string,
  68. monthVisits: number,
  69. nickName: string,
  70. staffNo: string,
  71. todayVisits: number,
  72. totalVisits: number,
  73. userId: number,
  74. }
  75. const tableData = ref<TableModel[]>([
  76. { deptId: 1, deptName: '部门1', monthVisits: 1, nickName: '张三', staffNo: '10001', todayVisits: 1, totalVisits: 1, userId: 10014 },
  77. { deptId: 2, deptName: '部门2', monthVisits: 2, nickName: '李四', staffNo: '10002', todayVisits:2, totalVisits: 2, userId: 10014 },
  78. { deptId: 3, deptName: '部门3', monthVisits: 3, nickName: '王五', staffNo: '10003', todayVisits: 3, totalVisits: 3, userId: 10014 },
  79. { deptId: 4, deptName: '部门4', monthVisits: 4, nickName: '赵六', staffNo: '10004', todayVisits: 4, totalVisits: 4, userId: 10014 },
  80. { deptId: 5, deptName: '部门5', monthVisits: 5, nickName: '孙七', staffNo: '10005', todayVisits:5, totalVisits: 5, userId: 10014 },
  81. { deptId: 6, deptName: '部门6', monthVisits: 6, nickName: '周八', staffNo: '10006', todayVisits: 6, totalVisits: 6, userId: 10014 },
  82. { deptId: 7, deptName: '部门7', monthVisits: 7, nickName: '吴九', staffNo: '10007', todayVisits:7, totalVisits: 7, userId: 10014 },
  83. { deptId: 8, deptName: '部门8', monthVisits: 8, nickName: '郑十', staffNo: '10008', todayVisits: 8, totalVisits: 8, userId: 10014 },
  84. { deptId: 9, deptName: '部门9', monthVisits: 9, nickName: '王十一', staffNo: '10009', todayVisits:9, totalVisits: 9, userId: 10014 },
  85. { deptId: 10, deptName: '部门10', monthVisits: 10, nickName: '李十二', staffNo: '10010', todayVisits: 10, totalVisits: 10, userId: 10014 },
  86. { deptId: 11, deptName: '部门11', monthVisits: 11, nickName: '赵十三', staffNo: '10011', todayVisits: 11, totalVisits: 11, userId: 10014 },
  87. ])
  88. export interface FormModelCommon {
  89. dept: string,
  90. nickName: string,
  91. staffNo: string,
  92. }
  93. const ruleForm = ref<FormModelCommon>({
  94. dept: '',
  95. nickName: '',
  96. staffNo: '',
  97. })
  98. const ruleFormRef = ref<FormInstance>();
  99. const departmentList = ref<DepartMentModel[]>([]);
  100. // 搜索数据
  101. function submitForm(formE1: FormInstance | undefined) {
  102. console.log('搜索数据')
  103. if (!formE1) return
  104. // formE1.validate((valid, fields) => {
  105. // if (valid) {
  106. // getPersonalVisits(ruleForm.value)
  107. // }
  108. // else {
  109. // console.log('error submit!', fields);s
  110. // }
  111. // })
  112. }
  113. // 重置表单
  114. function resetForm(formE1: FormInstance | undefined) {
  115. console.log('重置表单');
  116. if (!formE1) return
  117. // formE1.resetFields()
  118. // console.log('resetForm')
  119. // queryData();
  120. }
  121. // const props = defineProps<{ type: string }>()
  122. // const props = defineProps<{
  123. // queryData: (d1: number, d2: number) => Promise<Visits<Records>>,
  124. // currentDayData: (d: number) => Promise<VisitsModel[]>,
  125. // currentMonthData: (d: number) => Promise<VisitsModel[]>,
  126. // currentAllData: (d: number) => Promise<VisitsModel[]>,
  127. // getPersonalVisits: (d1: number | undefined, d2: string, d3: number, d4: number, d5: string) => Promise<Visits<Records>>,
  128. // }>();
  129. // const dialogVisible = ref(false);//控制弹框显示
  130. // const currentPage = ref(1);
  131. // const currentPageSize = ref(10);
  132. // const total = ref(11);
  133. // const tableData = ref<TableModel[]>()
  134. // const userId = ref(10014);
  135. // const getDepartmentList = () => {
  136. // getDeptList().then((res) => {
  137. // departmentList.value = res;
  138. // console.log('department:', res)
  139. // });
  140. // };
  141. // 查询数据列表
  142. // async function queryData() {
  143. // const res = await props.queryData(currentPage.value, currentPageSize.value);
  144. // console.log('tablecommon-querydata:', res);
  145. // tableData.value = res.records;
  146. // console.log('tablecommon-querydata1:', tableData.value);
  147. // total.value = res.totalRow;
  148. // }
  149. // 根据指定参数查询数据-搜索数据
  150. // function queryDataByParams() {
  151. // props.queryDataByParams().then(res => {
  152. // console.log(res)
  153. // })
  154. // // emit('queryDataByParams', data);
  155. // }
  156. // interface FormTable {
  157. // text: string,
  158. // dept: string,
  159. // }
  160. // // 翻页
  161. // function handleCurrentPageChange(val: number) {
  162. // currentPage.value = val
  163. // console.log('currentPage:' + currentPage.value)
  164. // queryData();
  165. // }
  166. // // 页数
  167. // function handeSizeChange(val: number) {
  168. // currentPageSize.value = val
  169. // console.log('currentPageSize:' + currentPageSize.value)
  170. // queryData()
  171. // }
  172. // function closeDialog() {
  173. // dialogVisible.value = false;
  174. // }
  175. // // 查询今日访问次数
  176. // function currentDayData(userId: number) {
  177. // console.log('table-common-currentDayData:', userId)
  178. // return props.currentDayData(userId).then(res => {
  179. // console.log('table-common-currentdaydata:', res)
  180. // return res
  181. // })
  182. // }
  183. // // 查询本月访问次数
  184. // function currentMonthData(userId: number) {
  185. // console.log('table-common-currentMonthData:', userId)
  186. // return props.currentMonthData(userId).then(res => {
  187. // console.log('table-common-currentmonthdata:', res);
  188. // return res
  189. // })
  190. // }
  191. // // 查询累计访问次数
  192. // function currentAllData(userId: number) {
  193. // return props.currentAllData(userId).then(res => {
  194. // console.log('table-common:', res);
  195. // return res;
  196. // })
  197. // }
  198. // // 查询个人访问次数-搜索数据
  199. // function getPersonalVisits(data: FormModelCommon) {
  200. // const departId = ref();
  201. // departmentList.value.forEach(item => {
  202. // if (item.deptName === data.dept) {
  203. // departId.value = item.deptId;
  204. // }
  205. // })
  206. // const newParam = {
  207. // pageNumber: currentPage.value,
  208. // pageSize: currentPageSize.value,
  209. // nickName: data.nickName,
  210. // // deptId: data.dept === BoardDeptEnum.all ? undefined : data.dept,
  211. // deptId: departId.value,
  212. // staffNo: data.staffNo,
  213. // }
  214. // console.log('getPersonalVisits:', newParam);
  215. // props.getPersonalVisits(newParam.deptId, newParam.nickName, newParam.pageNumber, newParam.pageSize, newParam.staffNo).then(res => {
  216. // console.log('table-common-getPersonalVisits:', res)
  217. // tableData.value = res.records;
  218. // })
  219. // }
  220. // // 打开数据表
  221. // function openDialog(row: TableModel) {
  222. // console.log('tablecommon-opendialog');
  223. // console.log(row.userId);
  224. // // tbData.value=row;
  225. // userId.value = row.userId;
  226. // dialogVisible.value = true;
  227. // // currentDayData();
  228. // }
  229. // onMounted(() => {
  230. // queryData()
  231. // getDepartmentList();
  232. // })
  233. </script>
  234. <style scoped>
  235. .form {
  236. /* width: 1100px; */
  237. margin-top: 18px;
  238. }
  239. /* .el-pagination {
  240. margin-top: 30px;
  241. } */
  242. </style>