view.vue 8.0 KB

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