quwangxin пре 2 година
родитељ
комит
57e409d802
2 измењених фајлова са 251 додато и 243 уклоњено
  1. 4 1
      src/views/saleOrder/components/create-order.vue
  2. 247 242
      src/views/saleOrder/index.vue

+ 4 - 1
src/views/saleOrder/components/create-order.vue

@@ -130,7 +130,10 @@
         </el-table-column>
         <el-table-column label="操作" align="center" width="70">
           <template slot-scope="scope">
-            <el-button type="text" @click="handleDeleteItem(scope.$index)"
+            <el-button
+              type="text"
+              @click="handleDeleteItem(scope.$index)"
+              v-if="!scope.row.id"
               >删除</el-button
             >
           </template>

+ 247 - 242
src/views/saleOrder/index.vue

@@ -1,296 +1,301 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
-      <order-search ref="searchRefs" @search="reload" :selection="selection" :activeName="activeName"> </order-search>
-	  <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
-	    <el-tab-pane label="待排产" name="first"></el-tab-pane>
-	    <el-tab-pane label="已排产" name="second"></el-tab-pane>
-	  </el-tabs>
+      <order-search
+        ref="searchRefs"
+        @search="reload"
+        :selection="selection"
+        :activeName="activeName"
+      >
+      </order-search>
+      <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
+        <el-tab-pane label="待排产" name="first"></el-tab-pane>
+        <el-tab-pane label="已排产" name="second"></el-tab-pane>
+      </el-tabs>
       <!-- 数据表格 -->
       <ele-pro-table
         ref="table"
         :columns="columns"
         :datasource="datasource"
-		    :selection.sync="selection"
+        :selection.sync="selection"
         cache-key="systemRoleTable"
-		    row-key="id"
+        row-key="id"
       >
-		<template v-slot:code='{row}'>
-			<el-link :underline="false" @click="openDetails(row)">
-			  {{ row.code }}
-			</el-link>
-		</template>
-		<!-- 操作列 -->
-		<template v-slot:action="{ row }">
-		  <el-link
-		    type="primary"
-		    :underline="false"
-		    icon="el-icon-edit"
-		    @click="toUpdate(row)"
-		  >
-		    修改
-		  </el-link>
-		  <el-popconfirm
-		    class="ele-action"
-		    title="确定要删除此销售订单吗?"
-		    @confirm="remove(row)"
-		  >
-		    <template v-slot:reference>
-		      <el-link type="danger" :underline="false" icon="el-icon-delete">
-		        删除
-		      </el-link>
-		    </template>
-		  </el-popconfirm>
-		</template>
+        <template v-slot:code="{ row }">
+          <el-link :underline="false" @click="openDetails(row)">
+            {{ row.code }}
+          </el-link>
+        </template>
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <template v-if="row.orderSource != 1">
+            <el-link
+              type="primary"
+              :underline="false"
+              icon="el-icon-edit"
+              @click="toUpdate(row)"
+            >
+              修改
+            </el-link>
+            <el-popconfirm
+              class="ele-action"
+              title="确定要删除此销售订单吗?"
+              @confirm="remove(row)"
+            >
+              <template v-slot:reference>
+                <el-link type="danger" :underline="false" icon="el-icon-delete">
+                  删除
+                </el-link>
+              </template>
+            </el-popconfirm>
+          </template>
+        </template>
       </ele-pro-table>
     </el-card>
-	<!-- 详情弹窗 -->
-	<order-detail @refresh="reload" ref="detailDialog"> </order-detail>
+    <!-- 详情弹窗 -->
+    <order-detail @refresh="reload" ref="detailDialog"> </order-detail>
     <!-- 创建订单 -->
-    <create-order ref="createDialog" @refresh="reload"> </create-order> 
+    <create-order ref="createDialog" @refresh="reload"> </create-order>
   </div>
 </template>
 
 <script>
   import OrderSearch from './components/order-search.vue';
   import OrderDetail from './components/order-detail.vue';
-  import CreateOrder from './components/create-order.vue'
-  import { getPageList , deleteOrder } from '@/api/saleOrder';
+  import CreateOrder from './components/create-order.vue';
+  import { getPageList, deleteOrder } from '@/api/saleOrder';
   import dictMixins from '@/mixins/dictMixins';
-  
+
   export default {
+    name: 'saleOrder',
     mixins: [dictMixins],
     components: {
       OrderSearch,
-	  OrderDetail,
-	  CreateOrder
+      OrderDetail,
+      CreateOrder
     },
     data () {
       return {
         // 加载状态
         loading: false,
-		activeName:"first",
-		selection:[]
+        activeName: 'first',
+        selection: []
       };
     },
     computed: {
       // 表格列配置
       columns () {
         const privateColumn = [];
-        if (this.activeName == 'first' ) {
+        if (this.activeName == 'first') {
           privateColumn.push({
-		    columnKey: 'action',
-		    label: '操作',
-		    width: 150,
-		    align: 'center',
-		    resizable: false,
-		    slot: 'action',
-		    showOverflowTooltip: true,
-			fixed:'right'
-		  });
+            columnKey: 'action',
+            label: '操作',
+            width: 150,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          });
         }
         return [
-		  {
-			width: 45,
-			type: 'selection',
-			columnKey: 'selection',
-			align: 'center'
-		  },
-		  {
-			columnKey: 'index',
-			label: '序号',
-			type: 'index',
-			width: 55,
-			align: 'center',
-			showOverflowTooltip: true,
-			fixed: 'left'
-		  },
-		  {
-			prop: 'code',
-			label: '销售订单号',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110,
-			slot: 'code'
-		  },
-		  {
-			prop: 'lineNumber',
-			label: '行号',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
-		  },
-		  {
-			prop: 'productCode',
-			label: '产品编码',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
-		  },
-		  {
-			prop: 'brandNo',
-			label: '牌号',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
-		  },
-		  {
-			prop: 'model',
-			label: '型号',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
-		  },
-		  {
-			prop: 'contractNum',
-			label: '合同数量',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
-		  },
-		  {
-			prop: 'lackNum',
-			label: '欠交数量',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
-		  },
-		  {
-			prop: 'orderLibraryType',
-			label: '按单按库',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110,
-				formatter: (_row, _column, cellValue) => {
-				  return this.getDictValue('按单按库', _row.orderLibraryType);
-				}
-		  },
-		  {
-			prop: 'deliveryRequirements',
-			label: '交付要求',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110,
-				formatter: (_row, _column, cellValue) => {
-				  return this.getDictValue('交付要求', _row.deliveryRequirements);
-				}
-		  },
-		  {
-			prop: 'orderType',
-			label: '订单类型',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110,
-				formatter: (_row, _column, cellValue) => {
-				  return this.getDictValue('订单类型', _row.orderType);
-				}
-		  },
-		  {
-			prop: 'orderSource',
-			label: '订单来源',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110,
-				formatter: (_row, _column, cellValue) => {
-				  return this.getDictValue('订单来源', _row.orderSource);
-				}
-		  },
-		  {
-			prop: 'status',
-			label: '生产状态',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110,
-				formatter: (_row, _column, cellValue) => {
-				  return this.getDictValue('生产状态', _row.status);
-				}
-		  },
-		  {
-			prop: 'releaseTime',
-			label: '下达时间',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
-		  },
-		  {
-			prop: 'deliveryTime',
-			label: '交付日期',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
-		  },
-		  {
-			prop: 'customerName',
-			label: '客户名称',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
-		  },
-		  {
-			prop: 'salesman',
-			label: '业务员',
-			align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
-		  },
-		  ...privateColumn
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '销售订单号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            slot: 'code'
+          },
+          {
+            prop: 'lineNumber',
+            label: '行号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'productCode',
+            label: '产品编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'contractNum',
+            label: '合同数量',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'lackNum',
+            label: '欠交数量',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'orderLibraryType',
+            label: '按单按库',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('按单按库', _row.orderLibraryType);
+            }
+          },
+          {
+            prop: 'deliveryRequirements',
+            label: '交付要求',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('交付要求', _row.deliveryRequirements);
+            }
+          },
+          {
+            prop: 'orderType',
+            label: '订单类型',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('订单类型', _row.orderType);
+            }
+          },
+          {
+            prop: 'orderSource',
+            label: '订单来源',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('订单来源', _row.orderSource);
+            }
+          },
+          {
+            prop: 'status',
+            label: '生产状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('生产状态', _row.status);
+            }
+          },
+          {
+            prop: 'releaseTime',
+            label: '下达时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'deliveryTime',
+            label: '交付日期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'customerName',
+            label: '客户名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'salesman',
+            label: '业务员',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          ...privateColumn
         ];
       }
     },
-    created () {     
-	  this.requestDict('按单按库');
-	  this.requestDict('交付要求');
-	  this.requestDict('订单类型');
-	  this.requestDict('订单来源');
-	  this.requestDict('生产状态');
+    created () {
+      this.requestDict('按单按库');
+      this.requestDict('交付要求');
+      this.requestDict('订单类型');
+      this.requestDict('订单来源');
+      this.requestDict('生产状态');
     },
     methods: {
-	
       /* 表格数据源 */
       async datasource ({ page, limit, where, order }) {
-			if(this.activeName=='first'){
-				 where.status = [1]
-			 }else{
-				 if(where.proStu){
-					 where.status = [where.proStu]
-				 }else{
-					 where.status = [2,3,4,5,6,7]
-				 }
-			 }
-			 const params = {
-				 size: limit,
-				 pageNum: page,
-				 ...where
-			 }
-			const data = await getPageList(params)
-			return data
+        if (this.activeName == 'first') {
+          where.status = [1];
+        } else {
+          if (where.proStu) {
+            where.status = [where.proStu];
+          } else {
+            where.status = [2, 3, 4, 5, 6, 7];
+          }
+        }
+        const params = {
+          size: limit,
+          pageNum: page,
+          ...where
+        };
+        const data = await getPageList(params);
+        return data;
       },
 
       /* 刷新表格 */
       reload (where) {
-        this.$refs.table.reload({ page: 1, limit:10,  where });
+        this.$refs.table.reload({ page: 1, limit: 10, where });
+      },
+
+      handleClick (tab, event) {
+        this.reload();
       },
-	  
-	  handleClick(tab, event) {
-		  this.reload()
-	  },
-	  openDetails(row){
-		  this.$refs.detailDialog.open(row)
-	  },
-	  toUpdate(row){
-		 this.$refs.createDialog.open(row) 
-	  },
-	  remove(row){
-		 deleteOrder([row.id]).then(res=>{
-				this.$message.success(res)
-				this.reload()
-			 }) 
-		}
+      openDetails (row) {
+        this.$refs.detailDialog.open(row);
+      },
+      toUpdate (row) {
+        this.$refs.createDialog.open(row);
+      },
+      remove (row) {
+        deleteOrder([row.id]).then((res) => {
+          this.$message.success(res);
+          this.reload();
+        });
+      }
     }
   };
 </script>
 
-<style lang="scss" scoped>
-
-</style>
-
+<style lang="scss" scoped></style>