|
@@ -1,10 +1,15 @@
|
|
|
<template>
|
|
|
- <div id="index">
|
|
|
+ <div id="distribute">
|
|
|
<admin-frame @search="search" :limit="limit" :total="total" topType="2" @back="back" :rightArrow="false" :useNav="false">
|
|
|
<template v-slot:info>
|
|
|
<van-col span="24" class="one">
|
|
|
- <van-button type="info" size="small" @click="selectUser">选择用户</van-button>
|
|
|
- <van-button type="info" size="small" @click="onSubmit">确认分配</van-button>
|
|
|
+ <van-button type="info" size="small" @click="toSearch()">查询条件</van-button>
|
|
|
+ <van-button type="danger" size="small" @click="selectDel()">批量删除</van-button>
|
|
|
+ <van-button type="info" size="small" @click="selectUser()">选择用户</van-button>
|
|
|
+ <van-button type="info" size="small" @click="selectSubmit()">确认批量分配</van-button>
|
|
|
+ <p>
|
|
|
+ 专利总数:<span class="total">({{ total }})</span>
|
|
|
+ </p>
|
|
|
</van-col>
|
|
|
<van-col span="24" class="two">
|
|
|
<van-form>
|
|
@@ -36,32 +41,33 @@
|
|
|
</template>
|
|
|
</admin-frame>
|
|
|
<van-dialog class="dialog" v-model="dialog.show" :title="dialog.title" :show-confirm-button="false" show-cancel-button cancel-button-text="返回">
|
|
|
- <info-1 :info="info" v-if="dialog.type == '1'"></info-1>
|
|
|
- <searchuser-1 v-else-if="dialog.type == '2'" @userSubmit="userSubmit"></searchuser-1>
|
|
|
+ <search-1 v-if="dialog.type == '1'" :searchForm="searchForm" @reseat="reseat" @onSubmit="onSubmit"></search-1>
|
|
|
+ <searchuser-1 v-if="dialog.type == '2'" @userSubmit="userSubmit"></searchuser-1>
|
|
|
</van-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import info1 from '@/layout/patentInfo/info-1.vue';
|
|
|
+import search1 from '@/layout/patentInfo/search-1.vue';
|
|
|
import searchuser1 from '@/layout/patentInfo/searchuser-1.vue';
|
|
|
import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: patentinfo } = createNamespacedHelpers('patentinfo');
|
|
|
+import { Dialog } from 'vant';
|
|
|
export default {
|
|
|
- name: 'index',
|
|
|
+ name: 'distribute',
|
|
|
props: {},
|
|
|
- components: { adminFrame, info1, searchuser1 },
|
|
|
+ components: { adminFrame, search1, searchuser1 },
|
|
|
data: function () {
|
|
|
return {
|
|
|
list: [],
|
|
|
- limit: 5,
|
|
|
+ limit: 4,
|
|
|
total: 0,
|
|
|
// 弹框
|
|
|
- dialog: { show: false, title: '详细信息', type: '1' },
|
|
|
- // 详细信息
|
|
|
- info: {},
|
|
|
- // 专利分配用户
|
|
|
+ dialog: { show: false, title: '查询条件', type: '1' },
|
|
|
+ // 查询条件
|
|
|
+ searchForm: {},
|
|
|
+ // 批量处理表单
|
|
|
form: {},
|
|
|
};
|
|
|
},
|
|
@@ -69,7 +75,7 @@ export default {
|
|
|
this.search();
|
|
|
},
|
|
|
methods: {
|
|
|
- ...patentinfo(['query', 'updateUser']),
|
|
|
+ ...patentinfo(['query', 'updateUser', 'delete']),
|
|
|
async search({ skip = 0, limit = this.limit, ...info } = {}) {
|
|
|
let res = await this.query({ skip, limit, ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
@@ -77,23 +83,35 @@ export default {
|
|
|
this.$set(this, `total`, res.total);
|
|
|
}
|
|
|
},
|
|
|
- // 详细信息
|
|
|
- toView(data) {
|
|
|
- this.$set(this, `info`, data);
|
|
|
- this.dialog = { show: true, title: '详细信息', type: '1' };
|
|
|
+ // 查询专利
|
|
|
+ toSearch() {
|
|
|
+ this.dialog = { show: true, title: '查询条件', type: '1' };
|
|
|
},
|
|
|
- // 提交
|
|
|
- async onSubmit() {
|
|
|
- let data = {
|
|
|
- patentData: this.form.patentData,
|
|
|
- user_id: this.form.user_id ? [{ user_id: this.form.user_id, name: this.form.name }] : '',
|
|
|
- };
|
|
|
- if (data.patentData && data.user_id) {
|
|
|
- let res = await this.updateUser(data);
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- this.$toast({ type: `success`, message: `操作完成` });
|
|
|
- this.search();
|
|
|
- }
|
|
|
+ // 重置条件
|
|
|
+ reseat() {
|
|
|
+ this.searchForm = {};
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ // 提交查询
|
|
|
+ onSubmit({ data }) {
|
|
|
+ this.search(data);
|
|
|
+ this.dialog = { show: false, title: '查询条件', type: '1' };
|
|
|
+ },
|
|
|
+ // 批量删除
|
|
|
+ async selectDel() {
|
|
|
+ let data = this.form.patentData;
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ Dialog.confirm({ title: '信息提示', message: '删除操作不可恢复,您确定要继续么?' })
|
|
|
+ .then(async () => {
|
|
|
+ for (const val of data) {
|
|
|
+ let res = await this.delete(val);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$toast({ type: `success`, message: `删除成功` });
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
} else {
|
|
|
this.$toast({ type: `error`, message: `缺少必要信息` });
|
|
|
}
|
|
@@ -108,12 +126,25 @@ export default {
|
|
|
this.$set(this.form, `name`, data.name);
|
|
|
this.dialog = { show: false, title: '选择用户', type: '2' };
|
|
|
},
|
|
|
-
|
|
|
+ // 提交
|
|
|
+ async selectSubmit() {
|
|
|
+ let data = { patentData: this.form.patentData, user_id: this.form.user_id ? [{ user_id: this.form.user_id, name: this.form.name }] : '' };
|
|
|
+ if (data.patentData && data.user_id) {
|
|
|
+ let res = await this.updateUser(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$toast({ type: `success`, message: `操作完成` });
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$toast({ type: `error`, message: `缺少必要信息` });
|
|
|
+ }
|
|
|
+ },
|
|
|
// 返回
|
|
|
back() {
|
|
|
this.$router.push({ path: '/patent/index' });
|
|
|
},
|
|
|
},
|
|
|
+
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
},
|
|
@@ -135,7 +166,15 @@ export default {
|
|
|
text-align: center;
|
|
|
margin: 8px 0;
|
|
|
.van-button {
|
|
|
- margin: 0 5px;
|
|
|
+ margin: 0 5px 5px 0;
|
|
|
+ }
|
|
|
+ p {
|
|
|
+ font-size: 16px;
|
|
|
+ margin: 5px 0 0 0;
|
|
|
+ span {
|
|
|
+ color: #000;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.two {
|