quwangxin před 2 roky
rodič
revize
8f2ef757e3

+ 3 - 16
src/components/AssetTree/index.vue

@@ -17,7 +17,7 @@
 </template>
 
 <script>
-  import { getTreeByPid, getTreeByType } from '@/api/classifyManage';
+  import { getTreeByPid } from '@/api/classifyManage';
   // let originId = '';
   // let originType = '';
   export default {
@@ -40,7 +40,7 @@
       defaultExpandAll: {
         type: Boolean,
         default: function () {
-          return true
+          return true;
         }
       },
       // 初始请求treeList
@@ -48,15 +48,6 @@
         type: Boolean,
         default: true
       },
-      // 接口分父级id 和 类型筛选
-      paramsType: {
-        type: String,
-        default: 'id'
-      },
-      type: {
-        type: String,
-        default: ''
-      },
       id: {
         type: String,
         default: '0'
@@ -92,12 +83,8 @@
       async getTreeData () {
         try {
           this.treeLoading = true;
-          const requestApi =
-            this.paramsType === 'type'
-              ? getTreeByType.bind(null, this.type)
-              : getTreeByPid.bind(null, this.id);
 
-          const res = await requestApi();
+          const res = await getTreeByPid(this.id);
           this.treeLoading = false;
           if (res?.code === '0') {
             this.treeList = res.data;

+ 3 - 1
src/components/header-title/index.vue

@@ -3,7 +3,9 @@
     <div class="title">
       <div class="left">
         <div class="ele-bg-primary box"></div>
-        <span :style="{ 'font-size': size }">{{ title }}</span>
+        <slot name="title"
+          ><span :style="{ 'font-size': size }">{{ title }}</span></slot
+        >
       </div>
       <div class="right">
         <slot />

+ 5 - 1
src/config/setting.js

@@ -3,6 +3,8 @@ export const API_BASE_URL = process.env.VUE_APP_API_BASE_URL;
 
 // 项目名称
 export const PROJECT_NAME = process.env.VUE_APP_NAME;
+// 系统名称
+export const SYSTEM_NAME = 'main-data';
 
 // 不显示侧栏的路由
 export const HIDE_SIDEBARS = [];
@@ -102,7 +104,9 @@ export const TAB_KEEP_ALIVE = true;
 export const TOKEN_HEADER_NAME = 'Authorization';
 
 // token 存储的名称
-export const TOKEN_STORE_NAME = 'access_token';
+export const TOKEN_STORE_NAME = window.__POWERED_BY_QIANKUN__
+  ? 'access_token'
+  : `${SYSTEM_NAME}-access_token`;
 
 // 主题配置存储的名称
 export const THEME_STORE_NAME = 'theme';

+ 4 - 1
src/router/index.js

@@ -8,11 +8,14 @@ import { WHITE_LIST, REDIRECT_PATH, LAYOUT_PATH } from '@/config/setting';
 import store from '@/store';
 import { getToken } from '@/utils/token-util';
 import { routes, getMenuRoutes } from './routes';
+import { SYSTEM_NAME } from '@/config/setting';
 
 Vue.use(VueRouter);
 
 const router = new VueRouter({
-  base: window.__POWERED_BY_QIANKUN__ ? '/page-main-data/' : '/main-data/',
+  base: window.__POWERED_BY_QIANKUN__
+    ? `/page-${SYSTEM_NAME}/`
+    : `/${SYSTEM_NAME}/`,
   routes,
   mode: 'history',
   scrollBehavior () {

+ 4 - 1
src/store/index.js

@@ -10,6 +10,7 @@ import theme from './modules/theme';
 import team from './modules/team';
 import createPersistedState from 'vuex-persistedstate';
 
+import { SYSTEM_NAME } from '@/config/setting';
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -25,7 +26,9 @@ export default new Vuex.Store({
   getters,
   plugins: [
     createPersistedState({
-      key: 'vuex-main',
+      key: window.__POWERED_BY_QIANKUN__
+        ? `vuex-${SYSTEM_NAME}`
+        : `private-vuex-${SYSTEM_NAME}`,
       storage: window.sessionStorage,
       paths: ['user']
     })

+ 0 - 163
src/views/material/product/components/dict-data-edit.vue

@@ -1,163 +0,0 @@
-<!-- 字典项编辑弹窗 -->
-<template>
-  <ele-modal
-    width="460px"
-    :visible="visible"
-    :close-on-click-modal="true"
-    :title="isUpdate ? '修改字典项' : '添加字典项'"
-    @update:visible="updateVisible"
-  >
-    <el-form :model="form" ref="form" :rules="rules" label-width="96px">
-      <el-form-item label="字典项名称:" prop="dictDataName">
-        <el-input
-          clearable
-          :maxlength="20"
-          v-model="form.dictDataName"
-          placeholder="请输入字典项名称"
-        />
-      </el-form-item>
-      <el-form-item label="字典项值:" prop="dictDataCode">
-        <el-input
-          clearable
-          :maxlength="20"
-          v-model="form.dictDataCode"
-          placeholder="请输入字典项值"
-        />
-      </el-form-item>
-      <el-form-item label="排序号:" prop="sortNumber">
-        <el-input-number
-          :min="0"
-          :max="9999"
-          v-model="form.sortNumber"
-          placeholder="请输入排序号"
-          controls-position="right"
-          class="ele-fluid ele-text-left"
-        />
-      </el-form-item>
-      <el-form-item label="备注:">
-        <el-input
-          :rows="4"
-          type="textarea"
-          :maxlength="200"
-          v-model="form.comments"
-          placeholder="请输入备注"
-        />
-      </el-form-item>
-    </el-form>
-    <template v-slot:footer>
-      <el-button @click="updateVisible(false)">取消 </el-button>
-      <el-button type="primary" :loading="loading" @click="save">
-        保存
-      </el-button>
-    </template>
-  </ele-modal>
-</template>
-
-<script>
-  import {
-    addDictionaryData,
-    updateDictionaryData
-  } from '@/api/system/dictionary-data';
-
-  export default {
-    // props: {
-    //   // 弹窗是否打开
-    //   visible: Boolean,
-    //   // 修改回显的数据
-    //   data: Object,
-    //   // 字典id
-    //   dictId: Object
-    // },
-    props: ['visible', 'data', 'dictId'],
-    data() {
-      const defaultForm = {
-        dictDataId: null,
-        dictDataName: '',
-        dictDataCode: '',
-        sortNumber: '',
-        comments: ''
-      };
-      return {
-        defaultForm,
-        // 表单数据
-        form: { ...defaultForm },
-        // 表单验证规则
-        rules: {
-          dictDataName: [
-            {
-              required: true,
-              message: '请输入字典项名称',
-              trigger: 'blur'
-            }
-          ],
-          dictDataCode: [
-            {
-              required: true,
-              message: '请输入字典项值',
-              trigger: 'blur'
-            }
-          ],
-          sortNumber: [
-            {
-              required: true,
-              message: '请输入排序号',
-              trigger: 'blur'
-            }
-          ]
-        },
-        // 提交状态
-        loading: false,
-        // 是否是修改
-        isUpdate: false
-      };
-    },
-    methods: {
-      /* 保存编辑 */
-      save() {
-        this.$refs.form.validate((valid) => {
-          if (!valid) {
-            return false;
-          }
-          this.loading = true;
-          const saveOrUpdate = this.isUpdate
-            ? updateDictionaryData
-            : addDictionaryData;
-          saveOrUpdate({
-            ...this.form,
-            dictId: this.dictId
-          })
-            .then((msg) => {
-              this.loading = false;
-              console.log(msg);
-              this.$message.success(msg);
-              this.updateVisible(false);
-              this.$emit('done');
-            })
-            .catch((e) => {
-              this.loading = false;
-              // this.$message.error(e.message);
-            });
-        });
-      },
-      /* 更新visible */
-      updateVisible(value) {
-        this.$emit('update:visible', value);
-      }
-    },
-    watch: {
-      visible(visible) {
-        if (visible) {
-          if (this.data) {
-            this.$util.assignObject(this.form, this.data);
-            this.isUpdate = true;
-          } else {
-            this.isUpdate = false;
-          }
-        } else {
-          this.$refs.form.clearValidate();
-          this.form = { ...this.defaultForm };
-        }
-      }
-    }
-  };
-</script>

+ 0 - 227
src/views/material/product/components/dict-data.vue

@@ -1,227 +0,0 @@
-<template>
-  <div>
-    <!-- 数据表格 -->
-    <ele-pro-table
-      ref="table"
-      :columns="columns"
-      :datasource="datasource"
-      :need-page="true"
-      :toolkit="[]"
-      :selection.sync="selection"
-      height="calc(100vh - 350px)"
-      full-height="calc(100vh - 116px)"
-      tool-class="ele-toolbar-form"
-      cache-key="systemDictDataTable"
-    >
-      <!-- 表头工具栏 -->
-      <!-- <template v-slot:toolbar>
-        <dict-data-search @search="reload">
-          <el-button
-            size="small"
-            type="primary"
-            icon="el-icon-plus"
-            class="ele-btn-icon"
-            @click="openEdit()"
-          >
-            添加
-          </el-button>
-          <el-button
-            size="small"
-            type="danger"
-            icon="el-icon-delete"
-            class="ele-btn-icon"
-            @click="removeBatch"
-          >
-            删除
-          </el-button>
-        </dict-data-search>
-      </template> -->
-      <!-- 操作列 -->
-      <template v-slot:appType="{ row }">
-        {{ types[row.appType] }}
-      </template>
-      <template v-slot:action="{ row }">
-        <el-link
-          type="primary"
-          :underline="false"
-          icon="el-icon-edit"
-          @click="openEdit(row)"
-        >
-          修改
-        </el-link>
-        <el-popconfirm
-          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>
-    <!-- 编辑弹窗 -->
-    <dict-edit :visible.sync="showEdit" :id="id" @done="reload" />
-  </div>
-</template>
-
-<script>
-  import DictDataSearch from './dict-data-search.vue';
-  import DictDataEdit from './dict-data-edit.vue';
-  import {
-    pageDictionaryData,
-    removeDictionaryData,
-    removeDictionaryDataBatch
-  } from '@/api/system/dictionary-data';
-  import { listDictionaries, removeDictionary } from '@/api/system/dictionary';
-  import DictEdit from './dict-edit.vue';
-
-  export default {
-    components: { DictDataSearch, DictDataEdit, DictEdit },
-    data() {
-      return {
-        // 表格列配置
-        columns: [
-          {
-            columnKey: 'selection',
-            type: 'selection',
-            width: 45,
-            align: 'center'
-          },
-          {
-            columnKey: 'index',
-            type: 'index',
-            width: 45,
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'code',
-            label: '字典编码',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'name',
-            label: '字典名称',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          // {
-          //   prop: 'appType',
-          //   label: '字典类型',
-
-          //   showOverflowTooltip: true,
-          //   minWidth: 110
-          // },
-          {
-            prop: 'appType',
-            align: 'center',
-            label: '应用类型',
-            showOverflowTooltip: true,
-            slot: 'appType'
-          },
-          {
-            prop: 'remark',
-            label: '描述',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'updateTime',
-            label: '上次更新时间',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110,
-            formatter: (_row, _column, cellValue) => {
-              return this.$util.toDateString(cellValue);
-            }
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 130,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
-          }
-        ],
-        types: {
-          1: '业务字典',
-          2: '数据字典'
-        },
-        // 表格选中数据
-        selection: [],
-        // 当前编辑数据
-        current: null,
-        // 是否显示编辑弹窗
-        showEdit: false,
-        id: ''
-      };
-    },
-
-    methods: {
-      /* 表格数据源 */
-      datasource({ page, limit, where, order }) {
-        return listDictionaries({ pageNum: page, size: limit, ...where });
-      },
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({ page: 1, where: where });
-      },
-      /* 显示编辑 */
-      openEdit(row) {
-        this.id = row.id;
-        this.current = row;
-        this.showEdit = true;
-      },
-      /* 删除 */
-      remove(row) {
-        const loading = this.$loading({ lock: true });
-        removeDictionary(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 });
-            removeDictionaryDataBatch(this.selection.map((d) => d.dictDataId))
-              .then((msg) => {
-                loading.close();
-                this.$message.success(msg);
-                this.reload();
-              })
-              .catch((e) => {
-                loading.close();
-                // this.$message.error(e.message);
-              });
-          })
-          .catch(() => {});
-      }
-    },
-    watch: {
-      // 监听字典id变化
-      // dictId() {
-      //   this.reload();
-      // }
-    }
-  };
-</script>

+ 0 - 476
src/views/material/product/components/dict-edit.vue

@@ -1,476 +0,0 @@
-<!-- 字典编辑弹窗 -->
-<template>
-  <ele-modal
-    width="800px"
-    :maxable="true"
-    :visible="visible"
-    :close-on-click-modal="true"
-    :title="isUpdate ? '修改字典' : '添加字典'"
-    @update:visible="updateVisible"
-  >
-    <div class="divider">
-      <div class="title">
-        <div class="ele-bg-primary"></div>
-        <span>基本信息</span>
-      </div>
-      <div class="ele-bg-primary" style="width: 100%; height: 2px"></div>
-    </div>
-    <el-form
-      ref="form"
-      :model="form"
-      :rules="rules"
-      label-width="85px"
-      style="margin-bottom: 10px"
-    >
-      <el-row>
-        <el-col :span="12">
-          <el-form-item label="字典名称:" prop="name">
-            <el-input
-              clearable
-              :disabled="isUpdate"
-              :maxlength="20"
-              v-model="form.name"
-              placeholder="请输入字典名称"
-            />
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="字典值:" prop="code">
-            <el-input
-              clearable
-              :disabled="isUpdate"
-              :maxlength="20"
-              v-model="form.code"
-              placeholder="请输入字典值"
-            />
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="应用类型:" prop="appType">
-            <el-radio-group v-model="form.appType">
-              <el-radio :label="1">业务字典</el-radio>
-              <el-radio :label="2">数据字典</el-radio>
-            </el-radio-group>
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="是否启用:" prop="enable">
-            <el-radio-group v-model="form.enable">
-              <el-radio :label="1">是</el-radio>
-              <el-radio :label="0">否</el-radio>
-            </el-radio-group>
-          </el-form-item>
-        </el-col>
-        <!-- <el-col :span="12">
-          <el-form-item label="排序号:" prop="sortNumber">
-            <el-input-number
-              :min="0"
-              :max="9999"
-              v-model="form.sortNumber"
-              controls-position="right"
-              placeholder="请输入排序号"
-              class="ele-fluid ele-text-left"
-            />
-          </el-form-item>
-        </el-col> -->
-
-        <el-col :span="24">
-          <el-form-item label="备注:">
-            <el-input
-              :rows="4"
-              type="textarea"
-              :maxlength="200"
-              v-model="form.remark"
-              placeholder="请输入备注"
-            />
-          </el-form-item>
-        </el-col>
-      </el-row>
-    </el-form>
-    <div class="divider">
-      <div class="title">
-        <div class="ele-bg-primary"></div>
-        <span>字典项配置</span>
-      </div>
-      <div class="ele-bg-primary" style="width: 100%; height: 2px"></div>
-    </div>
-    <div style="margin: 5px 0">
-      <el-button
-        size="small"
-        type="primary"
-        icon="el-icon-plus"
-        class="ele-btn-icon"
-        @click="pushArr"
-      >
-        添加
-      </el-button>
-
-      <!-- <el-button
-        size="small"
-        type="danger"
-        icon="el-icon-delete"
-        class="ele-btn-icon"
-        @click="removeArr"
-      >
-        删除
-      </el-button> -->
-    </div>
-    <el-table
-      :data="tableData"
-      border
-      style="width: 100%"
-      @selection-change="handleSelectionChange"
-    >
-      <el-table-column prop="code" label="字典项编码">
-        <template slot-scope="scope">
-          <el-input
-            @blur="checkedValue(scope.row.code)"
-            v-model="scope.row.code"
-            placeholder=""
-          ></el-input>
-        </template>
-      </el-table-column>
-      <el-table-column prop="name" label="字典项名称">
-        <template slot-scope="scope">
-          <el-input v-model="scope.row.name" placeholder=""></el-input>
-        </template>
-      </el-table-column>
-      <el-table-column prop="sort" label="排序">
-        <template slot-scope="scope">
-          <el-input
-            v-model="scope.row.sort"
-            @input="
-              scope.row.sort = String(scope.row.sort).replace(/[^\d]/g, '')
-            "
-          ></el-input>
-        </template>
-      </el-table-column>
-      <el-table-column prop="enable" label="启用">
-        <template slot-scope="scope">
-          <el-radio-group v-model="scope.row.enable">
-            <el-radio :label="1">是</el-radio>
-            <el-radio :label="0">否</el-radio>
-          </el-radio-group>
-        </template>
-      </el-table-column>
-      <el-table-column align="center" label="操作">
-        <template slot-scope="scope">
-          <el-popconfirm
-            class="ele-action"
-            title="确定要删除此字典项吗?"
-            @confirm="removeArr(scope)"
-          >
-            <template v-slot:reference>
-              <el-link type="danger" :underline="false" icon="el-icon-delete">
-                删除
-              </el-link>
-            </template>
-          </el-popconfirm>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <template v-slot:footer>
-      <el-button @click="updateVisible(false)">取消</el-button>
-      <el-button type="primary" :loading="loading" @click="save">
-        保存
-      </el-button>
-    </template>
-  </ele-modal>
-</template>
-
-<script>
-  import { addDictionary, updateDictionary } from '@/api/system/dictionary';
-  import {
-    pageDictionaryData,
-    removeDictionaryData,
-    removeDictionaryDataBatch
-  } from '@/api/system/dictionary-data';
-
-  export default {
-    props: {
-      // 弹窗是否打开
-      visible: Boolean,
-      // 修改回显的数据
-      id: String | Number
-    },
-    data() {
-      const defaultForm = {
-        name: '',
-        code: '',
-        appType: 1,
-        enable: 1,
-        remark: '',
-        dictStaticSubmitPOList: []
-      };
-      return {
-        defaultForm,
-        // 表单数据
-        form: { ...defaultForm },
-        // form: {
-        //   name: '',
-        //   code: '',
-        //   appType: 1,
-        //   enable: 1,
-        //   remark: ''
-        // },
-        // 表单验证规则
-        rules: {
-          name: [
-            {
-              required: true,
-              message: '请输入字典名称',
-              trigger: 'blur'
-            }
-          ],
-          code: [
-            {
-              required: true,
-              message: '请输入字典值',
-              trigger: 'blur'
-            }
-          ],
-          appType: [
-            {
-              required: true,
-              message: '请选择应用类型',
-              trigger: 'blur'
-            }
-          ],
-          enable: [
-            {
-              required: true,
-              message: '请选择是否启用',
-              trigger: 'blur'
-            }
-          ],
-          sort: [
-            {
-              required: true,
-              message: '请输入排序号',
-              trigger: 'blur'
-            }
-          ]
-        },
-        // 表格列配置
-        columns: [
-          {
-            columnKey: 'selection',
-            type: 'selection',
-            width: 45,
-            align: 'center'
-          },
-          {
-            columnKey: 'index',
-            type: 'index',
-            width: 45,
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'code',
-            label: '字典编码',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'name',
-            label: '字典名称',
-
-            showOverflowTooltip: true
-          },
-          // {
-          //   prop: 'appType',
-          //   label: '字典类型',
-
-          //   showOverflowTooltip: true,
-          //   minWidth: 110
-          // },
-          {
-            prop: 'appType',
-            label: '应用类型',
-
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'remark',
-            label: '描述',
-
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'createTime',
-            label: '创建时间',
-
-            showOverflowTooltip: true,
-            minWidth: 110,
-            formatter: (_row, _column, cellValue) => {
-              return this.$util.toDateString(cellValue);
-            }
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 130,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
-          }
-        ],
-        tableData: [],
-        // 表格选中数据
-        selection: [],
-        datasource: {
-          list: []
-        },
-        // 提交状态
-        loading: false,
-        // 是否是修改
-        isUpdate: false,
-        delectId: 1
-      };
-    },
-    created() {},
-
-    methods: {
-      pushArr() {
-        this.form.dictStaticSubmitPOList.push({
-          code: '',
-          enable: 1,
-          name: '',
-          sort: '',
-          delectId: this.delectId
-        });
-        this.delectId = this.delectId + 1;
-        this.filterArr();
-      },
-      //
-      checkedValue(val) {
-        console.log(val);
-      },
-      removeArr(row) {
-        console.log(row);
-        if (row.row.id) {
-          this.form.dictStaticSubmitPOList.forEach((item) => {
-            if (item.id === row.row.id) {
-              item.deleted = 1;
-            }
-          });
-          this.filterArr();
-        } else {
-          let index = this.form.dictStaticSubmitPOList.findIndex(
-            (item) => item.delectId === row.row.delectId
-          );
-          console.log(index);
-          this.form.dictStaticSubmitPOList.splice(index, 1); // 在数组的指定位置移除对应的元素。 返回移除的
-          this.filterArr();
-        }
-
-        // let falg = this.form.dictStaticSubmitPOList[row.$index].deleted === 0;
-        // if (falg) {
-        //   this.form.dictStaticSubmitPOList[row.$index].deleted = 1;
-        //   this.filterArr();
-        // } else {
-        //   this.form.dictStaticSubmitPOList.splice(row.$index, 1);
-        //   this.filterArr();
-        // }
-      },
-      handleSelectionChange() {},
-      /* 保存编辑 */
-      save() {
-        this.$refs.form.validate((valid) => {
-          if (!valid) {
-            return false;
-          }
-          let falg = this.form.dictStaticSubmitPOList.some(
-            (item, index) => item.code.length === 0
-          );
-          if (falg) {
-            this.$message({
-              message: '字典项编码不能为空',
-              type: 'warning'
-            });
-            return;
-          }
-          this.form.dictStaticSubmitPOList.forEach((item, index) => {
-            if (item.delectId) {
-              delete item.delectId;
-            }
-          });
-
-          this.loading = true;
-          const saveOrUpdate = this.isUpdate ? updateDictionary : addDictionary;
-          saveOrUpdate(this.form)
-            .then((msg) => {
-              this.loading = false;
-              this.$message.success(msg);
-              this.updateVisible(false);
-              this.$emit('done');
-            })
-            .catch((e) => {
-              this.loading = false;
-              // // this.$message.error(e.message);
-            });
-        });
-      },
-      filterArr() {
-        this.tableData = this.form.dictStaticSubmitPOList.filter(
-          (item) => item.deleted !== 1
-        );
-      },
-      /* 更新visible */
-      updateVisible(value) {
-        this.$emit('update:visible', value);
-      },
-
-      async getDetail() {
-        const res = await pageDictionaryData(this.id);
-        this.form = res.data.dictInfoVO;
-
-        this.form.dictStaticSubmitPOList = res.data.dictStaticVOList;
-        if (this.form.dictStaticSubmitPOList.length > 0) {
-          this.filterArr();
-        } else {
-          this.tableTata = [];
-        }
-      }
-    },
-    watch: {
-      visible(visible) {
-        if (visible) {
-          if (this.id) {
-            // this.$util.assignObject(this.form, this.data);
-            this.isUpdate = true;
-            this.getDetail();
-          } else {
-            this.isUpdate = false;
-          }
-        } else {
-          this.$refs.form.clearValidate();
-          this.form = { ...this.defaultForm };
-          this.form.dictStaticSubmitPOList = []; // clear the list of the dictionary static push button. 描述变化的字段不会在push后
-          this.tableData = []; // clear the list of the dictionary static push button. 描述变化的字段不会在push后。
-        }
-      }
-    }
-  };
-</script>
-<style lang="scss" scoped>
-  .divider {
-    margin-bottom: 20px;
-
-    .title {
-      display: flex;
-      align-items: center;
-      margin-bottom: 10px;
-      div {
-        width: 8px;
-        height: 20px;
-        margin-right: 10px;
-      }
-      span {
-        font-size: 20px;
-      }
-    }
-  }
-</style>

+ 19 - 36
src/views/material/product/components/dict-data-search.vue → src/views/material/product/components/product-search.vue

@@ -1,50 +1,35 @@
 <!-- 搜索表单 -->
 <template>
   <el-form
-    size="small"
     label-width="77px"
     class="ele-form-search"
     @keyup.enter.native="search"
     @submit.native.prevent
   >
     <el-row :gutter="10">
-      <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
-        <el-form-item label="编码">
-          <el-input
-            clearable
-            size="small"
-            v-model="where.code"
-            placeholder="请输入"
-          />
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 4 }">
+        <el-form-item label="产品编码">
+          <el-input clearable v-model="where.code" placeholder="请输入" />
         </el-form-item>
       </el-col>
-      <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
-        <el-form-item label="名称">
-          <el-input
-            clearable
-            size="small"
-            v-model="where.name"
-            placeholder="请输入"
-          />
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 4 }">
+        <el-form-item label="产品名称">
+          <el-input clearable v-model="where.name" placeholder="请输入" />
         </el-form-item>
       </el-col>
-      <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
-        <el-form-item label="应用类型">
-          <el-select v-model="where.appType" placeholder="请选择">
-            <el-option
-              v-for="item in options"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value"
-            >
-            </el-option>
-          </el-select>
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 4 }">
+        <el-form-item label="牌号">
+          <el-input clearable v-model="where.name" placeholder="请输入" />
         </el-form-item>
       </el-col>
-      <el-col v-bind="styleResponsive ? { md: 12 } : { span: 4 }">
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 4 }">
+        <el-form-item label="型号">
+          <el-input clearable v-model="where.name" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
         <el-form-item>
           <el-button
-            size="small"
             type="primary"
             icon="el-icon-search"
             class="ele-btn-icon"
@@ -60,8 +45,6 @@
             size="medium"
             >重置</el-button
           >
-
-          <slot></slot>
         </el-form-item>
       </el-col>
     </el-row>
@@ -70,7 +53,7 @@
 
 <script>
   export default {
-    data() {
+    data () {
       // 默认表单数据
       const defaultWhere = {
         name: '',
@@ -90,20 +73,20 @@
     },
     computed: {
       // 是否开启响应式布局
-      styleResponsive() {
+      styleResponsive () {
         return this.$store.state.theme.styleResponsive;
       }
     },
     methods: {
       /* 搜索 */
-      search() {
+      search () {
         if (this.where.appType === 0) {
           this.where.appType = '';
         }
         this.$emit('search', this.where);
       },
       /*  重置 */
-      reset() {
+      reset () {
         this.where = { ...this.defaultWhere };
         this.search();
       }

+ 64 - 90
src/views/material/product/index.vue

@@ -1,82 +1,51 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never">
-      <DictDataSearch @search="reload" />
-      <div style="margin: 5px 0; padding-left: 262px">
-        <el-button
-          size="small"
-          type="primary"
-          icon="el-icon-plus"
-          class="ele-btn-icon"
-          @click="openEdit()"
-        >
-          添加
-        </el-button>
-        <!-- <el-button
-          size="small"
-          type="warning"
-          icon="el-icon-edit"
-          class="ele-btn-icon"
-          :disabled="!current"
-          @click="openEdit(current)"
-        >
-          修改
-        </el-button> -->
-        <el-button
-          size="small"
-          type="danger"
-          icon="el-icon-delete"
-          class="ele-btn-icon"
-          :disabled="!current"
-          @click="remove"
-        >
-          删除
-        </el-button>
-      </div>
+      <ProductSearch @search="reload" />
       <ele-split-layout
         width="244px"
         allow-collapse
         :right-style="{ overflow: 'hidden' }"
       >
+        <div class="ele-border-lighter split-layout-right-content">
+          <AssetTree ref="assetTreeRef" id="9" />
+        </div>
         <!-- 表格 -->
-        <ele-pro-table
-          ref="table"
-          :columns="columns"
-          :datasource="datasource"
-          height="calc(100vh - 350px)"
-          :need-page="false"
-          :toolkit="[]"
-          :current.sync="current"
-          highlight-current-row
-          class="dict-table"
-          tool-class="ele-toolbar-actions"
-          @done="done"
-        >
-          <!-- 表头工具栏 -->
-          <template v-slot:toolbar> </template>
-        </ele-pro-table>
-
         <template v-slot:content>
-          <!-- 数据字典项列表 -->
-          <dict-data ref="dictData" v-if="current" :dict-id="current.id" />
+          <ele-pro-table
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            height="calc(100vh - 350px)"
+            :need-page="false"
+            :toolkit="[]"
+            :current.sync="current"
+            highlight-current-row
+            class="dict-table"
+            tool-class="ele-toolbar-actions"
+            @done="done"
+          >
+            <!-- 表头工具栏 -->
+            <template v-slot:toolbar> </template>
+            <template v-slot:action>
+              <el-link>编辑</el-link>
+            </template>
+          </ele-pro-table>
         </template>
       </ele-split-layout>
     </el-card>
-    <!-- 编辑弹窗 -->
-    <dict-edit :visible.sync="showEdit" @done="reload" />
   </div>
 </template>
 
 <script>
-  import DictData from './components/dict-data.vue';
-  import DictEdit from './components/dict-edit.vue';
-  import DictDataSearch from './components/dict-data-search.vue';
+  import AssetTree from '@/components/AssetTree';
+  import ProductSearch from './components/product-search.vue';
   import { listDictionaries, removeDictionary } from '@/api/system/dictionary';
 
   export default {
     name: 'SystemDictionary',
-    components: { DictData, DictEdit, DictDataSearch },
-    data() {
+    components: { AssetTree, ProductSearch },
+    data () {
       return {
         // 表格列配置
         columns: [
@@ -89,8 +58,38 @@
           },
           {
             prop: 'name',
-            label: '字典名称',
+            label: '产品编码',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '产品名称',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '牌号',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '型号',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '计量单位',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '包装单位',
             showOverflowTooltip: true
+          },
+          {
+            action: 'action',
+            slot: 'action',
+            label: '操作'
           }
         ],
         // 当前编辑数据
@@ -104,28 +103,28 @@
 
     methods: {
       /* 表格数据源 */
-      datasource() {
+      datasource () {
         // return;
         return listDictionaries();
       },
       /* 表格渲染完成回调 */
-      done(res) {
+      done (res) {
         if (res.data?.length) {
           this.$refs.table.setCurrentRow(res.data[0]);
         }
       },
       /* 刷新表格 */
-      reload(where) {
+      reload (where) {
         this.$refs.table.reload();
         this.$refs.dictData.reload(where);
       },
       /* 显示编辑 */
-      openEdit(row) {
+      openEdit (row) {
         this.editData = row;
         this.showEdit = true;
       },
       /* 删除 */
-      remove() {
+      remove () {
         this.$confirm('确定要删除选中的字典吗?', '提示', {
           type: 'warning'
         })
@@ -157,29 +156,4 @@
   };
 </script>
 
-<style lang="scss" scoped>
-  .dict-table {
-    :deep(.el-table__row) {
-      cursor: pointer;
-    }
-
-    :deep(.el-table__row > td:last-child:after) {
-      content: '\e6e0';
-      font-family: element-icons !important;
-      font-style: normal;
-      font-variant: normal;
-      text-transform: none;
-      -webkit-font-smoothing: antialiased;
-      -moz-osx-font-smoothing: grayscale;
-      line-height: 1;
-      position: absolute;
-      right: 10px;
-      top: 50%;
-      margin-top: -7px;
-    }
-
-    :deep(.el-table__row > td:last-child .cell) {
-      padding-right: 20px;
-    }
-  }
-</style>
+<style lang="scss" scoped></style>

+ 78 - 0
src/views/material/productLinkMaterial/components/link-material-dialog.vue

@@ -0,0 +1,78 @@
+<template>
+  <el-dialog :visible.sync="visible" title="">
+    <el-row :gutter="20">
+      <el-col :span="12">
+        <headerTitle>
+          <template v-slot:title>
+            可选
+            <el-button type="primary" size="small">关联</el-button>
+            <el-button type="primary" size="small" icon="icon-search"
+              >搜索</el-button
+            >
+          </template>
+        </headerTitle>
+        <el-form label-width="60px">
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="分类">
+                <el-input placeholder="请输入"></el-input> </el-form-item
+            ></el-col>
+            <el-col :span="12">
+              <el-form-item label="编码">
+                <el-input placeholder="请输入"></el-input></el-form-item
+            ></el-col>
+            <el-col :span="12">
+              <el-form-item label="名称">
+                <el-input placeholder="请输入"></el-input></el-form-item
+            ></el-col>
+            <el-col :span="12">
+              <el-form-item label="型号">
+                <el-input placeholder="请输入"></el-input></el-form-item
+            ></el-col>
+          </el-row>
+        </el-form>
+        <ele-pro-table
+          ref="table"
+          :columns="columns"
+          :datasource="[]"
+          height="calc(100vh - 350px)"
+          :need-page="false"
+        >
+        </ele-pro-table>
+      </el-col>
+      <el-col :span="12">
+        <headerTitle
+          ><template v-slot:title
+            >已关联
+            <el-button type="primary" size="small">取消关联</el-button>
+            <el-button type="primary" size="small" icon="icon-search"
+              >搜索</el-button
+            ></template
+          ></headerTitle
+        ></el-col
+      >
+    </el-row>
+  </el-dialog>
+</template>
+
+<script>
+  export default {
+    data () {
+      return {
+        visible: true,
+        columns: []
+      };
+    },
+    methods: {
+      open (type, row) {
+        switch (type) {
+          case value:
+            break;
+
+          default:
+            break;
+        }
+      }
+    }
+  };
+</script>

+ 95 - 0
src/views/material/productLinkMaterial/components/product-search.vue

@@ -0,0 +1,95 @@
+<!-- 搜索表单 -->
+<template>
+  <el-form
+    label-width="77px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row :gutter="10">
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 4 }">
+        <el-form-item label="产品编码">
+          <el-input clearable v-model="where.code" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 4 }">
+        <el-form-item label="产品名称">
+          <el-input clearable v-model="where.name" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 4 }">
+        <el-form-item label="牌号">
+          <el-input clearable v-model="where.name" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 4 }">
+        <el-form-item label="型号">
+          <el-input clearable v-model="where.name" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
+        <el-form-item>
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+          >
+            查询
+          </el-button>
+
+          <el-button
+            @click="reset"
+            icon="el-icon-refresh"
+            class="ele-btn-icon"
+            size="medium"
+            >重置</el-button
+          >
+        </el-form-item>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  export default {
+    data () {
+      // 默认表单数据
+      const defaultWhere = {
+        name: '',
+        code: '',
+        appType: ''
+      };
+      return {
+        options: [
+          { value: 0, label: '全部' },
+          { value: 1, label: '业务字典' },
+          { value: 2, label: '数据字典' }
+        ],
+        defaultWhere,
+        // 表单数据
+        where: { ...defaultWhere }
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive () {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    methods: {
+      /* 搜索 */
+      search () {
+        if (this.where.appType === 0) {
+          this.where.appType = '';
+        }
+        this.$emit('search', this.where);
+      },
+      /*  重置 */
+      reset () {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      }
+    }
+  };
+</script>

+ 171 - 0
src/views/material/productLinkMaterial/index.vue

@@ -0,0 +1,171 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <ProductSearch @search="reload" />
+      <ele-split-layout
+        width="244px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
+        <div class="ele-border-lighter split-layout-right-content">
+          <AssetTree ref="assetTreeRef" id="9" />
+        </div>
+        <!-- 表格 -->
+        <template v-slot:content>
+          <ele-pro-table
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            height="calc(100vh - 350px)"
+            :need-page="false"
+            :current.sync="current"
+            highlight-current-row
+            class="dict-table"
+            tool-class="ele-toolbar-actions"
+          >
+            <!-- 表头工具栏 -->
+            <template v-slot:toolbar>
+              <el-button type="primary" @click="handleLink(1)"
+                >关联设备</el-button
+              >
+              <el-button type="primary" @click="handleLink(2)"
+                >关联模具</el-button
+              >
+              <el-button type="primary" @click="handleLink(3)"
+                >关联舟皿</el-button
+              >
+            </template>
+            <template v-slot:action>
+              <el-link>编辑</el-link>
+            </template>
+          </ele-pro-table>
+        </template>
+      </ele-split-layout>
+    </el-card>
+    <linkMaterialDialog ref="linkMaterialDialogRef" />
+  </div>
+</template>
+
+<script>
+  import AssetTree from '@/components/AssetTree';
+  import ProductSearch from './components/product-search.vue';
+  import linkMaterialDialog from './components/link-material-dialog.vue';
+  import { listDictionaries, removeDictionary } from '@/api/system/dictionary';
+
+  export default {
+    name: 'SystemDictionary',
+    components: { AssetTree, ProductSearch, linkMaterialDialog },
+    data () {
+      return {
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 45,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '产品编码',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '产品名称',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '牌号',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '型号',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '计量单位',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '包装单位',
+            showOverflowTooltip: true
+          },
+          {
+            action: 'action',
+            slot: 'action',
+            label: '操作'
+          }
+        ],
+        // 当前编辑数据
+        current: null,
+        // 是否显示编辑弹窗
+        showEdit: false,
+        // 编辑回显数据
+        editData: null
+      };
+    },
+
+    methods: {
+      /* 表格数据源 */
+      datasource () {
+        // return;
+        return listDictionaries();
+      },
+      handleLink (type) {
+        console.log(this.current, 'handleLink');
+        if (!this.current) {
+          return this.$message.error('请选择产品!');
+        }
+
+        this.$refs.linkMaterialDialogRef.open(type, this.current);
+      },
+      /* 刷新表格 */
+      reload (where) {
+        this.$refs.table.reload();
+        this.$refs.dictData.reload(where);
+      },
+      /* 显示编辑 */
+      openEdit (row) {
+        this.editData = row;
+        this.showEdit = true;
+      },
+      /* 删除 */
+      remove () {
+        this.$confirm('确定要删除选中的字典吗?', '提示', {
+          type: 'warning'
+        })
+          .then(() => {
+            if (this.$refs.dictData.selection.length == 0) {
+              this.$message({
+                message: '当前未选择数据',
+                type: 'error'
+              });
+              return;
+            }
+            let ids = this.$refs.dictData.selection.map((item) => item.id);
+            const loading = this.$loading({ lock: true });
+
+            removeDictionary(ids, true)
+              .then((msg) => {
+                loading.close();
+                this.$message.success(msg);
+                this.reload();
+              })
+              .catch((e) => {
+                loading.close();
+                // this.$message.error(e.message);
+              });
+          })
+          .catch(() => {});
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 2 - 2
vue.config.js

@@ -31,11 +31,11 @@ module.exports = {
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
-        target: 'http://192.168.3.51:18086', // 测试
+        // target: 'http://192.168.3.51:18086', // 测试
         // target: 'http://192.168.3.35:8080', // kang杨威
         // target: 'http://192.168.3.25:8080', // 黄峥嵘
         // target: 'http://192.168.3.41:8080', // 何江鹏
-        // target: 'http://192.168.3.33:8080', // 谢一平
+        target: 'http://192.168.3.33:8080', // 谢一平
         // target: 'http://192.168.3.64:8080', // 粟勋
         // target: 'http://192.168.3.34:8080', // 刘毅勋
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域