index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. <template>
  2. <view>
  3. <u-time-line>
  4. <u-time-line-item nodeTop="2" class="u-p-b-20" v-for="item,index in list" :key="index">
  5. <template v-slot:node>
  6. <view class="u-node" :style="{ background: getTimeLineTagColor(item.type) }"></view>
  7. </template>
  8. <template v-slot:content>
  9. <view class="u-font-24 content">
  10. <view class="start" v-if="item.type == '0'">
  11. <view class="u-m-b-20 u-p-l-8 log-title u-flex">
  12. <text>创建</text>
  13. <text>{{item.creatorTime ? $u.timeFormat(item.creatorTime, 'yyyy-mm-dd hh:MM:ss'):''}}</text>
  14. </view>
  15. <view class="u-flex avatar-box" style="background-color: #F5F5F5;">
  16. <u-avatar :src="baseURL + item.headIcon" size="mini" mode="circle"
  17. class="avatar"></u-avatar>
  18. <text class="u-m-l-8">{{item.creatorUserName}}</text>
  19. </view>
  20. </view>
  21. <view class="avatar-block" v-else>
  22. <view class="u-m-b-20 u-p-l-8 u-flex log-title">
  23. <text>编辑</text>
  24. <text>{{item.creatorTime ? $u.timeFormat(item.creatorTime, 'yyyy-mm-dd hh:MM:ss'):''}}</text>
  25. </view>
  26. <view class="u-flex avatar-box ">
  27. <view class="u-flex">
  28. <u-avatar :src="baseURL + item.headIcon" size="mini" mode="circle"
  29. class="avatar"></u-avatar>
  30. <text class="u-m-l-8">{{item.creatorUserName}}</text>
  31. </view>
  32. <view>
  33. <text class="u-m-l-8">{{`有`}}</text>
  34. <text class="u-m-l-8" style="color: red;">{{item.dataLog.length}}</text>
  35. <text class="u-m-l-8">处更改</text>
  36. </view>
  37. </view>
  38. <view class="dataLog-child">
  39. <view class="dataLog-item" v-for="child,i in item.dataLog" :key="i">
  40. <!-- 子表 -->
  41. <view class="child-line" v-if="child.jnpfKey === 'table'">
  42. <view class="field-child">
  43. <text class="table-name">{{child.fieldName}}:</text>
  44. <view class="u-flex table-detail">
  45. <text>已修改</text>
  46. <view class="u-m-l-20 approver-list-r u-flex" @click="openChild(child)">
  47. <view class="txt">详情</view>
  48. <text class="icon-ym icon-ym-right"></text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 主表 -->
  54. <view class="ordinary-field" v-else>
  55. <view class="u-m-b-10 left">{{child.fieldName}}:</view>
  56. <view class="right">
  57. <view class="val" v-if="child.nameModified">
  58. <text style="color: #efbd47;">已修改</text>
  59. </view>
  60. <view class="val" v-else>
  61. <template v-if="child.jnpfKey === 'sign'">
  62. <view v-if="child.oldData !== child.newData">
  63. <text v-if="child.oldData" class="u-m-r-8 txt line-through"
  64. @click="previewImage(child.oldData,child.jnpfKey)">
  65. 旧签名
  66. </text>
  67. <text v-if="child.newData">
  68. <text>修改为</text>
  69. <text class="u-m-l-8 txt"
  70. @click="previewImage(child.newData,child.jnpfKey)">
  71. 新签名
  72. </text>
  73. </text>
  74. </view>
  75. <text v-if="child.oldData === child.newData"
  76. @click="previewImage(child.oldData,child.jnpfKey)">签名</text>
  77. </template>
  78. <template v-else-if="child.jnpfKey === 'signature'">
  79. <view v-if="child.oldData !== child.newData">
  80. <text v-if="child.oldData" class="u-m-r-8 txt line-through"
  81. @click="previewImage(child.oldData)">
  82. 旧签章
  83. </text>
  84. <text v-if="child.newData">
  85. <text>修改为</text>
  86. <text class="u-m-l-8 txt"
  87. @click="previewImage(child.newData)">
  88. 新签章
  89. </text>
  90. </text>
  91. </view>
  92. <text v-if="child.oldData === child.newData"
  93. @click="previewImage(child.oldData)">签章</text>
  94. </template>
  95. <template v-else>
  96. <text v-if="child.oldData !== child.newData">
  97. <text class="line-through">{{child.oldData}}</text>
  98. <text class="u-m-l-16 u-m-r-16"
  99. v-if="!child.oldData || child.newData ">修改为</text>
  100. <text>{{child.newData}}</text>
  101. </text>
  102. <text v-if="child.oldData === child.newData">未修改</text>
  103. </template>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </template>
  112. </u-time-line-item>
  113. </u-time-line>
  114. </view>
  115. <uni-popup ref="flowStepPopup" background-color="#fff" border-radius="8rpx 8rpx 0 0" :is-mask-click="false">
  116. <view class="timeLine-popup-content u-flex-col">
  117. <view class="u-flex head-title notice-warp">
  118. <text class="text">修改详情</text>
  119. <text class="text icon-ym icon-ym-fail" @click="popupClose"></text>
  120. </view>
  121. <view class="table-content">
  122. <view class="table-content-inner" v-for="(item,index) in chidData">
  123. <view class="table-content-title">
  124. {{item.jnpf_type == '0' ? '新增' : item.jnpf_type == '2' ? '删除' : '编辑'}}
  125. </view>
  126. <view class="table-field u-flex-col">
  127. <view class="u-flex table-field-item" v-for="(field,i) in item.chidField" :key="i"
  128. :style="{backgroundColor:item.jnpf_type == '0'?'#defee9':item.jnpf_type == '2'?'#ffd2d2':''}">
  129. <view class="label">{{field.label}}</view>
  130. <!-- 显示已修改,未修改 -->
  131. <view class="val" v-if="field.nameModified">
  132. <text v-if="field.oldData !== field.newData" style="color: #efbd47;"
  133. :class="item.jnpf_type == '2' ? 'line-through' : ''">已修改</text>
  134. <text v-if="field.oldData === field.newData"
  135. :class="item.jnpf_type == '2' ? 'line-through' : ''">{{item.jnpf_type == 0 ? '' : '未修改'}}</text>
  136. </view>
  137. <view class="val" v-else>
  138. <!-- 签名,电子签章 -->
  139. <template v-if="field.jnpfKey === 'sign'">
  140. <view v-if="field.oldData !== field.newData" class="val">
  141. <text v-if="field.oldData" class="u-m-r-8 txt"
  142. :class="item.jnpf_type == '2' || item.jnpf_type == '1' ? 'line-through' : ''"
  143. @click="previewImage(field.oldData,field.jnpfKey)">
  144. 旧签名
  145. </text>
  146. <template class="" v-if="item.jnpf_type != 2">
  147. <text v-if="field.newData && field.oldData">修改为</text>
  148. <text class="u-m-l-8 txt"
  149. @click="previewImage(field.newData,field.jnpfKey)">
  150. 新签名
  151. </text>
  152. </template>
  153. </view>
  154. <text @click="previewImage(field.oldData,field.jnpfKey)" class="txt"
  155. v-if="field.oldData === field.newData">{{item.jnpf_type == 0 ||(!field.oldData && !field.newData)? '' : '签名'}}</text>
  156. </template>
  157. <template v-else-if="field.jnpfKey === 'signature'">
  158. <view v-if="field.oldData !== field.newData" class="val">
  159. <text v-if="field.oldData" class="u-m-r-8 txt txt-left"
  160. :class="item.jnpf_type == '2' || item.jnpf_type == '1' ? 'line-through' : ''"
  161. @click="previewImage(field.oldData)">
  162. 旧签章
  163. </text>
  164. <template class="" v-if="item.jnpf_type != 2">
  165. <text v-if="field.newData && field.oldData">修改为</text>
  166. <text class="u-m-l-8 txt text-right" @click="previewImage(field.newData)">
  167. 新签章
  168. </text>
  169. </template>
  170. </view>
  171. <text @click="previewImage(field.oldData)" class="txt"
  172. v-if="field.oldData === field.newData">{{item.jnpf_type == 0 ||(!field.oldData && !field.newData) ? '' : '签章'}}</text>
  173. </template>
  174. <!-- 签名,电子签章end -->
  175. <template v-else>
  176. <view class="u-flex modify-box" v-if="field.oldData !== field.newData ">
  177. <view class="modify modify-left"
  178. :style="{'text-align':item.jnpf_type == '2'? 'end' : 'center'}"
  179. :class=" item.jnpf_type == '2' || item.jnpf_type == '1' ? 'line-through' : ''"
  180. v-if="field.oldData">
  181. {{field.oldData}}
  182. </view>
  183. <view v-if="field.newData && field.oldData" class="modify-center">修改为
  184. </view>
  185. <view class="modify modify-right"
  186. :style="{'text-align': item.jnpf_type == '0'? 'end' : 'center'}"
  187. :class="item.jnpf_type == '2' ? 'line-through' : ''" v-if="field.newData">
  188. {{field.newData}}
  189. </view>
  190. </view>
  191. <view v-if="field.oldData === field.newData" class="modify-else"
  192. :class="item.jnpf_type == '2' ? 'line-through' : ''">
  193. {{field.oldData}}
  194. </view>
  195. </template>
  196. </view>
  197. </view>
  198. </view>
  199. </view>
  200. </view>
  201. </view>
  202. </uni-popup>
  203. </template>
  204. <script>
  205. import {
  206. recordList
  207. } from '@/api/workFlow/flowBefore'
  208. import {
  209. useDefineSetting
  210. } from '@/utils/useDefineSetting';
  211. export default {
  212. props: {
  213. dataLogList: {
  214. type: Array,
  215. default: () => []
  216. }
  217. },
  218. data() {
  219. return {
  220. useDefine: useDefineSetting(),
  221. recordList: [],
  222. chidData: [],
  223. chidField: [],
  224. childItem: {}
  225. }
  226. },
  227. computed: {
  228. baseURL() {
  229. return this.define.baseURL
  230. },
  231. list() {
  232. let dataLogList = JSON.parse(JSON.stringify(this.dataLogList))
  233. if (dataLogList.length) {
  234. let dataLogData = dataLogList.map(o => ({
  235. ...o,
  236. dataLog: JSON.parse(o.dataLog)
  237. }))
  238. return dataLogData
  239. }
  240. }
  241. },
  242. methods: {
  243. previewImage(url, jnpfKey) {
  244. // #ifndef MP
  245. let baseURL = jnpfKey == 'sign' ? url : (this.baseURL + url)
  246. uni.previewImage({
  247. urls: [baseURL]
  248. });
  249. // #endif
  250. },
  251. openChild(child) {
  252. this.childItem = child || {}
  253. let chidData = this.childItem.chidData || [];
  254. let chidField = this.childItem.chidField || [];
  255. let data = chidData.map(o => {
  256. let item = {
  257. jnpf_type: o.jnpf_type,
  258. chidField: []
  259. };
  260. chidField.forEach(chid => {
  261. if (o.hasOwnProperty(chid.prop)) {
  262. let val = o[chid.prop]
  263. if (chid.jnpfKey === "calculate" && !chid.prop) return
  264. let newData = {
  265. ...chid,
  266. newData: val,
  267. oldData: o[`jnpf_old_${chid.prop}`] ? o[`jnpf_old_${chid.prop}`] : ''
  268. };
  269. item.chidField.push(newData);
  270. } else {
  271. item.chidField.push({
  272. ...chid,
  273. newData: '',
  274. oldData: ''
  275. });
  276. }
  277. });
  278. return item;
  279. });
  280. this.chidData = data
  281. this.$nextTick(() => {
  282. this.$refs.flowStepPopup.open('bottom')
  283. })
  284. },
  285. getTimeLineTagColor(status) {
  286. return status == 0 ? '#08AF28' : '#0177FF';
  287. },
  288. popupClose() {
  289. this.$refs.flowStepPopup.close()
  290. }
  291. }
  292. }
  293. </script>
  294. <style lang="scss">
  295. .line-through {
  296. text-decoration: line-through;
  297. }
  298. .modify-else {
  299. overflow: hidden;
  300. word-break: break-all;
  301. text-overflow: ellipsis;
  302. }
  303. .timeLine-popup-content {
  304. height: 1200rpx;
  305. overflow-y: scroll;
  306. .head-title {
  307. justify-content: space-between;
  308. color: #333333;
  309. padding: 0 20rpx;
  310. /* #ifdef APP */
  311. // padding: 20rpx 0;
  312. /* #endif */
  313. height: 80rpx;
  314. }
  315. .notice-warp {
  316. top: -2rpx;
  317. height: 80rpx;
  318. // border-bottom: 1rpx solid #ececec;
  319. }
  320. .table-content {
  321. padding: 0 20rpx;
  322. margin-top: 80rpx;
  323. .table-content-inner {
  324. margin-bottom: 40rpx;
  325. .table-content-title {
  326. min-height: 80rpx;
  327. background-color: #f5f5f5;
  328. padding: 16rpx 20rpx;
  329. border-radius: 8rpx 8rpx 0 0;
  330. color: #303133;
  331. }
  332. .table-field {
  333. .table-field-item {
  334. min-height: 80rpx;
  335. padding: 16rpx 20rpx;
  336. justify-content: space-between;
  337. align-items: center;
  338. border-bottom: 1rpx solid #ececec;
  339. color: #606266;
  340. &:last-child {
  341. border-radius: 0rpx 0rpx 8rpx 8rpx;
  342. }
  343. .label {
  344. flex: 0.3;
  345. }
  346. .val {
  347. font-size: 24rpx;
  348. text-align: right;
  349. flex: 0.7;
  350. .txt {
  351. color: #4aa8ff;
  352. }
  353. .modify-box {
  354. justify-content: flex-end;
  355. .modify {
  356. padding: 8rpx;
  357. border-radius: 8rpx;
  358. color: #606266;
  359. }
  360. .modify-center {
  361. width: 100rpx;
  362. text-align: center;
  363. }
  364. .modify-right {
  365. width: 200rpx;
  366. word-wrap: break-word;
  367. background-color: #defee9;
  368. text-align: center;
  369. }
  370. .modify-left {
  371. width: 200rpx;
  372. word-wrap: break-word;
  373. background-color: #ffd2d2;
  374. text-align: center;
  375. }
  376. }
  377. }
  378. }
  379. }
  380. }
  381. }
  382. }
  383. .u-node {
  384. width: 20rpx;
  385. height: 20rpx;
  386. border-radius: 50%;
  387. }
  388. .content {
  389. .start {
  390. .log-title {
  391. justify-content: space-between;
  392. }
  393. // box-shadow: 0 6rpx 12rpx rgba(2, 7, 28, 0.16);
  394. .avatar-box {
  395. padding: 20rpx;
  396. }
  397. }
  398. .avatar-block {
  399. .log-title {
  400. justify-content: space-between;
  401. }
  402. border-radius: 8rpx;
  403. // box-shadow: 0 6rpx 12rpx rgba(2, 7, 28, 0.16);
  404. .avatar-box {
  405. justify-content: space-between;
  406. background-color: #F5F5F5;
  407. border-bottom: 1rpx solid #ececec;
  408. padding: 20rpx;
  409. }
  410. .dataLog-child {
  411. background-color: #F5F5F5;
  412. // padding: 0 20rpx;
  413. .dataLog-item {
  414. padding: 20rpx;
  415. &:last-child {
  416. border-bottom: none;
  417. }
  418. .ordinary-field {
  419. align-items: flex-start;
  420. .left {
  421. flex: 0.2;
  422. }
  423. .right {
  424. flex: 0.8;
  425. .val {
  426. font-size: 24rpx;
  427. flex: 0.8;
  428. .txt {
  429. color: #4aa8ff;
  430. }
  431. }
  432. }
  433. }
  434. .child-line {
  435. .field-child {
  436. justify-content: space-between;
  437. .table-detail {
  438. justify-content: space-between;
  439. }
  440. .approver-list-r {
  441. height: 46rpx;
  442. .txt {
  443. height: 36rpx;
  444. }
  445. }
  446. }
  447. }
  448. }
  449. }
  450. }
  451. }
  452. </style>