ソースを参照

优化报销事项表单,添加可调整大小和最大化功能,并重构明细项为报销事项和金额输入

yusheng 9 ヶ月 前
コミット
0fd55fe9ef

+ 65 - 26
src/BIZComponents/processSubmitDialog/processSubmitDialog.vue

@@ -8,6 +8,8 @@
     :close-on-click-modal="false"
     :width="isRight ? '800px' : '450px'"
     :before-close="cancel"
+    :maxable="true"
+    :resizable="true"
   >
     <div style="display: flex; height: 100%; justify-content: space-between">
       <div class="form-box">
@@ -22,37 +24,45 @@
           :value="form.valueJson"
           ref="generateForm"
         >
-          <template v-slot:blank_1n0u9ky8="scope">
+          <template v-slot:blank_adopzrdd="scope">
             <el-button
               type="primary"
               size="small"
-              @click="addNewRow('blank_1n0u9ky8')"
-              >添加明细</el-button
+              @click="addNewRow('blank_adopzrdd')"
+              style="margin-bottom: 10px"
+              >添加报销事项</el-button
             >
 
             <div
-              v-for="(item, index) in scope.model.blank_1n0u9ky8"
+              v-for="(item, index) in scope.model.blank_adopzrdd"
               :key="index"
             >
-              宽度:<el-input
-                v-model="scope.model.blank_1n0u9ky8[index]"
-                style="width: 100px"
-              ></el-input>
+              <div class="blank_adopzrdd">
+                <span>{{ index + 1 }}报销事项:</span>
+                <el-input
+                  v-model="scope.model.blank_adopzrdd[index].remark"
+                  type="textarea"
+                  style="width: calc(100% - 80px)"
+                ></el-input>
+              </div>
+              <div class="blank_adopzrdd">
+                <span @click="delNewRow('blank_adopzrdd', index)"
+                  ><i
+                    class="el-icon-delete"
+                    style="color: #f56c6c; cursor: pointer"
+                  ></i
+                  >金额:</span
+                >
+                <el-input
+                  v-model="scope.model.blank_adopzrdd[index].price"
+                  type="number"
+                  style="width: calc(100% - 80px)"
+                  @change="changePrice(scope.model.blank_adopzrdd)"
+                ></el-input>
+              </div>
             </div>
           </template>
         </fm-generate-form>
-        <!--              <el-tree-->
-        <!--                @check-change="handleTreeChange"-->
-        <!--                show-checkbox-->
-        <!--                node-key="id"-->
-        <!--                class="filter-tree"-->
-        <!--                check-strictly-->
-        <!--                :data="treeData"-->
-        <!--                :props="defaultProps"-->
-        <!--                :filter-node-method="filterNode"-->
-        <!--                ref="tree"-->
-        <!--              >-->
-        <!--              </el-tree>-->
       </div>
       <div
         style="
@@ -277,6 +287,8 @@
   import { mapGetters } from 'vuex';
   import staffSelection from '@/components/staffSelection/staffSelection.vue';
   import dayjs from 'dayjs';
+  import { number } from 'echarts';
+  import { del } from 'vue';
   export default {
     name: 'processSubmitDialog',
     components: { visibilityRangeDialog, staffSelection },
@@ -387,14 +399,32 @@ this.postOptions.push(...response.data);
     methods: {
       async addNewRow(key) {
         console.log(key);
-        let {blank_1n0u9ky8} = await this.$refs.generateForm.getData(false);
-     
-
-        blank_1n0u9ky8.push('');
+        let data = await this.$refs.generateForm.getData(false);
+        data[key].push({
+          price: '',
+          remark: ''
+        });
         this.$refs.generateForm.setData({
-          key: blank_1n0u9ky8
+          key: data[key]
+        });
+      },
+      async delNewRow(key, index) {
+        let data = await this.$refs.generateForm.getData(false);
+        data[key] = data[key].filter((item, index1) => index1 != index);
+        this.$refs.generateForm.setData({
+          [key]: data[key]
+        });
+        this.changePrice(data[key]);
+ 
+      },
+      changePrice(data) {
+        let num = 0;
+        data.forEach((item) => {
+          num += Number(item.price);
+        });
+        this.$refs.generateForm.setData({
+          input_jd9ouzyh: num
         });
-
       },
       async init(row = {}) {
         this.title = row.name; //'新建' + row.name + '单';
@@ -709,4 +739,13 @@ this.postOptions.push(...response.data);
       color: #ffffff;
     }
   }
+  .blank_adopzrdd {
+    display: flex;
+    align-items: center;
+    > span {
+      display: inline-block;
+      width: 80px;
+    }
+    margin-bottom: 10px;
+  }
 </style>

+ 28 - 17
src/views/bpm/collaborative/detail.vue

@@ -32,24 +32,26 @@
         :edit="false"
         ref="generateForm"
       >
-             <template v-slot:blank_1n0u9ky8="scope">
-            <el-button
-              type="primary"
-              size="small"
-              @click="addNewRow('blank_1n0u9ky8')"
-              >添加明细</el-button
-            >
-
-            <div
-              v-for="(item, index) in scope.model.blank_1n0u9ky8"
-              :key="index"
-            >
-              宽度:<el-input
-                v-model="scope.model.blank_1n0u9ky8[index]"
-                style="width: 100px"
+        <template v-slot:blank_adopzrdd="scope">
+          <div v-for="(item, index) in scope.model.blank_adopzrdd" :key="index">
+            <div class="blank_adopzrdd">
+              <span>{{ index + 1 }}报销事项:</span>
+              <el-input
+                v-model="scope.model.blank_adopzrdd[index].remark"
+                type="textarea"
+                style="width: calc(100% - 80px)"
+              ></el-input>
+            </div>
+            <div class="blank_adopzrdd">
+              <span>金额:</span>
+              <el-input
+                v-model="scope.model.blank_adopzrdd[index].price"
+                type="number"
+                style="width: calc(100% - 80px)"
               ></el-input>
             </div>
-          </template>
+          </div>
+        </template>
       </fm-generate-form>
     </div>
 
@@ -75,7 +77,7 @@
     data() {
       return {
         form: {},
-        jsonData:{}
+        jsonData: {}
       };
     },
     methods: {
@@ -123,4 +125,13 @@
     display: flex;
     justify-content: space-between;
   }
+    .blank_adopzrdd {
+    display: flex;
+    align-items: center;
+    > span {
+      display: inline-block;
+      width: 80px;
+    }
+    margin-bottom: 10px;
+  }
 </style>

+ 29 - 0
src/views/bpm/done/detailDialog.vue

@@ -32,6 +32,26 @@
         :edit="false"
         ref="generateForm"
       >
+              <template v-slot:blank_adopzrdd="scope">
+          <div v-for="(item, index) in scope.model.blank_adopzrdd" :key="index">
+            <div class="blank_adopzrdd">
+              <span>{{ index + 1 }}报销事项:</span>
+              <el-input
+                v-model="scope.model.blank_adopzrdd[index].remark"
+                type="textarea"
+                style="width: calc(100% - 80px)"
+              ></el-input>
+            </div>
+            <div class="blank_adopzrdd">
+              <span>金额:</span>
+              <el-input
+                v-model="scope.model.blank_adopzrdd[index].price"
+                type="number"
+                style="width: calc(100% - 80px)"
+              ></el-input>
+            </div>
+          </div>
+        </template>
       </fm-generate-form>
       <async-biz-form-component
         v-else
@@ -122,4 +142,13 @@
       font-weight: bold;
     }
   }
+    .blank_adopzrdd {
+    display: flex;
+    align-items: center;
+    > span {
+      display: inline-block;
+      width: 80px;
+    }
+    margin-bottom: 10px;
+  }
 </style>

+ 130 - 95
src/views/bpm/handleTask/formParser/formParserDialog.vue

@@ -15,19 +15,38 @@
       :edit="false"
       ref="generateForm"
     >
+      <template v-slot:blank_adopzrdd="scope">
+        <div v-for="(item, index) in scope.model.blank_adopzrdd" :key="index">
+          <div class="blank_adopzrdd">
+            <span>{{ index + 1 }}报销事项:</span>
+            <el-input
+              v-model="scope.model.blank_adopzrdd[index].remark"
+              type="textarea"
+              style="width: calc(100% - 80px)"
+            ></el-input>
+          </div>
+          <div class="blank_adopzrdd">
+            <span>金额:</span>
+            <el-input
+              v-model="scope.model.blank_adopzrdd[index].price"
+              type="number"
+              style="width: calc(100% - 80px)"
+            ></el-input>
+          </div>
+        </div>
+      </template>
     </fm-generate-form>
     <div slot="footer" class="dialog-footer">
       <el-form label-width="100px" ref="formRef" :model="form">
         <!-- prop="reason" -->
         <el-form-item
           label="审批建议"
-        
           style="margin-bottom: 20px"
           :rules="{
-          required: true,
-          message: '',
-          trigger: 'blur'
-        }"
+            required: true,
+            message: '',
+            trigger: 'blur'
+          }"
         >
           <el-input
             type="textarea"
@@ -41,7 +60,7 @@
         type="success"
         size="mini"
         @click="handleAudit(1)"
-      >通过
+        >通过
       </el-button>
 
       <el-button
@@ -49,10 +68,13 @@
         type="danger"
         size="mini"
         @click="handleAudit(0)"
-      >驳回
+        >驳回
       </el-button>
 
-      <el-dropdown @command="(command) => handleCommand(command)" style="margin-left: 30px;">
+      <el-dropdown
+        @command="(command) => handleCommand(command)"
+        style="margin-left: 30px"
+      >
         <span class="el-dropdown-link">
           更多<i class="el-icon-arrow-down el-icon--right"></i>
         </span>
@@ -60,103 +82,116 @@
           <el-dropdown-item command="cancel">作废</el-dropdown-item>
         </el-dropdown-menu>
       </el-dropdown>
-    </div>  
-
-
+    </div>
   </ele-modal>
 </template>
 <script>
-import Parser from "@/components/FormGenerator/components/parser/Parser.vue";
-import {projectsUpdateAPI} from "@/api/bpm/components/project-manage";
-import {approveTaskWithVariables, cancelTask, rejectTask} from "@/api/bpm/task";
-import {getToken} from "@/utils/token-util";
+  import Parser from '@/components/FormGenerator/components/parser/Parser.vue';
+  import { projectsUpdateAPI } from '@/api/bpm/components/project-manage';
+  import {
+    approveTaskWithVariables,
+    cancelTask,
+    rejectTask
+  } from '@/api/bpm/task';
+  import { getToken } from '@/utils/token-util';
 
-export default {
-  name: 'formParserDialog',
-  components: {Parser},
-  props: {
-    businessId: {
-      default: ''
+  export default {
+    name: 'formParserDialog',
+    components: { Parser },
+    props: {
+      businessId: {
+        default: ''
+      },
+      formParserDialogFlag: {
+        type: Boolean,
+        default: false
+      }
     },
-    formParserDialogFlag: {
-      type: Boolean,
-      default: false
+    data() {
+      return {
+        form: {},
+        index: '',
+        jsonData: {}
+      };
     },
-  },
-  data() {
-    return {
-      form:{},
-      index:"",
-      jsonData: {},
-    }
-  },
-  methods: {
-    open(row){
-      this.form = _.cloneDeep(row)
-      this.jsonData = JSON.parse(this.form.formJson.makingJson);
-      this.jsonData.config.dataSource &&
-      this.jsonData.config.dataSource.forEach((item) => {
-        item.headers = {
-          Authorization: getToken()
+    methods: {
+      open(row) {
+        this.form = _.cloneDeep(row);
+        this.jsonData = JSON.parse(this.form.formJson.makingJson);
+        this.jsonData.config.dataSource &&
+          this.jsonData.config.dataSource.forEach((item) => {
+            item.headers = {
+              Authorization: getToken()
+            };
+            // item.url = item.url && item.url.replace('/api', this.APIUrl);
+          });
+      },
+      cancel() {
+        this.$emit('update:formParserDialogFlag', false);
+      },
+      async handleAudit(status) {
+        await this._approveTaskWithVariables(status);
+      },
+      async _approveTaskWithVariables(status) {
+        let variables = {
+          pass: !!status
         };
-        // item.url = item.url && item.url.replace('/api', this.APIUrl);
-      });
-    },
-    cancel() {
-      this.$emit('update:formParserDialogFlag', false);
-    },
-    async handleAudit(status) {
-      await this._approveTaskWithVariables(status);
-    },
-    async _approveTaskWithVariables(status) {
-      let variables = {
-        pass: !!status
-      };
-      let API = !!status ? approveTaskWithVariables : rejectTask
+        let API = !!status ? approveTaskWithVariables : rejectTask;
 
-      API({
-        id: this.form.id,
-        reason: this.form.reason,
-        businessId: this.businessId,
-        variables
-      }).then((res) => {
-        if (res.data.code != '-1') {
-          let params = {
-            status,
-            title: status === 0 ? '驳回' : ''
+        API({
+          id: this.form.id,
+          reason: this.form.reason,
+          businessId: this.businessId,
+          variables
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            let params = {
+              status,
+              title: status === 0 ? '驳回' : ''
+            };
+            this.$message.success(`审批${params.title}成功!`);
+            this.$emit('reload');
+            this.cancel();
           }
-          this.$message.success(`审批${params.title}成功!`);
-          this.$emit('reload')
-          this.cancel()
+        });
+      },
 
+      //更多
+      handleCommand(command) {
+        if (command === 'cancel') {
+          this.$confirm('是否确认作废?', {
+            type: 'warning',
+            cancelButtonText: '取消',
+            confirmButtonText: '确定'
+          })
+            .then(() => {
+              cancelTask({
+                taskId: this.form.id,
+                id: this.form.processInstance.id,
+                reason: this.form.reason
+              })
+                .then(() => {
+                  this.$emit('reload');
+                  this.cancel();
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
         }
-      });
-    },
-
-    //更多
-    handleCommand(command) {
-      if (command === 'cancel') {
-        this.$confirm("是否确认作废?", {
-          type: 'warning',
-          cancelButtonText: '取消',
-          confirmButtonText: '确定'
-        }).then(() => {
-          cancelTask({
-            taskId: this.form.id,
-            id: this.form.processInstance.id,
-            reason: this.form.reason
-          }).then(() => {
-            this.$emit('reload')
-            this.cancel()
-          }).catch(() => {
-            this.$message.error("流程作废失败");
-          });
-        }).catch(() => {
-        });
       }
-    },
-
-  }
-};
+    }
+  };
 </script>
-<style scoped lang="scss"></style>
+<style scoped lang="scss">
+  .blank_adopzrdd {
+    display: flex;
+    align-items: center;
+    > span {
+      display: inline-block;
+      width: 80px;
+    }
+    margin-bottom: 10px;
+  }
+</style>