离校前端框架,包括数据字典、工作队伍、新闻公告模块
diff --git a/leave-school-vue/src/mock/auditscope.js b/leave-school-vue/src/mock/auditscope.js
new file mode 100644
index 0000000..b1f233c
--- /dev/null
+++ b/leave-school-vue/src/mock/auditscope.js
@@ -0,0 +1,69 @@
+import Mock from 'mockjs'
+import { param2Obj } from '@/utils'
+
+const auditscopeList = Mock.mock({
+ 'list|50': [{
+ 'id': '@increment',
+ 'fwkzmc': '@cword(6, 15)',
+ 'fwkzsxl': '@word(15)'
+ }]
+}).list
+
+export default{
+ getList: config => {
+ const { fwkzmc, pageIndex = 1, pageSize = 20 } = param2Obj(config.url)
+ const mockList = auditscopeList.filter(item => {
+ if (fwkzmc && item.fwkzmc !== fwkzmc) return false
+ return true
+ })
+
+ const pageList = mockList.filter((item, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1))
+ return {
+ items: pageList,
+ recordCount: mockList.length,
+ code: 200
+ }
+ },
+ getItem: config => {
+ const { id } = param2Obj(config.url)
+ const mockList = auditscopeList.filter(item => item.id + '' === id + '')
+ return {
+ data: mockList.length > 0 ? mockList[0] : null,
+ code: 200
+ }
+ },
+ createData: config => {
+ const auditscope = JSON.parse(config.body)
+ if (!auditscope.id) {
+ auditscope.id = '' + parseInt(Math.random() * 100) + 1024 // mock a id
+ auditscopeList.unshift(auditscope)
+ } else {
+ for (let i = 0; i < auditscopeList.length; i++) {
+ if (auditscopeList[i].id + '' === auditscope.id + '') {
+ auditscopeList.splice(i, 1, auditscope)
+ break
+ }
+ }
+ }
+ return {
+ item: auditscope,
+ code: 200
+ }
+ },
+ deleteData: config => {
+ const auditscope = JSON.parse(config.body)
+ let index = -1
+ for (let i = 0; i < auditscopeList.length; i++) {
+ if (auditscopeList[i].id + '' === auditscope.id + '') {
+ index = i
+ break
+ }
+ }
+ if (index > -1) {
+ auditscopeList.splice(index, 1)
+ }
+ return {
+ code: 200
+ }
+ }
+}