info.vue 9.9 KB

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