lupeng 10 месяцев назад
Родитель
Сommit
d9fd0770d9

+ 2 - 2
src/views/device/allocate/index.vue

@@ -62,7 +62,7 @@
       width="850px"
       @close="dialog.visible = false"
     >
-      <device-page @device-info="deviceInfo" />
+      <device-page @device-info="deviceInfo" :operate="operate" />
     </el-dialog>
 
     <el-dialog
@@ -527,6 +527,7 @@ const test = () => {
   isShowTable.value = true;
   tableType.value = tableType.value == 1 ? 2 : 1;
 };
+const operate = ref("allocate");
 const permission = reactive({
   delBtn: checkPerm(ButtonPermKeys.DEVICE.BTNS.allocate_del),
   addBtn: checkPerm(ButtonPermKeys.DEVICE.BTNS.allocate_add),
@@ -985,7 +986,6 @@ option.value = Object.assign(option.value, {
     },
   ],
 });
-
 onMounted(() => {
   dataList();
   queryUserList();

+ 51 - 42
src/views/device/instance/components/device-page.vue

@@ -1,17 +1,17 @@
 <template>
   <div class="mainContentBox">
     <avue-crud
-        ref="crudRef"
-        v-model:search="search"
-        v-model="form"
-        :data="data"
-        :option="option"
-        v-model:page="page"
-        @row-click="rowClick"
-        @search-change="searchChange"
-        @search-reset="resetChange"
-        @size-change="dataList"
-        @current-change="dataList"
+      ref="crudRef"
+      v-model:search="search"
+      v-model="form"
+      :data="data"
+      :option="option"
+      v-model:page="page"
+      @row-click="rowClick"
+      @search-change="searchChange"
+      @search-reset="resetChange"
+      @size-change="dataList"
+      @current-change="dataList"
     >
     </avue-crud>
   </div>
@@ -32,7 +32,8 @@ const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
     src: "/api/v1/device",
   });
-const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } = Methords; //增删改查
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+  Methords; //增删改查
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const { checkBtnPerm, downloadTemplate } = Utils; //按钮权限等工具
 const props = defineProps({
@@ -40,14 +41,20 @@ const props = defineProps({
     type: String,
     default: () => {
       return 0;
-    }
-  }
-})
+    },
+  },
+  operate: {
+    type: String,
+    default: () => {
+      return "";
+    },
+  },
+});
 const crudRef = ref(null); //crudRef.value 获取avue-crud对象
-const emit = defineEmits(["deviceInfo"])
-const rowClick = (row)=>{
-  emit("deviceInfo", row)
-}
+const emit = defineEmits(["deviceInfo"]);
+const rowClick = (row) => {
+  emit("deviceInfo", row);
+};
 
 // 设置表格列或者其他自定义的option
 option.value = Object.assign(option.value, {
@@ -63,7 +70,7 @@ option.value = Object.assign(option.value, {
       label: "资产编号",
       prop: "deviceNo",
       search: true,
-      width: '120',
+      width: "120",
       rules: [
         {
           required: true,
@@ -76,7 +83,7 @@ option.value = Object.assign(option.value, {
       label: "设备名称",
       prop: "deviceName",
       search: true,
-      width: '120',
+      width: "120",
       rules: [
         {
           required: true,
@@ -88,45 +95,43 @@ option.value = Object.assign(option.value, {
 
     {
       label: "负责人",
-      width: '100',
+      width: "100",
       prop: "head",
     },
     {
       label: "存放位置",
-      width: '150',
+      width: "150",
       prop: "devicePosition",
     },
     {
       label: "型号",
-      width: '150',
+      width: "150",
       prop: "specifications",
     },
     {
       label: "制造厂",
-      width: '150',
+      width: "150",
       prop: "brand",
     },
-      {
-          label: "原值",
-          prop: "originalValue",
-          width: 100,
-          overHidden: true,
-      },
-      {
-          label: "出厂编号",
-          prop: "serialNumber",
-          width: 100,
-          overHidden: true,
-      },
+    {
+      label: "原值",
+      prop: "originalValue",
+      width: 100,
+      overHidden: true,
+    },
+    {
+      label: "出厂编号",
+      prop: "serialNumber",
+      width: 100,
+      overHidden: true,
+    },
     {
       label: "设备类型",
       prop: "deviceType",
       type: "select",
       search: true,
-      width: '100',
-      dicUrl:
-        dictDataUtil.request_url +
-        dictDataUtil.TYPE_CODE.device_type,
+      width: "100",
+      dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.device_type,
       props: {
         label: "dictLabel",
         value: "dictValue",
@@ -136,9 +141,13 @@ option.value = Object.assign(option.value, {
 });
 
 onMounted(() => {
-  if(props.deviceType!=null){
+  console.log("aaa", props.operate);
+  if (props.deviceType != null) {
     search.value.deviceType = props.deviceType;
   }
+  if (props.operate != null) {
+    search.value.operate = props.operate;
+  }
   dataList();
 });
 </script>

+ 2 - 1
src/views/device/maintenance/index.vue

@@ -73,7 +73,7 @@
       width="850px"
       @close="dialog.visible = false"
     >
-      <device-page @device-info="deviceInfo" />
+      <device-page @device-info="deviceInfo" :operate="operate" />
     </el-dialog>
 
     <el-dialog
@@ -219,6 +219,7 @@ const permission = reactive({
   editBtn: checkPerm(ButtonPermKeys.DEVICE.BTNS.maintenance_edit),
   menu: true,
 });
+const operate = ref("maintenance");
 const dialog = reactive({
   title: "设备选择",
   visible: false,

+ 2 - 1
src/views/device/repair/index.vue

@@ -49,7 +49,7 @@
       width="850px"
       @close="dialog.visible = false"
     >
-      <device-page @device-info="deviceInfo" />
+      <device-page @device-info="deviceInfo" :operate="operate" />
     </el-dialog>
 
     <el-dialog
@@ -606,6 +606,7 @@ const maintenanceSubmit1 = () => {
     }
   });
 };
+const operate = ref("repair");
 const maintenanceSubmit2 = () => {
   //alert(JSON.stringify(maintenanceInfo.value))
   maintenanceInfoForm2.value.validate((isValid, invalidFields) => {