add.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <view>
  3. <u-navbar :titleLong="fieldInfo.title" >
  4. </u-navbar>
  5. <view class="businessMain" :style="'font-size:'+fieldInfo.fontsize+'rpx'">
  6. <view class="businessTitle" v-if="false">{{fieldInfo.title}}</view>
  7. <view v-for="(item,i) in fieldList" :key="i" class="oawork-item" :class="getClass(item)">
  8. <template v-if="item.type.indexOf('uview')>-1">
  9. <view v-if="item.type.indexOf('divider')>-1">
  10. <u-divider bg-color="#fff" border-color="#6d6d6d" >{{item.text}}</u-divider>
  11. </view>
  12. </template>
  13. <template v-else>
  14. <view class="oawork-item1">
  15. <view class="oawork-item1_a">{{item.text}}<span v-if="item.isrequset" style="color:red">*</span></view>
  16. <view class="oawork-item1_b" >
  17. <template v-if="item.view">
  18. {{formData[item.key]?formData[item.key]:getViewItem(item)}}
  19. </template>
  20. <template v-else>
  21. <template v-if="item.type.indexOf('text')>-1" >
  22. <u-input v-model="formData[item.key]" :placeholder="'请输入'+item.text" :placeholderStyle="placeholderStyle"
  23. class="oawork-line" :customStyle="{textAlign: 'right'}" />
  24. </template>
  25. <template v-if="item.type.indexOf('textnumber')>-1" >
  26. <u-input v-model="formData[item.key]" type="number" :placeholder="'请输入'+item.text" :placeholderStyle="placeholderStyle"
  27. class="oawork-line" :customStyle="{textAlign: 'right'}" />
  28. </template>
  29. <template v-if="item.type.indexOf('radio')>-1" >
  30. <u-radio-group v-model="formData[item.key]" >
  31. <u-radio
  32. v-for="(item, index) in item.list?item.list:radioListDefault" :key="index"
  33. :name="item.value"
  34. >
  35. {{item.name}}
  36. </u-radio>
  37. </u-radio-group>
  38. </template>
  39. <template v-if="item.type.indexOf('selecttime')>-1" >
  40. <u-calendar max-date="2060-01-01" v-model="showCalendar" mode="date" @change="changeCalendar" ></u-calendar>
  41. <view @click="showCalendar = true,keyCalendar=item">{{formData[item.key]?formData[item.key]:getViewItem(item)}}</view>
  42. </template>
  43. <template v-if="item.type.indexOf('selecttime2')>-1" >
  44. <u-calendar max-date="2060-01-01" v-model="showCalendar" mode="range" @change="changeCalendar2" ></u-calendar>
  45. <view @click="showCalendar = true,keyCalendar=item">{{formData[item.key]?formData[item.key]:createTime}}至{{formData[item.key2]?formData[item.key2]:createTime}}</view>
  46. </template>
  47. </template>
  48. </view>
  49. <view class="oawork-item1_c" v-if="item.type.indexOf('unit')>-1">
  50. {{item.unit}}
  51. </view>
  52. </view>
  53. <view class="oawork-item2">
  54. <template v-if="item.type.indexOf('textlong')>-1" >
  55. <u-input v-model="formData[item.key]" :placeholder="'请输入'+item.text" :placeholderStyle="placeholderStyle"
  56. class="oawork-line" type="textarea" />
  57. </template>
  58. <template v-if="item.type.indexOf('upload')>-1" >
  59. <view class="upload">
  60. <u-upload-file-all ref="uUpload" :action="action"
  61. :max-size="50 * 1024 * 1024"
  62. :file-max-size="50 * 1024 * 1024"
  63. :maxCount="9"
  64. :form-data="uploadData" :header="header"
  65. :file-list="fileList" ></u-upload-file-all>
  66. </view>
  67. </template>
  68. <template v-if="item.type.indexOf('texteditor')>-1" >
  69. <view class="container">
  70. <view class="page-body">
  71. <view class='wrapper'>
  72. <view class='toolbar' @tap="format" style="overflow-y: auto;">
  73. <view :class="formats.bold ? 'ql-active' : ''" class="iconfont icon-zitijiacu" data-name="bold"></view>
  74. <view :class="formats.italic ? 'ql-active' : ''" class="iconfont icon-zitixieti" data-name="italic"></view>
  75. <view :class="formats.underline ? 'ql-active' : ''" class="iconfont icon-zitixiahuaxian" data-name="underline"></view>
  76. <view :class="formats.strike ? 'ql-active' : ''" class="iconfont icon-zitishanchuxian" data-name="strike"></view>
  77. <view :class="formats.align === 'center' ? 'ql-active' : ''" class="iconfont icon-juzhongduiqi" data-name="align" data-value="center"></view>
  78. <view :class="formats.align === 'right' ? 'ql-active' : ''" class="iconfont icon-youduiqi" data-name="align" data-value="right"></view>
  79. <view :class="formats.align === 'justify' ? 'ql-active' : ''" class="iconfont icon-zuoyouduiqi" data-name="align" data-value="justify"></view>
  80. <view class="iconfont icon-clearedformat" @tap="removeFormat"></view>
  81. <view :class="formats.color === '#0000ff' ? 'ql-active' : ''" class="iconfont icon-text_color" data-name="color" data-value="#0000ff"></view>
  82. <view :class="formats.backgroundColor === '#00ff00' ? 'ql-active' : ''" class="iconfont icon-fontbgcolor" data-name="backgroundColor" data-value="#00ff00"></view>
  83. <view class="iconfont icon-date" @tap="insertDate"></view>
  84. <view class="iconfont icon--checklist" data-name="list" data-value="check"></view>
  85. <view :class="formats.list === 'ordered' ? 'ql-active' : ''" class="iconfont icon-youxupailie" data-name="list" data-value="ordered"></view>
  86. <view :class="formats.list === 'bullet' ? 'ql-active' : ''" class="iconfont icon-wuxupailie" data-name="list" data-value="bullet"></view>
  87. <view class="iconfont icon-undo" @tap="undo"></view>
  88. <view class="iconfont icon-redo" @tap="redo"></view>
  89. <view class="iconfont icon-outdent" data-name="indent" data-value="-1"></view>
  90. <view class="iconfont icon-indent" data-name="indent" data-value="+1"></view>
  91. <view class="iconfont icon-fengexian" @tap="insertDivider"></view>
  92. <view class="iconfont icon-charutupian" @tap="insertImage"></view>
  93. <view :class="formats.header === 1 ? 'ql-active' : ''" class="iconfont icon-format-header-1" data-name="header" :data-value="1"></view>
  94. <view :class="formats.script === 'sub' ? 'ql-active' : ''" class="iconfont icon-zitixiabiao" data-name="script" data-value="sub"></view>
  95. <view :class="formats.script === 'super' ? 'ql-active' : ''" class="iconfont icon-zitishangbiao" data-name="script" data-value="super"></view>
  96. <view class="iconfont icon-shanchu" @tap="clear"></view>
  97. <view :class="formats.direction === 'rtl' ? 'ql-active' : ''" class="iconfont icon-direction-rtl" data-name="direction" data-value="rtl"></view>
  98. </view>
  99. <view class="editor-wrapper">
  100. <editor id="editor" class="ql-container" placeholder="开始输入..." show-img-size show-img-toolbar
  101. show-img-resize @statuschange="onStatusChange" :read-only="readOnly" @ready="onEditorReady">
  102. </editor>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </template>
  108. </view>
  109. </template>
  110. </view>
  111. </view>
  112. <view class="approveMain">
  113. <view class="approveMain_text" >流程</view>
  114. <u-time-line>
  115. <u-time-line-item node-top="10" v-for="(item,i) in approveList" :key="i" >
  116. <template v-slot:node>
  117. <view>
  118. <view class="u-node" style="background:#CDCDCD;">
  119. <!-- 此处为uView的icon组件 -->
  120. <!-- <u-icon name="checkmark" color="#fff" :size="24"></u-icon> -->
  121. </view>
  122. </view>
  123. </template>
  124. <template v-slot:content>
  125. <view class="approveItem_main">
  126. <view class="approveItem_a1">
  127. <view class="approveItem_a1_text1">
  128. 一级审批人
  129. </view>
  130. <view class="approveItem_a1_text2">
  131. 请选择审批人
  132. </view>
  133. <view class="approveItem_a1_text3">
  134. <view class="approveItem_a1_text3Img">
  135. <u-avatar size="56" class="img" ></u-avatar>
  136. <u-badge size="mini" count="x" type="info" :absolute="false">
  137. </u-badge>
  138. <view>晓丽</view>
  139. </view><view class="approveItem_a1_text3Img">
  140. <u-avatar size="56" class="img" ></u-avatar>
  141. <u-badge size="mini" count="x" type="info" :absolute="false">
  142. </u-badge>
  143. <view>晓丽</view>
  144. </view><view class="approveItem_a1_text3Img">
  145. <u-avatar size="56" class="img" ></u-avatar>
  146. <u-badge size="mini" count="x" type="info" :absolute="false">
  147. </u-badge>
  148. <view>晓丽</view>
  149. </view><view class="approveItem_a1_text3Img">
  150. <u-avatar size="56" class="img" ></u-avatar>
  151. <u-badge size="mini" count="x" type="info" :absolute="false">
  152. </u-badge>
  153. <view>晓丽</view>
  154. </view><view class="approveItem_a1_text3Img">
  155. <u-avatar size="56" class="img" ></u-avatar>
  156. <u-badge size="mini" count="x" type="info" :absolute="false">
  157. </u-badge>
  158. <view>晓丽</view>
  159. </view><view class="approveItem_a1_text3Img">
  160. <u-avatar size="56" class="img" ></u-avatar>
  161. <u-badge size="mini" count="x" type="info" :absolute="false">
  162. </u-badge>
  163. <view>晓丽</view>
  164. </view>
  165. <view class="approveItem_a1_text3Img">
  166. <u-avatar size="56" class="img" ></u-avatar>
  167. <u-badge size="mini" count="x" type="info" :absolute="false">
  168. </u-badge>
  169. <view>晓丽</view>
  170. </view>
  171. </view>
  172. </view>
  173. <view class="approveItem_a2">
  174. <view class="a2_span" @click="gotoSelectPerson(item)" >+</view>
  175. <span class="a2_span_2">*</span>
  176. </view>
  177. </view>
  178. </template>
  179. </u-time-line-item>
  180. </u-time-line>
  181. </view>
  182. </view>
  183. </template>
  184. <script>
  185. import {
  186. dataJsGetInfo
  187. } from './data.js'
  188. import {
  189. currentTimeStamp,
  190. parseUnixTime,
  191. } from '@/apis/utils'
  192. export default {
  193. data() {
  194. return {
  195. //editor
  196. readOnly: false,
  197. formats: {},
  198. //editor
  199. oatype:"",
  200. showCalendar:false,
  201. keyCalendar:{},
  202. placeholderStyle:"font-size: 24rpx",
  203. radioListDefault:[
  204. {
  205. name: '是',
  206. value: '1'
  207. },{
  208. name: '否',
  209. value: '0'
  210. },
  211. ],
  212. fieldInfo:{},
  213. fieldList:[],
  214. approveList:[
  215. {},{},{},{},{},
  216. ],
  217. action:"",
  218. formData:{},
  219. personInfo:{},
  220. createTime:"",
  221. createTime2:"",
  222. uploadData:{},
  223. fileList:[],
  224. header:{
  225. },
  226. placeholder: '开始输入...'
  227. }
  228. },
  229. onLoad(op){
  230. this.oatype=op.oatype
  231. this.fieldInfo=dataJsGetInfo(op.oatype)
  232. console.log(this.fieldInfo)
  233. this.fieldList=this.fieldInfo.list;
  234. this.init()
  235. },
  236. methods: {
  237. saveStorage(){
  238. },
  239. gotoSelectPerson(item){
  240. this.saveStorage();
  241. uni.navigateTo({
  242. url:"/pages/oawork/business/select"
  243. })
  244. },
  245. changeCalendar(e){
  246. this.formData[this.keyCalendar.key]=e.result;
  247. },
  248. changeCalendar2(e){
  249. this.formData[this.keyCalendar.key]=e.startDate;
  250. this.formData[this.keyCalendar.key2]=e.endDate;
  251. },
  252. init(){
  253. this.personInfo=this.carhelp.getPersonInfo()
  254. this.createTime=parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}');
  255. this.createTime2=parseUnixTime(currentTimeStamp());
  256. for(var i in this.fieldList){
  257. var obj=this.fieldList[i];
  258. this.formData[obj.key]=""
  259. }
  260. this.action=process.car.BASE_URL+"uploadPicture"
  261. this.uploadData.subFolder="oawork11"+this.oatype;
  262. //接口应该免登陆
  263. var token=this.carhelp.getToken()
  264. this.header={
  265. 'Authorization':token
  266. }
  267. },
  268. getViewItem(item){
  269. console.log(item)
  270. if(item.sql){
  271. var obj=this;
  272. for(var i in item.sql){
  273. var k=item.sql[i];
  274. obj=obj[k]
  275. }
  276. return obj;
  277. }
  278. },
  279. getClass(item){
  280. if(item){
  281. var list=item.type.map(it=>{
  282. return 'oawork-'+it
  283. })
  284. return list.join(' ')
  285. }
  286. },
  287. //editor
  288. readOnlyChange() {
  289. this.readOnly = !this.readOnly
  290. },
  291. onEditorReady() {
  292. // #ifdef MP-BAIDU
  293. this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editor');
  294. // #endif
  295. // #ifdef APP-PLUS || MP-WEIXIN || H5
  296. uni.createSelectorQuery().select('#editor').context((res) => {
  297. this.editorCtx = res.context
  298. }).exec()
  299. // #endif
  300. },
  301. undo() {
  302. this.editorCtx.undo()
  303. },
  304. redo() {
  305. this.editorCtx.redo()
  306. },
  307. format(e) {
  308. let {
  309. name,
  310. value
  311. } = e.target.dataset
  312. if (!name) return
  313. // console.log('format', name, value)
  314. this.editorCtx.format(name, value)
  315. },
  316. onStatusChange(e) {
  317. const formats = e.detail
  318. this.formats = formats
  319. },
  320. insertDivider() {
  321. this.editorCtx.insertDivider({
  322. success: function() {
  323. console.log('insert divider success')
  324. }
  325. })
  326. },
  327. clear() {
  328. uni.showModal({
  329. title: '清空编辑器',
  330. content: '确定清空编辑器全部内容?',
  331. success: res => {
  332. if (res.confirm) {
  333. this.editorCtx.clear({
  334. success: function(res) {
  335. console.log("clear success")
  336. }
  337. })
  338. }
  339. }
  340. })
  341. },
  342. removeFormat() {
  343. this.editorCtx.removeFormat()
  344. },
  345. insertDate() {
  346. const date = new Date()
  347. const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
  348. this.editorCtx.insertText({
  349. text: formatDate
  350. })
  351. },
  352. insertImage() {
  353. uni.chooseImage({
  354. count: 1,
  355. success: (res) => {
  356. this.editorCtx.insertImage({
  357. src: res.tempFilePaths[0],
  358. alt: '图像',
  359. success: function() {
  360. console.log('insert image success')
  361. }
  362. })
  363. }
  364. })
  365. },
  366. //editor
  367. }
  368. }
  369. </script>
  370. <style scoped lang="scss">
  371. .oawork-line{
  372. border-bottom: 1px solid #c8c8c8;
  373. }
  374. .oawork-paddingTop{
  375. padding-top: 40rpx;
  376. }
  377. .approveMain_text{
  378. font-weight: bold;
  379. color: rgba(51, 51, 51, 1);
  380. font-size: 32rpx;
  381. padding-bottom: 20rpx;
  382. padding-left: 32rpx;
  383. border-bottom: 1px solid #C8C8C8;
  384. margin-bottom: 16rpx;
  385. // padding-top: 32rpx;
  386. }
  387. .businessMain{
  388. /deep/.uni-input-input{
  389. font-size: 24rpx;
  390. }
  391. font-size: 32rpx;
  392. background: #fff;
  393. padding-top: 10rpx;
  394. padding-bottom: 50rpx;
  395. margin-bottom: 40rpx;
  396. display: flex;
  397. flex-wrap: wrap;
  398. .oawork-item{
  399. padding:4rpx 16rpx 4rpx 16rpx;
  400. width: 100%;
  401. .oawork-item1{
  402. display: flex;
  403. align-items: center;
  404. .oawork-item1_a{
  405. min-width: 160rpx;
  406. font-weight: bold;
  407. }
  408. .oawork-item1_b{
  409. color: #777777;
  410. width: 100%;
  411. text-align: right;
  412. }
  413. .oawork-item1_c{
  414. padding-left: 16rpx;
  415. }
  416. }
  417. }
  418. .oawork-selecttime,.oawork-selecttime2{
  419. margin: 10rpx 0;
  420. display: flex;
  421. .oawork-item1{
  422. width: 100%;
  423. }
  424. .oawork-item1_b{
  425. display: flex;
  426. align-items: center;
  427. justify-content: flex-end;
  428. height: 100%;
  429. border-bottom: 1px solid #c8c8c8;
  430. }
  431. }
  432. .oawork-itemrow{
  433. .oawork-item1_a{
  434. font-weight: 400 !important;
  435. width: 200%;
  436. }
  437. }
  438. .oawork-textlong{
  439. .oawork-item1_a{
  440. width: 100%;
  441. }
  442. }
  443. .oawork-title{
  444. padding:20rpx 0px 4rpx 20rpx;
  445. .oawork-item1_a{
  446. width: 100%;
  447. font-size: 32rpx;
  448. }
  449. }
  450. .width200{
  451. // padding:20rpx 0px 4rpx 20rpx;
  452. .oawork-item1_a{
  453. }
  454. }
  455. /deep/.oawork-width49{
  456. padding:4rpx 0px 4rpx 20rpx;
  457. width: 49%;
  458. .oawork-item1_a{
  459. min-width: 140rpx !important;
  460. }
  461. }
  462. }
  463. .approveMain{
  464. background: #fff;
  465. padding-bottom: 80rpx;
  466. padding-top: 20rpx;
  467. .approveItem_main{
  468. display: flex;
  469. justify-content: space-between;
  470. margin-bottom: 30rpx;
  471. margin-right: 32rpx;
  472. .approveItem_a1{
  473. .approveItem_a1_text1{
  474. color: rgba(16, 16, 16, 1);
  475. font-size: 32rpx;
  476. }
  477. .approveItem_a1_text2{
  478. margin-bottom: 16rpx;
  479. color: rgba(119, 119, 119, 1);
  480. font-size: 24rpx;
  481. }
  482. .approveItem_a1_text3{
  483. color: rgba(51, 51, 51, 1);
  484. font-size: 24rpx;
  485. display: flex;
  486. flex-direction: row;
  487. flex-wrap: wrap;
  488. .approveItem_a1_text3Img{
  489. margin-right: 40rpx;
  490. margin-top: 10rpx;
  491. /deep/.u-badge {
  492. position: relative !important;
  493. top: -40rpx !important;
  494. right: 10rpx !important;
  495. }
  496. }
  497. }
  498. }
  499. .approveItem_a2{
  500. .a2_span{
  501. border-radius: 4px;
  502. text-align: center;
  503. border: 1px solid rgba(227, 227, 227, 1);
  504. width: 72rpx;
  505. height: 72rpx;
  506. line-height: 60rpx;
  507. font-size: 48rpx;
  508. color:#9F9F9F ;
  509. }
  510. .a2_span_2{
  511. position: relative;
  512. top: -84rpx;
  513. left: 60rpx;
  514. color: red;
  515. }
  516. }
  517. }
  518. }
  519. .u-node {
  520. width: 18rpx;
  521. height: 18rpx;
  522. border-radius: 100rpx !important;
  523. display: flex;
  524. justify-content: center;
  525. align-items: center;
  526. background: #d0d0d0;
  527. }
  528. @import "./data/editor-icon.css";
  529. </style>