Преглед на файлове

五金匹配新增,修改左边小于右边不报错 ---cjh

17767204043 преди 3 години
родител
ревизия
e06c1d8f3a
променени са 1 файла, в които са добавени 606 реда и са изтрити 445 реда
  1. 606 445
      src/views/ProductionOrderList/Deliverylist/matchIronware.vue

+ 606 - 445
src/views/ProductionOrderList/Deliverylist/matchIronware.vue

@@ -1,479 +1,640 @@
 <template>
-    <div>
-  <Toptitle title="五金匹配">
+  <div>
+    <Toptitle title="五金匹配">
       <Button type="primary" @click="print(selectData)">批量打印</Button>
-         <Button type="primary" @click="back" style="margin-left:20px">返回</Button>
-  </Toptitle>
-  <div class="content">
-  <Form :label-width='100' class="form_style">
-      <FormItem label='项目编号:' class="form_item">
-          <span>{{formData.order_no}}</span>
-      </FormItem>
- <FormItem label='项目名称:' class="form_item">
-          <span>{{formData.residential_name}}</span>
-      </FormItem>
-       <FormItem label='运输单号:' class="form_item">
-          <span>{{formData.transport_no}}</span>
-      </FormItem>
-  </Form>
-  <div class="add_btn"><Button type="primary" size='small' @click="addShow">新增</Button></div>
-  <Table border :data='tableData' :columns='tableColumns' @on-selection-change='selectTable'>
-    <template slot="set" slot-scope="{row}">
-               <a @click="del(row)">删除</a>
-               <a style="margin-left:10px" @click="handelDetail(row)">详情</a>
-               <a style="margin-left:10px" @click="print(row)">打印</a>
-    </template>
-  </Table>
-  </div>
-   <div class="footer">
-              <Page :page-size-opts="[10, 20, 30, 40,100]"
-                    @on-page-size-change='changeSize'
-                    @on-change='changePage'
-                    :current='pageIndex'
-                    show-total
-                    :total="total"
-                    show-sizer
-                    :page-size='pageSize' />
-            </div>
-    <Modal title="新增" v-model="add_show" width='80'>
-        <div class="model_content">
+      <Button type="primary" @click="back" style="margin-left: 20px"
+        >返回</Button
+      >
+    </Toptitle>
+    <div class="content">
+      <Form :label-width="100" class="form_style">
+        <FormItem label="项目编号:" class="form_item">
+          <span>{{ formData.order_no }}</span>
+        </FormItem>
+        <FormItem label="项目名称:" class="form_item">
+          <span>{{ formData.residential_name }}</span>
+        </FormItem>
+        <FormItem label="运输单号:" class="form_item">
+          <span>{{ formData.transport_no }}</span>
+        </FormItem>
+      </Form>
+      <div class="add_btn">
+        <Button type="primary" size="small" @click="addShow">新增</Button>
+      </div>
+      <Table
+        border
+        :data="tableData"
+        :columns="tableColumns"
+        @on-selection-change="selectTable"
+      >
+        <template slot="set" slot-scope="{ row }">
+          <a @click="del(row)">删除</a>
+          <a style="margin-left: 10px" @click="handelDetail(row)">详情</a>
+          <a style="margin-left: 10px" @click="print(row)">打印</a>
+        </template>
+      </Table>
+    </div>
+    <div class="footer">
+      <Page
+        :page-size-opts="[10, 20, 30, 40, 100]"
+        @on-page-size-change="changeSize"
+        @on-change="changePage"
+        :current="pageIndex"
+        show-total
+        :total="total"
+        show-sizer
+        :page-size="pageSize"
+      />
+    </div>
+    <Modal title="新增" v-model="add_show" width="80">
+      <div class="model_content">
         <div class="model_left">
-            <div class="model_left_content">
-            <Form class="model_left_form" :label-width='80'>
-                <FormItem label='图号:' class="model_form_item">
-                    <Input size="small" placeholder="请输入图号" v-model="modelData.url_number" clearable/>
-                </FormItem>
-                <FormItem label='五金编码:' class="model_form_item">
-                    <Input size="small" placeholder="请输入五金编码" v-model="modelData.code" clearable/>
-                </FormItem>
-                <FormItem label='五金名称:' class="model_form_item">
-                    <Input size="small" placeholder="请输入五金名称" v-model="modelData.title" clearable/>
-                </FormItem>
-                <FormItem :label-width='10'><Button type="primary" size='small' @click="modelSearch">搜索</Button></FormItem>
+          <div class="model_left_content">
+            <Form class="model_left_form" :label-width="80">
+              <FormItem label="图号:" class="model_form_item">
+                <Input
+                  size="small"
+                  placeholder="请输入图号"
+                  v-model="modelData.url_number"
+                  clearable
+                />
+              </FormItem>
+              <FormItem label="五金编码:" class="model_form_item">
+                <Input
+                  size="small"
+                  placeholder="请输入五金编码"
+                  v-model="modelData.code"
+                  clearable
+                />
+              </FormItem>
+              <FormItem label="五金名称:" class="model_form_item">
+                <Input
+                  size="small"
+                  placeholder="请输入五金名称"
+                  v-model="modelData.title"
+                  clearable
+                />
+              </FormItem>
+              <FormItem :label-width="10"
+                ><Button type="primary" size="small" @click="modelSearch"
+                  >搜索</Button
+                ></FormItem
+              >
             </Form>
-            <Table :data='modelLeftTableData' :columns='modelLeftTableColumns' border max-height='400' @on-selection-change='modelTableChoose' ref="modelTable">
-
+            <Table
+              :data="modelLeftTableData"
+              :columns="modelLeftTableColumns"
+              border
+              max-height="400"
+              @on-selection-change="modelTableChoose"
+              ref="modelTable"
+            >
             </Table>
-            </div>
-            <div class="model_footer">
-              <Page :page-size-opts="[10, 20, 30, 40,100]"
-                    @on-page-size-change='changeModelSize'
-                    @on-change='changeModelPage'
-                    :current='pageModelIndex'
-                    show-total
-                    :total="ModelTotal"
-                    show-sizer
-                    :page-size='pageModelSize' />
-            </div>
+          </div>
+          <div class="model_footer">
+            <Page
+              :page-size-opts="[10, 20, 30, 40, 100]"
+              @on-page-size-change="changeModelSize"
+              @on-change="changeModelPage"
+              :current="pageModelIndex"
+              show-total
+              :total="ModelTotal"
+              show-sizer
+              :page-size="pageModelSize"
+            />
+          </div>
         </div>
         <div class="model_right">
-           <div style="margin-bottom:0px;lineHeight:50px">已选</div>
-           <Table :data='modelRightTableData' :columns='modelRightTableColumns' border max-height='400'>
-               <template slot="number" slot-scope="{row,index}">
-             <Input v-model="row.remain_num" type="number" @on-change='numChange($event,index)'/>
-               </template>
-               <template slot="set" slot-scope="{row,index}">
-                   <a @click="delSelectData(row,index)">删除</a>
-               </template>
-           </Table>
-        </div>
-        </div>
-        <div slot="footer" style="text-align:center">
-            <Button type="primary" @click="add_show=false" style="width:8vw;margin-right:5vw">返回</Button>
-            <Button type="primary" @click="addData" style="width:8vw">确定</Button>
+          <div style="margin-bottom: 0px; lineheight: 50px">已选</div>
+          <Table
+            :data="modelRightTableData"
+            :columns="modelRightTableColumns"
+            border
+            max-height="400"
+          >
+            <template slot="number" slot-scope="{ row, index }">
+              <Input
+                v-model="row.remain_num"
+                type="number"
+                @on-change="numChange($event, index)"
+              />
+            </template>
+            <template slot="set" slot-scope="{ row, index }">
+              <a @click="delSelectData(row, index)">删除</a>
+            </template>
+          </Table>
         </div>
+      </div>
+      <div slot="footer" style="text-align: center">
+        <Button
+          type="primary"
+          @click="add_show = false"
+          style="width: 8vw; margin-right: 5vw"
+          >返回</Button
+        >
+        <Button type="primary" @click="addData" style="width: 8vw">确定</Button>
+      </div>
     </Modal>
-    <Modal title="详情" v-model="detail_show" width='60'>
-             
-            <div style="height:92%;overflow:auto">
-            <Form style="display:flex;flex-wrap:wrap" :label-width='80'>
-                <FormItem label='图号:' :label-width='50'>
-                    <Input size="small" placeholder="请输入图号" v-model="detailData.url_number" clearable style="width:120px"/>
-                </FormItem>
-                <FormItem label='五金编码:'>
-                    <Input size="small" placeholder="请输入五金编码" v-model="detailData.code" clearable style="width:120px"/>
-                </FormItem>
-                <FormItem label='五金名称:'>
-                    <Input size="small" placeholder="请输入五金名称" v-model="detailData.title" clearable style="width:120px"/>
-                </FormItem>
-                <FormItem :label-width='10'><Button type="primary" size='small' @click="detailSearch">搜索</Button></FormItem>
-            </Form>
-            <Table :data='detailTableData' :columns='detailTableColumns' border max-height='400' ref="modelTable">
-
-            </Table>
-            </div>
-            <div style="text-align:center;margin-top:10px">
-              <Page :page-size-opts="[10, 20, 30, 40,100]"
-                    @on-page-size-change='changeDetailSize'
-                    @on-change='changeDetailPage'
-                    :current='pageDetailIndex'
-                    show-total
-                    :total="detailTotal"
-                    show-sizer
-                    :page-size='pageDetailSize' />
-            </div>
-          <div slot="footer" style="text-align:center">
-              <Button type="primary" @click="backDetail">返回</Button>
-          </div>
+    <Modal title="详情" v-model="detail_show" width="60">
+      <div style="height: 92%; overflow: auto">
+        <Form style="display: flex; flex-wrap: wrap" :label-width="80">
+          <FormItem label="图号:" :label-width="50">
+            <Input
+              size="small"
+              placeholder="请输入图号"
+              v-model="detailData.url_number"
+              clearable
+              style="width: 120px"
+            />
+          </FormItem>
+          <FormItem label="五金编码:">
+            <Input
+              size="small"
+              placeholder="请输入五金编码"
+              v-model="detailData.code"
+              clearable
+              style="width: 120px"
+            />
+          </FormItem>
+          <FormItem label="五金名称:">
+            <Input
+              size="small"
+              placeholder="请输入五金名称"
+              v-model="detailData.title"
+              clearable
+              style="width: 120px"
+            />
+          </FormItem>
+          <FormItem :label-width="10"
+            ><Button type="primary" size="small" @click="detailSearch"
+              >搜索</Button
+            ></FormItem
+          >
+        </Form>
+        <Table
+          :data="detailTableData"
+          :columns="detailTableColumns"
+          border
+          max-height="400"
+          ref="modelTable"
+        >
+        </Table>
+      </div>
+      <div style="text-align: center; margin-top: 10px">
+        <Page
+          :page-size-opts="[10, 20, 30, 40, 100]"
+          @on-page-size-change="changeDetailSize"
+          @on-change="changeDetailPage"
+          :current="pageDetailIndex"
+          show-total
+          :total="detailTotal"
+          show-sizer
+          :page-size="pageDetailSize"
+        />
+      </div>
+      <div slot="footer" style="text-align: center">
+        <Button type="primary" @click="backDetail">返回</Button>
+      </div>
     </Modal>
-    </div>
+  </div>
 </template>
 <script>
 export default {
-    data(){
-        return{
-            wxsoect:null,
-            selectData:[],
-            detail_show:false,
-            detailProxyData:[],
-            proxyData:[],
-            formData:{
-                order_no:'',
-                residential_name:'',
-                transport_no:'',
-            },
-            add_show:false,
-            pageDetailIndex:1,
-            pageDetailSize:10,
-            detailTotal:0,
-            pageModelIndex:1,
-            pageModelSize:10,
-            ModelTotal:0,
-            pageIndex:1,
-            pageSize:10,
-            total:0,
-            modelData:{
-                 url_number:'',
-                 code:'',
-                 title:''
-            },
-             detailData:{
-                 url_number:'',
-                 code:'',
-                 title:''
-            },
-            modelSelectData:[],
-             modelRightTableData:[],
-            modelRightTableColumns:[
-                   {title:'图号',minWidth:70,align:'center',key:'url_number'},
-                     {title:'物料编码',minWidth:100,align:'center',key:'code'},
-                       {title:'物料名称',minWidth:100,align:'center',key:'title'},
-                       {title:'数量',minWidth:70,align:'center',slot:'number',key:'remain_num'},
-                       {title:'操作',minWidth:70,align:'center',slot:'set'}
-            ],
-            detailTableData:[],
-          detailTableColumns:[
-                   {title:'图号',minWidth:70,align:'center',key:'url_number'},
-                     {title:'五金编码',minWidth:100,align:'center',key:'code'},
-                       {title:'五金名称',minWidth:100,align:'center',key:'title'},
-                           {title:'计量单位',minWidth:100,align:'center',key:'unit'},
-                             {title:'数量',minWidth:100,align:'center',key:'num'},
-            ],
-            modelLeftTableData:[],
-            modelLeftTableColumns:[
-                 {type:'selection',minWidth:60,align:'center'},
-                   {title:'图号',minWidth:70,align:'center',key:'url_number'},
-                     {title:'五金编码',minWidth:100,align:'center',key:'code'},
-                       {title:'五金名称',minWidth:100,align:'center',key:'title'},
-                         {title:'规格型号',minWidth:100,align:'center',render:(h,params)=>{
-                             const {row} = params;
-                             const text = `${row.long}*${row.width}*${row.high}`
-                             return h('span',{},text)
-                         }},
-                           {title:'计量单位',minWidth:100,align:'center',key:'unit'},
-                             {title:'剩余数量',minWidth:100,align:'center',key:'remain_num'},
-            ],
-           tableData:[],
-           tableColumns:[
-               {type:'selection',minWidth:60,align:'center'},
-               {title:'包装时间',minWidth:150,align:'center',render:(h,params)=>{
-                   const {row} = params;
-                   return h('span',{},this.func.replaceDateNoHMS(row.crt_time))
-               }},
-                {title:'包装码',minWidth:150,align:'center',key:'tag'},
-                 {title:'操作',minWidth:150,align:'center',slot:'set'},
-           ],
-        }
-    },
-    mounted(){
-        //   this.initModalData();
-          this.initData();
-           const wxsoect = new WebSocket('ws://localhost:1808');
-          this.wxsoect = wxsoect;
-           console.log("this.wxsoect :>> ", this.wxsoect);
-        
-             wxsoect.onopen = function(evt) {
-              console.log(`已成功打开`);
-                 };
-    },
-    methods:{
-        numChange(e,index){
-            console.log(e.target.value);
-            this.modelRightTableData[index].remain_num = e.target.value*1;
+  data() {
+    return {
+      wxsoect: null,
+      selectData: [],
+      detail_show: false,
+      detailProxyData: [],
+      proxyData: [],
+      formData: {
+        order_no: "",
+        residential_name: "",
+        transport_no: "",
+      },
+      add_show: false,
+      pageDetailIndex: 1,
+      pageDetailSize: 10,
+      detailTotal: 0,
+      pageModelIndex: 1,
+      pageModelSize: 10,
+      ModelTotal: 0,
+      pageIndex: 1,
+      pageSize: 10,
+      total: 0,
+      modelData: {
+        url_number: "",
+        code: "",
+        title: "",
+      },
+      detailData: {
+        url_number: "",
+        code: "",
+        title: "",
+      },
+      modelSelectData: [],
+      modelRightTableData: [],
+      modelRightTableColumns: [
+        { title: "图号", minWidth: 70, align: "center", key: "url_number" },
+        { title: "物料编码", minWidth: 100, align: "center", key: "code" },
+        { title: "物料名称", minWidth: 100, align: "center", key: "title" },
+        {
+          title: "数量",
+          minWidth: 70,
+          align: "center",
+          slot: "number",
+          key: "remain_num",
         },
-        print(data){
-            let obj = {};
-            obj.order_no = this.$route.query.order_no;
-            if(data instanceof Array){
-                let tag = [];
-                data.forEach(v=>{
-                    tag.push(v.tag)
-                })
-                     this.axios.post('/api/orders_transport_alloy_print',{tag}).then(res=>{
-                            res.data.forEach(ele=>{
-                     this.printDemo(ele)
-                            })
-                 })
-            }else{
-                 this.axios.post('/api/orders_transport_alloy_print',{tag:[data.tag]}).then(res=>{
-                         this.printDemo(res.data[0])
-                 })
-            }
+        { title: "操作", minWidth: 70, align: "center", slot: "set" },
+      ],
+      detailTableData: [],
+      detailTableColumns: [
+        { title: "图号", minWidth: 70, align: "center", key: "url_number" },
+        { title: "五金编码", minWidth: 100, align: "center", key: "code" },
+        { title: "五金名称", minWidth: 100, align: "center", key: "title" },
+        { title: "计量单位", minWidth: 100, align: "center", key: "unit" },
+        { title: "数量", minWidth: 100, align: "center", key: "num" },
+      ],
+      modelLeftTableData: [],
+      modelLeftTableColumns: [
+        { type: "selection", minWidth: 60, align: "center" },
+        { title: "图号", minWidth: 70, align: "center", key: "url_number" },
+        { title: "五金编码", minWidth: 100, align: "center", key: "code" },
+        { title: "五金名称", minWidth: 100, align: "center", key: "title" },
+        {
+          title: "规格型号",
+          minWidth: 100,
+          align: "center",
+          render: (h, params) => {
+            const { row } = params;
+            const text = `${row.long}*${row.width}*${row.high}`;
+            return h("span", {}, text);
+          },
+        },
+        { title: "计量单位", minWidth: 100, align: "center", key: "unit" },
+        {
+          title: "剩余数量",
+          minWidth: 100,
+          align: "center",
+          key: "remain_num",
+        },
+      ],
+      tableData: [],
+      tableColumns: [
+        { type: "selection", minWidth: 60, align: "center" },
+        {
+          title: "包装时间",
+          minWidth: 150,
+          align: "center",
+          render: (h, params) => {
+            const { row } = params;
+            return h("span", {}, this.func.replaceDateNoHMS(row.crt_time));
+          },
         },
-      printDemo(data) {
-      setTimeout(()=>{
- if (!data) return 0;
-      const st = this.wxsoect;
-      const {
-       area,
-number,
-order_no,
-part,
-product,
-size,
-tag,
-tag_bin,
-url_number,
-veneer,
-      } = data;
-      st.send("OpenPort|255");
-      st.send("ZM_ClearBuffer");
-      st.send("ZM_SetPrintSpeed|4");
-      st.send("ZM_SetDarkness|12");
+        { title: "包装码", minWidth: 150, align: "center", key: "tag" },
+        { title: "操作", minWidth: 150, align: "center", slot: "set" },
+      ],
+    };
+  },
+  mounted() {
+    //   this.initModalData();
+    this.initData();
+    const wxsoect = new WebSocket("ws://localhost:1808");
+    this.wxsoect = wxsoect;
+    console.log("this.wxsoect :>> ", this.wxsoect);
 
-      if (location.origin.indexOf("121.37.173.82") > -1) {
-        st.send("ZM_SetLabelHeight|136|32");
+    wxsoect.onopen = function (evt) {
+      console.log(`已成功打开`);
+    };
+  },
+  methods: {
+    numChange(e, index) {
+      console.log(e.target.value);
+      this.modelRightTableData[index].remain_num = e.target.value * 1;
+    },
+    print(data) {
+      let obj = {};
+      obj.order_no = this.$route.query.order_no;
+      if (data instanceof Array) {
+        let tag = [];
+        data.forEach((v) => {
+          tag.push(v.tag);
+        });
+        this.axios
+          .post("/api/orders_transport_alloy_print", { tag })
+          .then((res) => {
+            res.data.forEach((ele) => {
+              this.printDemo(ele);
+            });
+          });
       } else {
-        st.send("ZM_SetLabelHeight|160|16");
+        this.axios
+          .post("/api/orders_transport_alloy_print", { tag: [data.tag] })
+          .then((res) => {
+            this.printDemo(res.data[0]);
+          });
       }
+    },
+    printDemo(data) {
+      setTimeout(() => {
+        if (!data) return 0;
+        const st = this.wxsoect;
+        const {
+          area,
+          number,
+          order_no,
+          part,
+          product,
+          size,
+          tag,
+          tag_bin,
+          url_number,
+          veneer,
+        } = data;
+        st.send("OpenPort|255");
+        st.send("ZM_ClearBuffer");
+        st.send("ZM_SetPrintSpeed|4");
+        st.send("ZM_SetDarkness|12");
 
-      st.send("ZM_SetLabelWidth|664");
-      st.send(
-        `ZM_DrawTextTrueTypeW|70|20|24|0|Arial|1|600|0|0|0|A1| 项目:${order_no ||
-          ""}`
-      );
+        if (location.origin.indexOf("121.37.173.82") > -1) {
+          st.send("ZM_SetLabelHeight|136|32");
+        } else {
+          st.send("ZM_SetLabelHeight|160|16");
+        }
+
+        st.send("ZM_SetLabelWidth|664");
         st.send(
-        `ZM_DrawTextTrueTypeW|280|20|24|0|Arial|1|600|0|0|0|A1|  区域: ${area||''}`
-      );
-      st.send(
-        `ZM_DrawTextTrueTypeW|70|55|24|0|Arial|1|600|0|0|0|A2|  房号:${number||''}`
-      );
-       st.send(
-        `ZM_DrawTextTrueTypeW|280|55|24|0|Arial|1|600|0|0|0|A2| 产品:${product ||
-          ""} `
-      );
-       st.send(
-        `ZM_DrawTextTrueTypeW|70|90|24|0|Arial|1|600|0|0|0|A3| 部件:${part || ""} `
-      );
-      st.send(
-        `ZM_DrawTextTrueTypeW|280|90|24|0|Arial|1|600|0|0|0|A3| 图号: ${url_number ||
-          ""} `
-      );
-      st.send(
-        `ZM_DrawTextTrueTypeW|70|125|24|0|Arial|1|600|0|0|0|A4| 尺寸: ${size ||
-          ""} `
-      );
-  st.send(
-        `ZM_DrawTextTrueTypeW|280|125|24|0|Arial|1|600|0|0|0|A4| 木皮:${veneer || ""}`
-      );
-       st.send(
-        `ZM_DrawTextTrueTypeW|500|90|12|0|Arial|1|600|0|0|0|A4| ${tag_bin || ""}`
-      );
-      st.send(`ZM_RW_RfidFormat|1|0|0|${tag.length}|1|${tag}`);
-      st.send("ZM_PrintLabel_R|1|1");
-      st.send("ClosePort");
-      },1000)
-     
+          `ZM_DrawTextTrueTypeW|70|20|24|0|Arial|1|600|0|0|0|A1| 项目:${
+            order_no || ""
+          }`
+        );
+        st.send(
+          `ZM_DrawTextTrueTypeW|280|20|24|0|Arial|1|600|0|0|0|A1|  区域: ${
+            area || ""
+          }`
+        );
+        st.send(
+          `ZM_DrawTextTrueTypeW|70|55|24|0|Arial|1|600|0|0|0|A2|  房号:${
+            number || ""
+          }`
+        );
+        st.send(
+          `ZM_DrawTextTrueTypeW|280|55|24|0|Arial|1|600|0|0|0|A2| 产品:${
+            product || ""
+          } `
+        );
+        st.send(
+          `ZM_DrawTextTrueTypeW|70|90|24|0|Arial|1|600|0|0|0|A3| 部件:${
+            part || ""
+          } `
+        );
+        st.send(
+          `ZM_DrawTextTrueTypeW|280|90|24|0|Arial|1|600|0|0|0|A3| 图号: ${
+            url_number || ""
+          } `
+        );
+        st.send(
+          `ZM_DrawTextTrueTypeW|70|125|24|0|Arial|1|600|0|0|0|A4| 尺寸: ${
+            size || ""
+          } `
+        );
+        st.send(
+          `ZM_DrawTextTrueTypeW|280|125|24|0|Arial|1|600|0|0|0|A4| 木皮:${
+            veneer || ""
+          }`
+        );
+        st.send(
+          `ZM_DrawTextTrueTypeW|500|90|12|0|Arial|1|600|0|0|0|A4| ${
+            tag_bin || ""
+          }`
+        );
+        st.send(`ZM_RW_RfidFormat|1|0|0|${tag.length}|1|${tag}`);
+        st.send("ZM_PrintLabel_R|1|1");
+        st.send("ClosePort");
+      }, 1000);
     },
-        selectTable(e){
-         this.selectData = e;
-        },
-        backDetail(){
-            this.detailData = [];
-          this.detail_show = false;
-        },
-        detailSearch(){
-             this.pageDetailIndex = 1;
-            this.handelDetail(this.detailProxyData,this.detailData);
-        },
-        handelDetail(row,data){
-             this.detailProxyData = row;
-             this.axios.get('/api/orders_transport_alloy_detail',{params:{tag:row.tag,...data}}).then(res=>{
-                 this.detailTableData = res.data.data;
-                 this.detailTotal = res.data.total;
-             })
-             this.detail_show = true;
-        },
-        del(row){
-           this.axios.get('/api/orders_transport_alloy_del',{params:{tag:row.tag}}).then(res=>{
-               if(res.code ==200){
-                   this.$Message.success(res.msg);
-                   if(this.pageIndex>1){
-                       if(this.tableData.length==1){
-                              this.pageIndex--;
-                       }
-                   }
-                   this.initData();
-               }
-           })
-        },
-        addData(){
-          if(this.modelSelectData.length==0){
-            return this.$Message.warning('请确认数据!')
+    selectTable(e) {
+      this.selectData = e;
+    },
+    backDetail() {
+      this.detailData = [];
+      this.detail_show = false;
+    },
+    detailSearch() {
+      this.pageDetailIndex = 1;
+      this.handelDetail(this.detailProxyData, this.detailData);
+    },
+    handelDetail(row, data) {
+      this.detailProxyData = row;
+      this.axios
+        .get("/api/orders_transport_alloy_detail", {
+          params: { tag: row.tag, ...data },
+        })
+        .then((res) => {
+          this.detailTableData = res.data.data;
+          this.detailTotal = res.data.total;
+        });
+      this.detail_show = true;
+    },
+    del(row) {
+      this.axios
+        .get("/api/orders_transport_alloy_del", { params: { tag: row.tag } })
+        .then((res) => {
+          if (res.code == 200) {
+            this.$Message.success(res.msg);
+            if (this.pageIndex > 1) {
+              if (this.tableData.length == 1) {
+                this.pageIndex--;
+              }
+            }
+            this.initData();
           }
-          this.modelRightTableData.forEach(v=>{
-            v.num = v.remain_num;
-          })
-         this.axios.post('/api/orders_transport_alloy_save',{...this.$route.query,children:this.modelRightTableData}).then(res=>{
-             if(res.code==200){
-                 this.$Message.success(res.msg);
-                   this.add_show = false;
-                   this.pageIndex =1;
-                   this.initData();
-             }
-             }) 
-        },
-        modelSearch(){
-             this.pageModelIndex = 1;
-            this.initModalData(this.modelData);
-        },
-        delSelectData(row,index){
-           this.modelSelectData.splice(index,1);
-           this.modelRightTableData.splice(index,1);
-             this.modelLeftTableData.forEach((element,indx) => {
-           if(element.id == row.id){
-                     this.$refs.modelTable.toggleSelect(indx)
-           }
+        });
+    },
+    addData() {
+      if (this.modelSelectData.length == 0) {
+        return this.$Message.warning("请确认数据!");
+      }
+      let ifTrue = 0;
+      this.modelRightTableData.forEach((r) => {
+        this.modelLeftTableData.forEach((l) => {
+          if (r.id == l.id) {
+            if (r.remain_num < l.remain_num) {
+              ifTrue = 1;
+            }
+          }
+        });
       });
-        },
-        modelTableChoose(e){
-             this.modelSelectData = e;
-             this.modelRightTableData = JSON.parse(JSON.stringify(this.modelSelectData));
-        },
-        initModalData(row){
-            this.proxyData = row;
-          this.axios.get('/api/orders_transport_alloy_material',{params:{order_no:this.$route.query.order_no,...row,page_size:this.pageModelSize,page_index:this.pageModelIndex}}).then(res=>{
-                  this.modelLeftTableData = res.data.data;
-                  this.ModelTotal = res.data.total; 
-          })
-        },
-        addShow(){
-            this.modelSelectData = [];
-            this.modelRightTableData =[];
-        this.initModalData();
-        //    this.modelLeftTableData = JSON.parse(JSON.stringify(this.modelLeftTableData));
-             this.add_show = true;
-        },
-        initData(){
-          this.axios.get('/api/orders_transport_alloy_list',{params:{...this.$route.query,page_size:this.pageSize,page_index:this.pageIndex}}).then(res=>{
-                 this.tableData = res.data.data;
-                 this.total = res.data.total;
-                this.formData.order_no=res.data.order_no;
-                this.formData.residential_name=res.data.residential_name;
-                this.formData.transport_no=res.data.transport_no;
+      if (ifTrue == 0) {
+        this.modelRightTableData.forEach((v) => {
+          v.num = v.remain_num;
+        });
+        this.axios
+          .post("/api/orders_transport_alloy_save", {
+            ...this.$route.query,
+            children: this.modelRightTableData,
           })
-        },
-        changeDetailSize(e){
-            this.pageDetailSize = e;
-            this.pageDetailIndex = 1;
-            this.handelDetail(this.detailProxyData)
-        },
-        changeDetailPage(e){
-            this.pageDetailIndex = e;
-              this.handelDetail(this.detailProxyData)
-        },
-        changeModelSize(e){
-           this.pageModelSize = e;
-           this.pageModelIndex = 1;
-           this.initModalData(this.proxyData);
-        },
-        changeModelPage(e){
-            this.pageModelIndex = e;
-              this.initModalData(this.proxyData);
-        },
-        changeSize(e){
-              this.pageSize = e;
-              this.pageIndex =1;
+          .then((res) => {
+            if (res.code == 200) {
+              this.$Message.success(res.msg);
+              this.add_show = false;
+              this.pageIndex = 1;
               this.initData();
-        },
-        changePage(e){
-          this.pageIndex = e;
-          this.initData();
-        },
-        back(){
-            this.$router.go(-1);
-        },
-        
-    }
-}
+            }
+          });
+      } else {
+        return this.$Message.warning("数量不足,请重新输入");
+      }
+    },
+    modelSearch() {
+      this.pageModelIndex = 1;
+      this.initModalData(this.modelData);
+    },
+    delSelectData(row, index) {
+      this.modelSelectData.splice(index, 1);
+      this.modelRightTableData.splice(index, 1);
+      this.modelLeftTableData.forEach((element, indx) => {
+        if (element.id == row.id) {
+          this.$refs.modelTable.toggleSelect(indx);
+        }
+      });
+    },
+    modelTableChoose(e) {
+      this.modelSelectData = e;
+      this.modelRightTableData = JSON.parse(
+        JSON.stringify(this.modelSelectData)
+      );
+    },
+    initModalData(row) {
+      this.proxyData = row;
+      this.axios
+        .get("/api/orders_transport_alloy_material", {
+          params: {
+            order_no: this.$route.query.order_no,
+            ...row,
+            page_size: this.pageModelSize,
+            page_index: this.pageModelIndex,
+          },
+        })
+        .then((res) => {
+          this.modelLeftTableData = res.data.data;
+          this.ModelTotal = res.data.total;
+        });
+    },
+    addShow() {
+      this.modelSelectData = [];
+      this.modelRightTableData = [];
+      this.initModalData();
+      //    this.modelLeftTableData = JSON.parse(JSON.stringify(this.modelLeftTableData));
+      this.add_show = true;
+    },
+    initData() {
+      this.axios
+        .get("/api/orders_transport_alloy_list", {
+          params: {
+            ...this.$route.query,
+            page_size: this.pageSize,
+            page_index: this.pageIndex,
+          },
+        })
+        .then((res) => {
+          this.tableData = res.data.data;
+          this.total = res.data.total;
+          this.formData.order_no = res.data.order_no;
+          this.formData.residential_name = res.data.residential_name;
+          this.formData.transport_no = res.data.transport_no;
+        });
+    },
+    changeDetailSize(e) {
+      this.pageDetailSize = e;
+      this.pageDetailIndex = 1;
+      this.handelDetail(this.detailProxyData);
+    },
+    changeDetailPage(e) {
+      this.pageDetailIndex = e;
+      this.handelDetail(this.detailProxyData);
+    },
+    changeModelSize(e) {
+      this.pageModelSize = e;
+      this.pageModelIndex = 1;
+      this.initModalData(this.proxyData);
+    },
+    changeModelPage(e) {
+      this.pageModelIndex = e;
+      this.initModalData(this.proxyData);
+    },
+    changeSize(e) {
+      this.pageSize = e;
+      this.pageIndex = 1;
+      this.initData();
+    },
+    changePage(e) {
+      this.pageIndex = e;
+      this.initData();
+    },
+    back() {
+      this.$router.go(-1);
+    },
+  },
+};
 </script>
 <style lang="scss" scoped>
-.add_btn{
-    display: flex;
-    flex-direction:row-reverse;
-    margin-bottom: 10px;
-}
-.form_style{
-    margin-top: 10px;
-    display: flex;
-    flex-wrap: wrap;
-    .form_item{
-        width: 300px;
-    }
-}
-.footer{
-    text-align: center;
-    margin-top: 15px;
+.add_btn {
+  display: flex;
+  flex-direction: row-reverse;
+  margin-bottom: 10px;
 }
-.content{
-    height: 85%;
-    overflow: auto;
+.form_style {
+  margin-top: 10px;
+  display: flex;
+  flex-wrap: wrap;
+  .form_item {
+    width: 300px;
+  }
 }
-.model_content{
-    display: flex;
-    justify-content: space-between;
-    .model_left{
-     width: 58%;
-     height: 500px;
-    
-     .model_left_content{
-         height: 92%;
-         overflow: auto;
-          .model_left_form{
-         display: flex;
-         flex-wrap: wrap;
-         .model_form_item{
-             width: 200px;
-         }
-     }
-     }
-    
-     .model_footer{
-         text-align: center;
-         margin-top: 10px;
-     }
+.footer {
+  text-align: center;
+  margin-top: 15px;
 }
-.model_right{
-     width:40%;
-     height: 500px;
+.content {
+  height: 85%;
+  overflow: auto;
 }
+.model_content {
+  display: flex;
+  justify-content: space-between;
+  .model_left {
+    width: 58%;
+    height: 500px;
+
+    .model_left_content {
+      height: 92%;
+      overflow: auto;
+      .model_left_form {
+        display: flex;
+        flex-wrap: wrap;
+        .model_form_item {
+          width: 200px;
+        }
+      }
+    }
+
+    .model_footer {
+      text-align: center;
+      margin-top: 10px;
+    }
+  }
+  .model_right {
+    width: 40%;
+    height: 500px;
+  }
 }
-/deep/.ivu-input-small{
-     font-size: 9px;
-    // transform:scale(0.75);
-    // -ms-transform:scale(0.75);     /* IE 9 */
-    // -moz-transform:scale(0.75);     /* Firefox */
-    // -webkit-transform:scale(0.75); /* Safari 和 Chrome */
-    // -o-transform:scale(0.75);     /* Opera */
+/deep/.ivu-input-small {
+  font-size: 9px;
+  // transform:scale(0.75);
+  // -ms-transform:scale(0.75);     /* IE 9 */
+  // -moz-transform:scale(0.75);     /* Firefox */
+  // -webkit-transform:scale(0.75); /* Safari 和 Chrome */
+  // -o-transform:scale(0.75);     /* Opera */
 }
 </style>