Browse Source

工具的代码

master
DouDou 2 years ago
parent
commit
d5ea4f522f
  1. 7
      src/api/tool/com_tool_instance_add_update.js
  2. 424
      src/views/modules/tooling/components/com_tool_instance_add_update.vue
  3. 178
      src/views/modules/tooling/manuf_tool.vue

7
src/api/tool/com_tool_instance_add_update.js

@ -0,0 +1,7 @@
import { createAPI } from '@/utils/httpRequest.js'
// 获取
export const insertToolInstance = data => createAPI('plm/tool/insertToolInstance', 'POST', data)
// 获取
export const modifyToolInstance = data => createAPI('plm/tool/modifyToolInstance', 'POST', data)

424
src/views/modules/tooling/components/com_tool_instance_add_update.vue

@ -0,0 +1,424 @@
<template>
<div class="customer-css">
<el-dialog :title="titleCon" v-drag :visible.sync="visible"
width="750px" style="height: 650px;" class="customer-dialog">
<el-container style="height: 265px;">
<el-form :inline="true" label-position="top" label-width="80px">
<!-- 第一行 -->
<el-row class="customer-row">
<el-col :span="4">
<el-form-item label="工具样品:">
<el-input v-model="pageData.toolInstance" :disabled="!this.addFlag"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="描述:">
<el-input v-model="pageData.description" ></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="最近校对日期:">
<el-date-picker
value-format="yyyy-MM-dd"
style="width: 100%"
v-model="pageData.lastCalibrationDate"
type="date"
placeholder="最近校对日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="下一个校对日期:">
<el-input v-model="pageData.nextCalibrationDate" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="有效性:">
<el-input v-model="pageData.state" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 第二行 -->
<el-row class="customer-row">
<el-col :span="4">
<el-form-item label="工具/设备:">
<el-input v-model="pageData.toolResourceId" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="工具/设备描述:">
<el-input v-model="pageData.toolResourceDesc" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="对象标识:">
<span slot="label" style="" @click="getBaseList(1020)"><a herf="#">对象标识:</a></span>
<el-input v-model="pageData.objectId" ></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="对象描述:">
<el-input v-model="pageData.objectDesc" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="最近使用情况报告:">
<el-input v-model="pageData.lastUsageReport" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 第三行 -->
<el-row class="customer-row">
<el-col :span="4">
<el-form-item label="工作中心:">
<span slot="label" style="" @click="getBaseList(1021)"><a herf="#">工作中心:</a></span>
<el-input v-model="pageData.normalWorkCenterNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="描述:">
<el-input v-model="pageData.normalWorkCenterDesc" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="生产线:">
<span slot="label" style="" @click="getBaseList(1022)"><a herf="#">生产线:</a></span>
<el-input v-model="pageData.normalProductionLine" ></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="描述:">
<el-input v-model="pageData.normalProductionLineDesc" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="鉴别:">
<el-input v-model="pageData.toolDiscrimination" ></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 第四行 -->
<el-row class="customer-row">
<el-col :span="4">
<el-form-item label="线性:">
<el-input v-model="pageData.toolLinearity"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="重复性:">
<el-input v-model="pageData.toolRepeatability" ></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="偏差性:">
<el-input v-model="pageData.toolBias"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="稳定性:">
<el-input v-model="pageData.toolStability" ></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="再现能力:">
<el-input v-model="pageData.toolReproducibility" ></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 第五行 -->
<el-row>
<el-col :span="24">
<el-form-item label="备注:">
<el-input type="textarea" v-model="pageData.noteText" :rows="2" style="width: 725px;height: 20px"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-container>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveToolInfoFun">{{ buttons.confirmButton }}</el-button>
<el-button type="primary" @click="closeDialog">{{buttons.closeButton}}</el-button>
</span>
</el-dialog>
<!-- 选择 -->
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div>
</template>
<script>
import {
insertToolInstance,
modifyToolInstance,
} from '@/api/tool/com_tool_instance_add_update.js';
/*组件*/
import Chooselist from '@/views/modules/common/Chooselist'; /*选择组件*/
var functionId = 'C106003002';
export default {
components: {
Chooselist,/*选择组件*/
},
data() {
return {
titleCon: '工具新增',
showDefault: false,
visible: false,
addFlag: false,
pageData: {
site: this.$store.state.user.site,
username: this.$store.state.user.name,
toolId: '',
toolInstance: '',
description: '',
lastCalibrationDate: '',
nextCalibrationDate: '',
objectId: '',
objectDesc: '',
toolResourceId: '',
toolResourceDesc: '',
lastUsageReport: '',
normalWorkCenterNo: '',
normalWorkCenterDesc: '',
normalProductionLine: '',
normalProductionLineDesc: '',
state: '',
toolDiscrimination: '',
toolLinearity: '',
toolRepeatability: '',
toolBias: '',
toolStability: '',
toolReproducibility: '',
noteText: '',
ifsRowId: 0,
ifsRowVersion: '',
},
dataListLoading: false,
buttons: {
confirmButton: '确定',
closeButton: '关闭',
},
buttonList: [
{
functionId: functionId,
languageValue: '确定',
objectId: 'confirmButton',
objectType: 'button',
tableId: '*'
}, {
functionId: functionId,
languageValue: '关闭',
objectId: 'closeButton',
objectType: 'button',
tableId: '*'
},
],
queryButton: {
functionId: functionId,
table_id: '*',
languageCode: this.$i18n.locale,
objectType: 'button'
},
labelsList: [
{
functionId: functionId,
languageValue: '刀模板',
objectId: 'titleCon',
objectType: 'label',
tableId: '*'
}, {
functionId: functionId,
languageValue: '换刀模',
objectId: 'replaceToolTitle',
objectType: 'label',
tableId: '*'
}, {
functionId: functionId,
languageValue: '换刀模',
objectId: 'replaceTool',
objectType: 'label',
tableId: '*'
}, {
functionId: functionId,
languageValue: '原工具实例编码:',
objectId: 'oriToolInstanceId',
objectType: 'label',
tableId: '*'
}, {
functionId: functionId,
languageValue: '本卷生产数量:',
objectId: 'currentRollProdQty',
objectType: 'label',
tableId: '*'
}, {
functionId: functionId,
languageValue: '之前卷生产数量:',
objectId: 'oriRollProdQty',
objectType: 'label',
tableId: '*'
}, {
functionId: functionId,
languageValue: '累积生产数量:',
objectId: 'totalRollProdQty',
objectType: 'label',
tableId: '*'
}, {
functionId: functionId,
languageValue: '请扫描工具实例!',
objectId: 'pleaseScanToolInstanceId',
objectType: 'label',
tableId: '*'
}, {
functionId: functionId,
languageValue: '确认',
objectId: 'confirmLabel',
objectType: 'label',
tableId: '*'
}, {
functionId: functionId,
languageValue: '取消',
objectId: 'cancelLabel',
objectType: 'label',
tableId: '*'
},
],
queryLabel: {
functionId: functionId,
table_id: '*',
languageCode: this.$i18n.locale,
objectType: 'label'
},
}
},
methods: {
//
init(toolInfo, addFlag) {
this.visible = true;
//
if(addFlag){
this.titleCon = '工具实例新增';
this.pageData.site = toolInfo.site;
this.pageData.toolId = toolInfo.toolId;
this.pageData.toolInstance = '';
this.pageData.description = '';
this.pageData.lastCalibrationDate = '';
this.pageData.nextCalibrationDate = '';
this.pageData.objectId = '';
this.pageData.objectDesc = '';
this.pageData.toolResourceId = '';
this.pageData.toolResourceDesc = '';
this.pageData.lastUsageReport = '';
this.pageData.normalWorkCenterNo = '';
this.pageData.normalWorkCenterDesc = '';
this.pageData.normalProductionLine = '';
this.pageData.normalProductionLineDesc = '';
this.pageData.state = '';
this.pageData.toolDiscrimination = '';
this.pageData.toolLinearity = '';
this.pageData.toolRepeatability = '';
this.pageData.toolBias = '';
this.pageData.toolStability = '';
this.pageData.toolReproducibility = '';
this.pageData.noteText = '';
}else{
this.titleCon = '工具修改';
this.pageData = JSON.parse(JSON.stringify(toolInfo));
}
this.addFlag = addFlag;
},
/*关闭modal*/
closeDialog(){
//
this.$emit('refreshTooInstanceData');
//
this.visible = false;
//this.$emit('update:visible', false);
},
// S
getBaseList (val, type) {
this.tagNo = val
this.$nextTick(() => {
let strVal = ''
if(val === 1020){
let strCon = ' AND site = \''+ this.pageData.site+'\'';
this.$refs.baseList.init(val, strVal, strCon)
}else if(val === 1021){
let strCon = ' AND site = \''+ this.pageData.site+'\'';
this.$refs.baseList.init(val, strVal, strCon)
}else if(val === 1022){
let strCon = ' AND site = \''+ this.pageData.site+'\'';
this.$refs.baseList.init(val, strVal, strCon)
}else{
this.$refs.baseList.init(val, strVal)
}
})
},
/* 列表方法的回调 */
getBaseData (val) {
if (this.tagNo === 1020) {
this.pageData.objectId = val.mch_code;
this.pageData.objectDesc = val.mch_name;
}else if (this.tagNo === 1021) {
this.pageData.normalWorkCenterNo = val.work_center_no;
this.pageData.normalWorkCenterDesc = val.work_center_desc;
}else if (this.tagNo === 1022) {
this.pageData.normalProductionLine = val.production_line;
this.pageData.normalProductionLineDesc = val.description;
}
},
/*检查新的工信息*/
saveToolInfoFun(){
if(this.pageData.toolInstance == null || this.pageData.toolInstance == ''){
this.$message.error('工具样品不能为空!');
return false;
}
//
if (this.addFlag){
insertToolInstance(this.pageData).then(({data}) =>{
if(data.code === 200){
this.$message.success('操作成功!');
this.closeDialog();
}else{
this.$message.error(data.msg);
}
});
}else{
modifyToolInstance(this.pageData).then(({data}) =>{
if(data.code === 200){
this.$message.success('操作成功!');
this.closeDialog();
}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;
}
</style>

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

@ -71,7 +71,7 @@
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
@row-click="changeInstanceData"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 1000]"
:page-size="pageSize"
@ -81,7 +81,7 @@
<el-tabs style="font-size: 12px;min-height: 330px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick">
<el-tab-pane label="工具实例" name="detail" style="margin-left: -10px;">
<el-form label-position="top" style="margin-top: -15px; margin-left: 2px;">
<el-button type="primary" >新增</el-button>
<el-button type="primary" @click="addToolInstanceModal()">新增</el-button>
</el-form>
<el-table
:data="detailList"
@ -105,18 +105,18 @@
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- fixed="right"-->
<!-- header-align="center"-->
<!-- align="center"-->
<!-- width="100"-->
<!-- label="操作">-->
<!-- <template slot-scope="scope">-->
<!-- &lt;!&ndash; <a :href="'http://192.168.1.130:80/file/'+scope.row.url" :download="scope.row.fileName">下载</a>&ndash;&gt;-->
<!-- <a @click="downloadFile(scope.row)" >下载</a>-->
<!-- <a type="text" size="small" @click="deleteFile(scope.row)">删除</a>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
header-align="center"
align="center"
width="150"
fixed="right"
label="操作">
<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>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
@ -127,6 +127,10 @@
<toolInfoAddUpdate ref="toolInfoAddUpdate" :close-on-click-modal="false" @refreshTooInfoData="refreshTooInfoData">
</toolInfoAddUpdate>
<!-- 工具实例信息 -->
<toolInstanceAddUpdate ref="toolInstanceAddUpdate" :close-on-click-modal="false" @refreshTooInstanceData="refreshTooInstanceData">
</toolInstanceAddUpdate>
</div>
</template>
@ -140,12 +144,14 @@ import {
/*组件*/
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"; /*工具实例新增和修改组件*/
/*組件*/
export default {
components: {
Chooselist,/*选择组件*/
toolInfoAddUpdate,/*工具新增和修改组件*/
toolInstanceAddUpdate,/*工具实例新增和修改组件*/
},
name: "null",
data() {
@ -162,6 +168,7 @@ export default {
endDate:'',
},
currentRow:{},
currentInstanceRow: {},
height: 200,
dataList:[],
detailList:[],
@ -399,13 +406,13 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2SeqNo',
serialNumber: '106003Table2ToolInstance',
tableId: '106003Table2',
tableName: '工具申请明细',
columnProp: 'seqNo',
tableName: '工具实例明细',
columnProp: 'toolInstance',
headerAlign: 'center',
align: 'center',
columnLabel: '序号',
columnLabel: '工具样品',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -417,13 +424,13 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2QuotationNo',
serialNumber: '106003Table2Description',
tableId: '106003Table2',
tableName: '工具申请明细',
columnProp: 'quotationNo',
tableName: '工具实例明细',
columnProp: 'description',
headerAlign: 'center',
align: 'center',
columnLabel: '所属报价单',
columnLabel: '工具样品描述',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -437,7 +444,7 @@ export default {
functionId: 106003,
serialNumber: '106003Table2ToolNo',
tableId: '106003Table2',
tableName: '工具申请明细',
tableName: '工具实例明细',
columnProp: 'toolNo',
headerAlign: 'center',
align: 'center',
@ -453,13 +460,13 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2ToolDescription',
serialNumber: '106003Table2LastCalibrationDate',
tableId: '106003Table2',
tableName: '工具申请明细',
columnProp: 'toolDescription',
tableName: '工具实例明细',
columnProp: 'lastCalibrationDate',
headerAlign: 'center',
align: 'center',
columnLabel: '工具描述',
columnLabel: '最近校准日期',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -471,13 +478,13 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2ToolSpec',
serialNumber: '106003Table2ObjectId',
tableId: '106003Table2',
tableName: '工具申请明细',
columnProp: 'toolSpec',
tableName: '工具实例明细',
columnProp: 'objectId',
headerAlign: 'center',
align: 'center',
columnLabel: '工具规格',
columnLabel: '对象标识',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -489,13 +496,13 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2ApplyQty',
serialNumber: '106003Table2NormalWorkCenterNo',
tableId: '106003Table2',
tableName: '工具申请明细',
columnProp: 'applyQty',
tableName: '工具实例明细',
columnProp: 'normalWorkCenterNo',
headerAlign: 'center',
align: 'center',
columnLabel: '申请数量',
columnLabel: '工作中心',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -507,49 +514,49 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2ExpectedServiceLife',
serialNumber: '106003Table2NormalWorkCenterDesc',
tableId: '106003Table2',
tableName: '工具申请明细',
columnProp: 'expectedServiceLife',
tableName: '工具实例明细',
columnProp: 'normalWorkCenterDesc',
headerAlign: 'center',
align: 'center',
columnLabel: '预计寿命',
columnLabel: '工作重心描述',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 50
columnWidth: 60
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2UnitCost',
serialNumber: '106003Table2NormalProductionLine',
tableId: '106003Table2',
tableName: '工具申请明细',
columnProp: 'unitCost',
tableName: '工具实例明细',
columnProp: 'normalProductionLine',
headerAlign: 'center',
align: 'center',
columnLabel: '单位成本',
columnLabel: '生产线',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60
columnWidth: 50
},
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2quotationUnitCost',
serialNumber: '106003Table2NormalProductionLineDesc',
tableId: '106003Table2',
tableName: '工具申请明细',
columnProp: 'quotationUnitCost',
tableName: '工具实例明细',
columnProp: 'normalProductionLineDesc',
headerAlign: 'center',
align: 'center',
columnLabel: '单位报价成本',
columnLabel: '生产线描述',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -561,10 +568,10 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 106003,
serialNumber: '106003Table2Remark',
serialNumber: '106003Table2NoteText',
tableId: '106003Table2',
tableName: '工具申请明细',
columnProp: 'remark',
tableName: '工具实例明细',
columnProp: 'noteText',
headerAlign: 'center',
align: 'center',
columnLabel: '备注',
@ -642,6 +649,7 @@ export default {
return s
},
/*刷新工具信息*/
refreshTooInfoData() {
this.searchData.pageSize = this.pageSize
this.searchData.pageIndex = this.pageIndex
@ -656,8 +664,6 @@ export default {
/*新增工具的modal*/
addToolInfoModal(){
//1.
//modal
this.$nextTick(() => {
this.$refs.toolInfoAddUpdate.init(null, true)
@ -690,6 +696,48 @@ export default {
})
},
/*新增工具实例的modal*/
addToolInstanceModal(){
//
if(this.currentRow && Object.keys(this.currentRow).length > 0){
//modal
this.$nextTick(() => {
this.$refs.toolInstanceAddUpdate.init(this.currentRow, true)
});
}else{
this.$message.error('请先选择工具信息再添加工具实例!');
}
},
/*修改工具实例的modal*/
editToolInstanceModal(row){
this.currentInstanceRow = row;
//
if(Object.keys(this.currentInstanceRow).length > 0){
//modal
this.$nextTick(() => {
this.$refs.toolInstanceAddUpdate.init(this.currentInstanceRow, false)
});
}else{
this.$message.error('请先选择工具实例再添加工具实例!');
}
},
/*刷新工具信息*/
refreshTooInstanceData() {
getToolInstanceList(this.currentRow).then(({data}) => {
if (data.code == 200) {
this.detailList = data.rows;
}
this.dataListLoading = false
})
},
/*工具实例的生命周期*/
editToolInstanceDateModal(){
},
//
changeData(row) {
this.currentRow = JSON.parse(JSON.stringify(row));
@ -697,6 +745,11 @@ export default {
this.refreshCurrentTabTable ();
},
//
currentInstanceRow(row) {
this.currentInstanceRow = JSON.parse(JSON.stringify(row));
},
//
search () {
this.searchData.pageSize = this.pageSize
@ -724,10 +777,20 @@ export default {
// table
refreshCurrentTabTable () {
if (this.activeName == 'detail') {
this.getToolInstanceList();
this.refreshToolInstanceData();
}
},
/*刷新工具实例的信息*/
refreshToolInstanceData(){
getToolInstanceList(this.currentRow).then(({data}) => {
if (data.code == 200) {
this.detailList = data.rows;
}
this.dataListLoading = false
})
},
//
downloadFile(row){
@ -773,11 +836,6 @@ export default {
this.pageIndex = 1
this.search()
},
//
currentChangeHandle (val) {
this.pageIndex = val
this.search()
},
},
activated() {

Loading…
Cancel
Save