Commit fd420726 authored by daywrite's avatar daywrite

列表查询条件

parent dfd94ec7
......@@ -23,7 +23,19 @@ export default {
url: '/vue/case/save-edit'
},
suspendCase: {
url: '/vue/case/suspend'
},
deleteCase: {
url: '/vue/case/delete'
},
getContactByClientId: {
url: '/vue/search/contact-by-client-id'
},
getProjectByClientId: {
url: '/vue/search/project-by-client-id'
}
}
.case-app {
.mb10 {
margin-bottom: 10px;
}
a[class='client'] {
cursor: pointer;
color: white;
}
button[disabled] {
background-color: #909399!important;
border-color: #909399!important;
}
.color-dc3545 {
color: #dc3545;
}
......@@ -18,6 +27,17 @@
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{
border-left: 1px solid #DCDFE6;
margin: 0 2px 0 0;
......@@ -42,4 +62,28 @@
.ec-page-wrapper .el-form-item__label {
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>
<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-form-item ec-clear-left is-required">
<el-input
class="ec-input-normal"
size="mini"
v-model.trim="model.title">
</el-input>
<el-form-item label="客户名称" prop="client_id" class="ec-clear-left is-required">
<dep-select
:query="model"
:inputWidth="340"
:startLoadInitial="false"/>
</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 label="项目名称:" prop="project_id" class="ec-clear-left ec-form-item-lg">
<el-select v-model="model.project_id" size="small" placeholder="请选择">
<el-option v-for="(option, optKey) in options.projectIds"
:key="optKey"
:label="option.name"
:value="option.key"></el-option>
</el-select>
</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
:form-item="model.is_template"
:options-list="docIsTemplateArray"
@update:item="val => {model.is_template = val}">
:form-item="model.contact_id"
:options-list="options.contactIds"
@update:item="val => {model.contact_id = val}">
</single-radio>
</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
:form-item="model.documentTypeTag"
:options-list="docTypeTagsArray"
@update:item="val => {model.documentTypeTag = val}">
:form-item="model.case_type"
:options-list="caseTypeArray"
@update:item="val => {model.case_type = val}">
</single-radio>
</el-form-item>
<el-form-item label="文档部门:" prop="department_id" class="ec-clear-left is-required">
<single-radio
:form-item="model.department_id"
:options-list="docDepartmentIdArray"
@update:item="val => {model.department_id = val}">
</single-radio>
<!--添加服务目录-->
<el-form-item label="计划时间:" prop="start_at" class="ec-clear-left is-required">
<el-date-picker
size="small"
v-model="model.start_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="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 label="文档分类:" prop="documentType" class="ec-clear-left ec-form-item-lg is-required">
<el-select v-model="model.documentType" size="small" placeholder="请选择">
<el-option v-for="(option, optKey) in options.documentTypeArray"
<el-form-item label="提醒时间:" prop="alarm_before" class="ec-clear-left ec-form-item-lg">
<el-select v-model="model.alarm_before" size="small" placeholder="请选择">
<el-option v-for="(option, optKey) in caseAlarmBeforeArray"
:key="optKey"
:label="option.name"
:value="option.key"></el-option>
</el-select>
</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
class="ec-input-normal"
size="mini"
v-model.trim="model.attachment_id">
type="textarea"
:rows="3"
v-model.trim="model.description">
</el-input>
</el-form-item>
</el-form>
......@@ -57,6 +76,7 @@
</template>
<script>
import singleRadio from '../common/singleRadio'
import depSelect from '../schedule/depSelect'
import settingMixin from '../common/settingMixin'
import {
requestAPI,
......@@ -72,38 +92,26 @@ export default {
},
components: {
singleRadio
singleRadio,
depSelect
},
data () {
return {
options: {
documentTypeArray: []
projectIds: [],
contactIds: []
},
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: {}
}
},
created () {
this.$watch('model.department_id', function (val) {
this.getDocTypeArray(val)
this.$watch('model.client_id', function (val) {
this.getProjectIds(val)
this.getContactIds(val)
})
},
......@@ -115,11 +123,11 @@ export default {
methods: {
getNew () {
this.initSetting(['getDocNew'])
this.initSetting(['getCaseNew'])
},
getEdit (id) {
return this.initEditSetting('getDocEdit', id)
return this.initEditSetting('getCaseEdit', id)
},
_validate (cb) {
......@@ -134,11 +142,23 @@ export default {
this.$refs['form'].resetFields()
},
getDocTypeArray (id) {
requestAPI(api.getDocType, {
id: id
startAtChange (val) {
this.model.start_at = val
},
getProjectIds (id) {
requestAPI(api.getProjectByClientId, {
client_id: id
}).then(res => {
this.options.projectIds = res
})
},
getContactIds (id) {
requestAPI(api.getContactByClientId, {
client_id: id
}).then(res => {
this.options.documentTypeArray = res
this.options.contactIds = res
})
}
}
......
......@@ -2,7 +2,7 @@
<section>
<sidePopup ref="sidePopup" title="新建文档" :width="50" @update:close="() => btnClose()">
<CaseForm
ref="docForm"
ref="form"
:model="model">
</CaseForm>
<div class="mt20" style="margin-left: 150px;">
......@@ -31,13 +31,16 @@ export default {
diaVis: false,
model: {
id: '',
title: '',
description: '',
is_template: 0,
documentTypeTag: '',
department_id: '',
documentType: '',
attachment_id: ''
client_id: '',
client_name: '',
project_id: '',
contact_id: '',
case_type: '',
start_at: '',
spent_time: '',
alarm_before: '',
engineer_id: '',
description: ''
}
}
},
......@@ -45,32 +48,31 @@ export default {
methods: {
show (model) {
if (model) {
this.$refs.docForm.getEdit(model.id)
this.$refs.form.getEdit(model.id)
.then((_model) => {
UTIL.flatten(this.model, _model)
this.model.documentTypeTag = _model.documentTypeTag.key
})
} else {
this.$refs.docForm.getNew()
this.$refs.form.getNew()
}
this.$refs.sidePopup.show()
},
handleClose () {
this.$refs.sidePopup.close(() => {
this.$refs.docForm._resetFields()
this.$refs.form._resetFields()
})
},
btnClose () {
this.$refs.docForm._resetFields()
this.$refs.form._resetFields()
},
save () {
let _params = Object.assign({}, setModule(this.model, 'Documents'))
let _apiUrl = !this.model.id ? api.saveDocNew : api.saveDocEdit
!this.model.id && delete _params['Documents[id]']
this.$refs['docForm']._validate(() => {
this.$refs['form']._validate(() => {
requestAPI(Object.assign(_apiUrl, { method: 'POST' }), _params)
.then((res) => {
this.$refs.sidePopup.close()
......
......@@ -20,7 +20,15 @@
:filter="filter"
@update:clientList="form =>{ updateForm(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
v-for="item in result.list"
:item="item"
......@@ -38,23 +46,37 @@
<el-button
type="primary"
size="mini"
@click.prevent.stop="editSch(item)"
:disabled="item.can_update">
<i class="fa fa-edit animated"></i>编辑
@click.prevent.stop="viewEvent()"
:disabled="!item.can_suspend">
<i class="fa fa-fw fa-eye"></i>详情
</el-button>
<el-button
type="primary"
size="mini"
@click.prevent.stop="deleteSch(item.id)"
:disabled="!item.can_delete">
<i class="fa fa-trash-o animated-hove"></i>删除
@click.prevent.stop="suspendEvent(item)"
:disabled="!item.can_suspend">
<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
type="primary"
size="mini"
@click.prevent.stop="deleteSch(item.id)"
:disabled="!item.can_delete">
<i class="fa fa-fw fa-download"></i>下载
<i class="fa fa-trash-o animated-hove"></i>删除
</el-button>
</span>
</Item>
......@@ -84,6 +106,7 @@ import Pagenation from './casePagenation'
import clickOutside from '@/lib/bind'
import SetParams from '../common/setParams'
import TimeSearchForm from './timeSearchForm'
import singleRadioTool from '../common/singleRadioTool'
import {
requestAPI,
api
......@@ -100,7 +123,8 @@ export default {
FormModal,
LeaveMessage,
Pagenation,
TimeSearchForm
TimeSearchForm,
singleRadioTool
},
directives: {
......@@ -156,6 +180,8 @@ export default {
thispage: 1,
pagesize: 10
},
type: 'all',
navArray: [],
result: {
list: [],
pagenation: {
......@@ -185,10 +211,23 @@ export default {
// 1.查询条件
getFilter () {
requestAPI(api.getCaseFilter).then(res => {
let _inx = res.findIndex(item => item.key === 'CaseSearch[case_status]')
let _newRes = res.splice(_inx, 1)
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.列表数据
getList (ret) {
requestAPI(api.getCaseList, ret).then((res) => {
......@@ -266,20 +305,45 @@ export default {
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) {
this.$confirm('删除?', '提示', {
let deleteTip = '删除Case'
this.$confirm(`${deleteTip}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api.deleteDoc, { id })
requestAPI(api.deleteCase, { id })
.then((res) => {
this.$message.success('删除成功')
this.$message.success(`${deleteTip}成功`)
this._reload()
})
}).catch(() => {
this.$message.info('取消删除')
this.$message.info(`取消${deleteTip}`)
})
},
......
......@@ -82,9 +82,9 @@
</el-col>
<el-col :span="6" :xs="24">
</el-col>
<el-col :span="6" :xs="24">
<el-col :span="3" :xs="24">
</el-col>
<el-col :span="6" :xs="24">
<el-col :span="9" :xs="24">
<slot name="opearate">
</slot>
</el-col>
......
......@@ -78,6 +78,26 @@ export default {
docDepartmentIdArray () {
let ret = this.getArrayByKey('Documents', 'department_id')
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 {
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) {
return requestAPI(api.getDocEdit, { id })
.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