ApproveInfo.vue 11 KB

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