Переглянути джерело

Merge branch 'master' of http://192.168.101.4:3000/jiaxiaoqiang/JG-ADMIN-TEMP

jiaxiaoqiang 1 рік тому
батько
коміт
81be7bedac

+ 4 - 0
src/common/configs/dictDataUtil.ts

@@ -10,6 +10,10 @@ const DictDataUtil = {
     plan_order_priority: "plan_order_priority",
     //订单状态
     plan_order_state: "plan_order_state",
+    //设备类型
+    device_type: "device_type",
+    //设备状态
+    device_status: "device_status"
   },
   EXPAND_FIELD_TABLE: {
     //映射表列表

+ 104 - 0
src/views/device/allocate/index.vue

@@ -0,0 +1,104 @@
+<template>
+  <div class="mainContentBox">
+    <avue-crud
+      ref="crudRef"
+      v-model:search="search"
+      v-model="form"
+      :data="data"
+      :option="option"
+      v-model:page="page"
+      @row-save="createRow"
+      @row-update="updateRow"
+      @row-del="deleteRow"
+      @selection-change="selectionChange"
+    >
+      <template #menu-left="{ size }">
+        <el-button
+          :disabled="toDeleteIds.length < 1"
+          type="danger"
+          icon="el-icon-delete"
+          :size="size"
+          @click="multipleDelete"
+          >删除</el-button
+        >
+      </template>
+    </avue-crud>
+  </div>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+import ButtonPermKeys from "@/common/configs/buttonPermission";
+
+import { useCommonStoreHook } from "@/store";
+import dictDataUtil from "@/common/configs/dictDataUtil";
+const { isShowTable, tableType } = toRefs(useCommonStoreHook());
+const test = () => {
+  isShowTable.value = true;
+  tableType.value = tableType.value == 1 ? 2 : 1;
+};
+
+// 传入一个url,后面不带/
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+  useCrud({
+    src: "/api/v1/sys/alias",
+  });
+const { dataList, createRow, updateRow, deleteRow } = Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+const { checkBtnPerm } = Utils; //按钮权限等工具
+// checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
+// const permission = reactive({
+//   delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
+//   addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
+//   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
+//   menu: true,
+// });
+
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  delBtn: false,
+  selection: true,
+  column: [
+    {
+      label: "所属模块",
+      prop: "tableType",
+      search: true,
+      type: "select",
+      dicUrl:
+        dictDataUtil.request_url +
+        dictDataUtil.EXPAND_FIELD_TABLE.expand_table_list,
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
+    },
+    {
+      label: "拓展字段",
+      prop: "field",
+      type: "select",
+      dicUrl:
+        dictDataUtil.request_url +
+        dictDataUtil.EXPAND_FIELD_TABLE.expand_field_list,
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
+    },
+    {
+      label: "页面显示",
+      prop: "label",
+    },
+    {
+      label: "排序",
+      prop: "fieldSort",
+    },
+  ],
+});
+
+onMounted(() => {
+  // console.log("crudRef", crudRef)
+  dataList();
+});
+</script>

+ 131 - 0
src/views/device/instance/index.vue

@@ -0,0 +1,131 @@
+<template>
+  <div class="mainContentBox">
+    <avue-crud
+      ref="crudRef"
+      v-model:search="search"
+      v-model="form"
+      :data="data"
+      :option="option"
+      v-model:page="page"
+      @row-save="createRow"
+      @row-update="updateRow"
+      @row-del="deleteRow"
+      @selection-change="selectionChange"
+    >
+      <template #menu-left="{ size }">
+        <el-button
+          :disabled="toDeleteIds.length < 1"
+          type="danger"
+          icon="el-icon-delete"
+          :size="size"
+          @click="multipleDelete"
+          >删除</el-button
+        >
+      </template>
+    </avue-crud>
+  </div>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+import ButtonPermKeys from "@/common/configs/buttonPermission";
+
+import { useCommonStoreHook } from "@/store";
+import dictDataUtil from "@/common/configs/dictDataUtil";
+const { isShowTable, tableType } = toRefs(useCommonStoreHook());
+const test = () => {
+  isShowTable.value = true;
+  tableType.value = tableType.value == 1 ? 2 : 1;
+};
+
+// 传入一个url,后面不带/
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+  useCrud({
+    src: "/api/v1/device",
+  });
+const { dataList, createRow, updateRow, deleteRow } = Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+const { checkBtnPerm } = Utils; //按钮权限等工具
+// checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
+// const permission = reactive({
+//   delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
+//   addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
+//   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
+//   menu: true,
+// });
+
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  delBtn: false,
+  selection: true,
+  column: [
+    {
+      label: "设备编号",
+      prop: "deviceNo",
+      search: true
+    },
+    {
+      label: "设备名称",
+      prop: "deviceName",
+      search: true
+    },
+    {
+      label: "设备类型",
+      prop: "deviceType",
+      type: "select",
+      search: true,
+      dicUrl:
+        dictDataUtil.request_url +
+        dictDataUtil.TYPE_CODE.device_type,
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
+    },
+    {
+      label: "设备状态",
+      prop: "state",
+      type: "select",
+      search: true,
+      dicUrl:
+          dictDataUtil.request_url +
+          dictDataUtil.TYPE_CODE.device_status,
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
+    },
+    {
+      label: "供应厂商",
+      prop: "manufacturer",
+    },
+    {
+      label: "所在车间",
+      prop: "workshop",
+    },
+    {
+      label: "所在工位",
+      prop: "station",
+    },
+    {
+      label: "负责人",
+      prop: "head",
+    },
+    {
+      label: "规格",
+      prop: "specifications",
+    },
+    {
+      label: "品牌",
+      prop: "brand",
+    },
+  ],
+});
+
+onMounted(() => {
+  // console.log("crudRef", crudRef)
+  dataList();
+});
+</script>

+ 11 - 12
src/views/system/dict/components/dict-item.vue

@@ -33,7 +33,7 @@ const props = defineProps({
 watch(
   () => props.typeCode,
   (newVal: string) => {
-    queryParams.typeCode = newVal;
+    queryParams.dictCode = newVal;
     formData.dictCode = newVal;
     resetQuery();
   }
@@ -49,7 +49,7 @@ const total = ref(0);
 const queryParams = reactive<DictQuery>({
   pageNo: 1,
   pageSize: 10,
-  typeCode: props.typeCode,
+  dictCode: props.typeCode,
 });
 
 const dictList = ref<DictPageVO[]>();
@@ -74,7 +74,7 @@ const rules = reactive({
  * 查询
  */
 function handleQuery() {
-  if (queryParams.typeCode) {
+  if (queryParams.dictCode) {
     loading.value = true;
     getDictPage(queryParams)
       .then(({ data }) => {
@@ -108,13 +108,11 @@ function handleSelectionChange(selection: any) {
  *
  * @param dictId 字典ID
  */
-function openDialog(dictId?: number) {
+function openDialog(form?: any) {
   dialog.visible = true;
-  if (dictId) {
+  if (form) {
     dialog.title = "修改字典";
-    getDictFormData(dictId).then(({ data }) => {
-      Object.assign(formData, data);
-    });
+    Object.assign(formData, form);
   } else {
     dialog.title = "新增字典";
   }
@@ -245,9 +243,10 @@ onMounted(() => {
         <el-table-column type="selection" width="50" />
         <el-table-column label="字典名称" prop="dictLabel" />
         <el-table-column label="字典值" prop="dictValue" />
+        <el-table-column label="排序" prop="dictSort" />
         <el-table-column label="状态" align="center">
           <template #default="scope">
-            <el-tag v-if="scope.row.state === 1" type="success">启用</el-tag>
+            <el-tag v-if="scope.row.state === 0" type="success">启用</el-tag>
             <el-tag v-else type="info">禁用</el-tag>
           </template>
         </el-table-column>
@@ -257,7 +256,7 @@ onMounted(() => {
               v-hasPerm="[ButtonPermKeys.SYSTEM.BTNS.dict_edit]"
               type="primary"
               link
-              @click="openDialog(scope.row.id)"
+              @click="openDialog(scope.row)"
               ><i-ep-edit />编辑</el-button
             >
             <el-button
@@ -309,8 +308,8 @@ onMounted(() => {
         </el-form-item>
         <el-form-item label="状态" prop="status">
           <el-radio-group v-model="formData.state">
-            <el-radio :value="1">正常</el-radio>
-            <el-radio :value="0">停用</el-radio>
+            <el-radio :value=0>正常</el-radio>
+            <el-radio :value=1>停用</el-radio>
           </el-radio-group>
         </el-form-item>
         <el-form-item label="备注" prop="remark">