瀏覽代碼

Merge branch 'master' into 'dev'

Master

See merge request motive-power/yxl/yxl-web-admin-frontend!8
梁展鹏 3 年之前
父節點
當前提交
1fbed9c76e

+ 3 - 1
src/api/photoWarehouse/index.js

@@ -9,7 +9,9 @@ export const saveItem = params =>
 export const delItem = ({ id, ...params }) =>
 	api.del(`/yxl-back-end/admin/photo-warehouse/${id}`, params);
 export const auditItem = params =>
-	api.post(`/yxl-back-end/admin/photo-warehouse/audit`, params);
+  api.post(`/yxl-back-end/admin/photo-warehouse/audit`, params);
+export const auditMultItem = ({params}) =>
+  api.post(`/yxl-back-end/admin/photo-warehouse/mult/audit`, params);
 export const updateItem = ({ id, ...params }) =>
 	api.put(`/yxl-back-end/admin/photo-warehouse/${id}`, params);
 

+ 4 - 0
src/components/BaseTable.vue

@@ -1,5 +1,9 @@
 <template>
   <div class="mt-20">
+    <el-row :gutter="10" class="mt-10 mb8">
+      <slot :selected="multipleSelection" name="batch-btn-box" />
+    </el-row>
+
     <el-table
       :data="items"
       :style="`width: 100%; min-height:${minHeight};`"

+ 8 - 0
src/utils/dialog-helper.js

@@ -13,6 +13,7 @@ import WithdrawalRecordVerifyItem from 'views/statistics/withdrawalRecord/modal/
 import PhotoerVerifyItem from 'views/photographerManagement/photographerVerify/modal/ItemModal.vue';
 import ActivityItem from 'views/photoManagement/eventsList/modal/ItemModal.vue';
 import PhotoVerifyItem from 'views/photoManagement/photoVerifyManagement/modal/ItemModal.vue';
+import PhotoVerifyMultItem from 'views/photoManagement/photoVerifyManagement/modal/MultItemModal.vue';
 import ImageGoodsItem from 'views/photoManagement/imageGoodsManagement/modal/ItemModal.vue';
 import PhotoUpload from 'views/photographerManagement/photoVerify/modal/ItemModal.vue';
 import PhotoMultUpload from 'views/photographerManagement/photoVerify/modal/MultItemModal.vue';
@@ -38,6 +39,13 @@ const modal = (Component, props) => {
   document.body.appendChild(_component.$el);
 };
 
+let PhotoVerifyMultItemModal = data => {
+  modal(PhotoVerifyMultItem, data);
+};
+Vue.prototype.$PhotoVerifyMultItemModal = params => {
+  PhotoVerifyMultItemModal(params);
+};
+
 let PhotoMultUploadModal = data => {
   modal(PhotoMultUpload, data);
 };

+ 65 - 1
src/views/photoManagement/photoVerifyManagement/index.vue

@@ -8,7 +8,34 @@
       :items="items"
       :pagination="pagination"
       :page-change="pageChange"
-    />
+    >
+      <template v-slot:batch-btn-box="{ selected }">
+        
+        <!-- <el-col :span="1.5">
+          <el-button
+            type="success"
+            plain
+            icon="el-icon-edit"
+            size="mini"
+            :disabled="selected | singleBatch"
+            @click="handleUpdate(selected)"
+            v-hasPermi="['car:brand:edit']"
+            >修改</el-button
+          >
+        </el-col> -->
+        <el-col :span="1.5">
+          <el-button
+            type="success"
+            plain
+            size="mini"
+            :disabled="selected | multipleBatch"
+            @click="handleAudit(selected)"
+            >批量审核</el-button
+          >
+        </el-col>
+      </template>
+
+    </base-table>
   </div>
 </template>
 
@@ -17,11 +44,38 @@ import toolbar from './toolbar';
 import mxFilterList from '@/mixins/filterList';
 import { getPage } from '@/api/photoWarehouse';
 
+const checkArr = (arr) => {
+  if (Array.isArray(arr)) {
+    if (arr.length === 0) {
+      return 'null';
+    } else if (arr.length === 1) {
+      return 'single';
+    } else {
+      return 'multiple';
+    }
+  } else {
+    throw new Error('ErrorType, we need Array', arr);
+  }
+};
+
+
 export default {
   name: 'photoVerifyManagement',
 
   components: { toolbar },
 
+  filters: {
+    // 单选可用
+    singleBatch: (arr) => {
+      return checkArr(arr) !== 'single';
+    },
+    // 非空可用
+    multipleBatch: (arr) => {
+      return checkArr(arr) === 'null';
+    },
+  },
+
+
   mixins: [
     mxFilterList({
       fetchList: getPage // 在下方data再声明一个 fetchList: iGetList 同等效果
@@ -32,6 +86,9 @@ export default {
     return {
       columns: [
         {
+          key: 'selection',
+        },
+         {
           key: 'id',
           name: '标识',
           width: this.$col.b
@@ -175,6 +232,13 @@ export default {
 
   beforeDestroy() {
     this.$g_off('photo_reload', this.reload);
+  },
+  methods: {
+    handleAudit(arr) {
+      this.$PhotoVerifyMultItemModal({
+        ids: arr.map(x => x.id)
+      })
+    }
   }
 };
 </script>

+ 96 - 0
src/views/photoManagement/photoVerifyManagement/modal/MultItemModal.vue

@@ -0,0 +1,96 @@
+<template>
+  <el-dialog
+    :title="title"
+    :visible.sync="modal"
+    width="80%"
+    :close-on-click-modal="false"
+    @close="
+      res => {
+        $emit('cancel');
+      }
+    "
+  >
+    <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+      <el-form-item label="审核状态" prop="auditStatus">
+        <el-radio-group v-model="form.auditStatus">
+          <el-radio :label="1">通过</el-radio>
+          <el-radio :label="-1">不通过</el-radio>
+        </el-radio-group>
+      </el-form-item>
+      <el-form-item label="审核备注">
+        <el-input
+          v-model="form.auditMsg"
+          type="textarea"
+          :rows="2"
+          placeholder="请输入内容"
+        >
+        </el-input>
+      </el-form-item>
+    </el-form>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="modal = false">取消</el-button>
+      <el-button type="primary" @click="handleConfirm">确定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import { auditMultItem } from '@/api/photoWarehouse';
+
+export default {
+  name: 'photoVerifyMultItem',
+
+  props: {
+    ids: {
+      type: Array,
+      default: ()=>[]
+    },
+  },
+
+  data() {
+    return {
+      title: '照片批量审核详情',
+      modal: true,
+      form: {
+        auditStatus: null,
+        auditMsg: ''
+      },
+      rules: {
+        auditStatus: [
+          { required: true, message: '请选择是否通过', trigger: 'blur' }
+        ]
+      }
+    };
+  },
+
+  mounted() {},
+
+  methods: {
+
+    handleConfirm() {
+      this.$refs.form.validate(async valid => {
+        if (valid) {
+          const params = {
+            auditStatus: this.form.auditStatus,
+            auditMsg: this.form.auditMsg
+          };
+          if (this.ids.length > 0) params.ids = this.ids;
+          console.log(params)
+          const { success, msg } = await auditMultItem(params);
+          if (success) {
+            this.$success('保存成功!');
+            this.modal = false;
+            this.$g_emit('photo_reload');
+          }
+        }
+      });
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.pre-img {
+  height: 80px;
+}
+</style>