Procházet zdrojové kódy

修改组织架构和计量管理

huang_an před 1 rokem
rodič
revize
8aa4468bf5

+ 15 - 0
package-lock.json

@@ -27,6 +27,7 @@
         "echarts-wordcloud": "^2.0.0",
         "el-tree-transfer": "^2.4.7",
         "ele-admin": "^1.11.2",
+        "element-tree-line": "^0.2.1",
         "element-ui": "2.15.7",
         "github-markdown-css": "^5.1.0",
         "highlight.js": "9.18.5",
@@ -6217,6 +6218,14 @@
       "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.603.tgz",
       "integrity": "sha512-Dvo5OGjnl7AZTU632dFJtWj0uJK835eeOVQIuRcmBmsFsTNn3cL05FqOyHAfGQDIoHfLhyJ1Tya3PJ0ceMz54g=="
     },
+    "node_modules/element-tree-line": {
+      "version": "0.2.1",
+      "resolved": "https://registry.npmmirror.com/element-tree-line/-/element-tree-line-0.2.1.tgz",
+      "integrity": "sha512-YWHftDSOFiBuw49drxJV7Yi7pCqPpwBBBeQmySjchcxU3uUOAu72FDLK5RyTGJ5qt4Ci+yoUg7zJqsFP5u7N5A==",
+      "peerDependencies": {
+        "vue": "^2.6.11 || ^3.2.0"
+      }
+    },
     "node_modules/element-ui": {
       "version": "2.15.7",
       "resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.15.7.tgz",
@@ -21806,6 +21815,12 @@
       "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.603.tgz",
       "integrity": "sha512-Dvo5OGjnl7AZTU632dFJtWj0uJK835eeOVQIuRcmBmsFsTNn3cL05FqOyHAfGQDIoHfLhyJ1Tya3PJ0ceMz54g=="
     },
+    "element-tree-line": {
+      "version": "0.2.1",
+      "resolved": "https://registry.npmmirror.com/element-tree-line/-/element-tree-line-0.2.1.tgz",
+      "integrity": "sha512-YWHftDSOFiBuw49drxJV7Yi7pCqPpwBBBeQmySjchcxU3uUOAu72FDLK5RyTGJ5qt4Ci+yoUg7zJqsFP5u7N5A==",
+      "requires": {}
+    },
     "element-ui": {
       "version": "2.15.7",
       "resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.15.7.tgz",

+ 37 - 0
src/api/ruleManagement/meteringManagement.js

@@ -0,0 +1,37 @@
+import request from '@/utils/request';
+
+// 计量列表
+export async function getCategorymeasureList(params) {
+  const res = await request.get(`/main/categorymeasure/list`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 保存计量单位和分类
+export async function saveCategorymeasure(data) {
+  const res = await request.post(`/main/categorymeasure/save`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 修改计量单位和分类
+export async function updateCategorymeasure(data) {
+  const res = await request.put(`/main/categorymeasure/update`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 查询计量单位和分类详情
+export async function getCategorymeasureDetails(id) {
+  const res = await request.get(`/main/categorymeasure/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 271 - 261
src/views/enterpriseModel/dept/components/org-edit.vue

@@ -11,13 +11,8 @@
     <el-form ref="form" :model="form" :rules="rules" label-width="140px">
       <el-row :gutter="15">
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
-          <el-form-item label="编码:">
-            <el-input
-              clearable
-              :maxlength="20"
-              v-model="form.groupCode"
-              :disabled="true"
-            />
+          <el-form-item label="编码:" prop="groupCode">
+            <el-input clearable :maxlength="20" v-model="form.groupCode" />
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
@@ -60,7 +55,6 @@
               @focus="addOpen"
               @clear="clearManagerFirst"
               v-model="managerFirst.name"
-
               placeholder="请选择"
               clearable
             ></el-input>
@@ -317,276 +311,292 @@
 </template>
 
 <script>
-import OrgSelect from './org-select.vue';
-import OrgTypeSelect from './org-type-select.vue';
-import staffSelection from './staffSelection.vue';
-import fileUpload from '@/components/upload/fileUpload';
-import AreaSelect from '@/views/enterpriseModel/regionalManage/components/area-cascader.vue';
-import addUser from '@/views/system/user/components/add.vue';
+  import OrgSelect from './org-select.vue';
+  import OrgTypeSelect from './org-type-select.vue';
+  import staffSelection from './staffSelection.vue';
+  import fileUpload from '@/components/upload/fileUpload';
+  import AreaSelect from '@/views/enterpriseModel/regionalManage/components/area-cascader.vue';
+  import addUser from '@/views/system/user/components/add.vue';
 
-const defEnterprise = {
-  businessLicenseFile: [],
-  name: null,
-  address: null,
-  tel: '',
-  registerDate: '',
-  unifiedSocialCreditCode: '',
-  businessScope: '',
-  mainProduct: '',
-  remark: '',
-  fax: ''
-};
-const defFactoryForm = {
-  id: '',
-  code: '',
-  name: '',
-  groupId: '',
-  areaId: '',
-  areaName: '',
-  extInfo: {
-    principalDep: '', // 负责人部门
-    location: [],
-    locationDetail: ''
-  },
+  const defEnterprise = {
+    businessLicenseFile: [],
+    name: null,
+    address: null,
+    tel: '',
+    registerDate: '',
+    unifiedSocialCreditCode: '',
+    businessScope: '',
+    mainProduct: '',
+    remark: '',
+    fax: ''
+  };
+  const defFactoryForm = {
+    id: '',
+    code: '',
+    name: '',
+    groupId: '',
+    areaId: '',
+    areaName: '',
+    extInfo: {
+      principalDep: '', // 负责人部门
+      location: [],
+      locationDetail: ''
+    },
 
-  areaIdList: [],
-  enabled: 1,
-  parentId: 0,
-  leaderId: '',
-  type: 1 //  FACTORY(1, "工厂"), WORKSHOP_PLAN(2, "厂房"), WORKSHOP(3, "车间"), LINE(4, "厂线");
-};
-import {
-  addOrganization,
-  updateOrganization,
-  getById,
-  getCode
-} from '@/api/system/organization';
-import { basicAreaPageAPI } from '@/api/regionalManage';
-import { cityDataLabel } from 'ele-admin/packages/utils/regions';
+    areaIdList: [],
+    enabled: 1,
+    parentId: 0,
+    leaderId: '',
+    type: 1 //  FACTORY(1, "工厂"), WORKSHOP_PLAN(2, "厂房"), WORKSHOP(3, "车间"), LINE(4, "厂线");
+  };
+  import {
+    addOrganization,
+    updateOrganization,
+    getById,
+    getCode
+  } from '@/api/system/organization';
+  import { basicAreaPageAPI } from '@/api/regionalManage';
+  import { cityDataLabel } from 'ele-admin/packages/utils/regions';
 
-export default {
-  components: {
-    OrgSelect,
-    OrgTypeSelect,
-    staffSelection,
-    fileUpload,
-    AreaSelect,
-    addUser
-  },
-  props: {
-    // 弹窗是否打开
-    visible: Boolean,
-    // 修改回显的数据
-    data: Object,
-    // 上级id
-    parentId: [Number, String],
-    // 机构数据
-    organizationList: Array
-  },
-  data() {
-    const defaultForm = {
-      id: null,
-      parentId: null,
-      name: '',
-      type: '',
-      sort: null,
-      status: 1,
-      manager: [],
-      groupCode: '',
-      managerFirst: []
-    };
-    return {
-      defaultForm,
-      responsibleName: '',
-      // 表单数据
-      form: { ...defaultForm },
-      enterprise: { ...defEnterprise },
-      factoryForm: {
-        ...defFactoryForm
-      },
-      managerFirst:{},
-      cityDataLabel,
-      // 表单验证规则
-      rules: {
-        name: [{ required: true, message: '请输入机构名称', trigger: 'blur' }],
-        manager: [{ required: true, message: '请选择负责人', trigger: 'blur' }],
-        type: [{ required: true, message: '请选择机构类型', trigger: 'blur' }]
-      },
-      // 表单验证规则
-      enterpriseRules: {
-        name: [{ required: true, message: '请输入企业名称', trigger: 'blur' }],
-        address: [
-          { required: true, message: '请输入企业地址', trigger: 'blur' }
-        ],
-        unifiedSocialCreditCode: [
-          { required: true, message: '请输入统一社会性代码', trigger: 'blur' }
-        ]
-      },
-      // 提交状态
-      loading: false,
-      // 是否是修改
-      isUpdate: false
-    };
-  },
-  computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
-    }
-  },
-  created() {
-    this.getBasicAreaList();
-  },
-  methods: {
-    /* 保存编辑 */
-    async save() {
-      if (!(await this.formValidate())) {
-        return false;
-      }
-      if (
-        ['10', '20'].includes(this.form.type) &&
-        !(await this.enterpriseValidate())
-      ) {
-        return false;
-      }
-      let form = {
-        ...this.form
+  export default {
+    components: {
+      OrgSelect,
+      OrgTypeSelect,
+      staffSelection,
+      fileUpload,
+      AreaSelect,
+      addUser
+    },
+    props: {
+      // 弹窗是否打开
+      visible: Boolean,
+      // 修改回显的数据
+      data: Object,
+      // 上级id
+      parentId: [Number, String],
+      // 机构数据
+      organizationList: Array
+    },
+    data() {
+      const defaultForm = {
+        id: null,
+        parentId: null,
+        name: '',
+        type: '',
+        sort: null,
+        status: 1,
+        manager: [],
+        groupCode: '',
+        managerFirst: []
       };
-      if (['10', '20'].includes(this.form.type)) {
-        form['enterprise'] = this.enterprise;
-      }
-      this.loading = true;
-      const data = {
-        ...form,
-        parentId: this.form.parentId || 0
+      return {
+        defaultForm,
+        responsibleName: '',
+        // 表单数据
+        form: { ...defaultForm },
+        enterprise: { ...defEnterprise },
+        factoryForm: {
+          ...defFactoryForm
+        },
+        managerFirst: {},
+        cityDataLabel,
+        // 表单验证规则
+        rules: {
+          groupCode: [
+            { required: true, message: '请输入编码', trigger: 'blur' }
+          ],
+          name: [
+            { required: true, message: '请输入机构名称', trigger: 'blur' }
+          ],
+          manager: [
+            { required: true, message: '请选择负责人', trigger: 'blur' }
+          ],
+          type: [{ required: true, message: '请选择机构类型', trigger: 'blur' }]
+        },
+        // 表单验证规则
+        enterpriseRules: {
+          name: [
+            { required: true, message: '请输入企业名称', trigger: 'blur' }
+          ],
+          address: [
+            { required: true, message: '请输入企业地址', trigger: 'blur' }
+          ],
+          unifiedSocialCreditCode: [
+            { required: true, message: '请输入统一社会性代码', trigger: 'blur' }
+          ]
+        },
+        // 提交状态
+        loading: false,
+        // 是否是修改
+        isUpdate: false
       };
-      if (!this.isUpdate) {
-        delete data.id;
-      }
-      if(this.managerFirst?.name){
-        this.form.managerFirst[0]=this.managerFirst
-      }
-      const saveOrUpdate = this.isUpdate ? updateOrganization : addOrganization;
-      saveOrUpdate(data)
-        .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);
-        });
     },
-    formValidate() {
-      return new Promise((resolve, reject) => {
-        this.$refs.form.validate((valid) => {
-          resolve(valid);
-        });
-      });
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
     },
-    getAreaInfo(nodeInfo) {
-      this.factoryForm.areaName = nodeInfo[0]?.pathLabels.join('/') || '';
-      this.factoryForm.areaId = this.factoryForm.areaId || '';
+    created() {
+      this.getBasicAreaList();
     },
-    enterpriseValidate() {
-      return new Promise((resolve, reject) => {
-        this.$refs.enterpriseForm.validate((valid) => {
-          resolve(valid);
+    methods: {
+      /* 保存编辑 */
+      async save() {
+        if (!(await this.formValidate())) {
+          return false;
+        }
+        if (
+          ['10', '20'].includes(this.form.type) &&
+          !(await this.enterpriseValidate())
+        ) {
+          return false;
+        }
+        let form = {
+          ...this.form
+        };
+        if (['10', '20'].includes(this.form.type)) {
+          form['enterprise'] = this.enterprise;
+        }
+        this.loading = true;
+        const data = {
+          ...form,
+          parentId: this.form.parentId || 0
+        };
+        if (!this.isUpdate) {
+          delete data.id;
+        }
+        if (this.managerFirst?.name) {
+          this.form.managerFirst[0] = this.managerFirst;
+        }
+        const saveOrUpdate = this.isUpdate
+          ? updateOrganization
+          : addOrganization;
+        saveOrUpdate(data)
+          .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);
+          });
+      },
+      formValidate() {
+        return new Promise((resolve, reject) => {
+          this.$refs.form.validate((valid) => {
+            resolve(valid);
+          });
         });
-      });
-    },
-    /* 获取区域集合 */
-    async getBasicAreaList() {
-      this.areaList = await basicAreaPageAPI({
-        pageNum: 1,
-        size: 9999
-      });
-      this.areaTreeList = this.$util.toTreeData({
-        data: this.areaList,
-        idField: 'id',
-        parentIdField: 'parentId'
-      });
-    },
-    //选择负责人
-    confirmStaffSelection(data) {
-      this.form.manager = JSON.parse(JSON.stringify(data));
-      this.responsibleName = data.map((item) => item.name).toString();
-    },
-    addOpen() {
-      this.$refs.addUserRef.open();
-    },
-    clearManagerFirst(){
-      this.managerFirst={}
-    },
-    userBk(data) {
-      this.managerFirst = data;
-    },
-    openStaffSelection() {
-      console.log(this.form.manager);
-      this.$refs.staffSelection.open(
-        JSON.parse(JSON.stringify(this.form.manager)) || []
-      );
-    },
-    /* 更新visible */
-    updateVisible(value) {
-      this.$emit('update:visible', value);
-    }
-  },
-  watch: {
-    form: {
-      deep: true,
-      handler(n) {
-        this.enterprise.name = n.name;
-        this.factoryForm.name = n.name;
+      },
+      getAreaInfo(nodeInfo) {
+        this.factoryForm.areaName = nodeInfo[0]?.pathLabels.join('/') || '';
+        this.factoryForm.areaId = this.factoryForm.areaId || '';
+      },
+      enterpriseValidate() {
+        return new Promise((resolve, reject) => {
+          this.$refs.enterpriseForm.validate((valid) => {
+            resolve(valid);
+          });
+        });
+      },
+      /* 获取区域集合 */
+      async getBasicAreaList() {
+        this.areaList = await basicAreaPageAPI({
+          pageNum: 1,
+          size: 9999
+        });
+        this.areaTreeList = this.$util.toTreeData({
+          data: this.areaList,
+          idField: 'id',
+          parentIdField: 'parentId'
+        });
+      },
+      //选择负责人
+      confirmStaffSelection(data) {
+        this.form.manager = JSON.parse(JSON.stringify(data));
+        this.responsibleName = data.map((item) => item.name).toString();
+      },
+      addOpen() {
+        this.$refs.addUserRef.open();
+      },
+      clearManagerFirst() {
+        this.managerFirst = {};
+      },
+      userBk(data) {
+        this.managerFirst = data;
+      },
+      openStaffSelection() {
+        console.log(this.form.manager);
+        this.$refs.staffSelection.open(
+          JSON.parse(JSON.stringify(this.form.manager)) || []
+        );
+      },
+      /* 更新visible */
+      updateVisible(value) {
+        this.$emit('update:visible', value);
       }
     },
-    visible(visible) {
-      if (visible) {
-        if (this.data) {
-          getById(this.data.id).then((res) => {
-            for (const key in res.enterprise) {
-              this.$set(this.enterprise, key, res.enterprise[key]);
-            }
-            for (const key in res) {
-              if (key == 'parentId') {
-                this.$set(this.form, key, res[key] == 0 ? '' : res[key] ?? '');
+    watch: {
+      form: {
+        deep: true,
+        handler(n) {
+          this.enterprise.name = n.name;
+          this.factoryForm.name = n.name;
+        }
+      },
+      visible(visible) {
+        if (visible) {
+          if (this.data) {
+            getById(this.data.id).then((res) => {
+              for (const key in res.enterprise) {
+                this.$set(this.enterprise, key, res.enterprise[key]);
               }
-              if (key != 'enterprise') {
-                this.$set(this.form, key, res[key]);
+              for (const key in res) {
+                if (key == 'parentId') {
+                  this.$set(
+                    this.form,
+                    key,
+                    res[key] == 0 ? '' : res[key] ?? ''
+                  );
+                }
+                if (key != 'enterprise') {
+                  this.$set(this.form, key, res[key]);
+                }
               }
-            }
 
-            this.form.type = '' + this.form.type; //回显
-            if(this.form?.managerFirst.length){
-              this.managerFirst=this.form.managerFirst[0]
-            }
-            this.responsibleName =
-              res.manager && res.manager.map((item) => item.name).toString();
-          });
+              this.form.type = '' + this.form.type; //回显
+              if (this.form?.managerFirst.length) {
+                this.managerFirst = this.form.managerFirst[0];
+              }
+              this.responsibleName =
+                res.manager && res.manager.map((item) => item.name).toString();
+            });
 
-          // this.form.type = '' + this.form.type; //回显
-          // this.responsibleName =
-          //   this.data.manager &&
-          //   this.data.manager.map((item) => item.name).toString();
-          this.isUpdate = true;
+            // this.form.type = '' + this.form.type; //回显
+            // this.responsibleName =
+            //   this.data.manager &&
+            //   this.data.manager.map((item) => item.name).toString();
+            this.isUpdate = true;
+          } else {
+            this.form.parentId = this.parentId;
+            getCode().then((res) => {
+              this.form.groupCode = res;
+            });
+            this.isUpdate = false;
+          }
         } else {
-          this.form.parentId = this.parentId;
-          getCode().then((res) => {
-            this.form.groupCode = res;
-          });
-          this.isUpdate = false;
+          this.$refs.form.clearValidate();
+          this.$refs.enterpriseForm &&
+            this.$refs.enterpriseForm.clearValidate();
+          this.form = { ...this.defaultForm };
+          this.enterprise = { ...defEnterprise };
+          this.managerFirst = {};
+          this.responsibleName = '';
         }
-      } else {
-        this.$refs.form.clearValidate();
-        this.$refs.enterpriseForm && this.$refs.enterpriseForm.clearValidate();
-        this.form = { ...this.defaultForm };
-        this.enterprise = { ...defEnterprise };
-        this.managerFirst={}
-        this.responsibleName = '';
       }
     }
-  }
-};
+  };
 </script>

+ 189 - 186
src/views/enterpriseModel/dept/index.vue

@@ -1,7 +1,6 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
-
       <!-- 数据表格 -->
       <ele-pro-table
         ref="table"
@@ -30,7 +29,7 @@
           <el-button class="ele-btn-icon" size="small" @click="foldAll">
             折叠全部
           </el-button>
-          <el-button type="primary" size="mini" icon="el-icon-upload2" plain @click="uploadFile">导入</el-button>
+          <!-- <el-button type="primary" size="mini" icon="el-icon-upload2" plain @click="uploadFile">导入</el-button> -->
         </template>
         <!-- 标题列 -->
         <template v-slot:name="{ row }">
@@ -105,209 +104,213 @@
       @done="reload"
     />
 
-    <importDialog :defModule="moudleName" ref="importDialogRef" @success="reload" />
+    <importDialog
+      :defModule="moudleName"
+      ref="importDialogRef"
+      @success="reload"
+    />
   </div>
 </template>
 
 <script>
+  import OrgEdit from './components/org-edit.vue';
+  import importDialog from '@/components/upload/import-dialog.vue';
 
-import OrgEdit from './components/org-edit.vue';
-import importDialog from "@/components/upload/import-dialog.vue";
+  import {
+    listOrganizations,
+    removeOrganization
+  } from '@/api/system/organization';
 
-import {
-  listOrganizations,
-  removeOrganization
-} from '@/api/system/organization';
-
-export default {
-  name: 'SystemOrganization',
-  components: {OrgEdit, importDialog},
-  data() {
-    return {
-      //模块名称
-      moudleName : "mainGroup",
-      // 加载状态
-      loading: false,
-      // 列表数据
-      data: [],
-      // 选中数据
-      current: null,
-      // 是否显示表单弹窗
-      showEdit: false,
-      // 编辑回显数据
-      editData: null,
-      // 上级id
-      parentId: null
-    };
-  },
-  computed: {
-    // 表格列配置
-    columns() {
-      return [
-        {
-          columnKey: 'index',
-          type: 'index',
-          width: 45,
-          align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          prop: 'groupCode',
-          label: '编码',
-          showOverflowTooltip: true,
-          minWidth: 150,
-        },
-        {
-          prop: 'name',
-          label: '部门名称',
-          showOverflowTooltip: true,
-          minWidth: 110,
-          slot: 'name'
-        },
-        {
-          prop: '',
-          label: '一级负责人',
-          showOverflowTooltip: true,
-          align: 'center',
-          formatter: (_row) => {
-            return _row.managerFirst&&_row.managerFirst.map(item => item.name).toString()
+  export default {
+    name: 'SystemOrganization',
+    components: { OrgEdit, importDialog },
+    data() {
+      return {
+        //模块名称
+        moudleName: 'mainGroup',
+        // 加载状态
+        loading: false,
+        // 列表数据
+        data: [],
+        // 选中数据
+        current: null,
+        // 是否显示表单弹窗
+        showEdit: false,
+        // 编辑回显数据
+        editData: null,
+        // 上级id
+        parentId: null
+      };
+    },
+    computed: {
+      // 表格列配置
+      columns() {
+        return [
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 45,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'groupCode',
+            label: '编码',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+          {
+            prop: 'name',
+            label: '部门名称',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            slot: 'name'
+          },
+          {
+            prop: '',
+            label: '一级负责人',
+            showOverflowTooltip: true,
+            align: 'center',
+            formatter: (_row) => {
+              return (
+                _row.managerFirst &&
+                _row.managerFirst.map((item) => item.name).toString()
+              );
+            },
+            minWidth: 110
           },
-          minWidth: 110,
-        },
-        {
-          prop: '',
-          label: '二级负责人',
-          showOverflowTooltip: true,
-          align: 'center',
-          formatter: (_row) => {
-            return _row.manager.map(item => item.name).toString()
+          {
+            prop: '',
+            label: '二级负责人',
+            showOverflowTooltip: true,
+            align: 'center',
+            formatter: (_row) => {
+              return _row.manager.map((item) => item.name).toString();
+            },
+            minWidth: 110
           },
-          minWidth: 110,
-        },
 
-        {
-          prop: 'sort',
-          label: '排序',
-          showOverflowTooltip: true,
-          align: 'center',
-          width: 60
-        },
-        {
-          prop: 'status',
-          label: '状态',
-          showOverflowTooltip: true,
-          align: 'center',
-          width: 80,
-          slot: 'status'
-        },
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          showOverflowTooltip: true,
-          align: 'center',
-          minWidth: 110,
-          formatter: (_row, _column, cellValue) => {
-            return this.$util.toDateString(cellValue);
+          {
+            prop: 'sort',
+            label: '排序',
+            showOverflowTooltip: true,
+            align: 'center',
+            width: 60
+          },
+          {
+            prop: 'status',
+            label: '状态',
+            showOverflowTooltip: true,
+            align: 'center',
+            width: 80,
+            slot: 'status'
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.$util.toDateString(cellValue);
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 190,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
           }
-        },
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 190,
-          align: 'center',
-          resizable: false,
-          slot: 'action',
-          showOverflowTooltip: true
-        }
-      ]
-    },
-  },
-  created() {
-    //this.query();
-  },
-  methods: {
-    /* 查询 */
-    async datasource() {
-
-      const data = await listOrganizations()
-      this.data = this.$util.toTreeData({
-        data: data,
-        idField: 'id',
-        parentIdField: 'parentId'
-      });
-      return this.data
-
-    },
-    /* 刷新表格 */
-    reload(where) {
-      this.$refs.table.reload();
-    },
-    /* 选择数据 */
-    onNodeClick(row) {
-      if (row) {
-        this.current = row;
-        this.parentId = row.id;
-        this.$refs.tree.setCurrentKey(row.id);
-      } else {
-        this.current = null;
-        this.parentId = null;
+        ];
       }
     },
-    /* 展开全部 */
-    expandAll() {
-      this.$refs.table.toggleRowExpansionAll(true);
-    },
-    /* 折叠全部 */
-    foldAll() {
-      this.$refs.table.toggleRowExpansionAll(false);
+    created() {
+      //this.query();
     },
-    /* 显示编辑 */
-    openEdit(item) {
-      this.editData = item;
-      this.showEdit = true;
-    },
-    /* 删除 */
-    remove(row) {
-      this.$confirm('确定要删除选中的机构吗?', '提示', {
-        type: 'warning'
-      }).then(() => {
-          const loading = this.$loading({lock: true});
-          removeOrganization([row.id])
-            .then((msg) => {
-              loading.close();
-              this.$message.success(msg);
-              this.reload();
-            })
-            .catch((e) => {
-              loading.close();
-              // this.$message.error(e.message);
-            });
-        })
-        .catch(() => {
+    methods: {
+      /* 查询 */
+      async datasource() {
+        const data = await listOrganizations();
+        this.data = this.$util.toTreeData({
+          data: data,
+          idField: 'id',
+          parentIdField: 'parentId'
         });
-    },
-    uploadFile () {
-      this.$refs.importDialogRef.open();
+        return this.data;
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload();
+      },
+      /* 选择数据 */
+      onNodeClick(row) {
+        if (row) {
+          this.current = row;
+          this.parentId = row.id;
+          this.$refs.tree.setCurrentKey(row.id);
+        } else {
+          this.current = null;
+          this.parentId = null;
+        }
+      },
+      /* 展开全部 */
+      expandAll() {
+        this.$refs.table.toggleRowExpansionAll(true);
+      },
+      /* 折叠全部 */
+      foldAll() {
+        this.$refs.table.toggleRowExpansionAll(false);
+      },
+      /* 显示编辑 */
+      openEdit(item) {
+        this.editData = item;
+        this.showEdit = true;
+      },
+      /* 删除 */
+      remove(row) {
+        this.$confirm('确定要删除选中的机构吗?', '提示', {
+          type: 'warning'
+        })
+          .then(() => {
+            const loading = this.$loading({ lock: true });
+            removeOrganization([row.id])
+              .then((msg) => {
+                loading.close();
+                this.$message.success(msg);
+                this.reload();
+              })
+              .catch((e) => {
+                loading.close();
+                // this.$message.error(e.message);
+              });
+          })
+          .catch(() => {});
+      },
+      uploadFile() {
+        this.$refs.importDialogRef.open();
+      }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.sys-organization-list {
-  height: calc(100vh - 264px);
-  box-sizing: border-box;
-  border-width: 1px;
-  border-style: solid;
-  overflow: auto;
-}
+  .sys-organization-list {
+    height: calc(100vh - 264px);
+    box-sizing: border-box;
+    border-width: 1px;
+    border-style: solid;
+    overflow: auto;
+  }
 
-.sys-organization-list :deep(.el-tree-node__content) {
-  height: 30px;
+  .sys-organization-list :deep(.el-tree-node__content) {
+    height: 30px;
 
-  & > .el-tree-node__expand-icon {
-    margin-left: 10px;
+    & > .el-tree-node__expand-icon {
+      margin-left: 10px;
+    }
   }
-}
 </style>

+ 125 - 49
src/views/rulesManagement/meteringManagement/dialog.vue → src/views/rulesManagement/meteringManagement/baseDialog.vue

@@ -1,46 +1,56 @@
 <template>
   <el-dialog
-    :title="`${type}统一门户`"
+    class="meteringManagementDialog"
+    :title="`${type}计量单位`"
     :visible.sync="dialogVisible"
-    width="20%"
+    width="60%"
   >
-    <el-form label-width="100px" class="zw-criterion">
+    <el-form label-width="100px" :model="formData" class="zw-criterion">
+      <div class="el-form-item checkbox">
+        <el-checkbox v-model="formData.checked">基准计量单位</el-checkbox>
+      </div>
       <el-form-item label="编码" required>
         <el-input
-          v-model="form.code"
+          v-model="formData.code"
           placeholder="请输入内容"
           disabled
         ></el-input>
       </el-form-item>
       <el-form-item label="名称" required>
-        <el-input v-model="form.name" placeholder="请输入内容"></el-input>
+        <el-input v-model="formData.name" placeholder="请输入内容"></el-input>
       </el-form-item>
       <el-form-item label="所属组别" required>
-        <template>
-          <el-select v-model="form.type" placeholder="请选择" disabled>
-            <el-option
-              v-for="item in typeOptions"
-              :label="item.label"
-              :value="item.value"
-              :key="item.value"
-            >
-            </el-option>
-          </el-select>
-        </template>
-      </el-form-item>
-      <el-form-item label="换算类型" required>
-        <el-input v-model="form.name" placeholder="请输入内容"></el-input>
-      </el-form-item>
-      <el-form-item label="精度" required>
         <el-input
-          v-model="form.sort"
-          type="number"
+          v-model="formData.name"
           placeholder="请输入内容"
+          disabled
         ></el-input>
       </el-form-item>
+      <el-form-item label="换算类型">
+        <el-select
+          v-model="formData.type"
+          :placeholder="`请选择${formData.type}`"
+          disabled
+        >
+          <el-option
+            v-for="item in typeOptions"
+            :label="item.label"
+            :value="item.value"
+            :key="item.value"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="精度" required>
+        <el-input-number
+          v-model="formData.precision"
+          :min="0"
+          :max="5"
+        ></el-input-number>
+      </el-form-item>
       <el-form-item label="舍入类型" required>
         <template>
-          <el-select v-model="form.type" placeholder="请选择">
+          <el-select v-model="formData.type" placeholder="请选择">
             <el-option
               v-for="item in options"
               :label="item.label"
@@ -53,7 +63,7 @@
       </el-form-item>
       <el-form-item label="数据状态" required>
         <template>
-          <el-select v-model="form.dataType" placeholder="请选择" disabled>
+          <el-select v-model="formData.dataType" placeholder="请选择" disabled>
             <el-option
               v-for="item in dataTypeOptions"
               :label="item.label"
@@ -64,8 +74,47 @@
           </el-select>
         </template>
       </el-form-item>
-      <el-form-item label="备注描述">
-        <el-input v-model="form.remark" placeholder="请输入内容"></el-input>
+      <el-form-item class="w100" label="换算关系">
+        <div class="top">
+          <div class="">换算分母</div>
+          <div class="unit">*</div>
+          <div>当前单位</div>
+          <div class="unit">=</div>
+          <div>换算分子</div>
+          <div class="unit">*</div>
+          <div>当前单位</div>
+        </div>
+        <div class="bottom">
+          <div
+            ><el-input-number
+              v-model="num1"
+              :precision="formData.precision"
+            ></el-input-number
+          ></div>
+          <div class="unit">*</div>
+          <div>
+            <DictSelection dictName="计量单位" v-model="formData.unit1" />
+          </div>
+          <div class="unit">=</div>
+          <div
+            ><el-input-number
+              v-model="num2"
+              :precision="formData.precision"
+            ></el-input-number
+          ></div>
+          <div class="unit">*</div>
+          <div
+            ><DictSelection dictName="计量单位" v-model="formData.unit2"
+          /></div>
+        </div>
+      </el-form-item>
+      <el-form-item class="w100" label="备注描述">
+        <el-input
+          type="textarea"
+          :rows="4"
+          v-model="formData.remark"
+          placeholder="请输入内容"
+        ></el-input>
       </el-form-item>
     </el-form>
     <div slot="footer" class="dialog-footer">
@@ -76,7 +125,6 @@
 </template>
 
 <script>
-  import { uploadFile } from '@/api/system/file/index.js';
   import { getImageUrl } from '@/utils/file';
   import {
     saveInfo,
@@ -86,6 +134,14 @@
   export default {
     data() {
       return {
+        precision: 2,
+        formData: {
+          type: 1,
+          precision: 2,
+          dataType: 1
+        },
+        num1: '',
+        num2: '',
         options: [
           {
             label: '四舍五入',
@@ -114,8 +170,7 @@
         ],
         dialogVisible: false,
         file: null,
-        type: '新增',
-        form: {}
+        type: '新增'
       };
     },
     methods: {
@@ -179,24 +234,45 @@
 </script>
 
 <style lang="scss" scoped>
-  .typeSelect {
-    width: 100%;
-  }
-  .avatar-uploader {
-    height: 120px;
-    width: 100%;
-  }
-  .avatar {
-    width: 120px;
-    height: 120px;
-    object-fit: cover;
-  }
-  .avatar-uploader-icon {
-    width: 120px;
-    height: 120px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    border: 1px dashed #d9d9d9;
+  .meteringManagementDialog {
+    .typeSelect {
+      width: 100%;
+    }
+    :deep(.el-select) {
+      width: 100%;
+    }
+    :deep(.el-form-item) {
+      width: 48%;
+      display: inline-block;
+      margin-right: 1%;
+      .top {
+        display: flex;
+        > div {
+          flex: 1;
+          min-width: 0;
+        }
+        .unit {
+          flex: 0 0 30px;
+          text-align: center;
+        }
+      }
+      .bottom {
+        display: flex;
+        > div {
+          flex: 1;
+          min-width: 0;
+        }
+        .unit {
+          flex: 0 0 30px;
+          text-align: center;
+        }
+      }
+    }
+    .checkbox {
+      text-align: center;
+    }
+    .w100 {
+      width: 99% !important;
+    }
   }
 </style>

+ 63 - 12
src/views/rulesManagement/meteringManagement/index.vue

@@ -3,7 +3,15 @@
     <div class="mian">
       <div class="tree_box">
         <div class="control">
-          <el-button icon="el-icon-plus" type="primary">新增</el-button>
+          <el-button icon="el-icon-plus" type="primary" @click="addType('新增')"
+            >新增</el-button
+          >
+          <el-button icon="el-icon-edit" type="success" @click="addType('修改')"
+            >修改</el-button
+          >
+          <el-button icon="el-icon-delete" type="danger" @click="deleted()"
+            >删除</el-button
+          >
         </div>
         <el-tree
           class="tree"
@@ -12,7 +20,7 @@
           node-key="id"
           :expand-on-click-node="false"
           :default-expand-all="true"
-          :data="data"
+          :data="typeList"
           :props="defaultProps"
           @node-click="handleNodeClick"
         ></el-tree>
@@ -31,6 +39,8 @@
           <ele-pro-table
             ref="table"
             :columns="columns"
+            :initLoad="false"
+            :needPage="false"
             :datasource="datasource"
           >
             <!-- 表头工具栏 -->
@@ -40,7 +50,7 @@
                 type="primary"
                 icon="el-icon-plus"
                 class="ele-btn-icon"
-                @click="openEdit('add')"
+                @click="openEdit('新增')"
               >
                 新增
               </el-button>
@@ -49,15 +59,20 @@
         </div>
       </div>
     </div>
+    <baseDialog ref="baseDialogRef" @reload="getPages"></baseDialog>
+    <typeDialog ref="typeDialogRef" @reload="getTypeList"></typeDialog>
   </div>
 </template>
 
 <script>
-  import Dialog from './dialog.vue';
+  import { getCategorymeasureList } from '@/api/ruleManagement/meteringManagement.js';
+  import baseDialog from './baseDialog.vue';
+  import typeDialog from './typeDialog.vue';
   export default {
-    components: { Dialog },
+    components: { baseDialog, typeDialog },
     data() {
       return {
+        currentId: '',
         // 表格列配置
         columns: [
           {
@@ -90,17 +105,17 @@
             code: 'bao'
           }
         ],
-        data: [
+        typeList: [
           {
-            label: '包(bao)',
+            label: '长度(length)',
             children: []
           },
           {
-            label: '件(jian)',
+            label: '数量(quantity)',
             children: []
           },
           {
-            label: '盒(he)',
+            label: '重量(weight)',
             children: []
           }
         ],
@@ -110,15 +125,51 @@
         }
       };
     },
+    async created() {
+      this.getTypeList(); // 获取侧边栏分类列表
+      this.getPages(); // 获取表格数据列表
+    },
     methods: {
+      async getTypeList() {
+        this.typeList = await getCategorymeasureList({ parentId: 0 });
+        this.this.getPages();
+      },
+      addType(type) {
+        if (type == '新增') {
+          this.$refs.typeDialogRef.open(type);
+        } else {
+          this.$refs.typeDialogRef.open(type, this.currentId);
+        }
+      },
+      deleted() {
+        this.$confirm('是否确认删除?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            this.$message({
+              type: 'success',
+              message: '删除成功!'
+            });
+          })
+          .catch(() => {});
+      },
+      getPages(where) {
+        this.$refs.table.reload(where);
+      },
       datasource({ page, limit, where, order }) {
-        return this.tableData;
+        return getCategorymeasureList({
+          ...where
+        });
       },
       handleNodeClick(data) {
+        this.currentId = data.id;
         console.log(data);
       },
       openEdit() {
-        console.log('新增');
+        this.type = '新增';
+        this.$refs.baseDialogRef.open(this.type);
       }
     }
   };
@@ -136,7 +187,7 @@
       border-radius: 4px;
       display: flex;
       .tree_box {
-        flex: 0 0 200px;
+        flex: 0 0 240px;
         background-color: #fff;
         margin-right: 10px;
         display: flex;

+ 75 - 0
src/views/rulesManagement/meteringManagement/typeDialog.vue

@@ -0,0 +1,75 @@
+<template>
+  <el-dialog
+    class="typeDialog"
+    :title="`${type}计量分类`"
+    :visible.sync="dialogVisible"
+    width="25%"
+  >
+    <el-form label-width="100px" class="zw-criterion">
+      <el-form-item label="分类编码" required>
+        <el-input
+          v-model="formData.code"
+          placeholder="请输入内容"
+          disabled
+        ></el-input>
+      </el-form-item>
+      <el-form-item label="分类名称" required>
+        <el-input v-model="formData.name" placeholder="请输入内容"></el-input>
+      </el-form-item>
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <el-button size="small" @click="dialogVisible = false">关 闭</el-button>
+      <el-button size="small" @click="config" type="primary">确 定</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import {
+    saveCategorymeasure,
+    updateCategorymeasure,
+    getCategorymeasureDetails
+  } from '@/api/ruleManagement/meteringManagement.js';
+  import { getCode } from '@/api/codeManagement';
+  export default {
+    data() {
+      return {
+        dialogVisible: false,
+        formData: {},
+        type: '新增'
+      };
+    },
+    methods: {
+      handleClose() {
+        this.dialogVisible = false;
+      },
+      async open(type, id) {
+        if (type == '新增') {
+          this.formData.code = await getCode('metrological_code');
+        } else {
+          this.formData = await getCategorymeasureDetails(id);
+        }
+        this.type = type;
+        this.dialogVisible = true;
+      },
+      async config() {
+        if (!this.formData.name) {
+          return this.$message.error('请输入分类名称');
+        }
+        if (this.type == '新增') {
+          saveCategorymeasure({ ...this.formData, parentId: 0 }).then(() => {
+            this.$message.success('新增成功');
+            this.dialogVisible = false;
+            this.$emit('reload');
+          });
+        } else {
+          updateCategorymeasure({ ...this.formData }).then(() => {
+            this.$message.success('修改成功');
+            this.dialogVisible = false;
+            this.$emit('reload');
+          });
+        }
+      }
+    }
+  };
+</script>

+ 13 - 5
src/views/system/unifiedPortal/dialog.vue

@@ -4,7 +4,7 @@
     :visible.sync="dialogVisible"
     width="25%"
   >
-    <el-form label-width="120px" class="zw-criterion">
+    <el-form label-width="120px" class="zw-criterion" :model="form">
       <el-form-item label="图标(比例1:1)" required>
         <!-- <el-upload
           class="avatar-uploader"
@@ -76,7 +76,6 @@
 
 <script>
   import { uploadFile } from '@/api/system/file/index.js';
-  import { getImageUrl } from '@/utils/file';
   import {
     saveInfo,
     updateInfo,
@@ -88,7 +87,10 @@
         dialogVisible: false,
         file: null,
         type: '新增',
-        form: {},
+        form: {
+          linkType: '1',
+          architType: '1'
+        },
         imageUrl: '',
         options: [
           {
@@ -113,13 +115,19 @@
       async open(type, id) {
         this.type = type;
         if (type == '新增') {
-          this.form = {};
+          this.form = {
+            linkType: '1',
+            architType: '1'
+          };
           this.imageUrl = '';
           this.file = null;
         } else {
           this.file = null;
           this.form = await getDetails(id);
-          this.imageUrl = getImageUrl(this.form.iconPath);
+          this.imageUrl =
+            window.location.origin +
+            '/api/main/file/getFile?objectName=' +
+            this.form.iconPath;
         }
         this.dialogVisible = true;
       },

+ 4 - 2
src/views/system/unifiedPortal/index.vue

@@ -90,10 +90,12 @@
               this.getDictValue('架构分类', String(item.architType)) || '',
             linkTypeName:
               this.getDictValue('链接分类', String(item.linkType)) || '',
-            img: getImageUrl(item.iconPath)
+            img:
+              window.location.origin +
+              '/api/main/file/getFile?objectName=' +
+              item.iconPath
           };
         });
-        console.log(this.list);
       },
       add() {
         this.type = '新增';

+ 1 - 1
vue.config.js

@@ -33,7 +33,7 @@ module.exports = {
       '/api': {
         // target: 'http://192.168.1.124:50001',
         // target: 'http://192.168.1.147:18086',
-        target: 'http://192.168.1.125:18086',
+        target: 'http://192.168.1.116:18086',
         // target: 'http://192.168.1.176:18086',
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 262 - 249
yarn.lock


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů