Commit fd420726 authored by daywrite's avatar daywrite

列表查询条件

parent dfd94ec7
...@@ -23,7 +23,19 @@ export default { ...@@ -23,7 +23,19 @@ export default {
url: '/vue/case/save-edit' url: '/vue/case/save-edit'
}, },
suspendCase: {
url: '/vue/case/suspend'
},
deleteCase: { deleteCase: {
url: '/vue/case/delete' url: '/vue/case/delete'
},
getContactByClientId: {
url: '/vue/search/contact-by-client-id'
},
getProjectByClientId: {
url: '/vue/search/project-by-client-id'
} }
} }
.case-app { .case-app {
.mb10 {
margin-bottom: 10px;
}
a[class='client'] { a[class='client'] {
cursor: pointer; cursor: pointer;
color: white; color: white;
} }
button[disabled] {
background-color: #909399!important;
border-color: #909399!important;
}
.color-dc3545 { .color-dc3545 {
color: #dc3545; color: #dc3545;
} }
...@@ -18,6 +27,17 @@ ...@@ -18,6 +27,17 @@
color: #dc3545; color: #dc3545;
} }
.el-button--cancel {
color:white;
background-color: #EB7567;
border-color: #e86150;
}
.el-button--confirm {
color:white;
background-color:#649FD7;
border-color:#5092d2;
}
.el-radio-button__inner, .el-radio-button:last-child .el-radio-button__inner, .el-radio-button:first-child .el-radio-button__inner{ .el-radio-button__inner, .el-radio-button:last-child .el-radio-button__inner, .el-radio-button:first-child .el-radio-button__inner{
border-left: 1px solid #DCDFE6; border-left: 1px solid #DCDFE6;
margin: 0 2px 0 0; margin: 0 2px 0 0;
...@@ -42,4 +62,28 @@ ...@@ -42,4 +62,28 @@
.ec-page-wrapper .el-form-item__label { .ec-page-wrapper .el-form-item__label {
color: white; color: white;
} }
.single {
& .el-radio-button__inner, .el-radio-button:last-child .el-radio-button__inner, .el-radio-button:first-child .el-radio-button__inner{
border-left: 1px solid #DCDFE6;
margin: 0 10px 5px 0;
border-radius: 3px;
}
& .el-radio-button__inner:hover{
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
}
& .el-radio-button__orig-radio:checked+.el-radio-button__inner{
color: #fff;
background-color: #3c3c3c;
border-color: #373737;
box-shadow: 0 0 0 0 #373737;
}
& .el-radio-button__orig-radio:checked+.el-radio-button__inner:hover{
color: #333;
background-color: #d4d4d4;
border-color: #8c8c8c;
}
}
} }
<template> <template>
<section class="ec-page-wrapper" style="overflow: hidden; padding-bottom: 0px;"> <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 label-width="120px" ref="form" :rules="rules" :model="model" class="ec-create-form">
<el-form-item label="标题:" prop="title" class="ec-form-item ec-clear-left is-required"> <el-form-item label="客户名称" prop="client_id" class="ec-clear-left is-required">
<el-input <dep-select
class="ec-input-normal" :query="model"
size="mini" :inputWidth="340"
v-model.trim="model.title"> :startLoadInitial="false"/>
</el-input>
</el-form-item> </el-form-item>
<el-form-item label="备注:" prop="description" class="ec-clear-left ec-form-item-lg"> <el-form-item label="项目名称:" prop="project_id" class="ec-clear-left ec-form-item-lg">
<el-input <el-select v-model="model.project_id" size="small" placeholder="请选择">
class="ec-input-normal" <el-option v-for="(option, optKey) in options.projectIds"
type="textarea" :key="optKey"
:rows="3" :label="option.name"
v-model.trim="model.description"> :value="option.key"></el-option>
</el-input> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否为模版:" prop="is_template" class="ec-clear-left is-required"> <el-form-item label="联系人:" prop="contact_id" class="ec-clear-left is-required">
<single-radio <single-radio
:form-item="model.is_template" :form-item="model.contact_id"
:options-list="docIsTemplateArray" :options-list="options.contactIds"
@update:item="val => {model.is_template = val}"> @update:item="val => {model.contact_id = val}">
</single-radio> </single-radio>
</el-form-item> </el-form-item>
<el-form-item label="文档类型:" prop="documentTypeTag" class="ec-clear-left is-required"> <el-form-item label="Case类型:" prop="case_type" class="ec-clear-left is-required">
<single-radio <single-radio
:form-item="model.documentTypeTag" :form-item="model.case_type"
:options-list="docTypeTagsArray" :options-list="caseTypeArray"
@update:item="val => {model.documentTypeTag = val}"> @update:item="val => {model.case_type = val}">
</single-radio> </single-radio>
</el-form-item> </el-form-item>
<el-form-item label="文档部门:" prop="department_id" class="ec-clear-left is-required"> <!--添加服务目录-->
<single-radio <el-form-item label="计划时间:" prop="start_at" class="ec-clear-left is-required">
:form-item="model.department_id" <el-date-picker
:options-list="docDepartmentIdArray" size="small"
@update:item="val => {model.department_id = val}"> v-model="model.start_at"
</single-radio> type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
@change="startAtChange"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="计划用时:" prop="spent_time" class="ec-clear-left ec-form-item-lg">
<el-select v-model="model.spent_time" 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>
<el-form-item label="文档分类:" prop="documentType" class="ec-clear-left ec-form-item-lg is-required"> <el-form-item label="提醒时间:" prop="alarm_before" class="ec-clear-left ec-form-item-lg">
<el-select v-model="model.documentType" size="small" placeholder="请选择"> <el-select v-model="model.alarm_before" size="small" placeholder="请选择">
<el-option v-for="(option, optKey) in options.documentTypeArray" <el-option v-for="(option, optKey) in caseAlarmBeforeArray"
:key="optKey" :key="optKey"
:label="option.name" :label="option.name"
:value="option.key"></el-option> :value="option.key"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="文档:" prop="attachment_id" class="ec-clear-left ec-form-item-lg is-required"> <el-form-item label="工程师:" prop="engineer_id" class="ec-clear-left is-required">
<single-radio
:form-item="model.engineer_id"
:options-list="caseEngineerIdArray"
@update:item="val => {model.engineer_id = val}">
</single-radio>
</el-form-item>
<el-form-item label="Case说明:" prop="description" class="ec-clear-left ec-form-item-lg">
<el-input <el-input
class="ec-input-normal" class="ec-input-normal"
size="mini" type="textarea"
v-model.trim="model.attachment_id"> :rows="3"
v-model.trim="model.description">
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -57,6 +76,7 @@ ...@@ -57,6 +76,7 @@
</template> </template>
<script> <script>
import singleRadio from '../common/singleRadio' import singleRadio from '../common/singleRadio'
import depSelect from '../schedule/depSelect'
import settingMixin from '../common/settingMixin' import settingMixin from '../common/settingMixin'
import { import {
requestAPI, requestAPI,
...@@ -72,38 +92,26 @@ export default { ...@@ -72,38 +92,26 @@ export default {
}, },
components: { components: {
singleRadio singleRadio,
depSelect
}, },
data () { data () {
return { return {
options: { options: {
documentTypeArray: [] projectIds: [],
contactIds: []
}, },
rules: { rules: {
'title': [
{required: true, message: '标题不能为空', trigger: 'blur'}
],
'documentTypeTag': [
{required: true, message: '文档类型不能为空', trigger: 'change'}
],
'department_id': [
{required: true, message: '部门不能为空', trigger: 'change'}
],
'documentType': [
{required: true, message: '文档分类不能为空', trigger: 'blur'}
],
'attachment_id': [
{required: true, message: '未上传 ', trigger: 'blur'}
]
}, },
query: {} query: {}
} }
}, },
created () { created () {
this.$watch('model.department_id', function (val) { this.$watch('model.client_id', function (val) {
this.getDocTypeArray(val) this.getProjectIds(val)
this.getContactIds(val)
}) })
}, },
...@@ -115,11 +123,11 @@ export default { ...@@ -115,11 +123,11 @@ export default {
methods: { methods: {
getNew () { getNew () {
this.initSetting(['getDocNew']) this.initSetting(['getCaseNew'])
}, },
getEdit (id) { getEdit (id) {
return this.initEditSetting('getDocEdit', id) return this.initEditSetting('getCaseEdit', id)
}, },
_validate (cb) { _validate (cb) {
...@@ -134,11 +142,23 @@ export default { ...@@ -134,11 +142,23 @@ export default {
this.$refs['form'].resetFields() this.$refs['form'].resetFields()
}, },
getDocTypeArray (id) { startAtChange (val) {
requestAPI(api.getDocType, { this.model.start_at = val
id: id },
getProjectIds (id) {
requestAPI(api.getProjectByClientId, {
client_id: id
}).then(res => {
this.options.projectIds = res
})
},
getContactIds (id) {
requestAPI(api.getContactByClientId, {
client_id: id
}).then(res => { }).then(res => {
this.options.documentTypeArray = res this.options.contactIds = res
}) })
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<section> <section>
<sidePopup ref="sidePopup" title="新建文档" :width="50" @update:close="() => btnClose()"> <sidePopup ref="sidePopup" title="新建文档" :width="50" @update:close="() => btnClose()">
<CaseForm <CaseForm
ref="docForm" ref="form"
:model="model"> :model="model">
</CaseForm> </CaseForm>
<div class="mt20" style="margin-left: 150px;"> <div class="mt20" style="margin-left: 150px;">
...@@ -31,13 +31,16 @@ export default { ...@@ -31,13 +31,16 @@ export default {
diaVis: false, diaVis: false,
model: { model: {
id: '', id: '',
title: '', client_id: '',
description: '', client_name: '',
is_template: 0, project_id: '',
documentTypeTag: '', contact_id: '',
department_id: '', case_type: '',
documentType: '', start_at: '',
attachment_id: '' spent_time: '',
alarm_before: '',
engineer_id: '',
description: ''
} }
} }
}, },
...@@ -45,32 +48,31 @@ export default { ...@@ -45,32 +48,31 @@ export default {
methods: { methods: {
show (model) { show (model) {
if (model) { if (model) {
this.$refs.docForm.getEdit(model.id) this.$refs.form.getEdit(model.id)
.then((_model) => { .then((_model) => {
UTIL.flatten(this.model, _model) UTIL.flatten(this.model, _model)
this.model.documentTypeTag = _model.documentTypeTag.key
}) })
} else { } else {
this.$refs.docForm.getNew() this.$refs.form.getNew()
} }
this.$refs.sidePopup.show() this.$refs.sidePopup.show()
}, },
handleClose () { handleClose () {
this.$refs.sidePopup.close(() => { this.$refs.sidePopup.close(() => {
this.$refs.docForm._resetFields() this.$refs.form._resetFields()
}) })
}, },
btnClose () { btnClose () {
this.$refs.docForm._resetFields() this.$refs.form._resetFields()
}, },
save () { save () {
let _params = Object.assign({}, setModule(this.model, 'Documents')) let _params = Object.assign({}, setModule(this.model, 'Documents'))
let _apiUrl = !this.model.id ? api.saveDocNew : api.saveDocEdit let _apiUrl = !this.model.id ? api.saveDocNew : api.saveDocEdit
!this.model.id && delete _params['Documents[id]'] !this.model.id && delete _params['Documents[id]']
this.$refs['docForm']._validate(() => { this.$refs['form']._validate(() => {
requestAPI(Object.assign(_apiUrl, { method: 'POST' }), _params) requestAPI(Object.assign(_apiUrl, { method: 'POST' }), _params)
.then((res) => { .then((res) => {
this.$refs.sidePopup.close() this.$refs.sidePopup.close()
......
...@@ -20,7 +20,15 @@ ...@@ -20,7 +20,15 @@
:filter="filter" :filter="filter"
@update:clientList="form =>{ updateForm(form) }"> @update:clientList="form =>{ updateForm(form) }">
</search-form> </search-form>
<div class="page-body-content leaveMessage"> <div class="page-body-content">
<div class="mb10">
<singleRadioTool
:form-item="type"
:options-list="navArray"
@update:item="val => { typeChange(val) }">
<!-- <el-radio-button key="all" label="all" value="全部">全部</el-radio-button> -->
</singleRadioTool>
</div>
<Item <Item
v-for="item in result.list" v-for="item in result.list"
:item="item" :item="item"
...@@ -38,23 +46,37 @@ ...@@ -38,23 +46,37 @@
<el-button <el-button
type="primary" type="primary"
size="mini" size="mini"
@click.prevent.stop="editSch(item)" @click.prevent.stop="viewEvent()"
:disabled="item.can_update"> :disabled="!item.can_suspend">
<i class="fa fa-edit animated"></i>编辑 <i class="fa fa-fw fa-eye"></i>详情
</el-button> </el-button>
<el-button <el-button
type="primary" type="primary"
size="mini" size="mini"
@click.prevent.stop="deleteSch(item.id)" @click.prevent.stop="suspendEvent(item)"
:disabled="!item.can_delete"> :disabled="!item.can_suspend">
<i class="fa fa-trash-o animated-hove"></i>删除 <i class="fa fa-fw fa-ban text-danger"></i>中止
</el-button>
<el-button
type="primary"
size="mini"
@click.prevent.stop="closeEvent()"
:disabled="!item.can_close">
<i class="fa fa-fw fa-archive"></i>关闭Case
</el-button>
<el-button
type="primary"
size="mini"
@click.prevent.stop="editSch(item)"
:disabled="!item.can_update">
<i class="fa fa-edit animated"></i>编辑
</el-button> </el-button>
<el-button <el-button
type="primary" type="primary"
size="mini" size="mini"
@click.prevent.stop="deleteSch(item.id)" @click.prevent.stop="deleteSch(item.id)"
:disabled="!item.can_delete"> :disabled="!item.can_delete">
<i class="fa fa-fw fa-download"></i>下载 <i class="fa fa-trash-o animated-hove"></i>删除
</el-button> </el-button>
</span> </span>
</Item> </Item>
...@@ -84,6 +106,7 @@ import Pagenation from './casePagenation' ...@@ -84,6 +106,7 @@ import Pagenation from './casePagenation'
import clickOutside from '@/lib/bind' import clickOutside from '@/lib/bind'
import SetParams from '../common/setParams' import SetParams from '../common/setParams'
import TimeSearchForm from './timeSearchForm' import TimeSearchForm from './timeSearchForm'
import singleRadioTool from '../common/singleRadioTool'
import { import {
requestAPI, requestAPI,
api api
...@@ -100,7 +123,8 @@ export default { ...@@ -100,7 +123,8 @@ export default {
FormModal, FormModal,
LeaveMessage, LeaveMessage,
Pagenation, Pagenation,
TimeSearchForm TimeSearchForm,
singleRadioTool
}, },
directives: { directives: {
...@@ -156,6 +180,8 @@ export default { ...@@ -156,6 +180,8 @@ export default {
thispage: 1, thispage: 1,
pagesize: 10 pagesize: 10
}, },
type: 'all',
navArray: [],
result: { result: {
list: [], list: [],
pagenation: { pagenation: {
...@@ -185,10 +211,23 @@ export default { ...@@ -185,10 +211,23 @@ export default {
// 1.查询条件 // 1.查询条件
getFilter () { getFilter () {
requestAPI(api.getCaseFilter).then(res => { requestAPI(api.getCaseFilter).then(res => {
let _inx = res.findIndex(item => item.key === 'CaseSearch[case_status]')
let _newRes = res.splice(_inx, 1)
this.filter = res this.filter = res
let _navArray = _newRes[0].value
_navArray.unshift({key: 'all', name: '全部'})
this.navArray = _navArray
}) })
}, },
typeChange (val) {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, { 'CaseSearch[case_status]': val })
this.getList(ret)
},
// 2.列表数据 // 2.列表数据
getList (ret) { getList (ret) {
requestAPI(api.getCaseList, ret).then((res) => { requestAPI(api.getCaseList, ret).then((res) => {
...@@ -266,20 +305,45 @@ export default { ...@@ -266,20 +305,45 @@ export default {
this.$refs.formModal.show(item) this.$refs.formModal.show(item)
}, },
// 7.删除 // 7.操作
// 详情
viewEvent () {},
// 中止
suspendEvent (id) {
let closeTip = '中止Case'
this.$confirm(`${closeTip}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api.suspendCase, { id })
.then((res) => {
this.$message.success(`${closeTip}成功`)
this._reload()
})
}).catch(() => {
this.$message.info(`取消${closeTip}`)
})
},
// 关闭Case
closeEvent () {},
// 删除
deleteSch (id) { deleteSch (id) {
this.$confirm('删除?', '提示', { let deleteTip = '删除Case'
this.$confirm(`${deleteTip}?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
requestAPI(api.deleteDoc, { id }) requestAPI(api.deleteCase, { id })
.then((res) => { .then((res) => {
this.$message.success('删除成功') this.$message.success(`${deleteTip}成功`)
this._reload() this._reload()
}) })
}).catch(() => { }).catch(() => {
this.$message.info('取消删除') this.$message.info(`取消${deleteTip}`)
}) })
}, },
......
...@@ -82,9 +82,9 @@ ...@@ -82,9 +82,9 @@
</el-col> </el-col>
<el-col :span="6" :xs="24"> <el-col :span="6" :xs="24">
</el-col> </el-col>
<el-col :span="6" :xs="24"> <el-col :span="3" :xs="24">
</el-col> </el-col>
<el-col :span="6" :xs="24"> <el-col :span="9" :xs="24">
<slot name="opearate"> <slot name="opearate">
</slot> </slot>
</el-col> </el-col>
......
...@@ -78,6 +78,26 @@ export default { ...@@ -78,6 +78,26 @@ export default {
docDepartmentIdArray () { docDepartmentIdArray () {
let ret = this.getArrayByKey('Documents', 'department_id') let ret = this.getArrayByKey('Documents', 'department_id')
return ret && [].concat(ret.value) return ret && [].concat(ret.value)
},
caseTypeArray () {
let ret = this.getArrayByKey('Cases', 'case_type')
return ret && [].concat(ret.value)
},
caseSpentTimeArray () {
let ret = this.getArrayByKey('Cases', 'spent_time')
return ret && [].concat(ret.value)
},
caseAlarmBeforeArray () {
let ret = this.getArrayByKey('Cases', 'alarm_before')
return ret && [].concat(ret.value)
},
caseEngineerIdArray () {
let ret = this.getArrayByKey('CaseAssignments', 'engineer_id')
return ret && [].concat(ret.value)
} }
}, },
...@@ -106,6 +126,21 @@ export default { ...@@ -106,6 +126,21 @@ export default {
return methods[params].call(this, id) return methods[params].call(this, id)
}, },
getCaseEdit (id) {
return requestAPI(api.getCaseEdit, { id })
.then((res) => {
this.retNewArray = res.options
return res.model
})
},
getCaseNew () {
requestAPI(api.getCaseNew)
.then((res) => {
this.retNewArray = res.options
})
},
getDocEdit (id) { getDocEdit (id) {
return requestAPI(api.getDocEdit, { id }) return requestAPI(api.getDocEdit, { id })
.then((res) => { .then((res) => {
......
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