|
|
@@ -0,0 +1,432 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-button size="mini" type="text" @click="editBtn">编 辑</el-button>
|
|
|
+ <el-drawer title="汇报设置" append-to-body :show-close="false" :visible.sync="dialog" size="1100px">
|
|
|
+ <div slot="title" style="font-size: 15px">
|
|
|
+ 汇报设置
|
|
|
+ </div>
|
|
|
+ <div class="drawer__panel">
|
|
|
+ <el-form :model="form" :rules="rules" ref="form" label-width="140px" label-position="left" size="mini">
|
|
|
+ <div class="report-people" style="margin-bottom:0">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="模板名称:" prop="reportname">
|
|
|
+ <el-input type="text" size="small" placeholder="请输入模板名称" v-model="form.reportname"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="是否启用:" prop="isused">
|
|
|
+ <el-checkbox v-model="form.isused" :false-label="0" :true-label="1"></el-checkbox>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ <div class="report-people">
|
|
|
+ <div class="report-people_header">
|
|
|
+ <div class="normal-title" style="font-size:14px;margin-right:10px">汇报人员</div>
|
|
|
+ <addPeople :data="data" @selectPeople="selectPeopleFun" v-model="form.hrids"></addPeople>
|
|
|
+ </div>
|
|
|
+ <el-form-item label-width="20px" prop="hrids">
|
|
|
+ <el-table
|
|
|
+ ref="table"
|
|
|
+ :data="selectPeople"
|
|
|
+ style="width: 100%"
|
|
|
+ size="mini"
|
|
|
+ v-model="form.hrids"
|
|
|
+ height="400px"
|
|
|
+ border>
|
|
|
+ <el-table-column
|
|
|
+ prop="hrcode"
|
|
|
+ label="编号">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="name"
|
|
|
+ label="姓名">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="depname"
|
|
|
+ label="部门">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="position"
|
|
|
+ label="职位">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" size="mini" @click="delSelecrPeople(scope.row)">删 除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div style="margin-top:16px;text-align:right">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ small
|
|
|
+ @current-change="peopleCurrentChange"
|
|
|
+ :current-page="selectPeopleParam.content.pageNumber"
|
|
|
+ :page-size="selectPeopleParam.content.pageSize"
|
|
|
+ layout="total, prev, pager, next, jumper"
|
|
|
+ :total="peopleTotal">
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div class="report-people">
|
|
|
+ <div class="report-people_header">
|
|
|
+ <div class="normal-title" style="font-size:14px;margin-right:10px">汇报内容预设</div>
|
|
|
+ <addOption :data="data" @selectOption="selectOptionFun" v-model="form.sys_workreportpresetids"></addOption>
|
|
|
+ </div>
|
|
|
+ <el-form-item label-width="20px" prop="sys_workreportpresetids">
|
|
|
+ <el-table
|
|
|
+ ref="table"
|
|
|
+ :data="selectOption"
|
|
|
+ style="width: 100%"
|
|
|
+ size="mini"
|
|
|
+ v-model="form.sys_workreportpresetids"
|
|
|
+ border>
|
|
|
+ <el-table-column
|
|
|
+ prop="title"
|
|
|
+ label="标题">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="sequence"
|
|
|
+ label="排序">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="text" size="mini" v-model="scope.row.sequence"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" size="mini" @click="delOption(scope.row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div class="report-people">
|
|
|
+ <div class="report-people_header">
|
|
|
+ <div class="normal-title" style="font-size:14px">汇报对象</div>
|
|
|
+ </div>
|
|
|
+ <div class="select-item">
|
|
|
+ <p style="font-size:14px;margin-bottom:10px">组织内指定人员</p>
|
|
|
+ <selectTeam :data="data" ref="team" @teamChange="teamChange">
|
|
|
+ <el-form-item label-width="20px" prop="reporttohrids">
|
|
|
+ <el-tag
|
|
|
+ v-model="form.reporttohrids"
|
|
|
+ style="margin-bottom:10px"
|
|
|
+ :key="tag.hrid"
|
|
|
+ v-for="tag in selectReport"
|
|
|
+ closable
|
|
|
+ :disable-transitions="false"
|
|
|
+ @close="handleClose(tag)">
|
|
|
+ {{tag.name}}
|
|
|
+ </el-tag>
|
|
|
+ <el-button class="button-new-tag" size="small" @click="$refs.team.dialogFormVisible=true;$refs.team.getOrderList()">+ 添 加</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </selectTeam>
|
|
|
+ </div>
|
|
|
+ <div class="select-item">
|
|
|
+ <p style="font-size:14px;margin-bottom:10px">组织内指定上级</p>
|
|
|
+ <el-form-item label-width="20px" prop="reporttohrids">
|
|
|
+ <el-select v-model="form.reporttodeps" multiple size="small" placeholder="请选择上级" style="width: 100%">
|
|
|
+ <el-option
|
|
|
+ v-for="item in deps"
|
|
|
+ :key="item.rowindex"
|
|
|
+ :label="item.value"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div class="fixed__btn__panel">
|
|
|
+ <el-button size="small" @click="dialog = false" class="normal-btn-width">取 消</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-drawer>
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import selectTeam from './teamSelect'
|
|
|
+import addPeople from './addPeople'
|
|
|
+import addOption from './addOption'
|
|
|
+export default {
|
|
|
+ name: "add",
|
|
|
+ props:['data'],
|
|
|
+ components:{selectTeam,addPeople,addOption},
|
|
|
+ data(){
|
|
|
+ return {
|
|
|
+ dialog:false,
|
|
|
+ peopleList:[],
|
|
|
+ deps:[],
|
|
|
+ detail:{},
|
|
|
+ form: {
|
|
|
+ "sys_workreportmodelid": 0,
|
|
|
+ "reportname": "",
|
|
|
+ "isused": 1,
|
|
|
+ "sys_workreportpresetids": [
|
|
|
+ ],
|
|
|
+ "hrids": [
|
|
|
+ ],
|
|
|
+ "reporttodeps": [
|
|
|
+ ],
|
|
|
+ "reporttohrids": [
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ rules:{
|
|
|
+ reportname:[
|
|
|
+ { required: true, message: '请填写模板名称', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ sys_workreportpresetids:[
|
|
|
+ { required: true, message: '请选择项', trigger: 'change'}
|
|
|
+ ],
|
|
|
+ hrids:[
|
|
|
+ { required: true, message: '请选择汇报人员', trigger: 'change'}
|
|
|
+ ],
|
|
|
+ reporttodeps:[
|
|
|
+ { required: true, message: '请选择上级部门', trigger: 'change'}
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ selectPeople:[],
|
|
|
+ selectReport:[],
|
|
|
+ selectOption:[],
|
|
|
+ selectPeopleParam: {
|
|
|
+ "id": "20230522140702",
|
|
|
+ "content": {
|
|
|
+ "sys_workreportmodelid": '',
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ selectOptionParam: {
|
|
|
+ "id": "20230522144902",
|
|
|
+ "content": {
|
|
|
+ "sys_workreportmodelid": '',
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ peopleTotal:0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ editBtn () {
|
|
|
+ this.dialog = true
|
|
|
+ this.getDetail(true)
|
|
|
+ this.getDepList()
|
|
|
+ this.getSelectPeople()
|
|
|
+ this.getselectOption()
|
|
|
+ },
|
|
|
+ async getDetail (init) {
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": "20230520160202",
|
|
|
+ "content": {
|
|
|
+ "sys_workreportmodelid": this.data.sys_workreportmodelid
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if (init) {
|
|
|
+ this.form = Object.assign({},this.form,res.data)
|
|
|
+ this.selectReport = this.form.reportuser
|
|
|
+ } else {
|
|
|
+ this.selectReport = res.data.reportuser
|
|
|
+ }
|
|
|
+ console.log(this.form);
|
|
|
+ },
|
|
|
+ async getpeopleList () {
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": "20230520160402",
|
|
|
+ "content": {
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 999999,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.modelList = res.data
|
|
|
+ console.log(this.modelList);
|
|
|
+ },
|
|
|
+ async getDepList () {
|
|
|
+ const res = await this.$store.dispatch('optiontypeselect','appointedsuperior')
|
|
|
+ this.deps = res.data
|
|
|
+ console.log(this.deps);
|
|
|
+ },
|
|
|
+ async getSelectPeople () {
|
|
|
+ this.selectPeopleParam.content.sys_workreportmodelid = this.data.sys_workreportmodelid
|
|
|
+ let res = await this.$api.requested(this.selectPeopleParam)
|
|
|
+ this.selectPeople = res.data
|
|
|
+ this.peopleTotal = res.total
|
|
|
+ console.log(this.selectPeople);
|
|
|
+ },
|
|
|
+ async getselectOption () {
|
|
|
+ this.selectOptionParam.content.sys_workreportmodelid = this.data.sys_workreportmodelid
|
|
|
+ let res = await this.$api.requested(this.selectOptionParam)
|
|
|
+ this.selectOption = res.data
|
|
|
+ console.log(this.selectOption);
|
|
|
+ },
|
|
|
+ async selectPeopleFun (data) {
|
|
|
+ let id = data.map(item => item.hrid)
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": "20230522101402",
|
|
|
+ "content": {
|
|
|
+ "sys_workreportmodelid": this.data.sys_workreportmodelid,
|
|
|
+ "type": 1, //汇报人员,汇报对象
|
|
|
+ "hrids": id
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
+ this.getSelectPeople()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async selectOptionFun (data) {
|
|
|
+ let id = data.map(item => {
|
|
|
+ return {
|
|
|
+ id:item.sys_workreportpresetid,
|
|
|
+ sequence:item.rowindex
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": "20230522143302",
|
|
|
+ "content": {
|
|
|
+ "sys_workreportmodelid": this.data.sys_workreportmodelid,
|
|
|
+ "sys_workreportpresetids": id
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
+ this.getselectOption()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async delSelecrPeople (data) {
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": "20230522101502",
|
|
|
+ "content": {
|
|
|
+ "sys_workreportmodelid": this.data.sys_workreportmodelid,
|
|
|
+ "type": 1, //汇报人员,汇报对象
|
|
|
+ "hrids": [data.hrid]
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
+ this.selectPeople.splice(this.selectPeople.findIndex(item => item.hrid == data.hrid),1)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async delOption (data) {
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": "20230522143402",
|
|
|
+ "content": {
|
|
|
+ "sys_workreportmodelid": this.data.sys_workreportmodelid,
|
|
|
+ "sys_workreportpresetids": [data.sys_workreportpresetid]
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
+ this.selectOption.splice(this.selectOption.findIndex(item => item.sys_workreportpresetid == data.sys_workreportpresetid),1)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onSubmit(){
|
|
|
+ this.form.sys_workreportpresetids = this.selectOption.map((item) => {
|
|
|
+ return {id:item.sys_workreportpresetid,sequence:item.sequence}
|
|
|
+ })
|
|
|
+ this.form.hrids = this.selectPeople.map(item => item.hrid)
|
|
|
+ this.form.reporttohrids = this.selectReport.map(item => item.hrid)
|
|
|
+ this.$refs['form'].validate(async (valid) => {
|
|
|
+ if (!valid) return false
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20230520142002",
|
|
|
+ "version":1,
|
|
|
+ "content": this.form
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ this.$refs['form'].resetFields();
|
|
|
+ this.dialog = false
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async teamChange (data) {
|
|
|
+ console.log(data);
|
|
|
+ let result = data.map(item => item.hrid)
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": "20230522101402",
|
|
|
+ "content": {
|
|
|
+ "sys_workreportmodelid": this.data.sys_workreportmodelid,
|
|
|
+ "type": 2, //汇报人员,汇报对象
|
|
|
+ "hrids": result
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
+ this.getDetail()
|
|
|
+ this.$refs.team.dialogFormVisible = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async handleClose(tag) {
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": "20230522101502",
|
|
|
+ "content": {
|
|
|
+ "sys_workreportmodelid": this.data.sys_workreportmodelid,
|
|
|
+ "type": 2, //汇报人员,汇报对象
|
|
|
+ "hrids": [tag.hrid]
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
+ this.selectReport.splice(this.selectReport.indexOf(tag), 1);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ peopleCurrentChange (val) {
|
|
|
+ this.selectPeopleParam.content.pageNumber = val
|
|
|
+ this.getSelectPeople()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.report-people {
|
|
|
+ margin-bottom: 30px;
|
|
|
+}
|
|
|
+.report-people .report-people_header {
|
|
|
+ display: flex;
|
|
|
+ margin-bottom: 20px;
|
|
|
+}
|
|
|
+.report-people .select-item {
|
|
|
+ margin-bottom: 20px;
|
|
|
+}
|
|
|
+.dialog-footer {
|
|
|
+ margin-top: 0;
|
|
|
+}
|
|
|
+.normal-title::before {
|
|
|
+ content: '*';
|
|
|
+ color: #f56c6c;
|
|
|
+ margin-right: 4px;
|
|
|
+}
|
|
|
+.el-select,.el-input,.el-cascader {
|
|
|
+ width: 100% !important;
|
|
|
+}
|
|
|
+.el-tag + .el-tag {
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
+.button-new-tag {
|
|
|
+ margin-left: 10px;
|
|
|
+ height: 32px;
|
|
|
+ line-height: 30px;
|
|
|
+ padding-top: 0;
|
|
|
+ padding-bottom: 0;
|
|
|
+}
|
|
|
+.input-new-tag {
|
|
|
+ width: 90px;
|
|
|
+ margin-left: 10px;
|
|
|
+ vertical-align: bottom;
|
|
|
+}
|
|
|
+</style>
|