Bläddra i källkod

前置工单更改为多选

qinhb 7 månader sedan
förälder
incheckning
fd88e1cc19

+ 3 - 1
src/views/plan/order/index.vue

@@ -319,7 +319,9 @@ const permission = reactive({
 const crudRef = ref(null); //crudRef.value 获取avue-crud对象
 option.value = {
   border: true,
-  searchIndex: 3,
+  index: true, //是否显示第几项
+  indexLabel: "序号",
+  indexWidth: "55px",
   searchIcon: true,
   editBtn: false,
   delBtn: false,

+ 38 - 11
src/views/plan/workOrder/components/work-order-page.vue

@@ -7,12 +7,19 @@
       :data="data"
       :option="option"
       v-model:page="page"
-      @row-click="rowClick"
+      @row-click="clickItem"
       @search-change="searchChange"
       @search-reset="resetChange"
       @size-change="dataList"
       @current-change="dataList"
-    />
+      @selection-change="selectionChange"
+    >
+      <template #footer>
+        <div v-if="multipleKey" style="width:60px;height:35px;float:right;margin-top: 15px;">
+          <el-button type="primary" @click="onSelected"> 确定 </el-button>
+        </div>
+      </template>
+    </avue-crud>
   </div>
 </template>
 <script setup>
@@ -26,10 +33,25 @@ const test = () => {
   isShowTable.value = true;
   tableType.value = tableType.value == 1 ? 2 : 1;
 };
+const props = defineProps({
+  queryType: {
+    type: String,
+    default: () => {
+      return "0";
+    },
+  },
+  multipleKey:{
+    type: String,
+    default: ()=>{
+      return null;
+    }
+  }
+});
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
     src: "/api/v1/plan/workOrder",
+    multipleSelectKey: props.multipleKey,
   });
 const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
   Methords; //增删改查
@@ -41,18 +63,22 @@ const emit = defineEmits(["orderInfo"]);
 const rowClick = (row) => {
   emit("orderInfo", row);
 };
-const props = defineProps({
-  queryType: {
-    type: String,
-    default: () => {
-      return "0";
-    },
-  },
-});
+const multipleKeyVal = ref(null)
+
+const onSelected = () => {
+  emit("orderInfo", toDeleteIds.value);
+};
+const clickItem = (row)=>{
+  if(!props.multipleKey){
+    rowClick(row)
+  }
+}
+
+
 // 设置表格列或者其他自定义的option
 option.value = Object.assign(option.value, {
   delBtn: false,
-  selection: false,
+  selection: props.multipleKey ? true : false,
   search: false,
   editBtn: false,
   addBtn: false,
@@ -227,6 +253,7 @@ option.value = Object.assign(option.value, {
 });
 
 onMounted(() => {
+  multipleKeyVal.value = props.multipleKey
   search.value.queryType = String(props.queryType);
   dataList();
 });

+ 5 - 2
src/views/plan/workOrder/index.vue

@@ -294,7 +294,7 @@
       width="950px"
       @close="dialog7.visible = false"
     >
-      <work-order-page queryType="2" @order-info="workOrderInfoClick" />
+      <work-order-page queryType="2" @order-info="workOrderInfoClick" multipleKey="workOrderCode"/>
     </el-dialog>
   </div>
 </template>
@@ -528,7 +528,9 @@ const handleSubmit = () => {
   });
 };
 const workOrderInfoClick = (value) => {
-  form.value.frontWorkOrderCode = value.workOrderCode;
+  if(value){
+    form.value.frontWorkOrderCode = value.join(',');
+  }
   dialog7.visible = false;
 };
 const orderInfo = (value) => {
@@ -797,6 +799,7 @@ option.value = Object.assign(option.value, {
       prop: "frontWorkOrderCode",
       width: "100",
       display: false,
+      overHidden: true,
       rules: [
         {
           required: true,