info.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  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">
  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. }
  81. },
  82. onLoad(op) {
  83. this.oatype = op.oatype
  84. if (op.id) {
  85. this.id = op.id
  86. }
  87. if (op.pid) {
  88. this.pid = op.pid
  89. }
  90. this.fieldInfo = dataJsGetInfo(op.oatype)
  91. this.fieldList = this.fieldInfo.list;
  92. this.getProcessDetails();
  93. },
  94. methods: {
  95. submitApi(sp) {
  96. uni.showLoading({
  97. title: "加载中",
  98. mask: true,
  99. })
  100. API.processNext({
  101. opinion:this.spText,
  102. action:this.sp,
  103. procinstId: this.pid
  104. }).then((res) => {
  105. uni.hideLoading();
  106. const eventChannel = this.getOpenerEventChannel();
  107. eventChannel.emit('refreshData');
  108. this.spPopup=false;
  109. uni.showModal({
  110. title:"提示",
  111. showCancel:false,
  112. content:"操作成功!",
  113. success() {
  114. uni.navigateBack()
  115. }
  116. })
  117. }).catch(error => {
  118. uni.showToast({
  119. title: error,
  120. icon: "none"
  121. })
  122. })
  123. },
  124. submit(sp) {
  125. var _this=this;
  126. this.spPopup=true
  127. this.sp=sp;
  128. this.spText=""
  129. },
  130. getProcessDetails() {
  131. uni.showLoading({
  132. title: "加载中",
  133. mask: true,
  134. })
  135. API.processDetails({
  136. formId: this.oatype,
  137. id: this.id
  138. }).then((res) => {
  139. uni.hideLoading();
  140. this.activityList = res.data.activityList
  141. var applyContent = res.data.applyContent
  142. this.init()
  143. if(applyContent){
  144. this.formData.id=applyContent.id
  145. this.formData={
  146. ...applyContent,
  147. ...this.formData
  148. }
  149. for (var i in this.fieldList) {
  150. var obj = this.fieldList[i];
  151. //(this.formData[obj.key], applyContent[obj.key])
  152. var data=applyContent[obj.key];
  153. if(data==null){
  154. continue
  155. }
  156. if (obj.type.indexOf("upload") > -1) {
  157. if(data){
  158. var sz=JSON.parse(data).map(str=>{
  159. var item=JSON.parse(str)
  160. return {
  161. url:item.url,name:item.name,view:1
  162. }
  163. })
  164. this.fileList=sz//data.split(",").map(item=>{return {url:item,item.name=,view:1}})
  165. }
  166. }
  167. this.formData[obj.key] = applyContent[obj.key]
  168. }
  169. }
  170. this.viewApproveBl=true
  171. //(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: 99;
  403. display: flex;
  404. .submitBtn30 {
  405. width: 30%;
  406. }
  407. .submitBtn60 {
  408. width: 60%;
  409. }
  410. }
  411. .spPopupView{
  412. //margin-top: 20px;
  413. padding: 8px;
  414. .spPopupViewTitle{
  415. padding-bottom: 3px;
  416. color: rgba(16, 16, 16, 1);
  417. font-size: 20px;
  418. text-align: center;
  419. padding: 8px;
  420. }
  421. .spPopupViewBtn{
  422. padding-bottom: 60px
  423. }
  424. }
  425. @import "../data/editor-icon.css";
  426. </style>