Prechádzať zdrojové kódy

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dev

longfenglin 1 rok pred
rodič
commit
c4bf27bc11

+ 5 - 5
src/views/system/user/components/user-edit.vue

@@ -122,7 +122,7 @@ export default {
   props: {
     // 弹窗是否打开
     visible: Boolean,
-    isUpdate: Boolean,
+    // isUpdate: Boolean,
     // 修改回显的数据
     data: Object,
     organizationList: {
@@ -293,10 +293,10 @@ export default {
         this.form = { ...this.defaultForm };
       }
     },
-    isUpdate(v){
-      console.log(v,66666);
-      this.isUpdate = v;
-    }
+    // isUpdate(v){
+    //   console.log(v,66666);
+    //   this.isUpdate = v;
+    // }
   }
 };
 </script>

+ 262 - 254
src/views/system/user/index.vue

@@ -144,269 +144,277 @@
 </template>
 
 <script>
-import tabMixins from '@/mixins/tableColumnsMixin';
-import UserSearch from './components/user-search.vue';
-import UserEdit from './components/user-edit.vue';
-import UserImport from './components/user-import.vue';
-import {
-  pageUsers,
-  putUsers,
-  deleteUsers,
-  resetPassword,putEnable
-} from '@/api/system/user';
-import { unbindLoginName, listOrganizations } from '@/api/system/organization';
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import UserSearch from './components/user-search.vue';
+  import UserEdit from './components/user-edit.vue';
+  import UserImport from './components/user-import.vue';
+  import {
+    pageUsers,
+    putUsers,
+    deleteUsers,
+    resetPassword,
+    putEnable
+  } from '@/api/system/user';
+  import {
+    unbindLoginName,
+    listOrganizations
+  } from '@/api/system/organization';
 
-export default {
-  name: 'SystemUser',
-  mixins: [tabMixins],
-  components: {
-    UserSearch,
-    UserEdit,
-    UserImport
-  },
-  data() {
-    return {
-      // 表格列配置
-      columns: [
-        {
-          columnKey: 'selection',
-          type: 'selection',
-          width: 45,
-          align: 'center',
-          fixed: 'left'
-        },
-        {
-          columnKey: 'index',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'left',
-          label: '序号'
-        },
-        {
-          prop: 'loginName',
-          label: '用户账号',
-          // sortable: 'custom',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-        {
-          prop: 'jobNumber',
-          label: '工号',
-          // sortable: 'custom',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-        {
-          prop: 'name',
-          label: '姓名',
-          // sortable: 'custom',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-        {
-          prop: 'phone',
-          label: '手机号',
-          // sortable: 'custom',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
+  export default {
+    name: 'SystemUser',
+    mixins: [tabMixins],
+    components: {
+      UserSearch,
+      UserEdit,
+      UserImport
+    },
+    data() {
+      return {
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left',
+            label: '序号'
+          },
+          {
+            prop: 'loginName',
+            label: '用户账号',
+            // sortable: 'custom',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'jobNumber',
+            label: '工号',
+            // sortable: 'custom',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'name',
+            label: '姓名',
+            // sortable: 'custom',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'phone',
+            label: '手机号',
+            // sortable: 'custom',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
 
-        {
-          columnKey: 'groupRoleList',
-          label: '角色',
-          showOverflowTooltip: true,
-          minWidth: 110,
-          formatter: (_row, _column, cellValue) => {
-            let names = [];
-            _row.groupRoleList.forEach((item) => {
-              names.push(...item.roleVOList.map((val) => val.name));
-            });
-            console.log(cellValue, 'cellValue');
-            return names.toString();
+          {
+            columnKey: 'groupRoleList',
+            label: '角色',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              let names = [];
+              _row.groupRoleList.forEach((item) => {
+                names.push(...item.roleVOList.map((val) => val.name));
+              });
+              console.log(cellValue, 'cellValue');
+              return names.toString();
+            }
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            // sortable: 'custom',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.$util.toDateString(cellValue);
+            }
+          },
+          {
+            prop: 'enable',
+            label: '状态',
+            align: 'center',
+            // sortable: 'custom',
+            width: 80,
+            resizable: false,
+            slot: 'enable',
+            showOverflowTooltip: true
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 280,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
           }
-        },
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          // sortable: 'custom',
-          showOverflowTooltip: true,
-          minWidth: 110,
-          formatter: (_row, _column, cellValue) => {
-            return this.$util.toDateString(cellValue);
-          }
-        },
-        {
-          prop: 'enable',
-          label: '状态',
-          align: 'center',
-          // sortable: 'custom',
-          width: 80,
-          resizable: false,
-          slot: 'enable',
-          showOverflowTooltip: true
-        },
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 280,
-          align: 'center',
-          resizable: false,
-          slot: 'action',
-          showOverflowTooltip: true
-        }
-      ],
-      // 表格选中数据
-      selection: [],
-      // 当前编辑数据
-      current: null,
-      // 是否显示编辑弹窗
-      showEdit: false,
-      // 是否显示导入弹窗
-      showImport: false,
-      organizationList: [],
-      pageSize: this.$store.state.tablePageSize,
-      cacheKeyUrl: '763607fc-system-user'
-    };
-  },
-  created() {
-    this.query();
-  },
-  methods: {
-    /* 表格数据源 */
-    datasource({ page, limit, where, order }) {
-      return pageUsers({ ...where, ...order, pageNum: page, size: limit });
+        ],
+        // 表格选中数据
+        selection: [],
+        // 当前编辑数据
+        current: null,
+        // 是否显示编辑弹窗
+        showEdit: false,
+        // 是否显示导入弹窗
+        showImport: false,
+        organizationList: [],
+        pageSize: this.$store.state.tablePageSize,
+        cacheKeyUrl: '763607fc-system-user'
+      };
     },
-    /* 查询 */
-    query() {
-      listOrganizations()
-        .then((list) => {
-          let _list = list.filter((i) => i.name != '超级管理员');
-
-          this.organizationList = this.$util.toTreeData({
-            data: _list,
-            idField: 'id',
-            parentIdField: 'parentId'
-          });
-        })
-        .catch((e) => {
-          this.loading = false;
-          // this.$message.error(e.message);
-        });
+    created() {
+      this.query();
     },
-    async changeEnable(row) {
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        return pageUsers({ ...where, ...order, pageNum: page, size: limit });
+      },
+      /* 查询 */
+      query() {
+        listOrganizations()
+          .then((list) => {
+            let _list = list.filter((i) => i.name != '超级管理员');
 
-      const res = await putEnable({id:row.id,enable:row.enable});
-      if (res.code == 0) {
-        this.$message({
-          type: 'success',
-          message: '修改成功',
-          customClass: 'ele-message-border'
-        });
-        this.reload();
-      }
-    },
-    /* 刷新表格 */
-    reload(where) {
-      this.$refs.table.reload({ page: 1, where: where });
-    },
-    /* 打开编辑弹窗 */
-    openEdit(row) {
-      this.current = row;
-      this.showEdit = true;
-      this.$refs.userEdit.$refs.form &&
-        this.$refs.userEdit.$refs.form.clearValidate();
-    },
-    // 解除绑定
-    toUnBind(row) {
-      const loading = this.$loading({ lock: true });
-      unbindLoginName(row.mainUserId)
-        .then((res) => {
-          loading.close();
-          this.$message.success('解绑成功');
+            this.organizationList = this.$util.toTreeData({
+              data: _list,
+              idField: 'id',
+              parentIdField: 'parentId'
+            });
+          })
+          .catch((e) => {
+            this.loading = false;
+            // this.$message.error(e.message);
+          });
+      },
+      async changeEnable(row) {
+        const res = await putEnable({ id: row.id, enable: row.enable });
+        if (res.code == 0) {
+          this.$message({
+            type: 'success',
+            message: '修改成功',
+            customClass: 'ele-message-border'
+          });
           this.reload();
+        }
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where: where });
+      },
+      /* 打开编辑弹窗 */
+      openEdit(row) {
+        this.current = row;
+        this.showEdit = true;
+        if (row?.id) {
+          this.$refs.userEdit.isUpdate = true;
+        } else {
+          this.$refs.userEdit.isUpdate = false;
+        }
+        this.$refs.userEdit.$refs.form &&
+          this.$refs.userEdit.$refs.form.clearValidate();
+      },
+      // 解除绑定
+      toUnBind(row) {
+        const loading = this.$loading({ lock: true });
+        unbindLoginName(row.mainUserId)
+          .then((res) => {
+            loading.close();
+            this.$message.success('解绑成功');
+            this.reload();
+          })
+          .catch((e) => {
+            loading.close();
+            // this.$message.error(e.message);
+          });
+      },
+      /* 打开导入弹窗 */
+      openImport() {
+        this.showImport = true;
+      },
+      /* 删除 */
+      remove(row) {
+        const loading = this.$loading({ lock: true });
+        deleteUsers([row.id])
+          .then((msg) => {
+            loading.close();
+            this.$message.success(msg);
+            this.reload();
+          })
+          .catch((e) => {
+            loading.close();
+            // this.$message.error(e.message);
+          });
+      },
+      /* 批量删除 */
+      removeBatch() {
+        if (!this.selection.length) {
+          this.$message.error('请至少选择一条数据');
+          return;
+        }
+        this.$confirm('确定要删除选中的用户吗?', '提示', {
+          type: 'warning'
         })
-        .catch((e) => {
-          loading.close();
-          // this.$message.error(e.message);
-        });
-    },
-    /* 打开导入弹窗 */
-    openImport() {
-      this.showImport = true;
-    },
-    /* 删除 */
-    remove(row) {
-      const loading = this.$loading({ lock: true });
-      deleteUsers([row.id])
-        .then((msg) => {
-          loading.close();
-          this.$message.success(msg);
-          this.reload();
+          .then(() => {
+            const loading = this.$loading({ lock: true });
+            deleteUsers(this.selection.map((d) => d.id))
+              .then((msg) => {
+                loading.close();
+                this.$message.success(msg);
+                this.reload();
+              })
+              .catch((e) => {
+                loading.close();
+                // this.$message.error(e.message);
+              });
+          })
+          .catch(() => {});
+      },
+      /* 重置用户密码 */
+      resetPsw(row) {
+        this.$confirm('确定要重置此用户的密码为"123456"吗?', '提示', {
+          type: 'warning'
         })
-        .catch((e) => {
-          loading.close();
-          // this.$message.error(e.message);
-        });
-    },
-    /* 批量删除 */
-    removeBatch() {
-      if (!this.selection.length) {
-        this.$message.error('请至少选择一条数据');
-        return;
+          .then(() => {
+            const loading = this.$loading({ lock: true });
+            resetPassword(row.id)
+              .then((msg) => {
+                loading.close();
+                this.$message.success(msg);
+              })
+              .catch((e) => {
+                loading.close();
+                // this.$message.error(e.message);
+              });
+          })
+          .catch(() => {});
+      },
+      /* 更改状态 */
+      editStatus(row) {
+        const loading = this.$loading({ lock: true });
+        updateUserStatus(row.userId, row.status)
+          .then((msg) => {
+            loading.close();
+            this.$message.success(msg);
+          })
+          .catch((e) => {
+            loading.close();
+            row.status = !row.status ? 1 : 0;
+            // this.$message.error(e.message);
+          });
       }
-      this.$confirm('确定要删除选中的用户吗?', '提示', {
-        type: 'warning'
-      })
-        .then(() => {
-          const loading = this.$loading({ lock: true });
-          deleteUsers(this.selection.map((d) => d.id))
-            .then((msg) => {
-              loading.close();
-              this.$message.success(msg);
-              this.reload();
-            })
-            .catch((e) => {
-              loading.close();
-              // this.$message.error(e.message);
-            });
-        })
-        .catch(() => {});
-    },
-    /* 重置用户密码 */
-    resetPsw(row) {
-      this.$confirm('确定要重置此用户的密码为"123456"吗?', '提示', {
-        type: 'warning'
-      })
-        .then(() => {
-          const loading = this.$loading({ lock: true });
-          resetPassword(row.id)
-            .then((msg) => {
-              loading.close();
-              this.$message.success(msg);
-            })
-            .catch((e) => {
-              loading.close();
-              // this.$message.error(e.message);
-            });
-        })
-        .catch(() => {});
-    },
-    /* 更改状态 */
-    editStatus(row) {
-      const loading = this.$loading({ lock: true });
-      updateUserStatus(row.userId, row.status)
-        .then((msg) => {
-          loading.close();
-          this.$message.success(msg);
-        })
-        .catch((e) => {
-          loading.close();
-          row.status = !row.status ? 1 : 0;
-          // this.$message.error(e.message);
-        });
     }
-  }
-};
+  };
 </script>

+ 308 - 264
src/views/technology/route/index.vue

@@ -4,316 +4,360 @@
       <!-- 搜索表单 -->
       <user-search @search="reload" />
       <!-- 数据表格 -->
-      <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="id"
-        :page-size="this.$store.state.tablePageSize" @columns-change="handleColumnChange" :cache-key="cacheKeyUrl"
-        @filter-change="selectType">
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        :selection.sync="selection"
+        row-key="id"
+        :page-size="this.$store.state.tablePageSize"
+        @columns-change="handleColumnChange"
+        :cache-key="cacheKeyUrl"
+        @filter-change="selectType"
+      >
         <!-- 表头工具栏 -->
         <template v-slot:toolbar>
-          <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon"
-            @click="openEdit(null)">新增</el-button>
-
-          <el-button size="small" type="primary" icon="el-icon-refresh-left" class="ele-btn-icon" @click='refreshData'
-            :loading="loading" v-if="clientEnvironmentId==1">刷新</el-button>
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="openEdit(null)"
+            >新增</el-button
+          >
+
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-refresh-left"
+            class="ele-btn-icon"
+            @click="refreshData"
+            :loading="loading"
+            v-if="clientEnvironmentId == 1"
+            >刷新</el-button
+          >
         </template>
 
-
         <template v-slot:code="{ row }">
-          <el-link type="primary" :underline="false" @click="openDetail(row)"> {{ row.code }}</el-link>
+          <el-link type="primary" :underline="false" @click="openDetail(row)">
+            {{ row.code }}</el-link
+          >
         </template>
 
-
         <!-- 状态列 -->
         <template v-slot:status="{ row }">
           {{ checkStatus(row) }}
         </template>
 
-
         <template v-slot:routeType="{ row }">
-          {{ row.routeType == 2 ? '委外' : row.routeType == 1 ? '生产' : row.routeType == 3 ? '质检' : '' }}
+          {{
+            row.routeType == 2
+              ? '委外'
+              : row.routeType == 1
+              ? '生产'
+              : row.routeType == 3
+              ? '质检'
+              : ''
+          }}
         </template>
 
-
-
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
-          <el-link type="primary" :underline="false" icon="el-icon-edit" @click="openEdit(row)">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit(row)"
+          >
             修改
           </el-link>
 
-
-          <el-link type="primary" :underline="false" icon="el-icon-document" @click="openHistory(row)">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-document"
+            @click="openHistory(row)"
+          >
             历史版本
           </el-link>
 
-          <el-popconfirm v-if="row.status != 1" class="ele-action" title="确定要删除当前工序吗?" @confirm="remove(row)">
+          <el-popconfirm
+            v-if="row.status != 1"
+            class="ele-action"
+            title="确定要删除当前工序吗?"
+            @confirm="remove(row)"
+          >
             <template v-slot:reference>
               <el-link type="danger" :underline="false" icon="el-icon-delete">
                 删除
               </el-link>
             </template>
           </el-popconfirm>
-
-
-
         </template>
       </ele-pro-table>
     </el-card>
     <!-- 编辑弹窗 -->
-    <user-edit :visible.sync="showEdit" :data="current" @done="reload" :isUpdate="isUpdate" ref="userEdit" />
-
-
+    <user-edit
+      :visible.sync="showEdit"
+      :data="current"
+      @done="reload"
+      ref="userEdit"
+    />
 
     <!-- 历史版本弹框 -->
     <historyModal ref="historyRefs"></historyModal>
 
-    <UserDetail :visible.sync="detailEdit" :data="current" @close="detailEdit = false" ref="UserDetailRef"></UserDetail>
-
+    <UserDetail
+      :visible.sync="detailEdit"
+      :data="current"
+      @close="detailEdit = false"
+      ref="UserDetailRef"
+    ></UserDetail>
   </div>
 </template>
 
 <script>
-import tabMixins from '@/mixins/tableColumnsMixin';
-import UserSearch from './components/user-search.vue';
-import UserEdit from './components/user-edit.vue';
-import UserDetail from './components/user-detail.vue'
-import historyModal from './components/historyModal.vue'
-import route from '@/api/technology/route';
-export default {
-  name: 'technologyRoute',
-  mixins: [tabMixins],
-  components: {
-    UserSearch,
-    UserEdit,
-    UserDetail,
-    historyModal
-  },
-  data() {
-    return {
-      isUpdate: false,
-      // 表格列配置
-      columns: [
-      {
-          columnKey: 'index',
-          label: '序号',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          slot: 'routeType',
-          label: '类型',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'code',
-          label: '工艺路线编码',
-          showOverflowTooltip: true,
-          align: 'center',
-          minWidth: 110,
-          slot: 'code',
-        },
-        {
-          prop: 'name',
-          label: '工艺路线名称',
-          showOverflowTooltip: true,
-          align: 'center',
-          minWidth: 110
-        },
-
-
-        {
-          prop: 'version',
-          label: '工艺路线版本',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-
-        // {
-        //   prop: 'produceVersionName',
-        //   label: '工艺类型',
-        //   align: 'center',
-        //   showOverflowTooltip: true
-        // },
-
-        {//修改此prop名称时,请同步修改columnKey属性和下方selectType方法
-          prop: 'status',
-          label: '状态',
-          align: 'center',
-          slot: 'status',
-          showOverflowTooltip: true,
-          minWidth: 110,
-          filters: [
-            { text: '草稿', value: -1 },
-            { text: '失效', value: 0 },
-            { text: '生效', value: 1 }
-          ],
-          filterMultiple: false,
-          columnKey: 'status'
-        },
-
-       
-        {
-          prop: 'factoriesName',
-          label: '所属工厂',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-
-        {
-          align: 'center',
-          prop: 'createTime',
-          label: '创建时间',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 220,
-          align: 'left',
-          resizable: false,
-          slot: 'action',
-
-        }
-      ],
-
-      // 表格选中数据
-      selection: [],
-      // 当前编辑数据
-      current: null,
-      // 是否显示编辑弹窗
-      showEdit: false,
-      detailEdit: false,
-
-      statusList: [
-        { label: '草稿', value: -1 },
-        { label: '失效', value: 0 },
-        { label: '生效', value: 1 }
-      ],
-      loading: false,
-      cacheKeyUrl: 'fb92f8df-technology-route'
-    };
-  },
-  computed: {
-    // 是否开启响应式布局
-    clientEnvironmentId() {
-      return this.$store.state.user.info.clientEnvironmentId;
-    }
-  },
-  methods: {
-    selectType(value) {
-      let where = {}
-      if (value.status.length > 0) {
-        where['status'] = value.status[0]
-      }
-      this.reload(where)
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import UserSearch from './components/user-search.vue';
+  import UserEdit from './components/user-edit.vue';
+  import UserDetail from './components/user-detail.vue';
+  import historyModal from './components/historyModal.vue';
+  import route from '@/api/technology/route';
+  export default {
+    name: 'technologyRoute',
+    mixins: [tabMixins],
+    components: {
+      UserSearch,
+      UserEdit,
+      UserDetail,
+      historyModal
     },
-    /* 表格数据源 */
-    async datasource({ page, limit, where, order }) {
-      const res = await route.list({
-        ...where,
-        ...order,
-        pageNum: page,
-        size: limit
-      });
-      return res;
+    data() {
+      return {
+        isUpdate: false,
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            slot: 'routeType',
+            label: '类型',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'code',
+            label: '工艺路线编码',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110,
+            slot: 'code'
+          },
+          {
+            prop: 'name',
+            label: '工艺路线名称',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            prop: 'version',
+            label: '工艺路线版本',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+
+          // {
+          //   prop: 'produceVersionName',
+          //   label: '工艺类型',
+          //   align: 'center',
+          //   showOverflowTooltip: true
+          // },
+
+          {
+            //修改此prop名称时,请同步修改columnKey属性和下方selectType方法
+            prop: 'status',
+            label: '状态',
+            align: 'center',
+            slot: 'status',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            filters: [
+              { text: '草稿', value: -1 },
+              { text: '失效', value: 0 },
+              { text: '生效', value: 1 }
+            ],
+            filterMultiple: false,
+            columnKey: 'status'
+          },
+
+          {
+            prop: 'factoriesName',
+            label: '所属工厂',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            align: 'center',
+            prop: 'createTime',
+            label: '创建时间',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 220,
+            align: 'left',
+            resizable: false,
+            slot: 'action'
+          }
+        ],
+
+        // 表格选中数据
+        selection: [],
+        // 当前编辑数据
+        current: null,
+        // 是否显示编辑弹窗
+        showEdit: false,
+        detailEdit: false,
+
+        statusList: [
+          { label: '草稿', value: -1 },
+          { label: '失效', value: 0 },
+          { label: '生效', value: 1 }
+        ],
+        loading: false,
+        cacheKeyUrl: 'fb92f8df-technology-route'
+      };
     },
-
-    checkStatus(row) {
-      let obj = this.statusList.find((it) => it.value == row.status);
-      return obj.label;
-    },
-
-    /* 刷新表格 */
-    reload(where) {
-      this.$refs.table.reload({ page: 1, where: where });
-    },
-    /* 打开编辑弹窗 */
-    openEdit(row) {
-      this.current = row;
-      this.showEdit = true;
-      if (row) {
-        this.isUpdate = true;
-      } else {
-        this.isUpdate = false;
+    computed: {
+      // 是否开启响应式布局
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
       }
-
-      this.$refs.userEdit.$refs.form &&
-        this.$refs.userEdit.$refs.form.clearValidate();
-    },
-    /* 打开历史版本 */
-    openHistory(row) {
-      this.$refs.historyRefs.open(row)
     },
-    /* 删除 */
-    remove(row) {
-      const loading = this.$loading({ lock: true });
-
-      route
-        .delete(row.id)
-        .then((msg) => {
-          loading.close();
-          this.$message.success('删除' + msg);
-          this.reload();
-        })
-        .catch((e) => {
-          loading.close();
-          // this.$message.error(e.message);
-        });
-    },
-    /* 批量删除 */
-    removeBatch() {
-      if (!this.selection.length) {
-        this.$message.error('请至少选择一条数据');
-        return;
-      }
-      this.$confirm('确定要删除选中的工序吗?', '提示', {
-        type: 'warning'
-      })
-        .then(() => {
-          const loading = this.$loading({ lock: true });
-          producetask
-            .delete(this.selection.map((d) => d.id))
-            .then((msg) => {
-              loading.close();
-              this.$message.success('删除' + msg);
-              this.reload();
-            })
-            .catch((e) => {
-              loading.close();
-              // this.$message.error(e.message);
-            });
-        })
-        .catch(() => { });
-    },
-
-    // 刷新数据
-    refreshData() {
-      this.loading = true;
-      route.syncRouting().then(res => {
-        if (res == '0') {
-          this.loading = false;
-          this.$message.success('数据刷新成功!')
-          this.reload()
+    methods: {
+      selectType(value) {
+        let where = {};
+        if (value.status.length > 0) {
+          where['status'] = value.status[0];
         }
-      })
-        .catch((e) => {
-          this.loading = false;
+        this.reload(where);
+      },
+      /* 表格数据源 */
+      async datasource({ page, limit, where, order }) {
+        const res = await route.list({
+          ...where,
+          ...order,
+          pageNum: page,
+          size: limit
         });
-    },
-
-    openDetail(row) {
-      this.current = row
-      // 
-
-      // this.$refs.userEdit.datasource(this.current.id);
-      this.detailEdit = true;
-    },
+        return res;
+      },
+
+      checkStatus(row) {
+        let obj = this.statusList.find((it) => it.value == row.status);
+        return obj.label;
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where: where });
+      },
+      /* 打开编辑弹窗 */
+      openEdit(row) {
+        this.current = row;
+        this.showEdit = true;
+        if (row?.id) {
+          this.$refs.userEdit.isUpdate = true;
+        } else {
+          this.$refs.userEdit.isUpdate = false;
+        }
 
-  }
-};
+        this.$refs.userEdit.$refs.form &&
+          this.$refs.userEdit.$refs.form.clearValidate();
+      },
+      /* 打开历史版本 */
+      openHistory(row) {
+        this.$refs.historyRefs.open(row);
+      },
+      /* 删除 */
+      remove(row) {
+        const loading = this.$loading({ lock: true });
+
+        route
+          .delete(row.id)
+          .then((msg) => {
+            loading.close();
+            this.$message.success('删除' + msg);
+            this.reload();
+          })
+          .catch((e) => {
+            loading.close();
+            // this.$message.error(e.message);
+          });
+      },
+      /* 批量删除 */
+      removeBatch() {
+        if (!this.selection.length) {
+          this.$message.error('请至少选择一条数据');
+          return;
+        }
+        this.$confirm('确定要删除选中的工序吗?', '提示', {
+          type: 'warning'
+        })
+          .then(() => {
+            const loading = this.$loading({ lock: true });
+            producetask
+              .delete(this.selection.map((d) => d.id))
+              .then((msg) => {
+                loading.close();
+                this.$message.success('删除' + msg);
+                this.reload();
+              })
+              .catch((e) => {
+                loading.close();
+                // this.$message.error(e.message);
+              });
+          })
+          .catch(() => {});
+      },
+
+      // 刷新数据
+      refreshData() {
+        this.loading = true;
+        route
+          .syncRouting()
+          .then((res) => {
+            if (res == '0') {
+              this.loading = false;
+              this.$message.success('数据刷新成功!');
+              this.reload();
+            }
+          })
+          .catch((e) => {
+            this.loading = false;
+          });
+      },
+
+      openDetail(row) {
+        this.current = row;
+        //
+
+        // this.$refs.userEdit.datasource(this.current.id);
+        this.detailEdit = true;
+      }
+    }
+  };
 </script>