洋浦学校 值班设置功能前端开发

init
gongdi 3 years ago
parent 9f9140ec0e
commit 52081420d6

@ -3,86 +3,101 @@
<a-button class="editable-add-btn" @click="handleAdd">
增加
</a-button>
<a-table :columns="tableColumns" :loading="loading" :data-source="dataSource" :pagination="false">
<a-table :columns="tableColumns" :loading="loading" :data-source="dataSource" tableLayout="fixed"
:pagination="false">
<template slot="rota_name" slot-scope="text, record">
<editable-cell :text="text" @change="onCellChange(record.rota_id, 'rota_name', $event)" />
<editable-cell :text="text" @change="onCellChange(record.rota_id, 'rota_name', $event)"/>
</template>
<template v-for="week in weekArr" :slot="'staffId' + week" slot-scope="text, record">
{{record.staff_info_map[text]}}
<personInfo-cell :info="record.staff_info_map[text]" @setDuty="setDuty(record,week)"/>
</template>
</a-table>
<a-modal title="选择值班人员"
:visible="visible"
centered
cancelText="取消"
okText="确定"
@ok="handleOk"
@cancel="handleCancel">
<person-list-choose @submitChoose="submitChoose"/>
</a-modal>
</div>
</template>
<script>
import InterConfig from '../interConfig';
import {Table, Button, Spin} from 'ant-design-vue';
import {Table, Button, Spin, Modal} from 'ant-design-vue';
import EditableCell from './editableCell.vue';
import PersonInfoCell from './personInfoCell.vue';
import PersonListChoose from './personListChoose.vue';
export default{
data(){
return {
weekArr:[1,2,3,4,5,6,7],
weekArr: [1, 2, 3, 4, 5, 6, 7],
tableColumns: [
{
dataIndex: 'rota_name',
title:"轮值名称",
title: "轮值名称",
key: 'rotaName',
width: "200px",
align: "center",
scopedSlots: { customRender: 'rota_name' },
scopedSlots: {customRender: 'rota_name'},
},
{
dataIndex: 'staff_id_1',
key: 'staffId1',
title: "星期一",
align: "center",
scopedSlots: { customRender: 'staffId1' },
scopedSlots: {customRender: 'staffId1'},
},
{
dataIndex: 'staff_id_2',
key: 'staffId2',
title: "星期二",
align: "center",
scopedSlots: { customRender: 'staffId2' },
scopedSlots: {customRender: 'staffId2'},
},
{
dataIndex: 'staff_id_3',
key: 'staffId3',
title: "星期三",
align: "center",
scopedSlots: { customRender: 'staffId3' },
scopedSlots: {customRender: 'staffId3'},
},
{
dataIndex: 'staff_id_4',
key: 'staffId4',
title: "星期四",
align: "center",
scopedSlots: { customRender: 'staffId4' },
scopedSlots: {customRender: 'staffId4'},
},
{
dataIndex: 'staff_id_5',
key: 'staffId5',
title: "星期五",
align: "center",
scopedSlots: { customRender: 'staffId5' },
scopedSlots: {customRender: 'staffId5'},
},
{
dataIndex: 'staff_id_6',
key: 'staffId6',
title: "星期六",
align: "center",
scopedSlots: { customRender: 'staffId6' },
scopedSlots: {customRender: 'staffId6'},
},
{
dataIndex: 'staff_id_7',
key: 'staffId7',
title: "星期日",
align: "center",
scopedSlots: { customRender: 'staffId7' },
scopedSlots: {customRender: 'staffId7'},
},
],
dataSource: [],
count:0,
count: 0,
loading: false,
visible: false,
param:{},
currentCell:"",
}
},
created(){
@ -108,26 +123,59 @@
handleAdd() {
const {count, dataSource} = this;
const newData = {
index:"第二小组"
index: "第二小组"
};
this.dataSource = [...dataSource, newData];
this.count = count + 1;
},
onCellChange:function (key,dataIndex,value) {
onCellChange: function (key, dataIndex, value) {
const dataSource = [...this.dataSource];
const target = dataSource.find(item => item.rota_id = key);
if(target){
if (target) {
target[dataIndex] = value;
this.dataSource = dataSource
}
console.log("dataSource:",this.dataSource)
},
setDuty: function (rowInfo,key) {
this.visible = true;
this.currentCell = key;
this.param = rowInfo;
},
handleOk:function () {
this.visible = false;
},
handleCancel:function () {
this.visible = false;
},
submitChoose:function (staffId) {
this.param["staff_id_" + this.currentCell] = staffId;
this.InterfaceConfig.callInterface([{
url: InterConfig.saveRota.url,
params: this.param,
method: InterConfig.saveRota.method,
isTestLogin: InterConfig.saveRota.isTestLogin,
}], (result) => {
let resData = result[0].data;
if (resData.code === 2000) {
this.visible = false;
Modal.success({
title: "操作成功",
content: "",
centered: true
});
this.getListRota();
}
})
}
},
components: {
ATable: Table,
AButton: Button,
ASpin: Spin,
EditableCell
EditableCell,
PersonInfoCell,
AModal: Modal,
PersonListChoose
}
}
</script>
@ -138,9 +186,9 @@
padding: 0.5rem;
.ant-table-wrapper {
margin-top: 0.5rem;
/deep/ .editable-cell{
/deep/ .editable-cell {
position: relative;
.editable-cell-text-wrapper{
.editable-cell-text-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
@ -151,11 +199,11 @@
cursor: pointer;
}
}
.editable-cell-input-wrapper{
.editable-cell-input-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
.ant-input{
.ant-input {
width: calc(100% - 30px);
}
.editable-cell-icon-check {

@ -102,7 +102,6 @@
this.$refs.cropper.getFile((file) => {
// this.data.props.imgFile = file
if (this.$refs.cropper.file) {
console.log("file:",file)
StaticParams.uploadFile(file, (data) => {
if (data.success === true) {
this.spinning = false;

@ -0,0 +1,46 @@
<template>
<div class="table-person-info-cell-style" @click="setDuty">
<person-info-view v-if="showInfo" :info="info" />
<div v-else class="setting-btn-style" @click="setDuty"></div>
</div>
</template>
<script>
import Upload from '../../../../../../components/common/uploader/Upload.vue';
import PersonInfoView from './personInfoView.vue';
export default{
props: {
info: {
type: Object
}
},
data(){
return {
showInfo: this.$props.info && Object.keys(this.$props.info).length > 0 ? true : false,
fileJson: [],
}
},
watch: {
info: function (val) {
this.info = val;
this.showInfo = val && Object.keys(val).length > 0 ? true : false;
}
},
methods: {
setDuty: function () {
this.$emit('setDuty')
}
},
components: {
Upload,
PersonInfoView
}
}
</script>
<style scoped lang="scss">
.table-person-info-cell-style {
.setting-btn-style {
color: #31a8fa;
cursor: pointer;
}
}
</style>

@ -0,0 +1,60 @@
<template>
<div class="duty-person-info-view-style">
<Upload :type="2" :multiple="false" :option="{}" :fileData="fileJson" ref="fileUpload" :canUpload="false"
:canDownload="false"/>
<div>{{info.staff_name}}</div>
<div>{{'<' + info.position + '>'}}</div>
<div>{{info.telephone}}</div>
</div>
</template>
<script>
import Upload from '../../../../../../components/common/uploader/Upload.vue';
export default{
props: {
info: {
type: Object
}
},
data(){
return {
fileJson: [],
}
},
watch:{
info:function (val) {
this.info = val;
this.buildFile(val.id_photo_json);
}
},
mounted(){
this.buildFile(this.$props.info.id_photo_json);
},
methods: {
buildFile: function (fileObj) {
if (fileObj && Object.keys(fileObj).length > 0) {
this.fileJson = [];
fileObj["key"] = fileObj['url'];
this.fileJson.push(fileObj);
}
}
},
components: {
Upload
}
}
</script>
<style scoped lang="scss">
.duty-person-info-view-style{
height: auto;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
.upload-container-style {
width: auto !important;
.img-style {
margin-right: 0 !important;
}
}
}
</style>

@ -0,0 +1,98 @@
<template>
<div class="person-list-choose-style">
<vue-scroll :ops="listScroll" style="height:19rem" class="score-list-div">
<div class="content-style">
<div class="info-box-style" v-for="item in dataList" :key="item.staff_id">
<person-info-view :info="item"/>
<a-button class="choose-btn-style" type="primary" @click="choose(item)"></a-button>
</div>
</div>
</vue-scroll>
</div>
</template>
<script>
/*
* 人员选择组件
* */
import InterConfig from '../interConfig';
import PersonInfoView from './personInfoView.vue';
import {Button} from 'ant-design-vue';
export default{
data(){
return {
staffName: "",
dataList: [],
listScroll: this.StaticParams.scrollOption,
}
},
created(){
this.getPersonList();
},
methods: {
getPersonList: function () {
let param = {
bureau_id: this.BaseConfig.person_info_my.bureau_id,
staff_name: "",
}
this.InterfaceConfig.callInterface([{
url: InterConfig.chooseStaffs.url,
params: param,
method: InterConfig.chooseStaffs.method,
isTestLogin: InterConfig.chooseStaffs.isTestLogin,
}], (result) => {
this.loading = false;
let resData = result[0].data;
if (resData.code === 2000) {
let dataList = resData.data;
if (dataList && dataList.length > 0) {
for (let i = 0, len = dataList.length; i < len; i++) {
dataList[i]['index'] = i + 1 + ((this.pageNumber - 1) * 10);
let fileList = [];
dataList[i]['id_photo_json']['key'] = dataList[i]['id_photo_json']['url'];
fileList.push(dataList[i]['id_photo_json']);
dataList[i]['fileList'] = fileList;
}
}
this.dataList = dataList;
}
})
},
choose: function (info) {
this.$emit("submitChoose", info.staff_id)
}
},
components: {
PersonInfoView,
AButton: Button
}
}
</script>
<style scoped lang="scss">
.person-list-choose-style {
width: 100%;
height: auto;
display: flex;
.content-style {
width: 100%;
height: auto;
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
.info-box-style {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-right: 0.5rem;
/deep/ .img-style {
margin-right: 0 !important;
}
.choose-btn-style {
margin: 0.5rem 0;
width: 50%;
height: 20px;
}
}
}
}
</style>

@ -142,5 +142,38 @@ const InterfaceConfig = {
isTestLogin: true,
},
/*
* 值班轮值列表-不分页
* "bureau_id":"必填 int 机构id"
* "staff_name":"非必填 string 值班职工姓名(搜索条件)"
* */
'chooseStaffs': {
url: 'intellioa/center/duty/chooseStaffs',
method: 'get',
isTestLogin: true,
},
/*
* 新增修改值班轮值信息
* "rota_id""轮值idnumber非必填填写即修改"
"rota_name""轮值名称string必填"
"staff_id_1""星期一值班职员idnumber非必填"
"staff_id_2""星期二值班职员idnumber非必填"
"staff_id_3""星期三值班职员idnumber非必填"
"staff_id_4""星期四值班职员idnumber非必填"
"staff_id_5""星期五值班职员idnumber非必填"
"staff_id_6""星期六值班职员idnumber非必填"
"staff_id_7""星期七值班职员idnumber非必填"
"person_id":"必填 int 操作人ID"
"identity_id":"必填 int 操作人身份ID"
"bureau_id":"必填 int 机构ID"
* */
'saveRota': {
url: 'intellioa/center/duty/saveRota',
method: 'post',
isTestLogin: true,
},
};
export default InterfaceConfig;

Loading…
Cancel
Save