ApproveInfo.vue 14 KB

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