ApproveInfo.vue 11 KB

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