Commit e111a349 authored by daywrite's avatar daywrite

save待办事项

parent c9d53052
import createRequestor from 'create-requestor' import createRequestor from 'create-requestor'
import { default as API } from '@/api' import { default as API } from '@/api'
const dev = process.env.NODE_ENV === 'development'
let config = { let config = {
ajaxOption: { ajaxOption: {
method: 'GET', method: dev ? 'GET' : 'POST',
dataType: 'json', dataType: 'json',
contentType: 'application/x-www-form-urlencoded; charset=UTF-8' contentType: 'application/x-www-form-urlencoded; charset=UTF-8'
}, },
...@@ -34,12 +36,23 @@ let config = { ...@@ -34,12 +36,23 @@ let config = {
let ajax = createRequestor(config) let ajax = createRequestor(config)
let setUrlK = (o) => {
let params = ''
Object.keys(o).forEach(item => {
params += `&${item}=${o[item]}`
})
return params
}
export function requestAPI (option, data) { export function requestAPI (option, data) {
let params = { data: JSON.stringify(data) } let params = { data: JSON.stringify(data) }
return ajax.requestAPI(option, params) return ajax.requestAPI(option, params)
} }
export function requestWithJsonAPI (option, data) { export function requestWithJsonAPI (option, data) {
if (dev && data) {
option.url += setUrlK(data)
data = {}
}
return ajax.requestAPI(option, data) return ajax.requestAPI(option, data)
} }
......
...@@ -7,5 +7,16 @@ export default { ...@@ -7,5 +7,16 @@ export default {
// 新建待办事项获取下拉列表配置项 // 新建待办事项获取下拉列表配置项
getSaveNew: { getSaveNew: {
url: '/vue/schedule/get-new' + urlEnd url: '/vue/schedule/get-new' + urlEnd
},
// 搜索客户名称
getClientByName: {
url: '/vue/search/client-by-name' + urlEnd
},
// 保存待办事项
saveNewSchedule: {
url: '/vue/schedule/save-new' + urlEnd
} }
} }
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
v-for="item in timeTypeArray" v-for="item in timeTypeArray"
:key="item.key" :key="item.key"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.key">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
v-for="item in alarmBeforeArray" v-for="item in alarmBeforeArray"
:key="item.key" :key="item.key"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.key">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
v-for="item in repeatTypeArray" v-for="item in repeatTypeArray"
:key="item.key" :key="item.key"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.key">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否共享" prop="actName" class="ec-clear-left is-required"> <el-form-item label="是否共享" prop="is_public" class="ec-clear-left is-required">
<el-radio-group v-model="model.is_public" size="small"> <el-radio-group v-model="model.is_public" size="small">
<el-radio :label="1" border>共享</el-radio> <el-radio :label="1" border>共享</el-radio>
<el-radio :label="0" border>私人</el-radio> <el-radio :label="0" border>私人</el-radio>
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
import depSelect from './depSelect' import depSelect from './depSelect'
import settingMixin from '../common/settingMixin' import settingMixin from '../common/settingMixin'
export default { export default {
name: 'fullCutForm', name: 'scheduleForm',
mixins: [settingMixin], mixins: [settingMixin],
...@@ -118,7 +118,6 @@ export default { ...@@ -118,7 +118,6 @@ export default {
}, },
created () { created () {
// this.initSetting(['getNewArray'])
if (this.isCreate) { if (this.isCreate) {
this.queryOaDeptViaJanus() this.queryOaDeptViaJanus()
} }
......
...@@ -6,12 +6,16 @@ ...@@ -6,12 +6,16 @@
</ScheduleForm> </ScheduleForm>
<div slot="footer" class="dialog-footer" style="text-align: center;"> <div slot="footer" class="dialog-footer" style="text-align: center;">
<el-button @click="diaVis = false" size="mini">取 消</el-button> <el-button @click="diaVis = false" size="mini">取 消</el-button>
<el-button type="primary" @click="diaVis = false" size="mini">确 定</el-button> <el-button type="primary" @click="save" size="mini">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
</section> </section>
</template> </template>
<script> <script>
import {
requestWithJsonAPI,
api
} from '@/lib/commonMixin'
import ScheduleForm from './scheduleForm' import ScheduleForm from './scheduleForm'
export default { export default {
...@@ -23,7 +27,7 @@ export default { ...@@ -23,7 +27,7 @@ export default {
return { return {
diaVis: false, diaVis: false,
model: { model: {
client_id: '', client_id: '111',
schedule_title: '', schedule_title: '',
start_at: '', start_at: '',
end_at: '', end_at: '',
...@@ -39,6 +43,14 @@ export default { ...@@ -39,6 +43,14 @@ export default {
methods: { methods: {
show () { show () {
this.diaVis = true this.diaVis = true
},
save () {
console.log('this.model', this.model)
requestWithJsonAPI(api.saveNewSchedule, this.model)
.then((res) => {
console.log(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