info.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. <template>
  2. <view>
  3. <u-navbar title="详情查看">
  4. <view slot="right"
  5. style="margin-right: 20px; ">
  6. <u-button type="error" v-if="processRevokeShow"
  7. @click="processRevokeBtn()" size="mini">撤回</u-button>
  8. </view>
  9. </u-navbar>
  10. <approve-info v-if="viewApproveBl"
  11. :fieldInfo="fieldInfo" :formData="formData" :fileList="fileList" ></approve-info>
  12. <view class="submitBtn" v-if="0">
  13. <u-button type="info" class="submitBtn30">保存</u-button>
  14. <u-button type="primary" class="submitBtn60" >提交</u-button>
  15. </view>
  16. <approve-view :activityList="activityList"></approve-view>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. dataJsGetInfo
  22. } from '../data.js'
  23. import * as API from '@/apis/pagejs/oa.js'
  24. import approveView from '@/components/ApproveView.vue'
  25. import approveInfo from '@/components/ApproveInfo.vue'
  26. import {
  27. currentTimeStamp,
  28. parseUnixTime,
  29. } from '@/apis/utils'
  30. export default {
  31. components: {
  32. approveView,approveInfo
  33. },
  34. data() {
  35. return {
  36. //editor
  37. readOnly: false,
  38. formats: {},
  39. //editor
  40. oatype: "",
  41. showCalendar: false,
  42. keyCalendar: {},
  43. placeholderStyle: "font-size: 24rpx",
  44. radioListDefault: [{
  45. name: '是',
  46. value: '1'
  47. }, {
  48. name: '否',
  49. value: '0'
  50. }, ],
  51. fieldInfo: {},
  52. fieldList: [],
  53. formData: {},
  54. activityList: [
  55. ],
  56. action: "",
  57. personInfo: {},
  58. createTime: "",
  59. createTime2: "",
  60. uploadData: {},
  61. fileList: [],
  62. header: {
  63. },
  64. viewApproveBl:false,
  65. id: "",
  66. placeholder: '开始输入...',
  67. processRevokeShow:false,
  68. }
  69. },
  70. onLoad(op) {
  71. this.oatype = op.oatype
  72. if (op.id) {
  73. this.id = op.id
  74. }
  75. this.fieldInfo = dataJsGetInfo(op.oatype)
  76. this.fieldList = this.fieldInfo.list;
  77. this.getProcessDetails();
  78. },
  79. methods: {
  80. processRevokeApi(){
  81. uni.showLoading({
  82. title: "加载中",
  83. mask: true,
  84. })
  85. API.processRevoke({
  86. procinstId: this.id
  87. }).then((res) => {
  88. this.viewApproveBl=false
  89. this.formData={}
  90. this.getProcessDetails(true);
  91. uni.showModal({
  92. title:"提示",
  93. showCancel:false,
  94. content:"操作成功!",
  95. success() {
  96. }
  97. })
  98. const eventChannel = this.getOpenerEventChannel();
  99. eventChannel.emit('refreshData');
  100. }).catch(error => {
  101. uni.showToast({
  102. title: error,
  103. icon: "none"
  104. })
  105. })
  106. },
  107. processRevokeBtn(){
  108. uni.showModal({
  109. title: '提示',
  110. content: '确认是否撤回本表单?',
  111. success: res=> {
  112. if (res.confirm) {
  113. this.processRevokeApi();
  114. } else if (res.cancel) {
  115. console.log('用户点击取消');
  116. }
  117. }
  118. });
  119. },
  120. submit(draftStatus) {
  121. },
  122. getProcessDetails(bl) {
  123. uni.showLoading({
  124. title: "加载中",
  125. mask: true,
  126. })
  127. API.processDetails({
  128. formId: this.oatype,
  129. id: this.id
  130. }).then((res) => {
  131. uni.hideLoading();
  132. this.activityList = res.data.activityList
  133. var applyContent = res.data.applyContent
  134. this.init()
  135. if(applyContent){
  136. var personInfo=this.carhelp.getPersonInfo()
  137. if(applyContent.applyPersonId==personInfo.id&&applyContent.status=="0"){
  138. this.processRevokeShow=true
  139. }else{
  140. this.processRevokeShow=false
  141. }
  142. this.formData={
  143. ...applyContent,
  144. ...this.formData
  145. }
  146. for (var i in this.fieldList) {
  147. var obj = this.fieldList[i];
  148. //(this.formData[obj.key], applyContent[obj.key])
  149. var data=applyContent[obj.key];
  150. if(data==null){
  151. continue
  152. }
  153. if (obj.type.indexOf("upload") > -1) {
  154. if(data){
  155. var sz=JSON.parse(data).map(str=>{
  156. var item=JSON.parse(str)
  157. return {
  158. url:item.url,name:item.name,view:1
  159. }
  160. })
  161. this.fileList=sz//data.split(",").map(item=>{return {url:item,item.name=,view:1}})
  162. }
  163. }
  164. this.formData[obj.key] = applyContent[obj.key]
  165. }
  166. }
  167. this.viewApproveBl=true
  168. if(bl){
  169. this.$forceUpdate();
  170. }
  171. console.log("formData",this.formData)
  172. }).catch(error => {
  173. uni.showToast({
  174. title: error,
  175. icon: "none"
  176. })
  177. })
  178. },
  179. saveStorage() {
  180. },
  181. gotoSelectPerson(item) {
  182. this.saveStorage();
  183. uni.navigateTo({
  184. url: "/pages/oawork/business/select"
  185. })
  186. },
  187. changeCalendar(e) {
  188. this.formData[this.keyCalendar.key] = e.result;
  189. },
  190. changeCalendar2(e) {
  191. this.formData[this.keyCalendar.key] = e.startDate;
  192. this.formData[this.keyCalendar.key2] = e.endDate;
  193. },
  194. init() {
  195. this.personInfo = this.carhelp.getPersonInfo()
  196. this.createTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}');
  197. this.createTime2 = parseUnixTime(currentTimeStamp());
  198. for (var i in this.fieldList) {
  199. var obj = this.fieldList[i];
  200. this.formData[obj.key] = ""
  201. }
  202. this.action = process.car.BASE_URL + "uploadPicture"
  203. this.uploadData.subFolder = "oawork11" + this.oatype;
  204. //接口应该免登陆
  205. var token = this.carhelp.getToken()
  206. this.header = {
  207. 'Authorization': token
  208. }
  209. },
  210. getViewItem(item) {
  211. //(item)
  212. if (item.sql) {
  213. var obj = this;
  214. for (var i in item.sql) {
  215. var k = item.sql[i];
  216. obj = obj[k]
  217. }
  218. return obj;
  219. }
  220. },
  221. getClass(item) {
  222. if (item) {
  223. var list = item.type.map(it => {
  224. return 'oawork-' + it
  225. })
  226. return list.join(' ')
  227. }
  228. },
  229. //editor
  230. readOnlyChange() {
  231. this.readOnly = !this.readOnly
  232. },
  233. onEditorReady() {
  234. // #ifdef MP-BAIDU
  235. this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editor');
  236. // #endif
  237. // #ifdef APP-PLUS || MP-WEIXIN || H5
  238. uni.createSelectorQuery().select('#editor').context((res) => {
  239. this.editorCtx = res.context
  240. }).exec()
  241. // #endif
  242. },
  243. undo() {
  244. this.editorCtx.undo()
  245. },
  246. redo() {
  247. this.editorCtx.redo()
  248. },
  249. format(e) {
  250. let {
  251. name,
  252. value
  253. } = e.target.dataset
  254. if (!name) return
  255. // //('format', name, value)
  256. this.editorCtx.format(name, value)
  257. },
  258. onStatusChange(e) {
  259. const formats = e.detail
  260. this.formats = formats
  261. },
  262. insertDivider() {
  263. this.editorCtx.insertDivider({
  264. success: function() {
  265. //('insert divider success')
  266. }
  267. })
  268. },
  269. clear() {
  270. uni.showModal({
  271. title: '清空编辑器',
  272. content: '确定清空编辑器全部内容?',
  273. success: res => {
  274. if (res.confirm) {
  275. this.editorCtx.clear({
  276. success: function(res) {
  277. //("clear success")
  278. }
  279. })
  280. }
  281. }
  282. })
  283. },
  284. removeFormat() {
  285. this.editorCtx.removeFormat()
  286. },
  287. insertDate() {
  288. const date = new Date()
  289. const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
  290. this.editorCtx.insertText({
  291. text: formatDate
  292. })
  293. },
  294. insertImage() {
  295. uni.chooseImage({
  296. count: 1,
  297. success: (res) => {
  298. this.editorCtx.insertImage({
  299. src: res.tempFilePaths[0],
  300. alt: '图像',
  301. success: function() {
  302. //('insert image success')
  303. }
  304. })
  305. }
  306. })
  307. },
  308. //editor
  309. }
  310. }
  311. </script>
  312. <style scoped lang="scss">
  313. .oawork-line {
  314. border-bottom: 1px solid #c8c8c8;
  315. }
  316. .oawork-paddingTop {
  317. padding-top: 40rpx;
  318. }
  319. .businessMain {
  320. /deep/.uni-input-input {
  321. font-size: 24rpx;
  322. }
  323. font-size: 32rpx;
  324. background: #fff;
  325. padding-top: 10rpx;
  326. padding-bottom: 50rpx;
  327. margin-bottom: 40rpx;
  328. display: flex;
  329. flex-wrap: wrap;
  330. .oawork-item {
  331. padding: 4rpx 16rpx 4rpx 16rpx;
  332. width: 100%;
  333. .oawork-item1 {
  334. display: flex;
  335. align-items: center;
  336. .oawork-item1_a {
  337. min-width: 160rpx;
  338. font-weight: bold;
  339. }
  340. .oawork-item1_b {
  341. color: #777777;
  342. width: 100%;
  343. text-align: right;
  344. }
  345. .oawork-item1_c {
  346. padding-left: 16rpx;
  347. }
  348. }
  349. }
  350. .oawork-selecttime,
  351. .oawork-selecttime2 {
  352. margin: 10rpx 0;
  353. display: flex;
  354. .oawork-item1 {
  355. width: 100%;
  356. }
  357. .oawork-item1_b {
  358. display: flex;
  359. align-items: center;
  360. justify-content: flex-end;
  361. height: 100%;
  362. border-bottom: 1px solid #c8c8c8;
  363. }
  364. }
  365. .oawork-itemrow {
  366. .oawork-item1_a {
  367. font-weight: 400 !important;
  368. width: 200%;
  369. }
  370. }
  371. .oawork-textlong {
  372. .oawork-item1_a {
  373. width: 100%;
  374. }
  375. }
  376. .oawork-title {
  377. padding: 20rpx 0px 4rpx 20rpx;
  378. .oawork-item1_a {
  379. width: 100%;
  380. font-size: 32rpx;
  381. }
  382. }
  383. .width200 {
  384. // padding:20rpx 0px 4rpx 20rpx;
  385. .oawork-item1_a {}
  386. }
  387. /deep/.oawork-width49 {
  388. padding: 4rpx 0px 4rpx 20rpx;
  389. width: 49%;
  390. .oawork-item1_a {
  391. min-width: 140rpx !important;
  392. }
  393. }
  394. }
  395. .submitBtn {
  396. bottom: 0;
  397. position: fixed;
  398. width: 100%;
  399. padding: 20rpx 40rpx;
  400. background-color: #fff;
  401. border-top: 3px solid #f3f4f4;
  402. z-index: 9999;
  403. display: flex;
  404. .submitBtn30 {
  405. width: 30%;
  406. }
  407. .submitBtn60 {
  408. width: 60%;
  409. }
  410. }
  411. .head-approve{
  412. padding: 2px 8px;
  413. background: #ffffff;
  414. margin-bottom: 8px;
  415. display: flex;
  416. flex-wrap: wrap;
  417. justify-content: space-between;
  418. font-size: 32px;
  419. }
  420. @import "../data/editor-icon.css";
  421. </style>