ldt-wx-mp-config.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <div class="public-微信公众号配置-set gray-box top-redius border-bottom-gray">
  3. <div class="title">
  4. {{ $t("sysManagement.ldtWeChatOfficialAccountConfiguration") }}
  5. </div>
  6. <el-form
  7. ref="dataForm"
  8. label-width="240px"
  9. size="mini"
  10. class="set-form"
  11. label-position="left"
  12. @keyup.enter.native="dataFormSubmit()"
  13. :rules="dataRule"
  14. :model="dataForm"
  15. >
  16. <el-form-item
  17. :label="`${$t('sysManagement.weChatOfficialAccount')}appId:`"
  18. style="width: 640px"
  19. prop="appId"
  20. >
  21. <el-input
  22. v-model="dataForm.appId"
  23. :placeholder="`${$t('sysManagement.weChatOfficialAccount')}appId`"
  24. controls-position="right"
  25. ></el-input>
  26. </el-form-item>
  27. <el-form-item
  28. :label="`${$t('sysManagement.ldtWeChatOfficialAccount')}clientId:`"
  29. style="width: 640px"
  30. prop="clientId"
  31. >
  32. <el-input
  33. v-model="dataForm.clientId"
  34. :placeholder="`${$t('sysManagement.ldtWeChatOfficialAccount')}clientId`"
  35. controls-position="right"
  36. ></el-input>
  37. </el-form-item>
  38. <el-form-item
  39. :label="`${$t('sysManagement.ldtWeChatOfficialAccount')}clientSecret:`"
  40. style="width: 640px"
  41. prop="clientSecret"
  42. >
  43. <el-input
  44. v-model="dataForm.clientSecret"
  45. :placeholder="`${$t('sysManagement.ldtWeChatOfficialAccount')}clientSecret`"
  46. controls-position="right"
  47. ></el-input>
  48. </el-form-item>
  49. <!--<el-form-item
  50. :label="`${$t('sysManagement.weChatOfficialAccount')}${$t(
  51. 'sysManagement.messageEncoding'
  52. )} token:`"
  53. style="width: 640px"
  54. prop="token"
  55. >
  56. <el-input
  57. v-model="dataForm.token"
  58. type="textarea"
  59. :placeholder="`${$t('sysManagement.weChatOfficialAccount')}${$t(
  60. 'sysManagement.messageEncoding'
  61. )} token`"
  62. controls-position="right"
  63. ></el-input>
  64. </el-form-item>
  65. <el-form-item
  66. :label="`${$t('sysManagement.weChatOfficialAccount')}${$t(
  67. 'sysManagement.messageEncoding'
  68. )} aesKey:`"
  69. style="width: 640px"
  70. prop="aesKey"
  71. >
  72. <el-input
  73. v-model="dataForm.aesKey"
  74. type="textarea"
  75. :placeholder="`${$t('sysManagement.weChatOfficialAccount')}${$t(
  76. 'sysManagement.messgaeEncoding'
  77. )} aesKey`"
  78. controls-position="right"
  79. ></el-input>
  80. </el-form-item>-->
  81. <div class="default-btn" @click="dataFormSubmit()">{{$t('sysManagement.save')}}</div>
  82. </el-form>
  83. <span slot="footer" class="dialog-footer">
  84. <!-- <el-button @click="visible = false">取消</el-button> -->
  85. </span>
  86. </div>
  87. </template>
  88. <script>
  89. export default {
  90. data () {
  91. return {
  92. dataForm: {
  93. // id: null,
  94. // paramKey: 'MP_CONFIG',
  95. appId: null,
  96. clientId: null,
  97. clientSecret: null,
  98. token: null,
  99. aesKey: null
  100. // paramValue: null
  101. },
  102. dataRule: {
  103. appId: [
  104. { required: true, message: `${this.$i18n.t('sysManagement.weChatOfficialAccount')} appId ${this.$i18n.t('sysManagement.nullTips')}`, trigger: 'blur' }
  105. ],
  106. clientId: [
  107. { required: true, message: `${this.$i18n.t('sysManagement.ldtWeChatOfficialAccount')} clientId ${this.$i18n.t('sysManagement.nullTips')}`, trigger: 'blur' }
  108. ],
  109. clientSecret: [
  110. { required: true, message: `${this.$i18n.t('sysManagement.ldtWeChatOfficialAccount')} clientSecret ${this.$i18n.t('sysManagement.nullTips')}`, trigger: 'blur' }
  111. ]
  112. }
  113. }
  114. },
  115. mounted () {
  116. this.init()
  117. },
  118. methods: {
  119. init () {
  120. // this.$refs['dataForm'].resetFields()
  121. this.$nextTick(() => {
  122. this.$http({
  123. url: this.$http.adornUrl('/sys/pconfig/info/' + 'LDT_MP_CONFIG'),
  124. method: 'get',
  125. params: this.$http.adornParams({
  126. id: this.dataForm.id,
  127. key: this.dataForm.paramKey
  128. })
  129. }).then(({ data }) => {
  130. if (data) {
  131. this.dataForm = data
  132. }
  133. })
  134. this.$refs['dataForm'].resetFields()
  135. })
  136. },
  137. // 表单提交
  138. dataFormSubmit () {
  139. let obj = {}
  140. obj.appId = this.dataForm.appId
  141. obj.secret = this.dataForm.secret
  142. obj.token = this.dataForm.token
  143. obj.aesKey = this.dataForm.aesKey
  144. this.$refs['dataForm'].validate((valid) => {
  145. if (valid) {
  146. this.$http({
  147. url: this.$http.adornUrl('/sys/pconfig/save'),
  148. method: 'post',
  149. data: this.$http.adornData({
  150. 'paramKey': 'LDT_MP_CONFIG',
  151. 'paramValue': JSON.stringify(this.dataForm),
  152. 'remark': this.$i18n.t('sysManagement.ldtWeChatOfficialAccountConfiguration')
  153. })
  154. }).then(({ data }) => {
  155. if (data) {
  156. this.init()
  157. }
  158. this.$message({
  159. message: this.$i18n.t('publics.operation'),
  160. type: 'success',
  161. duration: 1500,
  162. onClose: () => {
  163. this.visible = false
  164. this.$emit('refreshDataList')
  165. }
  166. })
  167. })
  168. }
  169. })
  170. }
  171. }
  172. }
  173. </script>