ApproveInfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <view>
  3. <view class="head-approve-main" >
  4. <view class="head-approve">
  5. <view class="head-approve-a">
  6. <view class="head-approve-a1">
  7. <u-avatar size="36" :src="formData.headImg" class="img"></u-avatar>
  8. <view class="head-approve-2">
  9. {{formData.applyPersonName}}
  10. </view>
  11. </view>
  12. <view class="head-approve-3">申请了<span class="head-approve-2" style="color:#2196F3;">{{fieldInfo.title}}</span></view>
  13. </view>
  14. <view class="head-approve-b" :style="{
  15. color:recordStatusColor(formData.status),
  16. borderColor:recordStatusColor(formData.status),
  17. }" >
  18. <span >{{formData.statusN}}</span>
  19. </view>
  20. </view>
  21. <view class="head-approve-info">
  22. <view>申请人部门:{{formData.orgName}}</view>
  23. <view>申请时间:{{formData.createTime}}</view>
  24. </view>
  25. </view>
  26. <view class="businessMain" :style="'font-size:'+fieldInfo.fontsize+'rpx'">
  27. <view class="businessTitle" v-if="false">{{fieldInfo.title}}</view>
  28. <view v-for="(item,i) in fieldList" :key="i" class="oawork-item" :class="getClass(item)">
  29. <template v-if="item.type.indexOf('uview')>-1">
  30. <view v-if="item.type.indexOf('divider')>-1">
  31. <u-divider bg-color="#fff" border-color="#6d6d6d">{{item.text}}</u-divider>
  32. </view>
  33. <view v-if="item.type.indexOf('stepBtn')>-1&&item.isEdit" style=" text-align: center;" >
  34. <u-button @click="stepBtn" type="warning" size="medium">{{item.text}}</u-button>
  35. </view>
  36. </template>
  37. <template v-else>
  38. <view class="oawork-item1">
  39. <view class="oawork-item1_a">{{item.serial}}{{item.text}}
  40. </view>
  41. <view class="oawork-item1_b">
  42. <template v-if="item.view">
  43. {{formData[item.key]?formData[item.key]:getViewItem(item)}}
  44. </template>
  45. <template v-else>
  46. <template v-if="item.type.indexOf('text')>-1">
  47. <u-input v-if="item.isEdit" v-model="formData[item.key]" :placeholder="'请输入'+item.text"
  48. :placeholderStyle="placeholderStyle" class="oawork-line"
  49. :customStyle="{textAlign: 'right1'}" />
  50. <span v-else >{{formData[item.key]}}</span>
  51. </template>
  52. <template v-if="item.type.indexOf('textnumber')>-1">
  53. <u-input v-if="item.isEdit" type="number" v-model="formData[item.key]" :placeholder="'请输入'+item.text"
  54. :placeholderStyle="placeholderStyle" class="oawork-line"
  55. :customStyle="{textAlign: 'right1'}" />
  56. <span v-else >{{formData[item.key]}}</span>
  57. </template>
  58. <template v-if="item.type.indexOf('radio')>-1">
  59. <u-radio-group v-model="formData[item.key]">
  60. <u-radio v-for="(item, index) in item.list?item.list:radioListDefault"
  61. :key="index" :name="item.value">
  62. {{item.name}}
  63. </u-radio>
  64. </u-radio-group>
  65. </template>
  66. <template v-if="item.type.indexOf('selecttime')>-1">
  67. <!-- <u-calendar max-date="2060-01-01" v-model="showCalendar" mode="date"
  68. @change="changeCalendar"></u-calendar>
  69. <view @click="showCalendar = true,keyCalendar=item">
  70. {{formData[item.key]?formData[item.key]:getViewItem(item)}}</view> -->
  71. {{formData[item.key]?formData[item.key]:getViewItem(item)}}
  72. </template>
  73. <template v-if="item.type.indexOf('selecttime2')>-1">
  74. <!-- <u-calendar max-date="2060-01-01" v-model="showCalendar" mode="range"
  75. @change="changeCalendar2"></u-calendar>
  76. <view @click="showCalendar = true,keyCalendar=item">
  77. {{formData[item.key]?formData[item.key]:createTime}}至{{formData[item.key2]?formData[item.key2]:createTime}}
  78. </view>
  79. -->
  80. {{formData[item.key]?formData[item.key]:createTime}}至{{formData[item.key2]?formData[item.key2]:createTime}}
  81. </template>
  82. </template>
  83. </view>
  84. <view class="oawork-item1_c" v-if="item.type.indexOf('unit')>-1">
  85. {{item.unit}}
  86. </view>
  87. </view>
  88. <view class="oawork-item2">
  89. <template v-if="item.type.indexOf('textlong')>-1">
  90. <u-input v-if="item.isEdit" v-model="formData[item.key]" :placeholder="'请输入'+item.text"
  91. :placeholderStyle="placeholderStyle" class="oawork-line" type="textarea" />
  92. <u-input v-else v-model="formData[item.key]"
  93. :customStyle="{fontSize: '16',color:'#000'}"
  94. placeholder="" :disabled="true"
  95. :placeholderStyle="placeholderStyle" class="oawork-line" type="textarea" />
  96. </template>
  97. <template v-if="item.type.indexOf('upload')>-1">
  98. <view class="upload">
  99. <u-upload-file-all :isedit="0" ref="uUpload" :max-size="50 * 1024 * 1024"
  100. :file-max-size="50 * 1024 * 1024"
  101. :file-list="fileList"></u-upload-file-all>
  102. </view>
  103. </template>
  104. <template v-if="item.type.indexOf('texteditor')>-1">
  105. <view class="ql-containerMain">
  106. <editor id="editor" class="ql-container"
  107. show-img-size
  108. show-img-toolbar show-img-resize
  109. :read-only="true" @ready="onEditorReady(formData[item.key])">
  110. </editor>
  111. </view>
  112. </template>
  113. </view>
  114. </template>
  115. </view>
  116. </view>
  117. </view>
  118. </template>
  119. <script>
  120. import * as API from '@/apis/pagejs/oa.js'
  121. export default {
  122. name:"ApproveInfo",
  123. props:{
  124. fieldInfo: {},
  125. personInfo: {},
  126. createTime: "",
  127. createTime2: "",
  128. stepNum:"",
  129. fileList:{
  130. type: Array,
  131. default () {
  132. return [];
  133. }
  134. },
  135. formData: {},
  136. placeholderStyle: "font-size: 24rpx",
  137. },
  138. watch: {
  139. fieldInfo: {
  140. immediate: true,
  141. handler(val) {
  142. //("fieldList",val)
  143. if(val){
  144. this.fieldList=val.list
  145. }
  146. }
  147. },
  148. // 监听lists的变化,发出事件
  149. lists(n) {
  150. this.$emit('on-list-change', n, this.index);
  151. }
  152. },
  153. data() {
  154. return {
  155. stepSubmit:false,
  156. radioListDefault: [{
  157. name: '是',
  158. value: '1'
  159. }, {
  160. name: '否',
  161. value: '0'
  162. }, ],
  163. fieldList: [],
  164. };
  165. },
  166. created() {
  167. },
  168. methods:{
  169. submitApi() {
  170. uni.showLoading({
  171. title: "加载中",
  172. mask: true,
  173. })
  174. this.formData.draftStatus = 0
  175. this.formData.applyDate=""
  176. API.application(this.fieldInfo.url, this.formData).then((res) => {
  177. uni.hideLoading();
  178. uni.showModal({
  179. title:"提示",
  180. showCancel:false,
  181. content:"操作成功!",
  182. success() {
  183. }
  184. })
  185. ////(this.formData.maintenanceDescription,res.data.applyContent.maintenanceDescription)
  186. }).catch(error => {
  187. uni.showToast({
  188. title: error,
  189. icon: "none"
  190. })
  191. })
  192. },
  193. stepBtn(){
  194. this.submitApi()
  195. },
  196. // getRole(item){
  197. // if(item.role){
  198. // if(item.role.indexOf("step1")>-1){
  199. // this.stepSubmit=true
  200. // return true
  201. // }
  202. // }else{
  203. // return false
  204. // }
  205. // },
  206. onEditorReady(html) {
  207. // #ifdef MP-BAIDU
  208. this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editor');
  209. // #endif
  210. // #ifdef APP-PLUS || MP-WEIXIN || H5
  211. uni.createSelectorQuery().select('#editor').context((res) => {
  212. this.editorCtx = res.context
  213. if(this.editorCtx){
  214. var _this=this
  215. console.log(html)
  216. this.editorCtx.setContents({
  217. html:html
  218. })
  219. }
  220. }).exec()
  221. // #endif
  222. },
  223. init() {
  224. // this.personInfo = this.carhelp.getPersonInfo()
  225. // this.createTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}');
  226. // this.createTime2 = parseUnixTime(currentTimeStamp());
  227. for (var i in this.fieldList) {
  228. var obj = this.fieldList[i];
  229. this.formData[obj.key] = ""
  230. }
  231. //this.action = process.car.BASE_URL + "uploadPicture"
  232. //this.uploadData.subFolder = "oawork11" + this.oatype;
  233. //接口应该免登陆
  234. var token = this.carhelp.getToken()
  235. this.header = {
  236. 'Authorization': token
  237. }
  238. },
  239. getViewItem(item) {
  240. //(item)
  241. if (item.viewSql) {
  242. var obj = this;
  243. for (var i in item.viewSql) {
  244. var k = item.viewSql[i];
  245. //("viewSql",k,obj)
  246. obj = obj[k]
  247. }
  248. return obj;
  249. }
  250. },
  251. getClass(item) {
  252. if (item) {
  253. var list = item.type.map(it => {
  254. return 'oawork-' + it
  255. })
  256. return list.join(' ')
  257. }
  258. },
  259. }
  260. }
  261. </script>
  262. <style scoped lang="scss">
  263. .oawork-line {
  264. border-bottom: 1px solid #c8c8c8;
  265. }
  266. .oawork-paddingTop {
  267. padding-top: 40rpx;
  268. }
  269. .businessMain {
  270. /deep/.uni-input-input {
  271. font-size: 24rpx;
  272. }
  273. font-size: 32rpx;
  274. background: #fff;
  275. padding-top: 10rpx;
  276. padding-bottom: 50rpx;
  277. margin-bottom: 40rpx;
  278. display: flex;
  279. flex-wrap: wrap;
  280. .oawork-item {
  281. padding: 4rpx 16rpx 4rpx 16rpx;
  282. width: 100%;
  283. .oawork-item1 {
  284. display: flex;
  285. align-items: center;
  286. .oawork-item1_a {
  287. min-width: 160rpx;
  288. //font-weight: bold;
  289. color: #777777;
  290. }
  291. .oawork-item1_b {
  292. //color: #777777;
  293. padding-left: 2px;
  294. color: #000;
  295. width: 100%;
  296. text-align: right;
  297. }
  298. .oawork-item1_c {
  299. padding-left: 16rpx;
  300. }
  301. }
  302. }
  303. .oawork-selecttime,
  304. .oawork-selecttime2 {
  305. margin: 10rpx 0;
  306. display: flex;
  307. .oawork-item1 {
  308. width: 100%;
  309. }
  310. .oawork-item1_b {
  311. display: flex;
  312. align-items: center;
  313. justify-content: flex-end;
  314. height: 100%;
  315. border-bottom: 1px solid #c8c8c8;
  316. }
  317. }
  318. .oawork-itemrow {
  319. .oawork-item1_a {
  320. font-weight: 400 !important;
  321. width: 200%;
  322. }
  323. }
  324. .oawork-textlong {
  325. .oawork-item1_a {
  326. width: 100%;
  327. }
  328. }
  329. .oawork-title {
  330. padding: 20rpx 0px 4rpx 20rpx;
  331. .oawork-item1_a {
  332. width: 100%;
  333. font-size: 32rpx;
  334. }
  335. }
  336. .width200 {
  337. // padding:20rpx 0px 4rpx 20rpx;
  338. .oawork-item1_a {}
  339. }
  340. /deep/.oawork-width49 {
  341. display: flex;
  342. padding: 4rpx 0px 4rpx 20rpx;
  343. width: 49%;
  344. .oawork-item1_a {
  345. font-size: 28rpx;
  346. min-width: 140rpx !important;
  347. }
  348. }
  349. }
  350. .submitBtn {
  351. bottom: 0;
  352. position: fixed;
  353. width: 100%;
  354. padding: 20rpx 40rpx;
  355. background-color: #fff;
  356. border-top: 3px solid #f3f4f4;
  357. z-index: 9999;
  358. display: flex;
  359. .submitBtn30 {
  360. width: 30%;
  361. }
  362. .submitBtn60 {
  363. width: 60%;
  364. }
  365. }
  366. .head-approve-main{
  367. background: #ffffff;
  368. .head-approve-info{
  369. background: #ffffff;
  370. margin-bottom: 8px;
  371. padding: 0px 8px 8px 8px;
  372. }
  373. .head-approve{
  374. padding: 8px 8px;
  375. background: #ffffff;
  376. font-size: 32rpx;
  377. display: flex;
  378. flex-wrap: wrap;
  379. align-items: center;
  380. justify-content: space-between;
  381. .head-approve-a{
  382. display: flex;
  383. align-items: center;
  384. flex-wrap: wrap;
  385. }
  386. .head-approve-a1{
  387. display: flex;
  388. align-items: center;
  389. }
  390. .head-approve-2{
  391. padding: 0 3px
  392. }
  393. .head-approve-b{
  394. padding: 2px 9px;
  395. border: 1px solid;
  396. border-radius: 18px;
  397. font-size: 24rpx;
  398. }
  399. }
  400. }
  401. //@import "../data/editor-icon.css";
  402. .ql-containerMain{
  403. border: 1px solid;
  404. }
  405. </style>