Commit 9c5d4ced authored by huai.li's avatar huai.li

Merge branch 'f_task' of 140.143.226.1:daywrite/bms-vue-obear into f_task

parents f981a712 2b045290
......@@ -24,17 +24,23 @@
"isRouteShow": 1,
"title": "首页",
"appName": portalName,
"url": "/scheduleHome"
"url": "/schedule"
}, {
"icon": "fa-home",
"isRouteShow": 1,
"title": "费用报销",
"appName": 'reimbursement',
"url": "/reimbursementHome"
"url": "/reimbursement"
}, {
"icon": "fa-home",
"isRouteShow": 1,
"title": "项目管理",
"appName": 'task',
"url": "/task"
}],
homePage: {
appName: 'reimbursement',
url: '/reimbursementHome'
url: '/reimbursement'
}
}
......
import ScheduleApi from './apis/schedule.js'
import ReimburrsementApi from './apis/reimbursement.js'
import TaskApi from './apis/task.js'
const API_HOST = process.env.API_HOST
const API_PORT = process.env.API_PORT
......@@ -26,6 +27,7 @@ const option = {
let apis = {}
apis = Object.assign(apis, ScheduleApi)
apis = Object.assign(apis, ReimburrsementApi)
apis = Object.assign(apis, TaskApi)
export default {
option,
......
......@@ -16,5 +16,8 @@ export default {
},
saveEditReim: {
url: '/vue/reimbursement/save-edit'
},
deleteReim: {
url: '/vue/reimbursement/delete'
}
}
@import './schedule-app.scss';
@import './reim-app.scss';
@import './task-app.scss'
......@@ -4,7 +4,7 @@
<el-col :span="4" :xs="24" class="obear-schedule-left" :style="{background: item.bgcolor}">
<el-row :gutter="10">
<el-col :span="24">
<router-link :to="{ path: '/scheduleView/' + item.client_id }">
<router-link :to="{ path: '/ofClient/' + item.client_id }">
<i class="fa fa-star" aria-hidden="true"></i>{{ isNullClient ? '客户名称(未设置)' : item.client.name }}
</router-link>
</el-col>
......
......@@ -2,6 +2,7 @@
<div>
<el-row class="form-content">
<el-form ref="clientForm" size="mini" :model="clientForm" label-width="0" label-position="top">
<slot name="pre"></slot>
<el-col :span="4" v-for="(item, key) in filter" :key="key">
<el-form-item>
<span slot="label" v-if="item.key !== 'Filter[sort]'">
......
......@@ -48,6 +48,21 @@ export default {
reimbursementCarbonCopyRels () {
let ret = this.getArrayByKey('Reimbursements', 'form_reimbursementCarbonCopyRels')
return ret && [].concat(ret.value)
},
reimbursementSettleAccountsAt () {
let ret = this.getArrayByKey('Reimbursements', 'settle_accounts_at')
return ret && [].concat(ret.value)
},
taskGroupArray () {
let ret = this.getArrayByKey('Tasks', 'task_group_id')
return ret && [].concat(ret.value)
},
salesOrderRemindReceiversArray () {
let ret = this.getArrayByKey('SalesOrders', 'salesOrderRemindReceivers')
return ret && [].concat(ret.value)
}
},
......@@ -71,6 +86,20 @@ export default {
})
},
getTaskGroupNew () {
requestAPI(api.getTaskGroupNew)
.then((res) => {
this.retNewArray = res.options
})
},
getTaskTask () {
requestAPI(api.getTaskNew)
.then((res) => {
this.retNewArray = res.options
})
},
getReimbursementNew () {
requestAPI(api.getReimNew)
.then((res) => {
......
......@@ -8,11 +8,11 @@
@update:item="val => {model.form_type = val}">
</single-radio>
</el-form-item>
<el-form-item label="费用类型:" prop="cost_type" class="ec-clear-left is-required">
<el-form-item label="费用类型:" prop="form_costType" class="ec-clear-left is-required">
<single-radio
:form-item="model.cost_type"
:form-item="model.form_costType"
:options-list="reimCostTypeArray"
@update:item="val => {model.cost_type = val}">
@update:item="val => {model.form_costType = val}">
</single-radio>
</el-form-item>
<el-form-item label="发生时间:" prop="occurrence_at" class="ec-clear-left is-required">
......@@ -20,6 +20,18 @@
size="small"
v-model="model.occurrence_at"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
@change="occurrenceAtChange"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结算时间:" prop="settle_accounts_at" class="ec-clear-left is-required">
<el-date-picker
size="small"
v-model="model.settle_accounts_at"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
@change="settleAccountsAtChange"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
......@@ -54,21 +66,23 @@
</el-select>
</el-form-item>
<el-form-item label="审核人:" prop="form_reimbursementVerifyRels" class="ec-clear-left ec-form-item-lg is-required">
<el-select v-model="model.form_reimbursementVerifyRels" size="small" multiple placeholder="请选择">
<el-select v-model="model.form_reimbursementVerifyRels" size="small" multiple placeholder="点击选择或输入关键字查询">
<el-option v-for="(option, optKey) in reimbursementVerifyRels"
:key="optKey"
:label="option.name"
:value="option.key"></el-option>
</el-select>
</el-form-item>
<el-form-item label="结算人:" prop="actName" class="ec-clear-left is-required">
<settle-account-select
:query="model"
:inputWidth="340"
:startLoadInitial="false"/>
<el-form-item label="结算人:" prop="settle_accounts_by" class="ec-clear-left is-required">
<el-select v-model="model.settle_accounts_by" size="small" filterable placeholder="点击选择或输入关键字查询">
<el-option v-for="(option, optKey) in reimbursementSettleAccountsAt"
:key="optKey"
:label="option.name"
:value="option.key"></el-option>
</el-select>
</el-form-item>
<el-form-item label="抄送:" prop="form_reimbursementCarbonCopyRels" class="ec-clear-left ec-form-item-lg">
<el-select v-model="model.form_reimbursementCarbonCopyRels" size="small" multiple placeholder="请选择">
<el-select v-model="model.form_reimbursementCarbonCopyRels" size="small" multiple placeholder="点击选择或输入关键字查询">
<el-option v-for="(option, optKey) in reimbursementCarbonCopyRels"
:key="optKey"
:label="option.name"
......@@ -87,7 +101,6 @@
</section>
</template>
<script>
import settleAccountSelect from './settleAccountSelect'
import singleRadio from '../common/singleRadio'
import settingMixin from '../common/settingMixin'
import depSelect from '../schedule/depSelect'
......@@ -105,7 +118,6 @@ export default {
},
components: {
settleAccountSelect,
singleRadio,
depSelect
},
......@@ -139,6 +151,14 @@ export default {
},
methods: {
occurrenceAtChange (val) {
this.model.occurrence_at = val
},
settleAccountsAtChange (val) {
this.model.settle_accounts_at = val
},
getProjectArray (id) {
requestAPI(api.searchProjectByClientId, {
client_id: id
......
......@@ -30,13 +30,15 @@ export default {
diaVis: false,
model: {
form_type: '',
cost_type: '',
form_costType: '',
occurrence_at: '',
settle_accounts_at: '',
amount: '',
client_id: '',
client_name: '', // 客户
form_reimbursementVerifyRels: [],
form_reimbursementCarbonCopyRels: [],
settle_accounts_by: '',
description: '',
project_id: '',
attachmentFiles: []
......@@ -46,14 +48,22 @@ export default {
methods: {
show (model) {
model && UTIL.flatten(this.model, model)
if (model) {
UTIL.flatten(this.model, model)
this.model.form_type = model.type.id
this.model.form_costType = model.costType.id
this.model.client_name = model.client.name
this.model.form_reimbursementVerifyRels = model.reimbursementVerifyRels.map(item => item.user_id)
this.model.form_reimbursementCarbonCopyRels = model.reimbursementCarbonCopyRels.map(item => item.user_id)
this.model.settle_accounts_by = model.settleAccountsBy.id
}
this.$refs.sidePopup.show()
},
handleClose () {
Object.keys(this.model).forEach(item => {
if (Array.isArray(item)) {
this.model[item] = ''
if (item === 'form_reimbursementVerifyRels' || item === 'form_reimbursementCarbonCopyRels') {
this.model[item] = []
} else {
this.model[item] = ''
}
......@@ -62,13 +72,13 @@ export default {
},
save () {
console.log(this.model)
let _params = Object.assign({}, setModule(this.model, 'Reimbursements'))
let _apiUrl = !this.model.id ? api.saveNewReim : api.saveEditReim
!this.model.id && delete _params['Reimbursements[id]']
console.log(_params)
requestAPI(Object.assign(_apiUrl, { method: 'POST' }), _params)
.then((res) => {
this.$refs.scheduleSidePopup.close()
this.$refs.sidePopup.close()
this.$message.success('操作成功')
})
}
......
......@@ -22,9 +22,9 @@
<div class="page-body-content">
<div class="mb10">
<singleRadioTool
:form-item="reimType"
:form-item="form['ReimbursementSearch[filter]']"
:options-list="result.navCount"
@update:item="val => {reimType = val}">
@update:item="val => { reimTypeChange(val) }">
<el-radio-button solt="default" key="default" label="default" value="报销单">报销单</el-radio-button>
</singleRadioTool>
</div>
......@@ -132,9 +132,9 @@ export default {
],
filter: [],
form: {
'ClientSearch[keyword]': ''
'ClientSearch[keyword]': '',
'ReimbursementSearch[filter]': 'all'
},
reimType: 'default',
// reimTypeArray: [],
pagenation: {
thispage: 1,
......@@ -167,6 +167,22 @@ export default {
this.getFilter()
},
_reload () {
let params = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {})
this.getList(params)
},
reimTypeChange (val) {
let params = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {navCount: this.reimType})
this.getList(params)
},
timeSearchForm (search) {
let params = this.setParams({
...this.form,
......@@ -192,8 +208,11 @@ export default {
},
updatePage (pager) {
Object.assign(this.pagenation, pager)
this.getList()
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {page: pager.thispage})
this.getList(ret)
},
getFilter () {
......@@ -230,8 +249,9 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api.deleteSchedule, { id })
requestAPI(api.deleteReim, { id })
.then((res) => {
this._reload()
this.$message.success('删除成功')
})
}).catch(() => {
......
// request
export { requestAPI, requestWithJsonAPI } from '../ajax'
export { requestOAPI } from './request'
export { requestJanusAPI } from '../ajax-janus'
export { default as api } from '@/api'
export { default as UTIL } from './util'
import api from '../api'
import api from '../api_old'
import $ from 'jquery'
import Cookie from 'browser-cookie'
// import Cookie from 'browser-cookie'
let globalOpt = api.option
const SESSION_EXPIRED_CODE = globalOpt.sessionExpiredCode
const SUCCESS_CODE = 200
const SUCCESS_CODE = 2000
const HTTP_PROTOCOL = /^http[s]?:\/\//
// const usingJSONP = false
const usingJSONP = process.env.NODE_ENV !== 'production'
function normalizeUrl (url, query, option) {
if (HTTP_PROTOCOL.test(url)) return url
......@@ -23,7 +24,6 @@ function normalizeUrl (url, query, option) {
fullUrl += url
if (Object.keys(query).length > 0) {
fullUrl += '?' + $.param(query)
console.log(fullUrl)
}
return fullUrl
......@@ -32,6 +32,7 @@ function normalizeUrl (url, query, option) {
function mergeAjaxOption (...options) {
let option1 = options.shift()
let option2 = options.shift()
console.log(option1, option2)
let query = {...option1.query, ...option2.query}
let data = {...option1.data, ...option2.data}
let headers = {...option1.headers, ...option2.headers}
......@@ -62,13 +63,13 @@ export function request (option) {
resolve(res.result)
} else {
// 如果不执行 reject,可能加载中动画不被关闭
reject(res.result, xhr, null)
reject(res, xhr, null)
if (res.msg) {
// 先让界面变化
setTimeout(function () {
window.alert(res.msg)
}, 300)
// setTimeout(function () {
// window.alert(res.msg)
// }, 300)
}
}
}, function (xhr, status, error) {
......@@ -93,13 +94,13 @@ export function request (option) {
})
}
function getTokenFromCookie () {
let cookie = new Cookie()
return cookie.get('vup_token')
}
// function getTokenFromCookie () {
// let cookie = new Cookie()
// return cookie.get('vup_token')
// }
let isSessionExpired = false
export function requestAPI (api, option = {}) {
export function requestOAPI (api, option = {}) {
// 第一个请求会放过期提示用户登录后,避免之后的其他请求再次弹消息
if (isSessionExpired) {
window.location.href = globalOpt.loginUrl
......@@ -107,7 +108,13 @@ export function requestAPI (api, option = {}) {
resolve({})
})
}
let setUrlK = (ojson) => {
let params = ''
Object.keys(ojson).forEach(item => {
params += '&' + encodeURIComponent(item) + '=' + ojson[item]
})
return params
}
// merge option
let ajaxOption = mergeAjaxOption(
globalOpt.ajax, // global
......@@ -116,11 +123,17 @@ export function requestAPI (api, option = {}) {
)
ajaxOption.url = normalizeUrl(ajaxOption.url, ajaxOption.query, globalOpt)
delete ajaxOption.query
if (usingJSONP) {
ajaxOption.url = ajaxOption.url + ajaxOption.getQuery
if (ajaxOption.data) {
ajaxOption.url += setUrlK(ajaxOption.data)
delete ajaxOption.data
}
}
// ajaxOption.contentType = 'application/json'
// ajaxOption.dataType = 'json'
// ajaxOption.data = JSON.stringify(ajaxOption.data)
ajaxOption.data = {data: JSON.stringify(ajaxOption.data)}
// ajaxOption.data = {data: JSON.stringify(ajaxOption.data)}
// stringify object member of data
let data = ajaxOption.data
......@@ -132,20 +145,20 @@ export function requestAPI (api, option = {}) {
}
// check is session expired
let token = getTokenFromCookie()
if (!token && process.env.NODE_ENV === 'production') {
console.info('token expired')
isSessionExpired = true
window.alert('登录超时,请重新登录!')
window.location.href = globalOpt.loginUrl
return new Promise(function (resolve, reject) {
resolve({})
})
}
// let token = getTokenFromCookie()
// if (!token && process.env.NODE_ENV === 'production') {
// console.info('token expired')
// isSessionExpired = true
// window.alert('登录超时,请重新登录!')
// window.location.href = globalOpt.loginUrl
// return new Promise(function (resolve, reject) {
// resolve({})
// })
// }
// append token to header
let headers = ajaxOption.headers || (ajaxOption.headers = {})
headers['X-Token'] = token
// let headers = ajaxOption.headers || (ajaxOption.headers = {})
// headers['X-Token'] = token
return request(ajaxOption)
}
......@@ -21,16 +21,23 @@ export function removeEmptyMemberArray (arr) {
})
return newArr
}
export let setModule = (obj, key) => {
export let setModule = (obj, key, options) => {
let ob = {}
console.log(options)
Object.keys(obj).forEach((item) => {
if (Array.isArray(obj[item])) {
obj[item].forEach(arr => {
let opt = options && options.find(i => key + '[' + item + ']' === i.key)
console.log(opt)
obj[item].forEach((arr, index) => {
if (arr.key) {
if (arr.key === 'new') {
ob[key + '[' + item + '][' + arr.key + '][]'] = arr.name
} else {
ob[key + '[' + item + '][' + arr.key + ']'] = arr.name
}
} else {
ob[key + '[' + item + '][' + index + ']'] = arr
}
})
} else {
ob[key + '[' + item + ']'] = obj[item]
......
......@@ -2,13 +2,17 @@ import portal from 'vis-portal'
import ScheduleRoute from './routes/schedule'
import ReimbursementRoute from './routes/reimbursement'
import TaskRoute from './routes/task'
let routes = []
let reimRoutes = []
let taskRoutes = []
const appName = 'schedule'
routes = [].concat(ScheduleRoute)
reimRoutes = [].concat(ReimbursementRoute)
taskRoutes = [].concat(TaskRoute)
let RouterInit = () => {
portal.createApp(appName, {}, app => {
......@@ -17,6 +21,9 @@ let RouterInit = () => {
portal.createApp('reimbursement', {}, app => {
app.mapRoute(reimRoutes)
})
portal.createApp('task', {}, app => {
app.mapRoute(taskRoutes)
})
// portal.createApp('client', {}, app => {
// app.mapRoute([
// {
......
import ReimbursementHome from '../components/reimbursement_list/reimbursementHome'
const routes = [{
path: '/reimbursementHome',
path: '/reimbursement',
name: 'reimbursementHome',
component: ReimbursementHome
}]
......
import ScheduleHome from '../components/schedule_list/scheduleHome'
import ScheduleView from '../components/common/scheduleView'
const routes = [{
path: '/scheduleHome',
path: '/schedule',
name: 'scheduleHome',
component: ScheduleHome
}, {
path: '/scheduleView/:id',
path: '/ofClient/:id',
name: 'scheduleView',
component: ScheduleView
}]
......
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