info.vue 11 KB

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