-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
415 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@import './scroll.less'; | ||
html,body{ | ||
margin:0; | ||
padding:0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
::-webkit-scrollbar { | ||
width: 8px; | ||
height: 8px; | ||
} | ||
|
||
::-webkit-scrollbar-track { | ||
width: 8px; | ||
background: rgba(#101F1C, 0.1); | ||
-webkit-border-radius: 2em; | ||
-moz-border-radius: 2em; | ||
border-radius: 2em; | ||
} | ||
|
||
::-webkit-scrollbar-thumb { | ||
// background-color: rgba(#101F1C, 0.5); | ||
background-clip: padding-box; | ||
min-height: 28px; | ||
-webkit-border-radius: 2em; | ||
-moz-border-radius: 2em; | ||
border-radius: 2em; | ||
background-color: #b3b3b3; | ||
box-shadow: 0px 1px 1px #eee inset; | ||
} | ||
|
||
::-webkit-scrollbar-thumb:hover { | ||
|
||
//background-color: rgba(#101F1C, 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { requestForMock } from "/src/api/service"; | ||
const request = requestForMock; | ||
const apiPrefix = "/FeatureFixed"; | ||
export function GetList(query) { | ||
return request({ | ||
url: apiPrefix + "/page", | ||
method: "get", | ||
data: query | ||
}); | ||
} | ||
|
||
export function AddObj(obj) { | ||
return request({ | ||
url: apiPrefix + "/add", | ||
method: "post", | ||
data: obj | ||
}); | ||
} | ||
|
||
export function UpdateObj(obj) { | ||
return request({ | ||
url: apiPrefix + "/update", | ||
method: "post", | ||
data: obj | ||
}); | ||
} | ||
|
||
export function DelObj(id) { | ||
return request({ | ||
url: apiPrefix + "/delete", | ||
method: "post", | ||
params: { id } | ||
}); | ||
} | ||
|
||
export function GetObj(id) { | ||
return request({ | ||
url: apiPrefix + "/info", | ||
method: "get", | ||
params: { id } | ||
}); | ||
} | ||
|
||
export function BatchDelete(ids) { | ||
return request({ | ||
url: apiPrefix + "/batchDelete", | ||
method: "post", | ||
data: { ids } | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import * as api from "./api"; | ||
import { dict } from "@fast-crud/fast-crud"; | ||
export default function ({ expose }) { | ||
const editRequest = async ({ form, row }) => { | ||
form.id = row.id; | ||
return await api.UpdateObj(form); | ||
}; | ||
const delRequest = async ({ row }) => { | ||
return await api.DelObj(row.id); | ||
}; | ||
const addRequest = async ({ form }) => { | ||
return await api.AddObj(form); | ||
}; | ||
|
||
return { | ||
crudOptions: { | ||
request: { | ||
pageRequest: api.GetList, | ||
addRequest, | ||
editRequest, | ||
delRequest | ||
}, | ||
rowHandle: { | ||
//固定右侧 | ||
fixed: "right" | ||
}, | ||
table: { | ||
scroll: { | ||
//需要设置它,否则滚动条拖动时,表头不会动 | ||
fixed: true | ||
} | ||
}, | ||
columns: { | ||
text1: { | ||
title: "text1", | ||
type: "text", | ||
column: { | ||
//固定左侧,并且被固定在左侧列要放在最前面 | ||
fixed: "left", | ||
width: 260 | ||
} | ||
}, | ||
id: { | ||
title: "id", | ||
type: "text", | ||
column: { | ||
width: 100 | ||
} | ||
}, | ||
text2: { | ||
title: "text2", | ||
type: "text", | ||
column: { | ||
width: 260 | ||
} | ||
}, | ||
text3: { | ||
title: "text3", | ||
type: "text", | ||
column: { | ||
width: 260 | ||
} | ||
}, | ||
text4: { | ||
title: "text4", | ||
type: "text", | ||
column: { | ||
width: 260 | ||
} | ||
}, | ||
text5: { | ||
title: "text5", | ||
type: "text", | ||
column: { | ||
width: 260 | ||
} | ||
}, | ||
last: { | ||
title: "last", | ||
type: "text", | ||
column: { | ||
width: 260 | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<template> | ||
<fs-crud ref="crudRef" v-bind="crudBinding" /> | ||
</template> | ||
|
||
<script> | ||
import { defineComponent, ref, onMounted } from "vue"; | ||
import createCrudOptions from "./crud"; | ||
import { useExpose, useCrud } from "@fast-crud/fast-crud"; | ||
export default defineComponent({ | ||
name: "FeatureFixed", | ||
setup() { | ||
// crud组件的ref | ||
const crudRef = ref(); | ||
// crud 配置的ref | ||
const crudBinding = ref(); | ||
// 暴露的方法 | ||
const { expose } = useExpose({ crudRef, crudBinding }); | ||
// 你的crud配置 | ||
const { crudOptions, selectedIds } = createCrudOptions({ expose }); | ||
// 初始化crud配置 | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars | ||
const { resetCrudOptions } = useCrud({ expose, crudOptions }); | ||
// 你可以调用此方法,重新初始化crud配置 | ||
// resetCrudOptions(options) | ||
// 页面打开后获取列表数据 | ||
onMounted(() => { | ||
expose.doRefresh(); | ||
}); | ||
return { | ||
crudBinding, | ||
crudRef | ||
}; | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import mockUtil from "/src/mock/base"; | ||
const options = { | ||
name: "FeatureFixed", | ||
idGenerator: 0 | ||
}; | ||
const list = [ | ||
{ | ||
text1: "我会被固定在左侧", | ||
last: "操作列被固定在右侧" | ||
} | ||
]; | ||
options.list = list; | ||
const mock = mockUtil.buildMock(options); | ||
export default mock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { requestForMock } from "/src/api/service"; | ||
const request = requestForMock; | ||
const apiPrefix = "/FeatureFixed"; | ||
export function GetList(query) { | ||
return request({ | ||
url: apiPrefix + "/page", | ||
method: "get", | ||
data: query | ||
}); | ||
} | ||
|
||
export function AddObj(obj) { | ||
return request({ | ||
url: apiPrefix + "/add", | ||
method: "post", | ||
data: obj | ||
}); | ||
} | ||
|
||
export function UpdateObj(obj) { | ||
return request({ | ||
url: apiPrefix + "/update", | ||
method: "post", | ||
data: obj | ||
}); | ||
} | ||
|
||
export function DelObj(id) { | ||
return request({ | ||
url: apiPrefix + "/delete", | ||
method: "post", | ||
params: { id } | ||
}); | ||
} | ||
|
||
export function GetObj(id) { | ||
return request({ | ||
url: apiPrefix + "/info", | ||
method: "get", | ||
params: { id } | ||
}); | ||
} | ||
|
||
export function BatchDelete(ids) { | ||
return request({ | ||
url: apiPrefix + "/batchDelete", | ||
method: "post", | ||
data: { ids } | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import * as api from "./api"; | ||
import { dict } from "@fast-crud/fast-crud"; | ||
export default function ({ expose }) { | ||
const editRequest = async ({ form, row }) => { | ||
form.id = row.id; | ||
return await api.UpdateObj(form); | ||
}; | ||
const delRequest = async ({ row }) => { | ||
return await api.DelObj(row.id); | ||
}; | ||
const addRequest = async ({ form }) => { | ||
return await api.AddObj(form); | ||
}; | ||
|
||
return { | ||
crudOptions: { | ||
request: { | ||
pageRequest: api.GetList, | ||
addRequest, | ||
editRequest, | ||
delRequest | ||
}, | ||
rowHandle: { | ||
fixed: "right" | ||
}, | ||
columns: { | ||
text1: { | ||
title: "text1", | ||
type: "text", | ||
column: { | ||
fixed: "left", | ||
width: 260 | ||
} | ||
}, | ||
id: { | ||
title: "id", | ||
type: "text", | ||
column: { | ||
width: 100 | ||
} | ||
}, | ||
text2: { | ||
title: "text2", | ||
type: "text", | ||
column: { | ||
width: 260 | ||
} | ||
}, | ||
text3: { | ||
title: "text3", | ||
type: "text", | ||
column: { | ||
width: 260 | ||
} | ||
}, | ||
text4: { | ||
title: "text4", | ||
type: "text", | ||
column: { | ||
width: 260 | ||
} | ||
}, | ||
text5: { | ||
title: "text5", | ||
type: "text", | ||
column: { | ||
width: 260 | ||
} | ||
}, | ||
last: { | ||
title: "last", | ||
type: "text", | ||
column: { | ||
width: 260 | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
} |
Oops, something went wrong.