Commit 1d3e3871 authored by 周远喜's avatar 周远喜

ok

parent f21ee430
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col span="24">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
<Col span="24">
<FormItem :label="l('startendTime')" prop="startTime">
<TimePicker
type="timerange"
format="HH:mm"
v-model="entity.startendTime"
placeholder="请选择时间段"
></TimePicker>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
disabled: false,
entity: {},
rules: {
title: [{ required: true, message: '请填写班次名称', trigger: 'blur' }]
}
}
},
props: {
v: Object
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true
// let parmes = {
// pageIndex: 1,
// pageSize: 20,
// conditions: [
// {
// fieldName: 'keys',
// fieldValue: this.entity.title,
// conditionalType: 'title'
// }
// ],
// total: 4
// }
// Api.paged(parmes).then((r) => {
// console.log(r.success)
// if(r.success){
// this.$Message.error("该班次名称已存在!")
// this.disabled = true
// return
// }else{
let pames = {
title: this.entity.title,
startendTime: this.entity.startendTime.join('-')
}
Api.create(pames)
.then((r) => {
if (r.success) {
// this.disabled = false
this.$Message.success('保存成功')
this.entity = {}
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
})
.catch((err) => {
this.$Message.error('保存失败')
console.warn(err)
})
}
})
// }
// })
},
handleClose() {
this.entity = {}
this.disabled = true
this.$emit('on-close')
},
l(key) {
key = 'calendar_class' + '.' + key
return this.$t(key)
}
},
watch: {
v() {
this.entity = this.$u.clone(this.v)
}
}
}
</script>
\ No newline at end of file
import Api from '@/plugins/request'
export default {
index:`${systemUrl}/calendarclass/paged`,
paged(params){
return Api.post(`${systemUrl}/calendarclass/paged`,params);
},
get(params){
return Api.get(`${systemUrl}/calendarclass/get`,params);
},
create(params){
return Api.post(`${systemUrl}/calendarclass/create`,params);
},
update(params){
return Api.post(`${systemUrl}/calendarclass/update`,params);
},
//删除:
delete(params) {
return Api.delete(`${systemUrl}/calendarclass/delete`,{params:params});
},
}
\ No newline at end of file
<template>
<div class="detail">
<Row>
<Filed :span="12" :name="l('title')">{{entity.title}}</Filed>
<Filed :span="12" :name="l('startTime')">{{entity.startTime}}</Filed>
<Filed :span="12" :name="l('endTime')">{{entity.endTime}}</Filed>
<Filed :span="12" :name="l('workHours')">{{entity.workHours}}</Filed>
</Row>
</div>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
entity: {},
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }],
code: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.$emit('on-load')
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "calendar_class" + "." + key;
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
}
}
}
</script>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col span="24">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
<Col span="24">
<!-- prop="startendTime" -->
<FormItem :label="l('startendTime')">
<TimePicker type="timerange" format="HH:mm" v-model="entity.startendTime" placeholder="请选择时间段"></TimePicker>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Edit',
data() {
return {
disabled: false,
entity: {},
rules: {
title: [{ required: true, message: '请填写班次名称', trigger: 'blur' }],
// startendTime: [{ required: true, message: '请选择时间段', trigger: 'blur' }],
}
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
r.result.startendTime=r.result.startendTime.split('-')
this.entity = r.result
this.$emit('on-load')
})
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
let startendTime = this.entity.startendTime
let pames={
title: this.entity.title,
startendTime: startendTime.join('-'),
workHours: this.entity.workHours,
creationTime: this.entity.creationTime,
creatorUserId: this.entity.creatorUserId,
id: this.entity.id,
}
Api.update(pames)
.then((r) => {
this.disabled = false
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'calendar_class' + '.' + key
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
</script>
\ No newline at end of file
<template>
<div class="classview">
<DataGrid :columns="columns" ref="grid" :action="action" :height="tableHeight"
@on-selection-change="selectionChange" :high="false">
<!-- :height="tabheight" -->
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入关键字班次名称" v-model="easySearch.keys.value" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons">
<Button type="primary" @click="addModal=true">新增</Button>
</template>
</DataGrid>
<div class="footer02" v-if="footerModel">
<span class="span">
已选择
<b class="span02">{{selectedRows.length}}</b>
</span>
<Button @click="deleteMore" class="span ml20"><Icon type="md-close"/>批量删除</Button>
</div>
<Modal v-model="addModal" title="新增" footer-hide>
<Add @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="editModal" title="编辑" footer-hide>
<Edit :eid="curId" @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
<p>确定删除?</p>
</Modal>
<Modal v-model="deletelMore" title="批量删除"@on-ok="cancel" @on-cancel="cancel">
<p>确定删除这{{selectedRows.length}}项么?</p>
</Modal>
</div>
</template>
<script>
import Api from './api'
import Add from './add'
import Edit from './edit'
import Detail from './detail'
import Search from './search'
export default {
name: 'list',
components: {
Add,
Edit,
Detail,
Search
},
data() {
return {
action: Api.index,
easySearch: {
keys: { op: 'title', value: null }
},
addModal: false,
editModal: false,
deletelModal: false,
selectedRows: [], //表格选中项
footerModel: false,
deletelMore: false,
tableHeight: '',
curId: 0,
columns: [
// { type: 'selection', width: 70, align: 'center'},
{ key: 'id', title: this.l('id'), hide: true, align: 'left' },
{
key: 'creationTime',
title: this.l('creationTime'),
hide: true,
align: 'left'
},
{
key: 'creatorUserId',
title: this.l('creatorUserId'),
hide: true,
align: 'left'
},
{
key: 'lastModificationTime',
title: this.l('lastModificationTime'),
hide: true,
align: 'left'
},
{
key: 'lastModifierUserId',
title: this.l('lastModifierUserId'),
hide: true,
align: 'left'
},
{
key: 'isDeleted',
title: this.l('isDeleted'),
hide: true,
align: 'left'
},
{
key: 'deletionTime',
title: this.l('deletionTime'),
hide: true,
align: 'left'
},
{
key: 'deleterUserId',
title: this.l('deleterUserId'),
hide: true,
align: 'left'
},
{
key: 'title',
title: this.l('title'),
align: 'left',
easy: true,
high: true
},
{
key: 'startendTime',
title: this.l('startendTime'),
align: 'left',
high: true,
},
{
key: 'startTime',
title: this.l('startTime'),
align: 'left',
hide: true,
high: true
},
{ key: 'endTime', title: this.l('endTime'), align: 'left',
hide: true, high: true },
{
key: 'workHours',
title: this.l('workHours'),
align: 'left',
high: true
},
{
title: '操作',
key: 'id',
width: 140,
align: 'center',
render: (h, params) => {
return h('div', { class: 'action' }, [
h(
'op',
{
attrs: { oprate: 'edit' },
on: { click: () => this.edit(params.row.id) }
},
'编辑'
),
h(
'op',
{
attrs: { oprate: 'remove' },
on: { click: () => this.remove(params.row.id) }
},
'删除'
)
])
}
}
]
}
},
created(){
this.tableHeight = window.innerHeight - 230
},
mounted() {
window.onresize = () => {///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight
this.tableHeight = window.screenHeight - 230
})()
}
},
async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典
},
methods: {
addOk() {
this.$refs.grid.load()
this.addModal = false
this.editModal = false
this.curId = 0
},
search() {
this.$refs.grid.reload(this.easySearch)
},
edit(id) {
this.editModal = true
this.curId = id
},
remove(id) {
this.deletelModal = true
this.curId = id
},
removeOk() {
Api.delete({ id: this.curId }).then((r) => {
if (r.success) {
this.$refs.grid.load()
this.deletelModal = false
this.$Message.success('删除成功')
}
})
},
removeCancel() {
this.deletelModal = false
},
cancel() {
this.curId = 0
this.addModal = false
this.editModal = false
this.deletedlModal = false
this.deletelMore = false
},
//多选处理--表格选择项变化方法
selectionChange(selection) {
this.selectedRows = selection
this.footerModel = selection.length > 0
},
deleteMore(){
this.deletelMore = true
},
l(key) {
/*
calendar_class:{
id:'',
creationTime:'创建时间',
creatorUserId:'创建人',
lastModificationTime:'更新时间',
lastModifierUserId:'更新人',
isDeleted:'删除人',
deletionTime:'删除时间',
deleterUserId:'删除人',
title:'班次名称',
startTime:'开始时间',
endTime:'结束时间',
workHours:'工作时长',
}
*/
let vkey = 'calendar_class' + '.' + key
return this.$t(vkey) || key
}
}
}
</script>
<style lang="less">
.classview{
height: 100%;
.footer02 {
background: #4c5968;
opacity: 0.9;
position: absolute;
bottom: 9px;
box-shadow: 0px -5px 6px rgba(0,0,0,0.3);
width: 86%;
z-index: 99;
padding: 10px;
color: #fff;
margin: 10px 0 10px 0;
}
}
</style>
\ No newline at end of file
<template>
<Form ref="form" :model="condition" :label-width="90">
<Row>
<Col :span="12" :v-if="condition.id.show"><FormItem :label="l('id')" prop="id"> <Input v-model="condition.id.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.creationTime.show"><FormItem :label="l('creationTime')" prop="creationTime"> <DatePicker type="daterange" v-model="condition.creationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.creatorUserId.show"><FormItem :label="l('creatorUserId')" prop="creatorUserId"> <Input v-model="condition.creatorUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModificationTime.show"><FormItem :label="l('lastModificationTime')" prop="lastModificationTime"> <DatePicker type="daterange" v-model="condition.lastModificationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModifierUserId.show"><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId"> <Input v-model="condition.lastModifierUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.isDeleted.show"><FormItem :label="l('isDeleted')" prop="isDeleted"> <Input v-model="condition.isDeleted.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.deletionTime.show"><FormItem :label="l('deletionTime')" prop="deletionTime"> <DatePicker type="daterange" v-model="condition.deletionTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.deleterUserId.show"><FormItem :label="l('deleterUserId')" prop="deleterUserId"> <Input v-model="condition.deleterUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.title.show"><FormItem :label="l('title')" prop="title"> <Input v-model="condition.title.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.startTime.show"><FormItem :label="l('startTime')" prop="startTime"> <DatePicker type="daterange" v-model="condition.startTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.endTime.show"><FormItem :label="l('endTime')" prop="endTime"> <DatePicker type="daterange" v-model="condition.endTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.workHours.show"><FormItem :label="l('workHours')" prop="workHours"> <Input v-model="condition.workHours.value"> </Input>
</FormItem></Col>
</Row>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
condition: {
id:{op:"Equal",value:null,show:false},
creationTime:{op:"Range",value:null,show:false},
creatorUserId:{op:"Equal",value:null,show:false},
lastModificationTime:{op:"Range",value:null,show:false},
lastModifierUserId:{op:"Equal",value:null,show:false},
isDeleted:{op:"Equal",value:null,show:false},
deletionTime:{op:"Range",value:null,show:false},
deleterUserId:{op:"Equal",value:null,show:false},
title:{op:"Equal",value:null,show:true},
startTime:{op:"Range",value:null,show:true},
endTime:{op:"Range",value:null,show:true},
workHours:{op:"Equal",value:null,show:true},
},
}
},
methods: {
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "calendar_class" + "." + key;
return this.$t(key)
}
}
}
</script>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="24">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('startTime')" prop="startTime">
<DatePicker type="date" v-model="entity.startTime"></DatePicker>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('endTime')" prop="endTime">
<DatePicker type="date" v-model="entity.endTime"></DatePicker>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
disabled: false,
entity: {},
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
v: Object
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true
Api.create(this.entity)
.then((r) => {
this.disabled = false
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'calendar_holiday' + '.' + key
return this.$t(key)
}
},
watch: {
v() {
this.entity = this.$u.clone(this.v)
}
}
}
</script>
\ No newline at end of file
import Api from '@/plugins/request'
export default {
index:`${systemUrl}/calendarholiday/paged`,
paged(params){
return Api.post(`${systemUrl}/calendarholiday/paged`,params);
},
get(params){
return Api.get(`${systemUrl}/calendarholiday/get`,params);
},
create(params){
return Api.post(`${systemUrl}/calendarholiday/create`,params);
},
update(params){
return Api.post(`${systemUrl}/calendarholiday/update`,params);
},
//删除:
delete(params) {
return Api.delete(`${systemUrl}/calendarholiday/delete`,{params:params});
},
}
\ No newline at end of file
<template>
<div class="detail">
<Row>
<Filed :span="12" :name="l('title')">{{entity.title}}</Filed>
<Filed :span="12" :name="l('startTime')">{{entity.startTime}}</Filed>
<Filed :span="12" :name="l('days')">{{entity.days}}</Filed>
<Filed :span="12" :name="l('endTime')">{{entity.endTime}}</Filed>
</Row>
</div>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
entity: {},
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }],
code: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.$emit('on-load')
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "calendar_holiday" + "." + key;
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
}
}
}
</script>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="24">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('startTime')" prop="startTime">
<DatePicker type="date" v-model="entity.startTime"></DatePicker>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('endTime')" prop="endTime">
<DatePicker type="date" v-model="entity.endTime"></DatePicker>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Edit',
data() {
return {
disabled: false,
entity: {},
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result
this.$emit('on-load')
})
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true
Api.update(this.entity)
.then((r) => {
this.disabled = false
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'calendar_holiday' + '.' + key
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
</script>
\ No newline at end of file
<template>
<div class="holiday">
<DataGrid :columns="columns" ref="grid" :action="action" :high="false" :height="tableHeight"
@on-selection-change="selectionChange" >
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入关键字节日名称" v-model="easySearch.keys.value" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons">
<Button type="primary" @click="addModal=true">新增</Button>
</template>
</DataGrid>
<div class="footer02" v-if="footerModel">
<span class="span">
已选择
<b class="span02">{{selectedRows.length}}</b>
</span>
<Button @click="deleteMore" class="span ml20"><Icon type="md-close"/>批量删除</Button>
</div>
<Modal v-model="addModal" title="新增" footer-hide>
<Add @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="editModal" title="编辑" footer-hide>
<Edit :eid="curId" @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
<p>确定删除?</p>
</Modal>
<Modal v-model="deletelMore" title="批量删除"@on-ok="cancel" @on-cancel="cancel">
<p>确定删除这{{selectedRows.length}}项么?</p>
</Modal>
</div>
</template>
<script>
import Api from './api'
import Add from './add'
import Edit from './edit'
import Detail from './detail'
import Search from './search'
export default {
name: 'list',
components: {
Add,
Edit,
Detail,
Search
},
data() {
return {
action: Api.index,
easySearch: {
keys: { op: 'title', value: null }
},
addModal: false,
editModal: false,
deletelModal: false,
selectedRows: [], //表格选中项
footerModel: false,
deletelMore: false,
tableHeight: '',
curId: 0,
columns: [
// { type: 'selection', width: 70, align: 'center'},
{ key: 'id', title: this.l('id'), hide: true, align: 'left' },
{
key: 'creationTime',
title: this.l('creationTime'),
hide: true,
align: 'left'
},
{
key: 'creatorUserId',
title: this.l('creatorUserId'),
hide: true,
align: 'left'
},
{
key: 'lastModificationTime',
title: this.l('lastModificationTime'),
hide: true,
align: 'left'
},
{
key: 'lastModifierUserId',
title: this.l('lastModifierUserId'),
hide: true,
align: 'left'
},
{
key: 'isDeleted',
title: this.l('isDeleted'),
hide: true,
align: 'left'
},
{
key: 'deletionTime',
title: this.l('deletionTime'),
hide: true,
align: 'left'
},
{
key: 'deleterUserId',
title: this.l('deleterUserId'),
hide: true,
align: 'left'
},
{
key: 'title',
title: this.l('title'),
align: 'left',
easy: true,
high: true
},
{
key: 'startTime',
title: this.l('startTime'),
align: 'left',
high: true
},
{
key: 'days',
title: this.l('days'),
hide: true,
align: 'left',
high: true
},
{
key: 'status',
title: this.l('status'),
hide: true,
align: 'left',
high: true
},
{ key: 'endTime', title: this.l('endTime'), align: 'left', high: true },
{
title: '操作',
key: 'id',
width: 140,
align: 'center',
render: (h, params) => {
return h('div', { class: 'action' }, [
h(
'op',
{
attrs: { oprate: 'edit' },
on: { click: () => this.edit(params.row.id) }
},
'编辑'
),
h(
'op',
{
attrs: { oprate: 'remove' },
on: { click: () => this.remove(params.row.id) }
},
'删除'
)
])
}
}
]
}
},
created(){
this.tableHeight = window.innerHeight - 230
},
mounted() {
// console.log(this)
window.onresize = () => {///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight
this.tableHeight = window.screenHeight - 230
})()
}
},
async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典
},
methods: {
addOk() {
this.$refs.grid.load()
this.addModal = false
this.editModal = false
this.curId = 0
},
search() {
this.$refs.grid.reload(this.easySearch)
},
edit(id) {
this.editModal = true
this.curId = id
},
remove(id) {
this.deletelModal = true
this.curId = id
},
removeOk() {
Api.delete({ id: this.curId }).then((r) => {
if (r.success) {
this.$refs.grid.load()
this.deletelModal = false
this.$Message.success('删除成功')
}
})
},
removeCancel() {
this.deletelModal = false
},
cancel() {
this.curId = 0
this.addModal = false
this.editModal = false
this.deletedlModal = false
this.deletelMore = false
},
//多选处理--表格选择项变化方法
selectionChange(selection) {
this.selectedRows = selection
this.footerModel = selection.length > 0
},
deleteMore(){
this.deletelMore = true
},
l(key) {
/*
calendar_holiday:{
id:'',
creationTime:'创建时间',
creatorUserId:'创建人',
lastModificationTime:'更新时间',
lastModifierUserId:'更新人',
isDeleted:'删除人',
deletionTime:'删除时间',
deleterUserId:'删除人',
title:'节日名称',
startTime:'开始时间',
days:'工作时长(小时)',
status:'状态',
endTime:'结束时间',
}
*/
let vkey = 'calendar_holiday' + '.' + key
return this.$t(vkey) || key
}
}
}
</script>
<style lang="less">
.holiday{
.footer02{
background: #4c5968;
opacity: 0.9;
position: absolute;
bottom: 9px;
box-shadow: 0px -5px 6px rgba(0,0,0,0.3);
width: 86%;
z-index: 99;
padding: 10px;
color: #fff;
margin: 10px 0 10px 0;
}
}
</style>
\ No newline at end of file
<template>
<Form ref="form" :model="condition" :label-width="90">
<Row>
<Col :span="12" :v-if="condition.id.show"><FormItem :label="l('id')" prop="id"> <Input v-model="condition.id.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.creationTime.show"><FormItem :label="l('creationTime')" prop="creationTime"> <DatePicker type="daterange" v-model="condition.creationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.creatorUserId.show"><FormItem :label="l('creatorUserId')" prop="creatorUserId"> <Input v-model="condition.creatorUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModificationTime.show"><FormItem :label="l('lastModificationTime')" prop="lastModificationTime"> <DatePicker type="daterange" v-model="condition.lastModificationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModifierUserId.show"><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId"> <Input v-model="condition.lastModifierUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.isDeleted.show"><FormItem :label="l('isDeleted')" prop="isDeleted"> <Input v-model="condition.isDeleted.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.deletionTime.show"><FormItem :label="l('deletionTime')" prop="deletionTime"> <DatePicker type="daterange" v-model="condition.deletionTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.deleterUserId.show"><FormItem :label="l('deleterUserId')" prop="deleterUserId"> <Input v-model="condition.deleterUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.title.show"><FormItem :label="l('title')" prop="title"> <Input v-model="condition.title.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.startTime.show"><FormItem :label="l('startTime')" prop="startTime"> <DatePicker type="daterange" v-model="condition.startTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.days.show"><FormItem :label="l('days')" prop="days"> <Input v-model="condition.days.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.status.show"><FormItem :label="l('status')" prop="status"> <Dictionary v-model="condition.status.value"></Dictionary>
</FormItem></Col>
<Col :span="12" :v-if="condition.endTime.show"><FormItem :label="l('endTime')" prop="endTime"> <DatePicker type="daterange" v-model="condition.endTime.value"></DatePicker>
</FormItem></Col>
</Row>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
condition: {
id:{op:"Equal",value:null,show:false},
creationTime:{op:"Range",value:null,show:false},
creatorUserId:{op:"Equal",value:null,show:false},
lastModificationTime:{op:"Range",value:null,show:false},
lastModifierUserId:{op:"Equal",value:null,show:false},
isDeleted:{op:"Equal",value:null,show:false},
deletionTime:{op:"Range",value:null,show:false},
deleterUserId:{op:"Equal",value:null,show:false},
title:{op:"Equal",value:null,show:true},
startTime:{op:"Range",value:null,show:true},
days:{op:"Equal",value:null,show:true},
status:{op:"Equal",value:null,show:true},
endTime:{op:"Range",value:null,show:true},
},
}
},
methods: {
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "calendar_holiday" + "." + key;
return this.$t(key)
}
}
}
</script>
\ No newline at end of file
<template>
<classView></classView>
</template>
<script>
import classView from './class/index'
export default {
components:{classView},
}
</script>
<style lang="less">
.footer02 {
background: #4c5968;
opacity: 0.9;
position: absolute;
bottom: 9px;
box-shadow: 0px -5px 6px rgba(0,0,0,0.3);
width: 83%;
z-index: 99;
padding: 10px;
color: #fff;
margin: 10px 0 10px 0;
}
</style>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row>
<Col :span="24">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('holidayTitle')" prop="holidayId">
<Select v-model="entity.holidayId" multiple @on-change="getItems">
<Option
v-for="item in orderCatList"
:value="item.id"
:key="item.index"
:label="item.title+'('+ item.startendTime +')'"
></Option>
</Select>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
disabled: false,
entity: {
id:[],
title:"",
holidayId:[],
holidayTitle:"",
selectItems:[],//选中的加班日历
},
orderCatList: [],
rules: {
title: [{ required: true, message: '请填写日历名称', trigger: 'blur' }],
holidayId: [
{ required: true, type: 'array', min: 1, message: '请选择关联假日', trigger: 'change' },
]
}
}
},
props: {
v: Object
},
created() {
this.selectAry()
},
methods: {
selectAry() {
Api.getlist().then((res) => {
this.orderCatList = res.result
})
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true
let titles=[];
this.selectItems.map(u=>{
titles.push(u.title+"("+u.startendTime+")")
})
let parme = {
title:this.entity.title,
holidayTitle:titles.join(),
holidayId:this.entity.holidayId.join(),
}
Api.create(parme)
.then((r) => {
this.disabled = false
if (r.success) {
this.$Message.success('保存成功')
this.entity.holidayId=[];
this.$refs.form.resetFields();
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
getItems(v){ //获取所有选中项;
var items=this.orderCatList.filter(u=>{
return v.indexOf(u.id)>-1
})
this.selectItems=items;
},
getHours(){ //获取工时
let sum=0;
this.selectItems.map(u=>{
sum+=u.workHours;
});
return sum;
},
l(key) {
key = 'calendar_overtime' + '.' + key
return this.$t(key)
}
},
watch: {
v() {
this.entity = this.$u.clone(this.v)
}
}
}
</script>
\ No newline at end of file
import Api from '@/plugins/request'
export default {
index: `${systemUrl}/calendarovertime/paged`,
paged (params) {
return Api.post(`${systemUrl}/calendarovertime/paged`, params)
},
getlist (params) {
return Api.get(`${systemUrl}/calendarovertime/getselectclass`, params)
},
getWeekTypeList (params) {
return Api.post(`${systemUrl}/calendarweektype/list`, params)
},
setweek (params) {
return Api.post(`${systemUrl}/calendarweektype/setweek`, params)
},
getsetweek (params) {
return Api.get(`${systemUrl}/calendarweektype/getcurrentset`, params)
},
get (params) {
return Api.get(`${systemUrl}/calendarovertime/get`, params)
},
create (params) {
return Api.post(`${systemUrl}/calendarovertime/create`, params)
},
update (params) {
return Api.post(`${systemUrl}/calendarovertime/update`, params)
},
//删除:
delete (params) {
return Api.delete(`${systemUrl}/calendarovertime/delete`, {
params: params
})
}
}
<template>
<div class="detail">
<Row>
<Filed :span="12" :name="l('title')">{{entity.title}}</Filed>
<Filed :span="12" :name="l('restType')">{{entity.restType}}</Filed>
<Filed :span="12" :name="l('holidayId')">{{entity.holidayId}}</Filed>
<Filed :span="12" :name="l('holidayTitle')">{{entity.holidayTitle}}</Filed>
<Filed :span="12" :name="l('holidayStartendTime')">{{entity.holidayStartendTime}}</Filed>
<Filed :span="12" :name="l('status')">{{entity.status}}</Filed>
</Row>
</div>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
entity: {},
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }],
code: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.$emit('on-load')
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "calendar_overtime" + "." + key;
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
}
}
}
</script>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row>
<Col :span="24">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('holidayTitle')" prop="classId">
<Select v-model="entity.classId" @on-change="getItems" multiple>
<Option
v-for="item in orderCatList"
:value="item.id"
:key="item.index"
:label="item.title+'('+ item.startendTime +')'"
></Option>
</Select>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Edit',
data() {
return {
disabled: false,
entity: {},
selectItems: [], //选中的加班日历
orderCatList: [],
rules: {
title: [{ required: true, message: '请填写日历名称', trigger: 'blur' }],
classId: [
{ required: true, type: 'array', min: 1, message: '请选择关联节日', trigger: 'change' },
]
}
}
},
props: {
eid: Number
},
created() {
this.selectAry()
},
methods: {
selectAry() {
Api.getlist().then((res) => {
this.orderCatList = res.result
})
},
load(v) {
Api.get({ id: v }).then((r) => {
let dataForm = r.result
if (dataForm.holidayId) {
let ids = dataForm.holidayId.split(',')
var uids = []
ids.map((u) => {
uids.push(parseInt(u))
})
this.getItems(uids)
dataForm.classId = uids
} else {
dataForm.classId = []
}
this.entity = dataForm
this.$emit('on-load')
})
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true
let titles = []
this.selectItems.map((u) => {
titles.push(u.title + '(' + u.startendTime + ')')
})
this.entity.holidayTitle = titles.join()
var data = this.$u.clone(this.entity)
data.holidayId = this.entity.classId.join()
Api.update(data)
.then((r) => {
this.disabled = false
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
getItems(v) {
var items = this.orderCatList.filter((u) => {
return v.indexOf(u.id) > -1
})
this.selectItems = items
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'calendar_overtime' + '.' + key
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
</script>
\ No newline at end of file
<template>
<div class="overtime">
<DataGrid
:columns="columns"
ref="grid"
:height="tableHeight"
:action="action"
:high="false"
@on-selection-change="selectionChange"
>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入关键字日历名称" v-model="easySearch.keys.value" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons">
<span>公休日设置:</span>
<RadioGroup v-model="weekType" @on-change="radioChange">
<Radio v-for="(item,index) in weekTypeList" :key="index" :label="item.title" border></Radio>
</RadioGroup>
</template>
<template slot="buttons">
<Button type="primary" @click="addModal=true">新增</Button>
</template>
</DataGrid>
<div class="footer02" v-if="footerModel">
<span class="span">
已选择
<b class="span02">{{selectedRows.length}}</b>
</span>
<Button @click="deleteMore" class="span ml20">
<Icon type="md-close" />批量删除
</Button>
</div>
<Modal v-model="addModal" title="新增" footer-hide>
<Add @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="editModal" title="编辑" footer-hide>
<Edit :eid="curId" @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
<p>确定删除?</p>
</Modal>
<Modal v-model="deletelMore" title="批量删除" @on-ok="cancel" @on-cancel="cancel">
<p>确定删除这{{selectedRows.length}}项么?</p>
</Modal>
</div>
</template>
<script>
import Api from './api'
import Add from './add'
import Edit from './edit'
import Detail from './detail'
import Search from './search'
export default {
name: 'list',
components: {
Add,
Edit,
Detail,
Search
},
data() {
return {
action: Api.index,
easySearch: {
keys: { op: 'title', value: null }
},
weekType: '',
weekTypeid: 0,
weekFlag: false,
weekTypeList: [],
tableHeight: '',
addModal: false,
editModal: false,
deletelModal: false,
selectedRows: [], //表格选中项
footerModel: false,
deletelMore: false,
curId: 0,
columns: [
// { type: 'selection', width: 70, align: 'center'},
{ key: 'id', title: this.l('id'), hide: true, align: 'left' },
{
key: 'creationTime',
title: this.l('creationTime'),
hide: true,
align: 'left'
},
{
key: 'creatorUserId',
title: this.l('creatorUserId'),
hide: true,
align: 'left'
},
{
key: 'lastModificationTime',
title: this.l('lastModificationTime'),
hide: true,
align: 'left'
},
{
key: 'lastModifierUserId',
title: this.l('lastModifierUserId'),
hide: true,
align: 'left'
},
{
key: 'isDeleted',
title: this.l('isDeleted'),
hide: true,
align: 'left'
},
{
key: 'deletionTime',
title: this.l('deletionTime'),
hide: true,
align: 'left'
},
{
key: 'deleterUserId',
title: this.l('deleterUserId'),
hide: true,
align: 'left'
},
{
key: 'title',
title: this.l('title'),
align: 'left',
easy: true,
high: true
},
{
key: 'restType',
title: this.l('restType'),
align: 'left',
hide: true,
high: true
},
{
key: 'holidayId',
title: this.l('holidayId'),
align: 'left',
hide: true,
high: true
},
{
key: 'holidayTitle',
title: this.l('holidayTitle'),
align: 'left',
high: true
},
{
key: 'status',
title: this.l('status'),
align: 'left',
hide: true,
high: true
},
{
title: '操作',
key: 'id',
width: 140,
align: 'center',
render: (h, params) => {
return h('div', { class: 'action' }, [
h(
'op',
{
attrs: { oprate: 'edit' },
on: { click: () => this.edit(params.row.id) }
},
'编辑'
),
h(
'op',
{
attrs: { oprate: 'remove' },
on: { click: () => this.remove(params.row.id) }
},
'删除'
)
])
}
}
]
}
},
created() {
this.getWeekTypeListFn()
this.tableHeight = window.innerHeight - 230
},
mounted() {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight
this.tableHeight = window.screenHeight - 230
})()
}
},
async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典
},
methods: {
getWeekTypeListFn() {
Api.getsetweek().then((res) => {
if (res.success) {
this.getweekList()
this.weekType = res.result.title
} else {
let parmse = {
conditions: [],
isDesc: true,
pageSize: 10
}
Api.getWeekTypeList(parmse).then((res) => {
this.weekTypeList = res.result
this.weekTypeList.map((v) => {
if ((v.isvalid = 1)) {
this.weekType = v.title
} else {
this.weekType = 0
}
})
})
}
})
},
//获取公休日数组
getweekList() {
let parmse = {
conditions: [],
isDesc: true,
pageSize: 10
}
Api.getWeekTypeList(parmse).then((res) => {
this.weekTypeList = res.result
})
},
//设置公休日
radioChange(a) {
let datArray = this.weekTypeList
datArray.map(u=>{
if(a== u.title){
this.weekTypeid = u.id
}
})
let id = this.weekTypeid
Api.setweek({ id: id }).then((res) => {
if (res.success) {
this.weekFlag = true
} else {
this.weekFlag = false
console.log('设置失败')
}
})
},
addOk() {
this.$refs.grid.load()
this.addModal = false
this.editModal = false
this.curId = 0
},
search() {
this.$refs.grid.reload(this.easySearch)
},
edit(id) {
this.editModal = true
this.curId = id
},
remove(id) {
this.deletelModal = true
this.curId = id
},
removeOk() {
Api.delete({ id: this.curId }).then((r) => {
if (r.success) {
this.$refs.grid.load()
this.deletelModal = false
this.$Message.success('删除成功')
}
})
},
removeCancel() {
this.deletelModal = false
},
cancel() {
this.curId = 0
this.addModal = false
this.editModal = false
this.deletedlModal = false
this.deletelMore = false
},
//多选处理--表格选择项变化方法
selectionChange(selection) {
this.selectedRows = selection
this.footerModel = selection.length > 0
},
deleteMore() {
this.deletelMore = true
},
l(key) {
/*
calendar_overtime:{
id:'',
creationTime:'创建时间',
creatorUserId:'创建人',
lastModificationTime:'更新时间',
lastModifierUserId:'更新人',
isDeleted:'删除人',
deletionTime:'删除时间',
deleterUserId:'删除人',
title:'日历名称',
restType:'关联节假日',
holidayId:'',
holidayTitle:'',
holidayStartendTime:'',
status:'',
}
*/
let vkey = 'calendar_overtime' + '.' + key
return this.$t(vkey) || key
}
}
}
</script>
<style lang="less">
.overtime {
.footer02 {
background: #4c5968;
opacity: 0.9;
position: absolute;
bottom: 9px;
box-shadow: 0px -5px 6px rgba(0, 0, 0, 0.3);
width: 86%;
z-index: 99;
padding: 10px;
color: #fff;
margin: 10px 0 10px 0;
}
}
</style>
\ No newline at end of file
<template>
<Form ref="form" :model="condition" :label-width="90">
<Row>
<Col :span="12" :v-if="condition.id.show"><FormItem :label="l('id')" prop="id"> <Input v-model="condition.id.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.creationTime.show"><FormItem :label="l('creationTime')" prop="creationTime"> <DatePicker type="daterange" v-model="condition.creationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.creatorUserId.show"><FormItem :label="l('creatorUserId')" prop="creatorUserId"> <Input v-model="condition.creatorUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModificationTime.show"><FormItem :label="l('lastModificationTime')" prop="lastModificationTime"> <DatePicker type="daterange" v-model="condition.lastModificationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModifierUserId.show"><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId"> <Input v-model="condition.lastModifierUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.isDeleted.show"><FormItem :label="l('isDeleted')" prop="isDeleted"> <Input v-model="condition.isDeleted.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.deletionTime.show"><FormItem :label="l('deletionTime')" prop="deletionTime"> <DatePicker type="daterange" v-model="condition.deletionTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.deleterUserId.show"><FormItem :label="l('deleterUserId')" prop="deleterUserId"> <Input v-model="condition.deleterUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.title.show"><FormItem :label="l('title')" prop="title"> <Input v-model="condition.title.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.restType.show"><FormItem :label="l('restType')" prop="restType"> <Input v-model="condition.restType.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.holidayId.show"><FormItem :label="l('holidayId')" prop="holidayId"> <Input v-model="condition.holidayId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.holidayTitle.show"><FormItem :label="l('holidayTitle')" prop="holidayTitle"> <Input v-model="condition.holidayTitle.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.holidayStartendTime.show"><FormItem :label="l('holidayStartendTime')" prop="holidayStartendTime"> <Input v-model="condition.holidayStartendTime.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.status.show"><FormItem :label="l('status')" prop="status"> <Input v-model="condition.status.value"> </Input>
</FormItem></Col>
</Row>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
condition: {
id:{op:"Equal",value:null,show:false},
creationTime:{op:"Range",value:null,show:false},
creatorUserId:{op:"Equal",value:null,show:false},
lastModificationTime:{op:"Range",value:null,show:false},
lastModifierUserId:{op:"Equal",value:null,show:false},
isDeleted:{op:"Equal",value:null,show:false},
deletionTime:{op:"Range",value:null,show:false},
deleterUserId:{op:"Equal",value:null,show:false},
title:{op:"Equal",value:null,show:true},
restType:{op:"Equal",value:null,show:true},
holidayId:{op:"Equal",value:null,show:true},
holidayTitle:{op:"Equal",value:null,show:true},
holidayStartendTime:{op:"Equal",value:null,show:true},
status:{op:"Equal",value:null,show:true},
},
}
},
methods: {
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "calendar_overtime" + "." + key;
return this.$t(key)
}
}
}
</script>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col span="24">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title" placeholder="请填写日历名称"></Input>
</FormItem>
</Col>
<Col span="24">
<FormItem :label="l('calendarClassTitle')" prop="calendarClassId">
<Select v-model="entity.calendarClassId" multiple @on-change="getItems">
<Option
v-for="item in orderCatList"
:value="item.id"
:key="item.index"
:label="item.title+'('+ item.startendTime +')'"
></Option>
</Select>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
disabled: false,
orderCatList: [],
multipleFlag: false,
vlableLis : [],
sum: 0,
idList : [],
titleClass:'',
titleClass02:'',
entity: {
id:[],
title:"",
calendarClassId:[],
calendarClassTitle:"",
workHours:0
},
selectItems:[],//选中的加班日历
rules: {
title: [{ required: true, message: '请填写日历名称', trigger: 'blur' }],
calendarClassId: [
{ required: true, type: 'array', min: 1, message: '请选择关联班次', trigger: 'change' },
]
}
}
},
props: {
v: Object
},
created() {
this.selectAry()
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true
let titles=[];
this.selectItems.map(u=>{
titles.push(u.title+"("+u.startendTime+")")
})
let parme = {
title:this.entity.title,
calendarClassTitle:titles.join(),
calendarClassId:this.entity.calendarClassId.join(),
workHours:this.getHours()
}
Api.create(parme)
.then((r) => {
this.disabled = false
if (r.success) {
this.$Message.success('保存成功')
this.entity.calendarClassId=[];
this.$refs.form.resetFields();
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.orderCatList = []
this.$emit('on-close')
},
selectAry() {
let parmse = {
pageIndex: 0,
cont: 0,
conditions: [],
pageSize: 0
}
Api.getlist().then((res) => {
this.orderCatList = res.result
})
},
getItems(v){ //获取所有选中项;
var items=this.orderCatList.filter(u=>{
return v.indexOf(u.id)>-1
})
this.selectItems=items;
},
getHours(){ //获取工时
let sum=0;
this.selectItems.map(u=>{
sum+=u.workHours;
});
return sum;
},
l(key) {
key = 'calendar_work' + '.' + key
return this.$t(key)
}
},
watch: {
v() {
this.entity = this.$u.clone(this.v)
}
}
}
</script>
\ No newline at end of file
import Api from '@/plugins/request'
export default {
index:`${systemUrl}/calendarwork/paged`,
paged(params){
return Api.post(`${systemUrl}/calendarwork/paged`,params);
},
get(params){
return Api.get(`${systemUrl}/calendarwork/get`,params);
},
getlist(params){
return Api.get(`${systemUrl}/calendarwork/getselectclass`,params);
},
create(params){
return Api.post(`${systemUrl}/calendarwork/create`,params);
},
update(params){
return Api.post(`${systemUrl}/calendarwork/update`,params);
},
//删除:
delete(params) {
return Api.delete(`${systemUrl}/calendarwork/delete`,{params:params});
},
}
\ No newline at end of file
<template>
<div class="detail">
<Row>
<Filed :span="12" :name="l('title')">{{entity.title}}</Filed>
<Filed :span="12" :name="l('calendarClassId')">{{entity.calendarClassId}}</Filed>
<Filed :span="12" :name="l('calendarClassTitle')">{{entity.calendarClassTitle}}</Filed>
<Filed :span="12" :name="l('calendarClassStart')">{{entity.calendarClassStart}}</Filed>
<Filed :span="12" :name="l('calendarClassEnd')">{{entity.calendarClassEnd}}</Filed>
<Filed :span="12" :name="l('workHours')">{{entity.workHours}}</Filed>
</Row>
</div>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
entity: {},
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }],
code: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.$emit('on-load')
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "calendar_work" + "." + key;
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
}
}
}
</script>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col span="24">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title" placeholder="请填写日历名称"></Input>
</FormItem>
</Col>
<Col span="24">
<FormItem :label="l('calendarClassTitle')"prop="classId" >
<Select v-model="entity.classId" multiple @on-change="getItems">
<Option
v-for="item in orderCatList"
:value="item.id"
:key="item.index"
:label="item.title+'('+ item.startendTime +')'"
></Option>
</Select>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Edit',
data() {
return {
disabled: false,
entity: {},
orderCatList: [],
selectItems: [], //选中的加班日历
rules: {
title: [{ required: true, message: '请填写日历名称', trigger: 'blur' }],
classId: [
{ required: true, type: 'array', min: 1, message: '请选择关联班次', trigger: 'change' },
]
}
}
},
props: {
eid: Number
},
created() {
this.selectList()
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
let dataForm = r.result
if(dataForm.calendarClassId){
let ids = dataForm.calendarClassId.split(',')
var uids=[];
ids.map(u=>{
uids.push(parseInt(u))
})
this.getItems(uids);
dataForm.classId=uids;
}else{
dataForm.classId=[];
}
this.entity = dataForm
this.$emit('on-load')
})
},
selectList() {
Api.getlist().then((res) => {
this.orderCatList = res.result
})
},
getItems(v) {
//获取所有选中项;
var items = this.orderCatList.filter((u) => {
return v.indexOf(u.id) > -1
})
this.selectItems = items
},
getHours() {
let sum = 0
this.selectItems.map((u) => {
sum += u.workHours
})
return sum
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true
let titles=[];
this.selectItems.map(u=>{
titles.push(u.title+"("+u.startendTime+")")
})
this.entity.calendarClassTitle=titles.join();
var data=this.$u.clone(this.entity);
data.calendarClassId=this.entity.classId.join();
data.workHours=this.getHours();
Api.update(data)
.then((r) => {
this.disabled = false
if (r.success) {
this.$Message.success('保存成功');
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'calendar_work' + '.' + key
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
</script>
\ No newline at end of file
<template>
<div class="workiview">
<DataGrid :columns="columns" ref="grid" :action="action" :high="false" :height="tableHeight"
@on-selection-change="selectionChange" >
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入关键字日历名称/" v-model="easySearch.keys.value" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons">
<Button type="primary" @click="addFn">新增</Button>
</template>
</DataGrid>
<div class="footer02" v-if="footerModel">
<span class="span">
已选择
<b class="span02">{{selectedRows.length}}</b>
</span>
<Button @click="deleteMore" class="span ml20"><Icon type="md-close"/>批量删除</Button>
</div>
<Modal v-model="addModal" ref="addmodal" title="新增" footer-hide>
<Add @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="editModal" title="编辑" footer-hide>
<Edit :eid="curId" @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
<p>确定删除?</p>
</Modal>
<Modal v-model="deletelMore" title="批量删除"@on-ok="cancel" @on-cancel="cancel">
<p>确定删除这{{selectedRows.length}}项么?</p>
</Modal>
</div>
</template>
<script>
import Api from './api'
import Add from './add'
import Edit from './edit'
import Detail from './detail'
import Search from './search'
export default {
name: 'list',
components: {
Add,
Edit,
Detail,
Search
},
data() {
return {
action: Api.index,
easySearch: {
keys: { op: 'title,calendarClassTitle', value: null }
},
addModal: false,
editModal: false,
deletelModal: false,
selectedRows: [], //表格选中项
tableHeight: '',
footerModel: false,
deletelMore: false,
curId: 0,
columns: [
// { type: 'selection', width: 70, align: 'center'},
{ key: 'id', title: this.l('id'), hide: true, align: 'left' },
{
key: 'creationTime',
title: this.l('creationTime'),
hide: true,
align: 'left'
},
{
key: 'creatorUserId',
title: this.l('creatorUserId'),
hide: true,
align: 'left'
},
{
key: 'lastModificationTime',
title: this.l('lastModificationTime'),
hide: true,
align: 'left'
},
{
key: 'lastModifierUserId',
title: this.l('lastModifierUserId'),
hide: true,
align: 'left'
},
{
key: 'isDeleted',
title: this.l('isDeleted'),
hide: true,
align: 'left'
},
{
key: 'deletionTime',
title: this.l('deletionTime'),
hide: true,
align: 'left'
},
{
key: 'deleterUserId',
title: this.l('deleterUserId'),
hide: true,
align: 'left'
},
{
key: 'title',
title: this.l('title'),
align: 'left',
easy: true,
high: true
},
{
key: 'calendarClassId',
title: this.l('calendarClassId'),
align: 'left',
hide: true,
high: true
},
{
key: 'calendarClassTitle',
title: this.l('calendarClassTitle'),
align: 'left',
easy: true,
high: true
},
{
key: 'calendarClassStart',
title: this.l('calendarClassStart'),
align: 'left',
hide: true,
high: true
},
{
key: 'calendarClassEnd',
title: this.l('calendarClassEnd'),
align: 'left',
hide: true,
high: true
},
{
key: 'workHours',
title: this.l('workHours'),
align: 'left',
high: true
},
{
title: '操作',
key: 'id',
width: 140,
align: 'center',
render: (h, params) => {
return h('div', { class: 'action' }, [
h(
'op',
{
attrs: { oprate: 'edit' },
on: { click: () => this.edit(params.row.id) }
},
'编辑'
),
h(
'op',
{
attrs: { oprate: 'remove' },
on: { click: () => this.remove(params.row.id) }
},
'删除'
)
])
}
}
]
}
},
created(){
this.tableHeight = window.innerHeight - 230
},
mounted() {
window.onresize = () => {///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight
this.tableHeight = window.screenHeight - 230
})()
}
},
async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典
},
methods: {
addOk() {
this.$refs.grid.load()
this.addModal = false
this.editModal = false
this.curId = 0
},
addFn(){
this.addModal=true
this.$refs.addmodal.entity = {}
},
search() {
this.$refs.grid.reload(this.easySearch)
},
edit(id) {
this.editModal = true
this.curId = id
},
remove(id) {
this.deletelModal = true
this.curId = id
},
removeOk() {
Api.delete({ id: this.curId }).then((r) => {
if (r.success) {
this.$refs.grid.load()
this.deletelModal = false
this.$Message.success('删除成功')
}
})
},
removeCancel() {
this.deletelModal = false
},
cancel() {
this.curId = 0
this.addModal = false
this.detailModal = false
this.editModal = false
this.deletedlModal = false
this.deletelMore = false
},
//多选处理--表格选择项变化方法
selectionChange(selection) {
this.selectedRows = selection
this.footerModel = selection.length > 0
},
deleteMore(){
this.deletelMore = true
},
l(key) {
/*
calendar_work:{
id:'',
creationTime:'创建时间',
creatorUserId:'创建人',
lastModificationTime:'更新时间',
lastModifierUserId:'更新人',
isDeleted:'删除人',
deletionTime:'删除时间',
deleterUserId:'删除人',
title:'日历名称',
calendarClassId:'关联班次',
calendarClassTitle:'',
calendarClassStart:'',
calendarClassEnd:'',
workHours:'工作时长',
}
*/
let vkey = 'calendar_work' + '.' + key
return this.$t(vkey) || key
}
}
}
</script>
<style lang="less">
.workiview{
.footer02{
background: #4c5968;
opacity: 0.9;
position: absolute;
bottom: 9px;
box-shadow: 0px -5px 6px rgba(0,0,0,0.3);
width: 86%;
z-index: 99;
padding: 10px;
color: #fff;
margin: 10px 0 10px 0;
}
}
</style>
\ No newline at end of file
<template>
<Form ref="form" :model="condition" :label-width="90">
<Row>
<Col :span="12" :v-if="condition.id.show"><FormItem :label="l('id')" prop="id"> <Input v-model="condition.id.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.creationTime.show"><FormItem :label="l('creationTime')" prop="creationTime"> <DatePicker type="daterange" v-model="condition.creationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.creatorUserId.show"><FormItem :label="l('creatorUserId')" prop="creatorUserId"> <Input v-model="condition.creatorUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModificationTime.show"><FormItem :label="l('lastModificationTime')" prop="lastModificationTime"> <DatePicker type="daterange" v-model="condition.lastModificationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModifierUserId.show"><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId"> <Input v-model="condition.lastModifierUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.isDeleted.show"><FormItem :label="l('isDeleted')" prop="isDeleted"> <Input v-model="condition.isDeleted.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.deletionTime.show"><FormItem :label="l('deletionTime')" prop="deletionTime"> <DatePicker type="daterange" v-model="condition.deletionTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.deleterUserId.show"><FormItem :label="l('deleterUserId')" prop="deleterUserId"> <Input v-model="condition.deleterUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.title.show"><FormItem :label="l('title')" prop="title"> <Input v-model="condition.title.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.calendarClassId.show"><FormItem :label="l('calendarClassId')" prop="calendarClassId"> <Input v-model="condition.calendarClassId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.calendarClassTitle.show"><FormItem :label="l('calendarClassTitle')" prop="calendarClassTitle"> <Input v-model="condition.calendarClassTitle.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.calendarClassStart.show"><FormItem :label="l('calendarClassStart')" prop="calendarClassStart"> <DatePicker type="daterange" v-model="condition.calendarClassStart.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.calendarClassEnd.show"><FormItem :label="l('calendarClassEnd')" prop="calendarClassEnd"> <DatePicker type="daterange" v-model="condition.calendarClassEnd.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.workHours.show"><FormItem :label="l('workHours')" prop="workHours"> <Input v-model="condition.workHours.value"> </Input>
</FormItem></Col>
</Row>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
condition: {
id:{op:"Equal",value:null,show:false},
creationTime:{op:"Range",value:null,show:false},
creatorUserId:{op:"Equal",value:null,show:false},
lastModificationTime:{op:"Range",value:null,show:false},
lastModifierUserId:{op:"Equal",value:null,show:false},
isDeleted:{op:"Equal",value:null,show:false},
deletionTime:{op:"Range",value:null,show:false},
deleterUserId:{op:"Equal",value:null,show:false},
title:{op:"Equal",value:null,show:true},
calendarClassId:{op:"Equal",value:null,show:true},
calendarClassTitle:{op:"Equal",value:null,show:true},
calendarClassStart:{op:"Range",value:null,show:true},
calendarClassEnd:{op:"Range",value:null,show:true},
workHours:{op:"Equal",value:null,show:true},
},
}
},
methods: {
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "calendar_work" + "." + key;
return this.$t(key)
}
}
}
</script>
\ No newline at end of file
<template>
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :show-message="false" :label-width="90">
<Row>
<FormItem label="类型" prop="typeid">
<Select v-model="formValidate.typeid" placeholder="请选择" style="width:240px;">
<Option v-for="(item,index) in alltype " :key="item.index" :value="item.value">{{item.label}}</Option>
</Select>
</FormItem>
</Row>
<Row>
<FormItem label="名称" prop="name">
<Input v-model="formValidate.name" style="width:240px;"></Input>
</FormItem>
</Row>
<Row>
<FormItem label="描述" prop="description">
<Input v-model="formValidate.description" style="width:240px;"></Input>
</FormItem>
</Row>
<!-- <FormItem label="编号" prop="number">
<Input v-model="formValidate.number" number></Input>
</FormItem> -->
</Form>
</template>
<script>
export default {
name:'addDictionary',
props:['alltype'],
data(){
return {
formValidate:{typeid:'',name:'',description:''},
ruleValidate:{
name:[{required: true}],
// number:[{required: true,type:'number'}],
typeid:[{required: true}]
}
}
}
}
</script>
<style scoped>
.ivu-form-item {width:48%;display:inline-block;}
.ivu-form-item:nth-child(odd) {
margin-left: 10px
}
</style>
\ No newline at end of file
<template>
<div>
<div class="contentRight">
<label>类型:</label>
<Select v-model="model1" @on-change="change" placeholder="请选择" style="width: 200px">
<Option v-for="(item,index) in selectdata" :key="item.index" :value="item.value">{{item.label}}</Option>
</Select>
<div style="float:right" class="paddingbtn">
<Button type="primary" @click="add('formValidate')">新增</Button>
<!-- <Button type="primary" @click="edit">编辑</Button>
<Button type="primary" @click="del">删除</Button> -->
</div>
<tb :tbPro="tbPro" ref="table" v-on:rowclick="rowclick" class="margin-top-10"></tb>
</div>
<Modal v-model="modal1" title="新增字典数据" :width="440" :mask-closable="false"
:loading="myloading"
ok-text="保存" cancel-text="取消" @on-ok="ok('formValidate')" @on-cancel='cancel'
>
<add-dictionary ref="datadictionary" :alltype="selectdata"></add-dictionary>
<!-- <div slot="footer" style="text-align:center">
<Button type="primary" @click="ok('formValidate')">保存</Button>
<Button
type="primary"
style="border-color: rgb(204, 204, 204);background-color:white;color:black"
@click="cancel"
>取消</Button>
</div> -->
</Modal>
<myconfirm ref="mysel" v-on:confirmok="okmysel" v-on:confirmcancel="cancelmysel"></myconfirm>
</div>
</template>
<script>
import tb from '../roleManagent/components/tb'
import addDictionary from './components/add'
import myconfirm from '../../processDesign/productTree/components/myconfirm'
import service from '@/plugins/request'
export default {
components:{tb,addDictionary,myconfirm},
data(){
return {
myloading:true,
model1:'',
modal1:false,
isEdit:false,
formValidate1:{},
keyid:0,
clickdata:{},
//xia la
selectdata:[
{
value:'产品类型',
label:'产品类型'
},
{
value:'产品分类',
label:'产品分类'
},
{
value:'工艺类型',
label:'工艺类型'
},
{
value:'工艺阶段',
label:'工艺阶段'
},
{
value:'产品型号',
label:'产品型号'
},
],
//表格数据和属性
tbPro:{
height:"",
isBorder: true,
stripe: true,//斑马纹
highlight:true,//高亮显示
columns: [
{
type: 'index',
width: 60,
align: 'center'
},
{
title: '名称',
key: 'name'
},
{
title: '描述',
key: 'description'
},
{
title: '编码',
key: 'code'
},
{
title: '操作',
key: 'action',
align: 'center',
width:400,
render: (h, params) => {
return h('div', [
h(
'span',
{
props: {
type: 'text',
ghost:true
},
style: {
color: '#249E91',
marginRight:"5px",
cursor:"pointer"
},
on: {
click: () => {
this.edit(params)
}
}
},
'编辑'
),
h(
'span',
{
props: {
type: 'text',
ghost:true
},
style: {
color: '#F56C6C',
marginRight:"5px",
cursor:"pointer"
},
on: {
click: () => {
this.del(params)
}
}
},
'删除'
)
])
}
}
],
data: [
]
}
}
},
created(){
var url=`${systemUrl}/DictionaryType/GetPaged`
service.get(`${url}`).then(response=>{
//console.log(response.result.items)
this.selectdata=response.result.items
this.model1=this.selectdata[0].value
this.loaddata(this.model1)
});
this.tbPro.height = window.innerHeight - 180;
},
mounted(){
window.onresize = () => {
return (() => {
this.tbPro.height = window.innerHeight - 180;
})()
}
},
computed:{
alldata:function(){
return this.tbPro.data
}
},
methods:{
loaddata(id){
var url=`${systemUrl}/Dictionary/GetPaged`
service.get(`${url}`,{params:{TypeId:id}}).then(response=>{
this.tbPro.data=response.result.items
})
},
change(data){
// console.log(data);
this.loaddata(data)
},
add:function(name){
this.isEdit=false;
var a = this.$refs.datadictionary;
a.$refs[name].resetFields();
this.modal1=true;
this.$refs.datadictionary.formValidate={typeid:'',description:'',name:''}
},
edit(params){
var a = this.$refs.datadictionary;
a.$refs['formValidate'].resetFields();
this.modal1=true;
this.isEdit=true;
let {typeId,name,description,id,code}=params.row;
// console.log(typeId)
// console.log(number);
this.$refs.datadictionary.formValidate={typeid:typeId,name:name,description:description,id:id,code:code}
},
del(params){
console.log(params)
this.keyid=params.row.id
console.log(this.keyid)
this.$refs.mysel.confirmmodal=true;
},
okmysel(bl){
var url=`${systemUrl}/Dictionary/Delete?id=${this.keyid}`
service.delete(`${url}`).then(response=>{
if(response.success)
{
this.$Message.success('删除成功')
this.loaddata(this.model1)
}
}).catch(error=>{
this.$Message.error('删除失败')
})
this.$refs.mysel.confirmmodal=bl
},
cancelmysel(bl){
this.$refs.mysel.confirmmodal=bl
},
//保存增加修改
ok(name){
var a = this.$refs.datadictionary;
var url=`${systemUrl}/Dictionary/CreateOrUpdate`
var ar=this.alldata.find((val)=>{
return (val.name==this.$refs.datadictionary.formValidate.name)
})
if(ar){
this.$Message.error('已存在字典项的名字');
setTimeout(() => {
this.myloading = false
this.$nextTick(() => {
this.myloading = true
})
}, 500)
return;
}
a.$refs[name].validate((valid) => {
if (valid) {
this.formValidate1 = this.$refs.datadictionary.formValidate
if (this.isedit)
{
//this.formValidate1.id=
}
service.post(`${url}`,JSON.stringify({Dictionary:this.formValidate1})).then(response=>{
if(response.success){
this.$Message.success('保存成功')
this.loaddata(this.model1)
this.modal1 = false
}
}).catch(error=>{
//console.log(123)
// console.log(error)
this.$Message.error('保存失败')
})
} else {
setTimeout(() => {
this.myloading = false
this.$nextTick(() => {
this.myloading = true
})
}, 500)
this.$Message.error('请输入必填项')
}
})
},
cancel(){
this.modal1=false;
},
rowclick(data,index){
console.log(typeof(data));
this.clickdata=data;
// console.log(this.clickdata);
}
}
}
</script>
<style scoped>
</style>
import api from '@/plugins/request'
const u=(path)=>`${systemUrl}/Dictionary/${path}`
export default {
getChildren(id) {
return api.get(u("GetChildren"), { id })
},
getTree(){
return api.get(u('GetTree'))
},
setColor(paras) {
return api.post(u("SetColor"), {Dictionary:paras})
},
setSort(paras) {
return api.post(u("SetSort"), paras)
},
save(paras) {
return api.post(u("CreateOrUpdate"), {Dictionary:paras})
},
}
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row class="rowTitle100">
<FormItem label="类别" prop="typeId">
<RadioGroup v-model="entity.typeId">
<Radio :label="0" disabled>系统</Radio>
<Radio :label="1" disabled>分类</Radio>
<Radio :label="2" disabled>字典</Radio>
<Radio :label="3" disabled>字典项</Radio>
</RadioGroup>
</FormItem>
</Row>
<Row class="rowTitle100">
<FormItem label="名称" prop="name">
<Input v-model="entity.name">
<ColorPicker v-model="entity.color" slot="prepend" transfer size="small" transfer recommend />
</Input>
</FormItem>
</Row>
<Row class="rowTitle100">
<FormItem label="编码" prop="code">
<Input v-model="entity.code" />
</FormItem>
</Row>
<Row class="rowTitle100">
<FormItem label="图标" prop="icon">
<InputIcon v-model="entity.icon"></InputIcon>
</FormItem>
</Row>
<FormItem label="状态" prop="number">
<RadioGroup v-model="entity.status">
<Radio :label="0">启用</Radio>
<Radio :label="1">禁用(名称和值可以启用或禁用,但不能删除)</Radio>
</RadioGroup>
</FormItem>
<FormItem label="锁定" prop="number">
<RadioGroup v-model="entity.isStatic">
<Radio :label="0">不锁定</Radio>
<Radio :label="1">锁定(锁定后不可改变名称和值,不能删除)</Radio>
</RadioGroup>
</FormItem>
<Row class="rowTitle100">
<FormItem label="描述" prop="description">
<Input v-model="entity.description" type="textarea" :rows="3"></Input>
</FormItem>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
export default {
name: 'Edit',
data() {
return {
entity: this.v,
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }],
code: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
v: Object
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
var url2 = `${systemUrl}/Dictionary/createorupdate`
this.$api.post(url2, { Dictionary: this.entity }).then((r) => {
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
}
})
}
})
},
handleClose() {
this.$emit('on-close')
}
},
watch: {
v(v) {
this.entity = this.v
console.info(this.entity)
}
}
}
</script>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<template>
<div class="jurisdiction">
<div class="jurisdiction-form">
<!-- <Form :model="formItem" :label-width="70" inline>
<FormItem label="菜单名称">
<Input v-model="formItem.name" placeholder="请输入菜单名"></Input>
</FormItem>
<FormItem label="菜单状态">
<Select v-model="formItem.status" placeholder="请选择菜单状态">
<Option value="1">显示</Option>
<Option value="2">隐藏</Option>
</Select>
</FormItem>
<FormItem :label-width="0">
<Button type="primary" @click="listTree">查询</Button>
</FormItem>
</Form> -->
<div class="right-btn">
<Button type="primary" @click="add">新建系统</Button>
</div>
</div>
<div>
<div class="margin-top-10">
<tree-grid
:items="data"
ref="table"
:columns="columns"
@on-row-click="rowClick"
@on-selection-change="selectionClick"
@on-sort-change="sortClick"
></tree-grid>
</div>
</div>
<!-- 新增系统弹框 -->
<Modal
v-model="addShow"
:title=" titleAdd"
:width="440"
:mask-closable="false"
ok-text="保存"
cancel-text="取消"
@on-ok="saveOk"
@on-cancel="saveCancel"
>
<div style="height:250px;padding:20px 0">
<Form :model="addModel" :label-width="120" inline>
<FormItem label="系统名称">
<Input
style="width:240px;"
size="large"
v-model.trim="addModel.name"
placeholder="请输入系统名称"
/>
</FormItem>
<FormItem label="请求地址">
<Input
style="width:240px;"
size="large"
v-model.trim="addModel.url"
placeholder="请输入请求地址"
/>
</FormItem>
<FormItem label="备注">
<Input
:rows="4"
maxlength="50"
show-word-limit
type="textarea"
placeholder="请输入备注信息"
style="width: 240px"
size="large"
v-model.trim="addModel.remark"
/>
</FormItem>
</Form>
</div>
</Modal>
<!-- 新建菜单/目录弹框 -->
<add-Memu ref="showAdd" :dataChild="dataChild" @listTree="listTree"></add-Memu>
</div>
</template>
<script>
import addMemu from './componets/addMemu'
export default {
name: '',
components: {
addMemu
},
data() {
return {
dataChild: {},
addShow: false,
showMenu: false,
titleAdd: '',
formItem: {
status: '',
name: ''
},
addModel: {
name: '',
url: '',
remark: '',
type: '0'
},
data: [],
columns: [
{
title: '菜单名称',
key: 'name',
width: '150',
sortable: true
},
{
title: '排序',
key: 'priority'
},
{
title: '请求地址',
key: 'url',
width: '200',
align: 'left'
},
{
title: '类型',
key: 'type',
align: 'center',
// render: (h, params) => {
// return h('state', {
// props: {
// code: 'system.menu.target',
// type: 'text',
// value: params.row.type + ''
// }
// })
// },
type: 'menuRender'
},
{
title: '状态',
key: 'status',
align: 'center',
type: 'menuIsshow'
},
{
title: 'icon图标',
key: 'icon',
align: 'center',
width: '100',
type: 'icons'
},
{
title: '打开方式',
key: 'target',
width: '150',
align: 'center',
type: 'menuTarget'
},
{
title: '备注',
key: 'remark',
width: '150'
},
{
title: '操作',
type: 'action',
actions: [
{
type: 'primary',
text: '新增'
},
{
type: 'primary',
text: '编辑'
},
{
type: 'error',
text: '删除'
}
],
width: '150'
}
]
}
},
created() {
this.formItem = {}
this.listTree()
},
async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典
},
methods: {
//查询
listTree() {
// name:this.formItem.name,status:this.formItem.status
this.$http.jurisdiction.getListTree(this.formItem).then((res) => {
// debugger
this.data = res.result
})
},
//新建
add() {
this.titleAdd = '新增系统'
this.addModel = {}
this.addShow = true
},
selectionClick(arr) {
//console.log('选中数据id数组:' + arr)
// this.checkids = arr
},
sortClick(key, type) {
//console.log('排序字段:' + key)
//console.log('排序规则:' + type)
},
rowClick(data, event, index, txt) {
this.dataChild = data
console.log(data)
if (txt == '新增') {
this.$refs.showAdd.showMenu = true
this.$refs.showAdd.addModel.type = '1'
this.$refs.showAdd.addModel.status = '1'
this.$refs.showAdd.addModel.up_id = data.id
this.$refs.showAdd.addModel.upName = data.name
this.$refs.showAdd.width = 500
this.$refs.showAdd.isActive = false
this.$refs.showAdd.hasError = true
this.$refs.showAdd.title = '新建目录'
this.$refs.showAdd.addModel.name = ''
this.$refs.showAdd.addModel.priority = ''
this.$refs.showAdd.addModel.remark = ''
}
if (txt == '编辑') {
if (data.type == '0') {
this.titleAdd = '编辑系统'
this.addShow = true
} else if (data.type == '3') {
//按钮
this.$refs.showAdd.customTitle = '编辑按钮'
this.$refs.showAdd.customShow = true
this.$refs.showAdd.customModel.status = data.status.toString()
this.$refs.showAdd.customModel.type = data.type.toString()
} else {
this.titleEit = '编辑目录/菜单'
this.$refs.showAdd.showCatalog = true
this.$refs.showAdd.catalogModel.status = data.status.toString()
this.$refs.showAdd.catalogModel.type = data.type.toString()
}
}
if (txt == '删除') {
this.$Modal.confirm({
title: '删除',
content: '<p>是否删除此条菜单,删除请选择确认,否则请取消</p>',
okText: '确认',
cancelText: '取消',
onOk: () => {
this.$http.jurisdiction.deleteRow(data.id).then((res) => {
this.$Message.success('删除成功')
this.listTree()
})
}
})
}
//console.log('当前行数据:' + data)
// console.log('点击行号:' + index)
// console.log('点击事件:' + event)
},
saveOk() {
if (this.titleAdd == '新增系统') {
this.addModel.type = '0'
} else if (this.titleAdd == '编辑系统') {
this.addModel.id = this.childId
}
this.$http.jurisdiction.add({ privilege: this.addModel }).then((res) => {
this.listTree()
})
},
saveCancel() {}
}
}
</script>
<style lang="less" scoped>
.jurisdiction-form {
margin-top: 10px;
// position: relative;
.right-btn {
text-align: right;
margin-bottom: 10px;
// position: absolute;
// top: 0px;
// right: 10px;
}
}
</style>
\ No newline at end of file
<template id="addPRi">
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :show-message="false" :label-width="80" >
<FormItem label="父权限" prop="up_id">
<Select v-model="formValidate.up_id" style="width:240px;">
<Option v-for="(item,index) in list " :key="index" :value="item.value" style="display:none">{{item.label}} </Option>
<Tree v-show="isShow" :data="seldata" @on-select-change="handleSelect"></Tree>
</Select>
</FormItem>
<FormItem label="权限名称" prop="name">
<Input v-model="formValidate.name" style="width:240px;"></Input>
</FormItem>
<FormItem label="系统" prop="from_system">
<Select v-model="formValidate.from_system" @on-change="selectSys" style="width:240px;">
<Option v-for="(item,index) in allsystem " :key="index+1" :value="item.value">{{item.label}}</Option>
</Select>
</FormItem>
<FormItem label="操作类型" prop="type">
<Select v-model="formValidate.type" placeholder="请选择" style="width:240px;">
<Option value=1>菜单</Option>
<Option value=2>系统</Option>
<Option value=3>页面</Option>
</Select>
</FormItem>
<FormItem label="地址" prop="url">
<Input v-model="formValidate.url" style="width:240px;"></Input>
<!-- <Select v-model="formValidate.url" placeholder="请选择">
<Option v-for="(item,index) in allpages " :key="item.value" :value="item.value">{{item.label}}</Option>
</Select> -->
</FormItem>
<!-- <FormItem label="密级" prop="secret_class">
<Select v-model="formValidate.secret_class" placeholder="请选择" style="width:240px;">
<Option v-for="(item,index) in mijis " :key="item.value" :value="item.value">{{item.label}}</Option>
</Select>
</FormItem> -->
<FormItem label="状态" prop="status">
<Select v-model="formValidate.status" placeholder="请选择" style="width:240px;">
<Option value=0>启用</Option>
<Option value=1>禁用</Option>
</Select>
</FormItem>
<!-- <FormItem label="打开方式" prop="target">
<Select v-model="formValidate.target" placeholder="请选择" style="width:240px;">
<Option value="系统内">系统内</Option>
<Option value="新页面">新页面</Option>
</Select>
</FormItem> -->
<FormItem label="排序" prop="priority">
<Input v-model="formValidate.priority" style="width:240px;"></Input>
</FormItem>
</Form>
</template>
<script>
import service from '@/plugins/request'
export default {
name:'addPrivilege',
tit:'',
props:[
'seldata'
],
data(){
return {
formValidate:{name:'',up_id:-1,from_system:'',type:'',url:'',status:'',target:'',priority:'',secret_class:''},
ruleValidate: {
up_id:[{required: true}],
name:[{required: true}],
from_system:[{required: true}],
type:[{required: true}],
url:[{required: true}]
// priority:[ { required: true, message: '排序不能为空' },
// { type: 'number', message: '请输入排序,只能填写数字' }]
},
list:[],
isShow:true,
allsystem:[
{
value:'0',
label:'三车间MES'
},
{
value:'1',
label:'机加MES'
}
],
allpages:[
{
value:'/a/index.html',
label:'/a/index.html'
},
{
value:'/a/port.html',
label:'/a/port.html'
},
{
value:'/a/default.html',
label:'/a/default.html'
}
],
mijis:[
{
value:'机密',
label:'机密'
},
{
value:'一般',
label:'一般'
},
{
value:'内部',
label:'内部'
}
]
}
},
created(){
this.formValidate.from_system=this.allsystem[0].value
//this.gettree(this.formValidate.from_system);
},
computed:{
},
methods:{
selectSys(){
this.$emit('selectSys',this.formValidate.from_system)
},
handleSelect(data){
this.list=[];
this.list.push({label:data[0].title,value:data[0].value});
console.log(this.list);
this.formValidate.up_id=data[0].value;
},
getdata(){
return this.formValidate
}
}
}
</script>
<style scoped>
.ivu-form-item {width:48%;display:inline-block;}
.ivu-form-item:nth-child(odd) {
margin-left: 10px
}
</style>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<template>
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :show-message="false" :label-width="90" >
<Row >
<FormItem label="角色名称" prop="name">
<Input v-model="formValidate.name" style="width:240px;"></Input>
</FormItem>
</Row>
<Row >
<FormItem label="状态" prop="status">
<Select v-model="formValidate.status" placeholder="请选择" style="width:240px;">
<Option value="0">启用</Option>
<Option value="1">禁用</Option>
</Select>
</FormItem>
</Row>
<Row >
<FormItem label="角色描述" prop="description">
<Input v-model="formValidate.description" style="width:240px;"></Input>
</FormItem>
</Row>
<!-- <FormItem label="角色类型" prop="type">
<Select v-model="formValidate.type" placeholder="请选择">
<Option value="生产处调度员">生产处调度员</Option>
<Option value="库管">库管</Option>
<Option value="班组长">班组长</Option>
<Option value="操作工">操作工</Option>
</Select>
</FormItem> -->
</Form>
</template>
<script>
export default {
name:'addRole',
tit:'',
props:[
''
],
data(){
return {
formValidate:{name:'',status:'',description:''},
ruleValidate: {
name:[{required: true}],
status:[{required: true}]
},
isShow:true,
allsystem:[
{
value:'全部',
label:'全部'
},
{
value:'三车间MES',
label:'三车间MES'
},
{
value:'机加MES',
label:'机加MES'
}
],
}
},
created(){
},
methods:{
}
}
</script>
<style scoped>
.ivu-form-item {width:46%;display:inline-block;}
.ivu-form-item:nth-child(odd) {
margin-left: 10px
}
.ivu-form-item:nth-child(even) {
margin-left: 14px
}
</style>
\ No newline at end of file
<template>
<div>
<Input v-model="value1" placeholder="请输入角色名称" clearable style="width: 200px" />
<Select v-model="model1" style="width:200px" clearable placeholder="请选择">
<Option v-for="item in roleStatus" :value="item.value" :key="item.value">{{item.label }}</Option>
</Select>
<Button type="primary" @click="search">查询</Button>
<slot></slot>
</div>
</template>
<script>
export default {
name:'rolemain',
data(){
return {
value1:'',
model1: '',
roleStatus: [
{
value: '启用',
label: '启用'
},
{
value: '禁用',
label: '禁用'
}
]
}
},
methods:{
search:function(){
this.$emit('search',this.value1,this.model1)
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<Select v-model="model1" style="width:200px">
<Option v-for="item in roleStatus" :value="item.value" :key="item.value">{{item.label}}</Option>
</Select>
</template>
<script>
export default {
name:'sel',
props:[
'model1','roleStatus'
]
}
</script>
\ No newline at end of file
<template>
<Table :border="tbPro.isBorder" stripe :columns="tbPro.columns" :stripe="tbPro.stripe"
:data="tbPro.data" :highlight-row="tbPro.highlight" :loading="tbPro.loading" :height="tbPro.height" :content="tbPro.cur" @on-row-click="rowclick" class="tableCommon"></Table>
</template>
<script>
export default {
name:'tb',
props:[
//'columns1','data1','isBorder'
'tbPro'
],
methods:{
rowclick(rowdata,index){
this.$emit('rowclick',rowdata,index)
}
}
}
</script>
\ No newline at end of file
This diff is collapsed.
<template>
<div>
<div class="roleMenu">
<Tree v-if="show" :data="list" ref="mytree" show-checkbox check-directly ></Tree>
</div>
<div>
<Button type="primary" @click="commit">保存</Button>
<Button class="ml20" @click="$emit('menu-close')">取消</Button>
</div>
</div>
</template>
<script>
export default {
name: 'addRole',
tit: '',
props: {
role: Object
},
data() {
return {
show:false,
data: [],
list:[]
}
},
created() {
this.loadTree();
},
methods: {
loadTree() {
var url = `${systemUrl}/menu/list`
this.$api.post(`${url}`, { pageSize: 2000 ,conditions:[{"fieldName":"Type","fieldValue":3,"conditionalType":"LessThan"}]}).then((r) => {
r.result.sort(function(a,b){
return a.priority-b.priority;
})
this.data = r.result;
})
},
loadRole() {
var url = `${systemUrl}/roleMenu/GetRoleMenu`
//权限树
this.show=false
this.list=[]
this.$api.get(`${url}`, { id: this.role.id }).then((response) => {
let ids= response.result
var items=this.$u.clone(this.data);
console.info(ids,items);
this.list=this.$u.toTree(items,0,u=>{
u.title=u.name;
u.expand=true;
if(ids.indexOf(u.id)>-1){
u.checked=true;
}else{
delete u.checked
}
},"upId")
this.show=true
})
},
commit(){
var list=[];
this.$refs.mytree.getCheckedAndIndeterminateNodes().map(u=>{
list.push({id:u.id,methodId:u.methodId|0,status:u.checked?1:0})
});
var url = `${systemUrl}/RoleMenu/AddRoleMenu`
//权限树
this.$api.post(`${url}`, { id: this.role.id ,list:list}).then((r) => {
if(r.success){
this.$Message.success("权限设置成功!")
}
})
}
}
,
watch:{
"role.id"(v){
this.loadRole();
}
}
}
</script>
<style scoped>
.roleMenu{
height: 400px;
overflow: auto;
}
</style>
\ No newline at end of file
<template>
<Form ref="formValidate" :model="formValidate" :label-width="80">
<Row :gutter="24">
<Col span="12">
<FormItem label="操作者" prop="userName">
<Input v-model="formValidate.userName" style="width:240px;"></Input>
</FormItem>
</Col>
<Col span="12">
<FormItem label="操作坏境" prop="system">
<Input v-model="formValidate.system" style="width:240px;"></Input>
</FormItem>
</Col>
</Row>
<Row :gutter="24">
<Col span="12">
<FormItem label="浏览器" prop="look">
<Input v-model="formValidate.look" style="width:240px;"></Input>
</FormItem>
</Col>
<Col span="12">
<FormItem label="发起页面" prop="startpage">
<Input v-model="formValidate.startpage" style="width:240px;"></Input>
</FormItem>
</Col>
</Row>
<Row :gutter="24">
<Col span="12">
<FormItem label="请求时间 (毫秒)" prop="executionDuration">
<Input v-model="formValidate.executionDuration" style="width:240px;"></Input>
</FormItem>
</Col>
<Col span="12">
<FormItem label="模块名称" prop="serviceName">
<Input v-model="formValidate.serviceName" style="width:240px;"></Input>
</FormItem>
</Col>
</Row>
<Row :gutter="24">
<Col span="12">
<FormItem label="处理方法" prop="methodName">
<Input v-model="formValidate.methodName" style="width:240px;"></Input>
</FormItem>
</Col>
<Col span="12">
<FormItem label="操作说明" prop="note">
<Input v-model="formValidate.note" style="width:240px;"></Input>
</FormItem>
</Col>
</Row>
<Row :gutter="24">
<Col span="12">
<FormItem label="ip地址" prop="clientIpAddress">
<Input v-model="formValidate.clientIpAddress" style="width:240px;"></Input>
</FormItem>
</Col>
<Col span="12"></Col>
</Row>
<Row style="height:90px">
<FormItem label="表单数据" prop="parameters">
<Input
v-model="formValidate.parameters"
type="textarea"
:rows="3"
style="width:634px;"
></Input>
</FormItem>
</Row>
<Row style="height:75px">
<FormItem label="异常信息" prop="exception">
<Input
v-model="formValidate.exception"
type="textarea"
:rows="3"
style="width:634px;"
></Input>
</FormItem>
</Row>
</Form>
</template>
<script>
export default {
name: 'detail',
data() {
return {
formValidate: {
userName: '',
system: '',
look: '',
startpage: '',
executionDuration: '',
serviceName: '',
methodName: '',
note: '',
clientIpAddress: '',
parameters: '',
exception: ''
}
}
}
}
</script>
<style scoped>
.ivu-form-item {
width: 48%;
display: inline-block;
}
.ivu-form-item:nth-child(odd) {
margin-left: 10px;
}
</style>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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