| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport"
- content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
- <link rel="stylesheet" href="./resource/vantIndex.css" />
- <link rel="stylesheet" href="./vue-form-making/index.css">
- </head>
- <body>
- <style>
- :root:root {
- --van-nav-bar-background: rgb(21, 122, 44);
- --van-nav-bar-title-text-color: rgb(255, 255, 255);
- --van-nav-bar-icon-color: rgb(255, 255, 255);
- }
- </style>
- <div id="app">
- <van-nav-bar @click-left="onClickLeft" style="background-color: rgb(21, 122, 44);color: rgb(255, 255, 255);"
- :title="title" left-arrow :safe-area-inset-top='true' :placeholder='true' :fixed='true'></van-nav-bar>
- <fm-generate-vant-form v-if='isFlag' :data="jsonData" :value="form.valueJson" ref="generateForm"
- :edit='isEdit'>
- </fm-generate-vant-form>
- <div>
- <!-- <van-form>
- <van-cell-group inset>
- <van-field type="textarea" v-model="form.reason" label="意见" placeholder="" rows="2" autosize
- show-word-limit />
- </van-cell-group>
- </van-form> -->
- <div
- style="display: flex;justify-content: space-between; padding: 30px 30px; position: fixed; bottom: 0; width: 100%; height: 80px;">
- <van-button style="width:48%" type="primary" @click="handleAudit(1)">提交
- </van-button>
- <van-button style="width:48%" type="danger" @click="onClickLeft">取消
- </van-button>
- </div>
- </div>
- </div>
- <script src="./resource/vue.global.prod.js"></script>
- <script src="./resource/vant.min.js"></script>
- <script src="./resource/axios.min.js"></script>
- <script src="./resource/uni.webview.js"></script>
- <script src="./vue-form-making/form-making-v3.umd.js"></script>
- <script>
- const APIUrl = 'http://192.168.1.251:51001'
- let EnvObj = {}
- uni.getEnv(function(res) {
- EnvObj = res;
- console.log('当前环境:' + JSON.stringify(res));
- });
- Vue.createApp({
- data() {
- return {
- isFlag: false,
- isEdit: true,
- title: '',
- jsonData: {},
- editData: {},
- form: {},
- headers: {},
- }
- },
- created() {
- this.headers = this.getQueryParams('headers');
- let params = this.getQueryParams('params');
- axios({
- method: 'get',
- url: APIUrl + `/flowable/bpmcustomform/getById/${params.id}`,
- headers: this.headers,
- }).then((res) => {
- if (res.data.code != '-1') {
- this.form = res.data.data
- this.title = this.form.name
- this.jsonData = JSON.parse(res.data.data.formJson.makingJson);
- this.jsonData.list.forEach(item => {
- item.options.headers = [{
- key: 'Authorization',
- value: this.headers.Authorization
- }]
- item.options.action = item.options.action && item.options.action.replace(
- '/api', APIUrl)
- if (item.type == "deptAndUserCascader") {
- item.type = 'cascader'
- }
- if (item.type == "deptCascader") {
- item.type = 'cascader'
- }
- if (item.type == "userSelect") {
- item.type = 'select'
- }
- })
- this.jsonData.config.dataSource && this.jsonData.config.dataSource.forEach(item => {
- item.headers = {
- Authorization: this.headers.Authorization
- }
- item.url = item.url && item.url.replace('/api', APIUrl)
- })
- this.isFlag = true
- }
- });
- // axios({
- // method: 'get',
- // url: APIUrl + `/bpm/task/list-by-process-instance-id?processInstanceId=${params.id}`,
- // headers: this.headers,
- // }).then((res) => {
- // console.log(res)
- // if (res.data.code != '-1') {
-
- // }
- // });
-
-
- },
- methods: {
- getQueryParams(queryName) {
- const urlSearchParams = new URLSearchParams(window.location.search);
- const query = urlSearchParams.get(queryName);
- return JSON.parse(query);
- },
- generateFormValid(validate = true) {
- return this.$refs.generateForm.getData(validate).then((data) => {
- return data;
- });
- },
- async handleAudit(status) {
- this.form.valueJson = await this.generateFormValid();
- console.log(this.form.valueJson)
- this.form.processType = '1';
- let API = APIUrl + '/bpm/process-instance/create'
- axios({
- method: 'post',
- url: API,
- headers: this.headers,
- data: {
- ...this.form,
- }
- }).then((res) => {
- if (res.data.code != '-1') {
- vant.showNotify({
- type: 'success',
- message: `提交成功!`,
- duration: 1000,
- });
- setTimeout(() => {
- this.onClickLeft()
- }, 1000)
- }
- });
- },
- onClickLeft() {
- uni.navigateBack({
- delta: 1
- });
- }
- }
- }).use(vant).use(FormMakingV3).mount('#app')
- </script>
- </body>
- </html>
|