<template>
|
<div>
|
<div class="body" :style="{height:mainHeight+'px'}">
|
<div class="bodyTopButtonGroup" style="justify-content: space-between">
|
<el-button type="primary" icon="el-icon-setting" @click="setting('setting')">设置</el-button>
|
</div>
|
|
<div class="bodyTopFormGroup">
|
<el-form
|
ref="form"
|
:model="form"
|
label-width="100px"
|
inline
|
style="display: flex;justify-content: space-between"
|
>
|
<div class="elForm" style="justify-content: flex-start">
|
<el-form-item label-width="70px" label="生产车间" style=" display: flex;">
|
<el-select
|
v-model="form.workshop"
|
style="width: 200px"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="item in workshopArr"
|
:key="item.code"
|
:label="item.name"
|
:value="item.code"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="生产单元" style=" display: flex;">
|
<el-select
|
v-model="form.devicetype"
|
style="width: 200px"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="item in devicetypeArr"
|
:key="item.code"
|
:label="item.name"
|
:value="item.code"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="有效状态" style=" display: flex;">
|
<el-select v-model="form.stustype" style="width: 200px" placeholder="请选择">
|
<el-option
|
v-for="item in stustypeArr"
|
:key="item.code"
|
:label="item.name"
|
:value="item.code"
|
/>
|
</el-select>
|
</el-form-item>
|
|
</div>
|
<div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened?'5%':'10%'}">
|
<el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
|
<el-button type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
|
</div>
|
</el-form>
|
<div
|
class="bodyTopFormExpand"
|
/>
|
</div>
|
|
<div class="elTableDiv">
|
<el-table
|
ref="tableDataRef"
|
class="tableFixed"
|
:data="tableData"
|
:style="{width: 100+'%',height:tableHeight+'px'}"
|
border
|
:height="tableHeight+'px'"
|
:row-class-name="tableRowClassName"
|
highlight-current-row
|
:header-cell-style="this.$headerCellStyle"
|
:cell-style="this.$cellStyle"
|
@sort-change="sortChange"
|
>
|
<el-table-column
|
prop="RowNum"
|
width="50"
|
fixed
|
label="序号"
|
/>
|
<el-table-column
|
prop="CaptPlanWorkShop"
|
label="生产车间"
|
sortable="custom"
|
width="160"
|
/>
|
<el-table-column
|
prop="CaptPlanDeviceType"
|
label="生产单元"
|
width="160"
|
sortable="custom"
|
/>
|
<el-table-column
|
prop="CaptPlanWorkShift"
|
label="默认方案"
|
sortable="custom"
|
width="240"
|
>
|
<template slot-scope="{row}">
|
<div style="display: flex;" @click="mrfaSearch(row,'mrfaSearch')">
|
<el-input
|
v-model="row.CaptPlanWorkShift"
|
readonly
|
/>
|
<el-button
|
type="primary"
|
style="padding: 0 10px;margin-left: 5px"
|
class="el-icon-search"
|
/>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="CaptPlanShopCalendarList"
|
label="工作日历"
|
sortable="custom"
|
>
|
<template slot-scope="{row}">
|
<date-picker
|
v-model="row.CaptPlanShopCalendarList"
|
:row-data="row"
|
style="width: 100%;"
|
:capacity-planning-search="CapacityPlanningSearch"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="CaptPlanUser"
|
label="创建人员"
|
sortable="custom"
|
width="160"
|
/>
|
<el-table-column
|
prop="CaptPlanDate"
|
width="160"
|
label="创建时间"
|
sortable="custom"
|
/>
|
|
<el-table-column
|
prop="CaptPlanStus"
|
width="160"
|
label="有效状态"
|
sortable="custom"
|
>
|
<template slot-scope="{row}">
|
<div v-if="row.CaptPlanStus==='Y'">
|
<svg-icon icon-class="circleYes" style="margin-right: 2px" />
|
有效
|
</div>
|
<div v-else-if="row.CaptPlanStus==='N'">
|
<svg-icon icon-class="circleNo" style="margin-right: 2px" />
|
无效
|
</div>
|
<div v-else>/</div>
|
</template>
|
</el-table-column>
|
|
<!-- <el-table-column-->
|
<!-- label="操作"-->
|
<!-- width="120"-->
|
<!-- fixed="right"-->
|
<!-- >-->
|
<!-- <template slot-scope="{row}">-->
|
<!-- <div class="operationClass">-->
|
<!-- <el-tooltip class="item" effect="dark" content="编辑" placement="top">-->
|
<!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />-->
|
<!-- </el-tooltip>-->
|
<!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">-->
|
<!-- <i class="el-icon-delete" @click="del(row)" />-->
|
<!-- </el-tooltip>-->
|
<!-- </div>-->
|
<!-- </template>-->
|
<!-- </el-table-column>-->
|
</el-table>
|
</div>
|
<!--分页-->
|
<pagination
|
:total="total"
|
:page.sync="form.page"
|
:limit.sync="form.rows"
|
align="right"
|
layout="total,prev, pager, next,sizes"
|
popper-class="select_bottom"
|
@pagination="getCapacityPlanningSearch"
|
/>
|
</div>
|
|
<el-dialog
|
:title="operation==='setting'?'设置':'默认方案'"
|
:visible.sync="dialogVisible"
|
width="1280px"
|
:close-on-click-modal="false"
|
top="10vh"
|
@closed="handleClose"
|
@close="handleClose"
|
>
|
<el-button v-if="operation==='setting'" type="primary" @click="addRow">新增</el-button>
|
<div class="elTableDiv">
|
<el-table
|
ref="tableDataDialogRef"
|
class="tableFixedDialog"
|
:data="tableDataDialog"
|
:style="{width: 100+'%',height:(tableHeight-200)+'px'}"
|
border
|
:height="(tableHeight-200)+'px'"
|
:row-class-name="tableRowClassName"
|
highlight-current-row
|
:header-cell-style="this.$headerCellStyle"
|
:cell-style="this.$cellStyle"
|
>
|
|
<el-table-column
|
v-if="operation!=='setting'"
|
width="50"
|
fixed
|
>
|
<template slot-scope="{row}">
|
<el-radio
|
v-model="radioSelectedId"
|
:label="row.hx"
|
style="padding-left: 10px;"
|
@change.native="getCurrentRowSource(row.hx)"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="famc"
|
label="方案名称"
|
width="150"
|
fixed
|
show-tooltip-when-overflow
|
>
|
<template slot-scope="{row}">
|
<el-input v-model="row.famc" :disabled="row.isVisible===0" type="text" />
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="gzsc"
|
label="工作时长"
|
width="100"
|
show-tooltip-when-overflow
|
/>
|
|
<el-table-column
|
prop="time1"
|
label="工作时间一"
|
>
|
<template slot-scope="{row}">
|
<el-time-picker
|
v-model="row.time1"
|
is-range
|
:disabled="row.isVisible===0"
|
:editable="false"
|
:clearable="false"
|
range-separator="~"
|
start-placeholder="开始"
|
end-placeholder="结束"
|
format="HH:mm"
|
@focus="val=>getTime(val,row,'time1')"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="time2"
|
label="工作时间二"
|
>
|
<template slot-scope="{row}">
|
<el-time-picker
|
v-model="row.time2"
|
is-range
|
:disabled="row.isVisible===0"
|
:editable="false"
|
:clearable="false"
|
range-separator="~"
|
start-placeholder="开始"
|
end-placeholder="结束"
|
format="HH:mm"
|
@focus="val=>getTime(val,row,'time2')"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="time3"
|
label="工作时间三"
|
>
|
<template slot-scope="{row}">
|
<el-time-picker
|
v-model="row.time3"
|
is-range
|
:editable="false"
|
:disabled="row.isVisible===0"
|
:clearable="false"
|
format="HH:mm"
|
range-separator="~"
|
start-placeholder="开始"
|
end-placeholder="结束"
|
@focus="val=>getTime(val,row,'time3')"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="time4"
|
label="工作时间四"
|
>
|
<template slot-scope="{row}">
|
<el-time-picker
|
v-model="row.time4"
|
is-range
|
format="HH:mm"
|
:editable="false"
|
:disabled="row.isVisible===0"
|
:clearable="false"
|
range-separator="~"
|
start-placeholder="开始"
|
end-placeholder="结束"
|
@focus="val=>getTime(val,row,'time4')"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="time5"
|
label="工作时间五"
|
>
|
<template slot-scope="{row}">
|
<el-time-picker
|
v-model="row.time5"
|
:disabled="row.isVisible===0"
|
is-range
|
:editable="false"
|
format="HH:mm"
|
:clearable="false"
|
range-separator="~"
|
start-placeholder="开始"
|
end-placeholder="结束"
|
@focus="val=>getTime(val,row,'time5')"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
v-if="operation==='setting'"
|
width="100"
|
fixed="right"
|
label="操作"
|
>
|
<template slot-scope="{row}">
|
<div class="operationClass">
|
<el-button v-if="row.isVisible===0" type="text" @click="editRow(row)">编辑</el-button>
|
<el-button v-if="row.isVisible===0" type="text" @click="delRow(row)">删除</el-button>
|
<el-button v-if="row.isVisible===1" type="text" @click="saveRow(row)">保存</el-button>
|
</div>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<div class="footerButton">
|
<el-button @click="dialogVisibleCancel">返 回</el-button>
|
<el-button v-if="operation!=='setting'" type="primary" @click="dialogVisibleConfirm">确 定</el-button>
|
</div>
|
</span>
|
</el-dialog>
|
|
<!--导入组件-->
|
<import-picker
|
ref="importPickerFunc"
|
class="importPickerClass"
|
:shows.sync="shows"
|
:title="title_value"
|
:colos="colos"
|
:code="code"
|
/>
|
|
</div>
|
</template>
|
|
<script>
|
import Pagination from '@/components/Pagination'
|
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
|
import { getCookie } from '@/utils/auth'
|
import ImportPicker from '@/components/ImportPicker'
|
import { validateCode } from '@/utils/global'
|
import $ from 'jquery'
|
import DatePicker from '@/components/DatePicker'
|
import { CapacityPlanningSearch } from '@/api/scgl'
|
import { DeviceTypeSelect, WorkShopSelect } from '@/api/sbgl'
|
|
export default {
|
name: 'Zzjg',
|
components: {
|
Pagination, ImportPicker, DatePicker
|
},
|
data() {
|
return {
|
mouseHoverType: 'mouseout',
|
isExpandForm: false,
|
mainHeight: 0,
|
tableHeight: 0,
|
form: {
|
workshop: '', // 车间编码
|
devicetype: '', // 生产单元
|
stustype: '', // 有效状态
|
prop: 'CaptPlanDate', // 排序字段
|
order: 'desc', // 排序字段
|
page: 1, // 第几页
|
rows: 20 // 每页多少条
|
},
|
stustypeArr: [
|
{ name: '有效', code: 'Y' },
|
{ name: '无效', code: 'N' }
|
],
|
workshopArr: [],
|
devicetypeArr: [],
|
total: 10,
|
tableData: [],
|
|
dialogVisible: false,
|
dialogForm: {
|
// OrgType: '',
|
// OrgCode: '',
|
// OrgName: '',
|
// SupUnit: ''// 上级单位
|
},
|
operation: '',
|
pickerOptions: {
|
disabledDate(time) {
|
// return time.getTime() > Date.now(); // 可选历史天、可选当前天、不可选未来天
|
// return time.getTime() > Date.now() - 8.64e7; // 可选历史天、不可选当前天、不可选未来天
|
return time.getTime() < Date.now() - 8.64e7 // 不可选历史天、可选当前天、可选未来天
|
// return time.getTime() < Date.now(); // 不可选历史天、不可选当前天、可选未来天
|
}
|
},
|
popoverVisible: false,
|
available: null,
|
nextMonth: null,
|
|
tableDataDialog: [
|
// {
|
// famc: '方案一',
|
// gzsc: '8小时',
|
// time1: [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 9, 40)],
|
// time2: '',
|
// time3: '',
|
// time4: '',
|
// time5: ''
|
// }
|
],
|
radioSelectedId: '',
|
|
title_value: '数据导入 / 点检部位',
|
code: '4',
|
shows: false
|
|
}
|
},
|
watch: {
|
shows() {
|
if (!this.shows) {
|
this.getCapacityPlanningSearch()
|
}
|
}
|
},
|
created() {
|
|
},
|
mounted() {
|
window.addEventListener('resize', this.getHeight)
|
this.getHeight()
|
|
this.handleRequest()
|
// this.getDialogData()
|
},
|
methods: {
|
getCurrentRowSource() {
|
|
},
|
getDialogData() {
|
let number = Math.random() * Math.random()// 作为删除时的标识符
|
number = number === 0 ? (10 + Math.random()) : number
|
this.tableDataDialog.push(
|
{
|
hx: 1,
|
famc: '方案一',
|
gzsc: '8小时',
|
time1: [],
|
time2: [],
|
time3: [],
|
time4: [],
|
time5: [],
|
number,
|
isVisible: 0
|
}
|
)
|
},
|
getTime(val, row, belong) {
|
const res = this.getDt()
|
if (belong === 'time1') {
|
// row.time1.push(new Date(res.yyyy, res.MM, res.dd, '00', '00'))
|
row.time1 = row.time1.length > 0 ? row.time1 : row.time1.push(new Date())
|
} else if (belong === 'time2') {
|
row.time2 = row.time2.length > 0 ? row.time2 : row.time2.push(new Date())
|
} else if (belong === 'time3') {
|
row.time3 = row.time3.length > 0 ? row.time3 : row.time3.push(new Date())
|
} else if (belong === 'time4') {
|
row.time4 = row.time4.length > 0 ? row.time4 : row.time4.push(new Date())
|
} else if (belong === 'time5') {
|
row.time5 = row.time5.length > 0 ? row.time5 : row.time5.push(new Date())
|
}
|
},
|
getDt() {
|
const dt = new Date()
|
|
const y = dt.getFullYear()
|
const m = (dt.getMonth() + 1 + '').padStart(2, '0')
|
const d = (dt.getDate() + '').padStart(2, '0')
|
|
const hh = (dt.getHours() + '').padStart(2, '0')
|
const mm = (dt.getMinutes() + '').padStart(2, '0')
|
const ss = (dt.getSeconds() + '').padStart(2, '0')
|
|
return { yyyy: y, MM: m, dd: d, hh, mm }
|
},
|
addRow() {
|
this.tableDataDialog.push(
|
{
|
hx: 2,
|
famc: '方案xxx',
|
gzsc: '8小时',
|
time1: [],
|
time2: [],
|
time3: [],
|
time4: [],
|
time5: [],
|
isVisible: 1
|
}
|
)
|
},
|
editRow(row) {
|
console.log(row)
|
row.isVisible = 1
|
},
|
saveRow(row) {
|
row.isVisible = 0
|
},
|
delRow(row) {
|
|
},
|
CapacityPlanningSearch() {
|
|
},
|
handleRequest() {
|
this.getCapacityPlanningSearch().then(res => {
|
if (res.code === '200') {
|
this.getWorkShopSelect()
|
this.getDeviceTypeSelect()
|
}
|
})
|
},
|
async getCapacityPlanningSearch() {
|
const res = await CapacityPlanningSearch(this.form)
|
this.total = res.count
|
this.tableData = res.data
|
this.tableData.forEach(item => {
|
item.CaptPlanShopCalendarList = item.CaiptPlanShopCalendarList ? item.CaptPlanShopCalendarList : []
|
})
|
|
return { code: res.code }
|
},
|
async getWorkShopSelect() {
|
const { data: res } = await WorkShopSelect()
|
this.workshopArr = res
|
},
|
async getDeviceTypeSelect() {
|
const { data: res } = await DeviceTypeSelect()
|
this.devicetypeArr = res
|
},
|
mrfaSearch(row, operation) {
|
console.log(row)
|
this.operation = operation
|
this.dialogVisible = true
|
|
this.$nextTick(() => {
|
this.$refs.tableDataDialogRef.doLayout()
|
})
|
},
|
// 排序改变时
|
sortChange({ column, prop, order }) {
|
if (order === 'descending') {
|
order = 'desc'
|
} else if (order === 'ascending') {
|
order = 'asc'
|
} else {
|
order = 'desc'
|
}
|
this.form.order = order
|
this.form.prop = prop
|
this.getCapacityPlanningSearch()
|
},
|
// 查询
|
search() {
|
this.getCapacityPlanningSearch()
|
},
|
// 导入按钮
|
upload() {
|
this.shows = true
|
this.$refs.importPickerFunc.newDataFunc()
|
},
|
colos() {
|
this.shows = false
|
},
|
// 重置
|
reset() {
|
this.form.workshop = ''
|
this.form.devicetype = ''
|
this.form.stustype = ''
|
this.getCapacityPlanningSearch()
|
},
|
setting(operation) {
|
this.operation = operation
|
this.dialogVisible = true
|
|
this.$nextTick(() => {
|
this.$refs.tableDataDialogRef.doLayout()
|
})
|
},
|
// 新增按钮
|
add(operation) {
|
this.operation = operation
|
this.dialogVisible = true
|
},
|
// 修改按钮
|
edit(operation, row) {
|
this.operation = operation
|
this.dialogVisible = true
|
|
this.$nextTick(() => {
|
this.dialogForm.OrgCode = row.org_code
|
this.dialogForm.OrgName = row.org_name
|
this.dialogForm.SupUnit = row.parent_id
|
})
|
},
|
// 删除按钮
|
async del(row) {
|
this.$confirm('是否确认删除?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
DeleteOrganization({ orgid: row.code }).then(res => {
|
if (res.code === '200') {
|
this.$message.success('删除成功!')
|
if (this.form.page > 1 && this.tableData.length === 1) {
|
this.form.page--
|
}
|
this.getCapacityPlanningSearch()
|
}
|
})
|
}).catch(() => {
|
this.$message.info('已取消删除')
|
})
|
},
|
// 对话框关闭事件
|
handleClose() {
|
this.dialogForm.OrgType = ''
|
this.dialogForm.OrgCode = ''
|
this.dialogForm.OrgName = ''
|
this.dialogForm.SupUnit = ''
|
this.$refs.dialogForm.clearValidate()
|
},
|
// 对话框取消
|
dialogVisibleCancel() {
|
this.dialogVisible = false
|
},
|
// 对话框确认
|
dialogVisibleConfirm() {
|
this.dialogVisible = false
|
},
|
// 获取页面高度
|
getHeight() {
|
this.$nextTick(() => {
|
this.mainHeight = window.innerHeight - 85
|
this.tableHeight = this.mainHeight - 195
|
this.$refs.tableDataRef.doLayout()
|
})
|
},
|
tableRowClassName({ row, rowIndex }) {
|
return 'custom-row'
|
}
|
}
|
}
|
</script>
|
|
<!--公共页面样式-->
|
<style lang="scss" scoped>
|
$main_color: #42b983;
|
::v-deep .el-button--text {
|
font-size: 14px;
|
cursor: pointer;
|
}
|
|
.el-icon-share, .el-icon-delete, .el-icon-edit-outline {
|
color: $main_color;
|
cursor: pointer;
|
}
|
|
.el-icon-edit-outline {
|
margin-right: 15px;
|
}
|
|
::v-deep .el-button--primary, .el-button--default, .el-button--info {
|
height: 34px;
|
display: flex;
|
align-items: center;
|
padding: 0 15px;
|
}
|
|
::v-deep .el-button--primary {
|
//background-color: $main_color !important;
|
}
|
|
::v-deep .el-button--default {
|
background-color: #f8f8fa;
|
border: none;
|
}
|
|
::v-deep .el-input__inner {
|
height: 34px;
|
line-height: 34px;
|
//color: #a7a7a7;
|
}
|
|
::v-deep .el-dialog__body {
|
//padding: 20px 100px !important;
|
padding: 20px !important;
|
}
|
|
::v-deep .dialogVisibleRoles .el-dialog__body {
|
padding: 20px 20px !important;
|
}
|
|
::v-deep .importPickerClass .el-dialog__body {
|
padding: 20px 20px !important;
|
}
|
|
::v-deep .el-dialog__footer {
|
display: flex;
|
justify-content: flex-end;
|
}
|
|
::v-deep .el-table .caret-wrapper {
|
transform: scale(0.8);
|
}
|
|
::v-deep .cell {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
}
|
|
::v-deep .el-table::before {
|
height: 0;
|
}
|
|
::v-deep .el-table__body-wrapper {
|
background-color: #f8f8fa;
|
}
|
|
::v-deep .el-table__body .el-table__row.hover-row td {
|
background-color: #eaecef;
|
}
|
|
::v-deep .el-form--inline .el-form-item__label {
|
color: #a7a7a7;
|
}
|
|
.body ::v-deep .el-divider {
|
border: 1px solid #eee;
|
width: 99%;
|
margin: 10px auto;
|
}
|
|
.body ::v-deep .el-form-item {
|
margin-bottom: 0;
|
}
|
|
.userDialogVisible ::v-deep .el-form-item {
|
margin-bottom: 0;
|
}
|
|
::v-deep .el-select__caret {
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
|
.tableFixed {
|
::v-deep .el-table__fixed-right {
|
height: 100% !important;
|
}
|
|
::v-deep .el-table__fixed {
|
height: 100% !important;
|
}
|
|
::v-deep .el-input__icon {
|
line-height: 35px;
|
}
|
|
}
|
|
.tableFixedDialog {
|
::v-deep .el-input__icon {
|
line-height: 27px;
|
}
|
|
::v-deep .el-range-separator {
|
line-height: 27px;
|
}
|
|
::v-deep .el-radio__label {
|
display: none;
|
}
|
}
|
</style>
|
<style>
|
|
.el-table .custom-row {
|
background: #f8f8fa;
|
}
|
</style>
|