5 changed files with 456 additions and 241 deletions
-
13src/api/tool/com_tool_instance_date_show.js
-
32src/views/modules/tooling/components/com_tool_instance_add_update.vue
-
306src/views/modules/tooling/components/com_tool_instance_date_add_update.vue
-
328src/views/modules/tooling/components/com_tool_instance_date_show.vue
-
18src/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,328 @@ |
|||||
|
<template> |
||||
|
<div class="customer-css"> |
||||
|
<el-dialog :title="titleCon" v-drag :visible.sync="visible" :close-on-click-modal="false" |
||||
|
width="490px" style="height: 650px;" class="customer-dialog"> |
||||
|
<el-container style="height: 325px;"> |
||||
|
<el-form :inline="true" :model="pageData" label-position="top" label-width="80px"> |
||||
|
<!-- 第一行 --> |
||||
|
<el-row class="customer-row"> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item label="域"> |
||||
|
<el-input v-model="pageData.site" disabled></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item label="工具标识号"> |
||||
|
<el-input v-model="pageData.toolId" disabled></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item label="工具标识描述"> |
||||
|
<el-input v-model="pageData.toolDesc" disabled></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<!-- 第二行 --> |
||||
|
<el-row class="customer-row"> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item label="工具分类"> |
||||
|
<el-input v-model="pageData.toolType" disabled></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item label="工具实例"> |
||||
|
<el-input v-model="pageData.toolInstance" disabled></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="8"> |
||||
|
<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="insertToolInstanceDateModal()">新增</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" > |
||||
|
<span> {{ scope.row['beginDate'] }}</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
prop="" |
||||
|
header-align="center" |
||||
|
align="center" |
||||
|
min-width="170" |
||||
|
label="结束日期"> |
||||
|
<template slot-scope="scope"> |
||||
|
<span> {{ scope.row['endDate'] }}</span> |
||||
|
</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" @click="editToolInstanceDateModal(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> |
||||
|
<!-- 工具实例生命周期信息 --> |
||||
|
<toolInstanceDateAddUpdate ref="toolInstanceDateAddUpdate" :close-on-click-modal="false" @refreshToolInstanceDateList="refreshToolInstanceDateList"> |
||||
|
</toolInstanceDateAddUpdate> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getToolInstanceDates, |
||||
|
insertToolInstanceDate, |
||||
|
modifyToolInstanceDate, |
||||
|
removeToolInstanceDate, |
||||
|
} from '@/api/tool/com_tool_instance_date_show.js'; |
||||
|
|
||||
|
import toolInstanceDateAddUpdate from "./com_tool_instance_date_add_update";/*工具实例生命周期的的新增和修改组件*/ |
||||
|
|
||||
|
var functionId = 'C106003003'; |
||||
|
export default { |
||||
|
components: { |
||||
|
toolInstanceDateAddUpdate,/*工具实例新增日期和修改组件*/ |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
titleCon: '工具新增', |
||||
|
showDefault: false, |
||||
|
visible: false, |
||||
|
dataList:[], |
||||
|
currentRow: {}, |
||||
|
columnArray: [], |
||||
|
pageData: { |
||||
|
site: this.$store.state.user.site, |
||||
|
username: this.$store.state.user.name, |
||||
|
toolId: '', |
||||
|
toolType: '', |
||||
|
toolDesc: '', |
||||
|
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.toolDesc = toolInfo.toolDesc; |
||||
|
this.pageData.toolInstance = toolInfo.toolInstance; |
||||
|
this.pageData.toolType = toolInfo.toolType; |
||||
|
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); |
||||
|
}, |
||||
|
|
||||
|
/*检查新的工信息*/ |
||||
|
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('结束日期不能小于开始日期!'); |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
/*工具实例的生命周期*/ |
||||
|
editToolInstanceDateModal(toolInfo){ |
||||
|
//判断是否选择好数据 |
||||
|
if(Object.keys(toolInfo).length > 0){ |
||||
|
//打开modal的页面 |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.toolInstanceDateAddUpdate.init(toolInfo, false) |
||||
|
}); |
||||
|
}else{ |
||||
|
this.$message.error('请先选择工具实例再添加工具实例!'); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
/*新增工具实例的生命周期*/ |
||||
|
insertToolInstanceDateModal(){ |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.toolInstanceDateAddUpdate.init(this.pageData,true) |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
/*检查新的工信息*/ |
||||
|
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