浏览代码

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

sunyadv 5 年之前
父节点
当前提交
0213e84806

+ 0 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldController.java

@@ -43,7 +43,6 @@ public class MouldController {
      * 添加参数:equipmentId 设备id, modelNo 模具编号 ,modelName 模具名称 ,maintainCount 保养设定次数:"1,2,3"
      * 修改参数:id 模具id, settingLife 使用年限, initialModulus 初始模次 equipmentId 设备id,
      * produceCompanyId 生产方公司id,ocCycle 每模平均周期,rfid rfid码,maintainCount 保养设定次数:"1,2,3"
-     * produceCompanyName 生产方公司的名称
      *
      * 模具更新时多传的参数  preUpdateId 要被更新的模具的id
      * @return

+ 10 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldServiceImpl.java

@@ -73,6 +73,7 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
             if ((m != null && m.getId() == mould.getId()) || m == null) {
                 if (mould.getProduceCompanyId() != null) {
                     Company company = companyMapper.selectById(mould.getProduceCompanyId());
+                    mould.setProduceCompanyName(company.getCompanyName());
                     mould.setArea(company.getCompanyAddress());
                 }
                 mouldMapper.updateById(mould);
@@ -83,7 +84,10 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
             if (null != mould.getPreUpdateId()) {
                 //更新模具操作
                 //取出之前模具的信息
-                Mould mould1 = mouldMapper.selectById(mould.getPreUpdateId());
+                Mould model = mouldMapper.selectById(mould.getPreUpdateId());
+                model.setProjectId(null);
+                model.setEquipmentId(null);
+                mouldMapper.updateById(model);
                 //查询当前模具编号的模具是否存在
                 Integer count = mouldMapper.selectCount(new QueryWrapper<Mould>().eq("model_no", mould.getModelNo()));
                 if (count > 0) {
@@ -92,13 +96,18 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
                 } else {
                     if (mould.getProduceCompanyId() != null) {
                         Company company = companyMapper.selectById(mould.getProduceCompanyId());
+                        mould.setProduceCompanyName(company.getCompanyName());
                         mould.setArea(company.getCompanyAddress());
                     }
                     mould.setCreatorId(user.getId());
                     mould.setCompanyId(user.getCompanyId());
+                    mould.setEquipmentId(model.getEquipmentId());
+                    mould.setProjectId(model.getProjectId());
+                    mould.setRunTimes(model.getRunTimes());
                     mouldMapper.insert(mould);
                 }
                 }else{
+                    //普通创建模具
                     //查询当前模具编号的模具是否存在
                     Integer count = mouldMapper.selectCount(new QueryWrapper<Mould>().eq("model_no", mould.getModelNo()));
                     if (count > 0) {

+ 5 - 1
cloud-model/src/main/resources/mapper/MouldMapper.xml

@@ -182,7 +182,7 @@
     <select id="selectListByCompanyId" resultMap="BaseResultMapVO">
 select
         tbm.id id,tbm.model_no model_no, tbm.model_name model_name,tbm.initial_modulus initial_modulus,tbm.rfid rfid,tbm.creator_id creator_id,tbm.equipment_id equipment_id,tbm.is_maintain,tbm.holes,
-        tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbm.pre_update_id,tbm.company_id,
+        tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbm.pre_update_id,tbm.company_id,tbco.company_name produceCompany,tbm.produce_company_id,
         tbp.manager mangerName,tbm.area area,tbmp.hill_number hillNumber,tbm.oc_cycle oc_cycle,tbp.manager_id managerId,
         tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times
         from
@@ -198,6 +198,10 @@ select
         tb_company tbc
         on
         tbc.id = tbm.company_id
+        left join
+        tb_company tbco
+        on
+        tbco.id = tbm.produce_company_id
         where
           tbm.company_id = #{companyId}
     </select>

+ 109 - 1
ys_vue/src/views/Home.vue

@@ -95,6 +95,7 @@
           </span>
           <el-dropdown-menu slot="dropdown">
             <el-dropdown-item @click.native="reset">修改密码</el-dropdown-item>
+            <el-dropdown-item @click.native="editInfoOpen">修改信息</el-dropdown-item>
             <el-dropdown-item divided @click.native="logout">退出登录</el-dropdown-item>
           </el-dropdown-menu>
         </el-dropdown>
@@ -217,6 +218,45 @@
             <el-button type="primary" @click.native="resetPwd" :loading="editLoading">提交</el-button>
           </div>
         </el-dialog>
+
+        <!--修改信息-->
+        <el-dialog
+          title="修改信息"
+          v-if="editInformation"
+          :visible.sync="editInformation"
+          :close-on-click-modal="false"
+          customClass="customWidth"
+        >
+          <el-form :model="editInfoForm" label-width="80px" :rules="passRule" ref="editInfoForm">
+            <el-form-item label="姓名" prop="username">
+              <el-input v-model="editInfoForm.username" autocomplete="off" placeholder="请输入姓名"></el-input>
+            </el-form-item>
+          </el-form>
+          <el-form :model="editInfoForm" label-width="80px" :rules="passRule" ref="editInfoForm">
+            <el-form-item label="手机号" prop="mobile">
+              <el-input
+                v-model="editInfoForm.mobile"
+                autocomplete="off"
+                placeholder="请输入手机号"
+                :disabled="true"
+              ></el-input>
+            </el-form-item>
+          </el-form>
+          <el-form :model="editInfoForm" label-width="80px" :rules="passRule" ref="editInfoForm">
+            <el-form-item label="所属公司" prop="companyName">
+              <el-input
+                v-model="editInfoForm.companyName"
+                autocomplete="off"
+                placeholder="请输入所属公司"
+                :disabled="true"
+              ></el-input>
+            </el-form-item>
+          </el-form>
+          <div slot="footer" class="dialog-footer">
+            <el-button @click.native="editPassWord = false">取消</el-button>
+            <el-button type="primary" @click.native="editInfo" :loading="editLoading2">提交</el-button>
+          </div>
+        </el-dialog>
       </section>
     </el-col>
   </el-row>
@@ -231,13 +271,25 @@ export default {
       collapsed: false,
       sysUserName: "",
 
+      editInformation: false,
       editPassWord: false,
       editLoading: false,
+      editLoading2: false,
       addForm: {
+        id: "",
         password: ""
       },
+      editInfoForm: {
+        id: "",
+        username: "",
+        mobile: "",
+        companyName: ""
+      },
       passRule: {
-        password: [{ required: true, message: "请输入新密码", trigger: "blur" }]
+        password: [
+          { required: true, message: "请输入新密码", trigger: "blur" }
+        ],
+        username: [{ required: true, message: "请输入姓名", trigger: "blur" }]
       },
       //消息数据
       popoverData: [],
@@ -277,6 +329,62 @@ export default {
       )[0].style.display = status ? "block" : "none";
     },
 
+    //打开编辑信息界面
+    editInfoOpen() {
+      this.editInformation = true;
+      this.editInfoForm.id = JSON.parse(sessionStorage.getItem("user")).id;
+      this.editInfoForm.username = JSON.parse(
+        sessionStorage.getItem("user")
+      ).username;
+      this.editInfoForm.mobile = JSON.parse(
+        sessionStorage.getItem("user")
+      ).account;
+      this.editInfoForm.companyName = JSON.parse(
+        sessionStorage.getItem("user")
+      ).companyName;
+    },
+
+    //编辑信息
+    editInfo() {
+      this.$refs.editInfoForm.validate(valid => {
+        if (valid) {
+          this.editLoading2 = true;
+          this.http.post(
+            this.port.pwd.resetPwd,
+            { id: this.editInfoForm.id, username: this.editInfoForm.username },
+            res => {
+              this.editLoading2 = false;
+              this.editInformation = false;
+              if (res.code == "ok") {
+                this.$message({
+                  message: "修改成功",
+                  type: "success"
+                });
+                //读取并覆盖session storage
+                var userObject = JSON.parse(sessionStorage.getItem("user"));
+                userObject.username = this.editInfoForm.username;
+                sessionStorage.setItem("user", JSON.stringify(userObject));
+                this.sysUserName = this.editInfoForm.username;
+              } else {
+                this.$message({
+                  message: res.msg,
+                  type: "error"
+                });
+              }
+            },
+            error => {
+              this.editLoading2 = false;
+              this.editInformation = false;
+              this.$message({
+                message: error,
+                type: "error"
+              });
+            }
+          );
+        }
+      });
+    },
+
     reset() {
       this.editPassWord = true;
       this.addForm.id = JSON.parse(sessionStorage.getItem("user")).id;