You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
2.0 KiB
92 lines
2.0 KiB
<template>
|
|
<VxeGrid ref="vxeGrid" v-bind="gridOptions" @cell-click="cellClick" @checkbox-change="checkboxChange" @checkbox-all="checkboxAll" />
|
|
</template>
|
|
|
|
<script>
|
|
import { VXETable } from 'vxe-table'
|
|
import paoWanPgdConfig from './pgdTable'
|
|
import {getPgd, zx} from "@/api/zyjh";
|
|
|
|
export default {
|
|
name: 'PwanPgd',
|
|
props: {
|
|
worker:{
|
|
type:Function,
|
|
default:function (){}
|
|
},
|
|
workers:{
|
|
type:Array,
|
|
default:[]
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
type: 'llpg',
|
|
gridOptions: {},
|
|
list: {},
|
|
setExt:null,
|
|
}
|
|
},
|
|
created() {
|
|
const {options, columns,setExt} = paoWanPgdConfig()
|
|
this.setExt=setExt
|
|
this.gridOptions = options
|
|
this.gridOptions.columns = columns
|
|
this.initData()
|
|
},
|
|
methods: {
|
|
initData() {
|
|
getPgd({zt: '32'}).then(res => {
|
|
this.gridOptions.data = res.data
|
|
this.setExt('workers',this.$props.workers)
|
|
})
|
|
},
|
|
checkboxAll({checked}) {
|
|
const worker = this.$props.worker
|
|
if (!worker) {
|
|
this.$message.warning('请选择操作人')
|
|
return;
|
|
}
|
|
if (checked) {
|
|
this.paigong(worker)
|
|
}
|
|
},
|
|
checkboxChange({checked, row}) {
|
|
const worker = this.$props.worker()
|
|
if (!worker) {
|
|
this.$message.warning('请选择操作人')
|
|
return;
|
|
}
|
|
if (checked) {
|
|
this.paigong(worker)
|
|
}
|
|
},
|
|
paigong(worker) {
|
|
const list = this.$refs.vxeGrid.getCheckboxRecords()
|
|
const tmpArr = []
|
|
for (const item of list) {
|
|
const data = {
|
|
id: item.id,
|
|
llry: worker.userCode,//抛丸施工人员姓名
|
|
}
|
|
tmpArr.push(data)
|
|
}
|
|
const data = {
|
|
type: this.type,
|
|
field: 'llpgrq',
|
|
zxZtName: 'LLPG',
|
|
list: tmpArr
|
|
}
|
|
VXETable.modal.confirm('您确定派工吗?').then(res => {
|
|
res === 'confirm' && zx(data).then(res=>{
|
|
this.initData()
|
|
})
|
|
})
|
|
},
|
|
cellClick({row}) {
|
|
this.$emit('initPgd', row)
|
|
}
|
|
}
|
|
}
|
|
</script>
|