Эх сурвалжийг харах

workflow修改,login3备份

huahaiyan 6 жил өмнө
parent
commit
e93d9df698

+ 69 - 4
src/dashoo.cn/backend/api/business/workflow/ActivitiService.go

@@ -20,10 +20,11 @@ import (
 )
 
 type ActivitiService struct {
-	BaseUrl  string
-	AposeUrl string
-	Username string
-	Password string
+	BaseUrl		string
+	AposeUrl	string
+	OriginUrl	string
+	Username 	string
+	Password 	string
 	ServiceBase
 }
 
@@ -35,6 +36,8 @@ func GetActivitiService(xormEngine *xorm.Engine) *ActivitiService {
 	s.BaseUrl = "http://47.92.212.59:8080/acti-api/api/acti"
 	//s.BaseUrl = "http://192.168.0.171:8081/api/acti"
 	s.AposeUrl = "http://47.92.212.59:8080/acti-api/api/apose"
+	//s.OriginUrl = "http://localhost:8081/api"
+	s.OriginUrl = "http://47.92.212.59:8080/acti-api/api"
 	//s.AposeUrl = "http://localhost:8081/api/apose"
 	//s.AposeUrl = "http://192.168.0.171:8081/api/apose"
 	s.Username = "leader"
@@ -67,6 +70,18 @@ func (this *ActivitiService) Post2(url string, params string, token string) *htt
 	log.Println("resp= ", resp)
 	return resp
 }
+func (this *ActivitiService) PostOrigin(url string, params string, token string) *http.Response {
+	client := &http.Client{}
+	req, err := http.NewRequest("POST", this.OriginUrl+url, strings.NewReader(params))
+	req.Header.Add("Content-Type", "application/json")
+	req.Header.Add("Authorization", "Bearer "+token)
+	resp, err := client.Do(req)
+	if err != nil {
+		log.Println("err= ", err)
+	}
+	log.Println("resp= ", resp)
+	return resp
+}
 
 func (this *ActivitiService) Get(url string, params string, token string) *http.Response {
 	client := &http.Client{}
@@ -237,3 +252,53 @@ func (this *ActivitiService) ExcelToPdf(addressUrl string) string {
 	fmt.Println("==retDocUrl==", retDocUrl)
 	return retDocUrl
 }
+
+
+func (this *ActivitiService) FillWordTemplate(datas map[string]interface{}, templateUrl string, fileName string) string {
+	var wordTempVM WordTemplateVM
+	wordTempVM.Datas = datas
+	wordTempVM.TemplateUrl = templateUrl
+	wordTempVM.FileName = fileName
+	fmt.Println("==templateUrl===", templateUrl)
+	jsonParam, err := json.Marshal(wordTempVM)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParam)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.PostOrigin("/word/fill-word", params, "")
+	if retVal.StatusCode != 200 {
+		return ""
+	}
+	//pdfByte, err := ioutil.ReadAll(retVal.Body)
+	//ioutil.WriteFile("E:\aa.pdf", pdfByte, 777)
+	//模板下载到服务器
+	_dir := utils.Cfg.MustValue("file", "tmplateDir") + "word"
+	utils.CreatePath(_dir)
+	_dir += "/tmp_" + strconv.Itoa(int(time.Now().Unix())) + ".docx"
+	raw := retVal.Body
+	defer raw.Close()
+
+	file, err := os.Create(_dir)
+	defer file.Close()
+	writer := bufio.NewWriter(file)
+	defer writer.Flush()
+	body, err := ioutil.ReadAll(raw)
+	writer.Write(body)
+
+	if err != nil {
+		return ""
+	}
+	var sw *Seaweed
+	var filer []string
+	if _filer := os.Getenv("GOSWFS_FILER_URL"); _filer != "" {
+		filer = []string{_filer}
+	}
+	sw = NewSeaweed("http", utils.Cfg.MustValue("file", "upFileHost"), filer, 2*1024*1024, 5*time.Minute)
+	//_, fID, err := sw.Upload(retVal.Body, "tmp.pdf", int64(len(pdfByte)), "", "")
+	_, _, fID, err := sw.UploadFile(_dir, "", "")
+	retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
+	os.Remove(_dir)
+	fmt.Println("==retDocUrl==", retDocUrl)
+	return retDocUrl
+}

+ 7 - 1
src/dashoo.cn/backend/api/business/workflow/workflow.go

@@ -27,7 +27,7 @@ type ActiHistoricTask struct {
 	BusinessKey       string `json:"businessKey"`
 	TaskName          string `json:"taskName"`
 	Assignee          string `json:"assignee"`
-	Users          	  string `json:"users"`
+	Users             string `json:"users"`
 	Result            string `json:"result"`
 	Remarks           string `json:"remarks"`
 	StartTime         int64  `json:"startTime"`
@@ -40,6 +40,12 @@ type AposeVM struct {
 	AddressUrl string `json:"addressUrl"`
 }
 
+type WordTemplateVM struct {
+	Datas       map[string]interface{} `json:"datas"`
+	TemplateUrl string                 `json:"templateUrl"`
+	FileName    string                 `json:"fileName"`
+}
+
 const (
 	//特检站数据录入
 	TJZ_DATA_KEY string = "tjz_data_apply"

+ 223 - 0
src/dashoo.cn/frontend_web/src/pages/login3.vue

@@ -0,0 +1,223 @@
+<template>
+
+  <div style="height: calc(100vh); width: 100%; background-color:#FFFFFF" >
+    <img src="../assets/img/title_gongfang.png" style="height:60px; margin-top: 20px;margin-left: 100px;"  >
+    <div class="back-width">
+      <div class="login-body">
+        <section class="login">
+          <!--<header class="login-header">
+            <h1 style="text-align:center;margin-top:70px;margin-bottom:40px;"><router-link to="/"><img src="../assets/img/logo.png" style="height:80px;"></router-link></h1>
+            <el-alert v-if="error" :title="error.title" type="warning" :description="error.message" show-icon/>
+          </header>-->
+          <el-form class="login-form" auto-complete="off" :model="model" :rules="rules" ref="user" label-position="top">
+            <h2 class="heading">登录</h2>
+            <el-form-item label="用户名" prop="username">
+              <el-input type="text" v-model="model.username" placeholder="请输入用户名">
+                <el-select v-model="loginMode" slot="append" placeholder="登录类型" style="width: 110px;">
+                  <el-option label="普通账户" :value="1"></el-option>
+                  <el-option label="PTR认证" :value="2"></el-option>
+                </el-select>
+              </el-input>
+            </el-form-item>
+            <el-form-item label="密码" prop="password">
+              <el-input type="password" v-model="model.password" placeholder="请输入密码" @keyup.enter.native="login()" />
+            </el-form-item>
+            <el-button type="primary" :loading="loading" @click="login()">{{ loading ? '登录中...' : '登录' }}</el-button>
+          </el-form>
+
+        </section>
+      </div>
+    </div>
+    <div >
+      <footer class="login-footer" style="color:#A9A9A9">
+        ©大港油田信息中心 版权所有
+      </footer>
+    </div>
+  </div>
+</template>
+
+<script>
+  import Vue from 'vue'
+  import Component from 'class-component'
+  @Component({
+    data() {
+      // form model
+      // TODO: remove default values
+      const model = {
+        username: '',
+        password: ''
+      }
+
+      // form validate rules
+      const rules = {
+        username: [{
+          required: true,
+          message: '请输入用户名'
+        }],
+        password: [{
+          required: true,
+          message: '请输入密码'
+        }]
+      }
+
+      return {
+        loginMode: 1,
+        model: model,
+        rules: rules,
+        error: null,
+        loading: false
+      }
+    }
+  })
+  export default class Login extends Vue {
+    layout() {
+      return 'empty'
+    }
+    login() {
+      this.logging = true
+      this.$refs.user.validate(async (valid) => {
+        try {
+          if (valid) {
+            await this.$store.dispatch('auth/login', {
+              fields: {
+                username: this.model.username.replace(/(^\s*)|(\s*$)/g, ""),
+                password: this.model.password.replace(/(^\s*)|(\s*$)/g, "")
+              }
+            })
+            if (process.env.appclient == 'lims') {
+              this.$router.push(this.$route.query.page || '/')
+            } else if (process.env.appclient == 'cellbank') {
+              this.$router.push(this.$route.query.page || '/indexdqm')
+            } else {
+              this.$router.push(this.$route.query.page || '/')
+            }
+          }
+        } catch (e) {
+          // this.$message.warning(e.message)
+          this.$message.warning('账号或密码错误')
+        } finally {
+          this.logging = false
+        }
+      })
+    }
+    logout() {
+      this.$store.dispatch('logout')
+    }
+  }
+
+</script>
+
+<style lang="scss">
+  @import '../assets/styles/base/variables';
+
+  .back-width {
+    background-color: #2F79F6;
+    position: fixed;
+    margin: auto;
+    left: 0;
+    right: 0;
+    top: 88px;
+    width: 100%;
+    height: 550px;
+  }
+
+  .login-body {
+
+    background: url("../assets/img/tian.png") no-repeat left 50%;
+    font-family: 'Open Sans', sans-serif;
+    background-color: #2469E8;
+    background-size: cover;
+
+    /*background-size: cover;
+    -webkit-background-size: cover;
+    -moz-background-size: cover;
+    -o-background-size: cover;*/
+    /*min-height: 1050px;*/
+
+    position: absolute;
+
+    margin: auto;
+    left: -400px;
+    right: 0;
+    bottom: 0;
+    width: 899px;
+    height: 550px;
+    /*
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;*/
+  }
+
+  .login-footer {
+    font-size: 10px;
+    clear: both;
+    display: block;
+    text-align: center;
+    margin: 0px auto;
+    position: absolute;
+    bottom: 10px;
+    width: 100%;
+
+    a {
+      color: $brand-color;
+    }
+  }
+
+  .login {
+    /*flex: 1;
+    width: 100%;*/
+    position: relative;
+    max-width: 22rem;
+    top: 60px;
+    left: 850px;
+    font-size: 0.875rem;
+    opacity: 0.9;
+
+    &-header {
+      margin-bottom: 1rem;
+
+      .brand {
+        margin: 4.5rem 0 3.5rem;
+        text-align: center;
+        letter-spacing: 0.125rem;
+
+        a {
+          margin: 0;
+          color: $brand-color;
+          font: 300 3rem sans-serif;
+
+          &:hover {
+            color: $brand-hover-color;
+            text-shadow: 0 0 1rem $brand-hover-color;
+          }
+        }
+      }
+    }
+
+    &-form {
+      margin-bottom: 2.5rem;
+      padding: 1.875rem 1.25rem;
+      background: $login-form-background;
+      color: $login-form-color;
+
+      .heading {
+        margin: 0 0 1rem;
+        font-weight: 400;
+        font-size: 1.5rem;
+      }
+
+      .el-button {
+        margin-top: 0.5rem;
+        width: 100%;
+      }
+    }
+
+
+  }
+
+  .nuxt-progress {
+    display: none;
+  }
+
+</style>