Commit 439a7d12 authored by daywrite's avatar daywrite

供应商模块

parent 1f5ebbda
......@@ -49,6 +49,12 @@
"title": "工单管理",
"appName": 'case',
"url": "/case"
}, {
"icon": "fa-home",
"isRouteShow": 1,
"title": "供应商管理",
"appName": 'supplier',
"url": "/supplier"
}],
homePage: {
appName: 'reimbursement',
......
......@@ -3,6 +3,7 @@ import ReimburrsementApi from './apis/reimbursement.js'
import TaskApi from './apis/task.js'
import DocumentApi from './apis/document.js'
import CaseApi from './apis/case.js'
import SupplierApi from './apis/Supplier.js'
const API_HOST = process.env.API_HOST
const API_PORT = process.env.API_PORT
......@@ -32,6 +33,7 @@ apis = Object.assign(apis, ReimburrsementApi)
apis = Object.assign(apis, TaskApi)
apis = Object.assign(apis, DocumentApi)
apis = Object.assign(apis, CaseApi)
apis = Object.assign(apis, SupplierApi)
export default {
option,
......
const type = 'supplier'
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`
}
}
......@@ -3,3 +3,4 @@
@import './task-app.scss';
@import './document-app.scss';
@import './case-app.scss';
@import './supplier-app.scss';
.supplier-app {
.color-dc3545 {
color: #dc3545;
}
.color-649FD7 {
color: #649FD7
}
.border-dc3545 {
border-color: #dc3545;
color: #dc3545;
}
}
<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="name" class="ec-clear-left is-required">
<el-input
class="ec-input-normal"
v-model.trim="model.name">
</el-input>
</el-form-item>
<el-form-item label="主营产品:" prop="main_products" class="ec-clear-left ec-form-item-lg is-required">
<el-input
class="ec-input-normal"
type="textarea"
:rows="3"
v-model.trim="model.main_products">
</el-input>
</el-form-item>
<el-form-item label="公司性质:" prop="company_nature" class="ec-clear-left ec-form-item-lg is-required">
<el-select v-model="model.company_nature" size="small" placeholder="请选择">
<el-option v-for="(option, optKey) in caseSpentTimeArray"
:key="optKey"
:label="option.name"
:value="option.key"></el-option>
</el-select>
</el-form-item>
<el-form-item label="供应商类型:" prop="supplierTags" class="ec-clear-left is-required">
<single-radio
:form-item="model.supplierTags"
:options-list="caseTypeArray"
@update:item="val => {model.supplierTags = val}">
</single-radio>
</el-form-item>
<el-form-item label="公司网址:" prop="website" class="ec-clear-left">
<el-input
class="ec-input-normal"
v-model.trim="model.website">
<template slot="prepend">Http://</template>
</el-input>
</el-form-item>
<el-form-item label="成立时间:" prop="established_at" class="ec-clear-left">
<el-date-picker
size="small"
v-model="model.established_at"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
@change="startAtChange"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="注册资金:" prop="capital" class="ec-clear-left">
<el-input
class="ec-input-normal"
v-model.trim="model.capital">
<el-select v-model="model.capital_currency" slot="prepend" placeholder="请选择">
<el-option label="餐厅名" value="1"></el-option>
<el-option label="订单号" value="2"></el-option>
</el-select>
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="法人代表:" prop="corp_rep" class="ec-clear-left">
<el-input
class="ec-input-normal"
v-model.trim="model.corp_rep">
</el-input>
</el-form-item>
<el-form-item label="付款周期:" prop="payment_cycle" class="ec-clear-left">
<el-input
class="ec-input-normal"
v-model.trim="model.payment_cycle">
</el-input>
</el-form-item>
<el-form-item label="账号:" prop="account_number" class="ec-clear-left">
<el-input
class="ec-input-normal"
v-model.trim="model.account_number">
</el-input>
</el-form-item>
<el-form-item label="办公地址:" prop="address1" class="ec-clear-left ec-form-item-lg">
<el-input
class="ec-input-normal"
type="textarea"
:rows="3"
v-model.trim="model.address1">
</el-input>
</el-form-item>
<el-form-item label="邮政编码:" prop="zip" class="ec-clear-left">
<el-input
class="ec-input-normal"
v-model.trim="model.zip">
</el-input>
</el-form-item>
<el-form-item label="座机:" prop="telephone" class="ec-clear-left">
<el-input
class="ec-input-normal"
v-model.trim="model.telephone">
</el-input>
</el-form-item>
<el-form-item label="传真:" prop="fax" class="ec-clear-left">
<el-input
class="ec-input-normal"
v-model.trim="model.fax">
</el-input>
</el-form-item>
<el-form-item label="备注:" prop="description" class="ec-clear-left ec-form-item-lg">
<el-input
class="ec-input-normal"
type="textarea"
:rows="3"
v-model.trim="model.description">
</el-input>
</el-form-item>
</el-form>
</section>
</template>
<script>
import singleRadio from '../common/singleRadio'
import settingMixin from '../common/settingMixin'
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'documentForim',
mixins: [settingMixin],
props: {
model: Object
},
components: {
singleRadio
},
data () {
return {
rules: {
},
query: {}
}
},
created () {
},
mounted () {
},
computed: {
},
methods: {
getNew () {
this.initSetting(['getSupplierNew'])
},
getEdit (id) {
return this.initEditSetting('getSupplierEdit', id)
},
_validate (cb) {
this.$refs['form'].validate((valid) => {
if (valid) {
cb && cb()
}
})
},
_resetFields () {
this.$refs['form'].resetFields()
},
startAtChange (val) {
this.model.established_at = val
}
}
}
</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()">
<CaseForm
ref="form"
:model="model">
</CaseForm>
<div class="mt20" style="margin-left: 150px;">
<el-button type="cancel" @click.stop.prevent="handleClose" size="mini">取 消</el-button>
<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 CaseForm from './caseForm'
import { setModule } from '@/lib/viewHelper'
export default {
components: {
CaseForm
},
data () {
return {
diaVis: false,
model: {
id: '',
name: '',
main_products: '',
company_nature: '',
supplierTags: '',
website: '',
established_at: '',
capital: '',
capital_currency: '',
corp_rep: '',
payment_cycle: '',
account_number: '',
address1: '',
zip: '',
telephone: '',
fax: '',
description: ''
}
}
},
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, 'Suppliers'))
let _apiUrl = !this.model.id ? api.savesupplierNew : api.savesupplierEdit
!this.model.id && delete _params['Suppliers[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
v-for="item in result.list"
:item="item"
:key="item.id">
<span slot="opearate" class="obear-opearate-button">
<el-button
type="primary"
size="mini"
@click.prevent.stop="leaveMessageSch(item)">
<span class="badge" v-if="item.commentCount.comment">
{{ item.commentCount.comment ? item.commentCount.comment : '' }}
</span>
<i class="fa fa-commenting"></i>留言
</el-button>
<el-button
type="primary"
size="mini"
@click.prevent.stop="editEvent(item)"
:disabled="!item.can_update">
<i class="fa fa-edit animated"></i>编辑
</el-button>
<el-button
type="primary"
size="mini"
@click.prevent.stop="deleteEvent(item.id)"
:disabled="!item.can_delete">
<i class="fa fa-trash-o animated-hove"></i>删除
</el-button>
</span>
</Item>
<Pagenation
@update:pager="pager => {updatePage(pager)}"
:total="result.pagenation.totalcount">
</Pagenation>
<leave-message
v-click-outside="lmClose"
ref="leaveMessage"
:lmTemplate="lmTemplate"
:type="9">
</leave-message>
</div>
</div>
<FormModal ref="formModal"></FormModal>
</section>
</template>
<script>
import SearchHeader from '../common/searchHeader'
import SearchForm from '../common/SearchForm'
import Item from './supplierItem'
import FormModal from '../case/caseModal'
import LeaveMessage from '../common/leaveMessage'
import Pagenation from './supplierPagenation'
import clickOutside from '@/lib/bind'
import SetParams from '../common/setParams'
import singleRadioTool from '../common/singleRadioTool'
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'supplierHome',
mixins: [SetParams],
components: {
SearchHeader,
SearchForm,
Item,
FormModal,
LeaveMessage,
Pagenation,
singleRadioTool
},
directives: {
clickOutside
},
data () {
return {
currKey: 'supplier',
lmTemplate: [
{
name: '客户名称',
value: 'client.name',
default: '未设置'
},
{
name: '内容',
value: 'description'
},
{
name: '待办时间',
value: 'schedule_week_display'
},
{
name: '状态',
value: 'schedule_status_display'
},
{
name: '开始时间',
value: 'start_at'
},
{
name: '结束时间',
value: 'end_at'
},
{
name: '重复',
value: 'repeat_type_display'
},
{
name: '负责人',
value: 'scheduleCreator.name'
},
{
name: '创建时间',
value: 'created_at'
}
],
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 = {},
thisUser = {}
} = res
this.result.list = list
this.result.pagenation = pagenation
this.result.thisUser = thisUser
})
},
// 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.操作
// 删除
deleteSch (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}`)
})
},
// 8.留言
leaveMessageSch (item) {
this.$refs.leaveMessage.isShow(item)
},
lmClose () {
this.$refs.leaveMessage &&
this.$refs.leaveMessage.isClose()
}
}
}
</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 class="obear-schedule-item">
<el-row class="obear-schedule-row">
<el-col :span="4" :xs="24" class="obear-schedule-left" :style="{background: item.bgcolor}">
<el-row :gutter="10">
<el-col :span="24">
<a class="client">
<i class="fa fa-star" aria-hidden="true"></i>{{ item.name }}
</a>
</el-col>
<el-col :span="24" style="padding-left: 3px;">
<span>
<img class="user-avatar rounded-circle" :src="item.createdBy.avatar.name">{{ item.createdBy.name }}
</span>
</el-col>
<el-col :span="24">
</el-col>
</el-row>
</el-col>
<el-col :span="20" :xs="24" class="obear-schedule-right">
<el-row :gutter="10">
<el-col :span="6" :xs="24">
<span>供应商类型:</span><span class="obear-schedule-right__content border-dc3545">{{ item.supplierTags.name }}</span>
</el-col>
<el-col :span="6" :xs="24">
<span class="obear-schedule-right__content border-dc3545">付款周期</span><span>{{ isNullPaymentCycle ? item.payment_cycle : '(未设置)' }}</span>
</el-col>
<el-col :span="6" :xs="24">
<span>更新时间:</span><span class="color-649FD7">{{ item.updated_at }}</span>
</el-col>
<el-col :span="6" :xs="24">
<span>录入人:</span><span>{{ item.createdBy.name }}</span>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="6" :xs="24">
<span class="obear-schedule-right__content border-dc3545">主营产品</span><span>{{ item.main_products }}</span>
</el-col>
<el-col :span="6" :xs="24">
<span class="obear-schedule-right__content border-dc3545">备注</span><span>{{ item.description }}</span>
</el-col>
<el-col :span="6" :xs="24">
</el-col>
<el-col :span="6" :xs="24">
<slot name="opearate">
</slot>
</el-col>
</el-row>
</el-col>
</el-row>
</section>
</template>
<script>
export default {
name: 'documentItem',
props: {
item: Object
},
data () {
return {
}
},
computed: {
isNullPaymentCycle () {
return !!this.item.payment_cycle
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang="scss">
$lightBlue: #20a0ff;
$lightRed: #dc3545;
.colRed {
color: red;
border: 1px solid red;
}
.colGreen {
color: green;
border: 1px solid green;
}
.colWhite {
color: white;
}
.collightBlue {
color: #649FD7;
}
.colBlue {
color: #0056b3;
}
.rounded-circle {
border-radius: 50% !important;
}
.user-avatar {
width: 16px;
max-width: 16px;
height: 16px;
max-height: 16px;
}
@include c('schedule-item') {
margin-bottom: 10px;
font-size: 12px;
}
@include c('schedule-item:first-child') {
.obear-schedule-left {
border-radius: 5px 0 0 0;
}
}
@include c('schedule-row') {
// min-height:100px;
background-color:white;
display: flex;
flex-wrap: wrap;
}
@include c('schedule-left') {
background-color: #EB7567;
color: white;
min-height: 100%;
padding: 10px 15px 6px;
> .el-row {
> .el-col {
margin-bottom: 4px;
}
}
.el-row div:first-child, .el-row div:first-child a{
color: white;
}
@include e('checkbox') {
display:block;
font-size: 12px;
background:white;
border-radius:2px;
color: $lightBlue;
padding: 0 2px 0 2px;
}
.el-checkbox {
margin-right: 10px;
}
span {
// display: inline-block;
// padding-left: 5px;
}
i {
display:inline-block;
padding-right:5px;
}
img {
display:inline-block;
margin-right:3px;
}
@include e('private') {
display: inline-block;
padding-left: 5px;
border-radius:5px;
border: 1px solid white;
width:35px;
height:17px;
}
}
@include c('schedule-right') {
height:100%;
padding: 10px 15px 6px;
> .el-row {
> .el-col {
margin-bottom: 4px;
.el-button {
margin: 0 2px;
padding: 7px;
}
.date-time {
color: #649FD7;
}
}
}
.badge {
border-radius: 2px;
color: #333744;
background: #ffffff;
vertical-align: baseline;
display: inline;
padding: 2px 6px;
}
span.badge-unread {
&:hover {
border-color: #de321d
}
color: #fff;
background-color: #e54c3a;
border-color: #a32516
}y: flex;
@include e('item') {
display: flex;
flex-direction: column;
justify-content: space-around;
padding: 5px 0 5px 5px;
flex:1;
}
@include e('status') {
color: red;
}
@include e('content') {
display: inline-block;
border-radius:2px;
border: 1px solid;
padding: 0 2px 0 2px;
}
}
</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>
......@@ -5,12 +5,14 @@ import ReimbursementRoute from './routes/reimbursement'
import TaskRoute from './routes/task'
import DocumentRoute from './routes/document'
import CaseRoute from './routes/case'
import SupplierRoute from './routes/supplier'
let routes = []
let reimRoutes = []
let taskRoutes = []
let documentRoutes = []
let caseRoutes = []
let supplierRoute = []
const appName = 'schedule'
......@@ -19,6 +21,7 @@ reimRoutes = [].concat(ReimbursementRoute)
taskRoutes = [].concat(TaskRoute)
documentRoutes = [].concat(DocumentRoute)
caseRoutes = [].concat(CaseRoute)
supplierRoute = [].concat(SupplierRoute)
let RouterInit = () => {
portal.createApp(appName, {}, app => {
......@@ -36,6 +39,9 @@ let RouterInit = () => {
portal.createApp('case', {}, app => {
app.mapRoute(caseRoutes)
})
portal.createApp('supplier', {}, app => {
app.mapRoute(supplierRoute)
})
// portal.createApp('client', {}, app => {
// app.mapRoute([
// {
......
import SupplierHome from '../components/supplier_list/supplierHome'
const routes = [{
path: '/supplier',
name: 'supplierHome',
component: SupplierHome
}]
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