info.vue 8.2 KB

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