zxr %!s(int64=3) %!d(string=hai) anos
pai
achega
b5292e83a8
Modificáronse 2 ficheiros con 65 adicións e 28 borrados
  1. 1 0
      src/store/modules/user.js
  2. 64 28
      src/views/PrintsManage/manage/index.vue

+ 1 - 0
src/store/modules/user.js

@@ -55,6 +55,7 @@ const user = {
           Cookies.set("nickName", res.user.nickName);
           Cookies.set("userId", res.user.userId);  
           Cookies.set("deptId", res.user.deptId);
+          Cookies.set("roles", res.user.roles[0].roleName);
           const avatar = user.avatar == "" ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
           if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
             commit('SET_ROLES', res.roles)

+ 64 - 28
src/views/PrintsManage/manage/index.vue

@@ -215,7 +215,24 @@
       </el-table-column>
       <el-table-column label="打印状态" align="center" prop="printStatus">
         <template slot-scope="scope">
-          <span style="color: #90da90" v-if="scope.row.printStatus == 1"
+          <span
+            style="color: #90da90"
+            v-if="
+              (scope.row.printStatus == 1 &&
+                scope.row.printRoom == 0 &&
+                roles == '15号文印室') ||
+                (scope.row.printStatus == 1 &&
+                  scope.row.printRoom == 1 &&
+                  roles == '19号文印室')
+            "
+            >待打印</span
+          >
+          <span
+            style="color: #90da90"
+            v-if="
+            scope.row.printStatus == 1 &&
+                (roles != '19号文印室' && roles != '15号文印室' )
+            "
             >打印中</span
           >
           <span style="color: #00ff00" v-if="scope.row.printStatus == 2"
@@ -325,7 +342,7 @@
           </el-select>
         </el-form-item>
         <div class="jiben">文件信息</div>
-        <el-form-item label="上传文件">
+        <el-form-item label="上传文件" prop="name">
           <!-- <fileUpload v-model="form.file" /> -->
           <el-upload
             :action="uploadFileUrl"
@@ -348,7 +365,7 @@
             >
           </el-upload>
         </el-form-item>
-        <el-form-item label="文件名称" prop="name">
+        <el-form-item label="文件名称">
           <el-input v-model="form.name" placeholder="请输入文件名称" />
         </el-form-item>
         <el-form-item label="打印份数" prop="printNumber">
@@ -656,7 +673,18 @@ export default {
       form: {},
       dyform: {},
       // 表单校验
-      rules: {},
+      rules: {
+        name: [
+          // { required: true, message: "发送文件不能为空", trigger: "click" },
+          { required: true }
+        ],
+        printRoom: [
+          { required: true, message: "打印室不能为空", trigger: "change" }
+        ],
+        isReturn: [
+          { required: true, message: "是否归还需要选择", trigger: "change" }
+        ]
+      },
       //级别
       levelMs: [],
       //文印室
@@ -674,16 +702,16 @@ export default {
       yaoqiu: "",
       dyopen2: false,
       tableau: null,
-      yaoqiuflg: false
+      yaoqiuflg: false,
+      roles: ""
     };
   },
   created() {
     this.getList();
-    if(Cookies.get('shuaxin')!='true'){
-       window.location.reload()
-       
+    if (Cookies.get("shuaxin") != "true") {
+      window.location.reload();
     }
-    Cookies.set('shuaxin','true');
+    Cookies.set("shuaxin", "true");
     //级别
     this.getDicts("level").then(response => {
       this.levelMs = response.data;
@@ -697,6 +725,9 @@ export default {
       this.islist = response.data;
     });
   },
+  mounted(){
+    this.roles = Cookies.get("roles");
+  },
   methods: {
     /** 查询集中文印主列表 */
     getList() {
@@ -783,7 +814,7 @@ export default {
     handleAdd() {
       this.reset();
       this.open = true;
-      this.title = "添加集中文印";
+      this.title = "添加集中文印";
       this.form.sendName = Cookies.get("nickName");
       this.form.sendId = Cookies.get("userId");
     },
@@ -796,7 +827,7 @@ export default {
         this.form.isPrintColor = response.data.isPrintColor + "";
         this.form.isPrintTwo = response.data.isPrintTwo + "";
         this.open = true;
-        this.title = "修改集中文印";
+        this.title = "修改集中文印";
       });
     },
     /** 提交按钮 */
@@ -921,7 +952,7 @@ export default {
       this.dyform.statusG = 0;
       this.dyform.printfileName = row.sendName;
       this.dyform.printNumber = row.printNumber;
-      this.dyform.printRoom=row.printRoom;
+      this.dyform.printRoom = row.printRoom;
       this.dyform.type = row.type;
       // this.dyform.isReturn = row.isReturn + "";
       if (row.isPrintColor == 1) {
@@ -951,24 +982,29 @@ export default {
     },
     //打印提交
     dysubmitForm() {
-      if (this.dyform.isReturn == 0) {
-        this.dyform.statusG = 1;
-      } else {
-        this.dyform.statusG = 0;
-      }
-      printCode(this.dyform).then(res => {
-        if (res.code == 200) {
-          console.log(res);
-          this.dyopen = false;
-          this.getList();
-          // var open=window.open();
-          location.href =
-            process.env.VUE_APP_BASE_API +
-            "/profile/print/" +
-            res.printFileName;
-          //  location.href =res.file;
+      this.$refs["dyform"].validate(valid => {
+        if (valid) {
+          if (this.dyform.isReturn == 0) {
+            this.dyform.statusG = 1;
+          } else {
+            this.dyform.statusG = 0;
+          }
+          printCode(this.dyform).then(res => {
+            if (res.code == 200) {
+              console.log(res);
+              this.dyopen = false;
+              this.getList();
+              // var open=window.open();
+              location.href =
+                process.env.VUE_APP_BASE_API +
+                "/profile/print/" +
+                res.printFileName;
+              //  location.href =res.file;
+            }
+          });
         }
       });
+
       // open.location.href="http://192.168.5.188:8080/priofile/print/202203211244.docx";
       // window.open( `https://view.officeapps.live.com/op/view.aspx?src=http://192.168.5.188:8080/profile/print/202203211428.docx`, "_blank");
     }