Commit 0fd0ae69 authored by daywrite's avatar daywrite

添加服务目录模块

parent 830f34ee
...@@ -67,6 +67,12 @@ ...@@ -67,6 +67,12 @@
"title": "个人信息", "title": "个人信息",
"appName": 'profile', "appName": 'profile',
"url": "/profile" "url": "/profile"
}, {
"icon": "fa-home",
"isRouteShow": 1,
"title": "服务目录",
"appName": 'services',
"url": "/service"
}], }],
homePage: { homePage: {
appName: 'reimbursement', appName: 'reimbursement',
......
...@@ -6,6 +6,7 @@ import CaseApi from './apis/case.js' ...@@ -6,6 +6,7 @@ import CaseApi from './apis/case.js'
import SupplierApi from './apis/supplier.js' import SupplierApi from './apis/supplier.js'
import AccountApi from './apis/account.js' import AccountApi from './apis/account.js'
import ProfileApi from './apis/profile.js' import ProfileApi from './apis/profile.js'
import ServiceApi from './apis/service.js'
const API_HOST = process.env.API_HOST const API_HOST = process.env.API_HOST
const API_PORT = process.env.API_PORT const API_PORT = process.env.API_PORT
...@@ -38,6 +39,7 @@ apis = Object.assign(apis, CaseApi) ...@@ -38,6 +39,7 @@ apis = Object.assign(apis, CaseApi)
apis = Object.assign(apis, SupplierApi) apis = Object.assign(apis, SupplierApi)
apis = Object.assign(apis, AccountApi) apis = Object.assign(apis, AccountApi)
apis = Object.assign(apis, ProfileApi) apis = Object.assign(apis, ProfileApi)
apis = Object.assign(apis, ServiceApi)
export default { export default {
option, option,
......
const type = 'service'
export default {
[`get${type}Filter`]: {
url: `/vue/${type}/get-filter`
},
[`get${type}List`]: {
url: `/vue/${type}/list`
},
[`get${type}New`]: {
url: `/vue/${type}/get-new`
},
[`save${type}New`]: {
url: `/vue/${type}/save-new`
},
[`get${type}Edit`]: {
url: `/vue/${type}/get-edit`
},
[`save${type}Edit`]: {
url: `/vue/${type}/save-edit`
},
[`delete${type}`]: {
url: `/vue/${type}/delete`
}
}
...@@ -6,3 +6,4 @@ ...@@ -6,3 +6,4 @@
@import './supplier-app.scss'; @import './supplier-app.scss';
@import './account-app.scss'; @import './account-app.scss';
@import './profile-app.scss'; @import './profile-app.scss';
@import './service-app.scss';
...@@ -108,6 +108,16 @@ export default { ...@@ -108,6 +108,16 @@ export default {
accountUserRoles () { accountUserRoles () {
let ret = this.getArrayByKey('Users', 'userRoles') let ret = this.getArrayByKey('Users', 'userRoles')
return ret && [].concat(ret.value) return ret && [].concat(ret.value)
},
servicesBrandIds () {
let ret = this.getArrayByKey('Services', 'brand_id')
return ret && [].concat(ret.value)
},
servicesTypeIds () {
let ret = this.getArrayByKey('Services', 'type_id')
return ret && [].concat(ret.value)
} }
}, },
...@@ -136,6 +146,21 @@ export default { ...@@ -136,6 +146,21 @@ export default {
return methods[params].call(this, id) return methods[params].call(this, id)
}, },
getServiceEdit (id) {
return requestAPI(api.getserviceEdit, { id })
.then((res) => {
this.retNewArray = res.options
return res.model
})
},
getServiceNew () {
requestAPI(api.getserviceNew)
.then((res) => {
this.retNewArray = res.options
})
},
getAccountNew () { getAccountNew () {
requestAPI(api.getaccountNew) requestAPI(api.getaccountNew)
.then((res) => { .then((res) => {
......
<template>
<section class="ec-page-wrapper" style="overflow: hidden; padding-bottom: 0px;">
<el-form label-width="120px" ref="form" :rules="rules" :model="model" class="ec-create-form">
<el-form-item label="服务名称:" prop="title" class="ec-clear-left is-required">
<el-input
class="ec-input-normal"
size="mini"
v-model.trim="model.title">
</el-input>
</el-form-item>
<el-form-item label="服务编号:" prop="serial_no" class="ec-clear-left is-required">
<el-input
class="ec-input-normal"
size="mini"
v-model.trim="model.serial_no">
</el-input>
</el-form-item>
<el-form-item label="服务品牌:" prop="brand_id" class="ec-clear-left ec-form-item-lg is-required">
<el-select v-model="model.brand_id" size="small" placeholder="请选择">
<el-option v-for="(option, optKey) in servicesBrandIds"
:key="optKey"
:label="option.name"
:value="option.key"></el-option>
</el-select>
</el-form-item>
<el-form-item label="服务类型:" prop="type_id" class="ec-clear-left ec-form-item-lg is-required">
<el-select v-model="model.type_id" size="small" placeholder="请选择">
<el-option v-for="(option, optKey) in servicesTypeIds"
:key="optKey"
:label="option.name"
:value="option.key"></el-option>
</el-select>
</el-form-item>
<el-form-item label="服务描述:" prop="description" class="ec-clear-left is-required">
<el-input
class="ec-input-normal"
size="mini"
v-model.trim="model.description">
</el-input>
</el-form-item>
<el-form-item label="工分(工作日工作时间):" prop="points" class="ec-clear-left is-required">
<el-input
class="ec-input-normal"
size="mini"
v-model.trim="model.points">
</el-input>
</el-form-item>
<el-form-item label="工分(工作日工作外时间):" prop="points_off_time" class="ec-clear-left is-required">
<el-input
class="ec-input-normal"
size="mini"
v-model.trim="model.points_off_time">
</el-input>
</el-form-item>
<el-form-item label="工分(节假日):" prop="points_holiday" class="ec-clear-left is-required">
<el-input
class="ec-input-normal"
size="mini"
v-model.trim="model.points_holiday">
</el-input>
</el-form-item>
</el-form>
</section>
</template>
<script>
import settingMixin from '../common/settingMixin'
export default {
name: 'serviceForm',
mixins: [settingMixin],
props: {
model: Object
},
components: {
},
data () {
return {
rules: {
},
query: {}
}
},
created () {
},
mounted () {
},
computed: {
},
methods: {
getNew () {
this.initSetting(['getServiceNew'])
},
getEdit (id) {
return this.initEditSetting('getServiceEdit', id)
},
_validate (cb) {
this.$refs['form'].validate((valid) => {
if (valid) {
cb && cb()
}
})
},
_resetFields () {
this.$refs['form'].resetFields()
}
}
}
</script>
<style lang="scss" scoped>
.ec-create-form .el-form-item {
width: 70%;
}
// .ec-create-form .el-form-item {
// width: 100%;
// }
</style>
<template>
<section>
<sidePopup ref="sidePopup" title="新建服务目录" :width="50" @update:close="() => btnClose()">
<ServiceForm
ref="form"
:model="model">
</ServiceForm>
<div class="mt20" style="margin-left: 150px;">
<el-button type="confirm" @click.stop.prevent="save" size="mini">保 存</el-button>
</div>
</sidePopup>
</section>
</template>
<script>
import {
requestAPI,
api,
UTIL
} from '@/lib/commonMixin'
import ServiceForm from './serviceForm'
import { setModule } from '@/lib/viewHelper'
export default {
components: {
ServiceForm
},
data () {
return {
diaVis: false,
model: {
id: '',
title: '',
serial_no: '',
brand_id: '',
type_id: '',
description: '',
points: '',
points_off_time: '',
points_holiday: ''
}
}
},
methods: {
show (model) {
if (model) {
this.$refs.form.getEdit(model.id)
.then((_model) => {
UTIL.flatten(this.model, _model)
})
} else {
this.$refs.form.getNew()
}
this.$refs.sidePopup.show()
},
handleClose () {
this.$refs.sidePopup.close(() => {
this.$refs.form._resetFields()
})
},
btnClose () {
this.$refs.form._resetFields()
},
save () {
let _params = Object.assign({}, setModule(this.model, 'Services'))
let _apiUrl = !this.model.id ? api.saveserviceNew : api.saveserviceEdit
!this.model.id && delete _params['Services[id]']
this.$refs['form']._validate(() => {
requestAPI(Object.assign(_apiUrl, { method: 'POST' }), _params)
.then((res) => {
this.$refs.sidePopup.close()
this.$message.success('操作成功')
this.$parent.reload()
}) // save
}) // validate
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<section>
<div class="content">
<search-header
ref="searchHeader"
:title="'服务目录'"
:search-key="'ClientSearch'"
:add-title="'新建服务目录'"
@update:headerSearch="search => searchKeyword(search)"
@update:headerAdd="() => addSch()"
@update:headerClear="() => searchClear()">
</search-header>
<search-form
ref="clientForm"
:filter="filter"
@update:clientList="form =>{ updateForm(form) }">
</search-form>
<div class="page-body-content">
<Item :list="result.list">
</Item>
<Pagenation
@update:pager="pager => {updatePage(pager)}"
:total="result.pagenation.totalcount">
</Pagenation>
</div>
</div>
<FormModal ref="formModal"></FormModal>
</section>
</template>
<script>
import SearchHeader from '../common/searchHeader'
import SearchForm from '../common/SearchForm'
import Item from './serviceItem'
import FormModal from '../service/serviceModal'
import Pagenation from './servicePagenation'
import SetParams from '../common/setParams'
import singleRadioTool from '../common/singleRadioTool'
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'accountHome',
mixins: [SetParams],
components: {
SearchHeader,
SearchForm,
Item,
FormModal,
Pagenation,
singleRadioTool
},
data () {
return {
currKey: 'service',
filter: [],
form: {
'ClientSearch[keyword]': ''
},
pagenation: {
thispage: 1,
pagesize: 10
},
type: 'all',
navArray: [],
result: {
list: [],
pagenation: {
totalcount: 1,
thispage: 1,
pagesize: 10
},
thisUser: {
id: '',
name: '',
sex: ''
}
}
}
},
mounted () {
this.init()
this.getList({})
},
methods: {
init () {
this.getFilter()
},
// 1.查询条件
getFilter () {
requestAPI(api[`get${this.currKey}Filter`]).then(res => {
this.filter = res
})
},
// 2.列表数据
getList (ret) {
requestAPI(api[`get${this.currKey}List`], ret).then((res) => {
const {
list = [],
pagenation = {}
} = res
this.result.list = list
this.result.pagenation = pagenation
})
},
// 3.1关键字搜索
searchKeyword (search) {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, search)
this.getList(ret)
},
// 3.2关键字后面的重置
searchClear () {
this.clearParams()
this.$refs.timeSearchForm.resetForm()
this._reload()
},
// 4.重新加载
_reload () {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {})
this.getList(ret)
},
// 5.1查询条件
updateForm (search) {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, search)
this.getList(ret)
},
// 5.2分页查询
updatePage (pager) {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {page: pager.thispage})
this.getList(ret)
},
// 5.3 TimeSearchForm
timeSearchForm (search) {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, search)
this.getList(ret)
},
// 6.1新增
addSch () {
this.$refs.formModal.show()
},
// 6.2编辑
editEvent (item) {
this.$refs.formModal.show(item)
},
// 7.操作
// 修改密码
changePasswordEvent () {},
// 删除
deleteEvent (id) {
let deleteTip = '删除账户'
this.$confirm(`${deleteTip}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api[`delete${this.type}`], { id })
.then((res) => {
this.$message.success(`${deleteTip}成功`)
this._reload()
})
}).catch(() => {
this.$message.info(`取消${deleteTip}`)
})
}
}
}
</script>
<style scoped lang="scss">
@include c('opearate-button') {
> .el-button {
margin-right:0px;
}
& .btn-primary .badge {
color: #333744;
background-color: #fff;
}
& .badge {
position: relative;
top: 0px;
left: -5px;
display: inline-block;
padding: 0px 5px;
font-size: 12px;
font-weight: 700;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25rem;
background:white;
color:#333744;
}
i {
display: inline-block;
padding-right: 3px;
}
}
</style>
<template>
<section>
<el-table :data="list" stripe border style="width: 100%">
<el-table-column label="服务品牌" width="180">
<template slot-scope="scope">
<span>{{ scope.row.brand.name }}</span>
</template>
</el-table-column>
<el-table-column label="服务类型" width="180">
<template slot-scope="scope">
<span>{{ scope.row.type.name }}</span>
</template>
</el-table-column>
<el-table-column label="服务编号" width="180">
<template slot-scope="scope">
<span>{{ scope.row.serial_no }}</span>
</template>
</el-table-column>
<el-table-column label="服务名称" width="180">
<template slot-scope="scope">
<span>{{ scope.row.title }}</span>
</template>
</el-table-column>
<el-table-column label="服务描述" width="280">
<template slot-scope="scope">
<ol>
<li v-for="item in scope.row.description">
<span>{{ item }}</span>
</li>
</ol>
</template>
</el-table-column>
<el-table-column prop="points" label="工分(工作日工作时间)" width="180">
</el-table-column>
<el-table-column prop="points_off_time" label="工分(工作日工作外时间)" width="180">
</el-table-column>
<el-table-column prop="points_holiday" label="工分(节假日)" width="180">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click.prevent.stop="editEvent(scope.row)" :disabled="!scope.row.can_update"><i class="fa fa-edit animated"></i>编辑</el-button>
<el-button type="primary" size="mini" @click.prevent.stop="deleteEvent(scope.row)" :disabled="!scope.row.can_delete"><i class="fa fa-edit animated"></i>删除</el-button>
</template>
</el-table-column>
</el-table>
</section>
</template>
<script>
export default {
name: 'serviceItem',
props: ['list'],
methods: {
editEvent (item) {
this.$parent.editEvent(item)
},
deleteEvent (item) {
this.$parent.deleteEvent(item)
}
}
}
</script>
<style scoped>
</style>
<template>
<section class="pull-right">
<el-pagination v-if="total > 0" class="mb20 mt20"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pager.thispage"
:page-sizes="[10, 20, 40, 60, 80, 100]"
:page-size="pager.pagesize"
layout="total, prev, pager, next, jumper"
:total="total">
</el-pagination>
</section>
</template>
<script>
export default {
props: {
total: {
type: Number,
default: 0
}
},
data () {
return {
pager: {
thispage: 1,
pagesize: 20,
totalcount: 0
}
}
},
created () {
// this.$emit('update:pager', this.pager)
},
methods: {
handleSizeChange (val) {
this.pager.thispage = 1
this.pager.pagesize = val
this.pager.totalcount = this.total
this.$emit('update:pager', this.pager)
},
handleCurrentChange (val) {
this.pager.thispage = val
this.pager.totalcount = this.total
this.$emit('update:pager', this.pager)
}
}
}
</script>
<style scoped>
</style>
...@@ -8,6 +8,7 @@ import CaseRoute from './routes/case' ...@@ -8,6 +8,7 @@ import CaseRoute from './routes/case'
import SupplierRoute from './routes/supplier' import SupplierRoute from './routes/supplier'
import AccountRoute from './routes/account' import AccountRoute from './routes/account'
import ProfileRoute from './routes/profile' import ProfileRoute from './routes/profile'
import ServiceRoute from './routes/service'
let routes = [] let routes = []
let reimRoutes = [] let reimRoutes = []
...@@ -17,6 +18,7 @@ let caseRoutes = [] ...@@ -17,6 +18,7 @@ let caseRoutes = []
let supplierRoute = [] let supplierRoute = []
let accountRoute = [] let accountRoute = []
let profileRoute = [] let profileRoute = []
let serviceRoute = []
const appName = 'schedule' const appName = 'schedule'
routes = [].concat(ScheduleRoute) routes = [].concat(ScheduleRoute)
...@@ -27,6 +29,7 @@ caseRoutes = [].concat(CaseRoute) ...@@ -27,6 +29,7 @@ caseRoutes = [].concat(CaseRoute)
supplierRoute = [].concat(SupplierRoute) supplierRoute = [].concat(SupplierRoute)
accountRoute = [].concat(AccountRoute) accountRoute = [].concat(AccountRoute)
profileRoute = [].concat(ProfileRoute) profileRoute = [].concat(ProfileRoute)
serviceRoute = [].concat(ServiceRoute)
let RouterInit = () => { let RouterInit = () => {
portal.createApp(appName, {}, app => { portal.createApp(appName, {}, app => {
...@@ -53,6 +56,9 @@ let RouterInit = () => { ...@@ -53,6 +56,9 @@ let RouterInit = () => {
portal.createApp('profile', {}, app => { portal.createApp('profile', {}, app => {
app.mapRoute(profileRoute) app.mapRoute(profileRoute)
}) })
portal.createApp('services', {}, app => {
app.mapRoute(serviceRoute)
})
// portal.createApp('client', {}, app => { // portal.createApp('client', {}, app => {
// app.mapRoute([ // app.mapRoute([
// { // {
......
import ServiceHome from '../components/service_list/serviceHome'
const routes = [{
path: '/service',
name: 'serviceHome',
component: ServiceHome
}]
export default routes
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