Commit 61ccdf1b authored by SQL_Mou's avatar SQL_Mou

add MockJs&store

parent adc72081
This diff is collapsed.
...@@ -4,12 +4,16 @@ ...@@ -4,12 +4,16 @@
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build" "build": "vue-cli-service build",
"mock": "json-server -c src/mock/json-server-config.json src/mock/index.js -m src/mock/post2get.js -w"
}, },
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"element-ui": "^2.15.5", "element-ui": "^2.15.5",
"json-server": "^0.16.3",
"mockjs": "^1.1.0",
"moment": "^2.29.1",
"qs": "^6.10.1", "qs": "^6.10.1",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.2.0", "vue-router": "^3.2.0",
...@@ -20,6 +24,7 @@ ...@@ -20,6 +24,7 @@
"@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0", "@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0", "@vue/cli-service": "~4.5.0",
"node-sass": "^6.0.1",
"sass": "^1.26.5", "sass": "^1.26.5",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
......
let Path = require('path')
let glob = require('glob')
const apiFiles = glob.sync(Path.resolve(__dirname, './') + '/**/*.js', {
nodir: true
})
let prefix = "hlkj/"
let data = {}
for(let i = 0; i < apiFiles.length; i++)
{
if(apiFiles[i].indexOf("index") < 0)
{
let api = require(apiFiles[i])
api.url = prefix + api.url;
for(let param1 in api.data)
{
data[api.url.replace(/\//g, '_')+param1] = api.data[param1]
}
}
}
module.exports = function () {
return data
}
\ No newline at end of file
{
"host":"localhost",
"port": 30003,
"static":"src/mock/public/",
"watch": true,
"read-only": false,
"no-cors": false,
"no-gzip": false,
"routes": "src/mock/route.json"
}
module.exports = function (req, res, next) {
var date=new Date();
var timer=date.getTime().toString();
req.method = "GET";
req.data = {t:timer};
next();
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
{
"/*/*/*/*/*": "/$1_$2_$3_$4_$5",
"/*/*/*/*": "/$1_$2_$3_$4",
"/*/*/*": "/$1_$2_$3",
"/*/*": "/$1_$2"
}
\ No newline at end of file
const Mock = require('mockjs');
const moment = require('moment');
module.exports = {
url: 'smv/',
data: {
layoutData: layoutData()
}
};
function layoutData() {
return Mock.mock({
returnObject: [
{
i: '0',
x: 0,
y: 0,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'lineChart'
},
{
i: '1',
x: 6,
y: 0,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'barChart'
},
{
i: '2',
x: 12,
y: 0,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'pieChart'
},
{
i: '3',
x: 18,
y: 0,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'lineChart'
},
{
i: '4',
x: 0,
y: 4,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'lineChart'
},
{
i: '5',
x: 6,
y: 4,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'lineChart'
},
{
i: '6',
x: 12,
y: 4,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'lineChart'
},
{
i: '7',
x: 18,
y: 4,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'lineChart'
},
{
i: '8',
x: 0,
y: 8,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'lineChart'
},
{
i: '9',
x: 6,
y: 8,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'lineChart'
},
{
i: 'a',
x: 12,
y: 8,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'lineChart'
},
{
i: 'b',
x: 18,
y: 8,
w: 6,
h: 4,
formData: {},
title: '标题',
chartType: 'lineChart'
}
]
});
}
const Mock = require("mockjs");
const moment = require("moment");
module.exports = {
url:"workOrder/",
data:{
getInfoById:getInfoById(),
findCustomerInfo:findCustomerInfo(),
getGovServiceByParam:getgovermentList(),
getOrderInfoById:getOrderInfoById(),
getOraIsNotFour:getOraIsNotFour(),
findWaitingls:findWaiting(),
selectNodeListBycustId:Mock.mock({returnBoolean:true,"returnObject": [1,2,3,4]}),
selectHisrecord:selectHisrecord()
}
};
function getInfoById()
{
return {returnObject:{"workOrder":{"faultAddress":"fdsfdsaf","rodCode":"","propertyRight":"","lineName":"","newFault":"","vehicle":"","customerComments":"","reference":"","eliminationTime":"","emergencyLevel":"02","appointmentTime":"","causeFailure":"","arrivalTime":"","customerId":"3000000000","siteClass":"02","id":"2000000666","preliminary":"","expatriatePersonnel":"","rushRepairRecord":"","secondClass":"","receivingPoint":"","faultScene":"02","faultAssignment":"","thirdClass":"","voltageGrade":"","appointmentReasons":"","firstClass":"02","repairTime":"","powerPoint":"","estimatedRepairTime":"","contractorOpinion":""},"requestOrder":null,"customerInfo":{"handler":"","businessType":"02","subordinate":"gddw_010201","customerCode":"222","orderStatus":"1","acceptedContents":"【一户无电】低压居民客户报修一户无电,经指导客户检查,无法判断设备故障及其资产归属,请现场查处。( 客户无法提供户号,只能提供地址)。","auditorPerson":"","flowInstanceId":"2000000222","customerType":"khlx_02","creatTime":"2019-02-24 00:33:05","businessTypeName":"故障","powerSupplyUnit":"010101","creatUser":"4941632","contactAddress":"山东省德州市德城区将军路刘集小区13号楼1单元502","id":"3000000000","returnVisitMode":"2","secondDept":"218","nodeStatus":"2","customerName":"刘女士","sendTime":"2019-02-24 00:33:05","filing":"","branchOffice":"gddw_0102","phone":"18678366251","sendPer":"4941632","dataSource":"1","contacts":"刘女士","disPatchMen":""}}};
}
function findCustomerInfo()
{
//{"id":"","customerCode":"","businessType":"","creatUser":"","contactAddress":"","phone":"","acceptedContents":"","customerName":""}
return Mock.mock({totalResult:'@integer(10,100)',"returnObject|1-10":[{"handler":"","subordinate":"gddw_010201","customerCode":"222","orderStatus":"1","acceptedContents":"【一户无电】低压居民客户报修一户无电,经指导客户检查,无法判断设备故障及其资产归属,请现场查处。( 客户无法提供户号,只能提供地址)。","auditorPerson":"","flowInstanceId":"2000000222","customerType":"khlx_02","creatTime":"2019-02-24 00:33:05","businessTypeName":"故障","powerSupplyUnit":"010101","creatUser":"4941632","contactAddress":"山东省德州市德城区将军路刘集小区13号楼1单元502","id":"3000000000","returnVisitMode":"2","secondDept":"218","nodeStatus":"2","customerName":"@cname","sendTime":"2019-02-24 00:33:05","filing":"","branchOffice":"gddw_0102","phone":"18678366251","sendPer":"4941632","dataSource":"1","contacts":"@cname","disPatchMen":""}]});
}
function getgovermentList()
{
return Mock.mock({totalResult:'@integer(10,100)',returnBoolean:true,total:"@integer(40,100)","returnObject|5-20":[{
'orderNo|+1': 1, //工单编号
sendTime: '@datetime', //发送时间
problemDesc: '@string', //问题描述
adminOp: '@string', //转办意见
timeLimit: '@datetime', // 办理时限
contacts: '@cname', //联系人
'contacNo|+1': 18764087555, //联系电话
contactAdd: '@county(true)', //联系地址
'emergencyLevel|1': ["一般","紧急"], //紧急程度
'issecret|1': ["",""], //保密
'processFlow|1': ["派发","分派","处理","审核","归档"], //转办流程
sender: '@cname', //发送人
remark: '@string', //备注
}]});
}
function getOrderInfoById()
{
return Mock.mock({returnBoolean:true,total:"@integer(40,100)","returnObject":{
'orderNo': '@integer(40,100)', //工单编号
sendTime: '@datetime', //发送时间
problemDesc: '@string', //问题描述
adminOp: '@string', //转办意见
timeLimit: '@datetime', // 办理时限
contacts: '@cname', //联系人
'contacNo|+1': 18764087555, //联系电话
contactAdd: '@county(true)', //联系地址
'emergencyLevel|1': ["一般","紧急"], //紧急程度
'issecret|1': ["",""], //保密
'processFlow|1': ["派发","分派","处理","审核","归档"], //转办流程
sender: '@cname', //发送人
remark: '@string', //备注
"callType|1": ["咨询","建议","表扬"], //来电类别
inputTime: '@datetime', //录入时间
level: '', //问题分类 需要将五级分类组合
levelone: 'AAA',
leveltwo:'BBB',
levelthree:'CCC',
levelfour:'DDD',
levelfive:'FFF',
orderType: '', //工单类型
'receChannel|1': ["短信","市长热线","微信"], //受理渠道
orderStatus: '', //工单状态
isreply: '', //是否回复
replynote: '', //回复备注
processType: '', //办理类型
receivemo: '@integer(100000,20000)', //受理员编号
issuer:'@cname',//签发人
handSituation:'@string',//办理情况
replyTime:'@datetime',//答复时间
respondent:'@cname',//答复人
'replyPhone|+5':18764087555,//答复电话
replyDep:'',//答复部门
'replyDepPhone|+5':18164087555,//答复部门电话
replySituation:'@string',//答复来电人情况
// blgj:'@string',//办理轨迹
sendTime:'@datetime',//发送时间
}});
}
function getOraIsNotFour()
{
return {};
}
function findWaiting()
{
return Mock.mock({returnBoolean:true,"returnObject|1-10":[
{id:'@integer(40,100)',
'dataSource|1':[1,2],
'businessType|1':[1,2,3,4,5],
'businessTypeName|1':["咨询","投诉","故障","表扬"],
sender:"@cname",
beginTime:'@datetime',
procestate:'@string',
descriptive:'@string(20,50)'
}]});
}
function selectHisrecord()
{
return Mock.mock({returnBoolean:true,"returnObject|1-10":[
{
'id':'@integer(40,100)',
'flowinstanceId':'@integer(40,100)',
'sender':'@integer(40,100)',
'receiver':'@integer(40,100)',
'beginTime':'@datetime',
'endTime':'@datetime',
'proceState':'@string',
'descriptive':'@string',
'senderName':'@cname',
'receiverName':'@cname',
'nodeId|1':[1,2,3,4,5],
}]});
}
\ No newline at end of file
This diff is collapsed.
...@@ -91,7 +91,17 @@ module.exports = { ...@@ -91,7 +91,17 @@ module.exports = {
pathRewrite: { pathRewrite: {
'^/api' : '' '^/api' : ''
} }
} },
'/mock': {
// target: "http://192.168.7.124:20000/mock/5cf77a56210725034419be41",
// target: 'http://45.125.46.128:20000/mock/5cf77a56210725034419be41',
target: 'localhost:30003/hlkj/',
// changeOrigin: true,
ws: true,
pathRewrite: {
"^/mock": ""
}
},
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment