Commit 98c068a8 authored by ww-xxy's avatar ww-xxy

优化窗口负责人

parent d4555d4e
...@@ -127,7 +127,6 @@ export default { ...@@ -127,7 +127,6 @@ export default {
return; return;
} }
this.tableData.loading = true; this.tableData.loading = true;
return;
this.$post("/attendance/stat/summary", this.query, { this.$post("/attendance/stat/summary", this.query, {
cancelToken: this.source.token, cancelToken: this.source.token,
}) })
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
label="负责人姓名" label="负责人姓名"
prop="staffId" prop="staffId"
filterable filterable
:disabled="editId?true:false"
v-model="form.staffId" v-model="form.staffId"
:enumData="userList" :enumData="userList"
placeholder="请输入负责人姓名" placeholder="请输入负责人姓名"
...@@ -62,7 +63,7 @@ ...@@ -62,7 +63,7 @@
</el-row> </el-row>
<div style="background-color: rgba(242, 246, 252, 1);padding: 20px;"> <div style="background-color: rgba(242, 246, 252, 1);padding: 20px;">
<wintable ref="wintable" :hallId="dict.hallId" class="wintabel" @selection-change="selectionChange"/> <wintable :editId="editId" ref="wintable" :hallId="dict.hallId" class="wintabel" @selection-change="selectionChange"/>
</div> </div>
<div style="padding: 20px;"> <div style="padding: 20px;">
...@@ -108,14 +109,39 @@ export default { ...@@ -108,14 +109,39 @@ export default {
] ]
}, },
userList:{}, userList:{},
userarr:[],//人员数组
checkArr:[],//选中窗口
editId:''//编辑id
}; };
}, },
methods: { methods: {
//重写表单
beforeSubmit(data){
data['deptName'] = this.dict.deptId[data.deptId]
data['salaName'] = this.dict.salaId[data.salaId]
data['staffName'] = this.userList[data.staffId]
try {
const userObj = this.userarr.find(v=>v.id == data.staffId) //工号
data['number'] = userObj.workNum
// 窗口列表
const checkArr = []
this.checkArr.forEach(v=>{
checkArr.push({
windowId:v.id,
windowName:v.name,
windowCode:v.fromnum,
building:v.building,
level:v.level
})
})
data['windowOwnerDetailList'] = checkArr
} catch (error) {}
return data
},
// 选中窗口 // 选中窗口
selectionChange(v){ selectionChange(v){
console.log(v,this.$refs.wintable,"########@@@@") this.checkArr = v
}, },
cascaderChange(val) { cascaderChange(val) {
if (this.deptList.length > 0) { if (this.deptList.length > 0) {
...@@ -130,7 +156,7 @@ export default { ...@@ -130,7 +156,7 @@ export default {
this.$post("/staff/list",{page:1,size:-1}).then(res=>{ this.$post("/staff/list",{page:1,size:-1}).then(res=>{
const {code,data} = res const {code,data} = res
if(code == 1){ if(code == 1){
const userList = data.data this.userarr = data.data
const arr = {} const arr = {}
data.data.forEach(element => { data.data.forEach(element => {
arr[element.id] = element.name arr[element.id] = element.name
...@@ -144,6 +170,7 @@ export default { ...@@ -144,6 +170,7 @@ export default {
}, },
/** 编辑 */ /** 编辑 */
edit(row) { edit(row) {
this.editId = row.staffId
this.reset(); this.reset();
this.query = { id: row.id }; this.query = { id: row.id };
this.urls.currUrl = "window/owner/edit"; this.urls.currUrl = "window/owner/edit";
...@@ -153,6 +180,7 @@ export default { ...@@ -153,6 +180,7 @@ export default {
}, },
/** 新增 */ /** 新增 */
add(row) { add(row) {
this.editId = ''
this.reset(); this.reset();
this.urls.currUrl = "window/owner/add"; this.urls.currUrl = "window/owner/add";
this.getData(); this.getData();
...@@ -161,6 +189,7 @@ export default { ...@@ -161,6 +189,7 @@ export default {
}, },
/** 查看*/ /** 查看*/
view(row) { view(row) {
this.editId = row.staffId
this.reset(); this.reset();
this.query = { id: row.id }; this.query = { id: row.id };
this.urls.currUrl = "window/owner/view"; this.urls.currUrl = "window/owner/view";
......
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
isshowTabPane: true, isshowTabPane: true,
search: [ search: [
{ {
name: "name", name: "staffName",
type: "text", type: "text",
label: "姓名", label: "姓名",
fuzzy: true, fuzzy: true,
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
{ label: "部门名称", prop: "deptName" }, { label: "部门名称", prop: "deptName" },
{ label: "姓名", prop: "name" }, { label: "姓名", prop: "staffName" },
{ label: "工号", prop: "number" }, { label: "工号", prop: "number" },
...@@ -73,6 +73,7 @@ export default { ...@@ -73,6 +73,7 @@ export default {
return ( return (
<table-buttons <table-buttons
noAdd noAdd
noView
row={row} row={row}
onEdit={this.toEdit} onEdit={this.toEdit}
onView={this.toView} onView={this.toView}
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<script> <script>
import table from "@/assets/mixins/table"; import table from "@/assets/mixins/table";
export default { export default {
props:['hallId','checkId'], props:['hallId','checkId','editId'],
mixins: [table], mixins: [table],
methods:{ methods:{
handleSelectionChange(v){ handleSelectionChange(v){
...@@ -16,12 +16,42 @@ export default { ...@@ -16,12 +16,42 @@ export default {
beforeFecth(){ beforeFecth(){
this.pageInfo.list = '/window/owner/subWindowList' this.pageInfo.list = '/window/owner/subWindowList'
}, },
//重写
afterRender(info){
const {data} = info
if(this.editId){
// 编辑的时候回显
const toggleRowSelection = []
data.forEach(element => {
if(element.selected == 1){
toggleRowSelection.push(element)
}
});
setTimeout(()=>{
this.toggleRowSelection = toggleRowSelection
})
}
}
}, },
created(){ created(){
this.config.search[0].enumData = this.hallId this.config.search[0].enumData = this.hallId
// setTimeout(()=>{ console.log(this.editId,"editId")
// this.toggleRowSelection = [this.tableData.data[0]]
// },2000) },
watch: {
editId:{
handler:function(v){
if(v){
this.query = {staffId:v}
}else{
this.query = {}
}
this.getData()
},
immediate:true
}
}, },
data(){ data(){
return { return {
......
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