Преглед на файлове

费用信息和类别10.13

caojunjie преди 1 година
родител
ревизия
1837c8e34e
променени са 2 файла, в които са добавени 113 реда и са изтрити 21 реда
  1. 67 15
      src/views/iosBasicData/bfeesdefine/bfeesdetype.vue
  2. 46 6
      src/views/iosBasicData/bfeesdefine/index.vue

+ 67 - 15
src/views/iosBasicData/bfeesdefine/bfeesdetype.vue

@@ -30,6 +30,16 @@
                            @click="handleDelete">删 除
                 </el-button>
             </template>
+            <template slot-scope="scope" slot="menu">
+                <el-button v-if="scope.row.status == 1" type="text" icon="el-icon-turn-off" style="color: #85e967" size="small"
+                           @click.stop="statusfun(scope.row.id,0)">
+                    启用
+                </el-button>
+                <el-button v-if="scope.row.status == 0" type="text" icon="el-icon-turn-off" style="color: #e83c3a" size="small"
+                           @click.stop="statusfun(scope.row.id,1)">
+                    停用
+                </el-button>
+            </template>
         </avue-crud>
     </basic-container>
 </template>
@@ -47,21 +57,29 @@
         page: {
           pageSize: 10,
           currentPage: 1,
-          total: 0
+          total: 0,
+          ageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
         },
         selectionList: [],
         option:{},
         optionBack: {
+            addBtnText: '新建类别',
+            addTitle: '新建类别',
+            editBtnText: '编辑',
+            editTitle: '编辑类别',
+            viewBtnText: '查看',
+            viewTitle: '查看类别',
           height:'auto',
           calcHeight: 30,
           tip: false,
           searchShow: true,
-          searchMenuSpan: 24,
+          searchMenuSpan: 6,
           border: true,
           index: true,
           viewBtn: true,
           selection: true,
           dialogClickModal: false,
+            menuWidth:260,
           column: [
             {
               label: "中文名称",
@@ -217,6 +235,26 @@
           this.option = await this.getColumnData(this.getColumnName(302.1), this.optionBack);
       },
     methods: {
+        // 禁用启用按钮
+        statusfun(id,status){
+            this.$confirm("确定将选择数据更改状态?", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning"
+            }).then(()=>{
+                bfeesdefineDetail(id).then(res=>{
+                    let obj = res.data.data;
+                    obj.status = status
+                    bfeesdefineSubmit(obj).then(()=>{
+                        this.onLoad(this.page);
+                        this.$message({
+                            type: "success",
+                            message: "操作成功!"
+                        });
+                    })
+                })
+            })
+        },
 
       rowSave(row, done, loading) {
         bfeesdefineSubmit(row).then(() => {
@@ -245,27 +283,41 @@
         });
       },
       rowDel(row) {
-        this.$confirm("确定将选择数据删除?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        })
-          .then(() => {
-            return bfeesdefineRemove(row.id);
-          })
-          .then(() => {
-            this.onLoad(this.page);
+        if (row.status === 1) {
+            this.$confirm("确定将选择数据删除?", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning"
+            })
+                .then(() => {
+                    return bfeesdefineRemove(row.id);
+                })
+                .then(() => {
+                    this.onLoad(this.page);
+                    this.$message({
+                        type: "success",
+                        message: "操作成功!"
+                    });
+                });
+        }else {
             this.$message({
-              type: "success",
-              message: "操作成功!"
+                message: '非禁用状态无法删除',
+                type: 'warning'
             });
-          });
+        }
+
       },
       handleDelete() {
         if (this.selectionList.length === 0) {
           this.$message.warning("请选择至少一条数据");
           return;
         }
+          for (const selection of this.selectionList) {
+              if (selection.status == 0) {
+                  this.$message.warning("选中的数据中有启用数据,启用数据不可删除!");
+                  return;
+              }
+          }
         this.$confirm("确定将选择数据删除?", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",

+ 46 - 6
src/views/iosBasicData/bfeesdefine/index.vue

@@ -33,23 +33,34 @@
               </el-button>
               <el-button type="success" size="small" @click="handleExport" icon="el-icon-printer">导出</el-button>
             </template>
+              <template slot-scope="scope" slot="menu">
+                  <el-button v-if="scope.row.status == 1" type="text" icon="el-icon-turn-off" style="color: #85e967" size="small"
+                             @click.stop="statusfun(scope.row.id,0)">
+                      启用
+                  </el-button>
+                  <el-button v-if="scope.row.status == 0" type="text" icon="el-icon-turn-off" style="color: #e83c3a" size="small"
+                             @click.stop="statusfun(scope.row.id,1)">
+                      停用
+                  </el-button>
+              </template>
             <template slot="unitNoForm">
-              <search-query ref="SearchQuery" :datalist="unitNoData" title="计量单位" :filterable="true" :clearable="true"
+              <search-query ref="SearchQuery" :disabled="searchDisabled" :selectValue="form.unitNo" :datalist="unitNoData" title="计量单位" :filterable="true" :clearable="true"
                 :remote="true" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
                 @remoteMethod="getBunitsListfun" @corpChange="unitNoCorpChange">
                 <bunits></bunits>
               </search-query>
             </template>
             <template slot="curNoForm">
-              <search-query ref="SearchQuery" :datalist="curNoData" title="币别" :filterable="true" :clearable="true"
+              <search-query ref="SearchQuery" :disabled="searchDisabled" :selectValue="form.curNo" :datalist="curNoData" title="币别" :filterable="true" :clearable="true"
                 :remote="true" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
                 @remoteMethod="getRateListfun" @corpChange="curNoCorpChange">
                 <rateManagement></rateManagement>
               </search-query>
             </template>
             <template slot="feesTypeNameForm">
-              <search-query ref="SearchQuery" :datalist="feesTypeData" title="费用类别" :filterable="true" :clearable="true"
-                :remote="true" :forParameter="{ key: 'id', label: 'cnName', value: 'id' }"
+              <search-query ref="SearchQuery" :disabled="searchDisabled" :selectValue="form.feesTypeName" :datalist="feesTypeData" title="费用类别"
+                            :filterable="true" :clearable="true"
+                :remote="true" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
                 @remoteMethod="bfeesdefineListfun" @corpChange="feesTypeCorpChange">
                 <bfeesdetype></bfeesdetype>
               </search-query>
@@ -127,6 +138,8 @@ export default {
   components: { bunits, bfeesdetype, rateManagement, SearchQuery },
   data() {
     return {
+        // 是否禁用
+        searchDisabled:false,
       // 类别弹窗的开启
       corpTypeVisible: false,
       // 费用类别数据
@@ -188,7 +201,8 @@ export default {
       page: {
         pageSize: 10,
         currentPage: 1,
-        total: 0
+        total: 0,
+        ageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
       },
       selectionList: [],
       option: {
@@ -212,6 +226,7 @@ export default {
         viewBtn: true,
         selection: true,
         dialogClickModal: false,
+          menuWidth:260,
         column: [
           // {
           //     label: "凭证",
@@ -463,6 +478,26 @@ export default {
     this.getRateListfun()
   },
   methods: {
+      // 禁用启用按钮
+      statusfun(id,status){
+          this.$confirm("确定将选择数据更改状态?", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning"
+          }).then(()=>{
+              bfeesDetail(id).then(res=>{
+                  let obj = res.data.data;
+                  obj.status = status
+                  bfeesSubmit(obj).then(()=>{
+                      this.onLoad(this.page);
+                      this.$message({
+                          type: "success",
+                          message: "操作成功!"
+                      });
+                  })
+              })
+          })
+      },
     // 导出
     handleExport() {
       var condition = ''
@@ -533,7 +568,7 @@ export default {
     // 费用信息选中回调
     feesTypeCorpChange(value) {
       this.feesTypeData.map(item => {
-        if (item.id == value) {
+        if (item.cnName == value) {
           this.form.feesTypeId = item.id
           this.form.feesTypeName = item.cnName
         }
@@ -638,6 +673,11 @@ export default {
         });
     },
     beforeOpen(done, type) {
+        if (["edit", "add"].includes(type)) {
+            this.searchDisabled = false
+        } else {
+            this.searchDisabled = true
+        }
       if (["edit", "view"].includes(type)) {
         bfeesDetail(this.form.id).then(res => {
           this.form = res.data.data;