sunyadv 5 年之前
父节点
当前提交
f8793047c8
共有 2 个文件被更改,包括 175 次插入95 次删除
  1. 172 94
      ys_vue/src/views/mold/moldDetail.vue
  2. 3 1
      ys_vue/src/views/project/projectDetail.vue

+ 172 - 94
ys_vue/src/views/mold/moldDetail.vue

@@ -134,7 +134,7 @@
 
             <!-- 更新4 -->
             <el-button
-                v-show="activeTab == 4 && user.id == moldDetail.managerId"
+                v-show="activeTab == 4 && user.id == moldDetail.managerId && canInitiate"
                 size="mini"
                 type="primary"
                 style="float: right;"
@@ -181,7 +181,7 @@
                             <template slot-scope="scope">
                                 <el-button size="small"
                                     v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))" 
-                                    @click="checkOpen(scope.row.id, scope.row.fileName)">审批</el-button>
+                                    @click="checkOpen(scope.row)">审批</el-button>
                                 <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
                                     <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
                                 </a>
@@ -278,7 +278,7 @@
                             <template slot-scope="scope">
                                 <el-button size="small" 
                                     v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))" 
-                                    @click="checkOpen(scope.row.id, scope.row.fileName)">审批</el-button>
+                                    @click="checkOpen(scope.row)">审批</el-button>
                                 <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
                                     <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
                                 </a>
@@ -317,7 +317,7 @@
                             <template slot-scope="scope">
                                 <el-button size="small" 
                                     v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))" 
-                                    @click="checkOpen(scope.row.id, scope.row.fileName)">审批</el-button>
+                                    @click="checkOpen(scope.row)">审批</el-button>
                                 <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
                                     <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
                                 </a>
@@ -352,7 +352,9 @@
                                     >通过</el-button>
                                 <el-button size="small" @click="checkUpdate(scope.row.id, false)" type="danger"
                                     v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))" 
-                                    >拒绝</el-button>
+                                    >不通过</el-button>
+                                <el-button size="small" @click="showAdd" type="primary"
+                                    v-if="scope.row.uplodtorId == user.id && scope.row.state == 3">更新模具</el-button>
                             </template>
                         </el-table-column>
                     </el-table>
@@ -380,7 +382,7 @@
                             <template slot-scope="scope">
                                 <el-button size="small" 
                                     v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))" 
-                                    @click="checkOpen(scope.row.id, scope.row.fileName)">审批</el-button>
+                                    @click="checkOpen(scope.row)">审批</el-button>
                                 <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
                                     <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
                                 </a>
@@ -396,21 +398,27 @@
 
         <!-- 操作记录 -->
         <el-col :span="24" class="title">
-            {{activeTab == 4?"更新":"操作"}}记录
-            <el-button v-if="user.id == moldDetail.managerId" size="mini" type="primary" style="float: right;" @click="centerDialog5Visible = true">导出</el-button>
+                {{activeTab == 4?"更新":"操作"}}记录
+                <el-button v-if="user.id == moldDetail.managerId && activeTab != 4" size="mini" type="primary" style="float: right;" @click="centerDialog5Visible = true">导出</el-button>
             </el-col>
-            <el-table :data="operations" highlight-current-row v-loading="listLoading" style="width: 100%;">
+            <el-table v-if="activeTab != 4" :data="operations" highlight-current-row v-loading="listLoading" style="width: 100%;">
                 <el-table-column type="index" width="40"></el-table-column>
                 <el-table-column prop="content" label="操作" width="120" sortable></el-table-column>
                 <el-table-column v-if="activeTab!= 4" prop="fileName" label="操作文档名称" sortable></el-table-column>
                 <el-table-column prop="operatorName" label="操作人" align="center" width="120" sortable></el-table-column>
                 <el-table-column prop="indate" label="操作时间" width="200" align="center" sortable></el-table-column>
             </el-table>
+            <el-table v-else :data="operations" highlight-current-row v-loading="listLoading" style="width: 100%;">
+                <el-table-column type="index" width="40"></el-table-column>
+                <el-table-column prop="content" label="操作" sortable></el-table-column>
+                <el-table-column prop="operatorName" label="操作人" align="center" width="200" sortable></el-table-column>
+                <el-table-column prop="indate" label="操作时间" width="400" align="center" sortable></el-table-column>
+            </el-table>
         </el-col>
 
         <!-- 审批弹窗 -->
-        <el-dialog title="审批" :visible.sync="centerDialogVisible" width="100" center>
-            <span>{{this.activeFileName}}</span>
+        <el-dialog title="审批" :visible.sync="centerDialogVisible" width="450px">
+            <a :href="this.fileUrl" :download="this.activeFileName"><el-link type="primary">{{this.activeFileName}}</el-link></a>
             <span slot="footer" class="dialog-footer">
                 <el-button @click="check(false)">不通过</el-button>
                 <el-button type="primary" @click="check(true)">通过</el-button>
@@ -444,9 +452,11 @@
         </el-dialog>
 
         <!-- 批量导出操作记录弹窗 -->
-        <el-dialog title="批量导出操作记录" v-if="centerDialog5Visible" :visible.sync="centerDialog5Visible" width="35%" center>
-            <span style="line-height: 40px;">请输入需要导出的时间段</span>
-            <el-date-picker v-model="recordTime" type="datetimerange" placeholder="选择日期时间" style="float: right;"></el-date-picker>
+        <el-dialog title="批量导出操作记录" v-if="centerDialog5Visible" :visible.sync="centerDialog5Visible" width="100" center>
+            <!-- <span style="line-height: 40px;">请选择需要导出的时间段:</span> -->
+            <div style="text-align:center;">
+                <el-date-picker v-model="recordTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
+            </div>
             <span slot="footer" class="dialog-footer">
                 <el-button @click="centerDialog5Visible = false">取消</el-button>
                 <el-button type="primary" @click="exportRecords">确定</el-button>
@@ -491,43 +501,33 @@
             </div>
         </el-dialog>
 
-        <!--编辑界面-->
-        <el-dialog title="编辑模具" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass="customWidth">
-            <el-form :model="editForm" label-width="100px" :rules="formRules" ref="editForm" :inline="true" class="demo-form-inline">
+        <!--更新界面-->
+        <el-dialog title="更新模具" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth">
+            <el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm" :inline="true" class="demo-form-inline">
                 <el-form-item label="模具名称" prop="modelName">
-                    <el-input v-model="editForm.modelName" autocomplete="off" placeholder="请输入模具名称"></el-input>
+                    <el-input v-model="addForm.modelName" autocomplete="off" placeholder="请输入模具名称"></el-input>
                 </el-form-item>
-                <el-form-item label="模具编号" prop="modelNo">
-                    <el-input v-model="editForm.modelNo" autocomplete="off" placeholder="请输入模具编号"></el-input>
+                <el-form-item label="初始模次" prop="initialModulus">
+                    <el-input v-model="addForm.initialModulus" autocomplete="off" placeholder="请输入初始模次"></el-input>
                 </el-form-item>
-                <el-form-item label="云模盒编号" prop="equipmentId">
-                    <el-select v-model="editForm.equipmentId" clearable filterable placeholder="请选择云模盒编号" style="width:202px">
-                        <el-option v-for="item in boxes" :key="item.id" :label="item.equipmentNo" :value="item.id"></el-option>
-                    </el-select>
+                <el-form-item label="模次寿命" prop="settingLife">
+                    <el-input v-model="addForm.settingLife" autocomplete="off" placeholder="请输入模次寿命"></el-input>
                 </el-form-item>
-                <el-form-item label="初始模次">
-                    <el-input v-model="editForm.initialModulus" autocomplete="off" placeholder="请输入初始模次"></el-input>
+                <el-form-item label="RIFD码" prop="rfid">
+                    <el-input v-model="addForm.rfid" autocomplete="off" placeholder="请输入RIFD码"></el-input>
                 </el-form-item>
-                <el-form-item label="模次寿命">
-                    <el-input v-model="editForm.settingLife" autocomplete="off" placeholder="请输入模次寿命"></el-input>
+                <el-form-item label="穴数" prop="holes">
+                    <el-input v-model="addForm.holes" autocomplete="off" placeholder="请输入穴数"></el-input>
                 </el-form-item>
-                <el-form-item label="RIFD码">
-                    <el-input v-model="editForm.rfid" autocomplete="off" placeholder="请输入RIFD码"></el-input>
-                </el-form-item>
-                <el-form-item label="保养次数">
-                    <el-select v-model="editForm.maintainCount" clearable multiple allow-create filterable default-first-option placeholder="请选择保养次数" style="width:202px">
+                <el-form-item label="保养次数" prop="maintainCount">
+                    <el-select v-model="addForm.maintainCount" clearable multiple allow-create filterable default-first-option placeholder="请选择保养次数" style="width:515px">
                         <el-option v-for="item in maintainCount" :key="item" :label="item" :value="item"></el-option>
                     </el-select>
                 </el-form-item>
-                <el-form-item label="所属生产方" v-if="moldDetail.projectId != null">
-                    <el-select v-model="editForm.produceCompanyId" clearable filterable placeholder="请选择所属生产方" style="width:202px">
-                        <el-option v-for="item in customCompany" :key="item.companyId" :label="item.companyName" :value="item.companyId"></el-option>
-                    </el-select>
-                </el-form-item>
             </el-form>
             <div slot="footer" class="dialog-footer">
-                <el-button @click.native="editFormVisible = false">取消</el-button>
-                <el-button type="primary" @click.native="addSubmit" :loading="editLoading">提交</el-button>
+                <el-button @click.native="addFormVisible = false">取消</el-button>
+                <el-button type="primary" @click.native="inviteSubmit" :loading="addLoading">提交</el-button>
             </div>
         </el-dialog>
     </section>
@@ -542,7 +542,7 @@
                 user: JSON.parse(sessionStorage.getItem("user")),
                 moldDetail: {},
                 customCompany: [],
-                boxes: [],
+
                 //操作记录的时间
                 recordTime: "",
                 //单独新增零件时所需的三个变量
@@ -560,18 +560,23 @@
                 },
                 maintainCount: [5000,10000],
                 formRules: {
-                    modelNo: [
-                        { required: true, message: "请输入模具编号", trigger: "blur" }
-                    ],
                     modelName: [
                         { required: true, message: "请输入模具名称", trigger: "blur" }
                     ],
-                    equipmentId: [
-                        {
-                            required: true,
-                            message: "请选择云模盒编号",
-                            trigger: ["blur", "change"]
-                        }
+                    initialModulus: [
+                        { required: true, message: "请输入初始模次", trigger: "blur" }
+                    ],
+                    settingLife: [
+                        { required: true, message: "请输入模次寿命", trigger: "blur" }
+                    ],
+                    rfid: [
+                        { required: true, message: "请输入RIFD码", trigger: "blur" }
+                    ],
+                    holes: [
+                        { required: true, message: "请输入穴数", trigger: "blur" }
+                    ],
+                    maintainCount: [
+                        { required: true, message: "请输入保养次数", trigger: ["blur", "change"] }
                     ],
                     number: [
                         { required: true, message: "请输入零件编号", trigger: "blur" }
@@ -590,6 +595,8 @@
                 view: 0,
                 approve: 0,
 
+                canInitiate: true,
+
                 //6种文档
                 documents: {
                     mould: [],
@@ -621,21 +628,21 @@
                 activePage: 0,
                 activeArticleId: null,
                 activeFileName: null,
-
-                editFormVisible: false, //修改界面是否显示
-                editLoading: false,
-                //修改界面数据
-                editForm: {
-                    id: 0,
+                fileUrl: null,
+                
+                boxes: [],
+                companys: [],
+                projects: [],
+                maintainCount: [5000,10000,15000,20000,25000],
+                addLoading: false,
+                addFormVisible: false,
+                addForm: {
                     modelName: "",
-                    modelNo: "",
-                    equipmentId: "",
                     initialModulus: "",
                     settingLife: "",
-                    rfid: "",
-                    produceCompanyId: "",
                     maintainCount: [],
-                    flag: 1
+                    rfid: "",
+                    holes: "",
                 },
 
                 files: [],
@@ -824,7 +831,7 @@
                     if(this.approve == 1){
                         array.push(list[i]);
                     } else {
-                        if(list[i].uplodtorId == this.user.id && list[i].state <= 0){
+                        if(list[i].uplodtorId == this.user.id){
                             array.push(list[i]);
                         }
                     }
@@ -838,6 +845,15 @@
                 } else if(num == 3) {
                     this.documents.maintain = array;
                 } else if(num == 4) {
+                    for(var i in array){
+                        if(i == 0){
+                            if(array[i].state == 3){
+                                this.canInitiate = false
+                            } else if(array[i].state < 0) {
+                                this.canInitiate = true
+                            }
+                        }
+                    }
                     this.documents.update = array;
                 } else if(num == 5) {
                     this.documents.abandon = array;
@@ -845,9 +861,10 @@
             },
 
             //打开审批窗口
-            checkOpen(id, name) {
-                this.activeArticleId = id;
-                this.activeFileName = name;
+            checkOpen(row) {
+                this.activeArticleId = row.id;
+                this.activeFileName = row.fileName;
+                this.fileUrl = row.fileUrl;
                 this.twoId = null;
                 this.threeId = null;
                 this.centerDialogVisible = true;
@@ -929,39 +946,39 @@
             //更新审批通过
             checkUpdate(id, approval) {
                 var tipString = "";
-                if(confirm){
-                    tipString = "确认审批通过吗?";
+                if(approval){
+                    tipString = "确认通过审批吗?";
                 }else{
-                    tipString = "确认审批拒绝吗?";
+                    tipString = "确认不通过审批吗?";
                 }
                 this.$confirm(tipString, '审批', {
-                    type: 'info'
+                    type: approval?'success':'error'
                 }).then(() => {
                     this.http.post( this.port.mold.moldFileCheck, {
-                    mouldFileId: id,
-                    isPass: confirm ? 1 : 0 //通过为1 不通过为0
-                },
-                res => {
-                    if (res.code == "ok") {
-                        this.$message({
-                            message: "审批完成",
-                            type: "success"
-                        });
-                        this.getDocument();
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: "error"
-                        });
-                    }
-                },
-                error => {
-                        this.$message({
-                            message: error,
-                            type: "error"
-                        });
-                    }
-                );
+                        mouldFileId: id,
+                        isPass: approval ? 1 : 0 //通过为1 不通过为0
+                    },
+                    res => {
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: "审批完成",
+                                type: "success"
+                            });
+                            this.getDocument();
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                            this.$message({
+                                message: error,
+                                type: "error"
+                            });
+                        }
+                    );
                 })
             },
 
@@ -1160,7 +1177,6 @@
                                 list[i].state = 100;
                             }
                         }
-                        // console.log(list)
                         this.documents.part = list;
                     } else {
                         this.$message({
@@ -1312,6 +1328,7 @@
 
             //导出操作记录
             exportRecords(){
+                console.log(this.recordTime)
                 if(this.recordTime[0] == null || this.recordTime[1] == null){
                     this.$message({
                         message: "未输入时间",
@@ -1341,6 +1358,63 @@
                         });
                     });
                 }
+            },
+
+            //更新弹框
+            showAdd() {
+                this.addFormVisible = true;
+                this.addForm = {
+                    modelName: "",
+                    initialModulus: "",
+                    settingLife: "",
+                    maintainCount: [],
+                    rfid: "",
+                    holes: ""
+                };
+            },
+
+            //更新提交
+            inviteSubmit(){
+                this.$refs.addForm.validate(valid => {
+                    if (valid) {
+                        this.addLoading = true;
+                        var maintainCount = this.addForm.maintainCount , str = "";
+                        for(var i in maintainCount) {
+                            if(i == maintainCount.length-1){
+                                str += maintainCount[i]
+                            } else {
+                                str += maintainCount[i] + ","
+                            }
+                        }
+                        this.addForm.maintainCount = str;
+                        this.addForm.preUpdateId = this.detailId;
+                        this.http.post( this.port.mold.addMold, this.addForm,
+                        res => {
+                            this.addLoading = false;
+                            if (res.code == "ok") {
+                                this.addFormVisible = false;
+                                this.$message({
+                                    message: "更新成功",
+                                    type: "success"
+                                });
+                                this.$router.push("/moldList");
+                            } else {
+                                this.$message({
+                                    message: res.msg,
+                                    type: "error"
+                                });
+                            }
+                        },
+                        error => {
+                            this.addLoading = false;
+                            this.addFormVisible = false;
+                            this.$message({
+                                message: error,
+                                type: "error"
+                            });
+                        });
+                    }
+                });
             }
         },
         created() {
@@ -1359,6 +1433,10 @@
 </script>
 
 <style scoped>
+    a {
+        text-decoration: none;
+    }
+
     .toolbar .el-form-item {
         font-size: 14px;
         vertical-align: middle;

+ 3 - 1
ys_vue/src/views/project/projectDetail.vue

@@ -90,7 +90,7 @@
                         <template slot="title">
                             <el-col :span="24" class="title">项目文档
                                 <!-- update == 1 -->
-                                <el-upload v-if="user.id == proDetail.managerId" action="customize" :http-request="uploadFile" :show-file-list="false" multiple :limit="5" style="float:right;margin-right:20px;">
+                                <el-upload v-if="user.id == proDetail.managerId" ref="upload" action="customize" :http-request="uploadFile" :show-file-list="false" :limit="1" style="float:right;margin-right:20px;">
                                     <el-button size="mini" type="primary" :loading="upLoading">点击上传</el-button>
                                 </el-upload>
                             </el-col>
@@ -883,6 +883,7 @@
                 form.append("file", fileObj);
                 this.http.uploadFile(this.port.project.uploadFile, form , res => {
                     this.upLoading = false;
+                    this.$refs.upload.clearFiles();
                     if (res.code == "ok") {
                         this.$message({
                             message: '上传成功',
@@ -898,6 +899,7 @@
                     }
                 }, error => {
                     this.upLoading = false;
+                    this.$refs.upload.clearFiles();
                     this.$message({
                         message: error,
                         type: 'error'