qukaidi 3 vuotta sitten
vanhempi
commit
490f270f16
1 muutettua tiedostoa jossa 39 lisäystä ja 55 poistoa
  1. 39 55
      src/views/workManagement/service-items/project.vue

+ 39 - 55
src/views/workManagement/service-items/project.vue

@@ -4,52 +4,30 @@
       <div class="box">
         <el-scrollbar>
           <basic-container>
-            <avue-tree
-              :option="treeOption"
-              :data="treeData"
-              @node-click="nodeClick"
-            />
+            <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" />
           </basic-container>
         </el-scrollbar>
       </div>
     </el-col>
     <el-col :span="20">
       <basic-container>
-        <avue-crud
-          ref="crud"
-          :data="data"
-          :option="tableOption"
-          :page.sync="page"
-          :table-loading="loading"
-          v-model='form'
-          :search.sync="search"
-          :cell-style="cellStyle"
-          :before-open="beforeOpen"
-          @size-change="sizeChange"
-          @current-change="currentChange"
-          @search-change="searchChange"
-          @refresh-change="refreshChange"
-          @row-save="rowSave"
-          @row-del="rowDel"
-          @row-update="rowUpdate"
-          @cell-dblclick="cellDblclick"
-          @on-load="getList"
-          @saveColumn="saveColumn"
-          @resetColumn="resetColumn"
-        >
+        <avue-crud ref="crud" :data="data" :option="tableOption" :page.sync="page" :table-loading="loading"
+          v-model='form' :search.sync="search" :cell-style="cellStyle" :before-open="beforeOpen"
+          @size-change="sizeChange" @current-change="currentChange" @search-change="searchChange"
+          @refresh-change="refreshChange" @row-save="rowSave" @row-del="rowDel" @row-update="rowUpdate"
+          @cell-dblclick="cellDblclick" @on-load="getList" @saveColumn="saveColumn" @resetColumn="resetColumn">
           <template slot="menuLeft">
-            <el-button
-              icon="el-icon-printer"
-              size="small"
-              type="primary"
-              @click.stop="openReport()"
-            >报表打印
+            <el-button icon="el-icon-plus" size="small" type="primary" @click.stop="rowAdd()">新 增
             </el-button>
+            <el-button icon="el-icon-printer" size="small" type="primary" @click.stop="openReport()">报表打印
+            </el-button>
+          </template>
+          <template slot-scope="{column, disabled}" slot="commissionForm">
+           <el-input v-model="form.commission" size="small" oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
+            <template slot="append">%</template>
+           </el-input>
           </template>
-          <report-dialog
-            :switchDialog="switchDialog"
-            @onClose="onClose()"
-          ></report-dialog>
+          <report-dialog :switchDialog="switchDialog" @onClose="onClose()"></report-dialog>
         </avue-crud>
       </basic-container>
     </el-col>
@@ -57,20 +35,20 @@
 </template>
 
 <script>
-  import option from "./configuration/projectOption.json";
-  import {getServiceProjectList, remove, submit,detail, getServiceTypeTree,getDeptTree,getDicData} from "@/api/workManagement/serviceProject";
-  import reportDialog from "@/components/report-dialog/main";
+import option from "./configuration/projectOption.json";
+import { getServiceProjectList, remove, submit, detail, getServiceTypeTree, getDeptTree, getDicData } from "@/api/workManagement/serviceProject";
+import reportDialog from "@/components/report-dialog/main";
 export default {
   data() {
     return {
-      switchDialog:false,//报表
+      switchDialog: false,//报表
       loading: true,
       data: [],
       tableOption: {},
-      form:{},
-      search:{},
-      treeDeptId:"",
-      treeDeptName:'',
+      form: {},
+      search: {},
+      treeDeptId: "",
+      treeDeptName: '',
       height: window.innerHeight - 350,
       page: {
         currentPage: 1,
@@ -80,7 +58,7 @@ export default {
       treeOption: {
         nodeKey: "id",
         lazy: true,
-        treeLoad: function(node, resolve) {
+        treeLoad: function (node, resolve) {
           const parentId = node.level === 0 ? 0 : node.data.id;
           getServiceTypeTree(parentId).then(res => {
             resolve(
@@ -120,7 +98,7 @@ export default {
   methods: {
     //打印
     openReport() {
-      this.switchDialog =! this.switchDialog;
+      this.switchDialog = !this.switchDialog;
     },
     //关闭打印
     onClose(val) {
@@ -135,7 +113,7 @@ export default {
           this.tableOption.height = window.innerHeight - 240;
           // this.treeOption.height = window.innerHeight - 240;
         }
-      }).finally(()=>{
+      }).finally(() => {
         this.loading = false
       })
 
@@ -145,11 +123,11 @@ export default {
 
     // },
     //点击新增或修改时
-    beforeOpen(done, type){
+    beforeOpen(done, type) {
       if (["add"].includes(type)) {
-        this.tableOption.column.forEach(e=>{
-          if(e.prop=='goodsTypeId'){
-            this.$set(this.tableOption.column,2,{...e,value:this.treeDeptId})
+        this.tableOption.column.forEach(e => {
+          if (e.prop == 'goodsTypeId') {
+            this.$set(this.tableOption.column, 2, { ...e, value: this.treeDeptId })
           }
         })
       }
@@ -173,11 +151,17 @@ export default {
       this.getList();
     },
     refreshChange() {
-      this.getList(this.page,this.search);
+      this.getList(this.page, this.search);
+    },
+    rowAdd() {
+      this.form = {
+        commission: 5
+      }
+      this.$refs.crud.rowAdd()
     },
     rowSave(row, done, loading) {
       row.sort = 1;
-      row.goodsTypeId = Array.isArray(row.goodsTypeId) ? row.goodsTypeId.join(',') :  row.goodsTypeId;
+      row.goodsTypeId = Array.isArray(row.goodsTypeId) ? row.goodsTypeId.join(',') : row.goodsTypeId;
       submit(row).then(() => {
         this.page.currentPage = 1;
         this.getList(this.page);
@@ -202,7 +186,7 @@ export default {
         loading();
       });
     },
-    rowDel(row, index,done) {
+    rowDel(row, index, done) {
       this.$confirm("确定将选择数据删除?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",