Przeglądaj źródła

车间管理增加所属工厂查询

hezhanp 9 miesięcy temu
rodzic
commit
d458aead2e

+ 110 - 59
src/views/workOrder/components/order-search.vue

@@ -102,6 +102,26 @@
           </el-date-picker>
         </el-form-item>
       </el-col>
+
+      <el-col v-bind="styleResponsive ? { lg: 5, md: 7 } : { span: 3 }">
+        <el-form-item label="所属工厂:">
+          <el-select
+            size="mini"
+            v-model="where.parentId"
+            placeholder="请选择"
+            clearable
+            class="ele-block"
+          >
+            <el-option
+              v-for="item in options_factory"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
       <!--      <el-col v-bind="styleResponsive ? { lg: 6, md: 6 } : { span: 6 }">-->
       <!--        <el-form-item label="组织机构:">-->
       <!--          <auth-selection-->
@@ -121,6 +141,7 @@
           />
         </el-form-item>
       </el-col>
+
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <div class="ele-form-actions">
           <el-button
@@ -237,71 +258,101 @@
 </template>
 
 <script>
-  export default {
-    props: [],
-    data() {
-      // 默认表单数据
-      const defaultWhere = {
-        keyWord: '',
-        code: '',
-        productionPlanCode: '',
-        produceRoutingName: '',
-        productCode: '',
-        productName: '',
-        brandNo: '',
-        model: '',
+import { getFactoryarea } from '@/api/saleOrder';
+export default {
+  props: {},
+  data() {
+    // 默认表单数据
+    const defaultWhere = {
+      keyWord: '',
+      code: '',
+      productionPlanCode: '',
+      produceRoutingName: '',
+      productCode: '',
+      productName: '',
+      brandNo: '',
+      model: '',
+      parentId: '',
+      status: '',
+      createTime: []
+    };
 
-        status: '',
-        createTime: []
-      };
-      return {
-        // 表单数据
-        where: { ...defaultWhere },
-        statusOpt: [
-          { label: '暂停', value: 9 },
-          { label: '终止', value: 10 },
-          { label: '待下达', value: 8 },
-          { label: '待生产', value: 4 },
-          { label: '生产中', value: 5 }
-        ],
-        teamList: []
+    return {
+      options_factory: [],
+      // 表单数据
+      where: { ...defaultWhere },
+      statusOpt: [
+        { label: '暂停', value: 9 },
+        { label: '终止', value: 10 },
+        { label: '待下达', value: 8 },
+        { label: '待生产', value: 4 },
+        { label: '生产中', value: 5 }
+      ],
+      teamList: []
+    };
+  },
+  computed: {
+    // 是否开启响应式布局
+    styleResponsive() {
+      return this.$store.state.theme.styleResponsive;
+    }
+  },
+  watch: {},
+  mounted() {
+    this.getFactoryarea();
+    this.$nextTick(() => {
+      let factoryId = this.$store.state.user.info.factoryId;
+      this.where.parentId = factoryId;
+    });
+  },
+  created() {},
+  methods: {
+    getFactoryarea() {
+      let par = {
+        type: 1,
+        size: 9999
       };
+      getFactoryarea(par).then((res) => {
+        if (res.list && res.list.length > 0) {
+          this.options_factory = res.list.map((el) => {
+            console.log(el.id);
+            console.log(el.name);
+            return {
+              value: el.id,
+              label: el.name
+            };
+          });
+          console.log(this.options_factory);
+        }
+      });
     },
-    computed: {
-      // 是否开启响应式布局
-      styleResponsive() {
-        return this.$store.state.theme.styleResponsive;
+    /* 搜索 */
+    search() {
+      const where = { ...this.where };
+      if (where.createTime?.length) {
+        where.createTimeStart = where.createTime[0];
+        where.createTimeEnd = where.createTime[1];
       }
+      delete where.createTime;
+      console.log(where);
+      this.$emit('search', where);
     },
-    watch: {},
-    created() {},
-    methods: {
-      /* 搜索 */
-      search() {
-        const where = { ...this.where };
-        if (where.createTime?.length) {
-          where.createTimeStart = where.createTime[0];
-          where.createTimeEnd = where.createTime[1];
-        }
-        delete where.createTime;
-        this.$emit('search', where);
-      },
-      /*  重置 */
-      reset() {
-        this.where = { ...this.defaultWhere };
-        this.search();
-      }
+    /*  重置 */
+    reset() {
+      this.where = { ...this.defaultWhere };
+      this.search();
     }
-  };
+  }
+};
 </script>
 <style lang="scss" scoped>
-  .ele-form-actions {
-    display: flex;
-    align-items: center;
-    justify-content: flex-start;
-    padding-top: 4.5px;
-  }
-  .searchExpend {
-    padding: 20px 50px 0 30px;
-  }
+.ele-form-actions {
+  display: flex;
+  align-items: center;
+  justify-content: flex-start;
+  padding-top: 4.5px;
+}
+.searchExpend {
+  padding: 20px 50px 0 30px;
+}
 </style>

+ 6 - 0
src/views/workOrder/index.vue

@@ -336,6 +336,12 @@
             minWidth: 100,
             showOverflowTooltip: true
           },
+          {
+            prop: 'factoryName',
+            label: '所属工厂',
+            align: 'center',
+            minWidth: 100,
+          },
           {
             prop: 'taskName',
             action: 'taskName',