Browse Source

工具的代码

master
DouDou 1 year ago
parent
commit
840c901446
  1. 13
      src/api/tool/com_tool_instance_date_add_update.js
  2. 3
      src/api/tool/tool_info.js
  3. 355
      src/views/modules/tooling/components/com_tool_instance_date_add_update.vue
  4. 56
      src/views/modules/tooling/manuf_tool.vue

13
src/api/tool/com_tool_instance_date_add_update.js

@ -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)

3
src/api/tool/tool_info.js

@ -9,3 +9,6 @@ export const getToolInstanceList = data => createAPI('plm/tool/getToolInstanceLi
// 删除
export const removeToolInfo = data => createAPI('plm/tool/removeToolInfo', 'POST', data)
// 删除
export const removeToolInstance = data => createAPI('plm/tool/removeToolInstance', 'POST', data)

355
src/views/modules/tooling/components/com_tool_instance_date_add_update.vue

@ -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>

56
src/views/modules/tooling/manuf_tool.vue

@ -114,7 +114,7 @@
<template slot-scope="scope">
<a type="text" size="small" @click="editToolInstanceModal(scope.row)">编辑</a>
<a type="text" size="small" @click="editToolInstanceDateModal(scope.row)">生命周期</a>
<a type="text" size="small" @click="deleteToolInfoConfirm(scope.row)">删除</a>
<a type="text" size="small" @click="deleteToolInstanceConfirm(scope.row)">删除</a>
</template>
</el-table-column>
</el-table>
@ -131,6 +131,10 @@
<toolInstanceAddUpdate ref="toolInstanceAddUpdate" :close-on-click-modal="false" @refreshTooInstanceData="refreshTooInstanceData">
</toolInstanceAddUpdate>
<!-- 工具实例生命周期信息 -->
<toolInstanceDateAddUpdate ref="toolInstanceDateAddUpdate" :close-on-click-modal="false" @refreshTooInstanceData="refreshTooInstanceData">
</toolInstanceDateAddUpdate>
</div>
</template>
@ -139,12 +143,14 @@ import {
getToolInfoList, //
getToolInstanceList, //
removeToolInfo,/*删除工具信息*/
removeToolInstance,/*删除工具实例信息*/
} from '@/api/tool/tool_info.js'
/*组件*/
import Chooselist from '@/views/modules/common/Chooselist'; /*选择组件*/
import toolInfoAddUpdate from "./components/com_tool_info_add_update"; /*工具新增和修改组件*/
import toolInstanceAddUpdate from "./components/com_tool_instance_add_update"; /*工具实例新增和修改组件*/
import toolInstanceDateAddUpdate from "./components/com_tool_instance_date_add_update"; /*工具实例新增日期和修改组件*/
/*組件*/
export default {
@ -152,6 +158,7 @@ export default {
Chooselist,/*选择组件*/
toolInfoAddUpdate,/*工具新增和修改组件*/
toolInstanceAddUpdate,/*工具实例新增和修改组件*/
toolInstanceDateAddUpdate,/*工具实例新增日期和修改组件*/
},
name: "null",
data() {
@ -733,23 +740,50 @@ export default {
})
},
/*工具实例的生命周期*/
editToolInstanceDateModal(){
/*删除工具实例确认*/
deleteToolInstanceConfirm(toolInfo){
this.$confirm('是否删除工具实例:'+ toolInfo.toolInstance+'?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeToolInstance(toolInfo).then(({data}) => {
if (data.code === 200) {
this.$message.success('操作成功!');
this.refreshTooInstanceData();
} else {
this.$message.error(data.msg);
}
})
})
},
/*工具实例的生命周期*/
editToolInstanceDateModal(toolInfo){
this.currentInstanceRow = toolInfo;
//
if(Object.keys(this.currentInstanceRow).length > 0){
//modal
this.$nextTick(() => {
this.$refs.toolInstanceDateAddUpdate.init(this.currentInstanceRow)
});
}else{
this.$message.error('请先选择工具实例再添加工具实例!');
}
},
//
changeData(row) {
this.currentRow = JSON.parse(JSON.stringify(row));
this.currentRow2 = row;
this.refreshCurrentTabTable ();
},
//
currentInstanceRow(row) {
this.currentInstanceRow = JSON.parse(JSON.stringify(row));
/*切换工具实例*/
changeInstanceData(row){
this.currentRow = JSON.parse(JSON.stringify(row));
},
//
search () {
this.searchData.pageSize = this.pageSize
@ -791,16 +825,8 @@ export default {
})
},
//
downloadFile(row){
// let inData={
// site:this.currentRow.site,
// username:this.$store.state.user.name,
// projectId:this.currentRow.projectId
// }
// getProjectUserRole(inData).then(({data}) => {
// if(this.$store.state.user.name=='admin'||data.row.downFlag=='Y') {
downLoadProjectFile(row)
.then(({data}) => {
//

Loading…
Cancel
Save