info.vue 10 KB

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