synchronization.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <a-spin :spinning="spinning" tip="正在同步中...">
  3. <a-card :bordered="false">
  4. <!-- 查询区域 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="searchQuery">
  7. <a-row :gutter="24">
  8. <a-col :md="6" :sm="12">
  9. <a-form-item label="数据模块">
  10. <j-input placeholder="输入数据模块查询" ></j-input>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="8">
  14. <a-form-item label="同步方式">
  15. <j-input placeholder="输入同步方式查询" ></j-input>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="8">
  19. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  20. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  21. </span>
  22. </a-col>
  23. </a-row>
  24. </a-form>
  25. </div>
  26. <!-- 操作按钮区域 -->
  27. <div class="table-operator" style="border-top: 5px">
  28. <a-button @click="pulldata()" type="primary" icon="plus" >拉取</a-button>
  29. <a-button @click="pulldata()" type="primary" icon="plus" >同步U8</a-button>
  30. <a-button @click="synchronizationWeixin()" type="primary" icon="plus" >同步企业微信</a-button>
  31. <a-dropdown :visible="show">
  32. <a-button @click="synchronizationPt()" type="primary" icon="plus" >同步中间平台</a-button>
  33. <a-menu slot="overlay">
  34. <a-menu-item >
  35. <a-month-picker placeholder="请选择日期" v-model="date"/>
  36. </a-menu-item>
  37. </a-menu>
  38. </a-dropdown>
  39. </div>
  40. <!-- table区域-begin -->
  41. <div>
  42. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  43. <i class="anticon anticon-info-circle ant-alert-icon"></i>已选择&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>&nbsp;&nbsp;
  44. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  45. </div>
  46. <a-table
  47. ref="table"
  48. bordered
  49. size="middle"
  50. rowKey="id"
  51. :columns="columns"
  52. :dataSource="data"
  53. :pagination="ipagination"
  54. :loading="loading"
  55. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type: 'radio'}"
  56. @change="handleTableChange">
  57. <template slot="avatarslot" slot-scope="text, record, index">
  58. <div class="anty-img-wrap">
  59. <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/>
  60. </div>
  61. </template>
  62. <span slot="action" slot-scope="text, record">
  63. <!-- <a-dropdown>
  64. <a class="ant-dropdown-link">
  65. 同步 <a-icon type="down"/>
  66. </a>
  67. <a-menu slot="overlay">
  68. <a-menu-item >
  69. <a href="javascript:;" @click="handleDetail(record)">同步U8</a>
  70. </a-menu-item>
  71. <a-menu-item >
  72. <a href="javascript:;" @click="handleChangePassword(record.username)">同步中间平台</a>
  73. </a-menu-item>
  74. <a-menu-item >
  75. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  76. <a>同步企业微信</a>
  77. </a-popconfirm>
  78. </a-menu-item>
  79. </a-menu>
  80. </a-dropdown> -->
  81. </span>
  82. </a-table>
  83. </div>
  84. <!-- table区域-end -->
  85. <!-- 用户回收站 -->
  86. <user-recycle-bin-modal :visible.sync="recycleBinVisible" />
  87. </a-card>
  88. </a-spin>
  89. </template>
  90. <script>
  91. import UserModal from './modules/UserModal'
  92. import PasswordModal from './modules/PasswordModal'
  93. import {putAction,getFileAccessHttpUrl} from '@/api/manage';
  94. import {frozenBatch} from '@/api/api'
  95. import {pullData,synchronizationWeixin,tbquery,synchronizationPt} from '@/api/api'
  96. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  97. import JInput from '@/components/jeecg/JInput'
  98. import UserRecycleBinModal from './modules/UserRecycleBinModal'
  99. import JSuperQuery from '@/components/jeecg/JSuperQuery'
  100. export default {
  101. name: "UserList",
  102. mixins: [JeecgListMixin],
  103. components: {
  104. UserModal,
  105. PasswordModal,
  106. JInput,
  107. UserRecycleBinModal,
  108. JSuperQuery
  109. },
  110. data() {
  111. return {
  112. show:false,
  113. date:null,
  114. spinning:false,
  115. data:[],
  116. description: '这是数据同步管理页面',
  117. queryParam: {},
  118. recycleBinVisible: false,
  119. selectedRowKeys:[],
  120. columns: [
  121. {
  122. title: '编号',
  123. dataIndex: '',
  124. key:'rowIndex',
  125. width:60,
  126. align:"center",
  127. customRender:function (t,r,index) {
  128. return parseInt(index)+1;
  129. }
  130. },
  131. {
  132. title: '数据模块',
  133. align: "center",
  134. dataIndex: 'name',
  135. width: 120,
  136. sorter: true
  137. },
  138. {
  139. title: '状态',
  140. align: "center",
  141. width: 100,
  142. dataIndex: 'state',
  143. customRender:function (t,r,index) {
  144. if(r.state==""||r.state==null){
  145. return "暂无";
  146. }
  147. if(r.state=="0"){
  148. return "成功";
  149. }
  150. if(r.state=="1"){
  151. return "失败";
  152. }
  153. }
  154. },
  155. {
  156. title: '同步方式',
  157. align: "center",
  158. width: 120,
  159. dataIndex: 'type',
  160. customRender:function (t,r,index) {
  161. if(r.type==""||r.type==null){
  162. return "暂无";
  163. }
  164. if(r.type=="0"){
  165. return "手动同步";
  166. }
  167. if(r.type=="1"){
  168. return "自动同步";
  169. }
  170. }
  171. },
  172. {
  173. title: '同步时间',
  174. align: "center",
  175. width: 120,
  176. dataIndex: 'date',
  177. sorter: true,
  178. customRender:function (t,r,index) {
  179. if(r.date==""||r.date==null){
  180. return "暂无";
  181. }else{
  182. return r.date;
  183. }
  184. }
  185. },
  186. {
  187. title: '用时',
  188. align: "center",
  189. width: 100,
  190. dataIndex: 'time',
  191. customRender:function (t,r,index) {
  192. if(r.time==""||r.time==null){
  193. return "暂无";
  194. }else{
  195. return r.time+"秒";
  196. }
  197. }
  198. },
  199. {
  200. title: '操作',
  201. align: "center",
  202. width: 150,
  203. }
  204. ],
  205. }
  206. },
  207. /* watch:{
  208. date:{
  209. handler(newVal, objVal) {
  210. if(this.date!=null){
  211. this.show=false;
  212. }
  213. },
  214. }
  215. }, */
  216. created() {
  217. this.querylist();
  218. },
  219. methods: {
  220. querylist:function(){
  221. tbquery({}).then(res=>{
  222. this.data=res;
  223. })
  224. },
  225. synchronizationPt:function(){
  226. if(this.selectedRowKeys.length<1){
  227. this.$message.warning('请选择需要同步的数据!');
  228. return false;
  229. }
  230. if(this.selectedRowKeys[0]==1){
  231. this.$message.warning('该数据不能同步到平台!');
  232. return false;
  233. }
  234. this.show=true;
  235. if(this.date==null){
  236. this.$message.warning('请选择需要同步的日期!');
  237. return false;
  238. }
  239. this.spinning=true;
  240. var datetime=this.formats(this.date);
  241. synchronizationPt({date:datetime,id:this.selectedRowKeys[0],type:0,typeGo:2}).then(res=>{
  242. console.log(res);
  243. this.$message.warning('同步成功'+res.count+'条,同步失败'+res.errCount+'条');
  244. this.querylist();
  245. this.spinning=false;
  246. })
  247. },
  248. formats:function(e){
  249. var date = new Date(e);
  250. var seperator1 = "-";
  251. var year = date.getFullYear();
  252. var month = date.getMonth() + 1;
  253. if (month >= 1 && month <= 9) {
  254. month = "0" + month;
  255. }
  256. var currentdate = year + seperator1 + month;
  257. return currentdate;
  258. },
  259. onSelectChange(selectedRowKeys) {
  260. this.selectedRowKeys=selectedRowKeys;
  261. },
  262. synchronizationWeixin:function(){
  263. if(this.selectedRowKeys.length<1){
  264. this.$message.warning('请选择需要同步的数据!');
  265. return false;
  266. }
  267. if(this.selectedRowKeys[0]!=1){
  268. this.$message.warning('该数据不能同步到企业微信!');
  269. return false;
  270. }
  271. this.spinning=true;
  272. synchronizationWeixin({id:this.selectedRowKeys[0],type:0,typeGo:0}).then(res=>{
  273. this.$message.warning(res.msg);
  274. this.querylist();
  275. this.spinning=false;
  276. })
  277. },
  278. pulldata:function(){
  279. this.spinning=true;
  280. pullData({}).then(res=>{
  281. if(res.errCode=="0"){
  282. this.$message.success('拉取数据成功'
  283. +res.userCount+"条,拉取数据失败"+res.userErrCount+"条");
  284. }else{
  285. this.$message.warning("拉取数据失败");
  286. }
  287. this.spinning=false;
  288. })
  289. },
  290. }
  291. }
  292. </script>
  293. <style scoped>
  294. @import '~@assets/less/common.less'
  295. </style>