4 changed files with 412 additions and 15 deletions
-
13src/api/tool/com_tool_instance_date_add_update.js
-
3src/api/tool/tool_info.js
-
355src/views/modules/tooling/components/com_tool_instance_date_add_update.vue
-
56src/views/modules/tooling/manuf_tool.vue
@ -0,0 +1,13 @@ |
|||
import { createAPI } from '@/utils/httpRequest.js' |
|||
|
|||
// 获取
|
|||
export const getToolInstanceDates = data => createAPI('plm/tool/getToolInstanceDates', 'POST', data) |
|||
|
|||
// 获取
|
|||
export const insertToolInstanceDate = data => createAPI('plm/tool/insertToolInstanceDate', 'POST', data) |
|||
|
|||
// 获取
|
|||
export const modifyToolInstanceDate = data => createAPI('plm/tool/modifyToolInstanceDate', 'POST', data) |
|||
|
|||
// 删除
|
|||
export const removeToolInstanceDate = data => createAPI('plm/tool/removeToolInstanceDate', 'POST', data) |
|||
@ -0,0 +1,355 @@ |
|||
<template> |
|||
<div class="customer-css"> |
|||
<el-dialog :title="titleCon" v-drag :visible.sync="visible" |
|||
width="490px" style="height: 650px;" class="customer-dialog"> |
|||
<el-container style="height: 325px;"> |
|||
<el-form :inline="true" label-position="top" label-width="80px"> |
|||
<!-- 第一行 --> |
|||
<el-row class="customer-row"> |
|||
<el-col :span="12"> |
|||
<el-form-item label="域:"> |
|||
<el-input v-model="pageData.site" disabled></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-form-item label="工具标识号:"> |
|||
<el-input v-model="pageData.toolId" disabled></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<!-- 第二行 --> |
|||
<el-row class="customer-row"> |
|||
<el-col :span="12"> |
|||
<el-form-item label="工具样品:"> |
|||
<el-input v-model="pageData.toolInstance" disabled></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="工具样品描述:"> |
|||
<el-input v-model="pageData.description" disabled></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row style="margin-top: 10px;"> |
|||
<el-col :span="6"> |
|||
<el-form-item style="margin-left: 5px;"> |
|||
<el-button type="primary" @click="addNewToolDate()">新增</el-button> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<!--材料的使用记录--> |
|||
<fieldset class="customer-fieldset" style="width: 350px;"> |
|||
<legend>生命周期维护</legend> |
|||
<el-table |
|||
height="160" |
|||
:data="dataList" |
|||
border |
|||
v-loading="dataListLoading" |
|||
style="width: 460px; margin-top: -5px;"> |
|||
<el-table-column |
|||
v-for="(item,index) in columnArray" :key="index" |
|||
:sortable="item.columnSortable" |
|||
:prop="item.columnProp" |
|||
:header-align="item.headerAlign" |
|||
:show-overflow-tooltip="item.showOverflowTooltip" |
|||
:align="item.align" |
|||
:fixed="item.fixed==''?false:item.fixed" |
|||
:width="item.columnWidth" |
|||
:label="item.columnLabel"> |
|||
<template slot-scope="scope"> |
|||
<span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span> |
|||
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" |
|||
style="width: 100px; height: 80px"/></span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="" |
|||
header-align="center" |
|||
align="center" |
|||
min-width="170" |
|||
label="开始日期"> |
|||
<template slot-scope="scope" > |
|||
<el-date-picker |
|||
value-format="yyyy-MM-dd" |
|||
style="width: 100%" :disabled="scope.id > 0" |
|||
v-model="scope.row.beginDate" @change="checkBeginDate(scope.row, scope.row.beginDate)" |
|||
type="date" class="table-el-date" |
|||
placeholder="开始日期"> |
|||
</el-date-picker> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="" |
|||
header-align="center" |
|||
align="center" |
|||
min-width="170" |
|||
label="结束日期"> |
|||
<template slot-scope="scope"> |
|||
<el-date-picker |
|||
value-format="yyyy-MM-dd" |
|||
style="width: 100%" |
|||
v-model="scope.row.endDate" @change="checkEndDate(scope.row, scope.row.endDate)" |
|||
type="date" class="table-el-date" |
|||
placeholder="结束日期"> |
|||
</el-date-picker> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
header-align="center" |
|||
align="center" |
|||
width="100" |
|||
fixed="right" |
|||
label="操作"> |
|||
<template slot-scope="scope"> |
|||
<a type="text" size="small" v-if="scope.row.id > 0" @click="saveToolInstanceDateModal(scope.row)">保存</a> |
|||
<a type="text" size="small" v-if="scope.row.id === 0" @click="insertToolInstanceDateModal(scope.row)">新增</a> |
|||
<a type="text" size="small" @click="deleteToolInstanceDateConfirm(scope.row, scope.$index)">删除</a> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</fieldset> |
|||
</el-form> |
|||
</el-container> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
getToolInstanceDates, |
|||
insertToolInstanceDate, |
|||
modifyToolInstanceDate, |
|||
removeToolInstanceDate, |
|||
} from '@/api/tool/com_tool_instance_date_add_update.js'; |
|||
|
|||
var functionId = 'C106003003'; |
|||
export default { |
|||
data() { |
|||
return { |
|||
titleCon: '工具新增', |
|||
showDefault: false, |
|||
visible: false, |
|||
dataList:[], |
|||
currentRow: {}, |
|||
columnArray: [], |
|||
pageData: { |
|||
site: this.$store.state.user.site, |
|||
username: this.$store.state.user.name, |
|||
toolId: '', |
|||
toolInstance: '', |
|||
description: '', |
|||
beginDate: '', |
|||
endDate: '', |
|||
ifsRowId: 0, |
|||
ifsRowVersion: '', |
|||
}, |
|||
dataListLoading: false, |
|||
} |
|||
}, |
|||
methods: { |
|||
|
|||
//初始化组件的参数 |
|||
init(toolInfo) { |
|||
this.visible = true; |
|||
//判断是否是新增 |
|||
this.pageData.site = toolInfo.site; |
|||
this.pageData.toolId = toolInfo.toolId; |
|||
this.pageData.toolInstance = toolInfo.toolInstance; |
|||
this.pageData.description = toolInfo.description; |
|||
this.titleCon = '工具实例生命周期维护'; |
|||
//刷新工具实例下的生命周期的数据 |
|||
this.refreshToolInstanceDateList(); |
|||
}, |
|||
|
|||
/*刷新工具信息*/ |
|||
refreshToolInstanceDateList() { |
|||
getToolInstanceDates(this.pageData).then(({data}) => { |
|||
if (data.code == 200) { |
|||
this.dataList = data.rows; |
|||
} |
|||
this.dataListLoading = false |
|||
}) |
|||
}, |
|||
|
|||
/*关闭modal*/ |
|||
closeDialog(){ |
|||
//刷新原页面的数据 |
|||
this.$emit('refreshTooInstanceData'); |
|||
//关闭当前的页面 |
|||
this.visible = false; |
|||
//this.$emit('update:visible', false); |
|||
}, |
|||
|
|||
/*新增加一行新的数据*/ |
|||
addNewToolDate(){ |
|||
let instanceDate = {'id': 0, 'site': this.pageData.site, 'toolId': this.pageData.toolId, 'toolInstance': this.pageData.toolInstance, |
|||
'beginDate': '', 'endDate': '', 'ifsRowId': '', 'ifsRowVewrsion': ''}; |
|||
//添加对象 |
|||
this.dataList.push(instanceDate); |
|||
}, |
|||
|
|||
/*检查新的工信息*/ |
|||
checkBeginDate(row, beginDate){ |
|||
if(null == beginDate || beginDate === ''){ |
|||
this.$message.error('开始日期必须存在!'); |
|||
} |
|||
const begin = this.dayjs(beginDate); |
|||
const now = this.dayjs(this.dayjs().format('YYYY-MM-DD')); |
|||
if (begin.valueOf() < now.valueOf()) { |
|||
this.$message.error('开始日期不能小于当前日期!'); |
|||
row.beginDate = ''; |
|||
} |
|||
//如果结束的日期存在 必须大于等于当前日期 |
|||
if(!(null == row.endDate || '' === row.endDate )){ |
|||
const end = this.dayjs(row.endDate); |
|||
if (begin.valueOf() > end.valueOf()) { |
|||
this.$message.error('结束日期不能小于开始日期!'); |
|||
} |
|||
} |
|||
}, |
|||
|
|||
/*检查新的工信息*/ |
|||
checkEndDate(row, endDate){ |
|||
if(null == endDate || endDate === ''){ |
|||
endDate = '3000-01-01'; |
|||
} |
|||
const end = this.dayjs(endDate); |
|||
const now = this.dayjs(this.dayjs().format('YYYY-MM-DD')); |
|||
if (end.valueOf() < now.valueOf()) { |
|||
this.$message.error('结束日期不能小于当前日期!'); |
|||
row.endDate = ''; |
|||
} |
|||
//如果结束的日期存在 必须大于等于当前日期 |
|||
const begin = this.dayjs(row.beginDate); |
|||
if (begin.valueOf() > end.valueOf()) { |
|||
this.$message.error('结束日期不能小于开始日期!'); |
|||
row.endDate = ''; |
|||
} |
|||
}, |
|||
|
|||
/*新增工具实例的生命周期*/ |
|||
insertToolInstanceDateModal(row){ |
|||
if(null == row.beginDate || row.beginDate === ''){ |
|||
this.$message.error('开始日期必须存在!'); |
|||
} |
|||
const begin = this.dayjs(row.beginDate); |
|||
const now = this.dayjs(this.dayjs().format('YYYY-MM-DD')); |
|||
if (begin.valueOf() < now.valueOf()) { |
|||
this.$message.error('开始日期不能小于当前日期!'); |
|||
row.beginDate = ''; |
|||
} |
|||
//如果结束的日期存在 必须大于等于当前日期 |
|||
if(!(null == row.endDate || '' === row.endDate )){ |
|||
const end = this.dayjs(row.endDate); |
|||
if (begin.valueOf() > end.valueOf()) { |
|||
this.$message.error('结束日期不能小于开始日期!'); |
|||
} |
|||
} |
|||
insertToolInstanceDate(row).then(({data}) =>{ |
|||
if(data.code === 200){ |
|||
this.$message.success('操作成功!'); |
|||
//刷新表格 |
|||
this.refreshToolInstanceDateList(); |
|||
}else{ |
|||
this.$message.error(data.msg); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
/*检查新的工信息*/ |
|||
saveToolInstanceDateModal(row){ |
|||
if(null == row.beginDate || row.beginDate === ''){ |
|||
this.$message.error('开始日期必须存在!'); |
|||
} |
|||
const begin = this.dayjs(row.beginDate); |
|||
const now = this.dayjs(this.dayjs().format('YYYY-MM-DD')); |
|||
if (begin.valueOf() < now.valueOf()) { |
|||
this.$message.error('开始日期不能小于当前日期!'); |
|||
row.beginDate = ''; |
|||
} |
|||
//如果结束的日期存在 必须大于等于当前日期 |
|||
if(!(null == row.endDate || '' === row.endDate )){ |
|||
const end = this.dayjs(row.endDate); |
|||
if (begin.valueOf() > end.valueOf()) { |
|||
this.$message.error('结束日期不能小于开始日期!'); |
|||
} |
|||
} |
|||
modifyToolInstanceDate(row).then(({data}) =>{ |
|||
if(data.code === 200){ |
|||
this.$message.success('操作成功!'); |
|||
//刷新表格 |
|||
this.refreshToolInstanceDateList(); |
|||
}else{ |
|||
this.$message.error(data.msg); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
/*删除处理业务*/ |
|||
deleteToolInstanceDateConfirm(row, index){ |
|||
//删除提示 |
|||
this.$confirm('是否删除?', '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
//如果没有进数据库 直接删除即可 如果进入数据库需要删除数据到数据库 |
|||
if (row.id === 0){ |
|||
this.dataList.splice(index, 1); |
|||
this.$message.success('操作成功!'); |
|||
}else { |
|||
removeToolInstanceDate(row).then(({data}) => { |
|||
if (data.code === 200) { |
|||
this.$message.success('操作成功!'); |
|||
this.refreshToolInstanceDateList(); |
|||
} else { |
|||
this.$message.error(data.msg); |
|||
} |
|||
}) |
|||
} |
|||
|
|||
}) |
|||
} |
|||
}, |
|||
created() { |
|||
// this.factoryList() |
|||
// this.getLanguageList() |
|||
} |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
|
|||
/*调整两个input的间距*/ |
|||
.customer-row .el-col-4 + .el-col-4 { |
|||
margin-left: 25px; |
|||
} |
|||
|
|||
.customer-row .el-input--medium { |
|||
width: 135px !important; |
|||
} |
|||
|
|||
/*table中input 修改样式*/ |
|||
/deep/ div.table-el-date { |
|||
padding: 0px 0px; |
|||
height: 25px !important; |
|||
} |
|||
|
|||
/*table中input*/ |
|||
div.table-el-date /deep/ input.el-input__inner{ |
|||
padding: 0px 0px; |
|||
height: 23px !important; |
|||
text-align: right; |
|||
} |
|||
|
|||
/* 特殊的样式*/ |
|||
/deep/ .el-table div.cell:has(.table-el-date) { |
|||
/* 直接作用于 <td> 元素 */ |
|||
padding: 0px; |
|||
height: 25px; |
|||
} |
|||
|
|||
|
|||
|
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue