userCenterCommunication.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <div style="width: 100%;background: #fff;min-height: 700px;color: #666;" class="userCenterMyProject">
  3. <div style="height: 60px;line-height: 60px;padding-top: 30px;margin-left: 30px;margin-right: 30px; border-bottom: 1px solid rgba(228, 228, 228, 1);">
  4. {{$t('common.Interactive')}}({{totalCount}})
  5. </div>
  6. <div style="margin-left: 30px;">
  7. <el-table
  8. :data="tableData"
  9. stripe
  10. highlight-current-row
  11. @row-click="toLook"
  12. class="projectName"
  13. style="width: 100%" >
  14. <template slot="empty">
  15. {{$t('common.UserNoData')}}
  16. </template>
  17. <el-table-column prop="senderName" fixed :label="$t('common.userName')" width="120"> </el-table-column>
  18. <el-table-column prop="columnName" :label="$t('common.projectName')" width='120'> </el-table-column>
  19. <el-table-column prop="content" :label="$t('common.MessageContent')" width='320'> </el-table-column>
  20. <el-table-column :prop="createDate" :formatter="dateFormat" :label="$t('common.MessageTime')" width="150"></el-table-column>
  21. <el-table-column fixed="right" prop="address5" :label="$t('common.Option')" width="210">
  22. <template slot-scope="scope">
  23. <el-button
  24. v-if="scope.row.interactiveMessageInfo == undefined"
  25. @click.native.prevent="reply(scope.row)"
  26. @click.stop
  27. type="text"
  28. size="medium">
  29. {{$t('common.Reply')}}
  30. </el-button>
  31. <el-button
  32. @click.native.prevent="look(scope.row)"
  33. @click.stop
  34. type="text"
  35. size="medium">
  36. {{$t('common.look')}}
  37. </el-button>
  38. <el-button
  39. @click.native.prevent="deleteRow(scope.$index, tableData)"
  40. @click.stop
  41. type="text"
  42. size="medium">
  43. {{$t('common.delete')}}
  44. </el-button>
  45. </template>
  46. </el-table-column>
  47. </el-table>
  48. </div>
  49. <div style="width: 100%;text-align: center;">
  50. <el-pagination
  51. style="margin-top: 50px;height: 80px;"
  52. background
  53. layout="prev, pager, next"
  54. :total=totalCount @size-change="handleSizeChange"
  55. @current-change="handleCurrentChange">
  56. </el-pagination>
  57. </div>
  58. <el-dialog
  59. title="留言回复"
  60. :visible.sync="dialogVisible"
  61. width="30%"
  62. v-if="$i18n.locale == 'zh'"
  63. >
  64. <div style="padding: 0 20px;" >
  65. <span>回复内容:</span>
  66. <el-input required="required" type="textarea" style="margin-top: 10px;" placeholder="请输入内容"
  67. v-model="text" maxlength="200" show-word-limit>
  68. </el-input>
  69. <span slot="footer" class="dialog-footer" style="margin-left: 150px;display:block;margin-top: 20px;">
  70. <el-button @click="dialogVisible = false">取 消</el-button>
  71. <el-button type="primary" @click="replyMessage">确 定</el-button>
  72. </span>
  73. </div>
  74. </el-dialog>
  75. <el-dialog
  76. title="Message Reply"
  77. :visible.sync="dialogVisible"
  78. width="30%"
  79. v-if="$i18n.locale == 'en'"
  80. >
  81. <div style="padding: 0 20px;" >
  82. <span>Message Content:</span>
  83. <el-input required="required" type="textarea" style="margin-top: 10px;" placeholder="Please input the content"
  84. v-model="text">
  85. </el-input>
  86. <span slot="footer" class="dialog-footer" style="margin-left: 150px;display:block;margin-top: 20px;">
  87. <el-button @click="dialogVisible = false">Close</el-button>
  88. <el-button type="primary" @click="replyMessage">Save</el-button>
  89. </span>
  90. </div>
  91. </el-dialog>
  92. <el-dialog
  93. title="互动交流"
  94. v-if="$i18n.locale == 'zh'"
  95. :visible.sync="dialogVisibles"
  96. width="30%"
  97. >
  98. <div style="padding: 0 20px;">
  99. <div>
  100. <span style="display: inline-block;width: 50px;height: 50px;border-radius: 50px;overflow: hidden; background: #666;">{{$t('common.userAvatar')}}</span>
  101. <span style="line-height: 50px;display: inline-block;vertical-align: top;margin-left: 20px;">{{row.senderName}}</span>
  102. <span style="float: right;">{{dateFormat(row)}}</span>
  103. </div>
  104. <div style="line-height:30px;font-size:13px;color:#333;margin-top:20px;margin-left: 60px;">
  105. {{row.content?row.content:""}}
  106. </div>
  107. <div style="margin-top: 20px;">{{$t('common.replyMessage')}}</div>
  108. <div style="margin-left: 60px;line-height: 30px;">
  109. {{row.interactiveMessageInfo?row.interactiveMessageInfo.content:""}}
  110. </div>
  111. </div>
  112. </el-dialog>
  113. <el-dialog
  114. title="Communication"
  115. v-if="$i18n.locale == 'en'"
  116. :visible.sync="dialogVisibles"
  117. width="30%"
  118. >
  119. <div style="padding: 0 20px;">
  120. <div>
  121. <span style="display: inline-block;width: 50px;height: 50px;border-radius: 50px;overflow: hidden; background: #666;">{{$t('common.userAvatar')}}</span>
  122. <span style="line-height: 50px;display: inline-block;vertical-align: top;margin-left: 20px;">{{row.senderName}}</span>
  123. <span style="float: right;">{{dateFormat(row)}}</span>
  124. </div>
  125. <div style="line-height:30px;font-size:13px;color:#333;margin-top:20px;margin-left: 60px;">
  126. {{row.content?row.content:""}}
  127. </div>
  128. <div style="margin-top: 20px;">{{$t('common.replyMessage')}}</div>
  129. <div style="margin-left: 60px;line-height: 30px;">
  130. {{row.interactiveMessageInfo?row.interactiveMessageInfo.content:""}}
  131. </div>
  132. </div>
  133. </el-dialog>
  134. </div>
  135. </template>
  136. <script>
  137. import {saveInteractiveMessage, getInteractiveMessageInfosList,userContentgetInteractiveMessageInfosList,getAllUmsUser,getAllProject,gateDelInteractiveMessage} from '@/api/operation/interactiveMessage';
  138. import Base from "@/views/base/Base";
  139. import {getDicts} from '@/api/dict';
  140. import {getToken,resetToken} from "@/utils/auth";
  141. import moment from 'moment'
  142. import Bus from "@/api/bus";
  143. export default {
  144. name: 'userCenterCommunication',
  145. extends: Base,
  146. data () {
  147. return {
  148. senderId:"",
  149. totalCount: "",
  150. text:"",
  151. row:{},
  152. totalCount:0,
  153. dialogVisible:false,
  154. dialogVisibles:false,
  155. params: {
  156. pageNo: 0,
  157. pageSize: 10,
  158. bizObjectType: "0",
  159. approveStatusDict: "2"
  160. },
  161. interactiveMessageInfo: {
  162. },
  163. formInline: {
  164. user: '',
  165. region: ''
  166. },
  167. tableData: []
  168. }
  169. },
  170. mounted() {
  171. this.initData();
  172. },
  173. methods:{
  174. toLook (row) {
  175. this.toView('projectPresentationDetails',row.columnCode)
  176. },
  177. toView(router, json) {
  178. window.localStorage.setItem('router', '');
  179. this.$store.commit('modify', router);
  180. Bus.$emit("router", router); //存 Bus.$emit
  181. const { href } =this.$router.resolve({
  182. name: router,
  183. query: {
  184. key: json,
  185. }
  186. });
  187. window.open(href, '_blank');
  188. },
  189. dateFormat(row) {
  190. return moment(row.replyDate).format('YYYY-MM-DD');
  191. },
  192. reply(row) {
  193. this.row=row;
  194. this.dialogVisible=true;
  195. },
  196. look(row) {
  197. this.row=row;
  198. this.dialogVisibles=true;
  199. },
  200. //回复信息
  201. replyMessage() {
  202. this.interactiveMessageInfo.content = this.text;
  203. this.interactiveMessageInfo.replyStatusDict = "N";
  204. this.interactiveMessageInfo.replyStatus = "否";
  205. this.interactiveMessageInfo.bizObjectId = this.row.id;
  206. this.interactiveMessageInfo.bizObjectType = "1";
  207. this.interactiveMessageInfo.approveStatusDict = "0";
  208. this.interactiveMessageInfo.columnCode = this.row.columnCode;
  209. let token = getToken();
  210. this.submitHandler(token => {
  211. saveInteractiveMessage(JSON.stringify(this.interactiveMessageInfo),token).then(res=>{
  212. this.dialogVisible = false;
  213. this.text = "";
  214. this.resetToken();
  215. this.initData()
  216. })
  217. })
  218. },
  219. deleteRow(index, rows) {
  220. //删除
  221. this.$confirm(this.$t('common.Thisoperationwillpermanently'), this.$t('common.Tips'), {
  222. confirmButtonText: this.$t('common.OK'),
  223. cancelButtonText: this.$t('common.cancel'),
  224. type: 'warning'
  225. }).then(() => {
  226. gateDelInteractiveMessage(rows[index].id).then(res=>{
  227. this.$message({
  228. message: res.msg,
  229. type: 'success'
  230. });
  231. this.initData();
  232. }).catch((error) => {
  233. this.$message.error(res.msg);
  234. })
  235. }).catch(() => {
  236. this.$message({
  237. type: 'info',
  238. message: this.$i18n.locale === 'zh' ? '已取消删除' : 'Deletion canceled',
  239. });
  240. });
  241. },
  242. initData(){
  243. let user = window.localStorage.getItem('user');
  244. var users = JSON.parse(user);
  245. if (users == null) {
  246. alert("请先登录")
  247. return
  248. }
  249. this.senderId = users.userId;
  250. this.params.senderId = users.userId
  251. userContentgetInteractiveMessageInfosList(this.params).then(res=>{
  252. this.tableData = res.data.interactiveMessageInfos
  253. this.totalCount=res.data.page.totalCount-0;
  254. })
  255. },
  256. // 发布
  257. release(index, rows) {
  258. console.log(index, rows)
  259. },
  260. // 编辑
  261. change(index, rows) {
  262. console.log(index, rows)
  263. },
  264. // 撤回
  265. withdraw(index,rows) {
  266. console.log(index, rows)
  267. },
  268. handleSizeChange(val) {
  269. console.log(`每页 ${val} 条`);
  270. },
  271. handleCurrentChange(val) {
  272. this.params.pageNo=val;
  273. this.initData()
  274. }
  275. }
  276. }
  277. </script>
  278. <style scoped>
  279. .el-input {
  280. width: 200px ;
  281. }
  282. .el-form-item__content,.el-select {
  283. width: 200px !important;
  284. }
  285. .el-table thead {
  286. background: #eee;
  287. }
  288. .userCenterMyProject >>> .el-pagination .el-pager li,
  289. .userCenterMyProject >>> .el-pagination .btn-next,
  290. .userCenterMyProject >>> .el-pagination .btn-prev{
  291. width: 35px;
  292. height: 35px;
  293. line-height: 35px;
  294. }
  295. .userCenterMyProject >>> .el-pagination.is-background .el-pager li:not(.disabled).active {
  296. background: #0050d8;
  297. }
  298. .projectName >>> .el-table__row td:nth-of-type(2){
  299. color: #0a0000af !important;
  300. }
  301. .projectName >>> .el-table__row td:nth-of-type(2) .cell{
  302. cursor: pointer;
  303. }
  304. .projectName >>> .el-table__row td:nth-of-type(2) .cell:hover{
  305. color: rgb(47, 0, 255) !important;
  306. }
  307. </style>