view.vue 8.1 KB

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