wxy há 4 anos atrás
pai
commit
484763e00b

+ 8 - 2
src/views/client/contract.vue

@@ -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 || '创建失败')) {

+ 5 - 1
src/views/personnel/user.vue

@@ -28,7 +28,7 @@
       <data-form v-model="form" :fields="fields" @save="turnSave" :rules="rules" status-icon>
         <template #options="{item}">
           <template v-if="item.model == 'role'">
-            <el-option v-for="(item, index) in roleOptions" :key="index" :value="item.type" :label="item.name"></el-option>
+            <el-option v-for="(item, index) in Options" :key="index" :value="item.value" :label="item.name"></el-option>
           </template>
         </template>
         <template #custom="{item}">
@@ -99,6 +99,10 @@ export default {
         { label: '角色', model: 'role', type: 'select', format: true },
       ],
       roleOptions: [],
+      Options: [
+        { name: '管理员', value: '0' },
+        { name: '用户', value: '1' },
+      ],
       rules: {
         login_id: [{ required: true, message: '请输入登录id', trigger: 'blur' }],
         // password: [{ required: true, message: '请输入密码', trigger: 'blur' }],

+ 6 - 2
src/views/supplier/contract.vue

@@ -119,9 +119,11 @@ export default {
         this.$set(this, `nameList`, res.data);
       }
     },
-    // 查合同 其他参数是...info,都包括在里面,可以输出看看
+    // 查合同
     async searchTreaty({ skip = 0, limit = 10, ...info } = {}) {
-      const res = await this.query({ skip, limit, ...info });
+      let obj = { skip, limit, ...info };
+      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);
@@ -131,7 +133,9 @@ export default {
     //关闭
     toClose() {
       this.form = {};
+      console.log(this.dialog);
       this.dialog = false;
+      console.log('调用了');
     },
     //保存
     async turnSave({ data }) {

+ 1 - 1
vue.config.js

@@ -26,7 +26,7 @@ module.exports = {
     //api地址前缀
     proxy: {
       '/api/servicezhwl': {
-        target: 'http://127.0.0.1:7002',
+        target: 'http://free.liaoningdoupo.com',
       },
       '/api/role/auth': {
         target: 'http://free.liaoningdoupo.com', //http://free.liaoningdoupo.com