zouyu
2024-01-11 7b09b025269aa1ea04e83be487954913d263a5b3
包装检验模板管理
已修改2个文件
已添加3个文件
671 ■■■■■ 文件已修改
src/api/quality/packageInspectTemp.js 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/plan/productionschedul/index.vue 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/quality/packageInspectTemplate/index.vue 211 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/quality/packageInspectTemplate/inspect-detail.vue 256 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/quality/packageinspect/packageInspect-form.vue 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/quality/packageInspectTemp.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,68 @@
import request from '@/router/axios'
export function getList(query){
    return request({
        url: '/mes/qualityPackageInspectTemp/page',
        method: 'get',
        params: query
    })
}
export function getInspectList(id){
    return request({
        url: '/mes/qualityPackageInspectTemp/pageInspect/'+id,
        method: 'get',
    })
}
export function getAllTemplateByEnable(){
    return request({
        url: '/mes/qualityPackageInspectTemp/getAllTemplateByEnable',
        method: 'get',
    })
}
export function addTemplate(data){
    return request({
        url: '/mes/qualityPackageInspectTemp/addTemplate',
        method: 'post',
        params: data
    })
}
export function updateTemplate(data){
    return request({
        url: '/mes/qualityPackageInspectTemp/updateTemplate',
        method: 'post',
        params: data
    })
}
export function addInspect(data){
    return request({
        url: '/mes/qualityPackageInspectTemp/addInspect',
        method: 'post',
        params: data
    })
}
export function updateInspect(data){
    return request({
        url: '/mes/qualityPackageInspectTemp/updateInspect',
        method: 'post',
        params: data
    })
}
export function delTemplate(id){
    return request({
        url: '/mes/qualityPackageInspectTemp/deleteTemplate/'+id,
        method: 'post',
    })
}
export function deleteInspect(id){
    return request({
        url: '/mes/qualityPackageInspectTemp/deleteInspect/'+id,
        method: 'post',
    })
}
src/views/plan/productionschedul/index.vue
@@ -10,37 +10,37 @@
                <div>
                  <el-button @click="tagFinished" size="mini" round type="success">标记已完成</el-button>
                  <el-button size="mini" round type="primary"
                  v-if="permissions.plan_productionschedul_edit_line"
                  v-if="permissions.plan_productionschedul_edit_line"
                  @click="openEditDialog">编辑时间线</el-button>
                  <el-tooltip content="刷新">
                    <el-button circle icon="el-icon-refresh" @click="getDataList"></el-button>
                  </el-tooltip>
                </div>
              </div>
              <avue-crud
              <avue-crud
              class="unfinished-crud"
              :data="tableData"
              ref="crud"
              :option="option"
              :span-method="spanMethod"
              :data="tableData"
              ref="crud"
              :option="option"
              :span-method="spanMethod"
              @refresh-change="getDataList"
              @current-change="handleCurrentChange"
              @size-change="handleSizeChange"
              :page="page"
              :page="page"
              @selection-change="selectionRow"
              :table-loading="loading">
              <template #menu="{ row, index }">
                <el-button
                v-if="permissions.plan_productionschedul_edit"
                type="text"
                icon="el-icon-edit"
                size="small"
                <el-button
                v-if="permissions.plan_productionschedul_edit"
                type="text"
                icon="el-icon-edit"
                size="small"
                @click="editHandle(row, index)">编辑</el-button>
                <el-button
                v-if="permissions.plan_productionschedul_del"
                type="text"
                icon="el-icon-delete"
                size="small"
                <el-button
                v-if="permissions.plan_productionschedul_del"
                type="text"
                icon="el-icon-delete"
                size="small"
                @click="deleteHandle(row, index)">删除</el-button>
              </template>
              </avue-crud>
@@ -51,23 +51,23 @@
              <div style="display:flex;height:36px;justify-content: space-between;align-items:center;">
                <div><span style="color:#34BD66;font-weight: bold;">已完成</span></div>
              </div>
              <avue-crud
              <avue-crud
              class="finished-crud"
              :data="finishedTableData"
              ref="finished"
              :option="finishedOption"
              :span-method="spanMethod"
              :data="finishedTableData"
              ref="finished"
              :option="finishedOption"
              :span-method="spanMethod"
              @refresh-change="getFinishedData"
              @current-change="handleCurrentChange"
              @size-change="handleSizeChange"
              :page="finishedPage"
              :page="finishedPage"
              @selection-change="selectionFinishedRow">
              <!-- <template #menu="{ row, index }">
                <el-button
                v-if="permissions.plan_productionschedul_del"
                type="text"
                icon="el-icon-delete"
                size="small"
                <el-button
                v-if="permissions.plan_productionschedul_del"
                type="text"
                icon="el-icon-delete"
                size="small"
                @click="deleteHandle(row, index)">删除</el-button>
              </template> -->
              </avue-crud>
@@ -129,7 +129,7 @@
                      style="width:100%"
                      v-model="item.planTime"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      type="datetime"
                      type="datetime"
                      placeholder="选择日期时间">
                    </el-date-picker>
                  </el-col>
@@ -143,7 +143,7 @@
                      style="width:100%"
                      v-model="item.actualTime"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      type="datetime"
                      type="datetime"
                      placeholder="选择日期时间">
                    </el-date-picker>
                  </el-col>
@@ -454,7 +454,7 @@
      }, {
        prop: 'contractNo',
        span: []
      },
      },
      {
        prop: 'orderTime',
        span: []
src/views/quality/packageInspectTemplate/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,211 @@
<template>
  <div>
    <basic-container>
        <avue-crud
        :data="list"
        style="width:98%"
        :option="option"
        :page="page"
        @row-save="saveTemplate"
        @current-change="currentChange"
        @size-change="sizeChange">
            <template slot="state" slot-scope="scope">
                <el-tag :type="scope.row.state ? 'success':'danger'">{{scope.row.state ? '启用':'禁用'}}</el-tag>
            </template>
            <template slot="stateForm" slot-scope="scope">
                <el-switch
                    v-model="scope.row.state"
                    active-color="#13ce66"
                    :active-value="true"
                    :inactive-value="false">
                </el-switch>
            </template>
            <template #menu="{size,row,index}">
                <el-button class="menu-button" :size="size" @click="showInspectDialog(size,row,index)" type="text" icon="el-icon-set-up">检验项</el-button>
                <el-button class="menu-button" :size="size" @click="updateTemplate(size,row,index)" type="text" icon="el-icon-edit">编辑</el-button>
                <el-button class="menu-button" :size="size" @click="deleteTemplate(size,row,index)" type="text" icon="el-icon-delete">删除</el-button>
            </template>
        </avue-crud>
    </basic-container>
    <el-dialog
    title="编辑模板信息"
    :visible.sync="updateDialog"
    width="40%">
        <el-form :model="updateData" label-width="100px" :inline="true"
            label-position="right" ref="updateTemplate" :rules="updateRules">
            <el-form-item label="模板名称" prop="templateName">
                <el-input v-model="updateData.templateName" placeholder="请输入模板名称"></el-input>
            </el-form-item>
            <el-form-item label="是否启用" prop="state">
                <el-switch
                    v-model="updateData.state"
                    active-color="#13ce66"
                    :active-value="true"
                    :inactive-value="false">
                </el-switch>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button type="primary" icon="el-icon-circle-plus-outline" @click="confirmUpdate">保 å­˜</el-button>
            <el-button icon="el-icon-remove-outline" @click="updateDialog = false">取 æ¶ˆ</el-button>
        </span>
    </el-dialog>
    <inspectDetail v-if="isShow" :paramObj="paramObj" :currshowlist.sync="showDetail"></inspectDetail>
  </div>
</template>
<script>
import inspectDetail from './inspect-detail'
import {getList,addTemplate,updateTemplate,delTemplate} from '@/api/quality/packageInspectTemp'
export default {
    data(){
        return {
            isShow: false,
            paramObj:{
                id: null,
            },
            showDetail: false,
            updateData:{
                templateName: null,
                state: null,
            },
            updateRules:{
                templateName:[{required:true,message:'请输入模板名称',trigger:'blur'}]
            },
            updateDialog: false,
            list: [],
            page:{
                currentPage: 1,
                pageSize: 20,
                total: 0
            },
            option: {
                dialogWidth: '40%',
                menu: true,
                addBtn: true,
                editBtn: false,
                delBtn: false,
                border: true,
                index: true,
                height: 400,
                indexLabel: '序号',
                align: 'center',
                refreshBtn: false,
                columnBtn: false, // æ˜¯å¦æ˜¾ç¤ºæ˜¾å½±æŒ‰é’®H
                headerAlign: 'center',
                column: [{
                    label: '模板名称',
                    prop: 'templateName',
                    overHidden: true,
                    rules:[{required:true,message:'模板名称不能为空',trigger:'blur'}]
                }, {
                    label: '是否启用',
                    prop: 'state',
                    overHidden: true,
                    slot: true,
                    formslot: true,
                    value: true,
                }]
            }
        }
    },
    created(){
        this.getDataList()
    },
    components:{
        inspectDetail
    },
    methods:{
        deleteTemplate(size,row,index){
            const _than = this
            this.$confirm('此操作将永久删除该模板, æ˜¯å¦ç»§ç»­?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
            type: 'warning'
            }).then(() => {
                delTemplate(row.id).then(res=>{
                    if(res.status===200){
                        _than.$message.success("删除成功")
                        _than.getDataList()
                    }
                }).catch(error=>{
                    console.error(error)
                })
            }).catch(() => {});
        },
        showInspectDialog(size,row,index){
            this.paramObj.id = row.id
            this.isShow = true
            this.$nextTick(()=>{
                this.showDetail = true
            })
        },
        updateTemplate(size,row,index){
            console.log(row);
            this.updateData = JSON.parse(JSON.stringify(row))
            this.updateDialog  =true
        },
        confirmUpdate(){
            const _than = this
            this.$refs.updateTemplate.validate(valid=>{
                if(valid){
                    let data = {
                        id:this.updateData.id,
                        templateName:this.updateData.templateName,
                        state:this.updateData.state
                    }
                    updateTemplate(data).then(res=>{
                        if(res.status===200){
                            _than.$message.success("更新成功")
                            _than.getDataList()
                            _than.updateDialog = false
                        }
                    }).catch(error=>{
                        console.error(error)
                    })
                }
            })
        },
        saveTemplate(row, done, loading){
            addTemplate(row).then(res=>{
                if(res.status===200){
                    this.$message.success("添加成功")
                    this.getDataList()
                }
            }).catch(error=>{
                console.error(error)
            })
            setTimeout(()=>{
                done()
            },1000)
        },
        sizeChange(pageSize) {
            this.page.pageSize = pageSize;
            this.getList();
        },
        currentChange(currentPage) {
            this.page.currentPage = currentPage;
            this.getList();
        },
        getDataList() {
            getList({
                current: this.page.currentPage,
                size: this.page.pageSize,
                templateType: '0'
            }).then(res=>{
                if(res.status===200){
                    this.list = res.data.data.records
                    this.page.total = res.data.data.total
                }
            }).catch(error=>{
                console.error(error)
            })
        },
    }
}
</script>
<style scoped>
.menu-button{
    margin: 0px 5px;
}
</style>
src/views/quality/packageInspectTemplate/inspect-detail.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,256 @@
<template>
    <div>
    <el-dialog
    title="检验项管理"
    top="5vh"
    :visible.sync="inspectDialog"
    @close="$emit('update:currshowlist', false)"
    :show="currshowlist"
    width="80%">
        <avue-crud
        ref="inspectDetail"
        :data="dataList"
        :option="option"
        @row-save="addInspectHandler"
        @row-del="delInspectHandler"
        :page="page">
            <template #menu="{size,row,index}">
                <el-button v-if="row.children!=null" class="menu-button" :size="size" @click="addChildren(size,row,index)" type="text" icon="el-icon-circle-plus-outline">添加子项目</el-button>
                <el-button v-if="row.children==null" class="menu-button" :size="size" @click="showUpdateDialog(size,row,index)" type="text" icon="el-icon-edit">编辑</el-button>
                <el-button v-if="row.children==null" class="menu-button" :size="size" @click="delInspectHandler(size,row,index)" type="text" icon="el-icon-delete">删除</el-button>
            </template>
        </avue-crud>
    </el-dialog>
    <el-dialog
    title="编辑"
    :visible.sync="updateVisible"
    width="50%">
        <el-form :model="editForm" label-position="right" label-width="100px" ref="editForm">
            <el-form-item label="检验项" prop="inspectName" :rules="{required:true,message:'检验项不能为空',trigger:'blur'}">
                <el-input
                disabled
                placeholder="请输入检验项目名称"
                type="textarea"
                v-model="editForm.inspectName"
                :rows="2" />
            </el-form-item>
            <el-form-item label="检验标准" prop="inspectRequired" :rules="{required:true,message:'检验标准不能为空',trigger:'blur'}">
                <el-input
                placeholder="请输入检验标准"
                type="textarea"
                v-model="editForm.inspectRequired"
                :rows="2" />
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button @click="updateVisible = false">取 æ¶ˆ</el-button>
            <el-button type="primary" @click="updateInspectHandler">ç¡® å®š</el-button>
        </span>
    </el-dialog>
    <el-dialog
    title="添加子项目"
    :visible.sync="addChildrenVisible"
    width="50%">
        <el-form :model="addChildrenForm" label-position="right"
        label-width="100px" ref="addChildrenForm">
            <el-form-item label="检验项" prop="inspectName">
                <el-input
                placeholder="请输入检验项目名称"
                type="textarea"
                disabled
                v-model="addChildrenForm.inspectName"
                :rows="2" />
            </el-form-item>
            <el-form-item label="检验标准" prop="inspectRequired" :rules="{required:true,message:'检验标准不能为空',trigger:'blur'}">
                <el-input
                placeholder="请输入检验标准"
                type="textarea"
                v-model="addChildrenForm.inspectRequired"
                :rows="2" />
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button @click="addChildrenVisible = false">取 æ¶ˆ</el-button>
            <el-button type="primary" @click="addInspectHandler">ç¡® å®š</el-button>
        </span>
    </el-dialog>
</div>
</template>
<script>
import {getInspectList,addInspect,updateInspect,deleteInspect} from '@/api/quality/packageInspectTemp'
export default {
    props: {
        currshowlist: {
            type: Boolean,
            default: false
        },
        paramObj: {
            type: Object,
            default: ()=>{
                return null
            }
        }
    },
    watch: {
        updateVisible(newVal){
            if(!newVal){
                this.$refs.editForm.resetFields()
            }
        },
        addChildrenVisible(newVal){
            if(!newVal){
                this.$refs.addChildrenForm.resetFields()
            }
        },
        currshowlist() {
            this.inspectDialog = this.currshowlist
            if (this.currshowlist) {
                this.$nextTick(() => {
                    this.getData()
                })
            }
        }
    },
    data(){
        return {
            addChildrenVisible: false,
            addChildrenForm: {
                inspectName: null,
                inspectRequired: null,
            },
            editForm: {
                inspectName: null,
                inspectRequired: null,
            },
            updateVisible: false,
            inspectDialog: false,
            dataList: [],
            page:{
                currentPage: 1,
                pageSize: 20,
                total: 0
            },
            option: {
                rowKey: 'id',
                rowParentKey: 'id',
                defaultExpandAll: true,
                dialogWidth: '60%',
                menu: true,
                addBtn: true,
                editBtn: false,
                delBtn: false,
                border: true,
                index: true,
                height: 350,
                indexLabel: '序号',
                align: 'center',
                refreshBtn: false,
                columnBtn: false, // æ˜¯å¦æ˜¾ç¤ºæ˜¾å½±æŒ‰é’®H
                headerAlign: 'center',
                column: [{
                    label: '检验项',
                    prop: 'inspectName',
                    overHidden: true,
                    formslot: true,
                }, {
                    label: '检验标准',
                    prop: 'inspectRequired',
                    overHidden: true,
                    formslot: true,
                }]
            },
        }
    },
    methods:{
        addChildren(size,row,index){
            console.log(row);
            this.addChildrenForm.inspectName = row.inspectName
            this.addChildrenVisible = true
        },
        delInspectHandler(size,row,index){
            const _than = this
            this.$confirm('此操作将永久删除该检验项, æ˜¯å¦ç»§ç»­?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                deleteInspect(row.id).then(res=>{
                    if(res.status===200){
                        _than.$message.success("删除成功")
                        _than.getData()
                    }
                }).catch(error=>{
                    console.error(error)
                })
            }).catch(() => {});
        },
        showUpdateDialog(size,row,index){
            this.editForm = {
                id: row.id,
                inspectName: row.templateName,
                inspectRequired: row.inspectRequired
            }
            this.updateVisible = true
        },
        updateInspectHandler(){
            this.$refs.editForm.validate(valid=>{
                if(valid){
                    updateInspect(this.editForm).then(res=>{
                        if(res.status===200){
                            this.$message.success("修改成功")
                            this.getData()
                            this.updateVisible = false
                        }
                    }).catch(error=>{
                        console.error(error)
                    })
                }
            })
        },
        addInspectHandler(){
            const _than = this
            this.$refs.addChildrenForm.validate(valid=>{
                if(valid){
                    let obj = {
                        parentId: this.paramObj.id,
                        ...this.addChildrenForm
                    }
                    addInspect(obj).then(res=>{
                        if(res.status===200){
                            _than.getData()
                            _than.$message.success("添加成功")
                            _than.addChildrenVisible = false
                        }
                    }).catch(error=>{
                        console.error(error)
                    })
                }
            })
        },
        getData(){
            getInspectList(this.paramObj.id).then(res=>{
                if(res.status===200){
                    let dataList = res.data.data.records
                    dataList.forEach(ele=>{
                        ele.id = Math.random()
                    })
                    this.dataList = dataList
                    this.page.total = res.data.data.total
                }
            }).catch(error=>{
                console.error(error)
            })
        },
    }
}
</script>
<style scope>
.avue-crud__pagination {
    position: relative;
    padding: 0px 0 0px 20px;
    text-align: right;
    z-index: 10;
}
</style>
src/views/quality/packageinspect/packageInspect-form.vue
@@ -68,11 +68,10 @@
            <el-col :span="12" style="text-align: right;">
                <el-dropdown @command="handleCommand" v-if="!isShow && resultVal==null">
                    <el-button size="mini" style="margin-right: 10px;" type="primary" >
                        åˆ‡æ¢é»˜è®¤æ£€éªŒé¡¹<i class="el-icon-arrow-down el-icon--right"></i>
                        åˆ‡æ¢æ£€éªŒé¡¹æ¨¡æ¿<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="1">检验项目1</el-dropdown-item>
                        <el-dropdown-item divided command="2">检验项目2</el-dropdown-item>
                        <el-dropdown-item :key="index" v-for="(item,index) in inspectMoulds" :command="item.father">{{item.father}}</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
              <el-button v-if="resultVal=='' || resultVal==null" size="mini" @click="clickAddLine()">添加检验项目</el-button>
@@ -124,6 +123,7 @@
                        <el-select style="width:100%" :disabled="resultVal!=null" @change="changeResult" v-model="scope.row.result" v-if="!scope.row.children">
                            <el-option label="合格" value="合格"></el-option>
                            <el-option label="不合格" value="不合格"></el-option>
                            <el-option label="不适用" value="不适用"></el-option>
                        </el-select>
                    </template>
                  </el-table-column>
@@ -194,6 +194,7 @@
  updatePackageInspectById,
  getCustomer,
} from '@/api/quality/packageInspect'
import {getAllTemplateByEnable} from '@/api/quality/packageInspectTemp'
import {inspect1,inspect2} from '@/const/defaultPackageInspect'
export default {
    computed:{
@@ -202,6 +203,7 @@
    },
    data(){
        return{
            inspectMoulds: [],
            isShow: false,
            submitData: {
              id:null,
@@ -253,7 +255,10 @@
          this.resultVal=val
        }
      }
      this.getAllInspect()
      this.init()
      this.checkShowState()
    },
    watch:{
      dialogVisible(newVal){
@@ -263,15 +268,34 @@
      }
    },
    methods:{
      checkShowState(){
        let num = 0
        this.list.forEach(ele=>{
            if(ele.children){
                ele.children.forEach(c=>{
                    if(c.pid){
                        num++
                    }
                })
            }
        })
        this.isShow = num==0
      },
      getAllInspect(){
        getAllTemplateByEnable().then(res=>{
            if(res.status===200){
                this.inspectMoulds = res.data.data
            }
        }).catch(error=>{
            console.error(error)
        })
      },
      handleCommand(command) {
        switch(command){
            case "1":
                this.init(inspect1)
            break;
            case "2":
                this.init(inspect2)
            break;
        }
        this.inspectMoulds.forEach(ele=>{
            if(ele.father==command){
                this.init(ele.children)
            }
        })
      },
      changeResult(){
        let result = ''
@@ -433,7 +457,27 @@
            _than.list = []
            let userNameList = []
            if(dataList){
                _than.list = JSON.parse(JSON.stringify(dataList))
                let tempList = []
                dataList.forEach(ele=>{
                    let obj = {
                        randomId: Math.random(),
                        name: ele.inspectName,
                        children: []
                    }
                    if(ele.children){
                        ele.children.forEach(e=>{
                            obj.children.push({
                                required: e.inspectRequired,
                                randomId: Math.random(),
                                isEdit: false,
                                note: '',
                                result: ''
                            })
                        })
                    }
                    tempList.push(obj)
                })
                _than.list = tempList
            }
            data.packageInsProductS.forEach(item => {
              if (item.children) {
@@ -462,9 +506,9 @@
                    _than.list.push(ele)
                }
              })
              let find1 = this.list.find(ele=>ele.name===inspect1[0].name&&ele.isEdit) !=undefined;
              let find2 = this.list.find(ele=>ele.name===inspect2[0].name&&ele.isEdit) !=undefined;
              this.isShow = find1||find2
            //   let find1 = this.list.find(ele=>ele.name===inspect1[0].name&&ele.isEdit) !=undefined;
            //   let find2 = this.list.find(ele=>ele.name===inspect2[0].name&&ele.isEdit) !=undefined;
            //   this.isShow = find1||find2
              _than.conclusionTable = [{
                packageNo: data.packageNo,
                userName: Array.from(new Set(userNameList)).join(','),