<template>
|
<el-dialog
|
width="60%"
|
title="人工类型"
|
top="5vh"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
class="part-dialog"
|
>
|
<el-row>
|
<el-col :span="7">
|
<el-table
|
stripe
|
ref="personList"
|
:data="personList"
|
@selection-change="personSelectionChange"
|
:row-style="{ height: '26px' }"
|
:cell-style="{ padding: '0' }"
|
style="padding-top: 74px"
|
>
|
<el-table-column type="selection" />
|
<el-table-column
|
label="人员名称"
|
prop="staffName"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="人员编号"
|
prop="staffNo"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
</el-table>
|
</el-col>
|
<el-col :span="17">
|
<ttable
|
:table="table"
|
@handleSelectionChange="handleSelectionChange"
|
@currentChange="handleCurrentChange"
|
:uploadInfo="uploadInfo"
|
:prelang="prelang"
|
:options="options"
|
:bottomOffset="350"
|
:ajaxFun="ajaxFun"
|
:paramObj="paramObj"
|
ref="commonHandymanTypeTable"
|
>
|
<template #toolbar>
|
<el-select
|
v-model="handymanTemplateId"
|
placeholder="请选择人工模板"
|
clearable
|
@change="changeHandymanTemplate"
|
>
|
<el-option
|
v-for="item in handymanTemplates"
|
:key="item.id"
|
:label="item.templateDescription"
|
:value="item.id"
|
>
|
</el-option>
|
</el-select>
|
</template>
|
</ttable>
|
</el-col>
|
</el-row>
|
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="innerVisible = false">取 消</el-button>
|
<el-button type="primary" @click="saveSelectRow">确 定</el-button>
|
</div>
|
</el-dialog>
|
</template>
|
<script>
|
import { fetchListByTemplateId } from '@/api/product/handymantype'
|
import ttable from '@/views/common/ztt-table'
|
import { getAllHandymanTemplate } from '@/api/product/handymantemplate'
|
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
personList: {
|
type: Array,
|
default: []
|
},
|
workstationId: {
|
type: Number,
|
default: null
|
}
|
},
|
data() {
|
return {
|
ajaxFun: fetchListByTemplateId,
|
innerVisible: false,
|
listLoading: true,
|
currentRow: null,
|
multipleSelection: [],
|
uploadInfo: {
|
// 是否展示上传EXCEL以及对应的url
|
isShow: false,
|
url: ''
|
},
|
prelang: 'operation',
|
options: {
|
height: 300, // 默认高度-为了表头固定
|
stripe: true, // 是否为斑马纹 table
|
highlightCurrentRow: false, // 是否要高亮当前行
|
border: true, // 是否有纵向边框
|
lazy: false, // 是否需要懒加载
|
fit: true, // 列的宽度是否自撑开
|
multiSelect: true, //
|
isGeneralSearch: true,
|
seqNo: true,
|
isRefresh: true, // 是否显示刷新按钮
|
isShowHide: true, // 是否显示显影按钮
|
isSearch: false, // 高级查询按钮
|
defaultOrderBy: { column: 'id', direction: 'desc' }
|
},
|
table: {
|
total: 0,
|
currentPage: 1,
|
pageSize: 20,
|
data: [],
|
// 标题
|
column: [
|
{
|
minWidth: '140',
|
prop: 'handymanNo',
|
label: '人工编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '140',
|
prop: 'handymanName',
|
label: '人工名称',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '140',
|
prop: 'conversionCoefficient',
|
label: '系数',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
}
|
],
|
materialTypeList: []
|
},
|
addOrUpdateVisible: false,
|
personSelection: [],
|
handymanTemplates: [],
|
handymanTemplateId: null,
|
paramObj: { handymanTemplateId: null }
|
}
|
},
|
components: {
|
ttable
|
},
|
methods: {
|
saveSelectRow() {
|
if (this.options.multiSelect) {
|
this.$emit(
|
'handleSelectionChange',
|
this.multipleSelection,
|
this.personSelection
|
)
|
} else {
|
this.$emit(
|
'handleSelectionChange',
|
this.currentRow,
|
this.personSelection
|
)
|
}
|
this.innerVisible = false
|
},
|
handleCurrentChange(row) {
|
this.currentRow = row
|
},
|
handleSelectionChange(val) {
|
// 多行选中
|
this.multipleSelection = val
|
},
|
getData() {
|
if (this.$refs.commonHandymanTypeTable !== undefined) {
|
this.$refs.commonHandymanTypeTable.getDataList()
|
}
|
},
|
// 选中上机人员
|
personSelectionChange(val) {
|
this.personSelection = val
|
},
|
// 选中人工模板
|
changeHandymanTemplate(val) {
|
this.paramObj = { handymanTemplateId: val }
|
this.$nextTick(() => {
|
this.getData()
|
})
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
this.$nextTick(() => {
|
this.getData()
|
})
|
}
|
},
|
workstationId: {
|
handler: function(newVal, oldVal) {
|
if (this.workstationId) {
|
getAllHandymanTemplate(
|
Object.assign({ workstationId: this.workstationId })
|
).then((response) => {
|
const handymanTemplates = response.data.data
|
if (handymanTemplates && handymanTemplates.length > 0) {
|
this.handymanTemplates = handymanTemplates
|
this.paramObj = {
|
handymanTemplateId: this.handymanTemplates[0].id
|
}
|
this.handymanTemplateId = this.handymanTemplates[0].id
|
} else {
|
this.handymanTemplates = []
|
this.paramObj = { handymanTemplateId: null }
|
this.handymanTemplateId = null
|
}
|
})
|
} else {
|
this.handymanTemplates = []
|
this.paramObj = { handymanTemplateId: null }
|
this.handymanTemplateId = null
|
}
|
},
|
immediate: true
|
}
|
}
|
}
|
</script>
|
<style>
|
.part-dialog .el-dialog__header {
|
padding: 10px 20px 10px;
|
}
|
.part-dialog .el-dialog__header .el-dialog__headerbtn {
|
top: 10px;
|
}
|
.part-dialog .el-dialog__body {
|
padding: 5px 20px;
|
}
|
|
.part-dialog .el-dialog__footer {
|
padding: 5px 20px 10px;
|
}
|
|
.part-dialog .el-dialog__body .avue-crud__pagination {
|
margin-top: 0px;
|
margin-bottom: 5px;
|
}
|
</style>
|