|
@@ -111,6 +111,7 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.search();
|
|
|
+ console.log(this.user);
|
|
|
},
|
|
|
methods: {
|
|
|
...treaty(['query', 'create', 'update', 'delete']),
|
|
@@ -124,7 +125,12 @@ export default {
|
|
|
},
|
|
|
// 查合同 其他参数是...info,都包括在里面,可以输出看看
|
|
|
async searchTreaty({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
- const res = await this.query({ skip, limit, ...info });
|
|
|
+ let obj = { skip, limit, ...info };
|
|
|
+ //如果role不是0就是用户,用户只能查看自己添加的合同,根据创始人owner来查询属于自己添加的合同
|
|
|
+ //用户与管理员的区别就是需不需要根据owner这个条件来查询用户
|
|
|
+ if (this.user.role !== '0') obj.owner = this.user.id;
|
|
|
+
|
|
|
+ const res = await this.query(obj);
|
|
|
if (this.$checkRes(res)) {
|
|
|
const { data, total } = res;
|
|
|
this.$set(this, `list`, data);
|
|
@@ -146,7 +152,7 @@ export default {
|
|
|
this.toClose();
|
|
|
}
|
|
|
} else {
|
|
|
- //谁登陆owner就是谁,把id赋予上面就行
|
|
|
+ //谁登陆owner就是谁,把id赋予上面就行,创建新的合同的时候必须添加一个owner创始人这是必填的
|
|
|
data.owner = this.user.id;
|
|
|
const res = await this.create(data);
|
|
|
if (this.$checkRes(res, '创建成功', res.errmsg || '创建失败')) {
|