quwangxin před 2 roky
rodič
revize
4c4bcd3ef3

+ 16 - 14
src/views/productionPlan/index.vue

@@ -316,8 +316,8 @@
       },
       // 发布工单
       handleOrderPublish(type, row) {
-        this.$confirm('发布工单后不可撤回,确定发布吗?', '发布确认').then(
-          async () => {
+        this.$confirm('发布工单后不可撤回,确定发布吗?', '发布确认')
+          .then(async () => {
             const loading = this.$loading({
               lock: true,
               fullscreen: true,
@@ -342,13 +342,14 @@
                   produceVersionId: row.produceVersionId,
                   status: 4,
                   model: row.model,
+                  id: row.workOrderId,
                   brandNo: row.brandNo,
                   categoryId: row.categoryId,
                   productCode: row.productCode,
                   productName: row.productName
                 }
               ]);
-              if (data) {
+              if (data || data === 0) {
                 this.$message.success('发布成功!');
               } else {
                 this.$message.error('发布失败,请重新发布!');
@@ -359,9 +360,9 @@
             }
             loading.close();
           })
-		  .catch((err)=>{
-			  console.error(err);
-		  })
+          .catch((err) => {
+            console.error(err);
+          });
 
         // this.$router.push({
         //   path: '/productionPlan/workOrderPublish',
@@ -398,14 +399,15 @@
         });
       },
       handleDelete({ id }) {
-        this.$confirm('确定删除当前数据?', '提示').then(async () => {
-          await del(id);
-          this.$message.success('删除成功!');
-          this.reload();
-        })
-		.catch((err)=>{
-			console.error(err);
-		})
+        this.$confirm('确定删除当前数据?', '提示')
+          .then(async () => {
+            await del(id);
+            this.$message.success('删除成功!');
+            this.reload();
+          })
+          .catch((err) => {
+            console.error(err);
+          });
       }
     }
   };

+ 32 - 29
src/views/saleOrder/components/order-search.vue

@@ -140,7 +140,9 @@
         <el-form-item label-width="0px">
           <div class="btn-wrapper">
             <el-button @click="goProduct">转生产计划</el-button>
-            <el-button type="primary" @click="orderRefresh"  :loading="loading">订单刷新</el-button>
+            <el-button type="primary" @click="orderRefresh" :loading="loading"
+              >订单刷新</el-button
+            >
             <el-button type="success" @click="toCreate">创建订单</el-button>
             <el-upload
               class="avatar-uploader"
@@ -183,7 +185,6 @@
   import { importFile } from '@/api/saleOrder';
   import fileUrl from '@/assets/file/销售订单导入模板.xls';
   import { pullSalesOrder, deleteOrder } from '@/api/saleOrder';
-  import { data } from 'ele-admin/lib/ele-pro-table';
   export default {
     props: {
       selection: Array,
@@ -194,7 +195,7 @@
       CreateOrder,
       GroupOrder
     },
-    data () {
+    data() {
       // 默认表单数据
       const defaultWhere = {
         code: '',
@@ -231,18 +232,18 @@
           { value: 1, label: '按单' },
           { value: 2, label: '按库' }
         ],
-		loading:false
+        loading: false
       };
     },
     computed: {
       // 是否开启响应式布局
-      styleResponsive () {
+      styleResponsive() {
         return this.$store.state.theme.styleResponsive;
       }
     },
     watch: {
       activeName: {
-        handler () {
+        handler() {
           if (this.activeName == 'first') {
             this.where.proStu = 1;
           } else {
@@ -254,10 +255,10 @@
         immediate: true
       }
     },
-    created () {},
+    created() {},
     methods: {
       /* 搜索 */
-      search () {
+      search() {
         if (this.time.length) {
           this.where.startTime = this.time[0];
           this.where.endTime = this.time[1];
@@ -265,7 +266,7 @@
         this.$emit('search', this.where);
       },
       /*  重置 */
-      reset () {
+      reset() {
         this.time = [];
         this.where = { ...this.defaultWhere };
         if (this.activeName == 'first') {
@@ -275,28 +276,28 @@
         }
         this.search();
       },
-      toImport () {
+      toImport() {
         this.$refs.importDialog.open();
       },
-      toCreate () {
+      toCreate() {
         this.$refs.createDialog.open();
       },
-      toGroup () {
+      toGroup() {
         this.$refs.groupDialog.open();
       },
-      goProduct () {
+      goProduct() {
         if (!this.selection.length) {
           return this.$message.warning('请先勾选一个或多个订单!');
         }
         const productCode = this.selection[0].productCode;
-		const orderType = this.selection[0].orderType;
+        const orderType = this.selection[0].orderType;
         for (var i = 0; i < this.selection.length; i++) {
           if (productCode != this.selection[i].productCode) {
             return this.$message.warning('物料编码不一致!');
           }
-			if (orderType != this.selection[i].orderType) {
-			  return this.$message.warning('订单类型不一致!');
-			}
+          if (orderType != this.selection[i].orderType) {
+            return this.$message.warning('订单类型不一致!');
+          }
         }
         const list = [];
         this.selection.map((item) => {
@@ -311,18 +312,20 @@
       },
 
       // 刷新订单
-      orderRefresh () {
-		  this.loading = true
-        pullSalesOrder().then((res) => {
-			 this.$message.success('刷新成功!')
-			 this.loading = false
-		}).catch(() => {
-			this.loading = false
-		});
+      orderRefresh() {
+        this.loading = true;
+        pullSalesOrder()
+          .then((res) => {
+            this.$message.success('刷新成功!');
+            this.loading = false;
+          })
+          .catch(() => {
+            this.loading = false;
+          });
       },
 
       // 点击批量删除
-      batchDelete () {
+      batchDelete() {
         if (!this.selection.length) {
           return this.$message.warning('请先勾选一个或多个订单!');
         }
@@ -344,13 +347,13 @@
           .catch(() => {});
       },
 
-      handleChange (file, fileList) {
+      handleChange(file, fileList) {
         this.fileList = fileList;
         console.log(fileList);
       },
 
       //上传限制
-      beforeUpload (file) {
+      beforeUpload(file) {
         const isLt10M = file.size / 1024 / 1024 < 10;
         if (!isLt10M) {
           this.$message.error('上传文件大小不能超过 10MB!');
@@ -358,7 +361,7 @@
         return isLt10M;
       },
       //文件上传
-      uploadFile (param) {
+      uploadFile(param) {
         let fd = new FormData();
         this.fileList.forEach((item) => {
           fd.append('importExcel', item.raw);