From 9da0675fa67f1f03f48881b2664da4c01356d1b5 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期三, 23 七月 2025 15:01:08 +0800
Subject: [PATCH] 插回损--功能修改
---
src/views/equipment/mould/index.vue | 567 ++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 504 insertions(+), 63 deletions(-)
diff --git a/src/views/equipment/mould/index.vue b/src/views/equipment/mould/index.vue
index de379cd..2b486b8 100644
--- a/src/views/equipment/mould/index.vue
+++ b/src/views/equipment/mould/index.vue
@@ -1,44 +1,218 @@
<template>
<div class="mod-config">
<basic-container>
- <ttable
- :table="table"
- :isShowHide="true"
- :ajaxFun="ajaxFun"
- :prelang="prelang"
- :options="options"
- ref="processconfiguration"
- >
- <template #toolbar>
- <el-button type="primary"
- @click="">鏂板</el-button>
- <!-- <el-dropdown style="margin-left: 20px;" @command="handleCommand">
- <el-button >
- 鐘舵�佸彉鏇�<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item :key="index"
- :command="item.label"
- v-for="(item,index) in taskTypeArr"
- >{{ item.label }}</el-dropdown-item
- >
- </el-dropdown-menu>
- </el-dropdown> -->
- </template>
- </ttable>
+ <ttable
+ @handleSelectionChange="handleSelectionChange"
+ :table="table"
+ :uploadInfo="uploadInfo"
+ :ajaxFun="ajaxFun"
+ :prelang="prelang"
+ :options="options"
+ ref="mouldTable"
+ class="mouldTable"
+ >
+ <template #toolbar>
+ <el-dropdown
+ @command="handleCommand"
+ >
+ <el-button>
+ 鐘舵�佹敼鍙�<i class="el-icon-arrow-down el-icon--right"></i>
+ </el-button>
+ <el-dropdown-menu slot="dropdown">
+ <el-dropdown-item
+ :command="item.value"
+ v-for="item in optList"
+ >{{ item.label }}</el-dropdown-item
+ >
+ </el-dropdown-menu>
+ </el-dropdown>
+ </template>
+ </ttable>
</basic-container>
+ <el-dialog
+ :title="editRow.id==null ? '鏂板':'淇敼'"
+ :visible.sync="dialogVisible"
+ width="40%">
+ <el-form :model="editRow" label-position="right" label-width="100px" ref="editForm" :rules="editRules">
+ <el-row :gutter="16">
+ <el-col :span="12">
+ <el-form-item prop="model" label="妯″叿鍨嬪彿">
+ <el-input v-model="editRow.model" placeholder="璇疯緭鍏ユā鍏峰瀷鍙�" :disabled="editRow.id"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item prop="name" label="妯″叿鍚嶇О">
+ <el-input v-model="editRow.name" placeholder="璇疯緭鍏ユā鍏峰悕绉�"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="16">
+ <el-col :span="12">
+ <el-form-item prop="status" label="妯″叿鐘舵��">
+ <el-select v-model="editRow.status" placeholder="璇烽�夋嫨妯″叿鐘舵��" style="width: 100%;">
+ <el-option
+ v-for="item in optList"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value">
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item prop="drawingNo" label="妯″叿鍥惧彿">
+ <el-input v-model="editRow.drawingNo" placeholder="璇疯緭鍏ユā鍏峰浘鍙�"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="16">
+ <el-col :span="12">
+ <el-form-item prop="workShop" label="杞﹂棿">
+ <el-select v-model="editRow.workShop" placeholder="璇烽�夋嫨杞﹂棿" style="width: 100%;">
+ <el-option
+ v-for="item in workshopList"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value">
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item prop="shelfNo" label="璐ф灦鍙�">
+ <el-input v-model="editRow.shelfNo" placeholder="璇疯緭鍏ヨ揣鏋跺彿"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="16">
+ <el-col :span="12">
+ <el-form-item prop="erpOrder" label="ERP璁㈠崟鍙�">
+ <el-input v-model="editRow.erpOrder" placeholder="璇疯緭鍏RP璁㈠崟鍙�"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item prop="texture" label="鏉愯川">
+ <el-input v-model="editRow.texture" placeholder="璇疯緭鍏ユ潗璐�"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="16">
+ <el-col :span="12">
+ <el-form-item prop="supplier" label="渚涘簲鍟�">
+ <el-input v-model="editRow.supplier" placeholder="璇疯緭鍏ヤ緵搴斿晢"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item prop="userTime" label="鎶曞叆浣跨敤鏃ユ湡">
+ <el-date-picker
+ v-model="editRow.userTime"
+ type="datetime"
+ placeholder="璇锋姇鍏ヤ娇鐢ㄦ棩鏈�"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ format="yyyy-MM-dd HH:mm:ss" style="width: 100%;">
+ </el-date-picker>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="16">
+ <el-col :span="12">
+ <el-form-item prop="serviceLife" label="浣跨敤瀵垮懡">
+ <el-input v-model="editRow.serviceLife" placeholder="璇疯緭鍏ヤ娇鐢ㄥ鍛�"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item prop="number" label="宸蹭娇鐢ㄦ鏁�">
+ <el-input v-model="editRow.number" placeholder="璇疯緭鍏ュ凡浣跨敤娆℃暟"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="16">
+ <el-col :span="12">
+ <el-form-item prop="person" label="璐d换浜�">
+ <el-input v-model="editRow.person" placeholder="璇疯緭鍏ヨ矗浠讳汉"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item prop="remark" label="澶囨敞">
+ <el-input v-model="editRow.remark" placeholder="璇疯緭鍏ュ娉�" type="textarea" :rows="3"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="confirmSaveOrUpdateMould">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
+ <el-dialog title="鏍囩鍒楄〃" :visible.sync="diaPrintTab" width="500px" top="5vh">
+ <div style="width:100%;height:400px;overflow-y: auto;">
+ <div class="dia_body" id="printRaw">
+ <el-card class="box-card" v-for="(tem, i) in multipleSelection" :key="i" style="margin-bottom: 10px; font-size: 16px !important;page-break-before:always;page-break-after: always;">
+ <!-- <el-row>
+ <el-col :span="8" :offset="1">搴忓彿锛�</el-col>
+ <el-col :span="7" style="font-weight: bold;">{{ tem.id }}</el-col>
+ </el-row> -->
+ <el-row>
+ <el-col :span="6" :offset="1">缂栧彿锛�</el-col>
+ <el-col :span="12" style="font-weight: bold;">{{ tem.code }}</el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="6" :offset="1">妯″叿鍚嶇О锛�</el-col>
+ <el-col :span="12" style="font-weight: bold;">{{ tem.name }}</el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="6" :offset="1">妯″叿浣嶇疆锛�</el-col>
+ <el-col :span="12" style="font-weight: bold;">{{ tem.workShop }}-{{tem.shelfNo}}</el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="6" :offset="1">妯″叿浜岀淮鐮侊細</el-col>
+ <el-col :span="7">
+ <vueQr :text="tem.code" :size="80" :margin="2"></vueQr>
+ </el-col>
+ </el-row>
+ </el-card>
+ </div>
+ </div>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="diaPrintTab = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="printFun">鎵� 鍗�</el-button>
+ </span>
+ </el-dialog>
</div>
</template>
<script>
import ttable from '@/views/common/ztt-table.vue'
-import { fetchList, } from '@/api/quality/finishedDelivery'
-
+import * as fecha from 'element-ui/lib/utils/date'
+import { fetchList,addMould,updateMould,delById } from '@/api/equipment/moulde'
+import { mapGetters } from 'vuex'
+import { remote } from '@/api/admin/dict'
+import vueQr from 'vue-qr'
+import PrintJS from 'print-js'
export default {
data(){
return {
+ diaPrintTab: false,
+ editRules: {
+ model: [{required:true,message:'璇疯緭鍏ユā鍏峰瀷鍙�',trigger:'blur'}],
+ name: [{required:true,message:'璇疯緭鍏ユā鍏峰悕绉�',trigger:'blur'}],
+ status: [{required:true,message:'璇烽�夋嫨妯″叿鐘舵��',trigger:'change'}]
+ },
+ editRow: {
+ code: null,
+ name: null,
+ },
+ uploadInfo: {
+ // 鏄惁灞曠ず涓婁紶EXCEL浠ュ強瀵瑰簲鐨剈rl
+ isShow: true,
+ url: '/mes/mould/upload',
+ download: true,
+ fileName: '妯″叿缁熻琛�'
+ },
+ dialogVisible: false,
ajaxFun: fetchList,
- prelang: 'operation',
+ prelang: 'moudle',
+ multipleSelection: [],
dataListLoading: false,
options: {
height: 300, // 榛樿楂樺害-涓轰簡琛ㄥご鍥哄畾
@@ -62,79 +236,346 @@
// 鏍囬
column: [
{
- minWidth: '140',
- prop: 'packageNo',
- label: '璁惧',
- isTrue: true,
- isSearch: true,
- searchInfoType: 'text',
- },{
- minWidth: '140',
- prop: 'outBatchNo',
+ minWidth: '140px',
+ prop: 'code',
label: '妯″叿缂栧彿',
isTrue: true,
isSearch: true,
searchInfoType: 'text',
+ render: { fun: this.addOrUpdateHandle }
},
{
- minWidth: '140',
- prop: 'partNo',
+ minWidth: '140px',
+ prop: 'name',
label: '妯″叿鍚嶇О',
isTrue: true,
isSearch: true,
searchInfoType: 'text',
},
{
- minWidth: '140',
- prop: 'partName',
- label: '宸ュ簭',
+ minWidth: '140px',
+ prop: 'drawingNo',
+ label: '妯″叿鍥惧彿',
isTrue: true,
isSearch: true,
searchInfoType: 'text',
},
{
- minWidth: '140',
- prop: 'specs',
- label: '宸ユ',
+ minWidth: '140px',
+ prop: 'status',
+ label: '妯″叿鐘舵��',
+ isTrue: true,
+ isSearch: true,
+ isTags:true,
+ searchInfoType: 'select',
+ formatter: this.workShopFormatter,
+ optList: () => {
+ return this.optList
+ },
+ },
+ {
+ minWidth: '140px',
+ prop: 'model',
+ label: '妯″叿鍨嬪彿',
isTrue: true,
isSearch: true,
searchInfoType: 'text',
},
{
- minWidth: '140',
- prop: 'unit',
- label: '瀵垮懡杞崲绯绘暟',
+ minWidth: '140px',
+ prop: 'workShop',
+ label: '杞﹂棿',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'select',
+ formatter: this.workShopFormatter,
+ optList: () => {
+ return this.workshopList
+ }
+ },
+ {
+ minWidth: '140px',
+ prop: 'shelfNo',
+ label: '璐ф灦鍙�',
isTrue: true,
isSearch: true,
searchInfoType: 'text',
+ },
+ {
+ minWidth: '140px',
+ prop: 'erpOrder',
+ label: 'ERP璁㈠崟鍙�',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ },
+ {
+ minWidth: '140px',
+ prop: 'texture',
+ label: '鏉愯川',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ },
+ {
+ minWidth: '140px',
+ prop: 'supplier',
+ label: '渚涘簲鍟�',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ },
+ {
+ minWidth: '140px',
+ prop: 'userTime',
+ label: '鎶曞叆浣跨敤鏃ユ湡',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'date',
+ formatter: this.formatDateTime
+ },
+ {
+ minWidth: '140px',
+ prop: 'serviceLife',
+ label: '浣跨敤瀵垮懡',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text'
+ },
+ {
+ minWidth: '140px',
+ prop: 'number',
+ label: '宸蹭娇鐢ㄦ鏁�',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ },
+ {
+ minWidth: '140px',
+ prop: 'person',
+ label: '璐d换浜�',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ },
+
+ {
+ minWidth: '140px',
+ prop: 'createTime',
+ label: '鍒涘缓鏃堕棿',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'date',
+ formatter: this.formatDateTime
},
],
toolbar: [],
- operator: [{
- text: '鍒犻櫎',
- type: 'text',
- size: 'small',
- fun: this.deleteHandle
- }],
+ operator: null,
operatorConfig: {
fixed: 'right',
label: '鎿嶄綔',
width: 100,
minWidth: 100
- },
+ },
},
+ optList:[
+ {
+ value:'姝e父',
+ label:'姝e父',
+ type:'success'
+ },
+ {
+ value:'寮傚父',
+ label:'寮傚父',
+ type:'danger'
+ },
+ {
+ value:'杩斾慨',
+ label:'杩斾慨',
+ type:'warning'
+ },
+ {
+ value:'鎶ュ簾',
+ label:'鎶ュ簾',
+ type:'info'
+ },
+ ],
+ workshopList: []
}
},
- // computed: {
- // ...mapGetters(['permissions'])
- // },
- components: {
- ttable
+ computed: {
+ ...mapGetters(['permissions'])
},
- medthods: {
+ components: {
+ ttable,
+ vueQr,
+ },
+ watch: {
+ dialogVisible(newVal){
+ if(!newVal){
+ this.editRow = {
+ code: null,
+ name: null,
+ }
+ }
+ }
+ },
+ created(){
+ if(this.permissions.equipment_mould_add){
+ this.table.toolbar.push({
+ text: '鏂板',
+ type: 'primary',
+ fun: this.addOrUpdateHandle
+ })
+ }
+ if(this.permissions.equipment_mould_del){
+ this.table.operator = [{
+ text: '鍒犻櫎',
+ type: 'text',
+ fun: this.deleteHandle
+ }]
+ }
+ if(this.permissions.equipment_mould_labelprint){
+ this.table.toolbar.push({
+ text: '鏍囩鎵撳嵃',
+ type: 'primary',
+ fun: this.labelPrint
+ })
+ }
+ this.table.operator = arr.length>0 ? arr : null
+ },
+ mounted(){
+ remote('work_shop').then((response) => {
+ if (response.data.code === 0) {
+ this.workshopList = response.data.data
+ } else {
+ this.workshopList = []
+ }
+ })
+ },
+ methods: {
+ handleSelectionChange(val) {
+ this.multipleSelection = val
+ },
+ deleteHandle(row){
+ this.$confirm('鏄惁纭鍒犻櫎妯″叿鍚嶇О涓�' + row.name, '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ closeOnClickModal: false,
+ type: 'warning'
+ })
+ .then(function() {
+ return delById(row.id)
+ }).then((data) => {
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.getData()
+ })
+ },
+ confirmSaveOrUpdateMould(){
+ this.$refs.editForm.validate(valid=>{
+ if(valid){
+ if(this.editRow.id){
+ updateMould(this.editRow).then(res=>{
+ if(res.status===200){
+ this.$message.success("淇敼鎴愬姛")
+ this.getData()
+ }
+ }).catch(error=>{
+ console.error(error)
+ })
+ }else{
+ addMould(this.editRow).then(res=>{
+ if(res.status===200){
+ this.$message.success("鏂板鎴愬姛")
+ this.getData()
+ }
+ }).catch(error=>{
+ console.error(error)
+ })
+ }
+ this.dialogVisible = false
+ }
+ })
+ },
+ workShopFormatter(row, column, cellValue) {
+ this.workshopList.forEach((obj) => {
+ if (obj.value == cellValue) {
+ cellValue = obj.label
+ }
+ })
+ return cellValue
+ },
+ addOrUpdateHandle(row){
+ if(row){
+ this.editRow = row
+ }
+ this.dialogVisible = true
+ this.$refs["editForm"].clearValidate()
+ },
formatDateTime(row, column, cellValue) {
- return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd') : ''
+ return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd HH:mm:ss') : ''
+ },
+ getData() {
+ this.$refs.mouldTable.getDataList()
+ },
+ // 鏍囪鐘舵��
+ handleCommand(event) {
+ if (this.multipleSelection && this.multipleSelection.length > 0) {
+ this.multipleSelection.forEach((item) => {
+ item.status = event;
+ updateMould(item).then(res=>{
+ if(res.status===200){
+ // this.$message.success("淇敼鎴愬姛")
+ this.getData()
+ }
+ }).catch(error=>{
+ console.error(error)
+ })
+ })
+ this.$message.success('鏀瑰彉' + event + '鎴愬姛')
+ } else {
+ this.$message.error('璇烽�夋嫨妯″叿')
+ }
+ },
+ labelPrint(){
+ if(this.multipleSelection.length==0){
+ this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹�')
+ return
+ }
+ this.diaPrintTab = true
+ },
+ printFun() {
+ // this.printDialogVisible = false;
+ this.diaPrintTab = false;
+ PrintJS({
+ printable: 'printRaw',//椤甸潰
+ type: "html",//鏂囨。绫诲瀷
+ maxWidth:450,
+ targetStyles:['*'],
+ style: `@page {
+ margin:0;
+ padding: 0;
+ size: 360px 170px landscape;
+ }
+ html{
+ zoom:100%;
+ }
+ @media print{
+ width: 360px;
+ height: 170px;
+ margin:0;
+ padding: 0;
+ }`,
+ onPrintDialogClose: this.erexcel=false,
+ targetStyles: ["*"], // 浣跨敤dom鐨勬墍鏈夋牱寮忥紝寰堥噸瑕�
+ font_size: '',
+ });
},
},
}
-</script>
\ No newline at end of file
+</script>
+<style scoped>
+.mouldTable >>>.el-table__fixed-right .el-table__fixed-body-wrapper {
+ top: 74px !important;
+}
+</style>
--
Gitblit v1.9.3