123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815 |
- <template>
- <view>
- <u-navbar :titleLong="fieldInfo.title">
- </u-navbar>
- <view class="businessMain" :style="'font-size:'+fieldInfo.fontsize+'rpx'">
- <view class="businessTitle" v-if="false">{{fieldInfo.title}}</view>
- <view v-for="(item,i) in fieldList" :key="i"
-
- class="oawork-item" :class="getClass(item)">
- <template v-if="item.type.indexOf('uview')>-1">
- <view v-if="item.type.indexOf('divider')>-1">
- <u-divider bg-color="#fff" border-color="#6d6d6d">{{item.text}}</u-divider>
- </view>
- </template>
- <template v-else>
- <view class="oawork-item1">
- <view class="oawork-item1_a">{{item.serial}}{{item.text}}<span v-if="item.isrequset" style="color:red">*</span>
- </view>
- <view class="oawork-item1_b" v-if="item.role==null||item.role.indexOf('0')>-1||item.role.indexOf('0')>-1">
- <template v-if="item.view">
- {{formData[item.key]?formData[item.key]:getViewItem(item)}}
- </template>
- <template v-else>
- <template v-if="item.type.indexOf('text')>-1">
- <u-input v-model="formData[item.key]" :placeholder="'请输入'+item.text"
- :placeholderStyle="placeholderStyle" class="oawork-line"
- :customStyle="{textAlign: 'right1'}" />
- </template>
- <template v-if="item.type.indexOf('textnumber')>-1">
- <u-input v-model="formData[item.key]" type="number" :placeholder="'请输入'+item.text"
- :placeholderStyle="placeholderStyle" class="oawork-line"
- :customStyle="{textAlign: 'right1'}" />
- </template>
- <template v-if="item.type.indexOf('radio')>-1">
- <u-radio-group v-model="formData[item.key]">
- <u-radio v-for="(item, index) in item.list?item.list:radioListDefault"
- :key="index" :name="item.value">
- {{item.name}}
- </u-radio>
- </u-radio-group>
- </template>
- <template v-if="item.type.indexOf('selecttime')>-1">
- <u-calendar max-date="2060-01-01" v-model="showCalendar" mode="date"
- @change="changeCalendar"></u-calendar>
- <view @click="showCalendar = true,keyCalendar=item">
- {{formData[item.key]?formData[item.key]:getViewItem(item)}}</view>
- </template>
- <template v-if="item.type.indexOf('selecttime2')>-1">
- <u-calendar max-date="2060-01-01" v-model="showCalendar" mode="range"
- @change="changeCalendar2"></u-calendar>
- <view @click="showCalendar = true,keyCalendar=item">
- {{formData[item.key]?formData[item.key]:createTime}}至{{formData[item.key2]?formData[item.key2]:createTime}}
- </view>
- </template>
- </template>
- </view>
- <view class="oawork-item1_c" v-if="item.type.indexOf('unit')>-1">
- {{item.unit}}
- </view>
- </view>
- <view class="oawork-item2" v-if="item.role==null||item.role.indexOf('0')>-1||item.role.indexOf('0')>-1" >
- <template v-if="item.type.indexOf('textlong')>-1">
- <u-input v-model="formData[item.key]" :placeholder="'请输入'+item.text"
- :placeholderStyle="placeholderStyle" class="oawork-line" type="textarea" />
- </template>
- <template v-if="item.type.indexOf('upload')>-1">
- <view class="upload">
- <u-upload-file-all ref="uUpload" :action="action" :max-size="50 * 1024 * 1024"
- :file-max-size="50 * 1024 * 1024" :maxCount="9" :form-data="uploadData"
- :header="header" :file-list="fileList"></u-upload-file-all>
- </view>
- </template>
- <template v-if="item.type.indexOf('texteditor')>-1">
- <view class="container">
- <view class="page-body">
- <view class='wrapper'>
- <view class='toolbar' @tap="format" style="overflow-y: auto;">
- <view :class="formats.bold ? 'ql-active' : ''"
- class="iconfont icon-zitijiacu" data-name="bold"></view>
- <view :class="formats.italic ? 'ql-active' : ''"
- class="iconfont icon-zitixieti" data-name="italic"></view>
- <view :class="formats.underline ? 'ql-active' : ''"
- class="iconfont icon-zitixiahuaxian" data-name="underline"></view>
- <view :class="formats.strike ? 'ql-active' : ''"
- class="iconfont icon-zitishanchuxian" data-name="strike"></view>
- <view :class="formats.align === 'center' ? 'ql-active' : ''"
- class="iconfont icon-juzhongduiqi" data-name="align"
- data-value="center"></view>
- <view :class="formats.align === 'right' ? 'ql-active' : ''"
- class="iconfont icon-youduiqi" data-name="align" data-value="right">
- </view>
- <view :class="formats.align === 'justify' ? 'ql-active' : ''"
- class="iconfont icon-zuoyouduiqi" data-name="align"
- data-value="justify"></view>
- <view class="iconfont icon-clearedformat" @tap="removeFormat"></view>
- <view :class="formats.color === '#0000ff' ? 'ql-active' : ''"
- class="iconfont icon-text_color" data-name="color" data-value="#0000ff">
- </view>
- <view :class="formats.backgroundColor === '#00ff00' ? 'ql-active' : ''"
- class="iconfont icon-fontbgcolor" data-name="backgroundColor"
- data-value="#00ff00"></view>
- <view class="iconfont icon-date" @tap="insertDate"></view>
- <view class="iconfont icon--checklist" data-name="list" data-value="check">
- </view>
- <view :class="formats.list === 'ordered' ? 'ql-active' : ''"
- class="iconfont icon-youxupailie" data-name="list" data-value="ordered">
- </view>
- <view :class="formats.list === 'bullet' ? 'ql-active' : ''"
- class="iconfont icon-wuxupailie" data-name="list" data-value="bullet">
- </view>
- <view class="iconfont icon-undo" @tap="undo"></view>
- <view class="iconfont icon-redo" @tap="redo"></view>
- <view class="iconfont icon-outdent" data-name="indent" data-value="-1">
- </view>
- <view class="iconfont icon-indent" data-name="indent" data-value="+1">
- </view>
- <view class="iconfont icon-fengexian" @tap="insertDivider"></view>
- <view class="iconfont icon-charutupian" @tap="insertImage"></view>
- <view :class="formats.header === 1 ? 'ql-active' : ''"
- class="iconfont icon-format-header-1" data-name="header"
- :data-value="1"></view>
- <view :class="formats.script === 'sub' ? 'ql-active' : ''"
- class="iconfont icon-zitixiabiao" data-name="script" data-value="sub">
- </view>
- <view :class="formats.script === 'super' ? 'ql-active' : ''"
- class="iconfont icon-zitishangbiao" data-name="script"
- data-value="super"></view>
- <view class="iconfont icon-shanchu" @tap="clear"></view>
- <view :class="formats.direction === 'rtl' ? 'ql-active' : ''"
- class="iconfont icon-direction-rtl" data-name="direction"
- data-value="rtl"></view>
- </view>
- <view class="editor-wrapper">
- <editor id="editor" class="ql-container"
-
- placeholder="开始输入..." show-img-size
- show-img-toolbar show-img-resize @statuschange="onStatusChange"
- :read-only="readOnly" @ready="onEditorReady">
- </editor>
- </view>
- </view>
- </view>
- </view>
- </template>
- </view>
- </template>
- </view>
- <view class="submitBtn" v-if="isReady">
- <u-button type="info" class="submitBtn30" @click="submit(0)">保存</u-button>
- <u-button type="primary" class="submitBtn60" @click="submit(1)">提交</u-button>
- </view>
- </view>
- <approve-view :activityList="activityList" :initStart="false"></approve-view>
-
- </view>
- </template>
- <script>
- import {
- dataJsGetInfo
- } from '../data.js'
- import * as API from '@/apis/pagejs/oa.js'
- import approveView from '@/components/ApproveView.vue'
- import {
- currentTimeStamp,
- parseUnixTime,
- } from '@/apis/utils'
- export default {
- components: {
- approveView
- },
- data() {
- return {
- //editor
- readOnly: false,
- formats: {},
- editorCtx:"",
- //editor
- oatype: "",
- showCalendar: false,
- keyCalendar: {},
- placeholderStyle: "font-size: 24rpx",
- radioListDefault: [{
- name: '是',
- value: '1'
- }, {
- name: '否',
- value: '0'
- }, ],
- fieldInfo: {},
- fieldList: [],
- activityList: [
- ],
- action: "",
- formData: {},
- personInfo: {},
- createTime: "",
- createTime2: "",
- uploadData: {},
- fileList: [],
- header: {
- },
- id: "",
- placeholder: '开始输入...',
- isReady:true,
- themeWordKey:"",
- }
- },
- onLoad(op) {
- this.oatype = op.oatype
- if (op.id) {
- this.id = op.id
- }
- this.fieldInfo = dataJsGetInfo(op.oatype)
-
- this.fieldList = this.fieldInfo.list;
- this.getProcessDetails();
- },
- methods: {
- inspect(){
- // if (!this.form.verifyCode) {
- // uni.showToast({
- // title: "请输入验证码",
- // icon: "none"
- // })
- // return
- // }
-
- for(var i in this.fieldList){
- var item=this.fieldList[i]
- if(item.isrequset){
- //(item)
- var key=this.formData[item.key]
- if(!key){
- uni.showToast({
- title: "请输入"+item.text,
- icon: "none"
- })
- return false
- }
-
- }
- }
- return true
- },
-
- submit(draftStatus) {
- if(this.editorCtx){
- var _this=this
- this.formData[this.themeWordKey]=this.editorCtx.getContents({
- success(obj){
- _this.formData[_this.themeWordKey]=obj.html
- console.log(obj.html)
- _this.submitApi(draftStatus);
- }
- })
- }else{
- this.submitApi(draftStatus);
- }
- },
- submitApi(draftStatus) {
- if(draftStatus){
- var c=this.inspect()
- if(!c){
- return
- }
- }
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- this.formData.draftStatus = draftStatus
- this.formData.formId = this.oatype
-
-
-
-
- if(this.$refs.uUpload){
- var list=this.$refs.uUpload[0].lists.filter(val => {
- return val.progress == 100;
- })
- if(list.length){
- var str =list.map(item=>{
- //(item)
- return JSON.stringify( {
- name:item.file?item.file.name:item.name,
- url:item.response?item.response.data.fileUrl:item.url
- })
- })
- this.formData.annexFile=JSON.stringify(str)
-
- }
- }
-
-
- API.application(this.fieldInfo.url, this.formData).then((res) => {
- uni.hideLoading();
- const eventChannel = this.getOpenerEventChannel();
- eventChannel.emit('refreshData');
- uni.showModal({
- title:"提示",
- showCancel:false,
- content:"操作成功!",
-
- success() {
- uni.navigateBack()
- }
- })
- ////(this.formData.maintenanceDescription,res.data.applyContent.maintenanceDescription)
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getProcessDetails() {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- API.processDetails({
- formId: this.oatype,
- id: this.id
- }).then((res) => {
- uni.hideLoading();
- this.activityList = res.data.activityList
- var applyContent = res.data.applyContent
- this.init()
- if(applyContent){
- this.formData.id=applyContent.id
- for (var i in this.fieldList) {
- var obj = this.fieldList[i];
- //(this.formData[obj.key], applyContent[obj.key])
- var data=applyContent[obj.key];
- if(data==null){
- continue
- }
- if (obj.type.indexOf("upload") > -1) {
- if(data){
-
- var sz=JSON.parse(data).map(str=>{
- var item=JSON.parse(str)
- return {
- url:item.url,name:item.name,view:1
- }
- })
-
- this.fileList=sz//data.split(",").map(item=>{return {url:item,item.name=,view:1}})
- }
-
- }
- this.formData[obj.key] = applyContent[obj.key]
-
- }
-
- if(this.editorCtx){
- var _this=this
- //console.log(_this.formData.themeWord)
- this.editorCtx.setContents({
- html:_this.formData[_this.themeWordKey]
- })
- }
-
- }
-
- //console.log("formData",this.formData)
- ////(this.formData.maintenanceDescription,res.data.applyContent.maintenanceDescription)
- }).catch(error => {
- this.isReady=false;
- if(!error){
- error="未配置审批流程,请联系管理员"
- }
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- saveStorage() {
- },
- gotoSelectPerson(item) {
- this.saveStorage();
- uni.navigateTo({
- url: "/pages/oawork/business/select"
- })
- },
- changeCalendar(e) {
- this.formData[this.keyCalendar.key] = e.result;
- },
- changeCalendar2(e) {
- this.formData[this.keyCalendar.key] = e.startDate;
- this.formData[this.keyCalendar.key2] = e.endDate;
- },
- init() {
- this.personInfo = this.carhelp.getPersonInfo()
- this.createTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}');
- this.createTime2 = parseUnixTime(currentTimeStamp());
- for (var i in this.fieldList) {
- var obj = this.fieldList[i];
- this.formData[obj.key] = ""
- if(obj.type.indexOf('texteditor')>-1){
- this.themeWordKey=obj.key
- console.log("this.themeWordKey",this.themeWordKey)
- }
- }
- this.action = process.car.BASE_URL + "uploadPicture"
- this.uploadData.subFolder = "oawork11" + this.oatype;
- //接口应该免登陆
- var token = this.carhelp.getToken()
- this.header = {
- 'Authorization': token
- }
- },
- getViewItem(item) {
- //(item)
- if (item.sql) {
- var obj = this;
- for (var i in item.sql) {
- var k = item.sql[i];
- obj = obj[k]
- this.formData[item.key]=obj
- }
- return obj;
- }
- },
- getClass(item) {
- if (item) {
- var list = item.type.map(it => {
- return 'oawork-' + it
- })
- return list.join(' ')
- }
- },
- //editor
- readOnlyChange() {
- this.readOnly = !this.readOnly
- },
- onEditorReady() {
- // #ifdef MP-BAIDU
- this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editor');
- // #endif
- // #ifdef APP-PLUS || MP-WEIXIN || H5
- uni.createSelectorQuery().select('#editor').context((res) => {
- this.editorCtx = res.context
-
- if(this.editorCtx){
- var _this=this
- //console.log(_this.formData.themeWord)
- this.editorCtx.setContents({
- html:_this.formData[_this.themeWordKey]
- })
- }
-
- }).exec()
- // #endif
- },
- undo() {
- this.editorCtx.undo()
- },
- redo() {
- this.editorCtx.redo()
- },
- format(e) {
- let {
- name,
- value
- } = e.target.dataset
- if (!name) return
- // //('format', name, value)
- this.editorCtx.format(name, value)
- },
- onStatusChange(e) {
- const formats = e.detail
- this.formats = formats
- },
- insertDivider() {
- this.editorCtx.insertDivider({
- success: function() {
- //('insert divider success')
- }
- })
- },
- clear() {
- uni.showModal({
- title: '清空编辑器',
- content: '确定清空编辑器全部内容?',
- success: res => {
- if (res.confirm) {
- this.editorCtx.clear({
- success: function(res) {
- //("clear success")
- }
- })
- }
- }
- })
- },
- removeFormat() {
- this.editorCtx.removeFormat()
- },
- insertDate() {
- const date = new Date()
- const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
- this.editorCtx.insertText({
- text: formatDate
- })
- },
- insertImage() {
- uni.chooseImage({
- count: 1,
- success: (res) => {
- this.editorCtx.insertImage({
- src: res.tempFilePaths[0],
- alt: '图像',
- success: function() {
- //('insert image success')
- }
- })
- }
- })
- },
- //editor
- }
- }
- </script>
- <style scoped lang="scss">
- .oawork-line {
- border-bottom: 1px solid #c8c8c8;
- }
- .oawork-paddingTop {
- padding-top: 40rpx;
- }
- .approveMain_text {
- font-weight: bold;
- color: rgba(51, 51, 51, 1);
- font-size: 32rpx;
- padding-bottom: 20rpx;
- padding-left: 32rpx;
- border-bottom: 1px solid #C8C8C8;
- margin-bottom: 16rpx;
- // padding-top: 32rpx;
- }
- .businessMain {
- /deep/.uni-input-input {
- font-size: 24rpx;
- }
- font-size: 32rpx;
- background: #fff;
- padding-top: 10rpx;
- padding-bottom: 50rpx;
- margin-bottom: 40rpx;
- display: flex;
- flex-wrap: wrap;
- .oawork-item {
- padding: 4rpx 16rpx 4rpx 16rpx;
- width: 100%;
- .oawork-item1 {
- display: flex;
- align-items: center;
- .oawork-item1_a {
- min-width: 160rpx;
- font-weight: bold;
- }
- .oawork-item1_b {
- color: #777777;
- width: 100%;
- text-align: right;
- }
- .oawork-item1_c {
- padding-left: 16rpx;
- }
- }
- }
- .oawork-selecttime,
- .oawork-selecttime2 {
- margin: 10rpx 0;
- display: flex;
- .oawork-item1 {
- width: 100%;
- }
- .oawork-item1_b {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- height: 100%;
- border-bottom: 1px solid #c8c8c8;
- }
- }
- .oawork-itemrow {
- .oawork-item1_a {
- font-weight: 400 !important;
- width: 200%;
- }
- }
- // .oawork-itemline {
- // .oawork-item1_a {
-
- // width: 100%;
- // }
- // }
- .oawork-texteditor{
- margin-top: 10px;
- }
- .oawork-textlong,.oawork-itemline {
- .oawork-item1_a {
- width: 100%;
- }
- }
- .oawork-title {
- padding: 20rpx 0px 4rpx 20rpx;
- .oawork-item1_a {
- width: 100%;
- font-size: 32rpx;
- }
- }
- .width200 {
- // padding:20rpx 0px 4rpx 20rpx;
- .oawork-item1_a {}
- }
- /deep/.oawork-width49 {
- padding: 4rpx 0px 4rpx 10rpx;
- width: 49%;
-
- .oawork-item1_a {
- font-size: 28rpx;
- min-width: 140rpx !important;
- }
- }
- }
- .approveMain {
- background: #fff;
- padding-bottom: 180rpx;
- padding-top: 20rpx;
- .approveItem_main {
- display: flex;
- justify-content: space-between;
- margin-bottom: 30rpx;
- margin-right: 32rpx;
- .approveItem_a1 {
- .approveItem_a1_text1 {
- color: rgba(16, 16, 16, 1);
- font-size: 32rpx;
- }
- .approveItem_a1_text2 {
- margin-bottom: 16rpx;
- color: rgba(119, 119, 119, 1);
- font-size: 24rpx;
- }
- .approveItem_a1_text3 {
- color: rgba(51, 51, 51, 1);
- font-size: 24rpx;
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- .approveItem_a1_text3Img {
- margin-right: 40rpx;
- margin-top: 10rpx;
- /deep/.u-badge {
- position: relative !important;
- top: -40rpx !important;
- right: 10rpx !important;
- }
- }
- }
- }
- .approveItem_a2 {
- .a2_span {
- border-radius: 4px;
- text-align: center;
- border: 1px solid rgba(227, 227, 227, 1);
- width: 72rpx;
- height: 72rpx;
- line-height: 60rpx;
- font-size: 48rpx;
- color: #9F9F9F;
- }
- .a2_span_2 {
- position: relative;
- top: -84rpx;
- left: 60rpx;
- color: red;
- }
- }
- }
- }
- .u-node {
- width: 18rpx;
- height: 18rpx;
- border-radius: 100rpx !important;
- display: flex;
- justify-content: center;
- align-items: center;
- background: #d0d0d0;
- }
- .submitBtn {
- bottom: 0;
- position: fixed;
- width: 100%;
- padding: 20rpx 40rpx;
- background-color: #fff;
- border-top: 3px solid #f3f4f4;
- z-index: 99;
- display: flex;
- .submitBtn30 {
- width: 30%;
- }
- .submitBtn60 {
- width: 60%;
- }
- }
- @import "../data/editor-icon.css";
- </style>
|